[Commits] c51f85f8823: Merge branch '10.2' into 10.3
revision-id: c51f85f8823a845cd4a6aa1b2aa5af18484b2ab0 (mariadb-10.3.12-188-gc51f85f8823) parent(s): a89f199c64a1d2339de7c167ce64ec148061a4d3 8ce702aa90c174566f4ac950e85cc7570bf9b647 author: Oleksandr Byelkin committer: Oleksandr Byelkin timestamp: 2019-05-12 17:20:23 +0200 message: Merge branch '10.2' into 10.3 CMakeLists.txt | 2 +- README.md | 8 +- COPYING.thirdparty => THIRDPARTY | 0 client/mysql_plugin.c | 8 +- client/mysqldump.c | 63 ++-- client/mysqlimport.c | 2 +- include/my_tree.h | 2 +- libmariadb | 2 +- mysql-test/include/ctype_like_escape.inc | 6 + mysql-test/lib/generate-ssl-certs.sh | 2 +- mysql-test/main/bootstrap.test | 9 + mysql-test/main/create_drop_binlog.result | 4 + mysql-test/main/create_drop_event.result | 5 + mysql-test/main/ctype_big5.result | 12 + mysql-test/main/ctype_euckr.result | 12 + mysql-test/main/ctype_gb2312.result | 12 + mysql-test/main/ctype_gbk.result | 12 + mysql-test/main/ctype_latin1.result | 12 + mysql-test/main/ctype_sjis.result | 12 + mysql-test/main/ctype_tis620.result | 12 + mysql-test/main/ctype_uca.result | 6 + mysql-test/main/ctype_ucs.result | 12 + mysql-test/main/ctype_ujis.result | 12 + mysql-test/main/ctype_utf16.result | 12 + mysql-test/main/ctype_utf16_uca.result | 6 + mysql-test/main/ctype_utf16le.result | 12 + mysql-test/main/ctype_utf32.result | 12 + mysql-test/main/ctype_utf32_uca.result | 6 + mysql-test/main/ctype_utf8.result | 12 + mysql-test/main/ctype_utf8mb4.result | 12 + mysql-test/main/ctype_utf8mb4_heap.result | 12 + mysql-test/main/ctype_utf8mb4_innodb.result | 12 + mysql-test/main/ctype_utf8mb4_myisam.result | 12 + mysql-test/main/ddl_i18n_koi8r.result | 8 + mysql-test/main/ddl_i18n_utf8.result | 8 + mysql-test/main/derived_cond_pushdown.result | 50 +++ mysql-test/main/derived_cond_pushdown.test | 14 + mysql-test/main/events_1.result | 68 ++++ mysql-test/main/events_2.result | 30 ++ mysql-test/main/events_bugs.result | 54 ++++ mysql-test/main/events_grant.result | 10 + mysql-test/main/events_restart.result | 26 +- mysql-test/main/events_stress.test | 1 + mysql-test/main/events_trans.result | 9 + mysql-test/main/flush_read_lock.result | 2 + mysql-test/main/func_gconcat.result | 30 +- mysql-test/main/func_gconcat.test | 33 +- mysql-test/main/func_hybrid_type.result | 30 ++ mysql-test/main/func_hybrid_type.test | 20 ++ mysql-test/main/func_str.result | 38 +++ mysql-test/main/func_str.test | 36 +++ mysql-test/main/gis.result | 28 +- mysql-test/main/gis.test | 35 ++- mysql-test/main/gis2.result | 38 --- mysql-test/main/gis2.test | 45 --- mysql-test/main/gis_notembedded.result | 45 +++ mysql-test/main/gis_notembedded.test | 24 ++ mysql-test/main/grant4.result | 21 ++ mysql-test/main/grant4.test | 31 +- mysql-test/main/information_schema_prepare.result | 4 + mysql-test/main/information_schema_prepare.test | 7 + mysql-test/main/lock_sync.result | 4 + mysql-test/main/mdev_19276.result | 11 + mysql-test/main/mdev_19276.test | 17 + mysql-test/main/multi_update.result | 23 ++ mysql-test/main/multi_update.test | 31 ++ ...lti_update2-master.opt => multi_update_big.opt} | 0 ...ulti_update2.result => multi_update_big.result} | 0 .../{multi_update2.test => multi_update_big.test} | 0 mysql-test/main/mysqldump-compat.result | 4 + mysql-test/main/mysqldump-compat.test | 13 + mysql-test/main/mysqldump.result | 16 + mysql-test/main/partition_innodb.result | 42 +++ mysql-test/main/partition_innodb.test | 25 ++ mysql-test/main/ps.result | 23 ++ mysql-test/main/ps.test | 16 + mysql-test/main/show_check.result | 4 + mysql-test/main/sp_notembedded.result | 2 + mysql-test/main/ssl_verify_ip.opt | 3 + mysql-test/main/ssl_verify_ip.result | 4 + mysql-test/main/ssl_verify_ip.test | 3 + mysql-test/main/stat_tables.result | 18 ++ mysql-test/main/stat_tables.test | 21 ++ mysql-test/main/stat_tables_innodb.result | 18 ++ mysql-test/main/statistics.result | 14 + mysql-test/main/statistics.test | 15 + mysql-test/main/status2.result | 4 +- mysql-test/main/status2.test | 4 +- mysql-test/main/timezone2.result | 33 ++ mysql-test/main/timezone2.test | 31 ++ mysql-test/main/type_bit.result | 7 + mysql-test/main/type_bit.test | 9 + mysql-test/main/view_grant.result | 4 + mysql-test/main/view_grant.test | 5 + mysql-test/main/win.result | 89 ++++++ mysql-test/main/win.test | 60 ++++ mysql-test/mysql-test-run.pl | 4 + mysql-test/std_data/serversan-cert.pem | 110 +++---- mysql-test/std_data/serversan-key.pem | 52 ++-- mysql-test/suite.pm | 4 + mysql-test/suite/binlog/r/binlog_mdev717.result | 2 + mysql-test/suite/binlog/r/binlog_sql_mode.result | 2 + mysql-test/suite/compat/oracle/r/events.result | 2 + .../suite/funcs_1/r/is_routines_embedded.result | 12 + mysql-test/suite/galera/r/galera_events.result | 2 + .../r/galera_parallel_autoinc_largetrx.result | 8 +- .../r/galera_parallel_autoinc_manytrx.result | 33 +- .../galera/t/galera_parallel_autoinc_largetrx.test | 10 +- .../galera/t/galera_parallel_autoinc_manytrx.test | 87 ++++-- .../suite/gcol/r/innodb_virtual_purge.result | 17 + mysql-test/suite/gcol/t/innodb_virtual_purge.test | 35 +++ mysql-test/suite/innodb/r/foreign-keys.result | 24 ++ mysql-test/suite/innodb/r/innodb-index.result | 27 ++ mysql-test/suite/innodb/r/innodb-truncate.result | 13 + .../innodb/r/innodb_skip_innodb_is_tables.result | 6 +- mysql-test/suite/innodb/r/xa_debug.result | 1 + mysql-test/suite/innodb/t/foreign-keys.test | 32 ++ mysql-test/suite/innodb/t/innodb-index.test | 20 ++ mysql-test/suite/innodb/t/innodb-truncate.test | 19 ++ mysql-test/suite/innodb/t/xa_debug.test | 1 + .../suite/perfschema/r/pfs_upgrade_event.result | 2 + mysql-test/suite/plugins/r/pam.result | 20 ++ mysql-test/suite/plugins/t/pam.test | 24 +- mysql-test/suite/rpl/r/kill_race_condition.result | 18 ++ .../suite/rpl/r/rpl_create_drop_event.result | 4 + mysql-test/suite/rpl/r/rpl_current_user.result | 2 + mysql-test/suite/rpl/r/rpl_events.result | 6 + mysql-test/suite/rpl/r/rpl_heartbeat_basic.result | 2 + mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result | 2 + mysql-test/suite/rpl/r/rpl_invoked_features.result | 4 + mysql-test/suite/rpl/r/rpl_killed_ddl.result | 2 + .../rpl/r/rpl_mixed_implicit_commit_binlog.result | 2 + .../rpl/r/rpl_row_implicit_commit_binlog.result | 2 + .../rpl/r/rpl_stm_implicit_commit_binlog.result | 2 + .../suite/rpl/r/rpl_tmp_table_and_DDL.result | 4 + mysql-test/suite/rpl/t/kill_race_condition.test | 28 ++ .../r/innodb_ft_result_cache_limit,32bit.rdiff | 11 + ....result => innodb_ft_result_cache_limit.result} | 0 .../r/innodb_ft_result_cache_limit_32.result | 7 - .../r/sysvars_innodb,32bit,xtradb.rdiff-disabled | 4 +- .../r/sysvars_innodb,xtradb.rdiff-disabled | 4 +- ...t_32.test => innodb_ft_result_cache_limit.test} | 2 +- .../t/innodb_ft_result_cache_limit_64.test | 9 - .../t/transaction_prealloc_size_bug27322.test | 9 +- mysys/tree.c | 48 ++- pcre/AUTHORS | 6 +- pcre/ChangeLog | 43 +++ pcre/LICENCE | 10 +- pcre/NEWS | 10 + pcre/configure.ac | 10 +- pcre/pcre_compile.c | 18 +- pcre/pcre_jit_compile.c | 2 +- pcre/pcrecpp.cc | 64 +++- pcre/pcrecpp_unittest.cc | 34 +- pcre/pcregrep.c | 4 +- pcre/testdata/testinput1 | 15 + pcre/testdata/testinput2 | 3 + pcre/testdata/testinput4 | 3 + pcre/testdata/testoutput1 | 24 ++ pcre/testdata/testoutput2 | 4 + pcre/testdata/testoutput4 | 4 + plugin/auth_pam/auth_pam.c | 10 +- scripts/maria_add_gis_sp.sql.in | 4 +- scripts/mysql_install_db.sh | 3 +- sql-common/client.c | 6 +- sql/events.cc | 6 + sql/field.cc | 2 +- sql/gen_win_tzname_data.ps1 | 11 + sql/ha_partition.cc | 11 +- sql/handler.h | 5 +- sql/item_func.h | 1 + sql/item_sum.cc | 93 +++++- sql/item_sum.h | 8 +- sql/log_event.cc | 23 +- sql/log_event_old.cc | 19 +- sql/mysql_upgrade_service.cc | 3 +- sql/mysqld.cc | 48 ++- sql/mysqld.h | 2 +- sql/share/errmsg-utf8.txt | 4 +- sql/sp_head.cc | 2 +- sql/sql_acl.cc | 33 +- sql/sql_base.cc | 102 +++--- sql/sql_base.h | 17 +- sql/sql_class.h | 1 + sql/sql_db.cc | 22 +- sql/sql_db.h | 2 +- sql/sql_lex.h | 2 +- sql/sql_parse.cc | 16 +- sql/sql_select.cc | 54 ++-- sql/sql_show.cc | 1 - sql/sql_statistics.cc | 20 +- sql/sql_string.cc | 21 ++ sql/sql_table.cc | 95 +++--- sql/sql_truncate.cc | 14 +- sql/sql_update.cc | 36 ++- sql/sql_view.cc | 3 +- sql/sql_window.cc | 27 ++ sql/sql_yacc.yy | 35 ++- sql/sql_yacc_ora.yy | 35 ++- sql/table.cc | 3 +- sql/table.h | 1 + sql/win_tzname_data.h | 136 ++++++++ storage/connect/filter.h | 1 + storage/connect/ha_connect.cc | 84 +++-- storage/connect/ha_connect.h | 3 +- storage/connect/jmgoconn.cpp | 4 +- storage/connect/tabdos.cpp | 42 +-- storage/connect/tabfmt.cpp | 13 +- storage/connect/user_connect.cc | 3 +- storage/connect/value.cpp | 97 +++--- storage/connect/value.h | 16 +- storage/innobase/buf/buf0dblwr.cc | 7 +- storage/innobase/dict/dict0stats.cc | 4 +- storage/innobase/fil/fil0fil.cc | 3 +- storage/innobase/fts/fts0config.cc | 9 +- storage/innobase/fts/fts0fts.cc | 46 +-- storage/innobase/fts/fts0opt.cc | 245 ++++++--------- storage/innobase/fts/fts0que.cc | 4 +- storage/innobase/fts/fts0sql.cc | 103 +++--- storage/innobase/gis/gis0rtree.cc | 9 +- storage/innobase/handler/ha_innodb.cc | 4 + storage/innobase/handler/handler0alter.cc | 25 +- storage/innobase/include/fil0fil.h | 3 +- storage/innobase/include/fts0fts.h | 12 +- storage/innobase/include/fts0priv.h | 132 ++++---- storage/innobase/include/handler0alter.h | 11 +- storage/innobase/log/log0log.cc | 6 - storage/innobase/read/read0read.cc | 2 +- storage/innobase/row/row0ftsort.cc | 1 - storage/innobase/row/row0merge.cc | 4 +- storage/innobase/row/row0purge.cc | 8 + storage/innobase/row/row0trunc.cc | 2 +- storage/innobase/srv/srv0mon.cc | 28 +- storage/innobase/ut/ut0timer.cc | 34 +- storage/perfschema/pfs_timer.cc | 23 +- storage/perfschema/pfs_timer.h | 2 +- storage/perfschema/table_performance_timers.cc | 10 +- storage/perfschema/unittest/pfs_server_stubs.cc | 2 + storage/perfschema/unittest/pfs_timer-t.cc | 2 + .../rocksdb/r/innodb_i_s_tables_disabled.result | 344 +++++++++++++++++++++ .../t/innodb_i_s_tables_disabled-master.opt | 30 ++ .../rocksdb/t/innodb_i_s_tables_disabled.test | 43 +++ storage/tokudb/.clang-format | 40 +++ storage/tokudb/ha_tokudb.cc | 28 +- storage/tokudb/ha_tokudb.h | 2 +- storage/tokudb/ha_tokudb_mrr_mysql.cc | 1 + .../mysql-test/rpl/r/rpl_tokudb_mixed_dml.result | 2 + .../tokudb/mysql-test/tokudb_bugs/r/PS-5158.result | 6 + .../tokudb/mysql-test/tokudb_bugs/r/PS-5163.result | 5 + .../mysql-test/tokudb_bugs/t/PS-5158-master.opt | 2 + .../tokudb/mysql-test/tokudb_bugs/t/PS-5158.test | 27 ++ .../tokudb/mysql-test/tokudb_bugs/t/PS-5163.test | 11 + support-files/rpm/server-postin.sh | 6 +- support-files/rpm/server-posttrans.sh | 7 +- support-files/rpm/server-preun.sh | 18 +- 255 files changed, 3975 insertions(+), 1186 deletions(-) diff --cc mysql-test/main/bootstrap.test index 414deede892,00000000000..97f5da86096 mode 100644,000000..100644 --- a/mysql-test/main/bootstrap.test +++ b/mysql-test/main/bootstrap.test @@@ -1,117 -1,0 +1,126 @@@ +# +# test mysqld in bootstrap mode +# +--disable_warnings +drop table if exists t1; +--enable_warnings + +# Add the datadir to the bootstrap command +let $MYSQLD_DATADIR= `select @@datadir`; +let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR --default-storage-engine=MyISAM --loose-skip-innodb --plugin-maturity=unknown; +# +# Check that --bootstrap reads from stdin +# +--write_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql +use test; +CREATE TABLE t1(a int); +EOF +--exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1 +drop table t1; +remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql; +# +# Check that --bootstrap of file with SQL error returns error +# +--write_file $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql +use test; +CREATE TABLE t1; +EOF +--error 1 +--exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1 +# Table t1 should not exists +--error 1051 +drop table t1; +remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql; + +# +# Bootstrap with a query larger than 2*thd->net.max_packet +# +set @my_max_allowed_packet= @@max_allowed_packet; +set global max_allowed_packet=64*@@max_allowed_packet; +--disable_query_log +create table t1 select 2 as a, concat(repeat('MySQL', @@max_allowed_packet/10), ';') as b; +eval select * into outfile '$MYSQLTEST_VARDIR/tmp/long_query.sql' from t1; +--enable_query_log +--error 1 +--exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/long_query.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1 +remove_file $MYSQLTEST_VARDIR/tmp/long_query.sql; + +set global max_allowed_packet=@my_max_allowed_packet; +drop table t1; + +--echo End of 5.1 tests + +--echo # +--echo # Bug #11766306: 59393: HAVE_INNODB=YES WHEN MYSQLD +--echo # STARTED WITH --SKIP-INNODB +--echo # + +# need the --skip-innodb option present for the test to succeed +SELECT 'bug' as '' FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb' + and SUPPORT='YES'; + +# +# MDEV-13063 Server crashes in intern_plugin_lock or assertion `plugin_ptr->ref_count == 1' fails in plugin_init +# +--error 1 +--exec $MYSQLD_BOOTSTRAP_CMD --myisam_recover_options=NONE + ++# ++# MDEV-19349 mysql_install_db: segfault at tmp_file_prefix check ++# ++--write_file $MYSQLTEST_VARDIR/tmp/1 ++use test; ++EOF ++--exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/1 >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1 ++--remove_file $MYSQLTEST_VARDIR/tmp/1 ++ +--echo End of 5.5 tests + +--source include/not_windows_embedded.inc +--source include/have_example_plugin.inc +# +# Check that --bootstrap can install and uninstall plugins +# +let $PLUGIN_DIR=`select @@plugin_dir`; +--write_file $MYSQLTEST_VARDIR/tmp/install_plugin.sql +install soname 'ha_example'; +uninstall plugin unusable; +EOF +--exec $MYSQLD_BOOTSTRAP_CMD --plugin-dir=$PLUGIN_DIR < $MYSQLTEST_VARDIR/tmp/install_plugin.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1 +--remove_file $MYSQLTEST_VARDIR/tmp/install_plugin.sql + +# +# Check that installed plugins are *not* automatically loaded in --bootstrap +# +--write_file $MYSQLTEST_VARDIR/tmp/bootstrap_plugins.sql +SET SQL_MODE=""; +use test; +create table t1(a int) engine=example charset=latin1; +EOF +--exec $MYSQLD_BOOTSTRAP_CMD --plugin-dir=$PLUGIN_DIR < $MYSQLTEST_VARDIR/tmp/bootstrap_plugins.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1 +--remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_plugins.sql +flush tables; +show create table t1; +drop table t1; +--replace_result .dll .so +select * from mysql.plugin; +truncate table mysql.plugin; + + +# +# MDEV-9969 mysql_install_db error processing ignore_db_dirs. +# +--write_file $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql +use test; +EOF +--exec $MYSQLD_BOOTSTRAP_CMD --ignore-db-dirs='some_dir' --ignore-db-dirs='some_dir' < $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1 +--remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql + +# +# MDEV-13397 MariaDB upgrade fail when using default_time_zone +# +--write_file $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql +use test; +EOF +--exec $MYSQLD_BOOTSTRAP_CMD --default-time-zone=Europe/Moscow < $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1 +--remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql diff --cc mysql-test/main/create_drop_binlog.result index be40fcc140a,00000000000..39d5754224c mode 100644,000000..100644 --- a/mysql-test/main/create_drop_binlog.result +++ b/mysql-test/main/create_drop_binlog.result @@@ -1,393 -1,0 +1,397 @@@ +reset master; +CREATE OR REPLACE DATABASE d1; +CREATE OR REPLACE DATABASE d1; +DROP DATABASE d1; +CREATE DATABASE IF NOT EXISTS d1; +CREATE DATABASE IF NOT EXISTS d1; +Warnings: +Note 1007 Can't create database 'd1'; database exists +DROP DATABASE IF EXISTS d1; +DROP DATABASE IF EXISTS d1; +Warnings: +Note 1008 Can't drop database 'd1'; database doesn't exist +"Runnig SHOW BINLOG EVENTS" +Log_name Pos Event_type Server_id End_log_pos Info +# # Gtid 1 # GTID #-#-# +# # Query 1 # CREATE OR REPLACE DATABASE d1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # CREATE OR REPLACE DATABASE d1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # DROP DATABASE d1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # CREATE DATABASE IF NOT EXISTS d1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # CREATE DATABASE IF NOT EXISTS d1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # DROP DATABASE IF EXISTS d1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # DROP DATABASE IF EXISTS d1 +RESET MASTER; +USE test; +CREATE OR REPLACE FUNCTION f1() RETURNS INT RETURN 1; +CREATE OR REPLACE FUNCTION f1() RETURNS INT RETURN 1; +DROP FUNCTION f1; +CREATE FUNCTION IF NOT EXISTS f1() RETURNS INT RETURN 1; +CREATE FUNCTION IF NOT EXISTS f1() RETURNS INT RETURN 1; +Warnings: +Note 1304 FUNCTION f1 already exists +DROP FUNCTION IF EXISTS f1; +DROP FUNCTION IF EXISTS f1; +Warnings: +Note 1305 FUNCTION test.f1 does not exist +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +# # Format_desc 1 # VER +# # Gtid_list 1 # [] +# # Binlog_checkpoint 1 # master-bin.000001 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) +RETURN 1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) +RETURN 1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP FUNCTION f1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION IF NOT EXISTS `f1`() RETURNS int(11) +RETURN 1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION IF NOT EXISTS `f1`() RETURNS int(11) +RETURN 1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP FUNCTION IF EXISTS f1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP FUNCTION IF EXISTS f1 +RESET MASTER; +CREATE TABLE t1 (a DATETIME); +CREATE OR REPLACE PROCEDURE p1() DELETE FROM t1; +CREATE OR REPLACE PROCEDURE p1() DELETE FROM t1; +DROP PROCEDURE p1; +CREATE PROCEDURE IF NOT EXISTS p1() DELETE FROM t1; +CREATE PROCEDURE IF NOT EXISTS p1() DELETE FROM t1; +Warnings: +Note 1304 PROCEDURE p1 already exists +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS p1; +Warnings: +Note 1305 PROCEDURE test.p1 does not exist +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +# # Format_desc 1 # VER +# # Gtid_list 1 # [] +# # Binlog_checkpoint 1 # master-bin.000001 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE TABLE t1 (a DATETIME) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `p1`() +DELETE FROM t1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `p1`() +DELETE FROM t1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP PROCEDURE p1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE IF NOT EXISTS `p1`() +DELETE FROM t1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE IF NOT EXISTS `p1`() +DELETE FROM t1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP PROCEDURE IF EXISTS p1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP PROCEDURE IF EXISTS p1 +DROP TABLE t1; +RESET MASTER; +CREATE OR REPLACE FUNCTION metaphon RETURNS STRING SONAME 'UDF_EXAMPLE_LIB'; +CREATE OR REPLACE FUNCTION metaphon RETURNS STRING SONAME 'UDF_EXAMPLE_LIB'; +DROP FUNCTION metaphon; +CREATE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME 'UDF_EXAMPLE_LIB'; +CREATE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME 'UDF_EXAMPLE_LIB'; +Warnings: +Note 1125 Function 'metaphon' already exists +DROP FUNCTION IF EXISTS metaphon; +DROP FUNCTION IF EXISTS metaphon; +Warnings: +Note 1305 FUNCTION test.metaphon does not exist +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +# # Format_desc 1 # VER +# # Gtid_list 1 # [] +# # Binlog_checkpoint 1 # master-bin.000001 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE FUNCTION metaphon RETURNS STRING SONAME 'UDM_EXAMPLE_LIB' +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE FUNCTION metaphon RETURNS STRING SONAME 'UDM_EXAMPLE_LIB' +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP FUNCTION metaphon +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME 'UDM_EXAMPLE_LIB' +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME 'UDM_EXAMPLE_LIB' +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP FUNCTION IF EXISTS metaphon +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP FUNCTION IF EXISTS metaphon +RESET MASTER; +# +# CREATE SERVER is not logged +# +CREATE OR REPLACE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'root', HOST 'localhost', DATABASE 'test'); +CREATE OR REPLACE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'root', HOST 'localhost', DATABASE 'test'); +DROP SERVER s1; +CREATE SERVER IF NOT EXISTS s1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'root', HOST 'localhost', DATABASE 'test'); +CREATE SERVER IF NOT EXISTS s1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'root', HOST 'localhost', DATABASE 'test'); +Warnings: +Note 1476 The foreign server, s1, you are trying to create already exists +DROP SERVER IF EXISTS s1; +DROP SERVER IF EXISTS s1; +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +# # Format_desc 1 # VER +# # Gtid_list 1 # [] +# # Binlog_checkpoint 1 # master-bin.000001 +RESET MASTER; +CREATE OR REPLACE VIEW v1 AS SELECT 1; +CREATE OR REPLACE VIEW v1 AS SELECT 1; +DROP VIEW v1; +CREATE VIEW IF NOT EXISTS v1 AS SELECT 1; +CREATE VIEW IF NOT EXISTS v1 AS SELECT 1; +Warnings: +Note 1050 Table 'v1' already exists +DROP VIEW IF EXISTS v1; +DROP VIEW IF EXISTS v1; +Warnings: +Note 4092 Unknown VIEW: 'test.v1' +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +# # Format_desc 1 # VER +# # Gtid_list 1 # [] +# # Binlog_checkpoint 1 # master-bin.000001 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS SELECT 1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS SELECT 1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP VIEW v1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW IF NOT EXISTS `v1` AS SELECT 1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW IF NOT EXISTS `v1` AS SELECT 1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP VIEW IF EXISTS v1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP VIEW IF EXISTS v1 +RESET MASTER; +CREATE OR REPLACE ROLE r1; +CREATE OR REPLACE ROLE r1; +DROP ROLE r1; +CREATE ROLE IF NOT EXISTS r1; +CREATE ROLE IF NOT EXISTS r1; +Warnings: +Note 1975 Can't create role 'r1'; it already exists +DROP ROLE IF EXISTS r1; +DROP ROLE IF EXISTS r1; +Warnings: +Note 1976 Can't drop role 'r1'; it doesn't exist +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +# # Format_desc 1 # VER +# # Gtid_list 1 # [] +# # Binlog_checkpoint 1 # master-bin.000001 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE ROLE r1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE ROLE r1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP ROLE r1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE ROLE IF NOT EXISTS r1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE ROLE IF NOT EXISTS r1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP ROLE IF EXISTS r1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP ROLE IF EXISTS r1 +RESET MASTER; +CREATE OR REPLACE USER u1@localhost; +CREATE OR REPLACE USER u1@localhost; +DROP USER u1@localhost; +CREATE USER IF NOT EXISTS u1@localhost; +CREATE USER IF NOT EXISTS u1@localhost; +Warnings: +Note 1973 Can't create user 'u1'@'localhost'; it already exists +DROP USER IF EXISTS u1@localhost; +DROP USER IF EXISTS u1@localhost; +Warnings: +Note 1974 Can't drop user 'u1'@'localhost'; it doesn't exist +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +# # Format_desc 1 # VER +# # Gtid_list 1 # [] +# # Binlog_checkpoint 1 # master-bin.000001 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE USER u1@localhost +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE USER u1@localhost +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP USER u1@localhost +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE USER IF NOT EXISTS u1@localhost +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE USER IF NOT EXISTS u1@localhost +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP USER IF EXISTS u1@localhost +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP USER IF EXISTS u1@localhost +RESET MASTER; +SET timestamp=UNIX_TIMESTAMP('2014-11-01 10:20:30'); +CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE IF EXISTS t1; ++Warnings: ++Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. +CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE IF EXISTS t2; ++Warnings: ++Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. +SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS; +EVENT_NAME EVENT_DEFINITION +ev1 DROP TABLE IF EXISTS t2 +DROP EVENT ev1; +DROP EVENT IF EXISTS ev1; +Warnings: +Note 1305 Event ev1 does not exist +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +# # Format_desc 1 # VER +# # Gtid_list 1 # [] +# # Binlog_checkpoint 1 # master-bin.000001 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE IF EXISTS t1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE IF EXISTS t2 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP EVENT ev1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP EVENT IF EXISTS ev1 +RESET MASTER; +CREATE TABLE t1 (a INT); +CREATE OR REPLACE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=10; +CREATE OR REPLACE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=11; +DROP TRIGGER tr1; +CREATE TRIGGER IF NOT EXISTS tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=20; +CREATE TRIGGER IF NOT EXISTS tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=21; +Warnings: +Note 1359 Trigger 'test.tr1' already exists +DROP TRIGGER IF EXISTS tr1; +DROP TRIGGER IF EXISTS tr1; +Warnings: +Note 1360 Trigger does not exist +DROP TABLE t1; +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +# # Format_desc 1 # VER +# # Gtid_list 1 # [] +# # Binlog_checkpoint 1 # master-bin.000001 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE TABLE t1 (a INT) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=10 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=11 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP TRIGGER tr1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` TRIGGER IF NOT EXISTS tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=20 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` TRIGGER IF NOT EXISTS tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=21 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP TRIGGER IF EXISTS tr1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP TRIGGER IF EXISTS tr1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP TABLE `t1` /* generated by server */ +RESET MASTER; +CREATE TABLE t1(a INT, b INT); +CREATE TABLE IF NOT EXISTS t1(a INT, b INT); +Warnings: +Note 1050 Table 't1' already exists +CREATE OR REPLACE INDEX i1 ON t1(a); +CREATE OR REPLACE INDEX i1 ON t1(a); +CREATE OR REPLACE INDEX i1 ON t1(a,b); +CREATE OR REPLACE INDEX i1 ON t1(a,b); +DROP TABLE t1; +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +# # Format_desc 1 # VER +# # Gtid_list 1 # [] +# # Binlog_checkpoint 1 # master-bin.000001 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE TABLE t1(a INT, b INT) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE TABLE IF NOT EXISTS t1(a INT, b INT) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE INDEX i1 ON t1(a) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE INDEX i1 ON t1(a) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE INDEX i1 ON t1(a,b) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE OR REPLACE INDEX i1 ON t1(a,b) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP TABLE `t1` /* generated by server */ +RESET MASTER; +RESET MASTER; +SHOW MASTER STATUS; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 <pos> +RESET MASTER TO 100; +SHOW MASTER STATUS; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000100 <pos> +RESET MASTER; +SHOW MASTER STATUS; +File Position Binlog_Do_DB Binlog_Ignore_DB +master-bin.000001 <pos> +CREATE TABLE t1(a INT, b INT); +CREATE TABLE IF NOT EXISTS t1(a INT, b INT); +Warnings: +Note 1050 Table 't1' already exists +CREATE INDEX IF NOT EXISTS i1 ON t1(a); +CREATE INDEX IF NOT EXISTS i1 ON t1(a); +Warnings: +Note 1061 Duplicate key name 'i1' +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + KEY `i1` (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP INDEX IF EXISTS i1 ON t1; +DROP INDEX IF EXISTS i1 ON t1; +Warnings: +Note 1091 Can't DROP INDEX `i1`; check that it exists +DROP TABLE t1; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +SHOW BINLOG EVENTS; +Log_name Pos Event_type Server_id End_log_pos Info +# # Format_desc 1 # VER +# # Gtid_list 1 # [] +# # Binlog_checkpoint 1 # master-bin.000001 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE TABLE t1(a INT, b INT) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE TABLE IF NOT EXISTS t1(a INT, b INT) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE INDEX IF NOT EXISTS i1 ON t1(a) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; CREATE INDEX IF NOT EXISTS i1 ON t1(a) +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP INDEX IF EXISTS i1 ON t1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP INDEX IF EXISTS i1 ON t1 +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP TABLE `t1` /* generated by server */ +# # Gtid 1 # GTID #-#-# +# # Query 1 # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */ +RESET MASTER; diff --cc mysql-test/main/ctype_latin1.result index 705c719405b,00000000000..efee1006abf mode 100644,000000..100644 --- a/mysql-test/main/ctype_latin1.result +++ b/mysql-test/main/ctype_latin1.result @@@ -1,8879 -1,0 +1,8891 @@@ +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 C281 81 1 +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 C28D 8D 1 +8E C5BD 8E 1 +8F C28F 8F 1 +90 C290 90 1 +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 C29D 9D 1 +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 1 as �, 2 as �, 3 as �, 4 as �, 5 as �, 6 as �, 7 as �, 8 as �; +� � � � � � � � +1 2 3 4 5 6 7 8 +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 +SET @test_character_set= 'latin1'; +SET @test_collation= 'latin1_swedish_ci'; +SET @safe_character_set_server= @@character_set_server; +SET @safe_collation_server= @@collation_server; +SET @safe_character_set_client= @@character_set_client; +SET @safe_character_set_results= @@character_set_results; +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) latin1_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) latin1_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; +create table t1 (a set('a') not null); +insert ignore into t1 values (),(); +Warnings: +Warning 1364 Field 'a' doesn't have a default value +select cast(a as char(1)) from t1; +cast(a as char(1)) + + +select a sounds like a from t1; +a sounds like a +1 +1 +select 1 from t1 order by cast(a as char(1)); +1 +1 +1 +drop table t1; +# +# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found +# +SET character_set_client=latin1; +SET character_set_connection= @test_character_set; +SET collation_connection= @test_collation; +SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1; +COLLATION('.') c1 +latin1_swedish_ci .wwwmysqlcom +set names utf8; +create table t1 ( +name varchar(10), +level smallint unsigned); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `name` varchar(10) DEFAULT NULL, + `level` smallint(5) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('string',1); +select concat(name,space(level)), concat(name, repeat(' ',level)) from t1; +concat(name,space(level)) concat(name, repeat(' ',level)) +string string +drop table t1; +DROP DATABASE d1; +USE test; +SET character_set_server= @safe_character_set_server; +SET collation_server= @safe_collation_server; +SET character_set_client= @safe_character_set_client; +SET character_set_results= @safe_character_set_results; +SET collation_connection='latin1_swedish_ci'; +create table t1 select repeat('a',4000) a; +delete from t1; +insert into t1 values ('a'), ('a '), ('a\t'); +select collation(a),hex(a) from t1 order by a; +collation(a) hex(a) +latin1_swedish_ci 6109 +latin1_swedish_ci 61 +latin1_swedish_ci 6120 +drop table t1; +# +# MDEV-5453 Assertion `src' fails in my_strnxfrm_unicode on GROUP BY MID(..) WITH ROLLUP +# +SELECT @@collation_connection; +@@collation_connection +latin1_swedish_ci +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +SELECT * FROM t1 GROUP BY MID(CURRENT_USER,0) WITH ROLLUP; +i +1 +1 +SELECT * FROM t1 GROUP BY MID('test',0) WITH ROLLUP; +i +1 +1 +DROP TABLE t1; +# +# MDEV-6170 Incorrect ordering with utf8_bin and utf8mb4_bin collations +# +SELECT @@collation_connection; +@@collation_connection +latin1_swedish_ci +CREATE TABLE t1 ENGINE=MEMORY AS SELECT REPEAT('a',5) AS a LIMIT 0; +INSERT INTO t1 (a) VALUES ("a"); +INSERT INTO t1 (a) VALUES ("b"); +INSERT INTO t1 (a) VALUES ("c"); +INSERT INTO t1 (a) VALUES ("d"); +INSERT INTO t1 (a) VALUES ("e"); +INSERT INTO t1 (a) VALUES ("f"); +INSERT INTO t1 (a) VALUES ("g"); +INSERT INTO t1 (a) VALUES ("h"); +INSERT INTO t1 (a) VALUES ("i"); +INSERT INTO t1 (a) VALUES ("j"); +INSERT INTO t1 (a) VALUES ("k"); +INSERT INTO t1 (a) VALUES ("l"); +INSERT INTO t1 (a) VALUES ("m"); +SELECT * FROM t1 ORDER BY LOWER(a); +a +a +b +c +d +e +f +g +h +i +j +k +l +m +SELECT * FROM t1 ORDER BY LOWER(a) DESC; +a +m +l +k +j +i +h +g +f +e +d +c +b +a +DROP TABLE t1; +select @@collation_connection; +@@collation_connection +latin1_swedish_ci +create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ; +insert into t1 values('abcdef'); +insert into t1 values('_bcdef'); +insert into t1 values('a_cdef'); +insert into t1 values('ab_def'); +insert into t1 values('abc_ef'); +insert into t1 values('abcd_f'); +insert into t1 values('abcde_'); +select c1 as c1u from t1 where c1 like 'ab\_def'; +c1u +ab_def +select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; +c2h +ab_def +drop table t1; ++SELECT @@collation_connection; ++@@collation_connection ++latin1_swedish_ci ++SELECT '\%b' LIKE '%\%'; ++'\%b' LIKE '%\%' ++0 +# +# MDEV-4842 STR_TO_DATE does not work with UCS2/UTF16/UTF32 +# +SELECT @@character_set_connection, HEX(CAST(_utf8'÷' AS CHAR)); +@@character_set_connection HEX(CAST(_utf8'÷' AS CHAR)) +latin1 F7 +SELECT STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR)); +STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR)) +2001-01-01 +CREATE TABLE t1 AS SELECT REPEAT(' ', 64) AS subject, REPEAT(' ',64) AS pattern LIMIT 0; +SHOW COLUMNS FROM t1; +Field Type Null Key Default Extra +subject varchar(64) YES NULL +pattern varchar(64) YES NULL +INSERT INTO t1 VALUES (_utf8'2001÷01÷01',_utf8'%Y÷%m÷%d'); +SELECT HEX(subject),HEX(pattern),STR_TO_DATE(subject, pattern) FROM t1; +HEX(subject) HEX(pattern) STR_TO_DATE(subject, pattern) +32303031F73031F73031 2559F7256DF72564 2001-01-01 00:00:00.000000 +DROP TABLE t1; +SELECT strcmp('a','a '), strcmp('a ','a'); +strcmp('a','a ') strcmp('a ','a') +0 0 +SELECT strcmp('a\0','a' ), strcmp('a','a\0'); +strcmp('a\0','a' ) strcmp('a','a\0') +-1 1 +SELECT strcmp('a\0','a '), strcmp('a ','a\0'); +strcmp('a\0','a ') strcmp('a ','a\0') +-1 1 +SELECT strcmp('a\t','a' ), strcmp('a', 'a\t'); +strcmp('a\t','a' ) strcmp('a', 'a\t') +-1 1 +SELECT strcmp('a\t','a '), strcmp('a ', 'a\t'); +strcmp('a\t','a ') strcmp('a ', 'a\t') +-1 1 +SET collation_connection='latin1_bin'; +create table t1 select repeat('a',4000) a; +delete from t1; +insert into t1 values ('a'), ('a '), ('a\t'); +select collation(a),hex(a) from t1 order by a; +collation(a) hex(a) +latin1_bin 6109 +latin1_bin 61 +latin1_bin 6120 +drop table t1; +# +# MDEV-5453 Assertion `src' fails in my_strnxfrm_unicode on GROUP BY MID(..) WITH ROLLUP +# +SELECT @@collation_connection; +@@collation_connection +latin1_bin +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +SELECT * FROM t1 GROUP BY MID(CURRENT_USER,0) WITH ROLLUP; +i +1 +1 +SELECT * FROM t1 GROUP BY MID('test',0) WITH ROLLUP; +i +1 +1 +DROP TABLE t1; +# +# MDEV-6170 Incorrect ordering with utf8_bin and utf8mb4_bin collations +# +SELECT @@collation_connection; +@@collation_connection +latin1_bin +CREATE TABLE t1 ENGINE=MEMORY AS SELECT REPEAT('a',5) AS a LIMIT 0; +INSERT INTO t1 (a) VALUES ("a"); +INSERT INTO t1 (a) VALUES ("b"); +INSERT INTO t1 (a) VALUES ("c"); +INSERT INTO t1 (a) VALUES ("d"); +INSERT INTO t1 (a) VALUES ("e"); +INSERT INTO t1 (a) VALUES ("f"); +INSERT INTO t1 (a) VALUES ("g"); +INSERT INTO t1 (a) VALUES ("h"); +INSERT INTO t1 (a) VALUES ("i"); +INSERT INTO t1 (a) VALUES ("j"); +INSERT INTO t1 (a) VALUES ("k"); +INSERT INTO t1 (a) VALUES ("l"); +INSERT INTO t1 (a) VALUES ("m"); +SELECT * FROM t1 ORDER BY LOWER(a); +a +a +b +c +d +e +f +g +h +i +j +k +l +m +SELECT * FROM t1 ORDER BY LOWER(a) DESC; +a +m +l +k +j +i +h +g +f +e +d +c +b +a +DROP TABLE t1; +select @@collation_connection; +@@collation_connection +latin1_bin +create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ; +insert into t1 values('abcdef'); +insert into t1 values('_bcdef'); +insert into t1 values('a_cdef'); +insert into t1 values('ab_def'); +insert into t1 values('abc_ef'); +insert into t1 values('abcd_f'); +insert into t1 values('abcde_'); +select c1 as c1u from t1 where c1 like 'ab\_def'; +c1u +ab_def +select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; +c2h +ab_def +drop table t1; ++SELECT @@collation_connection; ++@@collation_connection ++latin1_bin ++SELECT '\%b' LIKE '%\%'; ++'\%b' LIKE '%\%' ++0 +SELECT strcmp('a','a '), strcmp('a ','a'); +strcmp('a','a ') strcmp('a ','a') +0 0 +SELECT strcmp('a\0','a' ), strcmp('a','a\0'); +strcmp('a\0','a' ) strcmp('a','a\0') +-1 1 +SELECT strcmp('a\0','a '), strcmp('a ','a\0'); +strcmp('a\0','a ') strcmp('a ','a\0') +-1 1 +SELECT strcmp('a\t','a' ), strcmp('a', 'a\t'); +strcmp('a\t','a' ) strcmp('a', 'a\t') +-1 1 +SELECT strcmp('a\t','a '), strcmp('a ', 'a\t'); +strcmp('a\t','a ') strcmp('a ', 'a\t') +-1 1 +CREATE TABLE �a (a int); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '�a (a int)' at line 1 +SELECT '�a' as str; +str +�a +set @str= _latin1 'ABC ���߲��~ ������ ����� ����� @ abc'; +SELECT convert(@str collate latin1_bin using utf8); +convert(@str collate latin1_bin using utf8) +ABC ���߲��~ ������ ����� ����� @ abc +SELECT convert(@str collate latin1_general_ci using utf8); +convert(@str collate latin1_general_ci using utf8) +ABC ���߲��~ ������ ����� ����� @ abc +SELECT convert(@str collate latin1_german1_ci using utf8); +convert(@str collate latin1_german1_ci using utf8) +ABC ���߲��~ ������ ����� ����� @ abc +SELECT convert(@str collate latin1_danish_ci using utf8); +convert(@str collate latin1_danish_ci using utf8) +ABC ���߲��~ ������ ����� ����� @ abc +SELECT convert(@str collate latin1_spanish_ci using utf8); +convert(@str collate latin1_spanish_ci using utf8) +ABC ���߲��~ ������ ����� ����� @ abc +SELECT convert(@str collate latin1_german2_ci using utf8); +convert(@str collate latin1_german2_ci using utf8) +ABC ���߲��~ ������ ����� ����� @ abc +SELECT convert(@str collate latin1_swedish_ci using utf8); +convert(@str collate latin1_swedish_ci using utf8) +ABC ���߲��~ ������ ����� ����� @ abc +SET NAMES latin1; +DROP TABLE IF EXISTS `abc�def`; +CREATE TABLE `abc�def` (i int); +INSERT INTO `abc�def` VALUES (1); +INSERT INTO abc�def VALUES (2); +SELECT * FROM `abc�def`; +i +1 +2 +SELECT * FROM abc�def; +i +1 +2 +DROP TABLE `abc�def`; +select hex(cast(_ascii 0x7f as char(1) character set latin1)); +hex(cast(_ascii 0x7f as char(1) character set latin1)) +7F +End of 5.0 tests +# +# Bug#58022 ... like ... escape export_set ( ... ) crashes when export_set returns warnings +# +SELECT '' LIKE '' ESCAPE EXPORT_SET(1, 1, 1, 1, ''); +'' LIKE '' ESCAPE EXPORT_SET(1, 1, 1, 1, '') +1 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '' +End of 5.1 tests +# +# Start of 5.5 tests +# +SET TIME_ZONE = _latin1 '+03:00'; +# +# Start of WL#2649 Number-to-string conversions +# +select hex(concat(1)); +hex(concat(1)) +31 +create table t1 as select concat(1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select hex(c1) from t1; +hex(c1) +31 +drop table t1; +select hex(concat(18446744073709551615)); +hex(concat(18446744073709551615)) +3138343436373434303733373039353531363135 +create table t1 as select concat(18446744073709551615) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select hex(c1) from t1; +hex(c1) +3138343436373434303733373039353531363135 +drop table t1; +select hex(concat(1.1)); +hex(concat(1.1)) +312E31 +create table t1 as select concat(1.1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select hex(c1) from t1; +hex(c1) +312E31 +drop table t1; +select hex(concat('a', 1+2)), charset(concat(1+2)); +hex(concat('a', 1+2)) charset(concat(1+2)) +6133 latin1 +create table t1 as select concat(1+2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(1-2)); +hex(concat(1-2)) +2D31 +create table t1 as select concat(1-2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(1*2)); +hex(concat(1*2)) +32 +create table t1 as select concat(1*2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(1/2)); +hex(concat(1/2)) +302E35303030 +create table t1 as select concat(1/2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(7) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(1 div 2)); +hex(concat(1 div 2)) +30 +create table t1 as select concat(1 div 2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(1 % 2)); +hex(concat(1 % 2)) +31 +create table t1 as select concat(1 % 2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(-1)); +hex(concat(-1)) +2D31 +create table t1 as select concat(-1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(-(1+2))); +hex(concat(-(1+2))) +2D33 +create table t1 as select concat(-(1+2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(1|2)); +hex(concat(1|2)) +33 +create table t1 as select concat(1|2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(1&2)); +hex(concat(1&2)) +30 +create table t1 as select concat(1&2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(bit_count(12))); +hex(concat(bit_count(12))) +32 +create table t1 as select concat(bit_count(12)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(2<<1)); +hex(concat(2<<1)) +34 +create table t1 as select concat(2<<1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(2>>1)); +hex(concat(2>>1)) +31 +create table t1 as select concat(2>>1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(~0)); +hex(concat(~0)) +3138343436373434303733373039353531363135 +create table t1 as select concat(~0) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(3^2)); +hex(concat(3^2)) +31 +create table t1 as select concat(3^2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(abs(-2))); +hex(concat(abs(-2))) +32 +create table t1 as select concat(abs(-2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(exp(2)),1)); +hex(left(concat(exp(2)),1)) +37 +create table t1 as select concat(exp(2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(log(2)),1)); +hex(left(concat(log(2)),1)) +30 +create table t1 as select concat(log(2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(log2(2)),1)); +hex(left(concat(log2(2)),1)) +31 +create table t1 as select concat(log2(2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(log10(2)),1)); +hex(left(concat(log10(2)),1)) +30 +create table t1 as select concat(log10(2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(sqrt(2)),1)); +hex(left(concat(sqrt(2)),1)) +31 +create table t1 as select concat(sqrt(2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(pow(2,2)),1)); +hex(left(concat(pow(2,2)),1)) +34 +create table t1 as select concat(pow(2,2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(acos(0.5)),1)); +hex(left(concat(acos(0.5)),1)) +31 +create table t1 as select concat(acos(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(asin(0.5)),1)); +hex(left(concat(asin(0.5)),1)) +30 +create table t1 as select concat(asin(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(atan(0.5)),1)); +hex(left(concat(atan(0.5)),1)) +30 +create table t1 as select concat(atan(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(cos(0.5)),1)); +hex(left(concat(cos(0.5)),1)) +30 +create table t1 as select concat(cos(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(sin(0.5)),1)); +hex(left(concat(sin(0.5)),1)) +30 +create table t1 as select concat(sin(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(tan(0.5)),1)); +hex(left(concat(tan(0.5)),1)) +30 +create table t1 as select concat(tan(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(degrees(0))); +hex(concat(degrees(0))) +30 +create table t1 as select concat(degrees(0)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(radians(0))); +hex(concat(radians(0))) +30 +create table t1 as select concat(radians(0)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(ceiling(0.5))); +hex(concat(ceiling(0.5))) +31 +create table t1 as select concat(ceiling(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(floor(0.5))); +hex(concat(floor(0.5))) +30 +create table t1 as select concat(floor(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(round(0.5))); +hex(concat(round(0.5))) +31 +create table t1 as select concat(round(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(sign(0.5))); +hex(concat(sign(0.5))) +31 +create table t1 as select concat(sign(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(rand()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(length('a'))); +hex(concat(length('a'))) +31 +create table t1 as select concat(length('a')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(char_length('a'))); +hex(concat(char_length('a'))) +31 +create table t1 as select concat(char_length('a')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(bit_length('a'))); +hex(concat(bit_length('a'))) +38 +create table t1 as select concat(bit_length('a')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(coercibility('a'))); +hex(concat(coercibility('a'))) +34 +create table t1 as select concat(coercibility('a')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(locate('a','a'))); +hex(concat(locate('a','a'))) +31 +create table t1 as select concat(locate('a','a')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(field('c','a','b','c'))); +hex(concat(field('c','a','b','c'))) +33 +create table t1 as select concat(field('c','a','b','c')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(ascii(61))); +hex(concat(ascii(61))) +3534 +create table t1 as select concat(ascii(61)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(ord(61))); +hex(concat(ord(61))) +3534 +create table t1 as select concat(ord(61)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(7) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(find_in_set('b','a,b,c,d'))); +hex(concat(find_in_set('b','a,b,c,d'))) +32 +create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select md5('a'), hex(md5('a')); +md5('a') hex(md5('a')) +0cc175b9c0f1b6a831c399e269772661 3063633137356239633066316236613833316333393965323639373732363631 +create table t1 as select md5('a') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(32) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select old_password('a'), hex(old_password('a')); +old_password('a') hex(old_password('a')) +60671c896665c3fa 36303637316338393636363563336661 +create table t1 as select old_password('a') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(16) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select password('a'), hex(password('a')); +password('a') hex(password('a')) +*667F407DE7C6AD07358FA38DAED7828A72014B4E 2A36363746343037444537433641443037333538464133384441454437383238413732303134423445 +create table t1 as select password('a') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(41) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select sha('a'), hex(sha('a')); +sha('a') hex(sha('a')) +86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 38366637653433376661613561376663653135643164646362396561656165613337373636376238 +create table t1 as select sha('a') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(40) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select sha1('a'), hex(sha1('a')); +sha1('a') hex(sha1('a')) +86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 38366637653433376661613561376663653135643164646362396561656165613337373636376238 +create table t1 as select sha1('a') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(40) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(cast('-1' as signed))); +hex(concat(cast('-1' as signed))) +2D31 +create table t1 as select concat(cast('-1' as signed)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(cast('1' as unsigned))); +hex(concat(cast('1' as unsigned))) +31 +create table t1 as select concat(cast('1' as unsigned)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(cast(1/2 as decimal(5,5)))); +hex(concat(cast(1/2 as decimal(5,5)))) +302E3530303030 +create table t1 as select concat(cast(1/2 as decimal(5,5))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(7) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(cast('2001-01-02 03:04:05' as date))); +hex(concat(cast('2001-01-02 03:04:05' as date))) +323030312D30312D3032 +create table t1 as select concat(cast('2001-01-02 03:04:05' as date)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t1; +c1 +2001-01-02 +drop table t1; +select hex(concat(cast('2001-01-02 03:04:05' as time))); +hex(concat(cast('2001-01-02 03:04:05' as time))) +30333A30343A3035 +create table t1 as select concat(cast('2001-01-02 03:04:05' as time)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t1; +c1 +03:04:05 +drop table t1; +select hex(concat(cast('2001-01-02' as datetime))); +hex(concat(cast('2001-01-02' as datetime))) +323030312D30312D30322030303A30303A3030 +create table t1 as select concat(cast('2001-01-02' as datetime)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(19) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t1; +c1 +2001-01-02 00:00:00 +drop table t1; +select hex(concat(least(1,2))); +hex(concat(least(1,2))) +31 +create table t1 as select concat(least(1,2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(greatest(1,2))); +hex(concat(greatest(1,2))) +32 +create table t1 as select concat(greatest(1,2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(case when 11 then 22 else 33 end)); +hex(concat(case when 11 then 22 else 33 end)) +3232 +create table t1 as select concat(case when 11 then 22 else 33 end) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(coalesce(1,2))); +hex(concat(coalesce(1,2))) +31 +create table t1 as select concat(coalesce(1,2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat_ws(1,2,3)); +hex(concat_ws(1,2,3)) +323133 +create table t1 as select concat_ws(1,2,3) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(group_concat(1,2,3)); +hex(group_concat(1,2,3)) +313233 +create table t1 as select group_concat(1,2,3) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` mediumtext DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select 1 as c1 union select 'a'; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select hex(c1) from t1 order by c1; +hex(c1) +31 +61 +drop table t1; +create table t1 as select concat(last_insert_id()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(benchmark(0,0))); +hex(concat(benchmark(0,0))) +30 +create table t1 as select concat(benchmark(0,0)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(sleep(0))); +hex(concat(sleep(0))) +30 +create table t1 as select concat(sleep(0)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(is_free_lock('xxxx'))); +hex(concat(is_free_lock('xxxx'))) +31 +create table t1 as select concat(is_free_lock('xxxx')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(is_used_lock('a')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(release_lock('a')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(crc32(''))); +hex(concat(crc32(''))) +30 +create table t1 as select concat(crc32('')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(uncompressed_length(''))); +hex(concat(uncompressed_length(''))) +30 +create table t1 as select concat(uncompressed_length('')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(connection_id()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(inet_aton('127.1.1.1'))); +hex(concat(inet_aton('127.1.1.1'))) +32313330373732323235 +create table t1 as select concat(inet_aton('127.1.1.1')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(inet_ntoa(2130772225))); +hex(concat(inet_ntoa(2130772225))) +3132372E312E312E31 +create table t1 as select concat(inet_ntoa(2130772225)) as c1; +select * from t1; +c1 +127.1.1.1 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(31) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select 1; +1 +1 +select hex(concat(row_count())); +hex(concat(row_count())) +2D31 +create table t1 as select concat(row_count()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(found_rows())); +hex(concat(found_rows())) +30 +create table t1 as select concat(found_rows()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(uuid_short()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(uuid()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(36) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select coercibility(uuid()), coercibility(cast('a' as char character set latin1)); +coercibility(uuid()) coercibility(cast('a' as char character set latin1)) +4 2 +select charset(concat(uuid(), cast('a' as char character set latin1))); +charset(concat(uuid(), cast('a' as char character set latin1))) +latin1 +create table t1 as select concat(uuid(), cast('a' as char character set latin1)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(37) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(master_pos_wait('non-existent',0,2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(@a1:=1)); +hex(concat(@a1:=1)) +31 +create table t1 as select concat(@a2:=2) as c1, @a3:=3 as c2; +select hex(c1) from t1; +hex(c1) +32 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL, + `c2` int(1) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +set @a2=1; +select hex(concat(@a2)); +hex(concat(@a2)) +31 +create table t1 as select concat(@a2) as c1, @a2 as c2; +select hex(c1) from t1; +hex(c1) +31 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(20) DEFAULT NULL, + `c2` bigint(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(@a1:=sqrt(1))); +hex(concat(@a1:=sqrt(1))) +31 +create table t1 as select concat(@a2:=sqrt(1)) as c1, @a3:=sqrt(1) as c2; +select hex(c1) from t1; +hex(c1) +31 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) DEFAULT NULL, + `c2` double DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +set @a2=sqrt(1); +select hex(concat(@a2)); +hex(concat(@a2)) +31 +create table t1 as select concat(@a2) as c1, @a2 as c2; +select hex(c1) from t1; +hex(c1) +31 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) DEFAULT NULL, + `c2` double DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(@a1:=1.1)); +hex(concat(@a1:=1.1)) +312E31 +create table t1 as select concat(@a2:=1.1) as c1, @a3:=1.1 as c2; +select hex(c1) from t1; +hex(c1) +312E31 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) DEFAULT NULL, + `c2` decimal(2,1) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +set @a2=1.1; +select hex(concat(@a2)); +hex(concat(@a2)) +312E31 +create table t1 as select concat(@a2) as c1, @a2 as c2; +select hex(c1) from t1; +hex(c1) +312E31 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(83) DEFAULT NULL, + `c2` decimal(65,38) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(@@ft_max_word_len)); +hex(concat(@@ft_max_word_len)) +3834 +create table t1 as select concat(@@ft_max_word_len) as c1; +select hex(c1) from t1; +hex(c1) +3834 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat('a'='a' IS TRUE)); +hex(concat('a'='a' IS TRUE)) +31 +create table t1 as select concat('a'='a' IS TRUE) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat('a'='a' IS NOT TRUE)); +hex(concat('a'='a' IS NOT TRUE)) +30 +create table t1 as select concat('a'='a' IS NOT TRUE) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(NOT 'a'='a')); +hex(concat(NOT 'a'='a')) +30 +create table t1 as select concat(NOT 'a'='a') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat('a' IS NULL)); +hex(concat('a' IS NULL)) +30 +create table t1 as select concat('a' IS NULL) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat('a' IS NOT NULL)); +hex(concat('a' IS NOT NULL)) +31 +create table t1 as select concat('a' IS NOT NULL) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat('a' rlike 'a')); +hex(concat('a' rlike 'a')) +31 +create table t1 as select concat('a' IS NOT NULL) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(strcmp('a','b'))); +hex(concat(strcmp('a','b'))) +2D31 +create table t1 as select concat(strcmp('a','b')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat('a' like 'a')); +hex(concat('a' like 'a')) +31 +create table t1 as select concat('a' like 'b') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat('a' between 'b' and 'c')); +hex(concat('a' between 'b' and 'c')) +30 +create table t1 as select concat('a' between 'b' and 'c') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat('a' in ('a','b'))); +hex(concat('a' in ('a','b'))) +31 +create table t1 as select concat('a' in ('a','b')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(interval(23, 1, 15, 17, 30, 44, 200))); +hex(concat(interval(23, 1, 15, 17, 30, 44, 200))) +33 +create table t1 as select concat(interval(23, 1, 15, 17, 30, 44, 200)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 (a varchar(10), fulltext key(a)); +insert into t1 values ('a'); +select hex(concat(match (a) against ('a'))) from t1; +hex(concat(match (a) against ('a'))) +30 +create table t2 as select concat(match (a) against ('a')) as a from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` varchar(23) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +select hex(ifnull(1,'a')); +hex(ifnull(1,'a')) +31 +create table t1 as select ifnull(1,'a') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(ifnull(1,1))); +hex(concat(ifnull(1,1))) +31 +create table t1 as select concat(ifnull(1,1)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(ifnull(1.1,1.1))); +hex(concat(ifnull(1.1,1.1))) +312E31 +create table t1 as select concat(ifnull(1.1,1.1)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(if(1,'b',1)); +hex(if(1,'b',1)) +62 +create table t1 as select if(1,'b',1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(if(1,1,'b')); +hex(if(1,1,'b')) +31 +create table t1 as select if(1,1,'b') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(if(1,1,1))); +hex(concat(if(1,1,1))) +31 +create table t1 as select concat(if(1,1,1)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(nullif(1,2))); +hex(concat(nullif(1,2))) +31 +create table t1 as select concat(nullif(1,2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)')))); +hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)')))) +31 +create table t1 as select concat(Dimension(GeomFromText('LINSTRING(0 0,10 10)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); +hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) +32 +create table t1 as select concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))); +hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))) +32 +create table t1 as select concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); +hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) +30 +create table t1 as select concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))); +hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))) +31 +create table t1 as select concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))); +hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))) +30 +create table t1 as select concat(IsEmpty(GeomFromText('Point(1 1)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(IsSimple(GeomFromText('POINT(1 1)')))); +hex(concat(IsSimple(GeomFromText('POINT(1 1)')))) +31 +create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))); +hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))) +30 +create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))); +hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))) +31 +create table t1 as select concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))) as c1; +drop table t1; +select hex(concat(x(GeomFromText('Point(1 2)')))); +hex(concat(x(GeomFromText('Point(1 2)')))) +31 +create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(y(GeomFromText('Point(1 2)')))); +hex(concat(y(GeomFromText('Point(1 2)')))) +32 +create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))); +hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))) +31 +create table t1 as select concat(GLength(GeomFromText('LineString(1 2, 2 2)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))); +hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))) +31 +create table t1 as select concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(GeometryType(GeomFromText('Point(1 2)')))); +hex(concat(GeometryType(GeomFromText('Point(1 2)')))) +504F494E54 +create table t1 as select concat(GeometryType(GeomFromText('Point(1 2)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(AsText(GeomFromText('Point(1 2)')))); +hex(concat(AsText(GeomFromText('Point(1 2)')))) +504F494E542831203229 +create table t1 as select concat(AsText(GeomFromText('Point(1 2)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` longtext DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(period_add(200902, 2))); +hex(concat(period_add(200902, 2))) +323030393034 +create table t1 as select concat(period_add(200902, 2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(period_diff(200902, 200802))); +hex(concat(period_diff(200902, 200802))) +3132 +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +create table t1 as select concat(period_add(200902, 200802)) as c1; +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(6) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(to_days(20090224))); +hex(concat(to_days(20090224))) +373333383237 +create table t1 as select concat(to_days(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(dayofmonth(20090224))); +hex(concat(dayofmonth(20090224))) +3234 +create table t1 as select concat(dayofmonth(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(dayofyear(20090224))); +hex(concat(dayofyear(20090224))) +3535 +create table t1 as select concat(dayofyear(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(hour('10:11:12'))); +hex(concat(hour('10:11:12'))) +3130 +create table t1 as select concat(hour('10:11:12')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(minute('10:11:12'))); +hex(concat(minute('10:11:12'))) +3131 +create table t1 as select concat(minute('10:11:12')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(second('10:11:12'))); +hex(concat(second('10:11:12'))) +3132 +create table t1 as select concat(second('10:11:12')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(quarter(20090224))); +hex(concat(quarter(20090224))) +31 +create table t1 as select concat(quarter(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(week(20090224))); +hex(concat(week(20090224))) +38 +create table t1 as select concat(week(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(yearweek(20090224))); +hex(concat(yearweek(20090224))) +323030393038 +create table t1 as select concat(yearweek(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(year(20090224))); +hex(concat(year(20090224))) +32303039 +create table t1 as select concat(year(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(weekday(20090224))); +hex(concat(weekday(20090224))) +31 +create table t1 as select concat(weekday(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(dayofweek(20090224))); +hex(concat(dayofweek(20090224))) +33 +create table t1 as select concat(dayofweek(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(unix_timestamp(20090224))); +hex(concat(unix_timestamp(20090224))) +31323335343232383030 +create table t1 as select concat(unix_timestamp(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(17) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(time_to_sec('10:11:12'))); +hex(concat(time_to_sec('10:11:12'))) +3336363732 +create table t1 as select concat(time_to_sec('10:11:12')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(17) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(extract(year from 20090702))); +hex(concat(extract(year from 20090702))) +32303039 +create table t1 as select concat(extract(year from 20090702)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(microsecond('12:00:00.123456'))); +hex(concat(microsecond('12:00:00.123456'))) +313233343536 +create table t1 as select concat(microsecond('12:00:00.123456')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(month(20090224))); +hex(concat(month(20090224))) +32 +create table t1 as select concat(month(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(last_day('2003-02-05')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select c1, hex(c1) from t1; +c1 hex(c1) +2003-02-28 323030332D30322D3238 +drop table t1; +create table t1 as select concat(from_days(730669)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select c1, hex(c1) from t1; +c1 hex(c1) +2000-07-03 323030302D30372D3033 +drop table t1; +create table t1 as select concat(curdate()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(utc_date()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(curtime()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select repeat('a',20) as c1 limit 0; +set timestamp=1216359724; +insert into t1 values (current_date); +insert into t1 values (current_time); +select c1, hex(c1) from t1; +c1 hex(c1) +2008-07-18 323030382D30372D3138 +08:42:04 30383A34323A3034 +drop table t1; +create table t1 as select concat(utc_time()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(sec_to_time(2378))); +hex(concat(sec_to_time(2378))) +30303A33393A3338 +create table t1 as select concat(sec_to_time(2378)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))); +hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))) +32343A30303A3030 +create table t1 as select concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(maketime(10,11,12))); +hex(concat(maketime(10,11,12))) +31303A31313A3132 +create table t1 as select concat(maketime(10,11,12)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(get_format(DATE,'USA')); +hex(get_format(DATE,'USA')) +256D2E25642E2559 +create table t1 as select get_format(DATE,'USA') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(17) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(from_unixtime(1111885200)),4)); +hex(left(concat(from_unixtime(1111885200)),4)) +32303035 +create table t1 as select concat(from_unixtime(1111885200)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(19) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))); +hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))) +323030332D31322D33312032303A30303A3030 +create table t1 as select concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(19) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))); +hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))) +323030342D30312D30322031323A30303A3030 +create table t1 as select concat(date_add('2004-01-01 12:00:00', interval 1 day)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(19) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t1; +c1 +2004-01-02 12:00:00 +drop table t1; +select hex(concat(makedate(2009,1))); +hex(concat(makedate(2009,1))) +323030392D30312D3031 +create table t1 as select concat(makedate(2009,1)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t1; +c1 +2009-01-01 +drop table t1; +create table t1 as select concat(now()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(19) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(utc_timestamp()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(19) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(sysdate()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(19) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(addtime('00:00:00','11:22:33'))); +hex(concat(addtime('00:00:00','11:22:33'))) +31313A32323A3333 +create table t1 as select concat(addtime('00:00:00','11:22:33')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(26) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(subtime('23:59:59','11:22:33'))); +hex(concat(subtime('23:59:59','11:22:33'))) +31323A33373A3236 +create table t1 as select concat(subtime('23:59:59','11:22:33')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(26) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(elt(1,2,3)); +hex(elt(1,2,3)) +32 +create table t1 as select elt(1,2,3) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(export_set(1,2,3,4,2)); +hex(export_set(1,2,3,4,2)) +323433 +create table t1 as select export_set(1,2,3,4,2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(127) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(insert(1133,3,0,22)); +hex(insert(1133,3,0,22)) +313132323333 +create table t1 as select insert(1133,3,0,22) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(lcase(123)); +hex(lcase(123)) +313233 +create table t1 as select lcase(123) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(123,1)); +hex(left(123,1)) +31 +create table t1 as select left(123,1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(lower(123)); +hex(lower(123)) +313233 +create table t1 as select lower(123) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(lpad(1,2,0)); +hex(lpad(1,2,0)) +3031 +create table t1 as select lpad(1,2,0) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(ltrim(1)); +hex(ltrim(1)) +31 +create table t1 as select ltrim(1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(mid(1,1,1)); +hex(mid(1,1,1)) +31 +create table t1 as select mid(1,1,1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(repeat(1,2)); +hex(repeat(1,2)) +3131 +create table t1 as select repeat(1,2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(replace(1,1,2)); +hex(replace(1,1,2)) +32 +create table t1 as select replace(1,1,2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(reverse(12)); +hex(reverse(12)) +3231 +create table t1 as select reverse(12) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(right(123,1)); +hex(right(123,1)) +33 +create table t1 as select right(123,1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(rpad(1,2,0)); +hex(rpad(1,2,0)) +3130 +create table t1 as select rpad(1,2,0) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(rtrim(1)); +hex(rtrim(1)) +31 +create table t1 as select rtrim(1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(soundex(1)); +hex(soundex(1)) + +create table t1 as select soundex(1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(substring(1,1,1)); +hex(substring(1,1,1)) +31 +create table t1 as select substring(1,1,1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(trim(1)); +hex(trim(1)) +31 +create table t1 as select trim(1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(ucase(1)); +hex(ucase(1)) +31 +create table t1 as select ucase(1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(upper(1)); +hex(upper(1)) +31 +create table t1 as select upper(1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select repeat(' ', 64) as a limit 0; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ("1.1"), ("2.1"); +select a, hex(a) from t1; +a hex(a) +1.1 312E31 +2.1 322E31 +update t1 set a= a + 0.1; +select a, hex(a) from t1; +a hex(a) +1.2000000000000002 312E32303030303030303030303030303032 +2.2 322E32 +drop table t1; +create table t1 (a tinyint); +insert into t1 values (1); +select hex(concat(a)) from t1; +hex(concat(a)) +31 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a tinyint zerofill); +insert into t1 values (1), (10), (100); +select hex(concat(a)), a from t1; +hex(concat(a)) a +303031 001 +303130 010 +313030 100 +drop table t1; +create table t1 (a tinyint(4) zerofill); +insert into t1 values (1), (10), (100); +select hex(concat(a)), a from t1; +hex(concat(a)) a +30303031 0001 +30303130 0010 +30313030 0100 +drop table t1; +create table t1 (a decimal(10,2)); +insert into t1 values (123.45); +select hex(concat(a)) from t1; +hex(concat(a)) +3132332E3435 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(12) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a smallint); +insert into t1 values (1); +select hex(concat(a)) from t1; +hex(concat(a)) +31 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a smallint zerofill); +insert into t1 values (1), (10), (100), (1000), (10000); +select hex(concat(a)), a from t1; +hex(concat(a)) a +3030303031 00001 +3030303130 00010 +3030313030 00100 +3031303030 01000 +3130303030 10000 +drop table t1; +create table t1 (a mediumint); +insert into t1 values (1); +select hex(concat(a)) from t1; +hex(concat(a)) +31 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(9) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a mediumint zerofill); +insert into t1 values (1), (10), (100), (1000), (10000); +select hex(concat(a)), a from t1; +hex(concat(a)) a +3030303030303031 00000001 +3030303030303130 00000010 +3030303030313030 00000100 +3030303031303030 00001000 +3030303130303030 00010000 +drop table t1; +create table t1 (a int); +insert into t1 values (1); +select hex(concat(a)) from t1; +hex(concat(a)) +31 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a int zerofill); +insert into t1 values (1), (10), (100), (1000), (10000); +select hex(concat(a)), a from t1; +hex(concat(a)) a +30303030303030303031 0000000001 +30303030303030303130 0000000010 +30303030303030313030 0000000100 +30303030303031303030 0000001000 +30303030303130303030 0000010000 +drop table t1; +create table t1 (a bigint); +insert into t1 values (1); +select hex(concat(a)) from t1; +hex(concat(a)) +31 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a bigint zerofill); +insert into t1 values (1), (10), (100), (1000), (10000); +select hex(concat(a)), a from t1; +hex(concat(a)) a +3030303030303030303030303030303030303031 00000000000000000001 +3030303030303030303030303030303030303130 00000000000000000010 +3030303030303030303030303030303030313030 00000000000000000100 +3030303030303030303030303030303031303030 00000000000000001000 +3030303030303030303030303030303130303030 00000000000000010000 +drop table t1; +create table t1 (a float); +insert into t1 values (123.456); +select hex(concat(a)) from t1; +hex(concat(a)) +3132332E343536 +select concat(a) from t1; +concat(a) +123.456 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(12) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a float zerofill); +insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1); +select hex(concat(a)), a from t1; +hex(concat(a)) a +303030303030303030312E31 0000000001.1 +303030303030303031302E31 0000000010.1 +303030303030303130302E31 0000000100.1 +303030303030313030302E31 0000001000.1 +303030303031303030302E31 0000010000.1 +drop table t1; +create table t1 (a double); +insert into t1 values (123.456); +select hex(concat(a)) from t1; +hex(concat(a)) +3132332E343536 +select concat(a) from t1; +concat(a) +123.456 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(22) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a double zerofill); +insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1); +select hex(concat(a)), a from t1; +hex(concat(a)) a +30303030303030303030303030303030303030312E31 00000000000000000001.1 +30303030303030303030303030303030303031302E31 00000000000000000010.1 +30303030303030303030303030303030303130302E31 00000000000000000100.1 +30303030303030303030303030303030313030302E31 00000000000000001000.1 +30303030303030303030303030303031303030302E31 00000000000000010000.1 +drop table t1; +create table t1 (a year(2)); +Warnings: +Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead +insert into t1 values (1); +select hex(concat(a)) from t1; +hex(concat(a)) +3031 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a year); +insert into t1 values (1); +select hex(concat(a)) from t1; +hex(concat(a)) +32303031 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a bit(64)); +insert into t1 values (1); +select hex(concat(a)) from t1; +hex(concat(a)) +0000000000000001 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varbinary(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); +insert into t1 values (0); +insert into t1 values (20010203040506); +insert into t1 values (19800203040506); +insert into t1 values ('2001-02-03 04:05:06'); +select hex(concat(a)) from t1; +hex(concat(a)) +303030302D30302D30302030303A30303A3030 +323030312D30322D30332030343A30353A3036 +313938302D30322D30332030343A30353A3036 +323030312D30322D30332030343A30353A3036 +select concat(a) from t1; +concat(a) +0000-00-00 00:00:00 +2001-02-03 04:05:06 +1980-02-03 04:05:06 +2001-02-03 04:05:06 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(19) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a date); +insert into t1 values ('2001-02-03'); +insert into t1 values (20010203); +select hex(concat(a)) from t1; +hex(concat(a)) +323030312D30322D3033 +323030312D30322D3033 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a time); +insert into t1 values (1); +insert into t1 values ('01:02:03'); +select hex(concat(a)) from t1; +hex(concat(a)) +30303A30303A3031 +30313A30323A3033 +select concat(a) from t1; +concat(a) +00:00:01 +01:02:03 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a datetime); +insert into t1 values ('2001-02-03 04:05:06'); +insert into t1 values (20010203040506); +select hex(concat(a)) from t1; +hex(concat(a)) +323030312D30322D30332030343A30353A3036 +323030312D30322D30332030343A30353A3036 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(19) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a tinyint); +insert into t1 values (1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(4) YES NULL +select hex(a) from v1; +hex(a) +31 +drop table t1; +drop view v1; +create table t1 (a tinyint zerofill); +insert into t1 values (1), (10), (100); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(3) YES NULL +select hex(a) from v1; +hex(a) +303031 +303130 +313030 +drop table t1; +drop view v1; +create table t1 (a tinyint(30) zerofill); +insert into t1 values (1), (10), (100); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(30) YES NULL +select hex(a) from v1; +hex(a) +303030303030303030303030303030303030303030303030303030303031 +303030303030303030303030303030303030303030303030303030303130 +303030303030303030303030303030303030303030303030303030313030 +drop table t1; +drop view v1; +create table t1 (a decimal(10,2)); +insert into t1 values (123.45); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(12) YES NULL +select hex(a) from v1; +hex(a) +3132332E3435 +drop table t1; +drop view v1; +create table t1 (a smallint); +insert into t1 values (1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(6) YES NULL +select hex(a) from v1; +hex(a) +31 +drop table t1; +drop view v1; +create table t1 (a smallint zerofill); +insert into t1 values (1), (10), (100), (1000), (10000); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(5) YES NULL +select hex(a) from v1; +hex(a) +3030303031 +3030303130 +3030313030 +3031303030 +3130303030 +drop table t1; +drop view v1; +create table t1 (a mediumint); +insert into t1 values (1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(9) YES NULL +select hex(a) from v1; +hex(a) +31 +drop table t1; +drop view v1; +create table t1 (a mediumint zerofill); +insert into t1 values (1), (10), (100), (1000), (10000); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(8) YES NULL +select hex(a) from v1; +hex(a) +3030303030303031 +3030303030303130 +3030303030313030 +3030303031303030 +3030303130303030 +drop table t1; +drop view v1; +create table t1 (a int); +insert into t1 values (1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(11) YES NULL +select hex(a) from v1; +hex(a) +31 +drop table t1; +drop view v1; +create table t1 (a int zerofill); +insert into t1 values (1), (10), (100), (1000), (10000); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(10) YES NULL +select hex(a) from v1; +hex(a) +30303030303030303031 +30303030303030303130 +30303030303030313030 +30303030303031303030 +30303030303130303030 +drop table t1; +drop view v1; +create table t1 (a bigint); +insert into t1 values (1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(20) YES NULL +select hex(a) from v1; +hex(a) +31 +drop table t1; +drop view v1; +create table t1 (a bigint zerofill); +insert into t1 values (1), (10), (100), (1000), (10000); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(20) YES NULL +select hex(a) from v1; +hex(a) +3030303030303030303030303030303030303031 +3030303030303030303030303030303030303130 +3030303030303030303030303030303030313030 +3030303030303030303030303030303031303030 +3030303030303030303030303030303130303030 +drop table t1; +drop view v1; +create table t1 (a float); +insert into t1 values (123.456); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(12) YES NULL +select hex(a) from v1; +hex(a) +3132332E343536 +drop table t1; +drop view v1; +create table t1 (a float zerofill); +insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(12) YES NULL +select hex(a) from v1; +hex(a) +303030303030303030312E31 +303030303030303031302E31 +303030303030303130302E31 +303030303030313030302E31 +303030303031303030302E31 +drop table t1; +drop view v1; +create table t1 (a double); +insert into t1 values (123.456); +select concat(a) from t1; +concat(a) +123.456 +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(22) YES NULL +select hex(a) from v1; +hex(a) +3132332E343536 +drop table t1; +drop view v1; +create table t1 (a double zerofill); +insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(22) YES NULL +select hex(a) from v1; +hex(a) +30303030303030303030303030303030303030312E31 +30303030303030303030303030303030303031302E31 +30303030303030303030303030303030303130302E31 +30303030303030303030303030303030313030302E31 +30303030303030303030303030303031303030302E31 +drop table t1; +drop view v1; +create table t1 (a year(2)); +Warnings: +Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead +insert into t1 values (1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(2) YES NULL +select hex(a) from v1; +hex(a) +3031 +drop table t1; +drop view v1; +create table t1 (a year); +insert into t1 values (1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(4) YES NULL +select hex(a) from v1; +hex(a) +32303031 +drop table t1; +drop view v1; +create table t1 (a bit(64)); +insert into t1 values (1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varbinary(64) YES NULL +select hex(a) from v1; +hex(a) +0000000000000001 +drop table t1; +drop view v1; +create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); +insert into t1 values (0); +insert into t1 values (20010203040506); +insert into t1 values (19800203040506); +insert into t1 values ('2001-02-03 04:05:06'); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(19) YES NULL +select hex(a) from v1; +hex(a) +303030302D30302D30302030303A30303A3030 +323030312D30322D30332030343A30353A3036 +313938302D30322D30332030343A30353A3036 +323030312D30322D30332030343A30353A3036 +drop table t1; +drop view v1; +create table t1 (a date); +insert into t1 values ('2001-02-03'); +insert into t1 values (20010203); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(10) YES NULL +select hex(a) from v1; +hex(a) +323030312D30322D3033 +323030312D30322D3033 +drop table t1; +drop view v1; +create table t1 (a time); +insert into t1 values (1); +insert into t1 values ('01:02:03'); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(10) YES NULL +select hex(a) from v1; +hex(a) +30303A30303A3031 +30313A30323A3033 +drop table t1; +drop view v1; +create table t1 (a datetime); +insert into t1 values ('2001-02-03 04:05:06'); +insert into t1 values (20010203040506); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(19) YES NULL +select hex(a) from v1; +hex(a) +323030312D30322D30332030343A30353A3036 +323030312D30322D30332030343A30353A3036 +drop table t1; +drop view v1; +create function f1 (par1 int) returns int +begin +return concat(par1); +end| +set @a= f1(1); +select hex(@a); +hex(@a) +1 +select hex(concat(f1(1))); +hex(concat(f1(1))) +31 +create table t1 as select f1(1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(f1(1)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create view v1 as select concat(f1(1)) as c1; +show columns from v1; +Field Type Null Key Default Extra +c1 varchar(11) YES NULL +drop table t1; +drop view v1; +drop function f1; +create function f1 (par1 decimal(18,2)) returns decimal(18,2) +begin +return concat(par1); +end| +set @a= f1(123.45); +select hex(@a); +hex(@a) +7B +select hex(concat(f1(123.45))); +hex(concat(f1(123.45))) +3132332E3435 +create table t1 as select f1(123.45) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` decimal(18,2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(f1(123.45)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create view v1 as select concat(f1(123.45)) as c1; +show columns from v1; +Field Type Null Key Default Extra +c1 varchar(20) YES NULL +drop table t1; +drop view v1; +drop function f1; +create function f1 (par1 float) returns float +begin +return concat(par1); +end| +set @a= f1(123.45); +select hex(@a); +hex(@a) +7B +select hex(concat(f1(123.45))); +hex(concat(f1(123.45))) +3132332E3435 +create table t1 as select f1(123.45) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` float DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(f1(123.45)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(12) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create view v1 as select concat(f1(123.45)) as c1; +show columns from v1; +Field Type Null Key Default Extra +c1 varchar(12) YES NULL +drop table t1; +drop view v1; +drop function f1; +create function f1 (par1 date) returns date +begin +return concat(par1); +end| +set @a= f1(cast('2001-01-02' as date)); +select hex(@a); +hex(@a) +323030312D30312D3032 +select hex(concat(f1(cast('2001-01-02' as date)))); +hex(concat(f1(cast('2001-01-02' as date)))) +323030312D30312D3032 +create table t1 as select f1(cast('2001-01-02' as date)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(f1(cast('2001-01-02' as date))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create view v1 as select concat(f1(cast('2001-01-02' as date))) as c1; +show columns from v1; +Field Type Null Key Default Extra +c1 varchar(10) YES NULL +drop table t1; +drop view v1; +drop function f1; +# +# End of WL#2649 Number-to-string conversions +# +# +# Bug#54668 User variable assignments get wrong type +# +SET @x=md5('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +latin1 latin1_swedish_ci +SET @x=old_password('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +latin1 latin1_swedish_ci +SET @x=password('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +latin1 latin1_swedish_ci +SET @x=sha('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +latin1 latin1_swedish_ci +SET @x=sha1('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +latin1 latin1_swedish_ci +SET @x=astext(point(1,2)); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +latin1 latin1_swedish_ci +SET @x=aswkt(point(1,2)); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +latin1 latin1_swedish_ci +# +# Bug#54916 GROUP_CONCAT + IFNULL truncates output +# +SELECT @@collation_connection; +@@collation_connection +latin1_swedish_ci +CREATE TABLE t1 (a MEDIUMINT NULL) ENGINE=MYISAM; +INSERT INTO t1 VALUES (1234567); +SELECT GROUP_CONCAT(IFNULL(a,'')) FROM t1; +GROUP_CONCAT(IFNULL(a,'')) +1234567 +SELECT GROUP_CONCAT(IF(a,a,'')) FROM t1; +GROUP_CONCAT(IF(a,a,'')) +1234567 +SELECT GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END) FROM t1; +GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END) +1234567 +SELECT COALESCE(a,'') FROM t1 GROUP BY 1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(a,'') 253 9 7 Y 0 39 8 +COALESCE(a,'') +1234567 +# All columns must be VARCHAR(9) with the same length: +CREATE TABLE t2 AS +SELECT +CONCAT(a), +IFNULL(a,''), +IF(a,a,''), +CASE WHEN a THEN a ELSE '' END, +COALESCE(a,'') +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `CONCAT(a)` varchar(9) DEFAULT NULL, + `IFNULL(a,'')` varchar(9) NOT NULL, + `IF(a,a,'')` varchar(9) DEFAULT NULL, + `CASE WHEN a THEN a ELSE '' END` varchar(9) DEFAULT NULL, + `COALESCE(a,'')` varchar(9) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `CONCAT_WS(1,2,3)` varchar(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `INSERT(1133,3,0,22)` varchar(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT LCASE(a) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `LCASE(a)` varchar(9) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT UCASE(a) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `UCASE(a)` varchar(9) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `REPEAT(1,2)` varchar(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `LEFT(123,2)` varchar(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `RIGHT(123,2)` varchar(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `LTRIM(123)` varchar(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `RTRIM(123)` varchar(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ELT(1,111,222,333)` varchar(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `REPLACE(111,2,3)` varchar(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `SUBSTRING_INDEX(111,111,1)` varchar(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `MAKE_SET(111,222,3)` varchar(5) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `SOUNDEX(1)` varchar(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `EXPORT_SET(1,'Y','N','',8)` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +# End of Bug#54916 +# +# +# Bug#58190 BETWEEN no longer uses indexes for date or datetime fields +# +SELECT @@collation_connection; +@@collation_connection +latin1_swedish_ci +CREATE TABLE t1 ( +id INT(11) DEFAULT NULL, +date_column DATE DEFAULT NULL, +KEY(date_column)); +INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01'); +EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range date_column date_column 4 NULL 1 Using index condition +ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL; +EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range date_column date_column 6 NULL 1 Using index condition +DROP TABLE t1; +# +# Bug #31384 DATE_ADD() and DATE_SUB() return binary data +# +SELECT @@collation_connection, @@character_set_results; +@@collation_connection @@character_set_results +latin1_swedish_ci latin1 +SELECT +CHARSET(DATE_SUB('2007-08-03', INTERVAL 1 MINUTE)) AS field_str1, +CHARSET(DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE)) AS field_str2, +CHARSET(DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY)) AS field_date, +CHARSET(DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE)) AS field_datetime; +field_str1 field_str2 field_date field_datetime +latin1 latin1 binary binary +CREATE TABLE t1 AS +SELECT +DATE_SUB('2007-08-03', INTERVAL 1 MINUTE) AS field_str1, +DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2, +DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date, +DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `field_str1` varchar(19) DEFAULT NULL, + `field1_str2` varchar(19) DEFAULT NULL, + `field_date` date DEFAULT NULL, + `field_datetime` datetime DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +SELECT +DATE_SUB('2007-08-03', INTERVAL 1 DAY) AS field_str1, +DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2, +DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date, +DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def field_str1 254 19 10 Y 0 0 8 +def field1_str2 254 19 19 Y 0 0 8 +def field_date 10 10 10 Y 128 0 63 +def field_datetime 12 19 19 Y 128 0 63 +field_str1 field1_str2 field_date field_datetime +2007-08-02 2007-08-03 17:32:00 2007-08-02 2007-08-03 17:32:00 +SELECT +HEX(DATE_SUB('2007-08-03', INTERVAL 1 MINUTE)) AS field_str1, +HEX(DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE)) AS field1_str2, +HEX(DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY)) AS field_date, +HEX(DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE)) AS field_datetime; +field_str1 field1_str2 field_date field_datetime +323030372D30382D30322032333A35393A3030 323030372D30382D30332031373A33323A3030 323030372D30382D3032 323030372D30382D30332031373A33323A3030 +# +# MDEV-4841 Wrong character set of ADDTIME() and DATE_ADD() +# +SELECT @@collation_connection, @@character_set_results; +@@collation_connection @@character_set_results +latin1_swedish_ci latin1 +SELECT +CHARSET(ADDTIME(_latin1'10:01:01',_latin1'10:00:00')) AS addtime1, +CHARSET(ADDTIME('10:01:01','10:00:00')) AS addtime2, +CHARSET(DATE_ADD(_latin1'2001-01-01 10:01:01',interval 10 second)) AS date_add1, +CHARSET(DATE_ADD('2001-01-01 10:01:01',interval 10 second)) AS date_add2; +addtime1 addtime2 date_add1 date_add2 +latin1 latin1 latin1 latin1 +CREATE TABLE t1 AS +SELECT +ADDTIME(_latin1'10:01:01',_latin1'10:00:00') AS addtime1, +ADDTIME('10:01:01','10:00:00') AS addtime2, +DATE_ADD(_latin1'2001-01-01 10:01:01',interval 10 second) AS date_add1, +DATE_ADD('2001-01-01 10:01:01',interval 10 second) AS date_add2; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `addtime1` varchar(26) DEFAULT NULL, + `addtime2` varchar(26) DEFAULT NULL, + `date_add1` varchar(19) DEFAULT NULL, + `date_add2` varchar(19) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT * FROM t1; +addtime1 addtime2 date_add1 date_add2 +20:01:01 20:01:01 2001-01-01 10:01:11 2001-01-01 10:01:11 +DROP TABLE t1; +# +# Bug#11926811 / Bug#60625 Illegal mix of collations +# +SELECT @@collation_connection; +@@collation_connection +latin1_swedish_ci +CREATE PROCEDURE p1() +BEGIN +DECLARE v_LastPaymentDate DATETIME DEFAULT NULL; +SELECT v_LastPaymentDate < NOW(); +EXPLAIN EXTENDED SELECT v_LastPaymentDate < NOW(); +SHOW WARNINGS; +EXPLAIN EXTENDED SELECT CONCAT(v_LastPaymentDate, NOW()); +END// +CALL p1; +v_LastPaymentDate < NOW() +NULL +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Level Code Message +Note 1003 select v_LastPaymentDate@0 < current_timestamp() AS `v_LastPaymentDate < NOW()` +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select concat(v_LastPaymentDate@0,current_timestamp()) AS `CONCAT(v_LastPaymentDate, NOW())` +DROP PROCEDURE p1; +# +# Bug#52159 returning time type from function and empty left join causes debug assertion +# +CREATE FUNCTION f1() RETURNS TIME RETURN 1; +CREATE TABLE t1 (b INT); +INSERT INTO t1 VALUES (0); +SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY a; +f1() +00:00:01 +DROP FUNCTION f1; +DROP TABLE t1; +# +# MDEV-9662 Assertion `precision || !scale' failed in my_decimal_precision_to_length_no_truncation(uint, uint8, bool) +# +SELECT @@collation_connection; +@@collation_connection +latin1_swedish_ci +SELECT CASE 1 WHEN 2 THEN ( - '3' ) END; +CASE 1 WHEN 2 THEN ( - '3' ) END +NULL +# +# MDEV-5702 Incorrect results are returned with NULLIF() +# +CREATE TABLE t1 (d DATE); +INSERT INTO t1 VALUES ('1999-11-11'),('2014-02-04'); +SELECT DISTINCT d, CAST(d AS CHAR), NULLIF(d,"2000-01-01") AS bad, NULLIF(CAST(d AS CHAR),"2000-01-01") AS good FROM t1; +d CAST(d AS CHAR) bad good +1999-11-11 1999-11-11 1999-11-11 1999-11-11 +2014-02-04 2014-02-04 2014-02-04 2014-02-04 +CREATE TABLE t2 AS SELECT DISTINCT d, NULLIF(d,'2000-01-01') AS bad FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `d` date DEFAULT NULL, + `bad` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +SET NAMES latin1; +SET sql_mode=''; +CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a)); +INSERT INTO t1 VALUES (); +SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1; +maketime(`a`,`a`,`a`) +00:00:00.000000 +DROP TABLE t1; +SET sql_mode=default; +# +# Bug#11764503 (Bug#57341) Query in EXPLAIN EXTENDED shows wrong characters +# +SET NAMES utf8; +EXPLAIN EXTENDED SELECT 'abcdó', _latin1'abcdó', _utf8'abcdó'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select 'abcdó' AS `abcdó`,_latin1'abcd\xC3\xB3' AS `abcdó`,_utf8'abcd\xC3\xB3' AS `abcdó` +SET NAMES latin1; +EXPLAIN EXTENDED SELECT 'abcdó', _latin1'abcdó', _utf8'abcdó'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select 'abcdó' AS `abcdó`,_latin1'abcd\xC3\xB3' AS `abcdó`,_utf8'abcd\xC3\xB3' AS `abcd�` +# +# End of 5.5 tests +# +# +# Start of 5.6 tests +# +# +# WL#3664 WEIGHT_STRING +# +set @@collation_connection=latin1_swedish_ci; +select @@collation_connection; +@@collation_connection +latin1_swedish_ci +CREATE TABLE t1 AS SELECT 'a' AS a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a)) FROM t1; +HEX(WEIGHT_STRING(a)) +41 +SELECT HEX(ws) FROM t2; +HEX(ws) +41 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(5) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(5) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a)) FROM t1; +HEX(WEIGHT_STRING(a)) +4141414141 +SELECT HEX(ws) FROM t2; +HEX(ws) +4141414141 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(3))) +414141 +SELECT HEX(ws) FROM t2; +HEX(ws) +414141 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41414141412020202020 +SELECT HEX(ws) FROM t2; +HEX(ws) +41414141412020202020 +DROP TABLE t2; +DROP TABLE t1; +select hex(weight_string('a')); +hex(weight_string('a')) +41 +select hex(weight_string('A')); +hex(weight_string('A')) +41 +select hex(weight_string('abc')); +hex(weight_string('abc')) +414243 +select hex(weight_string('abc' as char(2))); +hex(weight_string('abc' as char(2))) +4142 +select hex(weight_string('abc' as char(3))); +hex(weight_string('abc' as char(3))) +414243 +select hex(weight_string('abc' as char(5))); +hex(weight_string('abc' as char(5))) +4142432020 +select hex(weight_string('abc', 1, 2, 0xC0)); +hex(weight_string('abc', 1, 2, 0xC0)) +41 +select hex(weight_string('abc', 2, 2, 0xC0)); +hex(weight_string('abc', 2, 2, 0xC0)) +4142 +select hex(weight_string('abc', 3, 2, 0xC0)); +hex(weight_string('abc', 3, 2, 0xC0)) +414220 +select hex(weight_string('abc', 4, 2, 0xC0)); +hex(weight_string('abc', 4, 2, 0xC0)) +41422020 +select hex(weight_string('abc', 5, 2, 0xC0)); +hex(weight_string('abc', 5, 2, 0xC0)) +4142202020 +select hex(weight_string('abc',25, 2, 0xC0)); +hex(weight_string('abc',25, 2, 0xC0)) +41422020202020202020202020202020202020202020202020 +select hex(weight_string('abc', 1, 3, 0xC0)); +hex(weight_string('abc', 1, 3, 0xC0)) +41 +select hex(weight_string('abc', 2, 3, 0xC0)); +hex(weight_string('abc', 2, 3, 0xC0)) +4142 +select hex(weight_string('abc', 3, 3, 0xC0)); +hex(weight_string('abc', 3, 3, 0xC0)) +414243 +select hex(weight_string('abc', 4, 3, 0xC0)); +hex(weight_string('abc', 4, 3, 0xC0)) +41424320 +select hex(weight_string('abc', 5, 3, 0xC0)); +hex(weight_string('abc', 5, 3, 0xC0)) +4142432020 +select hex(weight_string('abc',25, 3, 0xC0)); +hex(weight_string('abc',25, 3, 0xC0)) +41424320202020202020202020202020202020202020202020 +select hex(weight_string('abc', 1, 4, 0xC0)); +hex(weight_string('abc', 1, 4, 0xC0)) +41 +select hex(weight_string('abc', 2, 4, 0xC0)); +hex(weight_string('abc', 2, 4, 0xC0)) +4142 +select hex(weight_string('abc', 3, 4, 0xC0)); +hex(weight_string('abc', 3, 4, 0xC0)) +414243 +select hex(weight_string('abc', 4, 4, 0xC0)); +hex(weight_string('abc', 4, 4, 0xC0)) +41424320 +select hex(weight_string('abc', 5, 4, 0xC0)); +hex(weight_string('abc', 5, 4, 0xC0)) +4142432020 +select hex(weight_string('abc',25, 4, 0xC0)); +hex(weight_string('abc',25, 4, 0xC0)) +41424320202020202020202020202020202020202020202020 +select @@collation_connection; +@@collation_connection +latin1_swedish_ci +select hex(weight_string(cast(_latin1 0x80 as char))); +hex(weight_string(cast(_latin1 0x80 as char))) +80 +select hex(weight_string(cast(_latin1 0x808080 as char))); +hex(weight_string(cast(_latin1 0x808080 as char))) +808080 +select hex(weight_string(cast(_latin1 0x808080 as char) as char(2))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(2))) +8080 +select hex(weight_string(cast(_latin1 0x808080 as char) as char(3))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(3))) +808080 +select hex(weight_string(cast(_latin1 0x808080 as char) as char(5))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(5))) +8080802020 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0)) +80 +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0)) +8080 +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0)) +808020 +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0)) +80802020 +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0)) +8080202020 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0)) +80802020202020202020202020202020202020202020202020 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0)) +80 +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0)) +8080 +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0)) +808080 +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0)) +80808020 +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0)) +8080802020 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0)) +80808020202020202020202020202020202020202020202020 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0)) +80 +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0)) +8080 +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0)) +808080 +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0)) +80808020 +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0)) +8080802020 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0)) +80808020202020202020202020202020202020202020202020 +select @@collation_connection; +@@collation_connection +latin1_swedish_ci +select hex(weight_string('a' LEVEL 1)); +hex(weight_string('a' LEVEL 1)) +41 +select hex(weight_string('A' LEVEL 1)); +hex(weight_string('A' LEVEL 1)) +41 +select hex(weight_string('abc' LEVEL 1)); +hex(weight_string('abc' LEVEL 1)) +414243 +select hex(weight_string('abc' as char(2) LEVEL 1)); +hex(weight_string('abc' as char(2) LEVEL 1)) +4142 +select hex(weight_string('abc' as char(3) LEVEL 1)); +hex(weight_string('abc' as char(3) LEVEL 1)) +414243 +select hex(weight_string('abc' as char(5) LEVEL 1)); +hex(weight_string('abc' as char(5) LEVEL 1)) +4142432020 +select hex(weight_string('abc' as char(5) LEVEL 1 REVERSE)); +hex(weight_string('abc' as char(5) LEVEL 1 REVERSE)) +2020434241 +select hex(weight_string('abc' as char(5) LEVEL 1 DESC)); +hex(weight_string('abc' as char(5) LEVEL 1 DESC)) +BEBDBCDFDF +select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE)); +hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE)) +DFDFBCBDBE +set @@collation_connection=latin1_bin; +select @@collation_connection; +@@collation_connection +latin1_bin +CREATE TABLE t1 AS SELECT 'a' AS a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a)) FROM t1; +HEX(WEIGHT_STRING(a)) +61 +SELECT HEX(ws) FROM t2; +HEX(ws) +61 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(5) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(5) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a)) FROM t1; +HEX(WEIGHT_STRING(a)) +6161616161 +SELECT HEX(ws) FROM t2; +HEX(ws) +6161616161 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(3))) +616161 +SELECT HEX(ws) FROM t2; +HEX(ws) +616161 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61616161612020202020 +SELECT HEX(ws) FROM t2; +HEX(ws) +61616161612020202020 +DROP TABLE t2; +DROP TABLE t1; +select hex(weight_string('a')); +hex(weight_string('a')) +61 +select hex(weight_string('A')); +hex(weight_string('A')) +41 +select hex(weight_string('abc')); +hex(weight_string('abc')) +616263 +select hex(weight_string('abc' as char(2))); +hex(weight_string('abc' as char(2))) +6162 +select hex(weight_string('abc' as char(3))); +hex(weight_string('abc' as char(3))) +616263 +select hex(weight_string('abc' as char(5))); +hex(weight_string('abc' as char(5))) +6162632020 +select hex(weight_string('abc', 1, 2, 0xC0)); +hex(weight_string('abc', 1, 2, 0xC0)) +61 +select hex(weight_string('abc', 2, 2, 0xC0)); +hex(weight_string('abc', 2, 2, 0xC0)) +6162 +select hex(weight_string('abc', 3, 2, 0xC0)); +hex(weight_string('abc', 3, 2, 0xC0)) +616220 +select hex(weight_string('abc', 4, 2, 0xC0)); +hex(weight_string('abc', 4, 2, 0xC0)) +61622020 +select hex(weight_string('abc', 5, 2, 0xC0)); +hex(weight_string('abc', 5, 2, 0xC0)) +6162202020 +select hex(weight_string('abc',25, 2, 0xC0)); +hex(weight_string('abc',25, 2, 0xC0)) +61622020202020202020202020202020202020202020202020 +select hex(weight_string('abc', 1, 3, 0xC0)); +hex(weight_string('abc', 1, 3, 0xC0)) +61 +select hex(weight_string('abc', 2, 3, 0xC0)); +hex(weight_string('abc', 2, 3, 0xC0)) +6162 +select hex(weight_string('abc', 3, 3, 0xC0)); +hex(weight_string('abc', 3, 3, 0xC0)) +616263 +select hex(weight_string('abc', 4, 3, 0xC0)); +hex(weight_string('abc', 4, 3, 0xC0)) +61626320 +select hex(weight_string('abc', 5, 3, 0xC0)); +hex(weight_string('abc', 5, 3, 0xC0)) +6162632020 +select hex(weight_string('abc',25, 3, 0xC0)); +hex(weight_string('abc',25, 3, 0xC0)) +61626320202020202020202020202020202020202020202020 +select hex(weight_string('abc', 1, 4, 0xC0)); +hex(weight_string('abc', 1, 4, 0xC0)) +61 +select hex(weight_string('abc', 2, 4, 0xC0)); +hex(weight_string('abc', 2, 4, 0xC0)) +6162 +select hex(weight_string('abc', 3, 4, 0xC0)); +hex(weight_string('abc', 3, 4, 0xC0)) +616263 +select hex(weight_string('abc', 4, 4, 0xC0)); +hex(weight_string('abc', 4, 4, 0xC0)) +61626320 +select hex(weight_string('abc', 5, 4, 0xC0)); +hex(weight_string('abc', 5, 4, 0xC0)) +6162632020 +select hex(weight_string('abc',25, 4, 0xC0)); +hex(weight_string('abc',25, 4, 0xC0)) +61626320202020202020202020202020202020202020202020 +select @@collation_connection; +@@collation_connection +latin1_bin +select hex(weight_string(cast(_latin1 0x80 as char))); +hex(weight_string(cast(_latin1 0x80 as char))) +80 +select hex(weight_string(cast(_latin1 0x808080 as char))); +hex(weight_string(cast(_latin1 0x808080 as char))) +808080 +select hex(weight_string(cast(_latin1 0x808080 as char) as char(2))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(2))) +8080 +select hex(weight_string(cast(_latin1 0x808080 as char) as char(3))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(3))) +808080 +select hex(weight_string(cast(_latin1 0x808080 as char) as char(5))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(5))) +8080802020 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0)) +80 +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0)) +8080 +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0)) +808020 +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0)) +80802020 +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0)) +8080202020 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0)) +80802020202020202020202020202020202020202020202020 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0)) +80 +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0)) +8080 +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0)) +808080 +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0)) +80808020 +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0)) +8080802020 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0)) +80808020202020202020202020202020202020202020202020 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0)) +80 +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0)) +8080 +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0)) +808080 +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0)) +80808020 +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0)) +8080802020 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0)) +80808020202020202020202020202020202020202020202020 +select @@collation_connection; +@@collation_connection +latin1_bin +select hex(weight_string('a' LEVEL 1)); +hex(weight_string('a' LEVEL 1)) +61 +select hex(weight_string('A' LEVEL 1)); +hex(weight_string('A' LEVEL 1)) +41 +select hex(weight_string('abc' LEVEL 1)); +hex(weight_string('abc' LEVEL 1)) +616263 +select hex(weight_string('abc' as char(2) LEVEL 1)); +hex(weight_string('abc' as char(2) LEVEL 1)) +6162 +select hex(weight_string('abc' as char(3) LEVEL 1)); +hex(weight_string('abc' as char(3) LEVEL 1)) +616263 +select hex(weight_string('abc' as char(5) LEVEL 1)); +hex(weight_string('abc' as char(5) LEVEL 1)) +6162632020 +select hex(weight_string('abc' as char(5) LEVEL 1 REVERSE)); +hex(weight_string('abc' as char(5) LEVEL 1 REVERSE)) +2020636261 +select hex(weight_string('abc' as char(5) LEVEL 1 DESC)); +hex(weight_string('abc' as char(5) LEVEL 1 DESC)) +9E9D9CDFDF +select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE)); +hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE)) +DFDF9C9D9E +set @@collation_connection=latin1_general_cs; +select @@collation_connection; +@@collation_connection +latin1_general_cs +CREATE TABLE t1 AS SELECT 'a' AS a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a)) FROM t1; +HEX(WEIGHT_STRING(a)) +42 +SELECT HEX(ws) FROM t2; +HEX(ws) +42 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(5) CHARACTER SET latin1 COLLATE latin1_general_cs DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(5) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a)) FROM t1; +HEX(WEIGHT_STRING(a)) +4242424242 +SELECT HEX(ws) FROM t2; +HEX(ws) +4242424242 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(3))) +424242 +SELECT HEX(ws) FROM t2; +HEX(ws) +424242 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +42424242422020202020 +SELECT HEX(ws) FROM t2; +HEX(ws) +42424242422020202020 +DROP TABLE t2; +DROP TABLE t1; +select hex(weight_string('a')); +hex(weight_string('a')) +42 +select hex(weight_string('A')); +hex(weight_string('A')) +41 +select hex(weight_string('abc')); +hex(weight_string('abc')) +425254 +select hex(weight_string('abc' as char(2))); +hex(weight_string('abc' as char(2))) +4252 +select hex(weight_string('abc' as char(3))); +hex(weight_string('abc' as char(3))) +425254 +select hex(weight_string('abc' as char(5))); +hex(weight_string('abc' as char(5))) +4252542020 +select hex(weight_string('abc', 1, 2, 0xC0)); +hex(weight_string('abc', 1, 2, 0xC0)) +42 +select hex(weight_string('abc', 2, 2, 0xC0)); +hex(weight_string('abc', 2, 2, 0xC0)) +4252 +select hex(weight_string('abc', 3, 2, 0xC0)); +hex(weight_string('abc', 3, 2, 0xC0)) +425220 +select hex(weight_string('abc', 4, 2, 0xC0)); +hex(weight_string('abc', 4, 2, 0xC0)) +42522020 +select hex(weight_string('abc', 5, 2, 0xC0)); +hex(weight_string('abc', 5, 2, 0xC0)) +4252202020 +select hex(weight_string('abc',25, 2, 0xC0)); +hex(weight_string('abc',25, 2, 0xC0)) +42522020202020202020202020202020202020202020202020 +select hex(weight_string('abc', 1, 3, 0xC0)); +hex(weight_string('abc', 1, 3, 0xC0)) +42 +select hex(weight_string('abc', 2, 3, 0xC0)); +hex(weight_string('abc', 2, 3, 0xC0)) +4252 +select hex(weight_string('abc', 3, 3, 0xC0)); +hex(weight_string('abc', 3, 3, 0xC0)) +425254 +select hex(weight_string('abc', 4, 3, 0xC0)); +hex(weight_string('abc', 4, 3, 0xC0)) +42525420 +select hex(weight_string('abc', 5, 3, 0xC0)); +hex(weight_string('abc', 5, 3, 0xC0)) +4252542020 +select hex(weight_string('abc',25, 3, 0xC0)); +hex(weight_string('abc',25, 3, 0xC0)) +42525420202020202020202020202020202020202020202020 +select hex(weight_string('abc', 1, 4, 0xC0)); +hex(weight_string('abc', 1, 4, 0xC0)) +42 +select hex(weight_string('abc', 2, 4, 0xC0)); +hex(weight_string('abc', 2, 4, 0xC0)) +4252 +select hex(weight_string('abc', 3, 4, 0xC0)); +hex(weight_string('abc', 3, 4, 0xC0)) +425254 +select hex(weight_string('abc', 4, 4, 0xC0)); +hex(weight_string('abc', 4, 4, 0xC0)) +42525420 +select hex(weight_string('abc', 5, 4, 0xC0)); +hex(weight_string('abc', 5, 4, 0xC0)) +4252542020 +select hex(weight_string('abc',25, 4, 0xC0)); +hex(weight_string('abc',25, 4, 0xC0)) +42525420202020202020202020202020202020202020202020 +select @@collation_connection; +@@collation_connection +latin1_general_cs +select hex(weight_string(cast(_latin1 0x80 as char))); +hex(weight_string(cast(_latin1 0x80 as char))) +C0 +select hex(weight_string(cast(_latin1 0x808080 as char))); +hex(weight_string(cast(_latin1 0x808080 as char))) +C0C0C0 +select hex(weight_string(cast(_latin1 0x808080 as char) as char(2))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(2))) +C0C0 +select hex(weight_string(cast(_latin1 0x808080 as char) as char(3))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(3))) +C0C0C0 +select hex(weight_string(cast(_latin1 0x808080 as char) as char(5))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(5))) +C0C0C02020 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0)) +C0 +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0)) +C0C0 +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0)) +C0C020 +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0)) +C0C02020 +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0)) +C0C0202020 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0)) +C0C02020202020202020202020202020202020202020202020 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0)) +C0 +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0)) +C0C0 +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0)) +C0C0C0 +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0)) +C0C0C020 +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0)) +C0C0C02020 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0)) +C0C0C020202020202020202020202020202020202020202020 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0)) +C0 +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0)) +C0C0 +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0)) +C0C0C0 +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0)) +C0C0C020 +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0)) +C0C0C02020 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0)) +C0C0C020202020202020202020202020202020202020202020 +select @@collation_connection; +@@collation_connection +latin1_general_cs +select hex(weight_string('a' LEVEL 1)); +hex(weight_string('a' LEVEL 1)) +42 +select hex(weight_string('A' LEVEL 1)); +hex(weight_string('A' LEVEL 1)) +41 +select hex(weight_string('abc' LEVEL 1)); +hex(weight_string('abc' LEVEL 1)) +425254 +select hex(weight_string('abc' as char(2) LEVEL 1)); +hex(weight_string('abc' as char(2) LEVEL 1)) +4252 +select hex(weight_string('abc' as char(3) LEVEL 1)); +hex(weight_string('abc' as char(3) LEVEL 1)) +425254 +select hex(weight_string('abc' as char(5) LEVEL 1)); +hex(weight_string('abc' as char(5) LEVEL 1)) +4252542020 +select hex(weight_string('abc' as char(5) LEVEL 1 REVERSE)); +hex(weight_string('abc' as char(5) LEVEL 1 REVERSE)) +2020545242 +select hex(weight_string('abc' as char(5) LEVEL 1 DESC)); +hex(weight_string('abc' as char(5) LEVEL 1 DESC)) +BDADABDFDF +select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE)); +hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE)) +DFDFABADBD +set @@collation_connection=binary; +select @@collation_connection; +@@collation_connection +binary +CREATE TABLE t1 AS SELECT 'a' AS a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varbinary(1) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a)) FROM t1; +HEX(WEIGHT_STRING(a)) +61 +SELECT HEX(ws) FROM t2; +HEX(ws) +61 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varbinary(5) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(5) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a)) FROM t1; +HEX(WEIGHT_STRING(a)) +6161616161 +SELECT HEX(ws) FROM t2; +HEX(ws) +6161616161 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(3))) +616161 +SELECT HEX(ws) FROM t2; +HEX(ws) +616161 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61616161610000000000 +SELECT HEX(ws) FROM t2; +HEX(ws) +61616161610000000000 +DROP TABLE t2; +DROP TABLE t1; +select hex(weight_string('a')); +hex(weight_string('a')) +61 +select hex(weight_string('A')); +hex(weight_string('A')) +41 +select hex(weight_string('abc')); +hex(weight_string('abc')) +616263 +select hex(weight_string('abc' as char(2))); +hex(weight_string('abc' as char(2))) +6162 +select hex(weight_string('abc' as char(3))); +hex(weight_string('abc' as char(3))) +616263 +select hex(weight_string('abc' as char(5))); +hex(weight_string('abc' as char(5))) +6162630000 +select hex(weight_string('abc', 1, 2, 0xC0)); +hex(weight_string('abc', 1, 2, 0xC0)) +61 +select hex(weight_string('abc', 2, 2, 0xC0)); +hex(weight_string('abc', 2, 2, 0xC0)) +6162 +select hex(weight_string('abc', 3, 2, 0xC0)); +hex(weight_string('abc', 3, 2, 0xC0)) +616200 +select hex(weight_string('abc', 4, 2, 0xC0)); +hex(weight_string('abc', 4, 2, 0xC0)) +61620000 +select hex(weight_string('abc', 5, 2, 0xC0)); +hex(weight_string('abc', 5, 2, 0xC0)) +6162000000 +select hex(weight_string('abc',25, 2, 0xC0)); +hex(weight_string('abc',25, 2, 0xC0)) +61620000000000000000000000000000000000000000000000 +select hex(weight_string('abc', 1, 3, 0xC0)); +hex(weight_string('abc', 1, 3, 0xC0)) +61 +select hex(weight_string('abc', 2, 3, 0xC0)); +hex(weight_string('abc', 2, 3, 0xC0)) +6162 +select hex(weight_string('abc', 3, 3, 0xC0)); +hex(weight_string('abc', 3, 3, 0xC0)) +616263 +select hex(weight_string('abc', 4, 3, 0xC0)); +hex(weight_string('abc', 4, 3, 0xC0)) +61626300 +select hex(weight_string('abc', 5, 3, 0xC0)); +hex(weight_string('abc', 5, 3, 0xC0)) +6162630000 +select hex(weight_string('abc',25, 3, 0xC0)); +hex(weight_string('abc',25, 3, 0xC0)) +61626300000000000000000000000000000000000000000000 +select hex(weight_string('abc', 1, 4, 0xC0)); +hex(weight_string('abc', 1, 4, 0xC0)) +61 +select hex(weight_string('abc', 2, 4, 0xC0)); +hex(weight_string('abc', 2, 4, 0xC0)) +6162 +select hex(weight_string('abc', 3, 4, 0xC0)); +hex(weight_string('abc', 3, 4, 0xC0)) +616263 +select hex(weight_string('abc', 4, 4, 0xC0)); +hex(weight_string('abc', 4, 4, 0xC0)) +61626300 +select hex(weight_string('abc', 5, 4, 0xC0)); +hex(weight_string('abc', 5, 4, 0xC0)) +6162630000 +select hex(weight_string('abc',25, 4, 0xC0)); +hex(weight_string('abc',25, 4, 0xC0)) +61626300000000000000000000000000000000000000000000 +select @@collation_connection; +@@collation_connection +binary +select hex(weight_string(cast(_latin1 0x80 as char))); +hex(weight_string(cast(_latin1 0x80 as char))) +80 +select hex(weight_string(cast(_latin1 0x808080 as char))); +hex(weight_string(cast(_latin1 0x808080 as char))) +808080 +select hex(weight_string(cast(_latin1 0x808080 as char) as char(2))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(2))) +8080 +select hex(weight_string(cast(_latin1 0x808080 as char) as char(3))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(3))) +808080 +select hex(weight_string(cast(_latin1 0x808080 as char) as char(5))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(5))) +8080800000 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0)) +80 +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0)) +8080 +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0)) +808000 +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0)) +80800000 +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0)) +8080000000 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0)) +80800000000000000000000000000000000000000000000000 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0)) +80 +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0)) +8080 +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0)) +808080 +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0)) +80808000 +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0)) +8080800000 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0)) +80808000000000000000000000000000000000000000000000 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0)) +80 +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0)) +8080 +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0)) +808080 +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0)) +80808000 +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0)) +8080800000 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0)) +80808000000000000000000000000000000000000000000000 +select @@collation_connection; +@@collation_connection +binary +select hex(weight_string('a' LEVEL 1)); +hex(weight_string('a' LEVEL 1)) +61 +select hex(weight_string('A' LEVEL 1)); +hex(weight_string('A' LEVEL 1)) +41 +select hex(weight_string('abc' LEVEL 1)); +hex(weight_string('abc' LEVEL 1)) +616263 +select hex(weight_string('abc' as char(2) LEVEL 1)); +hex(weight_string('abc' as char(2) LEVEL 1)) +6162 +select hex(weight_string('abc' as char(3) LEVEL 1)); +hex(weight_string('abc' as char(3) LEVEL 1)) +616263 +select hex(weight_string('abc' as char(5) LEVEL 1)); +hex(weight_string('abc' as char(5) LEVEL 1)) +6162630000 +select hex(weight_string('abc' as char(5) LEVEL 1 REVERSE)); +hex(weight_string('abc' as char(5) LEVEL 1 REVERSE)) +0000636261 +select hex(weight_string('abc' as char(5) LEVEL 1 DESC)); +hex(weight_string('abc' as char(5) LEVEL 1 DESC)) +9E9D9CFFFF +select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE)); +hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE)) +FFFF9C9D9E +set names latin1; +# +# End of 5.6 tests +# +# +# Start of 10.0 tests +# +# Start of ctype_unescape.inc +SET sql_mode = ''; +SET @query=_binary'SELECT CHARSET(\'test\'),@@character_set_client,@@character_set_connection'; +PREPARE stmt FROM @query; +EXECUTE stmt; +CHARSET('test') @@character_set_client @@character_set_connection +latin1 latin1 latin1 +DEALLOCATE PREPARE stmt; +CREATE TABLE allbytes (a VARBINARY(10)); +# Using selected bytes combinations +CREATE TABLE halfs (a INT); +INSERT INTO halfs VALUES (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07); +INSERT INTO halfs VALUES (0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F); +CREATE TEMPORARY TABLE bytes (a BINARY(1), KEY(a)) ENGINE=MyISAM; +INSERT INTO bytes SELECT CHAR((t1.a << 4) | t2.a USING BINARY) FROM halfs t1, halfs t2; +DROP TABLE halfs; +CREATE TABLE selected_bytes (a VARBINARY(10)); +INSERT INTO selected_bytes (a) VALUES ('\0'),('\b'),('\t'),('\r'),('\n'),('\Z'); +INSERT INTO selected_bytes (a) VALUES ('0'),('b'),('t'),('r'),('n'),('Z'); +INSERT INTO selected_bytes (a) VALUES ('\\'),('_'),('%'),(0x22),(0x27); +INSERT INTO selected_bytes (a) VALUES ('a'); +INSERT INTO selected_bytes (a) VALUES +(0x3F), # 7bit +(0x40), # 7bit mbtail +(0x7E), # 7bit mbtail nonascii-8bit +(0x7F), # 7bit nonascii-8bit +(0x80), # mbtail bad-mb +(0x81), # mbhead mbtail +(0x9F), # mbhead mbtail bad-mb +(0xA0), # mbhead mbtail bad-mb +(0xA1), # mbhead mbtail nonascii-8bit +(0xE0), # mbhead mbtai +(0xEF), # mbhead mbtail +(0xF9), # mbhead mbtail +(0xFA), # mbhead mbtail bad-mb +(0xFC), # mbhead mbtail bad-mb +(0xFD), # mbhead mbtail bad-mb +(0xFE), # mbhead mbtial bad-mb +(0xFF); +INSERT INTO allbytes (a) SELECT a FROM bytes; +INSERT INTO allbytes (a) SELECT CONCAT(t1.a,t2.a) FROM selected_bytes t1,selected_bytes t2; +INSERT INTO allbytes (a) SELECT CONCAT(0x5C,t1.a,t2.a) FROM selected_bytes t1,selected_bytes t2; +INSERT INTO allbytes (a) SELECT CONCAT(0x5C,t1.a,0x5C,t2.a) FROM selected_bytes t1,selected_bytes t2; +DROP TABLE selected_bytes; +DELETE FROM allbytes WHERE +OCTET_LENGTH(a)>1 AND +LOCATE(0x5C,a)=0 AND +a NOT LIKE '%\'%' AND + a NOT LIKE '%"%'; +CREATE PROCEDURE p1(val VARBINARY(10)) +BEGIN +DECLARE EXIT HANDLER FOR SQLSTATE '42000' INSERT INTO t1 (a,b) VALUES(val,NULL); +SET @query=CONCAT(_binary"INSERT INTO t1 (a,b) VALUES (0x",HEX(val),",'",val,"')"); +PREPARE stmt FROM @query; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +END// +CREATE PROCEDURE p2() +BEGIN +DECLARE val VARBINARY(10); +DECLARE done INT DEFAULT FALSE; +DECLARE stmt CURSOR FOR SELECT a FROM allbytes; +DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=TRUE; +OPEN stmt; +read_loop1: LOOP +FETCH stmt INTO val; +IF done THEN +LEAVE read_loop1; +END IF; +CALL p1(val); +END LOOP; +CLOSE stmt; +END// +CREATE FUNCTION iswellformed(a VARBINARY(256)) RETURNS INT RETURN a=BINARY CONVERT(a USING latin1);// +CREATE FUNCTION unescape(a VARBINARY(256)) RETURNS VARBINARY(256) +BEGIN +# We need to do it in a way to avoid producing new escape sequences +# First, enclose all known escsape sequences to '{{xx}}' + # - Backslash not followed by a LIKE pattern characters _ and % +# - Double escapes +# This uses PCRE Branch Reset Groups: (?|(alt1)|(alt2)|(alt3)). +# So '\\1' in the last argument always means the match, no matter +# which alternative it came from. +SET a=REGEXP_REPLACE(a,'(?|(\\\\[^_%])|(\\x{27}\\x{27}))','{{\\1}}'); +# Now unescape all enclosed standard escape sequences +SET a=REPLACE(a,'{{\\0}}', '\0'); +SET a=REPLACE(a,'{{\\b}}', '\b'); +SET a=REPLACE(a,'{{\\t}}', '\t'); +SET a=REPLACE(a,'{{\\r}}', '\r'); +SET a=REPLACE(a,'{{\\n}}', '\n'); +SET a=REPLACE(a,'{{\\Z}}', '\Z'); +SET a=REPLACE(a,'{{\\\'}}', '\''); +# Unescape double quotes +SET a=REPLACE(a,'{{\'\'}}', '\''); + # Unescape the rest: all other \x sequences mean just 'x' + SET a=REGEXP_REPLACE(a, '{{\\\\(.|\\R)}}', '\\1'); + RETURN a; +END// +CREATE FUNCTION unescape_type(a VARBINARY(256),b VARBINARY(256)) RETURNS VARBINARY(256) +BEGIN +RETURN CASE +WHEN b IS NULL THEN '[SyntErr]' + WHEN a=b THEN CASE +WHEN OCTET_LENGTH(a)=1 THEN '[Preserve]' + WHEN a RLIKE '\\\\[_%]' THEN '[Preserve][LIKE]' + WHEN a RLIKE '^[[:ascii:]]+$' THEN '[Preserve][ASCII]' + ELSE '[Preserv][MB]' END +WHEN REPLACE(a,0x5C,'')=b THEN '[Trivial]' + WHEN UNESCAPE(a)=b THEN '[Regular]' + ELSE '[Special]' END; +END// +CREATE FUNCTION wellformedness(a VARBINARY(256), b VARBINARY(256)) +RETURNS VARBINARY(256) +BEGIN +RETURN CASE +WHEN b IS NULL THEN '' + WHEN NOT iswellformed(a) AND iswellformed(b) THEN '[FIXED]' + WHEN iswellformed(a) AND NOT iswellformed(b) THEN '[BROKE]' + WHEN NOT iswellformed(a) AND NOT iswellformed(b) THEN '[ILSEQ]' + ELSE '' + END; +END// +CREATE FUNCTION mysql_real_escape_string_generated(a VARBINARY(256)) +RETURNS VARBINARY(256) +BEGIN +DECLARE a1 BINARY(1) DEFAULT SUBSTR(a,1,1); +DECLARE a2 BINARY(1) DEFAULT SUBSTR(a,2,1); +DECLARE a3 BINARY(1) DEFAULT SUBSTR(a,3,1); +DECLARE a4 BINARY(1) DEFAULT SUBSTR(a,4,1); +DECLARE a2a4 BINARY(2) DEFAULT CONCAT(a2,a4); +RETURN CASE +WHEN (a1=0x5C) AND +(a3=0x5C) AND +(a2>0x7F) AND +(a4 NOT IN ('_','%','0','t','r','n','Z')) AND +iswellformed(a2a4) THEN '[USER]' + ELSE '' + END; +END// +CREATE TABLE t1 (a VARBINARY(10),b VARBINARY(10)); +CALL p2(); +SELECT HEX(a),HEX(b), +CONCAT(unescape_type(a,b), +wellformedness(a,b), +mysql_real_escape_string_generated(a), +IF(UNESCAPE(a)<>b,CONCAT('[BAD',HEX(UNESCAPE(a)),']'),'')) AS comment +FROM t1 ORDER BY LENGTH(a),a; +HEX(a) HEX(b) comment +00 00 [Preserve] +01 01 [Preserve] +02 02 [Preserve] +03 03 [Preserve] +04 04 [Preserve] +05 05 [Preserve] +06 06 [Preserve] +07 07 [Preserve] +08 08 [Preserve] +09 09 [Preserve] +0A 0A [Preserve] +0B 0B [Preserve] +0C 0C [Preserve] +0D 0D [Preserve] +0E 0E [Preserve] +0F 0F [Preserve] +10 10 [Preserve] +11 11 [Preserve] +12 12 [Preserve] +13 13 [Preserve] +14 14 [Preserve] +15 15 [Preserve] +16 16 [Preserve] +17 17 [Preserve] +18 18 [Preserve] +19 19 [Preserve] +1A 1A [Preserve] +1B 1B [Preserve] +1C 1C [Preserve] +1D 1D [Preserve] +1E 1E [Preserve] +1F 1F [Preserve] +20 20 [Preserve] +21 21 [Preserve] +22 22 [Preserve] +23 23 [Preserve] +24 24 [Preserve] +25 25 [Preserve] +26 26 [Preserve] +27 NULL [SyntErr] +28 28 [Preserve] +29 29 [Preserve] +2A 2A [Preserve] +2B 2B [Preserve] +2C 2C [Preserve] +2D 2D [Preserve] +2E 2E [Preserve] +2F 2F [Preserve] +30 30 [Preserve] +31 31 [Preserve] +32 32 [Preserve] +33 33 [Preserve] +34 34 [Preserve] +35 35 [Preserve] +36 36 [Preserve] +37 37 [Preserve] +38 38 [Preserve] +39 39 [Preserve] +3A 3A [Preserve] +3B 3B [Preserve] +3C 3C [Preserve] +3D 3D [Preserve] +3E 3E [Preserve] +3F 3F [Preserve] +40 40 [Preserve] +41 41 [Preserve] +42 42 [Preserve] +43 43 [Preserve] +44 44 [Preserve] +45 45 [Preserve] +46 46 [Preserve] +47 47 [Preserve] +48 48 [Preserve] +49 49 [Preserve] +4A 4A [Preserve] +4B 4B [Preserve] +4C 4C [Preserve] +4D 4D [Preserve] +4E 4E [Preserve] +4F 4F [Preserve] +50 50 [Preserve] +51 51 [Preserve] +52 52 [Preserve] +53 53 [Preserve] +54 54 [Preserve] +55 55 [Preserve] +56 56 [Preserve] +57 57 [Preserve] +58 58 [Preserve] +59 59 [Preserve] +5A 5A [Preserve] +5B 5B [Preserve] +5C NULL [SyntErr] +5D 5D [Preserve] +5E 5E [Preserve] +5F 5F [Preserve] +60 60 [Preserve] +61 61 [Preserve] +62 62 [Preserve] +63 63 [Preserve] +64 64 [Preserve] +65 65 [Preserve] +66 66 [Preserve] +67 67 [Preserve] +68 68 [Preserve] +69 69 [Preserve] +6A 6A [Preserve] +6B 6B [Preserve] +6C 6C [Preserve] +6D 6D [Preserve] +6E 6E [Preserve] +6F 6F [Preserve] +70 70 [Preserve] +71 71 [Preserve] +72 72 [Preserve] +73 73 [Preserve] +74 74 [Preserve] +75 75 [Preserve] +76 76 [Preserve] +77 77 [Preserve] +78 78 [Preserve] +79 79 [Preserve] +7A 7A [Preserve] +7B 7B [Preserve] +7C 7C [Preserve] +7D 7D [Preserve] +7E 7E [Preserve] +7F 7F [Preserve] +80 80 [Preserve] +81 81 [Preserve] +82 82 [Preserve] +83 83 [Preserve] +84 84 [Preserve] +85 85 [Preserve] +86 86 [Preserve] +87 87 [Preserve] +88 88 [Preserve] +89 89 [Preserve] +8A 8A [Preserve] +8B 8B [Preserve] +8C 8C [Preserve] +8D 8D [Preserve] +8E 8E [Preserve] +8F 8F [Preserve] +90 90 [Preserve] +91 91 [Preserve] +92 92 [Preserve] +93 93 [Preserve] +94 94 [Preserve] +95 95 [Preserve] +96 96 [Preserve] +97 97 [Preserve] +98 98 [Preserve] +99 99 [Preserve] +9A 9A [Preserve] +9B 9B [Preserve] +9C 9C [Preserve] +9D 9D [Preserve] +9E 9E [Preserve] +9F 9F [Preserve] +A0 A0 [Preserve] +A1 A1 [Preserve] +A2 A2 [Preserve] +A3 A3 [Preserve] +A4 A4 [Preserve] +A5 A5 [Preserve] +A6 A6 [Preserve] +A7 A7 [Preserve] +A8 A8 [Preserve] +A9 A9 [Preserve] +AA AA [Preserve] +AB AB [Preserve] +AC AC [Preserve] +AD AD [Preserve] +AE AE [Preserve] +AF AF [Preserve] +B0 B0 [Preserve] +B1 B1 [Preserve] +B2 B2 [Preserve] +B3 B3 [Preserve] +B4 B4 [Preserve] +B5 B5 [Preserve] +B6 B6 [Preserve] +B7 B7 [Preserve] +B8 B8 [Preserve] +B9 B9 [Preserve] +BA BA [Preserve] +BB BB [Preserve] +BC BC [Preserve] +BD BD [Preserve] +BE BE [Preserve] +BF BF [Preserve] +C0 C0 [Preserve] +C1 C1 [Preserve] +C2 C2 [Preserve] +C3 C3 [Preserve] +C4 C4 [Preserve] +C5 C5 [Preserve] +C6 C6 [Preserve] +C7 C7 [Preserve] +C8 C8 [Preserve] +C9 C9 [Preserve] +CA CA [Preserve] +CB CB [Preserve] +CC CC [Preserve] +CD CD [Preserve] +CE CE [Preserve] +CF CF [Preserve] +D0 D0 [Preserve] +D1 D1 [Preserve] +D2 D2 [Preserve] +D3 D3 [Preserve] +D4 D4 [Preserve] +D5 D5 [Preserve] +D6 D6 [Preserve] +D7 D7 [Preserve] +D8 D8 [Preserve] +D9 D9 [Preserve] +DA DA [Preserve] +DB DB [Preserve] +DC DC [Preserve] +DD DD [Preserve] +DE DE [Preserve] +DF DF [Preserve] +E0 E0 [Preserve] +E1 E1 [Preserve] +E2 E2 [Preserve] +E3 E3 [Preserve] +E4 E4 [Preserve] +E5 E5 [Preserve] +E6 E6 [Preserve] +E7 E7 [Preserve] +E8 E8 [Preserve] +E9 E9 [Preserve] +EA EA [Preserve] +EB EB [Preserve] +EC EC [Preserve] +ED ED [Preserve] +EE EE [Preserve] +EF EF [Preserve] +F0 F0 [Preserve] +F1 F1 [Preserve] +F2 F2 [Preserve] +F3 F3 [Preserve] +F4 F4 [Preserve] +F5 F5 [Preserve] +F6 F6 [Preserve] +F7 F7 [Preserve] +F8 F8 [Preserve] +F9 F9 [Preserve] +FA FA [Preserve] +FB FB [Preserve] +FC FC [Preserve] +FD FD [Preserve] +FE FE [Preserve] +FF FF [Preserve] +0022 0022 [Preserve][ASCII] +0027 NULL [SyntErr] +005C NULL [SyntErr] +0822 0822 [Preserve][ASCII] +0827 NULL [SyntErr] +085C NULL [SyntErr] +0922 0922 [Preserve][ASCII] +0927 NULL [SyntErr] +095C NULL [SyntErr] +0A22 0A22 [Preserve][ASCII] +0A27 NULL [SyntErr] +0A5C NULL [SyntErr] +0D22 0D22 [Preserve][ASCII] +0D27 NULL [SyntErr] +0D5C NULL [SyntErr] +1A22 1A22 [Preserve][ASCII] +1A27 NULL [SyntErr] +1A5C NULL [SyntErr] +2200 2200 [Preserve][ASCII] +2208 2208 [Preserve][ASCII] +2209 2209 [Preserve][ASCII] +220A 220A [Preserve][ASCII] +220D 220D [Preserve][ASCII] +221A 221A [Preserve][ASCII] +2222 2222 [Preserve][ASCII] +2225 2225 [Preserve][ASCII] +2227 NULL [SyntErr] +2230 2230 [Preserve][ASCII] +223F 223F [Preserve][ASCII] +2240 2240 [Preserve][ASCII] +225A 225A [Preserve][ASCII] +225C NULL [SyntErr] +225F 225F [Preserve][ASCII] +2261 2261 [Preserve][ASCII] +2262 2262 [Preserve][ASCII] +226E 226E [Preserve][ASCII] +2272 2272 [Preserve][ASCII] +2274 2274 [Preserve][ASCII] +227E 227E [Preserve][ASCII] +227F 227F [Preserve][ASCII] +2280 2280 [Preserv][MB] +2281 2281 [Preserv][MB] +229F 229F [Preserv][MB] +22A0 22A0 [Preserv][MB] +22A1 22A1 [Preserv][MB] +22E0 22E0 [Preserv][MB] +22EF 22EF [Preserv][MB] +22F9 22F9 [Preserv][MB] +22FA 22FA [Preserv][MB] +22FC 22FC [Preserv][MB] +22FD 22FD [Preserv][MB] +22FE 22FE [Preserv][MB] +22FF 22FF [Preserv][MB] +2522 2522 [Preserve][ASCII] +2527 NULL [SyntErr] +255C NULL [SyntErr] +2700 NULL [SyntErr] +2708 NULL [SyntErr] +2709 NULL [SyntErr] +270A NULL [SyntErr] +270D NULL [SyntErr] +271A NULL [SyntErr] +2722 NULL [SyntErr] +2725 NULL [SyntErr] +2727 27 [Regular] +2730 NULL [SyntErr] +273F NULL [SyntErr] +2740 NULL [SyntErr] +275A NULL [SyntErr] +275C NULL [SyntErr] +275F NULL [SyntErr] +2761 NULL [SyntErr] +2762 NULL [SyntErr] +276E NULL [SyntErr] +2772 NULL [SyntErr] +2774 NULL [SyntErr] +277E NULL [SyntErr] +277F NULL [SyntErr] +2780 NULL [SyntErr] +2781 NULL [SyntErr] +279F NULL [SyntErr] +27A0 NULL [SyntErr] +27A1 NULL [SyntErr] +27E0 NULL [SyntErr] +27EF NULL [SyntErr] +27F9 NULL [SyntErr] +27FA NULL [SyntErr] +27FC NULL [SyntErr] +27FD NULL [SyntErr] +27FE NULL [SyntErr] +27FF NULL [SyntErr] +3022 3022 [Preserve][ASCII] +3027 NULL [SyntErr] +305C NULL [SyntErr] +3F22 3F22 [Preserve][ASCII] +3F27 NULL [SyntErr] +3F5C NULL [SyntErr] +4022 4022 [Preserve][ASCII] +4027 NULL [SyntErr] +405C NULL [SyntErr] +5A22 5A22 [Preserve][ASCII] +5A27 NULL [SyntErr] +5A5C NULL [SyntErr] +5C00 00 [Trivial] +5C08 08 [Trivial] +5C09 09 [Trivial] +5C0A 0A [Trivial] +5C0D 0D [Trivial] +5C1A 1A [Trivial] +5C22 22 [Trivial] +5C25 5C25 [Preserve][LIKE] +5C27 27 [Trivial] +5C30 00 [Regular] +5C3F 3F [Trivial] +5C40 40 [Trivial] +5C5A 1A [Regular] +5C5C 5C [Regular] +5C5F 5C5F [Preserve][LIKE] +5C61 61 [Trivial] +5C62 08 [Regular] +5C6E 0A [Regular] +5C72 0D [Regular] +5C74 09 [Regular] +5C7E 7E [Trivial] +5C7F 7F [Trivial] +5C80 80 [Trivial] +5C81 81 [Trivial] +5C9F 9F [Trivial] +5CA0 A0 [Trivial] +5CA1 A1 [Trivial] +5CE0 E0 [Trivial] +5CEF EF [Trivial] +5CF9 F9 [Trivial] +5CFA FA [Trivial] +5CFC FC [Trivial] +5CFD FD [Trivial] +5CFE FE [Trivial] +5CFF FF [Trivial] +5F22 5F22 [Preserve][ASCII] +5F27 NULL [SyntErr] +5F5C NULL [SyntErr] +6122 6122 [Preserve][ASCII] +6127 NULL [SyntErr] +615C NULL [SyntErr] +6222 6222 [Preserve][ASCII] +6227 NULL [SyntErr] +625C NULL [SyntErr] +6E22 6E22 [Preserve][ASCII] +6E27 NULL [SyntErr] +6E5C NULL [SyntErr] +7222 7222 [Preserve][ASCII] +7227 NULL [SyntErr] +725C NULL [SyntErr] +7422 7422 [Preserve][ASCII] +7427 NULL [SyntErr] +745C NULL [SyntErr] +7E22 7E22 [Preserve][ASCII] +7E27 NULL [SyntErr] +7E5C NULL [SyntErr] +7F22 7F22 [Preserve][ASCII] +7F27 NULL [SyntErr] +7F5C NULL [SyntErr] +8022 8022 [Preserv][MB] +8027 NULL [SyntErr] +805C NULL [SyntErr] +8122 8122 [Preserv][MB] +8127 NULL [SyntErr] +815C NULL [SyntErr] +9F22 9F22 [Preserv][MB] +9F27 NULL [SyntErr] +9F5C NULL [SyntErr] +A022 A022 [Preserv][MB] +A027 NULL [SyntErr] +A05C NULL [SyntErr] +A122 A122 [Preserv][MB] +A127 NULL [SyntErr] +A15C NULL [SyntErr] +E022 E022 [Preserv][MB] +E027 NULL [SyntErr] +E05C NULL [SyntErr] +EF22 EF22 [Preserv][MB] +EF27 NULL [SyntErr] +EF5C NULL [SyntErr] +F922 F922 [Preserv][MB] +F927 NULL [SyntErr] +F95C NULL [SyntErr] +FA22 FA22 [Preserv][MB] +FA27 NULL [SyntErr] +FA5C NULL [SyntErr] +FC22 FC22 [Preserv][MB] +FC27 NULL [SyntErr] +FC5C NULL [SyntErr] +FD22 FD22 [Preserv][MB] +FD27 NULL [SyntErr] +FD5C NULL [SyntErr] +FE22 FE22 [Preserv][MB] +FE27 NULL [SyntErr] +FE5C NULL [SyntErr] +FF22 FF22 [Preserv][MB] +FF27 NULL [SyntErr] +FF5C NULL [SyntErr] +5C0000 0000 [Trivial] +5C0008 0008 [Trivial] +5C0009 0009 [Trivial] +5C000A 000A [Trivial] +5C000D 000D [Trivial] +5C001A 001A [Trivial] +5C0022 0022 [Trivial] +5C0025 0025 [Trivial] +5C0027 NULL [SyntErr] +5C0030 0030 [Trivial] +5C003F 003F [Trivial] +5C0040 0040 [Trivial] +5C005A 005A [Trivial] +5C005C NULL [SyntErr] +5C005F 005F [Trivial] +5C0061 0061 [Trivial] +5C0062 0062 [Trivial] +5C006E 006E [Trivial] +5C0072 0072 [Trivial] +5C0074 0074 [Trivial] +5C007E 007E [Trivial] +5C007F 007F [Trivial] +5C0080 0080 [Trivial] +5C0081 0081 [Trivial] +5C009F 009F [Trivial] +5C00A0 00A0 [Trivial] +5C00A1 00A1 [Trivial] +5C00E0 00E0 [Trivial] +5C00EF 00EF [Trivial] +5C00F9 00F9 [Trivial] +5C00FA 00FA [Trivial] +5C00FC 00FC [Trivial] +5C00FD 00FD [Trivial] +5C00FE 00FE [Trivial] +5C00FF 00FF [Trivial] +5C0800 0800 [Trivial] +5C0808 0808 [Trivial] +5C0809 0809 [Trivial] +5C080A 080A [Trivial] +5C080D 080D [Trivial] +5C081A 081A [Trivial] +5C0822 0822 [Trivial] +5C0825 0825 [Trivial] +5C0827 NULL [SyntErr] +5C0830 0830 [Trivial] +5C083F 083F [Trivial] +5C0840 0840 [Trivial] +5C085A 085A [Trivial] +5C085C NULL [SyntErr] +5C085F 085F [Trivial] +5C0861 0861 [Trivial] +5C0862 0862 [Trivial] +5C086E 086E [Trivial] +5C0872 0872 [Trivial] +5C0874 0874 [Trivial] +5C087E 087E [Trivial] +5C087F 087F [Trivial] +5C0880 0880 [Trivial] +5C0881 0881 [Trivial] +5C089F 089F [Trivial] +5C08A0 08A0 [Trivial] +5C08A1 08A1 [Trivial] +5C08E0 08E0 [Trivial] +5C08EF 08EF [Trivial] +5C08F9 08F9 [Trivial] +5C08FA 08FA [Trivial] +5C08FC 08FC [Trivial] +5C08FD 08FD [Trivial] +5C08FE 08FE [Trivial] +5C08FF 08FF [Trivial] +5C0900 0900 [Trivial] +5C0908 0908 [Trivial] +5C0909 0909 [Trivial] +5C090A 090A [Trivial] +5C090D 090D [Trivial] +5C091A 091A [Trivial] +5C0922 0922 [Trivial] +5C0925 0925 [Trivial] +5C0927 NULL [SyntErr] +5C0930 0930 [Trivial] +5C093F 093F [Trivial] +5C0940 0940 [Trivial] +5C095A 095A [Trivial] +5C095C NULL [SyntErr] +5C095F 095F [Trivial] +5C0961 0961 [Trivial] +5C0962 0962 [Trivial] +5C096E 096E [Trivial] +5C0972 0972 [Trivial] +5C0974 0974 [Trivial] +5C097E 097E [Trivial] +5C097F 097F [Trivial] +5C0980 0980 [Trivial] +5C0981 0981 [Trivial] +5C099F 099F [Trivial] +5C09A0 09A0 [Trivial] +5C09A1 09A1 [Trivial] +5C09E0 09E0 [Trivial] +5C09EF 09EF [Trivial] +5C09F9 09F9 [Trivial] +5C09FA 09FA [Trivial] +5C09FC 09FC [Trivial] +5C09FD 09FD [Trivial] +5C09FE 09FE [Trivial] +5C09FF 09FF [Trivial] +5C0A00 0A00 [Trivial] +5C0A08 0A08 [Trivial] +5C0A09 0A09 [Trivial] +5C0A0A 0A0A [Trivial] +5C0A0D 0A0D [Trivial] +5C0A1A 0A1A [Trivial] +5C0A22 0A22 [Trivial] +5C0A25 0A25 [Trivial] +5C0A27 NULL [SyntErr] +5C0A30 0A30 [Trivial] +5C0A3F 0A3F [Trivial] +5C0A40 0A40 [Trivial] +5C0A5A 0A5A [Trivial] +5C0A5C NULL [SyntErr] +5C0A5F 0A5F [Trivial] +5C0A61 0A61 [Trivial] +5C0A62 0A62 [Trivial] +5C0A6E 0A6E [Trivial] +5C0A72 0A72 [Trivial] +5C0A74 0A74 [Trivial] +5C0A7E 0A7E [Trivial] +5C0A7F 0A7F [Trivial] +5C0A80 0A80 [Trivial] +5C0A81 0A81 [Trivial] +5C0A9F 0A9F [Trivial] +5C0AA0 0AA0 [Trivial] +5C0AA1 0AA1 [Trivial] +5C0AE0 0AE0 [Trivial] +5C0AEF 0AEF [Trivial] +5C0AF9 0AF9 [Trivial] +5C0AFA 0AFA [Trivial] +5C0AFC 0AFC [Trivial] +5C0AFD 0AFD [Trivial] +5C0AFE 0AFE [Trivial] +5C0AFF 0AFF [Trivial] +5C0D00 0D00 [Trivial] +5C0D08 0D08 [Trivial] +5C0D09 0D09 [Trivial] +5C0D0A 0D0A [Trivial] +5C0D0D 0D0D [Trivial] +5C0D1A 0D1A [Trivial] +5C0D22 0D22 [Trivial] +5C0D25 0D25 [Trivial] +5C0D27 NULL [SyntErr] +5C0D30 0D30 [Trivial] +5C0D3F 0D3F [Trivial] +5C0D40 0D40 [Trivial] +5C0D5A 0D5A [Trivial] +5C0D5C NULL [SyntErr] +5C0D5F 0D5F [Trivial] +5C0D61 0D61 [Trivial] +5C0D62 0D62 [Trivial] +5C0D6E 0D6E [Trivial] +5C0D72 0D72 [Trivial] +5C0D74 0D74 [Trivial] +5C0D7E 0D7E [Trivial] +5C0D7F 0D7F [Trivial] +5C0D80 0D80 [Trivial] +5C0D81 0D81 [Trivial] +5C0D9F 0D9F [Trivial] +5C0DA0 0DA0 [Trivial] +5C0DA1 0DA1 [Trivial] +5C0DE0 0DE0 [Trivial] +5C0DEF 0DEF [Trivial] +5C0DF9 0DF9 [Trivial] +5C0DFA 0DFA [Trivial] +5C0DFC 0DFC [Trivial] +5C0DFD 0DFD [Trivial] +5C0DFE 0DFE [Trivial] +5C0DFF 0DFF [Trivial] +5C1A00 1A00 [Trivial] +5C1A08 1A08 [Trivial] +5C1A09 1A09 [Trivial] +5C1A0A 1A0A [Trivial] +5C1A0D 1A0D [Trivial] +5C1A1A 1A1A [Trivial] +5C1A22 1A22 [Trivial] +5C1A25 1A25 [Trivial] +5C1A27 NULL [SyntErr] +5C1A30 1A30 [Trivial] +5C1A3F 1A3F [Trivial] +5C1A40 1A40 [Trivial] +5C1A5A 1A5A [Trivial] +5C1A5C NULL [SyntErr] +5C1A5F 1A5F [Trivial] +5C1A61 1A61 [Trivial] +5C1A62 1A62 [Trivial] +5C1A6E 1A6E [Trivial] +5C1A72 1A72 [Trivial] +5C1A74 1A74 [Trivial] +5C1A7E 1A7E [Trivial] +5C1A7F 1A7F [Trivial] +5C1A80 1A80 [Trivial] +5C1A81 1A81 [Trivial] +5C1A9F 1A9F [Trivial] +5C1AA0 1AA0 [Trivial] +5C1AA1 1AA1 [Trivial] +5C1AE0 1AE0 [Trivial] +5C1AEF 1AEF [Trivial] +5C1AF9 1AF9 [Trivial] +5C1AFA 1AFA [Trivial] +5C1AFC 1AFC [Trivial] +5C1AFD 1AFD [Trivial] +5C1AFE 1AFE [Trivial] +5C1AFF 1AFF [Trivial] +5C2200 2200 [Trivial] +5C2208 2208 [Trivial] +5C2209 2209 [Trivial] +5C220A 220A [Trivial] +5C220D 220D [Trivial] +5C221A 221A [Trivial] +5C2222 2222 [Trivial] +5C2225 2225 [Trivial] +5C2227 NULL [SyntErr] +5C2230 2230 [Trivial] +5C223F 223F [Trivial] +5C2240 2240 [Trivial] +5C225A 225A [Trivial] +5C225C NULL [SyntErr] +5C225F 225F [Trivial] +5C2261 2261 [Trivial] +5C2262 2262 [Trivial] +5C226E 226E [Trivial] +5C2272 2272 [Trivial] +5C2274 2274 [Trivial] +5C227E 227E [Trivial] +5C227F 227F [Trivial] +5C2280 2280 [Trivial] +5C2281 2281 [Trivial] +5C229F 229F [Trivial] +5C22A0 22A0 [Trivial] +5C22A1 22A1 [Trivial] +5C22E0 22E0 [Trivial] +5C22EF 22EF [Trivial] +5C22F9 22F9 [Trivial] +5C22FA 22FA [Trivial] +5C22FC 22FC [Trivial] +5C22FD 22FD [Trivial] +5C22FE 22FE [Trivial] +5C22FF 22FF [Trivial] +5C2500 5C2500 [Preserve][LIKE] +5C2508 5C2508 [Preserve][LIKE] +5C2509 5C2509 [Preserve][LIKE] +5C250A 5C250A [Preserve][LIKE] +5C250D 5C250D [Preserve][LIKE] +5C251A 5C251A [Preserve][LIKE] +5C2522 5C2522 [Preserve][LIKE] +5C2525 5C2525 [Preserve][LIKE] +5C2527 NULL [SyntErr] +5C2530 5C2530 [Preserve][LIKE] +5C253F 5C253F [Preserve][LIKE] +5C2540 5C2540 [Preserve][LIKE] +5C255A 5C255A [Preserve][LIKE] +5C255C NULL [SyntErr] +5C255F 5C255F [Preserve][LIKE] +5C2561 5C2561 [Preserve][LIKE] +5C2562 5C2562 [Preserve][LIKE] +5C256E 5C256E [Preserve][LIKE] +5C2572 5C2572 [Preserve][LIKE] +5C2574 5C2574 [Preserve][LIKE] +5C257E 5C257E [Preserve][LIKE] +5C257F 5C257F [Preserve][LIKE] +5C2580 5C2580 [Preserve][LIKE] +5C2581 5C2581 [Preserve][LIKE] +5C259F 5C259F [Preserve][LIKE] +5C25A0 5C25A0 [Preserve][LIKE] +5C25A1 5C25A1 [Preserve][LIKE] +5C25E0 5C25E0 [Preserve][LIKE] +5C25EF 5C25EF [Preserve][LIKE] +5C25F9 5C25F9 [Preserve][LIKE] +5C25FA 5C25FA [Preserve][LIKE] +5C25FC 5C25FC [Preserve][LIKE] +5C25FD 5C25FD [Preserve][LIKE] +5C25FE 5C25FE [Preserve][LIKE] +5C25FF 5C25FF [Preserve][LIKE] +5C2700 2700 [Trivial] +5C2708 2708 [Trivial] +5C2709 2709 [Trivial] +5C270A 270A [Trivial] +5C270D 270D [Trivial] +5C271A 271A [Trivial] +5C2722 2722 [Trivial] +5C2725 2725 [Trivial] +5C2727 NULL [SyntErr] +5C2730 2730 [Trivial] +5C273F 273F [Trivial] +5C2740 2740 [Trivial] +5C275A 275A [Trivial] +5C275C NULL [SyntErr] +5C275F 275F [Trivial] +5C2761 2761 [Trivial] +5C2762 2762 [Trivial] +5C276E 276E [Trivial] +5C2772 2772 [Trivial] +5C2774 2774 [Trivial] +5C277E 277E [Trivial] +5C277F 277F [Trivial] +5C2780 2780 [Trivial] +5C2781 2781 [Trivial] +5C279F 279F [Trivial] +5C27A0 27A0 [Trivial] +5C27A1 27A1 [Trivial] +5C27E0 27E0 [Trivial] +5C27EF 27EF [Trivial] +5C27F9 27F9 [Trivial] +5C27FA 27FA [Trivial] +5C27FC 27FC [Trivial] +5C27FD 27FD [Trivial] +5C27FE 27FE [Trivial] +5C27FF 27FF [Trivial] +5C3000 0000 [Regular] +5C3008 0008 [Regular] +5C3009 0009 [Regular] +5C300A 000A [Regular] +5C300D 000D [Regular] +5C301A 001A [Regular] +5C3022 0022 [Regular] +5C3025 0025 [Regular] +5C3027 NULL [SyntErr] +5C3030 0030 [Regular] +5C303F 003F [Regular] +5C3040 0040 [Regular] +5C305A 005A [Regular] +5C305C NULL [SyntErr] +5C305F 005F [Regular] +5C3061 0061 [Regular] +5C3062 0062 [Regular] +5C306E 006E [Regular] +5C3072 0072 [Regular] +5C3074 0074 [Regular] +5C307E 007E [Regular] +5C307F 007F [Regular] +5C3080 0080 [Regular] +5C3081 0081 [Regular] +5C309F 009F [Regular] +5C30A0 00A0 [Regular] +5C30A1 00A1 [Regular] +5C30E0 00E0 [Regular] +5C30EF 00EF [Regular] +5C30F9 00F9 [Regular] +5C30FA 00FA [Regular] +5C30FC 00FC [Regular] +5C30FD 00FD [Regular] +5C30FE 00FE [Regular] +5C30FF 00FF [Regular] +5C3F00 3F00 [Trivial] +5C3F08 3F08 [Trivial] +5C3F09 3F09 [Trivial] +5C3F0A 3F0A [Trivial] +5C3F0D 3F0D [Trivial] +5C3F1A 3F1A [Trivial] +5C3F22 3F22 [Trivial] +5C3F25 3F25 [Trivial] +5C3F27 NULL [SyntErr] +5C3F30 3F30 [Trivial] +5C3F3F 3F3F [Trivial] +5C3F40 3F40 [Trivial] +5C3F5A 3F5A [Trivial] +5C3F5C NULL [SyntErr] +5C3F5F 3F5F [Trivial] +5C3F61 3F61 [Trivial] +5C3F62 3F62 [Trivial] +5C3F6E 3F6E [Trivial] +5C3F72 3F72 [Trivial] +5C3F74 3F74 [Trivial] +5C3F7E 3F7E [Trivial] +5C3F7F 3F7F [Trivial] +5C3F80 3F80 [Trivial] +5C3F81 3F81 [Trivial] +5C3F9F 3F9F [Trivial] +5C3FA0 3FA0 [Trivial] +5C3FA1 3FA1 [Trivial] +5C3FE0 3FE0 [Trivial] +5C3FEF 3FEF [Trivial] +5C3FF9 3FF9 [Trivial] +5C3FFA 3FFA [Trivial] +5C3FFC 3FFC [Trivial] +5C3FFD 3FFD [Trivial] +5C3FFE 3FFE [Trivial] +5C3FFF 3FFF [Trivial] +5C4000 4000 [Trivial] +5C4008 4008 [Trivial] +5C4009 4009 [Trivial] +5C400A 400A [Trivial] +5C400D 400D [Trivial] +5C401A 401A [Trivial] +5C4022 4022 [Trivial] +5C4025 4025 [Trivial] +5C4027 NULL [SyntErr] +5C4030 4030 [Trivial] +5C403F 403F [Trivial] +5C4040 4040 [Trivial] +5C405A 405A [Trivial] +5C405C NULL [SyntErr] +5C405F 405F [Trivial] +5C4061 4061 [Trivial] +5C4062 4062 [Trivial] +5C406E 406E [Trivial] +5C4072 4072 [Trivial] +5C4074 4074 [Trivial] +5C407E 407E [Trivial] +5C407F 407F [Trivial] +5C4080 4080 [Trivial] +5C4081 4081 [Trivial] +5C409F 409F [Trivial] +5C40A0 40A0 [Trivial] +5C40A1 40A1 [Trivial] +5C40E0 40E0 [Trivial] +5C40EF 40EF [Trivial] +5C40F9 40F9 [Trivial] +5C40FA 40FA [Trivial] +5C40FC 40FC [Trivial] +5C40FD 40FD [Trivial] +5C40FE 40FE [Trivial] +5C40FF 40FF [Trivial] +5C5A00 1A00 [Regular] +5C5A08 1A08 [Regular] +5C5A09 1A09 [Regular] +5C5A0A 1A0A [Regular] +5C5A0D 1A0D [Regular] +5C5A1A 1A1A [Regular] +5C5A22 1A22 [Regular] +5C5A25 1A25 [Regular] +5C5A27 NULL [SyntErr] +5C5A30 1A30 [Regular] +5C5A3F 1A3F [Regular] +5C5A40 1A40 [Regular] +5C5A5A 1A5A [Regular] +5C5A5C NULL [SyntErr] +5C5A5F 1A5F [Regular] +5C5A61 1A61 [Regular] +5C5A62 1A62 [Regular] +5C5A6E 1A6E [Regular] +5C5A72 1A72 [Regular] +5C5A74 1A74 [Regular] +5C5A7E 1A7E [Regular] +5C5A7F 1A7F [Regular] +5C5A80 1A80 [Regular] +5C5A81 1A81 [Regular] +5C5A9F 1A9F [Regular] +5C5AA0 1AA0 [Regular] +5C5AA1 1AA1 [Regular] +5C5AE0 1AE0 [Regular] +5C5AEF 1AEF [Regular] +5C5AF9 1AF9 [Regular] +5C5AFA 1AFA [Regular] +5C5AFC 1AFC [Regular] +5C5AFD 1AFD [Regular] +5C5AFE 1AFE [Regular] +5C5AFF 1AFF [Regular] +5C5C00 5C00 [Regular] +5C5C08 5C08 [Regular] +5C5C09 5C09 [Regular] +5C5C0A 5C0A [Regular] +5C5C0D 5C0D [Regular] +5C5C1A 5C1A [Regular] +5C5C22 5C22 [Regular] +5C5C25 5C25 [Regular] +5C5C27 NULL [SyntErr] +5C5C30 5C30 [Regular] +5C5C3F 5C3F [Regular] +5C5C40 5C40 [Regular] +5C5C5A 5C5A [Regular] +5C5C5C NULL [SyntErr] +5C5C5F 5C5F [Regular] +5C5C61 5C61 [Regular] +5C5C62 5C62 [Regular] +5C5C6E 5C6E [Regular] +5C5C72 5C72 [Regular] +5C5C74 5C74 [Regular] +5C5C7E 5C7E [Regular] +5C5C7F 5C7F [Regular] +5C5C80 5C80 [Regular] +5C5C81 5C81 [Regular] +5C5C9F 5C9F [Regular] +5C5CA0 5CA0 [Regular] +5C5CA1 5CA1 [Regular] +5C5CE0 5CE0 [Regular] +5C5CEF 5CEF [Regular] +5C5CF9 5CF9 [Regular] +5C5CFA 5CFA [Regular] +5C5CFC 5CFC [Regular] +5C5CFD 5CFD [Regular] +5C5CFE 5CFE [Regular] +5C5CFF 5CFF [Regular] +5C5F00 5C5F00 [Preserve][LIKE] +5C5F08 5C5F08 [Preserve][LIKE] +5C5F09 5C5F09 [Preserve][LIKE] +5C5F0A 5C5F0A [Preserve][LIKE] +5C5F0D 5C5F0D [Preserve][LIKE] +5C5F1A 5C5F1A [Preserve][LIKE] +5C5F22 5C5F22 [Preserve][LIKE] +5C5F25 5C5F25 [Preserve][LIKE] +5C5F27 NULL [SyntErr] +5C5F30 5C5F30 [Preserve][LIKE] +5C5F3F 5C5F3F [Preserve][LIKE] +5C5F40 5C5F40 [Preserve][LIKE] +5C5F5A 5C5F5A [Preserve][LIKE] +5C5F5C NULL [SyntErr] +5C5F5F 5C5F5F [Preserve][LIKE] +5C5F61 5C5F61 [Preserve][LIKE] +5C5F62 5C5F62 [Preserve][LIKE] +5C5F6E 5C5F6E [Preserve][LIKE] +5C5F72 5C5F72 [Preserve][LIKE] +5C5F74 5C5F74 [Preserve][LIKE] +5C5F7E 5C5F7E [Preserve][LIKE] +5C5F7F 5C5F7F [Preserve][LIKE] +5C5F80 5C5F80 [Preserve][LIKE] +5C5F81 5C5F81 [Preserve][LIKE] +5C5F9F 5C5F9F [Preserve][LIKE] +5C5FA0 5C5FA0 [Preserve][LIKE] +5C5FA1 5C5FA1 [Preserve][LIKE] +5C5FE0 5C5FE0 [Preserve][LIKE] +5C5FEF 5C5FEF [Preserve][LIKE] +5C5FF9 5C5FF9 [Preserve][LIKE] +5C5FFA 5C5FFA [Preserve][LIKE] +5C5FFC 5C5FFC [Preserve][LIKE] +5C5FFD 5C5FFD [Preserve][LIKE] +5C5FFE 5C5FFE [Preserve][LIKE] +5C5FFF 5C5FFF [Preserve][LIKE] +5C6100 6100 [Trivial] +5C6108 6108 [Trivial] +5C6109 6109 [Trivial] +5C610A 610A [Trivial] +5C610D 610D [Trivial] +5C611A 611A [Trivial] +5C6122 6122 [Trivial] +5C6125 6125 [Trivial] +5C6127 NULL [SyntErr] +5C6130 6130 [Trivial] +5C613F 613F [Trivial] +5C6140 6140 [Trivial] +5C615A 615A [Trivial] +5C615C NULL [SyntErr] +5C615F 615F [Trivial] +5C6161 6161 [Trivial] +5C6162 6162 [Trivial] +5C616E 616E [Trivial] +5C6172 6172 [Trivial] +5C6174 6174 [Trivial] +5C617E 617E [Trivial] +5C617F 617F [Trivial] +5C6180 6180 [Trivial] +5C6181 6181 [Trivial] +5C619F 619F [Trivial] +5C61A0 61A0 [Trivial] +5C61A1 61A1 [Trivial] +5C61E0 61E0 [Trivial] +5C61EF 61EF [Trivial] +5C61F9 61F9 [Trivial] +5C61FA 61FA [Trivial] +5C61FC 61FC [Trivial] +5C61FD 61FD [Trivial] +5C61FE 61FE [Trivial] +5C61FF 61FF [Trivial] +5C6200 0800 [Regular] +5C6208 0808 [Regular] +5C6209 0809 [Regular] +5C620A 080A [Regular] +5C620D 080D [Regular] +5C621A 081A [Regular] +5C6222 0822 [Regular] +5C6225 0825 [Regular] +5C6227 NULL [SyntErr] +5C6230 0830 [Regular] +5C623F 083F [Regular] +5C6240 0840 [Regular] +5C625A 085A [Regular] +5C625C NULL [SyntErr] +5C625F 085F [Regular] +5C6261 0861 [Regular] +5C6262 0862 [Regular] +5C626E 086E [Regular] +5C6272 0872 [Regular] +5C6274 0874 [Regular] +5C627E 087E [Regular] +5C627F 087F [Regular] +5C6280 0880 [Regular] +5C6281 0881 [Regular] +5C629F 089F [Regular] +5C62A0 08A0 [Regular] +5C62A1 08A1 [Regular] +5C62E0 08E0 [Regular] +5C62EF 08EF [Regular] +5C62F9 08F9 [Regular] +5C62FA 08FA [Regular] +5C62FC 08FC [Regular] +5C62FD 08FD [Regular] +5C62FE 08FE [Regular] +5C62FF 08FF [Regular] +5C6E00 0A00 [Regular] +5C6E08 0A08 [Regular] +5C6E09 0A09 [Regular] +5C6E0A 0A0A [Regular] +5C6E0D 0A0D [Regular] +5C6E1A 0A1A [Regular] +5C6E22 0A22 [Regular] +5C6E25 0A25 [Regular] +5C6E27 NULL [SyntErr] +5C6E30 0A30 [Regular] +5C6E3F 0A3F [Regular] +5C6E40 0A40 [Regular] +5C6E5A 0A5A [Regular] +5C6E5C NULL [SyntErr] +5C6E5F 0A5F [Regular] +5C6E61 0A61 [Regular] +5C6E62 0A62 [Regular] +5C6E6E 0A6E [Regular] +5C6E72 0A72 [Regular] +5C6E74 0A74 [Regular] +5C6E7E 0A7E [Regular] +5C6E7F 0A7F [Regular] +5C6E80 0A80 [Regular] +5C6E81 0A81 [Regular] +5C6E9F 0A9F [Regular] +5C6EA0 0AA0 [Regular] +5C6EA1 0AA1 [Regular] +5C6EE0 0AE0 [Regular] +5C6EEF 0AEF [Regular] +5C6EF9 0AF9 [Regular] +5C6EFA 0AFA [Regular] +5C6EFC 0AFC [Regular] +5C6EFD 0AFD [Regular] +5C6EFE 0AFE [Regular] +5C6EFF 0AFF [Regular] +5C7200 0D00 [Regular] +5C7208 0D08 [Regular] +5C7209 0D09 [Regular] +5C720A 0D0A [Regular] +5C720D 0D0D [Regular] +5C721A 0D1A [Regular] +5C7222 0D22 [Regular] +5C7225 0D25 [Regular] +5C7227 NULL [SyntErr] +5C7230 0D30 [Regular] +5C723F 0D3F [Regular] +5C7240 0D40 [Regular] +5C725A 0D5A [Regular] +5C725C NULL [SyntErr] +5C725F 0D5F [Regular] +5C7261 0D61 [Regular] +5C7262 0D62 [Regular] +5C726E 0D6E [Regular] +5C7272 0D72 [Regular] +5C7274 0D74 [Regular] +5C727E 0D7E [Regular] +5C727F 0D7F [Regular] +5C7280 0D80 [Regular] +5C7281 0D81 [Regular] +5C729F 0D9F [Regular] +5C72A0 0DA0 [Regular] +5C72A1 0DA1 [Regular] +5C72E0 0DE0 [Regular] +5C72EF 0DEF [Regular] +5C72F9 0DF9 [Regular] +5C72FA 0DFA [Regular] +5C72FC 0DFC [Regular] +5C72FD 0DFD [Regular] +5C72FE 0DFE [Regular] +5C72FF 0DFF [Regular] +5C7400 0900 [Regular] +5C7408 0908 [Regular] +5C7409 0909 [Regular] +5C740A 090A [Regular] +5C740D 090D [Regular] +5C741A 091A [Regular] +5C7422 0922 [Regular] +5C7425 0925 [Regular] +5C7427 NULL [SyntErr] +5C7430 0930 [Regular] +5C743F 093F [Regular] +5C7440 0940 [Regular] +5C745A 095A [Regular] +5C745C NULL [SyntErr] +5C745F 095F [Regular] +5C7461 0961 [Regular] +5C7462 0962 [Regular] +5C746E 096E [Regular] +5C7472 0972 [Regular] +5C7474 0974 [Regular] +5C747E 097E [Regular] +5C747F 097F [Regular] +5C7480 0980 [Regular] +5C7481 0981 [Regular] +5C749F 099F [Regular] +5C74A0 09A0 [Regular] +5C74A1 09A1 [Regular] +5C74E0 09E0 [Regular] +5C74EF 09EF [Regular] +5C74F9 09F9 [Regular] +5C74FA 09FA [Regular] +5C74FC 09FC [Regular] +5C74FD 09FD [Regular] +5C74FE 09FE [Regular] +5C74FF 09FF [Regular] +5C7E00 7E00 [Trivial] +5C7E08 7E08 [Trivial] +5C7E09 7E09 [Trivial] +5C7E0A 7E0A [Trivial] +5C7E0D 7E0D [Trivial] +5C7E1A 7E1A [Trivial] +5C7E22 7E22 [Trivial] +5C7E25 7E25 [Trivial] +5C7E27 NULL [SyntErr] +5C7E30 7E30 [Trivial] +5C7E3F 7E3F [Trivial] +5C7E40 7E40 [Trivial] +5C7E5A 7E5A [Trivial] +5C7E5C NULL [SyntErr] +5C7E5F 7E5F [Trivial] +5C7E61 7E61 [Trivial] +5C7E62 7E62 [Trivial] +5C7E6E 7E6E [Trivial] +5C7E72 7E72 [Trivial] +5C7E74 7E74 [Trivial] +5C7E7E 7E7E [Trivial] +5C7E7F 7E7F [Trivial] +5C7E80 7E80 [Trivial] +5C7E81 7E81 [Trivial] +5C7E9F 7E9F [Trivial] +5C7EA0 7EA0 [Trivial] +5C7EA1 7EA1 [Trivial] +5C7EE0 7EE0 [Trivial] +5C7EEF 7EEF [Trivial] +5C7EF9 7EF9 [Trivial] +5C7EFA 7EFA [Trivial] +5C7EFC 7EFC [Trivial] +5C7EFD 7EFD [Trivial] +5C7EFE 7EFE [Trivial] +5C7EFF 7EFF [Trivial] +5C7F00 7F00 [Trivial] +5C7F08 7F08 [Trivial] +5C7F09 7F09 [Trivial] +5C7F0A 7F0A [Trivial] +5C7F0D 7F0D [Trivial] +5C7F1A 7F1A [Trivial] +5C7F22 7F22 [Trivial] +5C7F25 7F25 [Trivial] +5C7F27 NULL [SyntErr] +5C7F30 7F30 [Trivial] +5C7F3F 7F3F [Trivial] +5C7F40 7F40 [Trivial] +5C7F5A 7F5A [Trivial] +5C7F5C NULL [SyntErr] +5C7F5F 7F5F [Trivial] +5C7F61 7F61 [Trivial] +5C7F62 7F62 [Trivial] +5C7F6E 7F6E [Trivial] +5C7F72 7F72 [Trivial] +5C7F74 7F74 [Trivial] +5C7F7E 7F7E [Trivial] +5C7F7F 7F7F [Trivial] +5C7F80 7F80 [Trivial] +5C7F81 7F81 [Trivial] +5C7F9F 7F9F [Trivial] +5C7FA0 7FA0 [Trivial] +5C7FA1 7FA1 [Trivial] +5C7FE0 7FE0 [Trivial] +5C7FEF 7FEF [Trivial] +5C7FF9 7FF9 [Trivial] +5C7FFA 7FFA [Trivial] +5C7FFC 7FFC [Trivial] +5C7FFD 7FFD [Trivial] +5C7FFE 7FFE [Trivial] +5C7FFF 7FFF [Trivial] +5C8000 8000 [Trivial] +5C8008 8008 [Trivial] +5C8009 8009 [Trivial] +5C800A 800A [Trivial] +5C800D 800D [Trivial] +5C801A 801A [Trivial] +5C8022 8022 [Trivial] +5C8025 8025 [Trivial] +5C8027 NULL [SyntErr] +5C8030 8030 [Trivial] +5C803F 803F [Trivial] +5C8040 8040 [Trivial] +5C805A 805A [Trivial] +5C805C NULL [SyntErr][USER] +5C805F 805F [Trivial] +5C8061 8061 [Trivial] +5C8062 8062 [Trivial] +5C806E 806E [Trivial] +5C8072 8072 [Trivial] +5C8074 8074 [Trivial] +5C807E 807E [Trivial] +5C807F 807F [Trivial] +5C8080 8080 [Trivial] +5C8081 8081 [Trivial] +5C809F 809F [Trivial] +5C80A0 80A0 [Trivial] +5C80A1 80A1 [Trivial] +5C80E0 80E0 [Trivial] +5C80EF 80EF [Trivial] +5C80F9 80F9 [Trivial] +5C80FA 80FA [Trivial] +5C80FC 80FC [Trivial] +5C80FD 80FD [Trivial] +5C80FE 80FE [Trivial] +5C80FF 80FF [Trivial] +5C8100 8100 [Trivial] +5C8108 8108 [Trivial] +5C8109 8109 [Trivial] +5C810A 810A [Trivial] +5C810D 810D [Trivial] +5C811A 811A [Trivial] +5C8122 8122 [Trivial] +5C8125 8125 [Trivial] +5C8127 NULL [SyntErr] +5C8130 8130 [Trivial] +5C813F 813F [Trivial] +5C8140 8140 [Trivial] +5C815A 815A [Trivial] +5C815C NULL [SyntErr][USER] +5C815F 815F [Trivial] +5C8161 8161 [Trivial] +5C8162 8162 [Trivial] +5C816E 816E [Trivial] +5C8172 8172 [Trivial] +5C8174 8174 [Trivial] +5C817E 817E [Trivial] +5C817F 817F [Trivial] +5C8180 8180 [Trivial] +5C8181 8181 [Trivial] +5C819F 819F [Trivial] +5C81A0 81A0 [Trivial] +5C81A1 81A1 [Trivial] +5C81E0 81E0 [Trivial] +5C81EF 81EF [Trivial] +5C81F9 81F9 [Trivial] +5C81FA 81FA [Trivial] +5C81FC 81FC [Trivial] +5C81FD 81FD [Trivial] +5C81FE 81FE [Trivial] +5C81FF 81FF [Trivial] +5C9F00 9F00 [Trivial] +5C9F08 9F08 [Trivial] +5C9F09 9F09 [Trivial] +5C9F0A 9F0A [Trivial] +5C9F0D 9F0D [Trivial] +5C9F1A 9F1A [Trivial] +5C9F22 9F22 [Trivial] +5C9F25 9F25 [Trivial] +5C9F27 NULL [SyntErr] +5C9F30 9F30 [Trivial] +5C9F3F 9F3F [Trivial] +5C9F40 9F40 [Trivial] +5C9F5A 9F5A [Trivial] +5C9F5C NULL [SyntErr][USER] +5C9F5F 9F5F [Trivial] +5C9F61 9F61 [Trivial] +5C9F62 9F62 [Trivial] +5C9F6E 9F6E [Trivial] +5C9F72 9F72 [Trivial] +5C9F74 9F74 [Trivial] +5C9F7E 9F7E [Trivial] +5C9F7F 9F7F [Trivial] +5C9F80 9F80 [Trivial] +5C9F81 9F81 [Trivial] +5C9F9F 9F9F [Trivial] +5C9FA0 9FA0 [Trivial] +5C9FA1 9FA1 [Trivial] +5C9FE0 9FE0 [Trivial] +5C9FEF 9FEF [Trivial] +5C9FF9 9FF9 [Trivial] +5C9FFA 9FFA [Trivial] +5C9FFC 9FFC [Trivial] +5C9FFD 9FFD [Trivial] +5C9FFE 9FFE [Trivial] +5C9FFF 9FFF [Trivial] +5CA000 A000 [Trivial] +5CA008 A008 [Trivial] +5CA009 A009 [Trivial] +5CA00A A00A [Trivial] +5CA00D A00D [Trivial] +5CA01A A01A [Trivial] +5CA022 A022 [Trivial] +5CA025 A025 [Trivial] +5CA027 NULL [SyntErr] +5CA030 A030 [Trivial] +5CA03F A03F [Trivial] +5CA040 A040 [Trivial] +5CA05A A05A [Trivial] +5CA05C NULL [SyntErr][USER] +5CA05F A05F [Trivial] +5CA061 A061 [Trivial] +5CA062 A062 [Trivial] +5CA06E A06E [Trivial] +5CA072 A072 [Trivial] +5CA074 A074 [Trivial] +5CA07E A07E [Trivial] +5CA07F A07F [Trivial] +5CA080 A080 [Trivial] +5CA081 A081 [Trivial] +5CA09F A09F [Trivial] +5CA0A0 A0A0 [Trivial] +5CA0A1 A0A1 [Trivial] +5CA0E0 A0E0 [Trivial] +5CA0EF A0EF [Trivial] +5CA0F9 A0F9 [Trivial] +5CA0FA A0FA [Trivial] +5CA0FC A0FC [Trivial] +5CA0FD A0FD [Trivial] +5CA0FE A0FE [Trivial] +5CA0FF A0FF [Trivial] +5CA100 A100 [Trivial] +5CA108 A108 [Trivial] +5CA109 A109 [Trivial] +5CA10A A10A [Trivial] +5CA10D A10D [Trivial] +5CA11A A11A [Trivial] +5CA122 A122 [Trivial] +5CA125 A125 [Trivial] +5CA127 NULL [SyntErr] +5CA130 A130 [Trivial] +5CA13F A13F [Trivial] +5CA140 A140 [Trivial] +5CA15A A15A [Trivial] +5CA15C NULL [SyntErr][USER] +5CA15F A15F [Trivial] +5CA161 A161 [Trivial] +5CA162 A162 [Trivial] +5CA16E A16E [Trivial] +5CA172 A172 [Trivial] +5CA174 A174 [Trivial] +5CA17E A17E [Trivial] +5CA17F A17F [Trivial] +5CA180 A180 [Trivial] +5CA181 A181 [Trivial] +5CA19F A19F [Trivial] +5CA1A0 A1A0 [Trivial] +5CA1A1 A1A1 [Trivial] +5CA1E0 A1E0 [Trivial] +5CA1EF A1EF [Trivial] +5CA1F9 A1F9 [Trivial] +5CA1FA A1FA [Trivial] +5CA1FC A1FC [Trivial] +5CA1FD A1FD [Trivial] +5CA1FE A1FE [Trivial] +5CA1FF A1FF [Trivial] +5CE000 E000 [Trivial] +5CE008 E008 [Trivial] +5CE009 E009 [Trivial] +5CE00A E00A [Trivial] +5CE00D E00D [Trivial] +5CE01A E01A [Trivial] +5CE022 E022 [Trivial] +5CE025 E025 [Trivial] +5CE027 NULL [SyntErr] +5CE030 E030 [Trivial] +5CE03F E03F [Trivial] +5CE040 E040 [Trivial] +5CE05A E05A [Trivial] +5CE05C NULL [SyntErr][USER] +5CE05F E05F [Trivial] +5CE061 E061 [Trivial] +5CE062 E062 [Trivial] +5CE06E E06E [Trivial] +5CE072 E072 [Trivial] +5CE074 E074 [Trivial] +5CE07E E07E [Trivial] +5CE07F E07F [Trivial] +5CE080 E080 [Trivial] +5CE081 E081 [Trivial] +5CE09F E09F [Trivial] +5CE0A0 E0A0 [Trivial] +5CE0A1 E0A1 [Trivial] +5CE0E0 E0E0 [Trivial] +5CE0EF E0EF [Trivial] +5CE0F9 E0F9 [Trivial] +5CE0FA E0FA [Trivial] +5CE0FC E0FC [Trivial] +5CE0FD E0FD [Trivial] +5CE0FE E0FE [Trivial] +5CE0FF E0FF [Trivial] +5CEF00 EF00 [Trivial] +5CEF08 EF08 [Trivial] +5CEF09 EF09 [Trivial] +5CEF0A EF0A [Trivial] +5CEF0D EF0D [Trivial] +5CEF1A EF1A [Trivial] +5CEF22 EF22 [Trivial] +5CEF25 EF25 [Trivial] +5CEF27 NULL [SyntErr] +5CEF30 EF30 [Trivial] +5CEF3F EF3F [Trivial] +5CEF40 EF40 [Trivial] +5CEF5A EF5A [Trivial] +5CEF5C NULL [SyntErr][USER] +5CEF5F EF5F [Trivial] +5CEF61 EF61 [Trivial] +5CEF62 EF62 [Trivial] +5CEF6E EF6E [Trivial] +5CEF72 EF72 [Trivial] +5CEF74 EF74 [Trivial] +5CEF7E EF7E [Trivial] +5CEF7F EF7F [Trivial] +5CEF80 EF80 [Trivial] +5CEF81 EF81 [Trivial] +5CEF9F EF9F [Trivial] +5CEFA0 EFA0 [Trivial] +5CEFA1 EFA1 [Trivial] +5CEFE0 EFE0 [Trivial] +5CEFEF EFEF [Trivial] +5CEFF9 EFF9 [Trivial] +5CEFFA EFFA [Trivial] +5CEFFC EFFC [Trivial] +5CEFFD EFFD [Trivial] +5CEFFE EFFE [Trivial] +5CEFFF EFFF [Trivial] +5CF900 F900 [Trivial] +5CF908 F908 [Trivial] +5CF909 F909 [Trivial] +5CF90A F90A [Trivial] +5CF90D F90D [Trivial] +5CF91A F91A [Trivial] +5CF922 F922 [Trivial] +5CF925 F925 [Trivial] +5CF927 NULL [SyntErr] +5CF930 F930 [Trivial] +5CF93F F93F [Trivial] +5CF940 F940 [Trivial] +5CF95A F95A [Trivial] +5CF95C NULL [SyntErr][USER] +5CF95F F95F [Trivial] +5CF961 F961 [Trivial] +5CF962 F962 [Trivial] +5CF96E F96E [Trivial] +5CF972 F972 [Trivial] +5CF974 F974 [Trivial] +5CF97E F97E [Trivial] +5CF97F F97F [Trivial] +5CF980 F980 [Trivial] +5CF981 F981 [Trivial] +5CF99F F99F [Trivial] +5CF9A0 F9A0 [Trivial] +5CF9A1 F9A1 [Trivial] +5CF9E0 F9E0 [Trivial] +5CF9EF F9EF [Trivial] +5CF9F9 F9F9 [Trivial] +5CF9FA F9FA [Trivial] +5CF9FC F9FC [Trivial] +5CF9FD F9FD [Trivial] +5CF9FE F9FE [Trivial] +5CF9FF F9FF [Trivial] +5CFA00 FA00 [Trivial] +5CFA08 FA08 [Trivial] +5CFA09 FA09 [Trivial] +5CFA0A FA0A [Trivial] +5CFA0D FA0D [Trivial] +5CFA1A FA1A [Trivial] +5CFA22 FA22 [Trivial] +5CFA25 FA25 [Trivial] +5CFA27 NULL [SyntErr] +5CFA30 FA30 [Trivial] +5CFA3F FA3F [Trivial] +5CFA40 FA40 [Trivial] +5CFA5A FA5A [Trivial] +5CFA5C NULL [SyntErr][USER] +5CFA5F FA5F [Trivial] +5CFA61 FA61 [Trivial] +5CFA62 FA62 [Trivial] +5CFA6E FA6E [Trivial] +5CFA72 FA72 [Trivial] +5CFA74 FA74 [Trivial] +5CFA7E FA7E [Trivial] +5CFA7F FA7F [Trivial] +5CFA80 FA80 [Trivial] +5CFA81 FA81 [Trivial] +5CFA9F FA9F [Trivial] +5CFAA0 FAA0 [Trivial] +5CFAA1 FAA1 [Trivial] +5CFAE0 FAE0 [Trivial] +5CFAEF FAEF [Trivial] +5CFAF9 FAF9 [Trivial] +5CFAFA FAFA [Trivial] +5CFAFC FAFC [Trivial] +5CFAFD FAFD [Trivial] +5CFAFE FAFE [Trivial] +5CFAFF FAFF [Trivial] +5CFC00 FC00 [Trivial] +5CFC08 FC08 [Trivial] +5CFC09 FC09 [Trivial] +5CFC0A FC0A [Trivial] +5CFC0D FC0D [Trivial] +5CFC1A FC1A [Trivial] +5CFC22 FC22 [Trivial] +5CFC25 FC25 [Trivial] +5CFC27 NULL [SyntErr] +5CFC30 FC30 [Trivial] +5CFC3F FC3F [Trivial] +5CFC40 FC40 [Trivial] +5CFC5A FC5A [Trivial] +5CFC5C NULL [SyntErr][USER] +5CFC5F FC5F [Trivial] +5CFC61 FC61 [Trivial] +5CFC62 FC62 [Trivial] +5CFC6E FC6E [Trivial] +5CFC72 FC72 [Trivial] +5CFC74 FC74 [Trivial] +5CFC7E FC7E [Trivial] +5CFC7F FC7F [Trivial] +5CFC80 FC80 [Trivial] +5CFC81 FC81 [Trivial] +5CFC9F FC9F [Trivial] +5CFCA0 FCA0 [Trivial] +5CFCA1 FCA1 [Trivial] +5CFCE0 FCE0 [Trivial] +5CFCEF FCEF [Trivial] +5CFCF9 FCF9 [Trivial] +5CFCFA FCFA [Trivial] +5CFCFC FCFC [Trivial] +5CFCFD FCFD [Trivial] +5CFCFE FCFE [Trivial] +5CFCFF FCFF [Trivial] +5CFD00 FD00 [Trivial] +5CFD08 FD08 [Trivial] +5CFD09 FD09 [Trivial] +5CFD0A FD0A [Trivial] +5CFD0D FD0D [Trivial] +5CFD1A FD1A [Trivial] +5CFD22 FD22 [Trivial] +5CFD25 FD25 [Trivial] +5CFD27 NULL [SyntErr] +5CFD30 FD30 [Trivial] +5CFD3F FD3F [Trivial] +5CFD40 FD40 [Trivial] +5CFD5A FD5A [Trivial] +5CFD5C NULL [SyntErr][USER] +5CFD5F FD5F [Trivial] +5CFD61 FD61 [Trivial] +5CFD62 FD62 [Trivial] +5CFD6E FD6E [Trivial] +5CFD72 FD72 [Trivial] +5CFD74 FD74 [Trivial] +5CFD7E FD7E [Trivial] +5CFD7F FD7F [Trivial] +5CFD80 FD80 [Trivial] +5CFD81 FD81 [Trivial] +5CFD9F FD9F [Trivial] +5CFDA0 FDA0 [Trivial] +5CFDA1 FDA1 [Trivial] +5CFDE0 FDE0 [Trivial] +5CFDEF FDEF [Trivial] +5CFDF9 FDF9 [Trivial] +5CFDFA FDFA [Trivial] +5CFDFC FDFC [Trivial] +5CFDFD FDFD [Trivial] +5CFDFE FDFE [Trivial] +5CFDFF FDFF [Trivial] +5CFE00 FE00 [Trivial] +5CFE08 FE08 [Trivial] +5CFE09 FE09 [Trivial] +5CFE0A FE0A [Trivial] +5CFE0D FE0D [Trivial] +5CFE1A FE1A [Trivial] +5CFE22 FE22 [Trivial] +5CFE25 FE25 [Trivial] +5CFE27 NULL [SyntErr] +5CFE30 FE30 [Trivial] +5CFE3F FE3F [Trivial] +5CFE40 FE40 [Trivial] +5CFE5A FE5A [Trivial] +5CFE5C NULL [SyntErr][USER] +5CFE5F FE5F [Trivial] +5CFE61 FE61 [Trivial] +5CFE62 FE62 [Trivial] +5CFE6E FE6E [Trivial] +5CFE72 FE72 [Trivial] +5CFE74 FE74 [Trivial] +5CFE7E FE7E [Trivial] +5CFE7F FE7F [Trivial] +5CFE80 FE80 [Trivial] +5CFE81 FE81 [Trivial] +5CFE9F FE9F [Trivial] +5CFEA0 FEA0 [Trivial] +5CFEA1 FEA1 [Trivial] +5CFEE0 FEE0 [Trivial] +5CFEEF FEEF [Trivial] +5CFEF9 FEF9 [Trivial] +5CFEFA FEFA [Trivial] +5CFEFC FEFC [Trivial] +5CFEFD FEFD [Trivial] +5CFEFE FEFE [Trivial] +5CFEFF FEFF [Trivial] +5CFF00 FF00 [Trivial] +5CFF08 FF08 [Trivial] +5CFF09 FF09 [Trivial] +5CFF0A FF0A [Trivial] +5CFF0D FF0D [Trivial] +5CFF1A FF1A [Trivial] +5CFF22 FF22 [Trivial] +5CFF25 FF25 [Trivial] +5CFF27 NULL [SyntErr] +5CFF30 FF30 [Trivial] +5CFF3F FF3F [Trivial] +5CFF40 FF40 [Trivial] +5CFF5A FF5A [Trivial] +5CFF5C NULL [SyntErr][USER] +5CFF5F FF5F [Trivial] +5CFF61 FF61 [Trivial] +5CFF62 FF62 [Trivial] +5CFF6E FF6E [Trivial] +5CFF72 FF72 [Trivial] +5CFF74 FF74 [Trivial] +5CFF7E FF7E [Trivial] +5CFF7F FF7F [Trivial] +5CFF80 FF80 [Trivial] +5CFF81 FF81 [Trivial] +5CFF9F FF9F [Trivial] +5CFFA0 FFA0 [Trivial] +5CFFA1 FFA1 [Trivial] +5CFFE0 FFE0 [Trivial] +5CFFEF FFEF [Trivial] +5CFFF9 FFF9 [Trivial] +5CFFFA FFFA [Trivial] +5CFFFC FFFC [Trivial] +5CFFFD FFFD [Trivial] +5CFFFE FFFE [Trivial] +5CFFFF FFFF [Trivial] +5C005C00 0000 [Trivial] +5C005C08 0008 [Trivial] +5C005C09 0009 [Trivial] +5C005C0A 000A [Trivial] +5C005C0D 000D [Trivial] +5C005C1A 001A [Trivial] +5C005C22 0022 [Trivial] +5C005C25 005C25 [Regular] +5C005C27 0027 [Trivial] +5C005C30 0000 [Regular] +5C005C3F 003F [Trivial] +5C005C40 0040 [Trivial] +5C005C5A 001A [Regular] +5C005C5C 005C [Regular] +5C005C5F 005C5F [Regular] +5C005C61 0061 [Trivial] +5C005C62 0008 [Regular] +5C005C6E 000A [Regular] +5C005C72 000D [Regular] +5C005C74 0009 [Regular] +5C005C7E 007E [Trivial] +5C005C7F 007F [Trivial] +5C005C80 0080 [Trivial] +5C005C81 0081 [Trivial] +5C005C9F 009F [Trivial] +5C005CA0 00A0 [Trivial] +5C005CA1 00A1 [Trivial] +5C005CE0 00E0 [Trivial] +5C005CEF 00EF [Trivial] +5C005CF9 00F9 [Trivial] +5C005CFA 00FA [Trivial] +5C005CFC 00FC [Trivial] +5C005CFD 00FD [Trivial] +5C005CFE 00FE [Trivial] +5C005CFF 00FF [Trivial] +5C085C00 0800 [Trivial] +5C085C08 0808 [Trivial] +5C085C09 0809 [Trivial] +5C085C0A 080A [Trivial] +5C085C0D 080D [Trivial] +5C085C1A 081A [Trivial] +5C085C22 0822 [Trivial] +5C085C25 085C25 [Regular] +5C085C27 0827 [Trivial] +5C085C30 0800 [Regular] +5C085C3F 083F [Trivial] +5C085C40 0840 [Trivial] +5C085C5A 081A [Regular] +5C085C5C 085C [Regular] +5C085C5F 085C5F [Regular] +5C085C61 0861 [Trivial] +5C085C62 0808 [Regular] +5C085C6E 080A [Regular] +5C085C72 080D [Regular] +5C085C74 0809 [Regular] +5C085C7E 087E [Trivial] +5C085C7F 087F [Trivial] +5C085C80 0880 [Trivial] +5C085C81 0881 [Trivial] +5C085C9F 089F [Trivial] +5C085CA0 08A0 [Trivial] +5C085CA1 08A1 [Trivial] +5C085CE0 08E0 [Trivial] +5C085CEF 08EF [Trivial] +5C085CF9 08F9 [Trivial] +5C085CFA 08FA [Trivial] +5C085CFC 08FC [Trivial] +5C085CFD 08FD [Trivial] +5C085CFE 08FE [Trivial] +5C085CFF 08FF [Trivial] +5C095C00 0900 [Trivial] +5C095C08 0908 [Trivial] +5C095C09 0909 [Trivial] +5C095C0A 090A [Trivial] +5C095C0D 090D [Trivial] +5C095C1A 091A [Trivial] +5C095C22 0922 [Trivial] +5C095C25 095C25 [Regular] +5C095C27 0927 [Trivial] +5C095C30 0900 [Regular] +5C095C3F 093F [Trivial] +5C095C40 0940 [Trivial] +5C095C5A 091A [Regular] +5C095C5C 095C [Regular] +5C095C5F 095C5F [Regular] +5C095C61 0961 [Trivial] +5C095C62 0908 [Regular] +5C095C6E 090A [Regular] +5C095C72 090D [Regular] +5C095C74 0909 [Regular] +5C095C7E 097E [Trivial] +5C095C7F 097F [Trivial] +5C095C80 0980 [Trivial] +5C095C81 0981 [Trivial] +5C095C9F 099F [Trivial] +5C095CA0 09A0 [Trivial] +5C095CA1 09A1 [Trivial] +5C095CE0 09E0 [Trivial] +5C095CEF 09EF [Trivial] +5C095CF9 09F9 [Trivial] +5C095CFA 09FA [Trivial] +5C095CFC 09FC [Trivial] +5C095CFD 09FD [Trivial] +5C095CFE 09FE [Trivial] +5C095CFF 09FF [Trivial] +5C0A5C00 0A00 [Trivial] +5C0A5C08 0A08 [Trivial] +5C0A5C09 0A09 [Trivial] +5C0A5C0A 0A0A [Trivial] +5C0A5C0D 0A0D [Trivial] +5C0A5C1A 0A1A [Trivial] +5C0A5C22 0A22 [Trivial] +5C0A5C25 0A5C25 [Regular] +5C0A5C27 0A27 [Trivial] +5C0A5C30 0A00 [Regular] +5C0A5C3F 0A3F [Trivial] +5C0A5C40 0A40 [Trivial] +5C0A5C5A 0A1A [Regular] +5C0A5C5C 0A5C [Regular] +5C0A5C5F 0A5C5F [Regular] +5C0A5C61 0A61 [Trivial] +5C0A5C62 0A08 [Regular] +5C0A5C6E 0A0A [Regular] +5C0A5C72 0A0D [Regular] +5C0A5C74 0A09 [Regular] +5C0A5C7E 0A7E [Trivial] +5C0A5C7F 0A7F [Trivial] +5C0A5C80 0A80 [Trivial] +5C0A5C81 0A81 [Trivial] +5C0A5C9F 0A9F [Trivial] +5C0A5CA0 0AA0 [Trivial] +5C0A5CA1 0AA1 [Trivial] +5C0A5CE0 0AE0 [Trivial] +5C0A5CEF 0AEF [Trivial] +5C0A5CF9 0AF9 [Trivial] +5C0A5CFA 0AFA [Trivial] +5C0A5CFC 0AFC [Trivial] +5C0A5CFD 0AFD [Trivial] +5C0A5CFE 0AFE [Trivial] +5C0A5CFF 0AFF [Trivial] +5C0D5C00 0D00 [Trivial] +5C0D5C08 0D08 [Trivial] +5C0D5C09 0D09 [Trivial] +5C0D5C0A 0D0A [Trivial] +5C0D5C0D 0D0D [Trivial] +5C0D5C1A 0D1A [Trivial] +5C0D5C22 0D22 [Trivial] +5C0D5C25 0D5C25 [Regular] +5C0D5C27 0D27 [Trivial] +5C0D5C30 0D00 [Regular] +5C0D5C3F 0D3F [Trivial] +5C0D5C40 0D40 [Trivial] +5C0D5C5A 0D1A [Regular] +5C0D5C5C 0D5C [Regular] +5C0D5C5F 0D5C5F [Regular] +5C0D5C61 0D61 [Trivial] +5C0D5C62 0D08 [Regular] +5C0D5C6E 0D0A [Regular] +5C0D5C72 0D0D [Regular] +5C0D5C74 0D09 [Regular] +5C0D5C7E 0D7E [Trivial] +5C0D5C7F 0D7F [Trivial] +5C0D5C80 0D80 [Trivial] +5C0D5C81 0D81 [Trivial] +5C0D5C9F 0D9F [Trivial] +5C0D5CA0 0DA0 [Trivial] +5C0D5CA1 0DA1 [Trivial] +5C0D5CE0 0DE0 [Trivial] +5C0D5CEF 0DEF [Trivial] +5C0D5CF9 0DF9 [Trivial] +5C0D5CFA 0DFA [Trivial] +5C0D5CFC 0DFC [Trivial] +5C0D5CFD 0DFD [Trivial] +5C0D5CFE 0DFE [Trivial] +5C0D5CFF 0DFF [Trivial] +5C1A5C00 1A00 [Trivial] +5C1A5C08 1A08 [Trivial] +5C1A5C09 1A09 [Trivial] +5C1A5C0A 1A0A [Trivial] +5C1A5C0D 1A0D [Trivial] +5C1A5C1A 1A1A [Trivial] +5C1A5C22 1A22 [Trivial] +5C1A5C25 1A5C25 [Regular] +5C1A5C27 1A27 [Trivial] +5C1A5C30 1A00 [Regular] +5C1A5C3F 1A3F [Trivial] +5C1A5C40 1A40 [Trivial] +5C1A5C5A 1A1A [Regular] +5C1A5C5C 1A5C [Regular] +5C1A5C5F 1A5C5F [Regular] +5C1A5C61 1A61 [Trivial] +5C1A5C62 1A08 [Regular] +5C1A5C6E 1A0A [Regular] +5C1A5C72 1A0D [Regular] +5C1A5C74 1A09 [Regular] +5C1A5C7E 1A7E [Trivial] +5C1A5C7F 1A7F [Trivial] +5C1A5C80 1A80 [Trivial] +5C1A5C81 1A81 [Trivial] +5C1A5C9F 1A9F [Trivial] +5C1A5CA0 1AA0 [Trivial] +5C1A5CA1 1AA1 [Trivial] +5C1A5CE0 1AE0 [Trivial] +5C1A5CEF 1AEF [Trivial] +5C1A5CF9 1AF9 [Trivial] +5C1A5CFA 1AFA [Trivial] +5C1A5CFC 1AFC [Trivial] +5C1A5CFD 1AFD [Trivial] +5C1A5CFE 1AFE [Trivial] +5C1A5CFF 1AFF [Trivial] +5C225C00 2200 [Trivial] +5C225C08 2208 [Trivial] +5C225C09 2209 [Trivial] +5C225C0A 220A [Trivial] +5C225C0D 220D [Trivial] +5C225C1A 221A [Trivial] +5C225C22 2222 [Trivial] +5C225C25 225C25 [Regular] +5C225C27 2227 [Trivial] +5C225C30 2200 [Regular] +5C225C3F 223F [Trivial] +5C225C40 2240 [Trivial] +5C225C5A 221A [Regular] +5C225C5C 225C [Regular] +5C225C5F 225C5F [Regular] +5C225C61 2261 [Trivial] +5C225C62 2208 [Regular] +5C225C6E 220A [Regular] +5C225C72 220D [Regular] +5C225C74 2209 [Regular] +5C225C7E 227E [Trivial] +5C225C7F 227F [Trivial] +5C225C80 2280 [Trivial] +5C225C81 2281 [Trivial] +5C225C9F 229F [Trivial] +5C225CA0 22A0 [Trivial] +5C225CA1 22A1 [Trivial] +5C225CE0 22E0 [Trivial] +5C225CEF 22EF [Trivial] +5C225CF9 22F9 [Trivial] +5C225CFA 22FA [Trivial] +5C225CFC 22FC [Trivial] +5C225CFD 22FD [Trivial] +5C225CFE 22FE [Trivial] +5C225CFF 22FF [Trivial] +5C255C00 5C2500 [Regular] +5C255C08 5C2508 [Regular] +5C255C09 5C2509 [Regular] +5C255C0A 5C250A [Regular] +5C255C0D 5C250D [Regular] +5C255C1A 5C251A [Regular] +5C255C22 5C2522 [Regular] +5C255C25 5C255C25 [Preserve][LIKE] +5C255C27 5C2527 [Regular] +5C255C30 5C2500 [Regular] +5C255C3F 5C253F [Regular] +5C255C40 5C2540 [Regular] +5C255C5A 5C251A [Regular] +5C255C5C 5C255C [Regular] +5C255C5F 5C255C5F [Preserve][LIKE] +5C255C61 5C2561 [Regular] +5C255C62 5C2508 [Regular] +5C255C6E 5C250A [Regular] +5C255C72 5C250D [Regular] +5C255C74 5C2509 [Regular] +5C255C7E 5C257E [Regular] +5C255C7F 5C257F [Regular] +5C255C80 5C2580 [Regular] +5C255C81 5C2581 [Regular] +5C255C9F 5C259F [Regular] +5C255CA0 5C25A0 [Regular] +5C255CA1 5C25A1 [Regular] +5C255CE0 5C25E0 [Regular] +5C255CEF 5C25EF [Regular] +5C255CF9 5C25F9 [Regular] +5C255CFA 5C25FA [Regular] +5C255CFC 5C25FC [Regular] +5C255CFD 5C25FD [Regular] +5C255CFE 5C25FE [Regular] +5C255CFF 5C25FF [Regular] +5C275C00 2700 [Trivial] +5C275C08 2708 [Trivial] +5C275C09 2709 [Trivial] +5C275C0A 270A [Trivial] +5C275C0D 270D [Trivial] +5C275C1A 271A [Trivial] +5C275C22 2722 [Trivial] +5C275C25 275C25 [Regular] +5C275C27 2727 [Trivial] +5C275C30 2700 [Regular] +5C275C3F 273F [Trivial] +5C275C40 2740 [Trivial] +5C275C5A 271A [Regular] +5C275C5C 275C [Regular] +5C275C5F 275C5F [Regular] +5C275C61 2761 [Trivial] +5C275C62 2708 [Regular] +5C275C6E 270A [Regular] +5C275C72 270D [Regular] +5C275C74 2709 [Regular] +5C275C7E 277E [Trivial] +5C275C7F 277F [Trivial] +5C275C80 2780 [Trivial] +5C275C81 2781 [Trivial] +5C275C9F 279F [Trivial] +5C275CA0 27A0 [Trivial] +5C275CA1 27A1 [Trivial] +5C275CE0 27E0 [Trivial] +5C275CEF 27EF [Trivial] +5C275CF9 27F9 [Trivial] +5C275CFA 27FA [Trivial] +5C275CFC 27FC [Trivial] +5C275CFD 27FD [Trivial] +5C275CFE 27FE [Trivial] +5C275CFF 27FF [Trivial] +5C305C00 0000 [Regular] +5C305C08 0008 [Regular] +5C305C09 0009 [Regular] +5C305C0A 000A [Regular] +5C305C0D 000D [Regular] +5C305C1A 001A [Regular] +5C305C22 0022 [Regular] +5C305C25 005C25 [Regular] +5C305C27 0027 [Regular] +5C305C30 0000 [Regular] +5C305C3F 003F [Regular] +5C305C40 0040 [Regular] +5C305C5A 001A [Regular] +5C305C5C 005C [Regular] +5C305C5F 005C5F [Regular] +5C305C61 0061 [Regular] +5C305C62 0008 [Regular] +5C305C6E 000A [Regular] +5C305C72 000D [Regular] +5C305C74 0009 [Regular] +5C305C7E 007E [Regular] +5C305C7F 007F [Regular] +5C305C80 0080 [Regular] +5C305C81 0081 [Regular] +5C305C9F 009F [Regular] +5C305CA0 00A0 [Regular] +5C305CA1 00A1 [Regular] +5C305CE0 00E0 [Regular] +5C305CEF 00EF [Regular] +5C305CF9 00F9 [Regular] +5C305CFA 00FA [Regular] +5C305CFC 00FC [Regular] +5C305CFD 00FD [Regular] +5C305CFE 00FE [Regular] +5C305CFF 00FF [Regular] +5C3F5C00 3F00 [Trivial] +5C3F5C08 3F08 [Trivial] +5C3F5C09 3F09 [Trivial] +5C3F5C0A 3F0A [Trivial] +5C3F5C0D 3F0D [Trivial] +5C3F5C1A 3F1A [Trivial] +5C3F5C22 3F22 [Trivial] +5C3F5C25 3F5C25 [Regular] +5C3F5C27 3F27 [Trivial] +5C3F5C30 3F00 [Regular] +5C3F5C3F 3F3F [Trivial] +5C3F5C40 3F40 [Trivial] +5C3F5C5A 3F1A [Regular] +5C3F5C5C 3F5C [Regular] +5C3F5C5F 3F5C5F [Regular] +5C3F5C61 3F61 [Trivial] +5C3F5C62 3F08 [Regular] +5C3F5C6E 3F0A [Regular] +5C3F5C72 3F0D [Regular] +5C3F5C74 3F09 [Regular] +5C3F5C7E 3F7E [Trivial] +5C3F5C7F 3F7F [Trivial] +5C3F5C80 3F80 [Trivial] +5C3F5C81 3F81 [Trivial] +5C3F5C9F 3F9F [Trivial] +5C3F5CA0 3FA0 [Trivial] +5C3F5CA1 3FA1 [Trivial] +5C3F5CE0 3FE0 [Trivial] +5C3F5CEF 3FEF [Trivial] +5C3F5CF9 3FF9 [Trivial] +5C3F5CFA 3FFA [Trivial] +5C3F5CFC 3FFC [Trivial] +5C3F5CFD 3FFD [Trivial] +5C3F5CFE 3FFE [Trivial] +5C3F5CFF 3FFF [Trivial] +5C405C00 4000 [Trivial] +5C405C08 4008 [Trivial] +5C405C09 4009 [Trivial] +5C405C0A 400A [Trivial] +5C405C0D 400D [Trivial] +5C405C1A 401A [Trivial] +5C405C22 4022 [Trivial] +5C405C25 405C25 [Regular] +5C405C27 4027 [Trivial] +5C405C30 4000 [Regular] +5C405C3F 403F [Trivial] +5C405C40 4040 [Trivial] +5C405C5A 401A [Regular] +5C405C5C 405C [Regular] +5C405C5F 405C5F [Regular] +5C405C61 4061 [Trivial] +5C405C62 4008 [Regular] +5C405C6E 400A [Regular] +5C405C72 400D [Regular] +5C405C74 4009 [Regular] +5C405C7E 407E [Trivial] +5C405C7F 407F [Trivial] +5C405C80 4080 [Trivial] +5C405C81 4081 [Trivial] +5C405C9F 409F [Trivial] +5C405CA0 40A0 [Trivial] +5C405CA1 40A1 [Trivial] +5C405CE0 40E0 [Trivial] +5C405CEF 40EF [Trivial] +5C405CF9 40F9 [Trivial] +5C405CFA 40FA [Trivial] +5C405CFC 40FC [Trivial] +5C405CFD 40FD [Trivial] +5C405CFE 40FE [Trivial] +5C405CFF 40FF [Trivial] +5C5A5C00 1A00 [Regular] +5C5A5C08 1A08 [Regular] +5C5A5C09 1A09 [Regular] +5C5A5C0A 1A0A [Regular] +5C5A5C0D 1A0D [Regular] +5C5A5C1A 1A1A [Regular] +5C5A5C22 1A22 [Regular] +5C5A5C25 1A5C25 [Regular] +5C5A5C27 1A27 [Regular] +5C5A5C30 1A00 [Regular] +5C5A5C3F 1A3F [Regular] +5C5A5C40 1A40 [Regular] +5C5A5C5A 1A1A [Regular] +5C5A5C5C 1A5C [Regular] +5C5A5C5F 1A5C5F [Regular] +5C5A5C61 1A61 [Regular] +5C5A5C62 1A08 [Regular] +5C5A5C6E 1A0A [Regular] +5C5A5C72 1A0D [Regular] +5C5A5C74 1A09 [Regular] +5C5A5C7E 1A7E [Regular] +5C5A5C7F 1A7F [Regular] +5C5A5C80 1A80 [Regular] +5C5A5C81 1A81 [Regular] +5C5A5C9F 1A9F [Regular] +5C5A5CA0 1AA0 [Regular] +5C5A5CA1 1AA1 [Regular] +5C5A5CE0 1AE0 [Regular] +5C5A5CEF 1AEF [Regular] +5C5A5CF9 1AF9 [Regular] +5C5A5CFA 1AFA [Regular] +5C5A5CFC 1AFC [Regular] +5C5A5CFD 1AFD [Regular] +5C5A5CFE 1AFE [Regular] +5C5A5CFF 1AFF [Regular] +5C5C5C00 5C00 [Regular] +5C5C5C08 5C08 [Regular] +5C5C5C09 5C09 [Regular] +5C5C5C0A 5C0A [Regular] +5C5C5C0D 5C0D [Regular] +5C5C5C1A 5C1A [Regular] +5C5C5C22 5C22 [Regular] +5C5C5C25 5C5C25 [Regular] +5C5C5C27 5C27 [Regular] +5C5C5C30 5C00 [Regular] +5C5C5C3F 5C3F [Regular] +5C5C5C40 5C40 [Regular] +5C5C5C5A 5C1A [Regular] +5C5C5C5C 5C5C [Regular] +5C5C5C5F 5C5C5F [Regular] +5C5C5C61 5C61 [Regular] +5C5C5C62 5C08 [Regular] +5C5C5C6E 5C0A [Regular] +5C5C5C72 5C0D [Regular] +5C5C5C74 5C09 [Regular] +5C5C5C7E 5C7E [Regular] +5C5C5C7F 5C7F [Regular] +5C5C5C80 5C80 [Regular] +5C5C5C81 5C81 [Regular] +5C5C5C9F 5C9F [Regular] +5C5C5CA0 5CA0 [Regular] +5C5C5CA1 5CA1 [Regular] +5C5C5CE0 5CE0 [Regular] +5C5C5CEF 5CEF [Regular] +5C5C5CF9 5CF9 [Regular] +5C5C5CFA 5CFA [Regular] +5C5C5CFC 5CFC [Regular] +5C5C5CFD 5CFD [Regular] +5C5C5CFE 5CFE [Regular] +5C5C5CFF 5CFF [Regular] +5C5F5C00 5C5F00 [Regular] +5C5F5C08 5C5F08 [Regular] +5C5F5C09 5C5F09 [Regular] +5C5F5C0A 5C5F0A [Regular] +5C5F5C0D 5C5F0D [Regular] +5C5F5C1A 5C5F1A [Regular] +5C5F5C22 5C5F22 [Regular] +5C5F5C25 5C5F5C25 [Preserve][LIKE] +5C5F5C27 5C5F27 [Regular] +5C5F5C30 5C5F00 [Regular] +5C5F5C3F 5C5F3F [Regular] +5C5F5C40 5C5F40 [Regular] +5C5F5C5A 5C5F1A [Regular] +5C5F5C5C 5C5F5C [Regular] +5C5F5C5F 5C5F5C5F [Preserve][LIKE] +5C5F5C61 5C5F61 [Regular] +5C5F5C62 5C5F08 [Regular] +5C5F5C6E 5C5F0A [Regular] +5C5F5C72 5C5F0D [Regular] +5C5F5C74 5C5F09 [Regular] +5C5F5C7E 5C5F7E [Regular] +5C5F5C7F 5C5F7F [Regular] +5C5F5C80 5C5F80 [Regular] +5C5F5C81 5C5F81 [Regular] +5C5F5C9F 5C5F9F [Regular] +5C5F5CA0 5C5FA0 [Regular] +5C5F5CA1 5C5FA1 [Regular] +5C5F5CE0 5C5FE0 [Regular] +5C5F5CEF 5C5FEF [Regular] +5C5F5CF9 5C5FF9 [Regular] +5C5F5CFA 5C5FFA [Regular] +5C5F5CFC 5C5FFC [Regular] +5C5F5CFD 5C5FFD [Regular] +5C5F5CFE 5C5FFE [Regular] +5C5F5CFF 5C5FFF [Regular] +5C615C00 6100 [Trivial] +5C615C08 6108 [Trivial] +5C615C09 6109 [Trivial] +5C615C0A 610A [Trivial] +5C615C0D 610D [Trivial] +5C615C1A 611A [Trivial] +5C615C22 6122 [Trivial] +5C615C25 615C25 [Regular] +5C615C27 6127 [Trivial] +5C615C30 6100 [Regular] +5C615C3F 613F [Trivial] +5C615C40 6140 [Trivial] +5C615C5A 611A [Regular] +5C615C5C 615C [Regular] +5C615C5F 615C5F [Regular] +5C615C61 6161 [Trivial] +5C615C62 6108 [Regular] +5C615C6E 610A [Regular] +5C615C72 610D [Regular] +5C615C74 6109 [Regular] +5C615C7E 617E [Trivial] +5C615C7F 617F [Trivial] +5C615C80 6180 [Trivial] +5C615C81 6181 [Trivial] +5C615C9F 619F [Trivial] +5C615CA0 61A0 [Trivial] +5C615CA1 61A1 [Trivial] +5C615CE0 61E0 [Trivial] +5C615CEF 61EF [Trivial] +5C615CF9 61F9 [Trivial] +5C615CFA 61FA [Trivial] +5C615CFC 61FC [Trivial] +5C615CFD 61FD [Trivial] +5C615CFE 61FE [Trivial] +5C615CFF 61FF [Trivial] +5C625C00 0800 [Regular] +5C625C08 0808 [Regular] +5C625C09 0809 [Regular] +5C625C0A 080A [Regular] +5C625C0D 080D [Regular] +5C625C1A 081A [Regular] +5C625C22 0822 [Regular] +5C625C25 085C25 [Regular] +5C625C27 0827 [Regular] +5C625C30 0800 [Regular] +5C625C3F 083F [Regular] +5C625C40 0840 [Regular] +5C625C5A 081A [Regular] +5C625C5C 085C [Regular] +5C625C5F 085C5F [Regular] +5C625C61 0861 [Regular] +5C625C62 0808 [Regular] +5C625C6E 080A [Regular] +5C625C72 080D [Regular] +5C625C74 0809 [Regular] +5C625C7E 087E [Regular] +5C625C7F 087F [Regular] +5C625C80 0880 [Regular] +5C625C81 0881 [Regular] +5C625C9F 089F [Regular] +5C625CA0 08A0 [Regular] +5C625CA1 08A1 [Regular] +5C625CE0 08E0 [Regular] +5C625CEF 08EF [Regular] +5C625CF9 08F9 [Regular] +5C625CFA 08FA [Regular] +5C625CFC 08FC [Regular] +5C625CFD 08FD [Regular] +5C625CFE 08FE [Regular] +5C625CFF 08FF [Regular] +5C6E5C00 0A00 [Regular] +5C6E5C08 0A08 [Regular] +5C6E5C09 0A09 [Regular] +5C6E5C0A 0A0A [Regular] +5C6E5C0D 0A0D [Regular] +5C6E5C1A 0A1A [Regular] +5C6E5C22 0A22 [Regular] +5C6E5C25 0A5C25 [Regular] +5C6E5C27 0A27 [Regular] +5C6E5C30 0A00 [Regular] +5C6E5C3F 0A3F [Regular] +5C6E5C40 0A40 [Regular] +5C6E5C5A 0A1A [Regular] +5C6E5C5C 0A5C [Regular] +5C6E5C5F 0A5C5F [Regular] +5C6E5C61 0A61 [Regular] +5C6E5C62 0A08 [Regular] +5C6E5C6E 0A0A [Regular] +5C6E5C72 0A0D [Regular] +5C6E5C74 0A09 [Regular] +5C6E5C7E 0A7E [Regular] +5C6E5C7F 0A7F [Regular] +5C6E5C80 0A80 [Regular] +5C6E5C81 0A81 [Regular] +5C6E5C9F 0A9F [Regular] +5C6E5CA0 0AA0 [Regular] +5C6E5CA1 0AA1 [Regular] +5C6E5CE0 0AE0 [Regular] +5C6E5CEF 0AEF [Regular] +5C6E5CF9 0AF9 [Regular] +5C6E5CFA 0AFA [Regular] +5C6E5CFC 0AFC [Regular] +5C6E5CFD 0AFD [Regular] +5C6E5CFE 0AFE [Regular] +5C6E5CFF 0AFF [Regular] +5C725C00 0D00 [Regular] +5C725C08 0D08 [Regular] +5C725C09 0D09 [Regular] +5C725C0A 0D0A [Regular] +5C725C0D 0D0D [Regular] +5C725C1A 0D1A [Regular] +5C725C22 0D22 [Regular] +5C725C25 0D5C25 [Regular] +5C725C27 0D27 [Regular] +5C725C30 0D00 [Regular] +5C725C3F 0D3F [Regular] +5C725C40 0D40 [Regular] +5C725C5A 0D1A [Regular] +5C725C5C 0D5C [Regular] +5C725C5F 0D5C5F [Regular] +5C725C61 0D61 [Regular] +5C725C62 0D08 [Regular] +5C725C6E 0D0A [Regular] +5C725C72 0D0D [Regular] +5C725C74 0D09 [Regular] +5C725C7E 0D7E [Regular] +5C725C7F 0D7F [Regular] +5C725C80 0D80 [Regular] +5C725C81 0D81 [Regular] +5C725C9F 0D9F [Regular] +5C725CA0 0DA0 [Regular] +5C725CA1 0DA1 [Regular] +5C725CE0 0DE0 [Regular] +5C725CEF 0DEF [Regular] +5C725CF9 0DF9 [Regular] +5C725CFA 0DFA [Regular] +5C725CFC 0DFC [Regular] +5C725CFD 0DFD [Regular] +5C725CFE 0DFE [Regular] +5C725CFF 0DFF [Regular] +5C745C00 0900 [Regular] +5C745C08 0908 [Regular] +5C745C09 0909 [Regular] +5C745C0A 090A [Regular] +5C745C0D 090D [Regular] +5C745C1A 091A [Regular] +5C745C22 0922 [Regular] +5C745C25 095C25 [Regular] +5C745C27 0927 [Regular] +5C745C30 0900 [Regular] +5C745C3F 093F [Regular] +5C745C40 0940 [Regular] +5C745C5A 091A [Regular] +5C745C5C 095C [Regular] +5C745C5F 095C5F [Regular] +5C745C61 0961 [Regular] +5C745C62 0908 [Regular] +5C745C6E 090A [Regular] +5C745C72 090D [Regular] +5C745C74 0909 [Regular] +5C745C7E 097E [Regular] +5C745C7F 097F [Regular] +5C745C80 0980 [Regular] +5C745C81 0981 [Regular] +5C745C9F 099F [Regular] +5C745CA0 09A0 [Regular] +5C745CA1 09A1 [Regular] +5C745CE0 09E0 [Regular] +5C745CEF 09EF [Regular] +5C745CF9 09F9 [Regular] +5C745CFA 09FA [Regular] +5C745CFC 09FC [Regular] +5C745CFD 09FD [Regular] +5C745CFE 09FE [Regular] +5C745CFF 09FF [Regular] +5C7E5C00 7E00 [Trivial] +5C7E5C08 7E08 [Trivial] +5C7E5C09 7E09 [Trivial] +5C7E5C0A 7E0A [Trivial] +5C7E5C0D 7E0D [Trivial] +5C7E5C1A 7E1A [Trivial] +5C7E5C22 7E22 [Trivial] +5C7E5C25 7E5C25 [Regular] +5C7E5C27 7E27 [Trivial] +5C7E5C30 7E00 [Regular] +5C7E5C3F 7E3F [Trivial] +5C7E5C40 7E40 [Trivial] +5C7E5C5A 7E1A [Regular] +5C7E5C5C 7E5C [Regular] +5C7E5C5F 7E5C5F [Regular] +5C7E5C61 7E61 [Trivial] +5C7E5C62 7E08 [Regular] +5C7E5C6E 7E0A [Regular] +5C7E5C72 7E0D [Regular] +5C7E5C74 7E09 [Regular] +5C7E5C7E 7E7E [Trivial] +5C7E5C7F 7E7F [Trivial] +5C7E5C80 7E80 [Trivial] +5C7E5C81 7E81 [Trivial] +5C7E5C9F 7E9F [Trivial] +5C7E5CA0 7EA0 [Trivial] +5C7E5CA1 7EA1 [Trivial] +5C7E5CE0 7EE0 [Trivial] +5C7E5CEF 7EEF [Trivial] +5C7E5CF9 7EF9 [Trivial] +5C7E5CFA 7EFA [Trivial] +5C7E5CFC 7EFC [Trivial] +5C7E5CFD 7EFD [Trivial] +5C7E5CFE 7EFE [Trivial] +5C7E5CFF 7EFF [Trivial] +5C7F5C00 7F00 [Trivial] +5C7F5C08 7F08 [Trivial] +5C7F5C09 7F09 [Trivial] +5C7F5C0A 7F0A [Trivial] +5C7F5C0D 7F0D [Trivial] +5C7F5C1A 7F1A [Trivial] +5C7F5C22 7F22 [Trivial] +5C7F5C25 7F5C25 [Regular] +5C7F5C27 7F27 [Trivial] +5C7F5C30 7F00 [Regular] +5C7F5C3F 7F3F [Trivial] +5C7F5C40 7F40 [Trivial] +5C7F5C5A 7F1A [Regular] +5C7F5C5C 7F5C [Regular] +5C7F5C5F 7F5C5F [Regular] +5C7F5C61 7F61 [Trivial] +5C7F5C62 7F08 [Regular] +5C7F5C6E 7F0A [Regular] +5C7F5C72 7F0D [Regular] +5C7F5C74 7F09 [Regular] +5C7F5C7E 7F7E [Trivial] +5C7F5C7F 7F7F [Trivial] +5C7F5C80 7F80 [Trivial] +5C7F5C81 7F81 [Trivial] +5C7F5C9F 7F9F [Trivial] +5C7F5CA0 7FA0 [Trivial] +5C7F5CA1 7FA1 [Trivial] +5C7F5CE0 7FE0 [Trivial] +5C7F5CEF 7FEF [Trivial] +5C7F5CF9 7FF9 [Trivial] +5C7F5CFA 7FFA [Trivial] +5C7F5CFC 7FFC [Trivial] +5C7F5CFD 7FFD [Trivial] +5C7F5CFE 7FFE [Trivial] +5C7F5CFF 7FFF [Trivial] +5C805C00 8000 [Trivial][USER] +5C805C08 8008 [Trivial][USER] +5C805C09 8009 [Trivial][USER] +5C805C0A 800A [Trivial][USER] +5C805C0D 800D [Trivial][USER] +5C805C1A 801A [Trivial][USER] +5C805C22 8022 [Trivial][USER] +5C805C25 805C25 [Regular] +5C805C27 8027 [Trivial][USER] +5C805C30 8000 [Regular] +5C805C3F 803F [Trivial][USER] +5C805C40 8040 [Trivial][USER] +5C805C5A 801A [Regular] +5C805C5C 805C [Regular][USER] +5C805C5F 805C5F [Regular] +5C805C61 8061 [Trivial][USER] +5C805C62 8008 [Regular][USER] +5C805C6E 800A [Regular] +5C805C72 800D [Regular] +5C805C74 8009 [Regular] +5C805C7E 807E [Trivial][USER] +5C805C7F 807F [Trivial][USER] +5C805C80 8080 [Trivial][USER] +5C805C81 8081 [Trivial][USER] +5C805C9F 809F [Trivial][USER] +5C805CA0 80A0 [Trivial][USER] +5C805CA1 80A1 [Trivial][USER] +5C805CE0 80E0 [Trivial][USER] +5C805CEF 80EF [Trivial][USER] +5C805CF9 80F9 [Trivial][USER] +5C805CFA 80FA [Trivial][USER] +5C805CFC 80FC [Trivial][USER] +5C805CFD 80FD [Trivial][USER] +5C805CFE 80FE [Trivial][USER] +5C805CFF 80FF [Trivial][USER] +5C815C00 8100 [Trivial][USER] +5C815C08 8108 [Trivial][USER] +5C815C09 8109 [Trivial][USER] +5C815C0A 810A [Trivial][USER] +5C815C0D 810D [Trivial][USER] +5C815C1A 811A [Trivial][USER] +5C815C22 8122 [Trivial][USER] +5C815C25 815C25 [Regular] +5C815C27 8127 [Trivial][USER] +5C815C30 8100 [Regular] +5C815C3F 813F [Trivial][USER] +5C815C40 8140 [Trivial][USER] +5C815C5A 811A [Regular] +5C815C5C 815C [Regular][USER] +5C815C5F 815C5F [Regular] +5C815C61 8161 [Trivial][USER] +5C815C62 8108 [Regular][USER] +5C815C6E 810A [Regular] +5C815C72 810D [Regular] +5C815C74 8109 [Regular] +5C815C7E 817E [Trivial][USER] +5C815C7F 817F [Trivial][USER] +5C815C80 8180 [Trivial][USER] +5C815C81 8181 [Trivial][USER] +5C815C9F 819F [Trivial][USER] +5C815CA0 81A0 [Trivial][USER] +5C815CA1 81A1 [Trivial][USER] +5C815CE0 81E0 [Trivial][USER] +5C815CEF 81EF [Trivial][USER] +5C815CF9 81F9 [Trivial][USER] +5C815CFA 81FA [Trivial][USER] +5C815CFC 81FC [Trivial][USER] +5C815CFD 81FD [Trivial][USER] +5C815CFE 81FE [Trivial][USER] +5C815CFF 81FF [Trivial][USER] +5C9F5C00 9F00 [Trivial][USER] +5C9F5C08 9F08 [Trivial][USER] +5C9F5C09 9F09 [Trivial][USER] +5C9F5C0A 9F0A [Trivial][USER] +5C9F5C0D 9F0D [Trivial][USER] +5C9F5C1A 9F1A [Trivial][USER] +5C9F5C22 9F22 [Trivial][USER] +5C9F5C25 9F5C25 [Regular] +5C9F5C27 9F27 [Trivial][USER] +5C9F5C30 9F00 [Regular] +5C9F5C3F 9F3F [Trivial][USER] +5C9F5C40 9F40 [Trivial][USER] +5C9F5C5A 9F1A [Regular] +5C9F5C5C 9F5C [Regular][USER] +5C9F5C5F 9F5C5F [Regular] +5C9F5C61 9F61 [Trivial][USER] +5C9F5C62 9F08 [Regular][USER] +5C9F5C6E 9F0A [Regular] +5C9F5C72 9F0D [Regular] +5C9F5C74 9F09 [Regular] +5C9F5C7E 9F7E [Trivial][USER] +5C9F5C7F 9F7F [Trivial][USER] +5C9F5C80 9F80 [Trivial][USER] +5C9F5C81 9F81 [Trivial][USER] +5C9F5C9F 9F9F [Trivial][USER] +5C9F5CA0 9FA0 [Trivial][USER] +5C9F5CA1 9FA1 [Trivial][USER] +5C9F5CE0 9FE0 [Trivial][USER] +5C9F5CEF 9FEF [Trivial][USER] +5C9F5CF9 9FF9 [Trivial][USER] +5C9F5CFA 9FFA [Trivial][USER] +5C9F5CFC 9FFC [Trivial][USER] +5C9F5CFD 9FFD [Trivial][USER] +5C9F5CFE 9FFE [Trivial][USER] +5C9F5CFF 9FFF [Trivial][USER] +5CA05C00 A000 [Trivial][USER] +5CA05C08 A008 [Trivial][USER] +5CA05C09 A009 [Trivial][USER] +5CA05C0A A00A [Trivial][USER] +5CA05C0D A00D [Trivial][USER] +5CA05C1A A01A [Trivial][USER] +5CA05C22 A022 [Trivial][USER] +5CA05C25 A05C25 [Regular] +5CA05C27 A027 [Trivial][USER] +5CA05C30 A000 [Regular] +5CA05C3F A03F [Trivial][USER] +5CA05C40 A040 [Trivial][USER] +5CA05C5A A01A [Regular] +5CA05C5C A05C [Regular][USER] +5CA05C5F A05C5F [Regular] +5CA05C61 A061 [Trivial][USER] +5CA05C62 A008 [Regular][USER] +5CA05C6E A00A [Regular] +5CA05C72 A00D [Regular] +5CA05C74 A009 [Regular] +5CA05C7E A07E [Trivial][USER] +5CA05C7F A07F [Trivial][USER] +5CA05C80 A080 [Trivial][USER] +5CA05C81 A081 [Trivial][USER] +5CA05C9F A09F [Trivial][USER] +5CA05CA0 A0A0 [Trivial][USER] +5CA05CA1 A0A1 [Trivial][USER] +5CA05CE0 A0E0 [Trivial][USER] +5CA05CEF A0EF [Trivial][USER] +5CA05CF9 A0F9 [Trivial][USER] +5CA05CFA A0FA [Trivial][USER] +5CA05CFC A0FC [Trivial][USER] +5CA05CFD A0FD [Trivial][USER] +5CA05CFE A0FE [Trivial][USER] +5CA05CFF A0FF [Trivial][USER] +5CA15C00 A100 [Trivial][USER] +5CA15C08 A108 [Trivial][USER] +5CA15C09 A109 [Trivial][USER] +5CA15C0A A10A [Trivial][USER] +5CA15C0D A10D [Trivial][USER] +5CA15C1A A11A [Trivial][USER] +5CA15C22 A122 [Trivial][USER] +5CA15C25 A15C25 [Regular] +5CA15C27 A127 [Trivial][USER] +5CA15C30 A100 [Regular] +5CA15C3F A13F [Trivial][USER] +5CA15C40 A140 [Trivial][USER] +5CA15C5A A11A [Regular] +5CA15C5C A15C [Regular][USER] +5CA15C5F A15C5F [Regular] +5CA15C61 A161 [Trivial][USER] +5CA15C62 A108 [Regular][USER] +5CA15C6E A10A [Regular] +5CA15C72 A10D [Regular] +5CA15C74 A109 [Regular] +5CA15C7E A17E [Trivial][USER] +5CA15C7F A17F [Trivial][USER] +5CA15C80 A180 [Trivial][USER] +5CA15C81 A181 [Trivial][USER] +5CA15C9F A19F [Trivial][USER] +5CA15CA0 A1A0 [Trivial][USER] +5CA15CA1 A1A1 [Trivial][USER] +5CA15CE0 A1E0 [Trivial][USER] +5CA15CEF A1EF [Trivial][USER] +5CA15CF9 A1F9 [Trivial][USER] +5CA15CFA A1FA [Trivial][USER] +5CA15CFC A1FC [Trivial][USER] +5CA15CFD A1FD [Trivial][USER] +5CA15CFE A1FE [Trivial][USER] +5CA15CFF A1FF [Trivial][USER] +5CE05C00 E000 [Trivial][USER] +5CE05C08 E008 [Trivial][USER] +5CE05C09 E009 [Trivial][USER] +5CE05C0A E00A [Trivial][USER] +5CE05C0D E00D [Trivial][USER] +5CE05C1A E01A [Trivial][USER] +5CE05C22 E022 [Trivial][USER] +5CE05C25 E05C25 [Regular] +5CE05C27 E027 [Trivial][USER] +5CE05C30 E000 [Regular] +5CE05C3F E03F [Trivial][USER] +5CE05C40 E040 [Trivial][USER] +5CE05C5A E01A [Regular] +5CE05C5C E05C [Regular][USER] +5CE05C5F E05C5F [Regular] +5CE05C61 E061 [Trivial][USER] +5CE05C62 E008 [Regular][USER] +5CE05C6E E00A [Regular] +5CE05C72 E00D [Regular] +5CE05C74 E009 [Regular] +5CE05C7E E07E [Trivial][USER] +5CE05C7F E07F [Trivial][USER] +5CE05C80 E080 [Trivial][USER] +5CE05C81 E081 [Trivial][USER] +5CE05C9F E09F [Trivial][USER] +5CE05CA0 E0A0 [Trivial][USER] +5CE05CA1 E0A1 [Trivial][USER] +5CE05CE0 E0E0 [Trivial][USER] +5CE05CEF E0EF [Trivial][USER] +5CE05CF9 E0F9 [Trivial][USER] +5CE05CFA E0FA [Trivial][USER] +5CE05CFC E0FC [Trivial][USER] +5CE05CFD E0FD [Trivial][USER] +5CE05CFE E0FE [Trivial][USER] +5CE05CFF E0FF [Trivial][USER] +5CEF5C00 EF00 [Trivial][USER] +5CEF5C08 EF08 [Trivial][USER] +5CEF5C09 EF09 [Trivial][USER] +5CEF5C0A EF0A [Trivial][USER] +5CEF5C0D EF0D [Trivial][USER] +5CEF5C1A EF1A [Trivial][USER] +5CEF5C22 EF22 [Trivial][USER] +5CEF5C25 EF5C25 [Regular] +5CEF5C27 EF27 [Trivial][USER] +5CEF5C30 EF00 [Regular] +5CEF5C3F EF3F [Trivial][USER] +5CEF5C40 EF40 [Trivial][USER] +5CEF5C5A EF1A [Regular] +5CEF5C5C EF5C [Regular][USER] +5CEF5C5F EF5C5F [Regular] +5CEF5C61 EF61 [Trivial][USER] +5CEF5C62 EF08 [Regular][USER] +5CEF5C6E EF0A [Regular] +5CEF5C72 EF0D [Regular] +5CEF5C74 EF09 [Regular] +5CEF5C7E EF7E [Trivial][USER] +5CEF5C7F EF7F [Trivial][USER] +5CEF5C80 EF80 [Trivial][USER] +5CEF5C81 EF81 [Trivial][USER] +5CEF5C9F EF9F [Trivial][USER] +5CEF5CA0 EFA0 [Trivial][USER] +5CEF5CA1 EFA1 [Trivial][USER] +5CEF5CE0 EFE0 [Trivial][USER] +5CEF5CEF EFEF [Trivial][USER] +5CEF5CF9 EFF9 [Trivial][USER] +5CEF5CFA EFFA [Trivial][USER] +5CEF5CFC EFFC [Trivial][USER] +5CEF5CFD EFFD [Trivial][USER] +5CEF5CFE EFFE [Trivial][USER] +5CEF5CFF EFFF [Trivial][USER] +5CF95C00 F900 [Trivial][USER] +5CF95C08 F908 [Trivial][USER] +5CF95C09 F909 [Trivial][USER] +5CF95C0A F90A [Trivial][USER] +5CF95C0D F90D [Trivial][USER] +5CF95C1A F91A [Trivial][USER] +5CF95C22 F922 [Trivial][USER] +5CF95C25 F95C25 [Regular] +5CF95C27 F927 [Trivial][USER] +5CF95C30 F900 [Regular] +5CF95C3F F93F [Trivial][USER] +5CF95C40 F940 [Trivial][USER] +5CF95C5A F91A [Regular] +5CF95C5C F95C [Regular][USER] +5CF95C5F F95C5F [Regular] +5CF95C61 F961 [Trivial][USER] +5CF95C62 F908 [Regular][USER] +5CF95C6E F90A [Regular] +5CF95C72 F90D [Regular] +5CF95C74 F909 [Regular] +5CF95C7E F97E [Trivial][USER] +5CF95C7F F97F [Trivial][USER] +5CF95C80 F980 [Trivial][USER] +5CF95C81 F981 [Trivial][USER] +5CF95C9F F99F [Trivial][USER] +5CF95CA0 F9A0 [Trivial][USER] +5CF95CA1 F9A1 [Trivial][USER] +5CF95CE0 F9E0 [Trivial][USER] +5CF95CEF F9EF [Trivial][USER] +5CF95CF9 F9F9 [Trivial][USER] +5CF95CFA F9FA [Trivial][USER] +5CF95CFC F9FC [Trivial][USER] +5CF95CFD F9FD [Trivial][USER] +5CF95CFE F9FE [Trivial][USER] +5CF95CFF F9FF [Trivial][USER] +5CFA5C00 FA00 [Trivial][USER] +5CFA5C08 FA08 [Trivial][USER] +5CFA5C09 FA09 [Trivial][USER] +5CFA5C0A FA0A [Trivial][USER] +5CFA5C0D FA0D [Trivial][USER] +5CFA5C1A FA1A [Trivial][USER] +5CFA5C22 FA22 [Trivial][USER] +5CFA5C25 FA5C25 [Regular] +5CFA5C27 FA27 [Trivial][USER] +5CFA5C30 FA00 [Regular] +5CFA5C3F FA3F [Trivial][USER] +5CFA5C40 FA40 [Trivial][USER] +5CFA5C5A FA1A [Regular] +5CFA5C5C FA5C [Regular][USER] +5CFA5C5F FA5C5F [Regular] +5CFA5C61 FA61 [Trivial][USER] +5CFA5C62 FA08 [Regular][USER] +5CFA5C6E FA0A [Regular] +5CFA5C72 FA0D [Regular] +5CFA5C74 FA09 [Regular] +5CFA5C7E FA7E [Trivial][USER] +5CFA5C7F FA7F [Trivial][USER] +5CFA5C80 FA80 [Trivial][USER] +5CFA5C81 FA81 [Trivial][USER] +5CFA5C9F FA9F [Trivial][USER] +5CFA5CA0 FAA0 [Trivial][USER] +5CFA5CA1 FAA1 [Trivial][USER] +5CFA5CE0 FAE0 [Trivial][USER] +5CFA5CEF FAEF [Trivial][USER] +5CFA5CF9 FAF9 [Trivial][USER] +5CFA5CFA FAFA [Trivial][USER] +5CFA5CFC FAFC [Trivial][USER] +5CFA5CFD FAFD [Trivial][USER] +5CFA5CFE FAFE [Trivial][USER] +5CFA5CFF FAFF [Trivial][USER] +5CFC5C00 FC00 [Trivial][USER] +5CFC5C08 FC08 [Trivial][USER] +5CFC5C09 FC09 [Trivial][USER] +5CFC5C0A FC0A [Trivial][USER] +5CFC5C0D FC0D [Trivial][USER] +5CFC5C1A FC1A [Trivial][USER] +5CFC5C22 FC22 [Trivial][USER] +5CFC5C25 FC5C25 [Regular] +5CFC5C27 FC27 [Trivial][USER] +5CFC5C30 FC00 [Regular] +5CFC5C3F FC3F [Trivial][USER] +5CFC5C40 FC40 [Trivial][USER] +5CFC5C5A FC1A [Regular] +5CFC5C5C FC5C [Regular][USER] +5CFC5C5F FC5C5F [Regular] +5CFC5C61 FC61 [Trivial][USER] +5CFC5C62 FC08 [Regular][USER] +5CFC5C6E FC0A [Regular] +5CFC5C72 FC0D [Regular] +5CFC5C74 FC09 [Regular] +5CFC5C7E FC7E [Trivial][USER] +5CFC5C7F FC7F [Trivial][USER] +5CFC5C80 FC80 [Trivial][USER] +5CFC5C81 FC81 [Trivial][USER] +5CFC5C9F FC9F [Trivial][USER] +5CFC5CA0 FCA0 [Trivial][USER] +5CFC5CA1 FCA1 [Trivial][USER] +5CFC5CE0 FCE0 [Trivial][USER] +5CFC5CEF FCEF [Trivial][USER] +5CFC5CF9 FCF9 [Trivial][USER] +5CFC5CFA FCFA [Trivial][USER] +5CFC5CFC FCFC [Trivial][USER] +5CFC5CFD FCFD [Trivial][USER] +5CFC5CFE FCFE [Trivial][USER] +5CFC5CFF FCFF [Trivial][USER] +5CFD5C00 FD00 [Trivial][USER] +5CFD5C08 FD08 [Trivial][USER] +5CFD5C09 FD09 [Trivial][USER] +5CFD5C0A FD0A [Trivial][USER] +5CFD5C0D FD0D [Trivial][USER] +5CFD5C1A FD1A [Trivial][USER] +5CFD5C22 FD22 [Trivial][USER] +5CFD5C25 FD5C25 [Regular] +5CFD5C27 FD27 [Trivial][USER] +5CFD5C30 FD00 [Regular] +5CFD5C3F FD3F [Trivial][USER] +5CFD5C40 FD40 [Trivial][USER] +5CFD5C5A FD1A [Regular] +5CFD5C5C FD5C [Regular][USER] +5CFD5C5F FD5C5F [Regular] +5CFD5C61 FD61 [Trivial][USER] +5CFD5C62 FD08 [Regular][USER] +5CFD5C6E FD0A [Regular] +5CFD5C72 FD0D [Regular] +5CFD5C74 FD09 [Regular] +5CFD5C7E FD7E [Trivial][USER] +5CFD5C7F FD7F [Trivial][USER] +5CFD5C80 FD80 [Trivial][USER] +5CFD5C81 FD81 [Trivial][USER] +5CFD5C9F FD9F [Trivial][USER] +5CFD5CA0 FDA0 [Trivial][USER] +5CFD5CA1 FDA1 [Trivial][USER] +5CFD5CE0 FDE0 [Trivial][USER] +5CFD5CEF FDEF [Trivial][USER] +5CFD5CF9 FDF9 [Trivial][USER] +5CFD5CFA FDFA [Trivial][USER] +5CFD5CFC FDFC [Trivial][USER] +5CFD5CFD FDFD [Trivial][USER] +5CFD5CFE FDFE [Trivial][USER] +5CFD5CFF FDFF [Trivial][USER] +5CFE5C00 FE00 [Trivial][USER] +5CFE5C08 FE08 [Trivial][USER] +5CFE5C09 FE09 [Trivial][USER] +5CFE5C0A FE0A [Trivial][USER] +5CFE5C0D FE0D [Trivial][USER] +5CFE5C1A FE1A [Trivial][USER] +5CFE5C22 FE22 [Trivial][USER] +5CFE5C25 FE5C25 [Regular] +5CFE5C27 FE27 [Trivial][USER] +5CFE5C30 FE00 [Regular] +5CFE5C3F FE3F [Trivial][USER] +5CFE5C40 FE40 [Trivial][USER] +5CFE5C5A FE1A [Regular] +5CFE5C5C FE5C [Regular][USER] +5CFE5C5F FE5C5F [Regular] +5CFE5C61 FE61 [Trivial][USER] +5CFE5C62 FE08 [Regular][USER] +5CFE5C6E FE0A [Regular] +5CFE5C72 FE0D [Regular] +5CFE5C74 FE09 [Regular] +5CFE5C7E FE7E [Trivial][USER] +5CFE5C7F FE7F [Trivial][USER] +5CFE5C80 FE80 [Trivial][USER] +5CFE5C81 FE81 [Trivial][USER] +5CFE5C9F FE9F [Trivial][USER] +5CFE5CA0 FEA0 [Trivial][USER] +5CFE5CA1 FEA1 [Trivial][USER] +5CFE5CE0 FEE0 [Trivial][USER] +5CFE5CEF FEEF [Trivial][USER] +5CFE5CF9 FEF9 [Trivial][USER] +5CFE5CFA FEFA [Trivial][USER] +5CFE5CFC FEFC [Trivial][USER] +5CFE5CFD FEFD [Trivial][USER] +5CFE5CFE FEFE [Trivial][USER] +5CFE5CFF FEFF [Trivial][USER] +5CFF5C00 FF00 [Trivial][USER] +5CFF5C08 FF08 [Trivial][USER] +5CFF5C09 FF09 [Trivial][USER] +5CFF5C0A FF0A [Trivial][USER] +5CFF5C0D FF0D [Trivial][USER] +5CFF5C1A FF1A [Trivial][USER] +5CFF5C22 FF22 [Trivial][USER] +5CFF5C25 FF5C25 [Regular] +5CFF5C27 FF27 [Trivial][USER] +5CFF5C30 FF00 [Regular] +5CFF5C3F FF3F [Trivial][USER] +5CFF5C40 FF40 [Trivial][USER] +5CFF5C5A FF1A [Regular] +5CFF5C5C FF5C [Regular][USER] +5CFF5C5F FF5C5F [Regular] +5CFF5C61 FF61 [Trivial][USER] +5CFF5C62 FF08 [Regular][USER] +5CFF5C6E FF0A [Regular] +5CFF5C72 FF0D [Regular] +5CFF5C74 FF09 [Regular] +5CFF5C7E FF7E [Trivial][USER] +5CFF5C7F FF7F [Trivial][USER] +5CFF5C80 FF80 [Trivial][USER] +5CFF5C81 FF81 [Trivial][USER] +5CFF5C9F FF9F [Trivial][USER] +5CFF5CA0 FFA0 [Trivial][USER] +5CFF5CA1 FFA1 [Trivial][USER] +5CFF5CE0 FFE0 [Trivial][USER] +5CFF5CEF FFEF [Trivial][USER] +5CFF5CF9 FFF9 [Trivial][USER] +5CFF5CFA FFFA [Trivial][USER] +5CFF5CFC FFFC [Trivial][USER] +5CFF5CFD FFFD [Trivial][USER] +5CFF5CFE FFFE [Trivial][USER] +5CFF5CFF FFFF [Trivial][USER] +DROP TABLE t1; +DROP PROCEDURE p1; +DROP PROCEDURE p2; +DROP FUNCTION unescape; +DROP FUNCTION unescape_type; +DROP FUNCTION wellformedness; +DROP FUNCTION mysql_real_escape_string_generated; +DROP FUNCTION iswellformed; +DROP TABLE allbytes; +SET sql_mode = DEFAULT; +# End of ctype_backslash.inc +SET NAMES latin1; +# +# MDEV-7149 Constant condition propagation erroneously applied for LIKE +# +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE CONCAT(c1)='a'; +c1 +a +a +SELECT * FROM t1 WHERE CONCAT(c1) LIKE 'a '; +c1 +a +SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE 'a'=CONCAT(c1); +c1 +a +a +SELECT * FROM t1 WHERE 'a ' LIKE CONCAT(c1); +c1 +a +SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '% '=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '%'=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +# +# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' +# +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; +a LENGTH(a) +a 1 +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +a LENGTH(a) +a 1 +EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a ' +DROP TABLE t1; +# +# End of MDEV-8694 +# +SET NAMES latin1 COLLATE latin1_bin; +# +# MDEV-7149 Constant condition propagation erroneously applied for LIKE +# +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE CONCAT(c1)='a'; +c1 +a +a +SELECT * FROM t1 WHERE CONCAT(c1) LIKE 'a '; +c1 +a +SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE 'a'=CONCAT(c1); +c1 +a +a +SELECT * FROM t1 WHERE 'a ' LIKE CONCAT(c1); +c1 +a +SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '% '=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '%'=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +# +# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' +# +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; +a LENGTH(a) +a 1 +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +a LENGTH(a) +a 1 +EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a ' +DROP TABLE t1; +# +# End of MDEV-8694 +# +# +# MDEV-6752 Trailing incomplete characters are not replaced to question marks on conversion +# +SET NAMES utf8, character_set_connection=latin1; +SELECT '�'; +? +? +SELECT HEX('�'); +HEX('�') +3F +SELECT HEX(CAST('�' AS CHAR CHARACTER SET utf8)); +HEX(CAST('�' AS CHAR CHARACTER SET utf8)) +3F +SELECT HEX(CAST('�' AS CHAR CHARACTER SET latin1)); +HEX(CAST('�' AS CHAR CHARACTER SET latin1)) +3F +SELECT HEX(CONVERT('�' USING utf8)); +HEX(CONVERT('�' USING utf8)) +3F +SELECT HEX(CONVERT('�' USING latin1)); +HEX(CONVERT('�' USING latin1)) +3F +SELECT '�x'; +?x +?x +SELECT HEX('�x'); +HEX('�x') +3F78 +SELECT HEX(CAST('�x' AS CHAR CHARACTER SET utf8)); +HEX(CAST('�x' AS CHAR CHARACTER SET utf8)) +3F78 +SELECT HEX(CAST('�x' AS CHAR CHARACTER SET latin1)); +HEX(CAST('�x' AS CHAR CHARACTER SET latin1)) +3F78 +SELECT HEX(CONVERT('�x' USING utf8)); +HEX(CONVERT('�x' USING utf8)) +3F78 +SELECT HEX(CONVERT('�x' USING latin1)); +HEX(CONVERT('�x' USING latin1)) +3F78 +SET NAMES utf8; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1); +INSERT IGNORE INTO t1 VALUES ('�'),('�#'); +Warnings: +Warning 1366 Incorrect string value: '\xC2' for column `test`.`t1`.`a` at row 1 +Warning 1366 Incorrect string value: '\xC2#' for column `test`.`t1`.`a` at row 2 +SHOW WARNINGS; +Level Code Message +Warning 1366 Incorrect string value: '\xC2' for column `test`.`t1`.`a` at row 1 +Warning 1366 Incorrect string value: '\xC2#' for column `test`.`t1`.`a` at row 2 +SELECT HEX(a),a FROM t1; +HEX(a) a +3F ? +3F23 ?# +DROP TABLE t1; +# +# MDEV-7629 Regression: Bit and hex string literals changed column names in 10.0.14 +# +SELECT _latin1 0x7E, _latin1 X'7E', _latin1 B'01111110'; +_latin1 0x7E _latin1 X'7E' _latin1 B'01111110' +~ ~ ~ +# +# MDEV-9886 Illegal mix of collations with a view comparing a field to a binary constant +# +SET NAMES latin1; +CREATE TABLE t1 (a TEXT CHARACTER SET latin1); +INSERT INTO t1 VALUES (0xC0); +SELECT a<>0xEE5D AS a FROM t1; +a +1 +CREATE VIEW v1 AS SELECT a<>0xC0 AS a FROM t1; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` <> 0xc0 AS `a` from `t1` latin1 latin1_swedish_ci +SELECT * FROM v1; +a +0 +DROP VIEW v1; +DROP TABLE t1; +SET NAMES latin1; +# +# MDEV-13118 Wrong results with LOWER and UPPER and subquery +# +SET @save_optimizer_switch=@@optimizer_switch; +SET optimizer_switch=_latin1'derived_merge=on'; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `t` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI'); +SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub; +c2 +abcdefghi-abcdefghi +abcdefghi-abcdefghi +SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT UPPER(t) t2 FROM t1) sub; +c2 +ABCDEFGHI-ABCDEFGHI +ABCDEFGHI-ABCDEFGHI +DROP TABLE t1; +SET optimizer_switch=@save_optimizer_switch; +# +# MDEV-17298 ASAN unknown-crash / READ of size 1 in my_strntoul_8bit upon INSERT .. SELECT +# +SET NAMES latin1; +CREATE TABLE t1 (a CHAR); +CREATE TABLE t2 (b ENUM('foo','bar')); +INSERT INTO t1 VALUES ('1'); +INSERT INTO t2 SELECT * FROM t1; +DROP TABLE t1, t2; +# +# End of 10.0 tests +# +# +# Start of 10.1 tests +# +# +# MDEV-8661 Wrong result for SELECT..WHERE a='a' AND a='a' COLLATE latin1_bin +# +SET NAMES latin1; +CREATE TABLE t1 (a CHAR(10)); +INSERT INTO t1 VALUES ('a'),('A'); +SELECT * FROM t1 WHERE a='a' AND a='a' COLLATE latin1_bin; +a +a +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci); +INSERT INTO t1 VALUES ('a'),('A'); +SELECT * FROM t1 WHERE a='a' COLLATE latin1_bin AND a='A' COLLATE latin1_swedish_ci; +a +a +DROP TABLE t1; +# +# MDEV-8679 Equal field propagation is not used for VARCHAR when it safely could +# +CREATE TABLE t1 (a VARCHAR(10)); +INSERT INTO t1 VALUES ('10'),('11'),('12'); +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='10' AND IF(a='10',1,0)=1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '10' +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='10' AND CASE WHEN a='10' THEN 1 ELSE 0 END; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '10' +DROP TABLE t1; +# +# MDEV-8680 Wrong result for SELECT..WHERE a IN ('a' COLLATE latin1_bin,'b') AND a='a' +# +SET NAMES latin1; +CREATE TABLE t1 (a VARCHAR(10)); +INSERT INTO t1 VALUES ('a'),('A'); +SELECT * FROM t1 WHERE a IN ('a' COLLATE latin1_bin,'b'); +a +a +SELECT * FROM t1 WHERE a IN ('a' COLLATE latin1_bin,'b') AND a='a'; +a +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN ('a' COLLATE latin1_bin,'b') AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` in (<cache>('a' collate latin1_bin),'b') +DROP TABLE t1; +# +# MDEV-8698 Wrong result for SELECT..WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin; +# +SET NAMES latin1; +CREATE TABLE t1 (a VARCHAR(10)); +INSERT INTO t1 VALUES ('a'),('A'),('b'),('B'),('c'),('C'); +SELECT * FROM t1 WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin; +a +a +b +c +SELECT * FROM t1 WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin AND a='a'; +a +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 6 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` between 'a' and <cache>('c' collate latin1_bin) +DROP TABLE t1; +# +# MDEV-8707 Wrong result for SELECT..WHERE varchar_column=DATE'2001-01-01' AND varchar_column='2001-01-01' +# +SET NAMES latin1; +CREATE TABLE t1 (a VARCHAR(40)); +INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-01x'); +SELECT * FROM t1 WHERE a=DATE'2001-01-01' AND a='2001-01-01'; +a +2001-01-01 +SELECT * FROM t1 WHERE a='2001-01-01' AND a=DATE'2001-01-01'; +a +2001-01-01 +SELECT * FROM t1 WHERE (a,a)=('2001-01-01x',DATE'2001-01-01'); +a +2001-01-01x +Warnings: +Warning 1292 Truncated incorrect date value: '2001-01-01x' +SELECT * FROM t1 WHERE (a,a)=(DATE'2001-01-01','2001-01-01x'); +a +2001-01-01x +Warnings: +Warning 1292 Truncated incorrect date value: '2001-01-01x' +SELECT * FROM t1 WHERE (a,a)=('2001-01-01',DATE'2001-01-01'); +a +2001-01-01 +SELECT * FROM t1 WHERE (a,a)=(DATE'2001-01-01','2001-01-01'); +a +2001-01-01 +DROP TABLE t1; +CREATE TABLE t1 (a ENUM('2001-01-01','2001-01-01x')); +INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-01x'); +SELECT * FROM t1 WHERE a=DATE'2001-01-01' AND a='2001-01-01'; +a +2001-01-01 +SELECT * FROM t1 WHERE a='2001-01-01' AND a=DATE'2001-01-01'; +a +2001-01-01 +SELECT * FROM t1 WHERE (a,a)=('2001-01-01x',DATE'2001-01-01'); +a +2001-01-01x +Warnings: +Warning 1292 Truncated incorrect date value: '2001-01-01x' +SELECT * FROM t1 WHERE (a,a)=(DATE'2001-01-01','2001-01-01x'); +a +2001-01-01x +Warnings: +Warning 1292 Truncated incorrect date value: '2001-01-01x' +SELECT * FROM t1 WHERE (a,a)=('2001-01-01',DATE'2001-01-01'); +a +2001-01-01 +SELECT * FROM t1 WHERE (a,a)=(DATE'2001-01-01','2001-01-01'); +a +2001-01-01 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(40),b VARCHAR(40)); +INSERT INTO t1 VALUES ('2001-01-01','2001-01-01x'); +SELECT * FROM t1 WHERE a=b AND a=DATE'2001-01-01'; +a b +DROP TABLE t1; +CREATE TABLE t1 (a ENUM('2001-01-01','2001-01-01x'),b ENUM('2001-01-01','2001-01-01x')); +INSERT INTO t1 VALUES ('2001-01-01','2001-01-01x'); +SELECT * FROM t1 WHERE a=b AND a=DATE'2001-01-01'; +a b +DROP TABLE t1; +# +# MDEV-8695 Wrong result for SELECT..WHERE varchar_column='a' AND CRC32(varchar_column)=3904355907 +# +CREATE TABLE t1 (a VARCHAR(10) COLLATE latin1_bin); +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE CRC32(a)=3904355907; +a LENGTH(a) CRC32(a) +a 1 3904355907 +SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE a='a' AND CRC32(a)=3904355907; +a LENGTH(a) CRC32(a) +a 1 3904355907 +# 'a' should not be propagated into CRC32(a) +EXPLAIN EXTENDED SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE a='a' AND CRC32(a)=3904355907; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)`,crc32(`test`.`t1`.`a`) AS `CRC32(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and crc32(`test`.`t1`.`a`) = 3904355907 +SELECT a, HEX(a) FROM t1 WHERE HEX(a)='61'; +a HEX(a) +a 61 +SELECT *,HEX(a) FROM t1 WHERE a='a' AND HEX(a)='61'; +a HEX(a) +a 61 +# 'a' should not be propagated into HEX(a) +EXPLAIN EXTENDED SELECT *,HEX(a) FROM t1 WHERE a='a' AND HEX(a)='61'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,hex(`test`.`t1`.`a`) AS `HEX(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and hex(`test`.`t1`.`a`) = '61' +SELECT * FROM t1 WHERE a='a'; +a +a +a +SELECT * FROM t1 WHERE LENGTH(a)=2; +a +a +SELECT * FROM t1 WHERE a='a' AND LENGTH(a)=2; +a +a +# 'a' should not be propagated into LENGTH(a) +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND LENGTH(a)=2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' and octet_length(`test`.`t1`.`a`) = 2 +DROP TABLE t1; +# +# MDEV-8712 Wrong result for SELECT..WHERE latin1_bin_column=_latin1'a' AND latin1_bin_column='A' +# +SET NAMES latin1; +CREATE TABLE t1 (a VARCHAR(20) COLLATE latin1_bin); +INSERT INTO t1 VALUES ('a'),('b'); +SELECT * FROM t1 WHERE a='A'; +a +SELECT * FROM t1 WHERE a='A' AND a=_latin1'a'; +a +SELECT * FROM t1 WHERE a=_latin1'a' AND a='A'; +a +SELECT * FROM t1 WHERE a=_latin1'A'; +a +SELECT * FROM t1 WHERE a=_latin1'A' AND a=_latin1'a'; +a +SELECT * FROM t1 WHERE a=_latin1'a' AND a=_latin1'A'; +a +DROP TABLE t1; +# +# MDEV-8253 EXPLAIN SELECT prints unexpected characters +# +SET NAMES latin1; +CREATE TABLE t1 (a DECIMAL(10,1),b DECIMAL(10,1),c VARCHAR(10),d VARCHAR(10)); +INSERT INTO t1 VALUES (1.5,1.5,'1','1'),(3.5,3.5,'3','3'); +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE COALESCE(c,0)='3 ' AND COALESCE(d,0)=COALESCE(c,0); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` where coalesce(`test`.`t1`.`c`,0) = '3 ' and coalesce(`test`.`t1`.`d`,0) = '3 ' +DROP TABLE t1; +# +# MDEV-15005 ASAN: stack-buffer-overflow in my_strnncollsp_simple +# +SET NAMES latin1; +SELECT CONVERT(1, CHAR) IN ('100', 10, '101'); +CONVERT(1, CHAR) IN ('100', 10, '101') +0 +SELECT CONVERT(1, CHAR) IN ('100', 10, '1'); +CONVERT(1, CHAR) IN ('100', 10, '1') +1 +SELECT CONVERT(1, CHAR) IN ('100', '10', '1'); +CONVERT(1, CHAR) IN ('100', '10', '1') +1 +# +# End of 10.1 tests +# +# +# Start of 10.2 tests +# +# +# MDEV-9711 NO PAD Collatons +# +SET character_set_connection=latin1; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin1_swedish_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE latin1_swedish_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin1_swedish_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_swedish_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin1_swedish_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'latin1_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'latin1_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_swedish_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin1_swedish_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin1_swedish_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE latin1_swedish_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin1_swedish_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_swedish_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin1_swedish_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +41000000000000000000 +41202000000000000000 +20410000000000000000 +20412000000000000000 +41202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'latin1_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'latin1_swedish_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'latin1_swedish_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'latin1_swedish_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_swedish_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin1_swedish_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_swedish_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin1_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE latin1_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin1_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin1_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'latin1_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'latin1_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'latin1_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'latin1_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'latin1_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'latin1_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin1_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'latin1_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE latin1_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'latin1_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'latin1_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'latin1_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'latin1_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'latin1_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'latin1_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'latin1_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'latin1_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'latin1_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'latin1_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'latin1_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'latin1_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET NAMES latin1; +# +# MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results +# +CREATE OR REPLACE TABLE t1 AS SELECT SPACE(50) AS a, SPACE (50) AS b; +ALTER TABLE t1 ADD KEY(a), ADD KEY(b); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(50) DEFAULT NULL, + `b` varchar(50) DEFAULT NULL, + KEY `a` (`a`), + KEY `b` (`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('111', '111'); +INSERT INTO t1 VALUES ('222', '222'); +INSERT INTO t1 VALUES ('333', '333'); +INSERT INTO t1 VALUES ('444', '444'); +SELECT * FROM t1 WHERE a LIKE '111%'; +a b +111 111 +SELECT * FROM t1 IGNORE INDEX (a) WHERE a LIKE '111%'; +a b +111 111 +DROP TABLE t1; +# +# End of 10.2 tests +# diff --cc mysql-test/main/ctype_tis620.result index cf66c81c647,00000000000..9650c366d38 mode 100644,000000..100644 --- a/mysql-test/main/ctype_tis620.result +++ b/mysql-test/main/ctype_tis620.result @@@ -1,4413 -1,0 +1,4425 @@@ +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 CHARACTER SET tis620; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `recid` int(11) NOT NULL AUTO_INCREMENT, + `dyninfo` text DEFAULT NULL, + 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 +(IF( LOCATE( 'year=\"', dyninfo ) = 1, +SUBSTRING( dyninfo, 6+1, LOCATE('\"\r',dyninfo) - 6 -1), +IF( LOCATE( '\nyear=\"', dyninfo ), +SUBSTRING( dyninfo, LOCATE( '\nyear=\"', dyninfo ) + 7, +LOCATE( '\"\r', SUBSTRING( dyninfo, LOCATE( '\nyear=\"', dyninfo ) +7 )) - 1), '' ))) AS year +FROM t1 +HAVING year != '' ORDER BY year; +year +DROP TABLE t1; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.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),('�ѷ��ѧ��',1 506,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,1 577),('�ҹ�',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 KU NG 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),('ǹѪ��',17 53,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),('�����ٹ���',2 140,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),('��ջ���',1 972,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),('����س�',21 84,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),('ʧǹ',206 0,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),('�����ó�',2 338,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,3 20),('�ѹ�������',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),('����Թ���',51 4,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),('��ԡ�',47 1,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,1 028),('���ҵ',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),('�ij�',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,139 0),('�Ѫ�',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) +����� +���ت +���ѡɳ� +�� +��Թ +��� +����ѡ��� +����� +���� +������ +���ѵ +������ +���� +���� +����� +���ѵ�� +���Է��� +����ó +��Ҿ� +���� +����ó +������ +��������ó +��� +��Ҿ� +����ط�� +�����ó +��Թ�� +�ê�� +�þ� +���ѷ�� +��� +��Թ���പ +��Թ��� +���� +���ɰ +��� +���� +��õ�� +�ij� +�Ĵ� +�ķ��� +���� +���ҳ +�ž�ó +�ǡó� +�Ǿ� +���ѵ�� +��Ũѹ��� +��ũ�� +��ž� +������� +�ѭ��� +�ѯ�� +�ѱ�� +�ѷ��� +�ѷ��� +�ѹ��� +�ѹ���� +�ѹ��� +�ѹ��� +�ѹ��� +�ѹ��� +�ѹ���� +�ѹ��ѵ�� +�ѹ�ǧ�� +�ѹ���ó +�ѹ��ѡ��� +�ѹ�� +�ѹ�ԡҹ�� +�ѹ���� +��¹� +�ү�ǧ +�ҵ�� +��� +���Թ��� +���� +�����ѵ�� +���Թ� +��ӷԾ�� +��ӽ� +�Ӿ� +���ྪ� +����ѹ����ꡫ� +������� ��������� +������� +�ԡ�� +�Ԥ� +�Ԫêվ +���� +�Դ +�Դ� +�Ե�� +�Ե�� +�Ե� +�ԵԾ��� +�Ե��� +�Է�� +�Է�ȹ��� +�Է�ȹ� +�Ը�Ǵ� +�Ի�ྐྵ��(�������) +�Ծ��� +�Ծ� +�Ծѷ�� +�Ծѹ +���� +���� +����� +���ѹ�� +������ó� +���ب�� +���ص�� +����� +���غ� +���ź� +���ૹ�������鹵����� ᾤࡨ��� +���Ѳ�� +���ѵ�� +���ѵ� +���ҵ +����� +���Ҫ� +���Ҿ� +���� +�յ� +�ت��Թ��� +�ت�Ҷ +�ت�� +�ت�� +����� +��ʺ� +����� +ô�� +����ѵ�� +���� +�����ѵ�� +��� �Թ��� ������� +��è� +��è� +����Դ +���§ +������ +�����õ +��ê�� +�ѧ�� +�ѭ�� +�ѭ�ѵ� +�ѳ�Ե +�ѳ�Ե�� +�ѵá�ا�� +�ѵá�ا�����ظ�� +�ѹ����ѡ��� +�ҧ�͡�շ��緷�� +�ҹ���� +���ا�� +��ǵ��ᾤ +�� ��� ������ê�� �ӡѴ +�� ��� �� ����ʡ�� +��.���.������� +��.���.��.���硡�����ҧ +�ح���õ� +�ح�� +�ح���� +�ح��� +�ح�غ +�ح�Դ +�ح�� +�ح��Ѿ�� +�ح��� +�ح�ͧ +�ح���� +�ح����Է��� +�ح���� +�ح�� +�ح�ѧ +�ح������ +�ح���� +�ح�ѡ +�ح�Ѻ +�ح��� +�ح���� +�ح��� +�ح���� �����ͻ����� +�ح�� +�حʹͧ +�ح�Թ +�ح� +�ح�آ +�ح�ʧ +�س�Ե +�ػ�� +���ѭ��� +���Թ��� +����� +����Ҿ� +����Թ��� +��ɡ� +��ɺ� +����� +������ó� +������ +����� (�������) +���������ῤ������� (�������) +ອ��� +ອ��� +ອ��ѡɳ� ���鹵�� +ອ���ó +����ó +������ �ſ� +��ó� +����� +��ԭ�� +��Ծ� +����� +����Ѳ�� +����� +��Դ� +��Ե� +���� +������ +����� +��Ѵ�� +������ +��ҳ� +���Ǵ� +�����Թ�� +����� +��ص� +��Сͺ +��С�� +��С��Ե +��СԨ +��СԵ +��Фͧ +��Ш��Ե +��ШǺ +��Шѡ�� +��ШԵ� +��Ъ� +��ЪԵ +��Ъ���� +��г� +��д�ɰ� +��зѺ� +��зջ +��з���Ծ�� +�����ͧ +��о��� +��о��� +��оķ��� +��оѲ�� +��оѹ�� +���� +������ +�������� +�������Ҿ� +�������� +����Ҿ� +����Ҿ�ó +������ó� +������ +������ +�����¾� +������ +���§�� +����Թ +����ط� +������ +��������� +����ª�� +����ѵ� +����ѵ� +����Ե� +����Է +����Է�� +����ճ� +������ +���ʧ�� +����ҷ +����ҹ +������ +����Է��� +���� +������ +��Ѫ�� +��ҡ�� +��ҧ�� +��Ҫ�� +��ҳ� +��ҳ��� +�������� +���ö�� +��ԭ�� +��ԭ�� +��ԭ�� +��Գ�� +��Է�� +��Թ�� +�������ó +���ȹ� +���ȹ� +��ժ� +��խ� +������ó� +��ճ�Ѫ +��ճ� +��ѹ�� +��ѹ�� +�ͧ�� +�ѭ������� +�ѭ�� +�ѭ�Ҿ� +�ѭ�Ҿ� +�ѳ��� +�ѷ� +�ѷ�� +�ѷ��Ǵ� +�ҳ���� +�ҹ +�ҹྪ� +���Ԫҵ +���Ԫҵ� +���Ծѹ�� +���ճ� +��˹ѹ +�Ե� +�Ե��Ѫ�� +������ +����� +��¡ҭ��� +��¹ѹ�� +��¹ү +��¾��� +��¾��� +��¾� +������ó� +����ѵ�� +�����ó +����Ѳ�� +����ѡ��� +���� +���Ъ�� +���й��� +���йѹ�� +���йت +���о��� +���о� +���оѹ�� +���оѹ��� +������� +�����ѡ��� +���Ҿ� +���ѹ�� +�س��� +������Կ +��� +�������� +���Ĵ� +������ +����Է��� +������آ +�Ź���Կ +��ҡ�ͧ +��Ҿ�ó +�� +����Ե�� +��ا�ѡ��� +���� +��ͧ��ó +��ͧ��� +������� +��Ң�˹٪Թ�Χ +��Ң�˹٫Թ�Χ +��Ңع˹٫Թ�Χ +��ҹ��� ��繨������� +���¡�ä�ѧ�ͧ��ҧ�ӹѡ��Ѵ��ا��ҹ�� +���آ +��ʴ� +���༴� +����˭���� +༴� +�ԧ +伷 +���¡�ä�ѧ�ͧ��ҧ �ӹѡ��Ѵ��ا��ҹ�� +�������õ� +������ +���� +��ȸ� +����ѹ�� +����ԾѲ�� +�����Ѥ +��������� +���� +����� +�����ѡ��� +�����ѹ�� +����ѹ�� +���� +����ö +������ +���� +���ҹ +������� +��� +������ +����ѹ�� +��Դ� +�¹�� +��ا +�� +�á�� +�èԵ�� +�ê�� +�÷Ծ�� +�÷Ծ� +�÷��� +�� +�ù�� +�ù�� +�ùԵԿ��������մ��� +�þ��� +�þ�� +�þ�ó +�þ� +�þ��§�� +�þ��� +�þ��� +���� +��������������� +��ó���� +��ó���� +��ó����Ǵ� +��ó���� +��ó���� +��ó��³� +��ó�ó� +��óԡ� +��ó� +��øԴ� +������ +������ +���ѡ��� +������ +����ǧ +�����ä� +�����Ѳ�� +�������� +��л��ᴧ ���Ҥ����� �ӡѴ +��л��ᴧ ���Ҥ����� +������ 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; +SET collation_connection='tis620_thai_ci'; +create table t1 select repeat('a',4000) a; +delete from t1; +insert into t1 values ('a'), ('a '), ('a\t'); +select collation(a),hex(a) from t1 order by a; +collation(a) hex(a) +tis620_thai_ci 6109 +tis620_thai_ci 61 +tis620_thai_ci 6120 +drop table t1; +# +# MDEV-5453 Assertion `src' fails in my_strnxfrm_unicode on GROUP BY MID(..) WITH ROLLUP +# +SELECT @@collation_connection; +@@collation_connection +tis620_thai_ci +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +SELECT * FROM t1 GROUP BY MID(CURRENT_USER,0) WITH ROLLUP; +i +1 +1 +SELECT * FROM t1 GROUP BY MID('test',0) WITH ROLLUP; +i +1 +1 +DROP TABLE t1; +# +# MDEV-6170 Incorrect ordering with utf8_bin and utf8mb4_bin collations +# +SELECT @@collation_connection; +@@collation_connection +tis620_thai_ci +CREATE TABLE t1 ENGINE=MEMORY AS SELECT REPEAT('a',5) AS a LIMIT 0; +INSERT INTO t1 (a) VALUES ("a"); +INSERT INTO t1 (a) VALUES ("b"); +INSERT INTO t1 (a) VALUES ("c"); +INSERT INTO t1 (a) VALUES ("d"); +INSERT INTO t1 (a) VALUES ("e"); +INSERT INTO t1 (a) VALUES ("f"); +INSERT INTO t1 (a) VALUES ("g"); +INSERT INTO t1 (a) VALUES ("h"); +INSERT INTO t1 (a) VALUES ("i"); +INSERT INTO t1 (a) VALUES ("j"); +INSERT INTO t1 (a) VALUES ("k"); +INSERT INTO t1 (a) VALUES ("l"); +INSERT INTO t1 (a) VALUES ("m"); +SELECT * FROM t1 ORDER BY LOWER(a); +a +a +b +c +d +e +f +g +h +i +j +k +l +m +SELECT * FROM t1 ORDER BY LOWER(a) DESC; +a +m +l +k +j +i +h +g +f +e +d +c +b +a +DROP TABLE t1; +select @@collation_connection; +@@collation_connection +tis620_thai_ci +create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ; +insert into t1 values('abcdef'); +insert into t1 values('_bcdef'); +insert into t1 values('a_cdef'); +insert into t1 values('ab_def'); +insert into t1 values('abc_ef'); +insert into t1 values('abcd_f'); +insert into t1 values('abcde_'); +select c1 as c1u from t1 where c1 like 'ab\_def'; +c1u +ab_def +select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; +c2h +ab_def +drop table t1; ++SELECT @@collation_connection; ++@@collation_connection ++tis620_thai_ci ++SELECT '\%b' LIKE '%\%'; ++'\%b' LIKE '%\%' ++0 +drop table if exists t1; +create table t1 select repeat('a',10) as c1; +delete from t1; +insert into t1 values (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27),(0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F); +insert into t1 values (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37),(0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F); +insert into t1 values (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47),(0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F); +insert into t1 values (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57),(0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F); +insert into t1 values (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67),(0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F); +insert into t1 values (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77),(0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F); +SELECT GROUP_CONCAT(c1 ORDER BY binary c1 SEPARATOR ''), GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) FROM t1 GROUP BY c1; +GROUP_CONCAT(c1 ORDER BY binary c1 SEPARATOR '') GROUP_CONCAT(hex(c1) ORDER BY BINARY c1) + 20 +! 21 +" 22 +# 23 +$ 24 +% 25 +& 26 +' 27 +( 28 +) 29 +* 2A ++ 2B +, 2C +- 2D +. 2E +/ 2F +0 30 +1 31 +2 32 +3 33 +4 34 +5 35 +6 36 +7 37 +8 38 +9 39 +: 3A +; 3B +< 3C += 3D +> 3E +? 3F +@ 40 +[ 5B +\ 5C +] 5D +^ 5E +_ 5F +` 60 +Aa 41,61 +Bb 42,62 +Cc 43,63 +Dd 44,64 +Ee 45,65 +Ff 46,66 +Gg 47,67 +Hh 48,68 +Ii 49,69 +Jj 4A,6A +Kk 4B,6B +Ll 4C,6C +Mm 4D,6D +Nn 4E,6E +Oo 4F,6F +Pp 50,70 +Qq 51,71 +Rr 52,72 +Ss 53,73 +Tt 54,74 +Uu 55,75 +Vv 56,76 +Ww 57,77 +Xx 58,78 +Yy 59,79 +Zz 5A,7A +{ 7B +| 7C +} 7D +~ 7E + 7F +drop table t1; +# +# MDEV-7149 Constant condition propagation erroneously applied for LIKE +# +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET tis620 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE CONCAT(c1)='a'; +c1 +a +a +SELECT * FROM t1 WHERE CONCAT(c1) LIKE 'a '; +c1 +a +SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET tis620 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE 'a'=CONCAT(c1); +c1 +a +a +SELECT * FROM t1 WHERE 'a ' LIKE CONCAT(c1); +c1 +a +SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET tis620 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '% '=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET tis620 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '%'=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +# +# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' +# +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET tis620 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; +a LENGTH(a) +a 1 +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +a LENGTH(a) +a 1 +EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a ' +DROP TABLE t1; +# +# End of MDEV-8694 +# +SET collation_connection='tis620_bin'; +create table t1 select repeat('a',4000) a; +delete from t1; +insert into t1 values ('a'), ('a '), ('a\t'); +select collation(a),hex(a) from t1 order by a; +collation(a) hex(a) +tis620_bin 6109 +tis620_bin 61 +tis620_bin 6120 +drop table t1; +# +# MDEV-5453 Assertion `src' fails in my_strnxfrm_unicode on GROUP BY MID(..) WITH ROLLUP +# +SELECT @@collation_connection; +@@collation_connection +tis620_bin +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +SELECT * FROM t1 GROUP BY MID(CURRENT_USER,0) WITH ROLLUP; +i +1 +1 +SELECT * FROM t1 GROUP BY MID('test',0) WITH ROLLUP; +i +1 +1 +DROP TABLE t1; +# +# MDEV-6170 Incorrect ordering with utf8_bin and utf8mb4_bin collations +# +SELECT @@collation_connection; +@@collation_connection +tis620_bin +CREATE TABLE t1 ENGINE=MEMORY AS SELECT REPEAT('a',5) AS a LIMIT 0; +INSERT INTO t1 (a) VALUES ("a"); +INSERT INTO t1 (a) VALUES ("b"); +INSERT INTO t1 (a) VALUES ("c"); +INSERT INTO t1 (a) VALUES ("d"); +INSERT INTO t1 (a) VALUES ("e"); +INSERT INTO t1 (a) VALUES ("f"); +INSERT INTO t1 (a) VALUES ("g"); +INSERT INTO t1 (a) VALUES ("h"); +INSERT INTO t1 (a) VALUES ("i"); +INSERT INTO t1 (a) VALUES ("j"); +INSERT INTO t1 (a) VALUES ("k"); +INSERT INTO t1 (a) VALUES ("l"); +INSERT INTO t1 (a) VALUES ("m"); +SELECT * FROM t1 ORDER BY LOWER(a); +a +a +b +c +d +e +f +g +h +i +j +k +l +m +SELECT * FROM t1 ORDER BY LOWER(a) DESC; +a +m +l +k +j +i +h +g +f +e +d +c +b +a +DROP TABLE t1; +select @@collation_connection; +@@collation_connection +tis620_bin +create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ; +insert into t1 values('abcdef'); +insert into t1 values('_bcdef'); +insert into t1 values('a_cdef'); +insert into t1 values('ab_def'); +insert into t1 values('abc_ef'); +insert into t1 values('abcd_f'); +insert into t1 values('abcde_'); +select c1 as c1u from t1 where c1 like 'ab\_def'; +c1u +ab_def +select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; +c2h +ab_def +drop table t1; ++SELECT @@collation_connection; ++@@collation_connection ++tis620_bin ++SELECT '\%b' LIKE '%\%'; ++'\%b' LIKE '%\%' ++0 +# +# MDEV-7149 Constant condition propagation erroneously applied for LIKE +# +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET tis620 COLLATE tis620_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE CONCAT(c1)='a'; +c1 +a +a +SELECT * FROM t1 WHERE CONCAT(c1) LIKE 'a '; +c1 +a +SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET tis620 COLLATE tis620_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE 'a'=CONCAT(c1); +c1 +a +a +SELECT * FROM t1 WHERE 'a ' LIKE CONCAT(c1); +c1 +a +SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET tis620 COLLATE tis620_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '% '=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET tis620 COLLATE tis620_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '%'=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +# +# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' +# +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET tis620 COLLATE tis620_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; +a LENGTH(a) +a 1 +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +a LENGTH(a) +a 1 +EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a ' +DROP TABLE t1; +# +# End of MDEV-8694 +# +# +# Start of 5.6 tests +# +# +# WL#3664 WEIGHT_STRING +# +set names tis620; +set collation_connection=tis620_thai_ci; +select @@collation_connection; +@@collation_connection +tis620_thai_ci +CREATE TABLE t1 AS SELECT 'a' AS a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1) CHARACTER SET tis620 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a)) FROM t1; +HEX(WEIGHT_STRING(a)) +61 +SELECT HEX(ws) FROM t2; +HEX(ws) +61 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(5) CHARACTER SET tis620 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a)) FROM t1; +HEX(WEIGHT_STRING(a)) +6161616161 +SELECT HEX(ws) FROM t2; +HEX(ws) +6161616161 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(12) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(3))) +616161 +SELECT HEX(ws) FROM t2; +HEX(ws) +616161 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(40) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61616161612020202020 +SELECT HEX(ws) FROM t2; +HEX(ws) +61616161612020202020 +DROP TABLE t2; +DROP TABLE t1; +select hex(weight_string('a')); +hex(weight_string('a')) +61 +select hex(weight_string('A')); +hex(weight_string('A')) +61 +select hex(weight_string('abc')); +hex(weight_string('abc')) +616263 +select hex(weight_string('abc' as char(2))); +hex(weight_string('abc' as char(2))) +6162 +select hex(weight_string('abc' as char(3))); +hex(weight_string('abc' as char(3))) +616263 +select hex(weight_string('abc' as char(5))); +hex(weight_string('abc' as char(5))) +6162632020 +select hex(weight_string('abc', 1, 2, 0xC0)); +hex(weight_string('abc', 1, 2, 0xC0)) +61 +select hex(weight_string('abc', 2, 2, 0xC0)); +hex(weight_string('abc', 2, 2, 0xC0)) +6162 +select hex(weight_string('abc', 3, 2, 0xC0)); +hex(weight_string('abc', 3, 2, 0xC0)) +616220 +select hex(weight_string('abc', 4, 2, 0xC0)); +hex(weight_string('abc', 4, 2, 0xC0)) +61622020 +select hex(weight_string('abc', 5, 2, 0xC0)); +hex(weight_string('abc', 5, 2, 0xC0)) +6162202020 +select hex(weight_string('abc',25, 2, 0xC0)); +hex(weight_string('abc',25, 2, 0xC0)) +61622020202020202020202020202020202020202020202020 +select hex(weight_string('abc', 1, 3, 0xC0)); +hex(weight_string('abc', 1, 3, 0xC0)) +61 +select hex(weight_string('abc', 2, 3, 0xC0)); +hex(weight_string('abc', 2, 3, 0xC0)) +6162 +select hex(weight_string('abc', 3, 3, 0xC0)); +hex(weight_string('abc', 3, 3, 0xC0)) +616263 +select hex(weight_string('abc', 4, 3, 0xC0)); +hex(weight_string('abc', 4, 3, 0xC0)) +61626320 +select hex(weight_string('abc', 5, 3, 0xC0)); +hex(weight_string('abc', 5, 3, 0xC0)) +6162632020 +select hex(weight_string('abc',25, 3, 0xC0)); +hex(weight_string('abc',25, 3, 0xC0)) +61626320202020202020202020202020202020202020202020 +select hex(weight_string('abc', 1, 4, 0xC0)); +hex(weight_string('abc', 1, 4, 0xC0)) +61 +select hex(weight_string('abc', 2, 4, 0xC0)); +hex(weight_string('abc', 2, 4, 0xC0)) +6162 +select hex(weight_string('abc', 3, 4, 0xC0)); +hex(weight_string('abc', 3, 4, 0xC0)) +616263 +select hex(weight_string('abc', 4, 4, 0xC0)); +hex(weight_string('abc', 4, 4, 0xC0)) +61626320 +select hex(weight_string('abc', 5, 4, 0xC0)); +hex(weight_string('abc', 5, 4, 0xC0)) +6162632020 +select hex(weight_string('abc',25, 4, 0xC0)); +hex(weight_string('abc',25, 4, 0xC0)) +61626320202020202020202020202020202020202020202020 +select @@collation_connection; +@@collation_connection +tis620_thai_ci +select hex(weight_string('a' LEVEL 1)); +hex(weight_string('a' LEVEL 1)) +61 +select hex(weight_string('A' LEVEL 1)); +hex(weight_string('A' LEVEL 1)) +61 +select hex(weight_string('abc' LEVEL 1)); +hex(weight_string('abc' LEVEL 1)) +616263 +select hex(weight_string('abc' as char(2) LEVEL 1)); +hex(weight_string('abc' as char(2) LEVEL 1)) +6162 +select hex(weight_string('abc' as char(3) LEVEL 1)); +hex(weight_string('abc' as char(3) LEVEL 1)) +616263 +select hex(weight_string('abc' as char(5) LEVEL 1)); +hex(weight_string('abc' as char(5) LEVEL 1)) +6162632020 +select hex(weight_string('abc' as char(5) LEVEL 1 REVERSE)); +hex(weight_string('abc' as char(5) LEVEL 1 REVERSE)) +2020636261 +select hex(weight_string('abc' as char(5) LEVEL 1 DESC)); +hex(weight_string('abc' as char(5) LEVEL 1 DESC)) +9E9D9CDFDF +select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE)); +hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE)) +DFDF9C9D9E +SELECT strcmp('a','a '), strcmp('a ','a'); +strcmp('a','a ') strcmp('a ','a') +0 0 +SELECT strcmp('a\0','a' ), strcmp('a','a\0'); +strcmp('a\0','a' ) strcmp('a','a\0') +-1 1 +SELECT strcmp('a\0','a '), strcmp('a ','a\0'); +strcmp('a\0','a ') strcmp('a ','a\0') +-1 1 +SELECT strcmp('a\t','a' ), strcmp('a', 'a\t'); +strcmp('a\t','a' ) strcmp('a', 'a\t') +-1 1 +SELECT strcmp('a\t','a '), strcmp('a ', 'a\t'); +strcmp('a\t','a ') strcmp('a ', 'a\t') +-1 1 +select hex(weight_string(cast(0xE0A1 as char))); +hex(weight_string(cast(0xE0A1 as char))) +A1E0 +select hex(weight_string(cast(0xE0A1 as char) as char(1))); +hex(weight_string(cast(0xE0A1 as char) as char(1))) +A1 +set collation_connection=tis620_bin; +select @@collation_connection; +@@collation_connection +tis620_bin +CREATE TABLE t1 AS SELECT 'a' AS a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1) CHARACTER SET tis620 COLLATE tis620_bin NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a)) FROM t1; +HEX(WEIGHT_STRING(a)) +61 +SELECT HEX(ws) FROM t2; +HEX(ws) +61 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(5) CHARACTER SET tis620 COLLATE tis620_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(5) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a)) FROM t1; +HEX(WEIGHT_STRING(a)) +6161616161 +SELECT HEX(ws) FROM t2; +HEX(ws) +6161616161 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(3))) +616161 +SELECT HEX(ws) FROM t2; +HEX(ws) +616161 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61616161612020202020 +SELECT HEX(ws) FROM t2; +HEX(ws) +61616161612020202020 +DROP TABLE t2; +DROP TABLE t1; +select hex(weight_string('a')); +hex(weight_string('a')) +61 +select hex(weight_string('A')); +hex(weight_string('A')) +41 +select hex(weight_string('abc')); +hex(weight_string('abc')) +616263 +select hex(weight_string('abc' as char(2))); +hex(weight_string('abc' as char(2))) +6162 +select hex(weight_string('abc' as char(3))); +hex(weight_string('abc' as char(3))) +616263 +select hex(weight_string('abc' as char(5))); +hex(weight_string('abc' as char(5))) +6162632020 +select hex(weight_string('abc', 1, 2, 0xC0)); +hex(weight_string('abc', 1, 2, 0xC0)) +61 +select hex(weight_string('abc', 2, 2, 0xC0)); +hex(weight_string('abc', 2, 2, 0xC0)) +6162 +select hex(weight_string('abc', 3, 2, 0xC0)); +hex(weight_string('abc', 3, 2, 0xC0)) +616220 +select hex(weight_string('abc', 4, 2, 0xC0)); +hex(weight_string('abc', 4, 2, 0xC0)) +61622020 +select hex(weight_string('abc', 5, 2, 0xC0)); +hex(weight_string('abc', 5, 2, 0xC0)) +6162202020 +select hex(weight_string('abc',25, 2, 0xC0)); +hex(weight_string('abc',25, 2, 0xC0)) +61622020202020202020202020202020202020202020202020 +select hex(weight_string('abc', 1, 3, 0xC0)); +hex(weight_string('abc', 1, 3, 0xC0)) +61 +select hex(weight_string('abc', 2, 3, 0xC0)); +hex(weight_string('abc', 2, 3, 0xC0)) +6162 +select hex(weight_string('abc', 3, 3, 0xC0)); +hex(weight_string('abc', 3, 3, 0xC0)) +616263 +select hex(weight_string('abc', 4, 3, 0xC0)); +hex(weight_string('abc', 4, 3, 0xC0)) +61626320 +select hex(weight_string('abc', 5, 3, 0xC0)); +hex(weight_string('abc', 5, 3, 0xC0)) +6162632020 +select hex(weight_string('abc',25, 3, 0xC0)); +hex(weight_string('abc',25, 3, 0xC0)) +61626320202020202020202020202020202020202020202020 +select hex(weight_string('abc', 1, 4, 0xC0)); +hex(weight_string('abc', 1, 4, 0xC0)) +61 +select hex(weight_string('abc', 2, 4, 0xC0)); +hex(weight_string('abc', 2, 4, 0xC0)) +6162 +select hex(weight_string('abc', 3, 4, 0xC0)); +hex(weight_string('abc', 3, 4, 0xC0)) +616263 +select hex(weight_string('abc', 4, 4, 0xC0)); +hex(weight_string('abc', 4, 4, 0xC0)) +61626320 +select hex(weight_string('abc', 5, 4, 0xC0)); +hex(weight_string('abc', 5, 4, 0xC0)) +6162632020 +select hex(weight_string('abc',25, 4, 0xC0)); +hex(weight_string('abc',25, 4, 0xC0)) +61626320202020202020202020202020202020202020202020 +select @@collation_connection; +@@collation_connection +tis620_bin +select hex(weight_string('a' LEVEL 1)); +hex(weight_string('a' LEVEL 1)) +61 +select hex(weight_string('A' LEVEL 1)); +hex(weight_string('A' LEVEL 1)) +41 +select hex(weight_string('abc' LEVEL 1)); +hex(weight_string('abc' LEVEL 1)) +616263 +select hex(weight_string('abc' as char(2) LEVEL 1)); +hex(weight_string('abc' as char(2) LEVEL 1)) +6162 +select hex(weight_string('abc' as char(3) LEVEL 1)); +hex(weight_string('abc' as char(3) LEVEL 1)) +616263 +select hex(weight_string('abc' as char(5) LEVEL 1)); +hex(weight_string('abc' as char(5) LEVEL 1)) +6162632020 +select hex(weight_string('abc' as char(5) LEVEL 1 REVERSE)); +hex(weight_string('abc' as char(5) LEVEL 1 REVERSE)) +2020636261 +select hex(weight_string('abc' as char(5) LEVEL 1 DESC)); +hex(weight_string('abc' as char(5) LEVEL 1 DESC)) +9E9D9CDFDF +select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE)); +hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE)) +DFDF9C9D9E +SELECT strcmp('a','a '), strcmp('a ','a'); +strcmp('a','a ') strcmp('a ','a') +0 0 +SELECT strcmp('a\0','a' ), strcmp('a','a\0'); +strcmp('a\0','a' ) strcmp('a','a\0') +-1 1 +SELECT strcmp('a\0','a '), strcmp('a ','a\0'); +strcmp('a\0','a ') strcmp('a ','a\0') +-1 1 +SELECT strcmp('a\t','a' ), strcmp('a', 'a\t'); +strcmp('a\t','a' ) strcmp('a', 'a\t') +-1 1 +SELECT strcmp('a\t','a '), strcmp('a ', 'a\t'); +strcmp('a\t','a ') strcmp('a ', 'a\t') +-1 1 +select hex(weight_string(cast(0xE0A1 as char))); +hex(weight_string(cast(0xE0A1 as char))) +E0A1 +select hex(weight_string(cast(0xE0A1 as char) as char(1))); +hex(weight_string(cast(0xE0A1 as char) as char(1))) +E0 +# +# End of 5.6 tests +# +# +# Start of 10.2 tests +# +# +# MDEV-9711 NO PAD Collatons +# +SET character_set_connection=tis620; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'tis620_thai_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE tis620_thai_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=tis620 COLLATE=tis620_thai_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'tis620_thai_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'tis620_thai_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'tis620_thai_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'tis620_thai_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'tis620_thai_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'tis620_thai_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_thai_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_thai_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'tis620_thai_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_thai_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_thai_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'tis620_thai_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE tis620_thai_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=tis620 COLLATE=tis620_thai_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'tis620_thai_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'tis620_thai_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'tis620_thai_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'tis620_thai_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'tis620_thai_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'tis620_thai_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'tis620_thai_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'tis620_thai_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_thai_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_thai_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'tis620_thai_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_thai_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_thai_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'tis620_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE tis620_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=tis620 COLLATE=tis620_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'tis620_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'tis620_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'tis620_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'tis620_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'tis620_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'tis620_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'tis620_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'tis620_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'tis620_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'tis620_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'tis620_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'tis620_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE tis620_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=tis620 COLLATE=tis620_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'tis620_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'tis620_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'tis620_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +61000000000000000000 +61202000000000000000 +20610000000000000000 +20612000000000000000 +61202020000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'tis620_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'tis620_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'tis620_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'tis620_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'tis620_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'tis620_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'tis620_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'tis620_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'tis620_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'tis620_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +# +# End of 10.2 tests +# diff --cc mysql-test/main/ctype_uca.result index 7394ec82924,00000000000..41d2a1149ee mode 100644,000000..100644 --- a/mysql-test/main/ctype_uca.result +++ b/mysql-test/main/ctype_uca.result @@@ -1,15400 -1,0 +1,15406 @@@ +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 (_ucs2 0x1EA0),(_ucs2 0x1EA1),(_ucs2 0x1EA2),(_ucs2 0x1EA3); +INSERT INTO t1 VALUES (_ucs2 0x1EA4),(_ucs2 0x1EA5),(_ucs2 0x1EA6),(_ucs2 0x1EA7); +INSERT INTO t1 VALUES (_ucs2 0x1EA8),(_ucs2 0x1EA9),(_ucs2 0x1EAA),(_ucs2 0x1EAB); +INSERT INTO t1 VALUES (_ucs2 0x1EAC),(_ucs2 0x1EAD),(_ucs2 0x1EAE),(_ucs2 0x1EAF); +INSERT INTO t1 VALUES (_ucs2 0x1EB0),(_ucs2 0x1EB1),(_ucs2 0x1EB2),(_ucs2 0x1EB3); +INSERT INTO t1 VALUES (_ucs2 0x1EB4),(_ucs2 0x1EB5),(_ucs2 0x1EB6),(_ucs2 0x1EB7); +INSERT INTO t1 VALUES (_ucs2 0x1EB8),(_ucs2 0x1EB9),(_ucs2 0x1EBA),(_ucs2 0x1EBB); +INSERT INTO t1 VALUES (_ucs2 0x1EBC),(_ucs2 0x1EBD),(_ucs2 0x1EBE),(_ucs2 0x1EBF); +INSERT INTO t1 VALUES (_ucs2 0x1EC0),(_ucs2 0x1EC1),(_ucs2 0x1EC2),(_ucs2 0x1EC3); +INSERT INTO t1 VALUES (_ucs2 0x1EC4),(_ucs2 0x1EC5),(_ucs2 0x1EC6),(_ucs2 0x1EC7); +INSERT INTO t1 VALUES (_ucs2 0x1EC8),(_ucs2 0x1EC9),(_ucs2 0x1ECA),(_ucs2 0x1ECB); +INSERT INTO t1 VALUES (_ucs2 0x1ECC),(_ucs2 0x1ECD),(_ucs2 0x1ECE),(_ucs2 0x1ECF); +INSERT INTO t1 VALUES (_ucs2 0x1ED0),(_ucs2 0x1ED1),(_ucs2 0x1ED2),(_ucs2 0x1ED3); +INSERT INTO t1 VALUES (_ucs2 0x1ED4),(_ucs2 0x1ED5),(_ucs2 0x1ED6),(_ucs2 0x1ED7); +INSERT INTO t1 VALUES (_ucs2 0x1ED8),(_ucs2 0x1ED9),(_ucs2 0x1EDA),(_ucs2 0x1EDB); +INSERT INTO t1 VALUES (_ucs2 0x1EDC),(_ucs2 0x1EDD),(_ucs2 0x1EDE),(_ucs2 0x1EDF); +INSERT INTO t1 VALUES (_ucs2 0x1EE0),(_ucs2 0x1EE1),(_ucs2 0x1EE2),(_ucs2 0x1EE3); +INSERT INTO t1 VALUES (_ucs2 0x1EE4),(_ucs2 0x1EE5),(_ucs2 0x1EE6),(_ucs2 0x1EE7); +INSERT INTO t1 VALUES (_ucs2 0x1EE8),(_ucs2 0x1EE9),(_ucs2 0x1EEA),(_ucs2 0x1EEB); +INSERT INTO t1 VALUES (_ucs2 0x1EEC),(_ucs2 0x1EED),(_ucs2 0x1EEE),(_ucs2 0x1EEF); +INSERT INTO t1 VALUES (_ucs2 0x1EF0),(_ucs2 0x1EF1); +insert into t1 values ('AA'),('Aa'),('aa'),('aA'); +insert into t1 values ('AE'),('Ae'),('ae'),('aE'); +insert into t1 values ('CH'),('Ch'),('ch'),('cH'); +insert into t1 values ('DZ'),('Dz'),('dz'),('dZ'); +insert into t1 values ('DŽ'),('Dž'),('dž'),('dŽ'); +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 +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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 +AE,Ae,aE,ae +Á,á +Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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 +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ +CH,Ch,cH,ch +Č,č +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz +DŽ,Dž,dŽ,dž +Đ,đ +Ɖ +Ɗ +Ƌ,ƌ +Ð,ð +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 +AE,Ae,aE,ae +Ă,ă +Â,â +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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 +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ +CH,Ch,cH,ch +Č,č +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz +DŽ,Dž,dŽ,dž +Đ,đ +Ɖ +Ɗ +Ƌ,ƌ +Ð,ð +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 +AE,Ae,aE,ae +Ą,ą +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ć,ć +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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 +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,dZ,dz +DŽ,Dž,dŽ,dž +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 +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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 +AE,Ae,aE,ae +Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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 +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ç,ç +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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 +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ +cH +Č,č +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz +DŽ,Dž,dŽ,dž +Đ,đ +Ɖ +Ɗ +Ƌ,ƌ +Ð,ð +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 +AE,Ae,aE,ae +Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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 +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,CH,Ch,c,ch,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ +cH +Č,č +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz +DŽ,Dž,dŽ,dž +Đ,đ +Ɖ +Ɗ +Ƌ,ƌ +Ð,ð +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 +AE,Ae,aE,ae +Ä,ä +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ +cH +Č,č +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz +DŽ,Dž,dŽ,dž +Đ,đ +Ɖ +Ɗ +Ƌ,ƌ +Ð,ð +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 +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +cH +CH,Ch,ch +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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_roman_ci; +group_concat(c1 order by c1) +÷ +× +A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,ä,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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 +ǀ +ǁ +ǂ +ǃ +select group_concat(c1 order by c1) from t1 group by c1 collate utf8_esperanto_ci; +group_concat(c1 order by c1) +÷ +× +A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,ä,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ĉ,ĉ +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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_hungarian_ci; +group_concat(c1 order by c1) +÷ +× +A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,ä,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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_croatian_mysql561_ci; +group_concat(c1 order by c1) +÷ +× +A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,ä,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ĉ,ĉ,Ċ,ċ +CH,Ch,cH,ch +Č,č +Ć,ć +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,dZ,dz,DZ,Dz,dz +DŽ,Dž,dŽ,dž,DŽ,Dž,dž +Đ,đ +Ɖ +Ɗ +Ƌ,ƌ +Ð,ð +E,e,È,É,Ê,Ë,è,é,ê,ë,Ē,ē,Ĕ,ĕ,Ė,ė,Ę,ę,Ě,ě,Ẹ,ẹ,Ẻ,ẻ,Ẽ,ẽ,Ế,ế,Ề,ề,Ể,ể,Ễ,ễ,Ệ,ệ +Ǝ,ǝ +Ə +Ɛ +F,f +Ƒ,ƒ +G,g,Ĝ,ĝ,Ğ,ğ,Ġ,ġ,Ģ,ģ,Ǧ,ǧ,Ǵ,ǵ +Ǥ,ǥ +Ɠ +Ɣ +Ƣ,ƣ +H,h,Ĥ,ĥ +ƕ,Ƕ +Ħ,ħ +I,i,Ì,Í,Î,Ï,ì,í,î,ï,Ĩ,ĩ,Ī,ī,Ĭ,ĭ,Į,į,İ,Ǐ,ǐ,Ỉ,ỉ,Ị,ị +IJ,Ij,iJ,ij,IJ,ij +ı +Ɨ +Ɩ +J,j,Ĵ,ĵ,ǰ +K,k,Ķ,ķ,Ǩ,ǩ +Ƙ,ƙ +L,l,Ĺ,ĺ,Ļ,ļ,Ľ,ľ +Ŀ,ŀ +LL,Ll,lL,ll +LJ,Lj,lJ,lj,LJ,Lj,lj +Ł,ł +ƚ +ƛ +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_croatian_ci; +group_concat(c1 order by c1) +÷ +× +A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,ä,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ĉ,ĉ,Ċ,ċ +CH,Ch,cH,ch +Č,č +Ć,ć +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,dZ,dz,DZ,Dz,dz +dŽ +DŽ,Dž,dž,DŽ,Dž,dž +Đ,đ +Ɖ +Ɗ +Ƌ,ƌ +Ð,ð +E,e,È,É,Ê,Ë,è,é,ê,ë,Ē,ē,Ĕ,ĕ,Ė,ė,Ę,ę,Ě,ě,Ẹ,ẹ,Ẻ,ẻ,Ẽ,ẽ,Ế,ế,Ề,ề,Ể,ể,Ễ,ễ,Ệ,ệ +Ǝ,ǝ +Ə +Ɛ +F,f +Ƒ,ƒ +G,g,Ĝ,ĝ,Ğ,ğ,Ġ,ġ,Ģ,ģ,Ǧ,ǧ,Ǵ,ǵ +Ǥ,ǥ +Ɠ +Ɣ +Ƣ,ƣ +H,h,Ĥ,ĥ +ƕ,Ƕ +Ħ,ħ +I,i,Ì,Í,Î,Ï,ì,í,î,ï,Ĩ,ĩ,Ī,ī,Ĭ,ĭ,Į,į,İ,Ǐ,ǐ,Ỉ,ỉ,Ị,ị +IJ,Ij,iJ,ij,IJ,ij +ı +Ɨ +Ɩ +J,j,Ĵ,ĵ,ǰ +K,k,Ķ,ķ,Ǩ,ǩ +Ƙ,ƙ +L,l,Ĺ,ĺ,Ļ,ļ,Ľ,ľ +Ŀ,ŀ +lJ +LL,Ll,lL,ll +LJ,Lj,lj,LJ,Lj,lj +Ł,ł +ƚ +ƛ +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_german2_ci; +group_concat(c1 order by c1) +÷ +× +A,a,À,Á,Â,Ã,Å,à,á,â,ã,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae,Ä,Æ,ä,æ +Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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_unicode_520_ci; +group_concat(c1 order by c1) +÷ +× +A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,ä,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae,Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ƈ,ƈ +D,d,Ð,ð,Ď,ď,Đ,đ +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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_vietnamese_ci; +group_concat(c1 order by c1) +÷ +× +A,a,À,Á,Ã,Ä,Å,à,á,ã,ä,å,Ā,ā,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả +AA,Aa,aA,aa +AE,Ae,aE,ae +Ă,ă,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +Â,â,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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_thai_520_w2; +group_concat(c1 order by c1) +÷ +× +A,a +Á,á +À,à +Ă,ă +Ắ,ắ +Ằ,ằ +Ẵ,ẵ +Ẳ,ẳ +Â,â +Ấ,ấ +Ầ,ầ +Ẫ,ẫ +Ẩ,ẩ +Ǎ,ǎ +Å,å +Ǻ,ǻ +Ä,ä +Ǟ,ǟ +Ã,ã +Ǡ,ǡ +Ą,ą +Ā,ā +Ả,ả +Ạ,ạ +Ặ,ặ +Ậ,ậ +AA,Aa,aA,aa +AE,Ae,aE,ae +Æ,æ +Ǽ,ǽ +Ǣ,ǣ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c +Ć,ć +Ĉ,ĉ +Č,č +Ċ,ċ +Ç,ç +CH,Ch,cH,ch +Ƈ,ƈ +D,d +Ď,ď +Đ,đ +Ð,ð +DZ,Dz,dZ,dz,DZ,Dz,dz +DŽ,Dž,dŽ,dž,DŽ,Dž,dž +Ɖ +Ɗ +Ƌ,ƌ +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 +ǀ +ǁ +ǂ +ǃ +ALTER TABLE t1 CONVERT TO CHARACTER SET ucs2 COLLATE ucs2_bin; +SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_unicode_ci; +GROUP_CONCAT(c1 ORDER BY c1) +÷ +× +A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,ä,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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 ucs2_icelandic_ci; +GROUP_CONCAT(c1 ORDER BY c1) +÷ +× +A,a,À,Â,Ã,à,â,ã,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae +Á,á +Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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 ucs2_latvian_ci; +GROUP_CONCAT(c1 ORDER BY c1) +÷ +× +A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,ä,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ +CH,Ch,cH,ch +Č,č +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz +DŽ,Dž,dŽ,dž +Đ,đ +Ɖ +Ɗ +Ƌ,ƌ +Ð,ð +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 ucs2_romanian_ci; +GROUP_CONCAT(c1 ORDER BY c1) +÷ +× +A,a,À,Á,Ã,Ä,Å,à,á,ã,ä,å,Ā,ā,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae +Ă,ă +Â,â +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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 ucs2_slovenian_ci; +GROUP_CONCAT(c1 ORDER BY c1) +÷ +× +A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,ä,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ +CH,Ch,cH,ch +Č,č +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz +DŽ,Dž,dŽ,dž +Đ,đ +Ɖ +Ɗ +Ƌ,ƌ +Ð,ð +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 ucs2_polish_ci; +GROUP_CONCAT(c1 ORDER BY c1) +÷ +× +A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,ä,å,Ā,ā,Ă,ă,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae +Ą,ą +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ć,ć +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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 ucs2_estonian_ci; +GROUP_CONCAT(c1 ORDER BY c1) +÷ +× +A,a,À,Á,Â,Ã,Å,à,á,â,ã,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,dZ,dz +DŽ,Dž,dŽ,dž +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 ucs2_spanish_ci; +GROUP_CONCAT(c1 ORDER BY c1) +÷ +× +A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,ä,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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 ucs2_swedish_ci; +GROUP_CONCAT(c1 ORDER BY c1) +÷ +× +A,a,À,Á,Â,Ã,à,á,â,ã,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae +Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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 ucs2_turkish_ci; +GROUP_CONCAT(c1 ORDER BY c1) +÷ +× +A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,ä,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ç,ç +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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 ucs2_czech_ci; +GROUP_CONCAT(c1 ORDER BY c1) +÷ +× +A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,ä,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ +cH +Č,č +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz +DŽ,Dž,dŽ,dž +Đ,đ +Ɖ +Ɗ +Ƌ,ƌ +Ð,ð +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 ucs2_danish_ci; +GROUP_CONCAT(c1 ORDER BY c1) +÷ +× +A,a,À,Á,Â,Ã,à,á,â,ã,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +aA +AE,Ae,aE,ae +Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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 ucs2_lithuanian_ci; +GROUP_CONCAT(c1 ORDER BY c1) +÷ +× +A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,ä,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,CH,Ch,c,ch,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ +cH +Č,č +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz +DŽ,Dž,dŽ,dž +Đ,đ +Ɖ +Ɗ +Ƌ,ƌ +Ð,ð +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 ucs2_slovak_ci; +GROUP_CONCAT(c1 ORDER BY c1) +÷ +× +A,a,À,Á,Â,Ã,Å,à,á,â,ã,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae +Ä,ä +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ +cH +Č,č +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz +DŽ,Dž,dŽ,dž +Đ,đ +Ɖ +Ɗ +Ƌ,ƌ +Ð,ð +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 ucs2_spanish2_ci; +GROUP_CONCAT(c1 ORDER BY c1) +÷ +× +A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,ä,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +cH +CH,Ch,ch +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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 ucs2_roman_ci; +GROUP_CONCAT(c1 ORDER BY c1) +÷ +× +A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,ä,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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 +ǀ +ǁ +ǂ +ǃ +SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_esperanto_ci; +GROUP_CONCAT(c1 ORDER BY c1) +÷ +× +A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,ä,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ĉ,ĉ +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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 ucs2_hungarian_ci; +GROUP_CONCAT(c1 ORDER BY c1) +÷ +× +A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,ä,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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 ucs2_croatian_mysql561_ci; +GROUP_CONCAT(c1 ORDER BY c1) +÷ +× +A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,ä,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ĉ,ĉ,Ċ,ċ +CH,Ch,cH,ch +Č,č +Ć,ć +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,dZ,dz,DZ,Dz,dz +DŽ,Dž,dŽ,dž,DŽ,Dž,dž +Đ,đ +Ɖ +Ɗ +Ƌ,ƌ +Ð,ð +E,e,È,É,Ê,Ë,è,é,ê,ë,Ē,ē,Ĕ,ĕ,Ė,ė,Ę,ę,Ě,ě,Ẹ,ẹ,Ẻ,ẻ,Ẽ,ẽ,Ế,ế,Ề,ề,Ể,ể,Ễ,ễ,Ệ,ệ +Ǝ,ǝ +Ə +Ɛ +F,f +Ƒ,ƒ +G,g,Ĝ,ĝ,Ğ,ğ,Ġ,ġ,Ģ,ģ,Ǧ,ǧ,Ǵ,ǵ +Ǥ,ǥ +Ɠ +Ɣ +Ƣ,ƣ +H,h,Ĥ,ĥ +ƕ,Ƕ +Ħ,ħ +I,i,Ì,Í,Î,Ï,ì,í,î,ï,Ĩ,ĩ,Ī,ī,Ĭ,ĭ,Į,į,İ,Ǐ,ǐ,Ỉ,ỉ,Ị,ị +IJ,Ij,iJ,ij,IJ,ij +ı +Ɨ +Ɩ +J,j,Ĵ,ĵ,ǰ +K,k,Ķ,ķ,Ǩ,ǩ +Ƙ,ƙ +L,l,Ĺ,ĺ,Ļ,ļ,Ľ,ľ +Ŀ,ŀ +LL,Ll,lL,ll +LJ,Lj,lJ,lj,LJ,Lj,lj +Ł,ł +ƚ +ƛ +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 ucs2_croatian_ci; +GROUP_CONCAT(c1 ORDER BY c1) +÷ +× +A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,ä,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ĉ,ĉ,Ċ,ċ +CH,Ch,cH,ch +Č,č +Ć,ć +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,dZ,dz,DZ,Dz,dz +dŽ +DŽ,Dž,dž,DŽ,Dž,dž +Đ,đ +Ɖ +Ɗ +Ƌ,ƌ +Ð,ð +E,e,È,É,Ê,Ë,è,é,ê,ë,Ē,ē,Ĕ,ĕ,Ė,ė,Ę,ę,Ě,ě,Ẹ,ẹ,Ẻ,ẻ,Ẽ,ẽ,Ế,ế,Ề,ề,Ể,ể,Ễ,ễ,Ệ,ệ +Ǝ,ǝ +Ə +Ɛ +F,f +Ƒ,ƒ +G,g,Ĝ,ĝ,Ğ,ğ,Ġ,ġ,Ģ,ģ,Ǧ,ǧ,Ǵ,ǵ +Ǥ,ǥ +Ɠ +Ɣ +Ƣ,ƣ +H,h,Ĥ,ĥ +ƕ,Ƕ +Ħ,ħ +I,i,Ì,Í,Î,Ï,ì,í,î,ï,Ĩ,ĩ,Ī,ī,Ĭ,ĭ,Į,į,İ,Ǐ,ǐ,Ỉ,ỉ,Ị,ị +IJ,Ij,iJ,ij,IJ,ij +ı +Ɨ +Ɩ +J,j,Ĵ,ĵ,ǰ +K,k,Ķ,ķ,Ǩ,ǩ +Ƙ,ƙ +L,l,Ĺ,ĺ,Ļ,ļ,Ľ,ľ +Ŀ,ŀ +lJ +LL,Ll,lL,ll +LJ,Lj,lj,LJ,Lj,lj +Ł,ł +ƚ +ƛ +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 ucs2_german2_ci; +GROUP_CONCAT(c1 ORDER BY c1) +÷ +× +A,a,À,Á,Â,Ã,Å,à,á,â,ã,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae,Ä,Æ,ä,æ +Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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 ucs2_unicode_520_ci; +GROUP_CONCAT(c1 ORDER BY c1) +÷ +× +A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,ä,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +AA,Aa,aA,aa +AE,Ae,aE,ae,Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ƈ,ƈ +D,d,Ð,ð,Ď,ď,Đ,đ +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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 ucs2_vietnamese_ci; +GROUP_CONCAT(c1 ORDER BY c1) +÷ +× +A,a,À,Á,Ã,Ä,Å,à,á,ã,ä,å,Ā,ā,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ,Ạ,ạ,Ả,ả +AA,Aa,aA,aa +AE,Ae,aE,ae +Ă,ă,Ắ,ắ,Ằ,ằ,Ẳ,ẳ,Ẵ,ẵ,Ặ,ặ +Â,â,Ấ,ấ,Ầ,ầ,Ẩ,ẩ,Ẫ,ẫ,Ậ,ậ +Æ,æ,Ǣ,ǣ,Ǽ,ǽ +B,b +ƀ +Ɓ +Ƃ,ƃ +C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č +CH,Ch,cH,ch +Ƈ,ƈ +D,d,Ď,ď +DZ,Dz,DŽ,Dž,dZ,dz,dŽ,dž,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 +ǀ +ǁ +ǂ +ǃ +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; +CREATE TABLE t1 ( +a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_persian_ci, +offs INT NOT NULL +); +INSERT INTO t1 VALUES +(_ucs2 0x066D, 1),(_ucs2 0x064E, 2),(_ucs2 0xFE76, 3),(_ucs2 0xFE77, 4), +(_ucs2 0x0650, 5),(_ucs2 0xFE7A, 6),(_ucs2 0xFE7B, 7),(_ucs2 0x064F, 8), +(_ucs2 0xFE78, 9),(_ucs2 0xFE79,10),(_ucs2 0x064B,11),(_ucs2 0xFE70,12), +(_ucs2 0xFE71,13),(_ucs2 0x064D,14),(_ucs2 0xFE74,15),(_ucs2 0x064C,16), +(_ucs2 0xFE72,17), +(_ucs2 0xFE7F, 1),(_ucs2 0x0653, 2),(_ucs2 0x0654, 3),(_ucs2 0x0655, 4), +(_ucs2 0x0670, 5), +(_ucs2 0x0669, 1),(_ucs2 0x0622, 2),(_ucs2 0x0627, 3),(_ucs2 0x0671, 4), +(_ucs2 0x0621, 5),(_ucs2 0x0623, 6),(_ucs2 0x0625, 7),(_ucs2 0x0624, 8), +(_ucs2 0x0626, 9), +(_ucs2 0x0642, 1),(_ucs2 0x06A9, 2),(_ucs2 0x0643, 3), +(_ucs2 0x0648, 1),(_ucs2 0x0647, 2),(_ucs2 0x0629, 3),(_ucs2 0x06C0, 4), +(_ucs2 0x06CC, 5),(_ucs2 0x0649, 6),(_ucs2 0x064A, 7), +(_ucs2 0xFE80, 1),(_ucs2 0xFE81, 2),(_ucs2 0xFE82, 3),(_ucs2 0xFE8D, 4), +(_ucs2 0xFE8E, 5),(_ucs2 0xFB50, 6),(_ucs2 0xFB51, 7),(_ucs2 0xFE80, 8), +(_ucs2 0xFE83, 9),(_ucs2 0xFE84,10),(_ucs2 0xFE87,11),(_ucs2 0xFE88,12), +(_ucs2 0xFE85,13),(_ucs2 0xFE86,14),(_ucs2 0x0689,16),(_ucs2 0x068A,17), +(_ucs2 0xFEAE, 1),(_ucs2 0xFDFC, 2), +(_ucs2 0xFED8, 1),(_ucs2 0xFB8E, 2),(_ucs2 0xFB8F, 3),(_ucs2 0xFB90, 4), +(_ucs2 0xFB91, 5),(_ucs2 0xFED9, 6),(_ucs2 0xFEDA, 7),(_ucs2 0xFEDB, 8), +(_ucs2 0xFEDC, 9), +(_ucs2 0xFEEE, 1),(_ucs2 0xFEE9, 2),(_ucs2 0xFEEA, 3),(_ucs2 0xFEEB, 4), +(_ucs2 0xFEEC, 5),(_ucs2 0xFE93, 6),(_ucs2 0xFE94, 7),(_ucs2 0xFBA4, 8), +(_ucs2 0xFBA5, 9),(_ucs2 0xFBFC,10),(_ucs2 0xFBFD,11),(_ucs2 0xFBFE,12), +(_ucs2 0xFBFF,13),(_ucs2 0xFEEF,14),(_ucs2 0xFEF0,15),(_ucs2 0xFEF1,16), +(_ucs2 0xFEF2,17),(_ucs2 0xFEF3,18),(_ucs2 0xFEF4,19),(_ucs2 0xFEF5,20), +(_ucs2 0xFEF6,21),(_ucs2 0xFEF7,22),(_ucs2 0xFEF8,23),(_ucs2 0xFEF9,24), +(_ucs2 0xFEFA,25),(_ucs2 0xFEFB,26),(_ucs2 0xFEFC,27); +SELECT HEX(CONVERT(a USING ucs2)), offs, hex(weight_string(a)), a +FROM t1 ORDER BY a, offs, BINARY a; +HEX(CONVERT(a USING ucs2)) offs hex(weight_string(a)) a +0653 2 0001 ٓ +0654 3 0002 ٔ +0655 4 0003 ٕ +0670 5 0004 ٰ +FE7F 1 ﹿ +066D 1 02CB ٭ +064E 2 02CC َ +FE76 3 02CD ﹶ +FE77 4 02CE ﹷ +0650 5 02CF ِ +FE7A 6 02D0 ﹺ +FE7B 7 02D1 ﹻ +064F 8 02D2 ُ +FE78 9 02D3 ﹸ +FE79 10 02D4 ﹹ +064B 11 02D5 ً +FE70 12 02D6 ﹰ +FE71 13 02D7 ﹱ +064D 14 02D8 ٍ +FE74 15 02D9 ﹴ +064C 16 02DA ٌ +FE72 17 02DB ﹲ +0669 1 0E32 ٩ +0622 2 0E33 آ +0627 3 0E34 ا +0671 4 0E35 ٱ +0621 5 0E36 ء +0623 6 0E37 أ +0625 7 0E38 إ +0624 8 0E39 ؤ +0626 9 0E3A ئ +FE81 2 1348 ﺁ +FE82 3 1349 ﺂ +FE8D 4 134A ﺍ +FE8E 5 134B ﺎ +FB50 6 134C ﭐ +FB51 7 134D ﭑ +FE80 1 134E ﺀ +FE80 8 134E ﺀ +FE83 9 134F ﺃ +FE84 10 1350 ﺄ +FE87 11 1351 ﺇ +FE88 12 1352 ﺈ +FE85 13 1353 ﺅ +FE86 14 1354 ﺆ +0689 16 1355 ډ +068A 17 1356 ڊ +FEAE 1 1375 ﺮ +FDFC 2 1376 ﷼ +0642 1 139B ق +FED8 1 139B ﻘ +06A9 2 139C ک +FB8E 2 139C ﮎ +0643 3 139D ك +FB8F 3 139D ﮏ +FB90 4 139E ﮐ +FB91 5 139F ﮑ +FED9 6 13A0 ﻙ +FEDA 7 13A1 ﻚ +FEDB 8 13A2 ﻛ +FEDC 9 13A3 ﻜ +0648 1 13BD و +FEEE 1 13BD ﻮ +0647 2 13BE ه +FEE9 2 13BE ﻩ +0629 3 13BF ة +FEEA 3 13BF ﻪ +06C0 4 13C0 ۀ +FEEB 4 13C0 ﻫ +06CC 5 13C1 ی +FEEC 5 13C1 ﻬ +0649 6 13C2 ى +FE93 6 13C2 ﺓ +064A 7 13C3 ي +FE94 7 13C3 ﺔ +FBA4 8 13C4 ﮤ +FBA5 9 13C5 ﮥ +FBFC 10 13C6 ﯼ +FBFD 11 13C7 ﯽ +FBFE 12 13C8 ﯾ +FBFF 13 13C9 ﯿ +FEEF 14 13CA ﻯ +FEF0 15 13CB ﻰ +FEF1 16 13CC ﻱ +FEF2 17 13CD ﻲ +FEF3 18 13CE ﻳ +FEF4 19 13CF ﻴ +FEF5 20 13D0 ﻵ +FEF6 21 13D1 ﻶ +FEF7 22 13D2 ﻷ +FEF8 23 13D3 ﻸ +FEF9 24 13D4 ﻹ +FEFA 25 13D5 ﻺ +FEFB 26 13D6 ﻻ +FEFC 27 13D7 ﻼ +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 @safe_character_set_client= @@character_set_client; +SET @safe_character_set_results= @@character_set_results; +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; +create table t1 (a set('a') not null); +insert ignore into t1 values (),(); +Warnings: +Warning 1364 Field 'a' doesn't have a default value +select cast(a as char(1)) from t1; +cast(a as char(1)) + + +select a sounds like a from t1; +a sounds like a +1 +1 +select 1 from t1 order by cast(a as char(1)); +1 +1 +1 +drop table t1; +# +# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found +# +SET character_set_client=latin1; +SET character_set_connection= @test_character_set; +SET collation_connection= @test_collation; +SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1; +COLLATION('.') c1 +utf8_swedish_ci .wwwmysqlcom +set names utf8; +create table t1 ( +name varchar(10), +level smallint unsigned); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `name` varchar(10) COLLATE utf8_swedish_ci DEFAULT NULL, + `level` smallint(5) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_swedish_ci +insert into t1 values ('string',1); +select concat(name,space(level)), concat(name, repeat(' ',level)) from t1; +concat(name,space(level)) concat(name, repeat(' ',level)) +string string +drop table t1; +DROP DATABASE d1; +USE test; +SET character_set_server= @safe_character_set_server; +SET collation_server= @safe_collation_server; +SET character_set_client= @safe_character_set_client; +SET character_set_results= @safe_character_set_results; +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; +SET collation_connection='utf8_unicode_ci'; +create table t1 select repeat('a',4000) a; +delete from t1; +insert into t1 values ('a'), ('a '), ('a\t'); +select collation(a),hex(a) from t1 order by a; +collation(a) hex(a) +utf8_unicode_ci 6109 +utf8_unicode_ci 61 +utf8_unicode_ci 6120 +drop table t1; +# +# MDEV-5453 Assertion `src' fails in my_strnxfrm_unicode on GROUP BY MID(..) WITH ROLLUP +# +SELECT @@collation_connection; +@@collation_connection +utf8_unicode_ci +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +SELECT * FROM t1 GROUP BY MID(CURRENT_USER,0) WITH ROLLUP; +i +1 +1 +SELECT * FROM t1 GROUP BY MID('test',0) WITH ROLLUP; +i +1 +1 +DROP TABLE t1; +# +# MDEV-6170 Incorrect ordering with utf8_bin and utf8mb4_bin collations +# +SELECT @@collation_connection; +@@collation_connection +utf8_unicode_ci +CREATE TABLE t1 ENGINE=MEMORY AS SELECT REPEAT('a',5) AS a LIMIT 0; +INSERT INTO t1 (a) VALUES ("a"); +INSERT INTO t1 (a) VALUES ("b"); +INSERT INTO t1 (a) VALUES ("c"); +INSERT INTO t1 (a) VALUES ("d"); +INSERT INTO t1 (a) VALUES ("e"); +INSERT INTO t1 (a) VALUES ("f"); +INSERT INTO t1 (a) VALUES ("g"); +INSERT INTO t1 (a) VALUES ("h"); +INSERT INTO t1 (a) VALUES ("i"); +INSERT INTO t1 (a) VALUES ("j"); +INSERT INTO t1 (a) VALUES ("k"); +INSERT INTO t1 (a) VALUES ("l"); +INSERT INTO t1 (a) VALUES ("m"); +SELECT * FROM t1 ORDER BY LOWER(a); +a +a +b +c +d +e +f +g +h +i +j +k +l +m +SELECT * FROM t1 ORDER BY LOWER(a) DESC; +a +m +l +k +j +i +h +g +f +e +d +c +b +a +DROP TABLE t1; +select @@collation_connection; +@@collation_connection +utf8_unicode_ci +create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ; +insert into t1 values('abcdef'); +insert into t1 values('_bcdef'); +insert into t1 values('a_cdef'); +insert into t1 values('ab_def'); +insert into t1 values('abc_ef'); +insert into t1 values('abcd_f'); +insert into t1 values('abcde_'); +select c1 as c1u from t1 where c1 like 'ab\_def'; +c1u +ab_def +select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; +c2h +ab_def +drop table t1; ++SELECT @@collation_connection; ++@@collation_connection ++utf8_unicode_ci ++SELECT '\%b' LIKE '%\%'; ++'\%b' LIKE '%\%' ++0 +"BEGIN ctype_german.inc" +drop table if exists t1; +create table t1 as select repeat(' ', 64) as s1; +select collation(s1) from t1; +collation(s1) +utf8_unicode_ci +delete from t1; +INSERT INTO t1 VALUES ('ud'),('uf'); +INSERT INTO t1 VALUES ('od'),('of'); +INSERT INTO t1 VALUES ('e'); +INSERT INTO t1 VALUES ('ad'),('af'); +insert into t1 values ('a'),('ae'),(_latin1 0xE4); +insert into t1 values ('o'),('oe'),(_latin1 0xF6); +insert into t1 values ('s'),('ss'),(_latin1 0xDF); +insert into t1 values ('u'),('ue'),(_latin1 0xFC); +INSERT INTO t1 VALUES (_latin1 0xE6), (_latin1 0xC6); +INSERT INTO t1 VALUES (_latin1 0x9C), (_latin1 0x8C); +select s1, hex(s1) from t1 order by s1, binary s1; +s1 hex(s1) +a 61 +ä C3A4 +ad 6164 +ae 6165 +af 6166 +Æ C386 +æ C3A6 +e 65 +o 6F +ö C3B6 +od 6F64 +oe 6F65 +Œ C592 +œ C593 +of 6F66 +s 73 +ss 7373 +ß C39F +u 75 +ü C3BC +ud 7564 +ue 7565 +uf 7566 +select group_concat(s1 order by binary s1) from t1 group by s1; +group_concat(s1 order by binary s1) +a,ä +ad +ae +af +Æ,æ +e +o,ö +od +oe,Œ,œ +of +s +ss,ß +u,ü +ud +ue +uf +SELECT s1, hex(s1), hex(weight_string(s1)) FROM t1 ORDER BY s1, BINARY(s1); +s1 hex(s1) hex(weight_string(s1)) +a 61 0E33 +ä C3A4 0E33 +ad 6164 0E330E6D +ae 6165 0E330E8B +af 6166 0E330EB9 +Æ C386 0E38 +æ C3A6 0E38 +e 65 0E8B +o 6F 0F82 +ö C3B6 0F82 +od 6F64 0F820E6D +oe 6F65 0F820E8B +Œ C592 0F820E8B +œ C593 0F820E8B +of 6F66 0F820EB9 +s 73 0FEA +ss 7373 0FEA0FEA +ß C39F 0FEA0FEA +u 75 101F +ü C3BC 101F +ud 7564 101F0E6D +ue 7565 101F0E8B +uf 7566 101F0EB9 +SELECT s1, hex(s1) FROM t1 WHERE s1='ae' ORDER BY s1, BINARY(s1); +s1 hex(s1) +ae 6165 +drop table t1; +CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, + `b` int(1) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); +SELECT * FROM t1 ORDER BY a, b; +a b +s 0 +ß 1 +SELECT * FROM t1 ORDER BY a DESC, b; +a b +ß 1 +s 0 +SELECT * FROM t1 ORDER BY CONCAT(a), b; +a b +s 0 +ß 1 +SELECT * FROM t1 ORDER BY CONCAT(a) DESC, b; +a b +ß 1 +s 0 +DROP TABLE t1; +"END ctype_german.inc" +CREATE TABLE t1 (id int, a varchar(30) character set utf8); +INSERT INTO t1 VALUES (1, _ucs2 0x01310069), (2, _ucs2 0x01310131); +INSERT INTO t1 VALUES (3, _ucs2 0x00690069), (4, _ucs2 0x01300049); +INSERT INTO t1 VALUES (5, _ucs2 0x01300130), (6, _ucs2 0x00490049); +SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu +FROM t1 ORDER BY id; +a la l ll u lu +ıi 3 ıi 3 II 2 +ıı 4 ıı 4 II 2 +ii 2 ii 2 II 2 +İI 3 ii 2 İI 3 +İİ 4 ii 2 İİ 4 +II 2 ii 2 II 2 +ALTER TABLE t1 MODIFY a VARCHAR(30) character set utf8 collate utf8_turkish_ci; +SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu +FROM t1 ORDER BY id; +a la l ll u lu +ıi 3 ıi 3 Iİ 3 +ıı 4 ıı 4 II 2 +ii 2 ii 2 İİ 4 +İI 3 iı 3 İI 3 +İİ 4 ii 2 İİ 4 +II 2 ıı 4 II 2 +DROP TABLE t1; +CREATE TABLE t1 ( +c1 text character set ucs2 collate ucs2_polish_ci NOT NULL +) ENGINE=MyISAM; +insert into t1 values (''),('a'); +SELECT COUNT(*), c1 FROM t1 GROUP BY c1; +COUNT(*) c1 +1 +1 a +DROP TABLE IF EXISTS t1; +set names utf8; +create table t1 ( +a varchar(255), +key a(a) +) character set utf8 collate utf8_danish_ci; +insert into t1 values ('åaaaa'),('ååaaa'),('aaaaa'); +select a as like_a from t1 where a like 'a%'; +like_a +aaaaa +select a as like_aa from t1 where a like 'aa%'; +like_aa +aaaaa +select a as like_aaa from t1 where a like 'aaa%'; +like_aaa +aaaaa +select a as like_aaaa from t1 where a like 'aaaa%'; +like_aaaa +aaaaa +select a as like_aaaaa from t1 where a like 'aaaaa%'; +like_aaaaa +aaaaa +alter table t1 convert to character set ucs2 collate ucs2_danish_ci; +select a as like_a from t1 where a like 'a%'; +like_a +aaaaa +select a as like_aa from t1 where a like 'aa%'; +like_aa +aaaaa +select a as like_aaa from t1 where a like 'aaa%'; +like_aaa +aaaaa +select a as like_aaaa from t1 where a like 'aaaa%'; +like_aaaa +aaaaa +select a as like_aaaaa from t1 where a like 'aaaaa%'; +like_aaaaa +aaaaa +drop table t1; +create table t1 ( +a varchar(255), +key(a) +) character set utf8 collate utf8_spanish2_ci; +insert into t1 values ('aaaaa'),('lllll'),('zzzzz'); +select a as like_l from t1 where a like 'l%'; +like_l +lllll +select a as like_ll from t1 where a like 'll%'; +like_ll +lllll +select a as like_lll from t1 where a like 'lll%'; +like_lll +lllll +select a as like_llll from t1 where a like 'llll%'; +like_llll +lllll +select a as like_lllll from t1 where a like 'lllll%'; +like_lllll +lllll +alter table t1 convert to character set ucs2 collate ucs2_spanish2_ci; +select a as like_l from t1 where a like 'l%'; +like_l +lllll +select a as like_ll from t1 where a like 'll%'; +like_ll +lllll +select a as like_lll from t1 where a like 'lll%'; +like_lll +lllll +select a as like_llll from t1 where a like 'llll%'; +like_llll +lllll +select a as like_lllll from t1 where a like 'lllll%'; +like_lllll +lllll +drop table t1; +create table t1 ( +a varchar(255), +key a(a) +) character set utf8 collate utf8_czech_ci; +insert into t1 values +('b'),('c'),('d'),('e'),('f'),('g'),('h'),('ch'),('i'),('j'); +select * from t1 where a like 'c%'; +a +c +ch +alter table t1 convert to character set ucs2 collate ucs2_czech_ci; +select * from t1 where a like 'c%'; +a +c +ch +drop table t1; +set collation_connection=ucs2_unicode_ci; +drop table if exists t1; +create table t1 as +select repeat(' ', 64) as s1, repeat(' ',64) as s2 +union +select null, null; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `s1` varchar(64) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci DEFAULT NULL, + `s2` varchar(64) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +delete from t1; +insert into t1 values('aaa','aaa'); +insert into t1 values('aaa|qqq','qqq'); +insert into t1 values('gheis','^[^a-dXYZ]+$'); +insert into t1 values('aab','^aa?b'); +insert into t1 values('Baaan','^Ba*n'); +insert into t1 values('aaa','qqq|aaa'); +insert into t1 values('qqq','qqq|aaa'); +insert into t1 values('bbb','qqq|aaa'); +insert into t1 values('bbb','qqq'); +insert into t1 values('aaa','aba'); +insert into t1 values(null,'abc'); +insert into t1 values('def',null); +insert into t1 values(null,null); +insert into t1 values('ghi','ghi['); +select HIGH_PRIORITY s1 regexp s2 from t1; +s1 regexp s2 +0 +0 +0 +1 +1 +1 +1 +1 +1 +1 +NULL +NULL +NULL +NULL +drop table t1; +CREATE TABLE t1 AS +SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; +ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); +INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +SELECT hex(concat(repeat(0xF1F2, 10), '%')); +hex(concat(repeat(0xF1F2, 10), '%')) +F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F20025 +3 rows expected +SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); +a hex(b) c +2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL +3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL +4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL +DROP TABLE t1; +set names utf8; +End for 5.0 tests +End of 5.1 tests +# +# Start of 5.5 tests +# +SET collation_connection=utf8_czech_ci; +SELECT @@collation_connection; +@@collation_connection +utf8_czech_ci +# +# Bug#57737 Character sets: search fails with like, contraction, index +# +CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS s1 LIMIT 0; +INSERT INTO t1 VALUES ('c'),('ce'),('cé'),('ch'); +SELECT * FROM t1 WHERE s1 LIKE 'c%'; +s1 +c +ce +cé +ch +ALTER TABLE t1 ADD KEY s1 (s1); +SELECT * FROM t1 WHERE s1 LIKE 'c%'; +s1 +c +ce +cé +ch +ALTER TABLE t1 DROP KEY s1, ADD KEY(s1(1)); +SELECT * FROM t1 WHERE s1 LIKE 'ch'; +s1 +ch +DROP TABLE t1; +SELECT @@collation_connection; +@@collation_connection +utf8_czech_ci +# +# Bug#57737 Character sets: search fails with like, contraction, index +# Part#2 - ignorable characters +# +CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS s1 LIMIT 0; +INSERT INTO t1 VALUES ('a\0\0\0\0\0\t'),('a'),('b'),('c'),('d'),('e'); +SELECT HEX(s1) FROM t1 WHERE s1 LIKE 'a%'; +HEX(s1) +61000000000009 +61 +ALTER TABLE t1 ADD KEY s1 (s1); +SELECT HEX(s1) FROM t1 WHERE s1 LIKE 'a%'; +HEX(s1) +61000000000009 +61 +DROP TABLE t1; +SET collation_connection=ucs2_czech_ci; +SELECT @@collation_connection; +@@collation_connection +ucs2_czech_ci +# +# Bug#57737 Character sets: search fails with like, contraction, index +# +CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS s1 LIMIT 0; +INSERT INTO t1 VALUES ('c'),('ce'),('cé'),('ch'); +SELECT * FROM t1 WHERE s1 LIKE 'c%'; +s1 +c +ce +cé +ch +ALTER TABLE t1 ADD KEY s1 (s1); +SELECT * FROM t1 WHERE s1 LIKE 'c%'; +s1 +c +ce +cé +ch +ALTER TABLE t1 DROP KEY s1, ADD KEY(s1(1)); +SELECT * FROM t1 WHERE s1 LIKE 'ch'; +s1 +ch +DROP TABLE t1; +SELECT @@collation_connection; +@@collation_connection +ucs2_czech_ci +# +# Bug#57737 Character sets: search fails with like, contraction, index +# Part#2 - ignorable characters +# +CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS s1 LIMIT 0; +INSERT INTO t1 VALUES ('a\0\0\0\0\0\t'),('a'),('b'),('c'),('d'),('e'); +SELECT HEX(s1) FROM t1 WHERE s1 LIKE 'a%'; +HEX(s1) +0061000000000000000000000009 +0061 +ALTER TABLE t1 ADD KEY s1 (s1); +SELECT HEX(s1) FROM t1 WHERE s1 LIKE 'a%'; +HEX(s1) +0061000000000000000000000009 +0061 +DROP TABLE t1; +create table t1 (a int, c1 varchar(200) collate utf8_croatian_mysql561_ci, key (c1)); +insert into t1 values (1,'=> DZ'),(2,'=> Dz'),(3,'=> dz'),(4,'=> dZ'); +insert into t1 values (5,'=> DŽ'),(6,'=> Dž'),(7,'=> dž'),(8,'=> dŽ'); +insert into t1 values (9,'=> dž'),(10,'=> DŽ'); +select c1 from t1; +c1 +=> DZ +=> Dz +=> dz +=> dZ +=> DŽ +=> Dž +=> dž +=> dŽ +=> dž +=> DŽ +select concat(c1) from t1 order by c1; +concat(c1) +=> DZ +=> Dz +=> dz +=> dZ +=> DŽ +=> Dž +=> dž +=> dŽ +=> dž +=> DŽ +select * from t1 where c1 like '=> d%'; +a c1 +1 => DZ +2 => Dz +3 => dz +4 => dZ +5 => DŽ +6 => Dž +7 => dž +8 => dŽ +select * from t1 where concat(c1) like '=> d%'; +a c1 +1 => DZ +2 => Dz +3 => dz +4 => dZ +5 => DŽ +6 => Dž +7 => dž +8 => dŽ +select * from t1 where c1 like '=> dz%'; +a c1 +1 => DZ +2 => Dz +3 => dz +4 => dZ +select * from t1 where concat(c1) like '=> dz%'; +a c1 +1 => DZ +2 => Dz +3 => dz +4 => dZ +select * from t1 where c1 like '=> dž%'; +a c1 +5 => DŽ +6 => Dž +7 => dž +8 => dŽ +select * from t1 where concat(c1) like '=> dž%'; +a c1 +5 => DŽ +6 => Dž +7 => dž +8 => dŽ +select * from t1 where c1 = '=> dž'; +a c1 +5 => DŽ +6 => Dž +7 => dž +8 => dŽ +9 => dž +10 => DŽ +select * from t1 where concat(c1) = '=> dž'; +a c1 +5 => DŽ +6 => Dž +7 => dž +8 => dŽ +9 => dž +10 => DŽ +drop table t1; +# +# MDEV-7649 wrong result when comparing utf8 column with an invalid literal +# +SET NAMES utf8 COLLATE utf8_unicode_ci; +# +# Start of ctype_utf8_ilseq.inc +# +CREATE TABLE t1 ENGINE=MyISAM AS SELECT REPEAT(' ', 60) AS ch LIMIT 0;; +ALTER TABLE t1 +ADD id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, +ADD KEY(ch); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `ch` varchar(60) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`), + KEY `ch` (`ch`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); +SELECT ch FROM t1 WHERE ch='admin𝌆'; +ch +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆'; +ch +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆'; +ch +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +DELETE FROM t1; +INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????'); +INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b'); +INSERT INTO t1 (ch) VALUES ('az'),('a?z'),('a??z'),('a???z'),('a????z'); +INSERT INTO t1 (ch) VALUES ('z'); +INSERT INTO t1 (ch) VALUES (_utf8 0x61D080); +INSERT INTO t1 (ch) VALUES (_utf8 0x61D680); +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; +ch +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; +ch +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; +ch +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; +ch +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; +ch +a +a? +a?? +a??? +a???? +a????b +a????z +a???b +a???z +a??b +a??z +a?b +a?z +ab +az +aЀ +aր +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; +ch +a +a? +a?? +a??? +a???? +a????b +a????z +a???b +a???z +a??b +a??z +a?b +a?z +ab +az +aЀ +aր +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; +ch +a +a? +a?? +a??? +a???? +a????b +a????z +a???b +a???z +a??b +a??z +a?b +a?z +ab +az +aЀ +aր +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; +ch +a +a? +a?? +a??? +a???? +a????b +a????z +a???b +a???z +a??b +a??z +a?b +a?z +ab +az +aЀ +aր +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; +ch +z +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; +ch +z +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; +ch +z +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; +ch +z +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 +ALTER TABLE t1 DROP KEY ch; +# 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,''''); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'b'''); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch<''a', 0xD1,''' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +a +a? +a?? +a??? +a???? +a????b +a????z +a???b +a???z +a??b +a??z +a?b +a?z +ab +az +aЀ +aր +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch>''a', 0xD1,''' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +z +# 0xEA9A96 would be a good 3-byte character, 0xEA9A is an incomplete sequence +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,''' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,'b'' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +# 0x8F is a bad byte sequence (an mb2tail without mb2head) +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F,''' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F,'b'' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +# 0x8F8F is a bad byte sequence (an mb2tail without mb2head, two times) +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F8F,''' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F8F,'b'' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +DROP TABLE t1; +# +# End of ctype_utf8_ilseq.inc +# +# +# Start of ctype_utf8_ilseq.inc +# +CREATE TABLE t1 ENGINE=HEAP AS SELECT REPEAT(' ', 60) AS ch LIMIT 0;; +ALTER TABLE t1 +ADD id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, +ADD KEY(ch); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `ch` varchar(60) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`), + KEY `ch` (`ch`) +) ENGINE=MEMORY DEFAULT CHARSET=latin1 +INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); +SELECT ch FROM t1 WHERE ch='admin𝌆'; +ch +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆'; +ch +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆'; +ch +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +DELETE FROM t1; +INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????'); +INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b'); +INSERT INTO t1 (ch) VALUES ('az'),('a?z'),('a??z'),('a???z'),('a????z'); +INSERT INTO t1 (ch) VALUES ('z'); +INSERT INTO t1 (ch) VALUES (_utf8 0x61D080); +INSERT INTO t1 (ch) VALUES (_utf8 0x61D680); +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; +ch +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; +ch +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; +ch +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; +ch +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; +ch +a +a? +a?? +a??? +a???? +a????b +a????z +a???b +a???z +a??b +a??z +a?b +a?z +ab +az +aЀ +aր +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; +ch +a +a? +a?? +a??? +a???? +a????b +a????z +a???b +a???z +a??b +a??z +a?b +a?z +ab +az +aЀ +aր +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL ch NULL NULL NULL # Using where; Using filesort +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; +ch +a +a? +a?? +a??? +a???? +a????b +a????z +a???b +a???z +a??b +a??z +a?b +a?z +ab +az +aЀ +aր +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL ch NULL NULL NULL # Using where; Using filesort +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; +ch +a +a? +a?? +a??? +a???? +a????b +a????z +a???b +a???z +a??b +a??z +a?b +a?z +ab +az +aЀ +aր +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; +ch +z +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; +ch +z +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL ch NULL NULL NULL # Using where; Using filesort +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; +ch +z +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL ch NULL NULL NULL # Using where; Using filesort +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; +ch +z +ALTER TABLE t1 DROP KEY ch; +# 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,''''); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'b'''); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch<''a', 0xD1,''' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +a +a? +a?? +a??? +a???? +a????b +a????z +a???b +a???z +a??b +a??z +a?b +a?z +ab +az +aЀ +aր +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch>''a', 0xD1,''' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +z +# 0xEA9A96 would be a good 3-byte character, 0xEA9A is an incomplete sequence +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,''' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,'b'' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +# 0x8F is a bad byte sequence (an mb2tail without mb2head) +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F,''' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F,'b'' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +# 0x8F8F is a bad byte sequence (an mb2tail without mb2head, two times) +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F8F,''' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F8F,'b'' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +DROP TABLE t1; +# +# End of ctype_utf8_ilseq.inc +# +# +# End of 5.5 tests +# +# +# Start of 5.6 tests +# +# +# WL#3664 WEIGHT_STRING +# +set collation_connection=ucs2_unicode_ci; +select @@collation_connection; +@@collation_connection +ucs2_unicode_ci +CREATE TABLE t1 AS SELECT 'a' AS a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(16) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a)) FROM t1; +HEX(WEIGHT_STRING(a)) +0E33 +SELECT HEX(ws) FROM t2; +HEX(ws) +0E33 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(5) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(80) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a)) FROM t1; +HEX(WEIGHT_STRING(a)) +0E330E330E330E330E33 +SELECT HEX(ws) FROM t2; +HEX(ws) +0E330E330E330E330E33 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(48) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(3))) +0E330E330E33 +SELECT HEX(ws) FROM t2; +HEX(ws) +0E330E330E33 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(160) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0E330E330E330E330E3302090209020902090209 +SELECT HEX(ws) FROM t2; +HEX(ws) +0E330E330E330E330E3302090209020902090209 +DROP TABLE t2; +DROP TABLE t1; +select hex(weight_string('a')); +hex(weight_string('a')) +0E33 +select hex(weight_string('A')); +hex(weight_string('A')) +0E33 +select hex(weight_string('abc')); +hex(weight_string('abc')) +0E330E4A0E60 +select hex(weight_string('abc' as char(2))); +hex(weight_string('abc' as char(2))) +0E330E4A +select hex(weight_string('abc' as char(3))); +hex(weight_string('abc' as char(3))) +0E330E4A0E60 +select hex(weight_string('abc' as char(5))); +hex(weight_string('abc' as char(5))) +0E330E4A0E6002090209 +select hex(weight_string('abc', 1, 2, 0xC0)); +hex(weight_string('abc', 1, 2, 0xC0)) +0E +select hex(weight_string('abc', 2, 2, 0xC0)); +hex(weight_string('abc', 2, 2, 0xC0)) +0E33 +select hex(weight_string('abc', 3, 2, 0xC0)); +hex(weight_string('abc', 3, 2, 0xC0)) +0E330E +select hex(weight_string('abc', 4, 2, 0xC0)); +hex(weight_string('abc', 4, 2, 0xC0)) +0E330E4A +select hex(weight_string('abc', 5, 2, 0xC0)); +hex(weight_string('abc', 5, 2, 0xC0)) +0E330E4A02 +select hex(weight_string('abc',25, 2, 0xC0)); +hex(weight_string('abc',25, 2, 0xC0)) +0E330E4A020902090209020902090209020902090209020902 +select hex(weight_string('abc', 1, 3, 0xC0)); +hex(weight_string('abc', 1, 3, 0xC0)) +0E +select hex(weight_string('abc', 2, 3, 0xC0)); +hex(weight_string('abc', 2, 3, 0xC0)) +0E33 +select hex(weight_string('abc', 3, 3, 0xC0)); +hex(weight_string('abc', 3, 3, 0xC0)) +0E330E +select hex(weight_string('abc', 4, 3, 0xC0)); +hex(weight_string('abc', 4, 3, 0xC0)) +0E330E4A +select hex(weight_string('abc', 5, 3, 0xC0)); +hex(weight_string('abc', 5, 3, 0xC0)) +0E330E4A0E +select hex(weight_string('abc',25, 3, 0xC0)); +hex(weight_string('abc',25, 3, 0xC0)) +0E330E4A0E6002090209020902090209020902090209020902 +select hex(weight_string('abc', 1, 4, 0xC0)); +hex(weight_string('abc', 1, 4, 0xC0)) +0E +select hex(weight_string('abc', 2, 4, 0xC0)); +hex(weight_string('abc', 2, 4, 0xC0)) +0E33 +select hex(weight_string('abc', 3, 4, 0xC0)); +hex(weight_string('abc', 3, 4, 0xC0)) +0E330E +select hex(weight_string('abc', 4, 4, 0xC0)); +hex(weight_string('abc', 4, 4, 0xC0)) +0E330E4A +select hex(weight_string('abc', 5, 4, 0xC0)); +hex(weight_string('abc', 5, 4, 0xC0)) +0E330E4A0E +select hex(weight_string('abc',25, 4, 0xC0)); +hex(weight_string('abc',25, 4, 0xC0)) +0E330E4A0E6002090209020902090209020902090209020902 +select @@collation_connection; +@@collation_connection +ucs2_unicode_ci +select hex(weight_string(cast(_latin1 0x80 as char))); +hex(weight_string(cast(_latin1 0x80 as char))) +0E23 +select hex(weight_string(cast(_latin1 0x808080 as char))); +hex(weight_string(cast(_latin1 0x808080 as char))) +0E230E230E23 +select hex(weight_string(cast(_latin1 0x808080 as char) as char(2))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(2))) +0E230E23 +select hex(weight_string(cast(_latin1 0x808080 as char) as char(3))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(3))) +0E230E230E23 +select hex(weight_string(cast(_latin1 0x808080 as char) as char(5))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(5))) +0E230E230E2302090209 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0)) +0E +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0)) +0E23 +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0)) +0E230E +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0)) +0E230E23 +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0)) +0E230E2302 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0)) +0E230E23020902090209020902090209020902090209020902 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0)) +0E +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0)) +0E23 +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0)) +0E230E +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0)) +0E230E23 +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0)) +0E230E230E +select hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0)) +0E230E230E2302090209020902090209020902090209020902 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0)) +0E +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0)) +0E23 +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0)) +0E230E +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0)) +0E230E23 +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0)) +0E230E230E +select hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0)) +0E230E230E2302090209020902090209020902090209020902 +select @@collation_connection; +@@collation_connection +ucs2_unicode_ci +select hex(weight_string('a' LEVEL 1)); +hex(weight_string('a' LEVEL 1)) +0E33 +select hex(weight_string('A' LEVEL 1)); +hex(weight_string('A' LEVEL 1)) +0E33 +select hex(weight_string('abc' LEVEL 1)); +hex(weight_string('abc' LEVEL 1)) +0E330E4A0E60 +select hex(weight_string('abc' as char(2) LEVEL 1)); +hex(weight_string('abc' as char(2) LEVEL 1)) +0E330E4A +select hex(weight_string('abc' as char(3) LEVEL 1)); +hex(weight_string('abc' as char(3) LEVEL 1)) +0E330E4A0E60 +select hex(weight_string('abc' as char(5) LEVEL 1)); +hex(weight_string('abc' as char(5) LEVEL 1)) +0E330E4A0E6002090209 +select hex(weight_string('abc' as char(5) LEVEL 1 REVERSE)); +hex(weight_string('abc' as char(5) LEVEL 1 REVERSE)) +09020902600E4A0E330E +select hex(weight_string('abc' as char(5) LEVEL 1 DESC)); +hex(weight_string('abc' as char(5) LEVEL 1 DESC)) +F1CCF1B5F19FFDF6FDF6 +select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE)); +hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE)) +F6FDF6FD9FF1B5F1CCF1 +set @@collation_connection=utf8_unicode_ci; +select @@collation_connection; +@@collation_connection +utf8_unicode_ci +CREATE TABLE t1 AS SELECT 'a' AS a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(16) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a)) FROM t1; +HEX(WEIGHT_STRING(a)) +0E33 +SELECT HEX(ws) FROM t2; +HEX(ws) +0E33 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(5) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(80) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a)) FROM t1; +HEX(WEIGHT_STRING(a)) +0E330E330E330E330E33 +SELECT HEX(ws) FROM t2; +HEX(ws) +0E330E330E330E330E33 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(48) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(3))) +0E330E330E33 +SELECT HEX(ws) FROM t2; +HEX(ws) +0E330E330E33 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(160) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0E330E330E330E330E3302090209020902090209 +SELECT HEX(ws) FROM t2; +HEX(ws) +0E330E330E330E330E3302090209020902090209 +DROP TABLE t2; +DROP TABLE t1; +select hex(weight_string('a')); +hex(weight_string('a')) +0E33 +select hex(weight_string('A')); +hex(weight_string('A')) +0E33 +select hex(weight_string('abc')); +hex(weight_string('abc')) +0E330E4A0E60 +select hex(weight_string('abc' as char(2))); +hex(weight_string('abc' as char(2))) +0E330E4A +select hex(weight_string('abc' as char(3))); +hex(weight_string('abc' as char(3))) +0E330E4A0E60 +select hex(weight_string('abc' as char(5))); +hex(weight_string('abc' as char(5))) +0E330E4A0E6002090209 +select hex(weight_string('abc', 1, 2, 0xC0)); +hex(weight_string('abc', 1, 2, 0xC0)) +0E +select hex(weight_string('abc', 2, 2, 0xC0)); +hex(weight_string('abc', 2, 2, 0xC0)) +0E33 +select hex(weight_string('abc', 3, 2, 0xC0)); +hex(weight_string('abc', 3, 2, 0xC0)) +0E330E +select hex(weight_string('abc', 4, 2, 0xC0)); +hex(weight_string('abc', 4, 2, 0xC0)) +0E330E4A +select hex(weight_string('abc', 5, 2, 0xC0)); +hex(weight_string('abc', 5, 2, 0xC0)) +0E330E4A02 +select hex(weight_string('abc',25, 2, 0xC0)); +hex(weight_string('abc',25, 2, 0xC0)) +0E330E4A020902090209020902090209020902090209020902 +select hex(weight_string('abc', 1, 3, 0xC0)); +hex(weight_string('abc', 1, 3, 0xC0)) +0E +select hex(weight_string('abc', 2, 3, 0xC0)); +hex(weight_string('abc', 2, 3, 0xC0)) +0E33 +select hex(weight_string('abc', 3, 3, 0xC0)); +hex(weight_string('abc', 3, 3, 0xC0)) +0E330E +select hex(weight_string('abc', 4, 3, 0xC0)); +hex(weight_string('abc', 4, 3, 0xC0)) +0E330E4A +select hex(weight_string('abc', 5, 3, 0xC0)); +hex(weight_string('abc', 5, 3, 0xC0)) +0E330E4A0E +select hex(weight_string('abc',25, 3, 0xC0)); +hex(weight_string('abc',25, 3, 0xC0)) +0E330E4A0E6002090209020902090209020902090209020902 +select hex(weight_string('abc', 1, 4, 0xC0)); +hex(weight_string('abc', 1, 4, 0xC0)) +0E +select hex(weight_string('abc', 2, 4, 0xC0)); +hex(weight_string('abc', 2, 4, 0xC0)) +0E33 +select hex(weight_string('abc', 3, 4, 0xC0)); +hex(weight_string('abc', 3, 4, 0xC0)) +0E330E +select hex(weight_string('abc', 4, 4, 0xC0)); +hex(weight_string('abc', 4, 4, 0xC0)) +0E330E4A +select hex(weight_string('abc', 5, 4, 0xC0)); +hex(weight_string('abc', 5, 4, 0xC0)) +0E330E4A0E +select hex(weight_string('abc',25, 4, 0xC0)); +hex(weight_string('abc',25, 4, 0xC0)) +0E330E4A0E6002090209020902090209020902090209020902 +select @@collation_connection; +@@collation_connection +utf8_unicode_ci +select hex(weight_string(cast(_latin1 0x80 as char))); +hex(weight_string(cast(_latin1 0x80 as char))) +0E23 +select hex(weight_string(cast(_latin1 0x808080 as char))); +hex(weight_string(cast(_latin1 0x808080 as char))) +0E230E230E23 +select hex(weight_string(cast(_latin1 0x808080 as char) as char(2))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(2))) +0E230E23 +select hex(weight_string(cast(_latin1 0x808080 as char) as char(3))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(3))) +0E230E230E23 +select hex(weight_string(cast(_latin1 0x808080 as char) as char(5))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(5))) +0E230E230E2302090209 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0)) +0E +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0)) +0E23 +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0)) +0E230E +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0)) +0E230E23 +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0)) +0E230E2302 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0)) +0E230E23020902090209020902090209020902090209020902 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0)) +0E +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0)) +0E23 +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0)) +0E230E +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0)) +0E230E23 +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0)) +0E230E230E +select hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0)) +0E230E230E2302090209020902090209020902090209020902 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0)) +0E +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0)) +0E23 +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0)) +0E230E +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0)) +0E230E23 +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0)) +0E230E230E +select hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0)) +0E230E230E2302090209020902090209020902090209020902 +select @@collation_connection; +@@collation_connection +utf8_unicode_ci +select hex(weight_string('a' LEVEL 1)); +hex(weight_string('a' LEVEL 1)) +0E33 +select hex(weight_string('A' LEVEL 1)); +hex(weight_string('A' LEVEL 1)) +0E33 +select hex(weight_string('abc' LEVEL 1)); +hex(weight_string('abc' LEVEL 1)) +0E330E4A0E60 +select hex(weight_string('abc' as char(2) LEVEL 1)); +hex(weight_string('abc' as char(2) LEVEL 1)) +0E330E4A +select hex(weight_string('abc' as char(3) LEVEL 1)); +hex(weight_string('abc' as char(3) LEVEL 1)) +0E330E4A0E60 +select hex(weight_string('abc' as char(5) LEVEL 1)); +hex(weight_string('abc' as char(5) LEVEL 1)) +0E330E4A0E6002090209 +select hex(weight_string('abc' as char(5) LEVEL 1 REVERSE)); +hex(weight_string('abc' as char(5) LEVEL 1 REVERSE)) +09020902600E4A0E330E +select hex(weight_string('abc' as char(5) LEVEL 1 DESC)); +hex(weight_string('abc' as char(5) LEVEL 1 DESC)) +F1CCF1B5F19FFDF6FDF6 +select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE)); +hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE)) +F6FDF6FD9FF1B5F1CCF1 +set @@collation_connection=utf8_czech_ci; +select @@collation_connection; +@@collation_connection +utf8_czech_ci +select collation(cast(_latin1 0xDF as char)); +collation(cast(_latin1 0xDF as char)) +utf8_czech_ci +select hex(weight_string('s')); +hex(weight_string('s')) +0FEA +select hex(weight_string(cast(_latin1 0xDF as char))); +hex(weight_string(cast(_latin1 0xDF as char))) +0FEA0FEA +select hex(weight_string(cast(_latin1 0xDF as char) as char(1))); +hex(weight_string(cast(_latin1 0xDF as char) as char(1))) +0FEA +select hex(weight_string('c')); +hex(weight_string('c')) +0E60 +select hex(weight_string('h')); +hex(weight_string('h')) +0EE1 +select hex(weight_string('ch')); +hex(weight_string('ch')) +0EE2 +select hex(weight_string('i')); +hex(weight_string('i')) +0EFB +select hex(weight_string(cast(_latin1 0x6368DF as char))); +hex(weight_string(cast(_latin1 0x6368DF as char))) +0EE20FEA0FEA +select hex(weight_string(cast(_latin1 0x6368DF as char) as char(1))); +hex(weight_string(cast(_latin1 0x6368DF as char) as char(1))) +0EE2 +select hex(weight_string(cast(_latin1 0x6368DF as char) as char(2))); +hex(weight_string(cast(_latin1 0x6368DF as char) as char(2))) +0EE20FEA +select hex(weight_string(cast(_latin1 0x6368DF as char) as char(3))); +hex(weight_string(cast(_latin1 0x6368DF as char) as char(3))) +0EE20FEA0FEA +select hex(weight_string(cast(_latin1 0x6368DF as char) as char(4))); +hex(weight_string(cast(_latin1 0x6368DF as char) as char(4))) +0EE20FEA0FEA0209 +select hex(weight_string(cast(_latin1 0xDF6368 as char))); +hex(weight_string(cast(_latin1 0xDF6368 as char))) +0FEA0FEA0EE2 +select hex(weight_string(cast(_latin1 0xDF6368 as char) as char(1))); +hex(weight_string(cast(_latin1 0xDF6368 as char) as char(1))) +0FEA +select hex(weight_string(cast(_latin1 0xDF6368 as char) as char(2))); +hex(weight_string(cast(_latin1 0xDF6368 as char) as char(2))) +0FEA0FEA +select hex(weight_string(cast(_latin1 0xDF6368 as char) as char(3))); +hex(weight_string(cast(_latin1 0xDF6368 as char) as char(3))) +0FEA0FEA0EE2 +select hex(weight_string(cast(_latin1 0xDF6368 as char) as char(4))); +hex(weight_string(cast(_latin1 0xDF6368 as char) as char(4))) +0FEA0FEA0EE20209 +select hex(weight_string(cast(_latin1 0x6368DF as char), 1, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char), 1, 2, 0xC0)) +0E +select hex(weight_string(cast(_latin1 0x6368DF as char), 2, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char), 2, 2, 0xC0)) +0EE2 +select hex(weight_string(cast(_latin1 0x6368DF as char), 3, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char), 3, 2, 0xC0)) +0EE20F +select hex(weight_string(cast(_latin1 0x6368DF as char), 4, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char), 4, 2, 0xC0)) +0EE20FEA +select hex(weight_string(cast(_latin1 0x6368DF as char),25, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char),25, 2, 0xC0)) +0EE20FEA020902090209020902090209020902090209020902 +select hex(weight_string(cast(_latin1 0x6368DF as char), 1, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char), 1, 3, 0xC0)) +0E +select hex(weight_string(cast(_latin1 0x6368DF as char), 2, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char), 2, 3, 0xC0)) +0EE2 +select hex(weight_string(cast(_latin1 0x6368DF as char), 3, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char), 3, 3, 0xC0)) +0EE20F +select hex(weight_string(cast(_latin1 0x6368DF as char), 4, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char), 4, 3, 0xC0)) +0EE20FEA +select hex(weight_string(cast(_latin1 0x6368DF as char),25, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char),25, 3, 0xC0)) +0EE20FEA0FEA02090209020902090209020902090209020902 +select hex(weight_string(cast(_latin1 0x6368DF as char), 1, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char), 1, 4, 0xC0)) +0E +select hex(weight_string(cast(_latin1 0x6368DF as char), 2, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char), 2, 4, 0xC0)) +0EE2 +select hex(weight_string(cast(_latin1 0x6368DF as char), 3, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char), 3, 4, 0xC0)) +0EE20F +select hex(weight_string(cast(_latin1 0x6368DF as char), 4, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char), 4, 4, 0xC0)) +0EE20FEA +select hex(weight_string(cast(_latin1 0x6368DF as char),25, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char),25, 4, 0xC0)) +0EE20FEA0FEA02090209020902090209020902090209020902 +select hex(weight_string(cast(_latin1 0xDF6368 as char), 1, 2,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char), 1, 2,0xC0)) +0F +select hex(weight_string(cast(_latin1 0xDF6368 as char), 2, 2,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char), 2, 2,0xC0)) +0FEA +select hex(weight_string(cast(_latin1 0xDF6368 as char), 3, 2,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char), 3, 2,0xC0)) +0FEA0F +select hex(weight_string(cast(_latin1 0xDF6368 as char), 4, 2,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char), 4, 2,0xC0)) +0FEA0FEA +select hex(weight_string(cast(_latin1 0xDF6368 as char),25, 2,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char),25, 2,0xC0)) +0FEA0FEA020902090209020902090209020902090209020902 +select hex(weight_string(cast(_latin1 0xDF6368 as char), 1, 3,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char), 1, 3,0xC0)) +0F +select hex(weight_string(cast(_latin1 0xDF6368 as char), 2, 3,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char), 2, 3,0xC0)) +0FEA +select hex(weight_string(cast(_latin1 0xDF6368 as char), 3, 3,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char), 3, 3,0xC0)) +0FEA0F +select hex(weight_string(cast(_latin1 0xDF6368 as char), 4, 3,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char), 4, 3,0xC0)) +0FEA0FEA +select hex(weight_string(cast(_latin1 0xDF6368 as char),25, 3,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char),25, 3,0xC0)) +0FEA0FEA0EE202090209020902090209020902090209020902 +select hex(weight_string(cast(_latin1 0xDF6368 as char), 1, 4,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char), 1, 4,0xC0)) +0F +select hex(weight_string(cast(_latin1 0xDF6368 as char), 2, 4,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char), 2, 4,0xC0)) +0FEA +select hex(weight_string(cast(_latin1 0xDF6368 as char), 3, 4,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char), 3, 4,0xC0)) +0FEA0F +select hex(weight_string(cast(_latin1 0xDF6368 as char), 4, 4,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char), 4, 4,0xC0)) +0FEA0FEA +select hex(weight_string(cast(_latin1 0xDF6368 as char),25, 4,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char),25, 4,0xC0)) +0FEA0FEA0EE202090209020902090209020902090209020902 +set @@collation_connection=ucs2_czech_ci; +select @@collation_connection; +@@collation_connection +ucs2_czech_ci +select collation(cast(_latin1 0xDF as char)); +collation(cast(_latin1 0xDF as char)) +ucs2_czech_ci +select hex(weight_string('s')); +hex(weight_string('s')) +0FEA +select hex(weight_string(cast(_latin1 0xDF as char))); +hex(weight_string(cast(_latin1 0xDF as char))) +0FEA0FEA +select hex(weight_string(cast(_latin1 0xDF as char) as char(1))); +hex(weight_string(cast(_latin1 0xDF as char) as char(1))) +0FEA +select hex(weight_string('c')); +hex(weight_string('c')) +0E60 +select hex(weight_string('h')); +hex(weight_string('h')) +0EE1 +select hex(weight_string('ch')); +hex(weight_string('ch')) +0EE2 +select hex(weight_string('i')); +hex(weight_string('i')) +0EFB +select hex(weight_string(cast(_latin1 0x6368DF as char))); +hex(weight_string(cast(_latin1 0x6368DF as char))) +0EE20FEA0FEA +select hex(weight_string(cast(_latin1 0x6368DF as char) as char(1))); +hex(weight_string(cast(_latin1 0x6368DF as char) as char(1))) +0EE2 +select hex(weight_string(cast(_latin1 0x6368DF as char) as char(2))); +hex(weight_string(cast(_latin1 0x6368DF as char) as char(2))) +0EE20FEA +select hex(weight_string(cast(_latin1 0x6368DF as char) as char(3))); +hex(weight_string(cast(_latin1 0x6368DF as char) as char(3))) +0EE20FEA0FEA +select hex(weight_string(cast(_latin1 0x6368DF as char) as char(4))); +hex(weight_string(cast(_latin1 0x6368DF as char) as char(4))) +0EE20FEA0FEA0209 +select hex(weight_string(cast(_latin1 0xDF6368 as char))); +hex(weight_string(cast(_latin1 0xDF6368 as char))) +0FEA0FEA0EE2 +select hex(weight_string(cast(_latin1 0xDF6368 as char) as char(1))); +hex(weight_string(cast(_latin1 0xDF6368 as char) as char(1))) +0FEA +select hex(weight_string(cast(_latin1 0xDF6368 as char) as char(2))); +hex(weight_string(cast(_latin1 0xDF6368 as char) as char(2))) +0FEA0FEA +select hex(weight_string(cast(_latin1 0xDF6368 as char) as char(3))); +hex(weight_string(cast(_latin1 0xDF6368 as char) as char(3))) +0FEA0FEA0EE2 +select hex(weight_string(cast(_latin1 0xDF6368 as char) as char(4))); +hex(weight_string(cast(_latin1 0xDF6368 as char) as char(4))) +0FEA0FEA0EE20209 +select hex(weight_string(cast(_latin1 0x6368DF as char), 1, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char), 1, 2, 0xC0)) +0E +select hex(weight_string(cast(_latin1 0x6368DF as char), 2, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char), 2, 2, 0xC0)) +0EE2 +select hex(weight_string(cast(_latin1 0x6368DF as char), 3, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char), 3, 2, 0xC0)) +0EE20F +select hex(weight_string(cast(_latin1 0x6368DF as char), 4, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char), 4, 2, 0xC0)) +0EE20FEA +select hex(weight_string(cast(_latin1 0x6368DF as char),25, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char),25, 2, 0xC0)) +0EE20FEA020902090209020902090209020902090209020902 +select hex(weight_string(cast(_latin1 0x6368DF as char), 1, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char), 1, 3, 0xC0)) +0E +select hex(weight_string(cast(_latin1 0x6368DF as char), 2, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char), 2, 3, 0xC0)) +0EE2 +select hex(weight_string(cast(_latin1 0x6368DF as char), 3, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char), 3, 3, 0xC0)) +0EE20F +select hex(weight_string(cast(_latin1 0x6368DF as char), 4, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char), 4, 3, 0xC0)) +0EE20FEA +select hex(weight_string(cast(_latin1 0x6368DF as char),25, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char),25, 3, 0xC0)) +0EE20FEA0FEA02090209020902090209020902090209020902 +select hex(weight_string(cast(_latin1 0x6368DF as char), 1, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char), 1, 4, 0xC0)) +0E +select hex(weight_string(cast(_latin1 0x6368DF as char), 2, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char), 2, 4, 0xC0)) +0EE2 +select hex(weight_string(cast(_latin1 0x6368DF as char), 3, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char), 3, 4, 0xC0)) +0EE20F +select hex(weight_string(cast(_latin1 0x6368DF as char), 4, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char), 4, 4, 0xC0)) +0EE20FEA +select hex(weight_string(cast(_latin1 0x6368DF as char),25, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x6368DF as char),25, 4, 0xC0)) +0EE20FEA0FEA02090209020902090209020902090209020902 +select hex(weight_string(cast(_latin1 0xDF6368 as char), 1, 2,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char), 1, 2,0xC0)) +0F +select hex(weight_string(cast(_latin1 0xDF6368 as char), 2, 2,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char), 2, 2,0xC0)) +0FEA +select hex(weight_string(cast(_latin1 0xDF6368 as char), 3, 2,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char), 3, 2,0xC0)) +0FEA0F +select hex(weight_string(cast(_latin1 0xDF6368 as char), 4, 2,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char), 4, 2,0xC0)) +0FEA0FEA +select hex(weight_string(cast(_latin1 0xDF6368 as char),25, 2,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char),25, 2,0xC0)) +0FEA0FEA020902090209020902090209020902090209020902 +select hex(weight_string(cast(_latin1 0xDF6368 as char), 1, 3,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char), 1, 3,0xC0)) +0F +select hex(weight_string(cast(_latin1 0xDF6368 as char), 2, 3,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char), 2, 3,0xC0)) +0FEA +select hex(weight_string(cast(_latin1 0xDF6368 as char), 3, 3,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char), 3, 3,0xC0)) +0FEA0F +select hex(weight_string(cast(_latin1 0xDF6368 as char), 4, 3,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char), 4, 3,0xC0)) +0FEA0FEA +select hex(weight_string(cast(_latin1 0xDF6368 as char),25, 3,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char),25, 3,0xC0)) +0FEA0FEA0EE202090209020902090209020902090209020902 +select hex(weight_string(cast(_latin1 0xDF6368 as char), 1, 4,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char), 1, 4,0xC0)) +0F +select hex(weight_string(cast(_latin1 0xDF6368 as char), 2, 4,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char), 2, 4,0xC0)) +0FEA +select hex(weight_string(cast(_latin1 0xDF6368 as char), 3, 4,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char), 3, 4,0xC0)) +0FEA0F +select hex(weight_string(cast(_latin1 0xDF6368 as char), 4, 4,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char), 4, 4,0xC0)) +0FEA0FEA +select hex(weight_string(cast(_latin1 0xDF6368 as char),25, 4,0xC0)); +hex(weight_string(cast(_latin1 0xDF6368 as char),25, 4,0xC0)) +0FEA0FEA0EE202090209020902090209020902090209020902 +# +# Bug#33077 weight of supplementary characters is not 0xfffd +# +select hex(weight_string(_utf8mb4 0xF0908080 /* U+10000 */ collate utf8mb4_unicode_ci)); +hex(weight_string(_utf8mb4 0xF0908080 /* U+10000 */ collate utf8mb4_unicode_ci)) +FFFD +# +# Bug#53064 garbled data when using utf8_german2_ci collation +# +CREATE TABLE t1 (s1 VARCHAR(10) COLLATE utf8_german2_ci); +INSERT INTO t1 VALUES ('a'),('ae'),('af'); +SELECT s1,hex(s1),hex(weight_string(s1)) FROM t1 ORDER BY s1; +s1 hex(s1) hex(weight_string(s1)) +a 61 0E33 +ae 6165 0E330E8B +af 6166 0E330EB9 +DROP TABLE t1; +# +# WL#4013 Unicode german2 collation +# +SET collation_connection=utf8_german2_ci; +"BEGIN ctype_german.inc" +drop table if exists t1; +create table t1 as select repeat(' ', 64) as s1; +select collation(s1) from t1; +collation(s1) +utf8_german2_ci +delete from t1; +INSERT INTO t1 VALUES ('ud'),('uf'); +INSERT INTO t1 VALUES ('od'),('of'); +INSERT INTO t1 VALUES ('e'); +INSERT INTO t1 VALUES ('ad'),('af'); +insert into t1 values ('a'),('ae'),(_latin1 0xE4); +insert into t1 values ('o'),('oe'),(_latin1 0xF6); +insert into t1 values ('s'),('ss'),(_latin1 0xDF); +insert into t1 values ('u'),('ue'),(_latin1 0xFC); +INSERT INTO t1 VALUES (_latin1 0xE6), (_latin1 0xC6); +INSERT INTO t1 VALUES (_latin1 0x9C), (_latin1 0x8C); +select s1, hex(s1) from t1 order by s1, binary s1; +s1 hex(s1) +a 61 +ad 6164 +ae 6165 +Æ C386 +ä C3A4 +æ C3A6 +af 6166 +e 65 +o 6F +od 6F64 +oe 6F65 +ö C3B6 +Œ C592 +œ C593 +of 6F66 +s 73 +ss 7373 +ß C39F +u 75 +ud 7564 +ue 7565 +ü C3BC +uf 7566 +select group_concat(s1 order by binary s1) from t1 group by s1; +group_concat(s1 order by binary s1) +a +ad +ae,Æ,ä,æ +af +e +o +od +oe,ö,Œ,œ +of +s +ss,ß +u +ud +ue,ü +uf +SELECT s1, hex(s1), hex(weight_string(s1)) FROM t1 ORDER BY s1, BINARY(s1); +s1 hex(s1) hex(weight_string(s1)) +a 61 0E33 +ad 6164 0E330E6D +ae 6165 0E330E8B +Æ C386 0E330E8B +ä C3A4 0E330E8B +æ C3A6 0E330E8B +af 6166 0E330EB9 +e 65 0E8B +o 6F 0F82 +od 6F64 0F820E6D +oe 6F65 0F820E8B +ö C3B6 0F820E8B +Œ C592 0F820E8B +œ C593 0F820E8B +of 6F66 0F820EB9 +s 73 0FEA +ss 7373 0FEA0FEA +ß C39F 0FEA0FEA +u 75 101F +ud 7564 101F0E6D +ue 7565 101F0E8B +ü C3BC 101F0E8B +uf 7566 101F0EB9 +SELECT s1, hex(s1) FROM t1 WHERE s1='ae' ORDER BY s1, BINARY(s1); +s1 hex(s1) +ae 6165 +Æ C386 +ä C3A4 +æ C3A6 +drop table t1; +CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1) CHARACTER SET utf8 COLLATE utf8_german2_ci DEFAULT NULL, + `b` int(1) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); +SELECT * FROM t1 ORDER BY a, b; +a b +s 0 +ß 1 +SELECT * FROM t1 ORDER BY a DESC, b; +a b +ß 1 +s 0 +SELECT * FROM t1 ORDER BY CONCAT(a), b; +a b +s 0 +ß 1 +SELECT * FROM t1 ORDER BY CONCAT(a) DESC, b; +a b +ß 1 +s 0 +DROP TABLE t1; +"END ctype_german.inc" +# +# WL#2673 Unicode Collation Algorithm new version +# +SET NAMES utf8mb4 COLLATE utf8mb4_unicode_520_ci; +CREATE TABLE t1 AS SELECT repeat('a', 10) as c LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (_utf32 0x0180),(_utf32 0x023A); +INSERT INTO t1 VALUES (_utf32 0x023B),(_utf32 0x023C); +INSERT INTO t1 VALUES (_utf32 0x023D),(_utf32 0x023E); +INSERT INTO t1 VALUES (_utf32 0x0241),(_utf32 0x0242); +INSERT INTO t1 VALUES (_utf32 0x0243),(_utf32 0x0244); +INSERT INTO t1 VALUES (_utf32 0x0245),(_utf32 0x0246); +INSERT INTO t1 VALUES (_utf32 0x0247),(_utf32 0x0248); +INSERT INTO t1 VALUES (_utf32 0x0249),(_utf32 0x024A); +INSERT INTO t1 VALUES (_utf32 0x024B),(_utf32 0x024C); +INSERT INTO t1 VALUES (_utf32 0x024D),(_utf32 0x024E); +INSERT INTO t1 VALUES (_utf32 0x024F),(_utf32 0x026B); +INSERT INTO t1 VALUES (_utf32 0x027D),(_utf32 0x0289); +INSERT INTO t1 VALUES (_utf32 0x028C); +INSERT INTO t1 VALUES (_utf32 0x037B), (_utf32 0x037C); +INSERT INTO t1 VALUES (_utf32 0x037D), (_utf32 0x03FD); +INSERT INTO t1 VALUES (_utf32 0x03FE), (_utf32 0x03FF); +INSERT INTO t1 VALUES (_utf32 0x04C0), (_utf32 0x04CF); +INSERT INTO t1 VALUES (_utf32 0x04F6), (_utf32 0x04F7); +INSERT INTO t1 VALUES (_utf32 0x04FA), (_utf32 0x04FB); +INSERT INTO t1 VALUES (_utf32 0x04FC), (_utf32 0x04FD); +INSERT INTO t1 VALUES (_utf32 0x04FE), (_utf32 0x04FF); +INSERT INTO t1 VALUES (_utf32 0x0510), (_utf32 0x0511); +INSERT INTO t1 VALUES (_utf32 0x0512), (_utf32 0x0513); +INSERT INTO t1 VALUES (_utf32 0x10A0), (_utf32 0x10A1); +INSERT INTO t1 VALUES (_utf32 0x10A2), (_utf32 0x10A3); +INSERT INTO t1 VALUES (_utf32 0x10A4), (_utf32 0x10A5); +INSERT INTO t1 VALUES (_utf32 0x10A6), (_utf32 0x10A7); +INSERT INTO t1 VALUES (_utf32 0x2D00), (_utf32 0x2D01); +INSERT INTO t1 VALUES (_utf32 0x2D02), (_utf32 0x2D03); +INSERT INTO t1 VALUES (_utf32 0x2D04), (_utf32 0x2D05); +INSERT INTO t1 VALUES (_utf32 0x2D06), (_utf32 0x2D07); +INSERT INTO t1 VALUES (_utf32 0x1D7D); +INSERT INTO t1 VALUES (_utf32 0x2132),(_utf32 0x214E); +INSERT INTO t1 VALUES (_utf32 0x2183),(_utf32 0x2184); +INSERT INTO t1 VALUES (_utf32 0x2C80), (_utf32 0x2C81); +INSERT INTO t1 VALUES (_utf32 0x2C82), (_utf32 0x2C83); +INSERT INTO t1 VALUES (_utf32 0x2C84), (_utf32 0x2C85); +INSERT INTO t1 VALUES (_utf32 0x2C86), (_utf32 0x2C87); +INSERT INTO t1 VALUES (_utf32 0x2C88), (_utf32 0x2C89); +INSERT INTO t1 VALUES (_utf32 0x2C8A), (_utf32 0x2C8B); +INSERT INTO t1 VALUES (_utf32 0x2C8C), (_utf32 0x2C8D); +INSERT INTO t1 VALUES (_utf32 0x2C8E), (_utf32 0x2C8F); +INSERT INTO t1 VALUES (_utf32 0x2C60), (_utf32 0x2C61); +INSERT INTO t1 VALUES (_utf32 0x2C62), (_utf32 0x2C63); +INSERT INTO t1 VALUES (_utf32 0x2C64), (_utf32 0x2C65); +INSERT INTO t1 VALUES (_utf32 0x2C66), (_utf32 0x2C67); +INSERT INTO t1 VALUES (_utf32 0x2C68), (_utf32 0x2C69); +INSERT INTO t1 VALUES (_utf32 0x2C6A), (_utf32 0x2C6B); +INSERT INTO t1 VALUES (_utf32 0x2C6C), (_utf32 0x2C75); +INSERT INTO t1 VALUES (_utf32 0x2C76); +INSERT INTO t1 VALUES (_utf32 0x2C00), (_utf32 0x2C01); +INSERT INTO t1 VALUES (_utf32 0x2C02), (_utf32 0x2C03); +INSERT INTO t1 VALUES (_utf32 0x2C04), (_utf32 0x2C05); +INSERT INTO t1 VALUES (_utf32 0x2C06), (_utf32 0x2C07); +INSERT INTO t1 VALUES (_utf32 0x2C30), (_utf32 0x2C31); +INSERT INTO t1 VALUES (_utf32 0x2C32), (_utf32 0x2C33); +INSERT INTO t1 VALUES (_utf32 0x2C34), (_utf32 0x2C35); +INSERT INTO t1 VALUES (_utf32 0x2C36), (_utf32 0x2C37); +INSERT INTO t1 VALUES (_utf32 0x10400), (_utf32 0x10401); +INSERT INTO t1 VALUES (_utf32 0x10402), (_utf32 0x10403); +INSERT INTO t1 VALUES (_utf32 0x10404), (_utf32 0x10405); +INSERT INTO t1 VALUES (_utf32 0x10406), (_utf32 0x10407); +INSERT INTO t1 VALUES (_utf32 0x10428), (_utf32 0x10429); +INSERT INTO t1 VALUES (_utf32 0x1042A), (_utf32 0x1042B); +INSERT INTO t1 VALUES (_utf32 0x1042C), (_utf32 0x1042D); +INSERT INTO t1 VALUES (_utf32 0x1042E), (_utf32 0x1042F); +INSERT INTO t1 VALUES (_utf32 0x0370); +INSERT INTO t1 VALUES (_utf32 0x0371); +INSERT INTO t1 VALUES (_utf32 0x0372); +INSERT INTO t1 VALUES (_utf32 0x0373); +INSERT INTO t1 VALUES (_utf32 0x0514); +INSERT INTO t1 VALUES (_utf32 0x0515); +INSERT INTO t1 VALUES (_utf32 0x0516); +INSERT INTO t1 VALUES (_utf32 0x0517); +INSERT INTO t1 VALUES (_utf32 0xA640); +INSERT INTO t1 VALUES (_utf32 0xA641); +INSERT INTO t1 VALUES (_utf32 0xA642); +INSERT INTO t1 VALUES (_utf32 0xA643); +INSERT INTO t1 VALUES (_utf32 0xA722); +INSERT INTO t1 VALUES (_utf32 0xA723); +INSERT INTO t1 VALUES (_utf32 0xA724); +INSERT INTO t1 VALUES (_utf32 0xA725); +INSERT INTO t1 VALUES (_utf32 0xA726); +INSERT INTO t1 VALUES (_utf32 0xA727); +INSERT INTO t1 VALUES (_utf32 0xA728); +INSERT INTO t1 VALUES (_utf32 0xA729); +INSERT INTO t1 VALUES (_utf32 0xA72A); +INSERT INTO t1 VALUES (_utf32 0xA72B); +INSERT INTO t1 VALUES (_utf32 0x2CEB); +INSERT INTO t1 VALUES (_utf32 0x2CEC); +INSERT INTO t1 VALUES (_utf32 0x2CED); +INSERT INTO t1 VALUES (_utf32 0x2CEE); +SELECT hex(c), hex(lower(c)), hex(upper(c)), hex(weight_string(c)), c +FROM t1 ORDER BY c, BINARY c; +hex(c) hex(lower(c)) hex(upper(c)) hex(weight_string(c)) c +C8BA C8BA 1214 Ⱥ +E2B1A5 E2B1A5 C8BA 1214 ⱥ +C680 C680 C983 122D ƀ +C983 C680 C983 122D Ƀ +C8BB C8BC C8BB 1242 Ȼ +C8BC C8BC C8BB 1242 ȼ +E28683 E28684 E28683 124E Ↄ +E28684 E28684 E28683 124E ↄ +C986 C987 C986 1270 Ɇ +C987 C987 C986 1270 ɇ +E284B2 E2858E E284B2 12AE Ⅎ +E2858E E2858E E284B2 12AE ⅎ +E2B1A7 E2B1A8 E2B1A7 12E3 Ⱨ +E2B1A8 E2B1A8 E2B1A7 12E3 ⱨ +E2B1B5 E2B1B6 E2B1B5 12E4 Ⱶ +E2B1B6 E2B1B6 E2B1B5 12E4 ⱶ +EA9CA6 EA9CA7 EA9CA6 12E5 Ꜧ +EA9CA7 EA9CA7 EA9CA6 12E5 ꜧ +C988 C989 C988 130E Ɉ +C989 C989 C988 130E ɉ +E2B1A9 E2B1AA E2B1A9 1328 Ⱪ +E2B1AA E2B1AA E2B1A9 1328 ⱪ +C8BD C69A C8BD 133B Ƚ +E2B1A0 E2B1A1 E2B1A0 133F Ⱡ +E2B1A1 E2B1A1 E2B1A0 133F ⱡ +C9AB C9AB 1340 ɫ +E2B1A2 C9AB E2B1A2 1340 Ɫ +E1B5BD E1B5BD E2B1A3 13B8 ᵽ +E2B1A3 E1B5BD E2B1A3 13B8 Ᵽ +C98A C98B C98A 13D2 Ɋ +C98B C98B C98A 13D2 ɋ +C98C C98D C98C 13E4 Ɍ +C98D C98D C98C 13E4 ɍ +C9BD C9BD 13FC ɽ +E2B1A4 C9BD E2B1A4 13FC Ɽ +EA9CA8 EA9CA9 EA9CA8 143314AD Ꜩ +EA9CA9 EA9CA9 EA9CA8 143314AD ꜩ +C8BE C8BE 143C Ⱦ +E2B1A6 E2B1A6 C8BE 143C ⱦ +C984 CA89 C984 145B Ʉ +CA89 CA89 C984 145B ʉ +C985 CA8C C985 1489 Ʌ +CA8C CA8C C985 1489 ʌ +C98E C98F C98E 14A4 Ɏ +C98F C98F C98E 14A4 ɏ +E2B1AB E2B1AC E2B1AB 14C8 Ⱬ +E2B1AC E2B1AC E2B1AB 14C8 ⱬ +EA9CAA EA9CAB EA9CAA 14F3 Ꜫ +EA9CAB EA9CAB EA9CAA 14F3 ꜫ +C981 C982 C981 1506 Ɂ +C982 C982 C981 1506 ɂ +EA9CA2 EA9CA3 EA9CA2 150E Ꜣ +EA9CA3 EA9CA3 EA9CA2 150E ꜣ +EA9CA4 EA9CA5 EA9CA4 1518 Ꜥ +EA9CA5 EA9CA5 EA9CA4 1518 ꜥ +CDB0 CDB1 CDB0 154F Ͱ +CDB1 CDB1 CDB0 154F ͱ +CDBC CDBC CFBE 1564 ͼ +CFBE CDBC CFBE 1564 Ͼ +CDBB CDBB CFBD 1565 ͻ +CFBD CDBB CFBD 1565 Ͻ +CDBD CDBD CFBF 1566 ͽ +CFBF CDBD CFBF 1566 Ͽ +CDB2 CDB3 CDB2 156F Ͳ +CDB3 CDB3 CDB2 156F ͳ +E2B280 E2B281 E2B280 1571 Ⲁ +E2B281 E2B281 E2B280 1571 ⲁ +E2B282 E2B283 E2B282 1572 Ⲃ +E2B283 E2B283 E2B282 1572 ⲃ +E2B284 E2B285 E2B284 1573 Ⲅ +E2B285 E2B285 E2B284 1573 ⲅ +E2B286 E2B287 E2B286 1574 Ⲇ +E2B287 E2B287 E2B286 1574 ⲇ +E2B288 E2B289 E2B288 1575 Ⲉ +E2B289 E2B289 E2B288 1575 ⲉ +E2B28A E2B28B E2B28A 1577 Ⲋ +E2B28B E2B28B E2B28A 1577 ⲋ +E2B28C E2B28D E2B28C 1578 Ⲍ +E2B28D E2B28D E2B28C 1578 ⲍ +E2B28E E2B28F E2B28E 1579 Ⲏ +E2B28F E2B28F E2B28E 1579 ⲏ +E2B3AB E2B3AC E2B3AB 1591 Ⳬ +E2B3AC E2B3AC E2B3AB 1591 ⳬ +E2B3AD E2B3AE E2B3AD 15A0 Ⳮ +E2B3AE E2B3AE E2B3AD 15A0 ⳮ +D3BA D3BB D3BA 15D4 Ӻ +D3BB D3BB D3BA 15D4 ӻ +D3B6 D3B7 D3B6 15DC Ӷ +D3B7 D3B7 D3B6 15DC ӷ +EA9980 EA9981 EA9980 1611 Ꙁ +EA9981 EA9981 EA9980 1611 ꙁ +D490 D491 D490 1613 Ԑ +D491 D491 D490 1613 ԑ +EA9982 EA9983 EA9982 1618 Ꙃ +EA9983 EA9983 EA9982 1618 ꙃ +D492 D493 D492 1666 Ԓ +D493 D493 D492 1666 ԓ +D494 D495 D494 166E Ԕ +D495 D495 D494 166E ԕ +D496 D497 D496 16B7 Ԗ +D497 D497 D496 16B7 ԗ +D3BC D3BD D3BC 16F9 Ӽ +D3BD D3BD D3BC 16F9 ӽ +D3BE D3BF D3BE 16FD Ӿ +D3BF D3BF D3BE 16FD ӿ +D380 D38F D380 17B1 Ӏ +D38F D38F D380 17B1 ӏ +E2B080 E2B0B0 E2B080 17B5 Ⰰ +E2B0B0 E2B0B0 E2B080 17B5 ⰰ +E2B081 E2B0B1 E2B081 17B6 Ⰱ +E2B0B1 E2B0B1 E2B081 17B6 ⰱ +E2B082 E2B0B2 E2B082 17B7 Ⰲ +E2B0B2 E2B0B2 E2B082 17B7 ⰲ +E2B083 E2B0B3 E2B083 17B8 Ⰳ +E2B0B3 E2B0B3 E2B083 17B8 ⰳ +E2B084 E2B0B4 E2B084 17B9 Ⰴ +E2B0B4 E2B0B4 E2B084 17B9 ⰴ +E2B085 E2B0B5 E2B085 17BA Ⰵ +E2B0B5 E2B0B5 E2B085 17BA ⰵ +E2B086 E2B0B6 E2B086 17BB Ⰶ +E2B0B6 E2B0B6 E2B086 17BB ⰶ +E2B087 E2B0B7 E2B087 17BC Ⰷ +E2B0B7 E2B0B7 E2B087 17BC ⰷ +E182A0 E2B480 E182A0 17E5 Ⴀ +E2B480 E2B480 E182A0 17E5 ⴀ +E182A1 E2B481 E182A1 17E7 Ⴁ +E2B481 E2B481 E182A1 17E7 ⴁ +E182A2 E2B482 E182A2 17E9 Ⴂ +E2B482 E2B482 E182A2 17E9 ⴂ +E182A3 E2B483 E182A3 17EB Ⴃ +E2B483 E2B483 E182A3 17EB ⴃ +E182A4 E2B484 E182A4 17ED Ⴄ +E2B484 E2B484 E182A4 17ED ⴄ +E182A5 E2B485 E182A5 17EF Ⴅ +E2B485 E2B485 E182A5 17EF ⴅ +E182A6 E2B486 E182A6 17F1 Ⴆ +E2B486 E2B486 E182A6 17F1 ⴆ +E182A7 E2B487 E182A7 17F5 Ⴇ +E2B487 E2B487 E182A7 17F5 ⴇ +F0909080 F09090A8 F0909080 30D2 𐐀 +F09090A8 F09090A8 F0909080 30D2 𐐨 +F0909081 F09090A9 F0909081 30D3 𐐁 +F09090A9 F09090A9 F0909081 30D3 𐐩 +F0909082 F09090AA F0909082 30D4 𐐂 +F09090AA F09090AA F0909082 30D4 𐐪 +F0909083 F09090AB F0909083 30D5 𐐃 +F09090AB F09090AB F0909083 30D5 𐐫 +F0909084 F09090AC F0909084 30D6 𐐄 +F09090AC F09090AC F0909084 30D6 𐐬 +F0909085 F09090AD F0909085 30D7 𐐅 +F09090AD F09090AD F0909085 30D7 𐐭 +F0909086 F09090AE F0909086 30D8 𐐆 +F09090AE F09090AE F0909086 30D8 𐐮 +F0909087 F09090AF F0909087 30D9 𐐇 +F09090AF F09090AF F0909087 30D9 𐐯 +INSERT INTO t1 VALUES ('a'); +INSERT INTO t1 VALUES (concat(_utf32 0x61, _utf32 0xFFFF)); +INSERT INTO t1 VALUES (concat(_utf32 0x61, _utf32 0x10FFFF)); +INSERT INTO t1 VALUES (concat(_utf32 0x61, _utf32 0x10400)); +SELECT hex(c), hex(weight_string(c)) FROM t1 WHERE c LIKE 'a%' ORDER BY c; +hex(c) hex(weight_string(c)) +61 120F +61F0909080 120F30D2 +61EFBFBF 120FFBC1FFFF +61F48FBFBF 120FFBE1FFFF +SELECT hex(c), hex(weight_string(c)), c FROM t1 WHERE c LIKE _utf32 0x10400 ORDER BY c, BINARY c; +hex(c) hex(weight_string(c)) c +F0909080 30D2 𐐀 +F09090A8 30D2 𐐨 +SELECT hex(c), hex(weight_string(c)), c FROM t1 WHERE c LIKE _utf32 0x10428 ORDER BY c, BINARY c; +hex(c) hex(weight_string(c)) c +F0909080 30D2 𐐀 +F09090A8 30D2 𐐨 +ALTER TABLE t1 ADD KEY(c); +EXPLAIN SELECT hex(c) FROM t1 WHERE c LIKE 'a%' ORDER BY c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range c c 43 NULL 3 Using where; Using index +SELECT hex(c), hex(weight_string(c)) FROM t1 WHERE c LIKE 'a%' ORDER BY c; +hex(c) hex(weight_string(c)) +61 120F +61F0909080 120F30D2 +61EFBFBF 120FFBC1FFFF +61F48FBFBF 120FFBE1FFFF +SELECT hex(c), hex(weight_string(c)), c FROM t1 WHERE c LIKE _utf32 0x10400 ORDER BY c, BINARY c; +hex(c) hex(weight_string(c)) c +F0909080 30D2 𐐀 +F09090A8 30D2 𐐨 +SELECT hex(c), hex(weight_string(c)), c FROM t1 WHERE c LIKE _utf32 0x10428 ORDER BY c, BINARY c; +hex(c) hex(weight_string(c)) c +F0909080 30D2 𐐀 +F09090A8 30D2 𐐨 +DROP TABLE t1; +# +# End of 5.6 tests +# +# +# Start of MariaDB-10.0 tests +# + +SET NAMES utf8 COLLATE utf8_unicode_ci; +# +# MDEV-7149 Constant condition propagation erroneously applied for LIKE +# +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE CONCAT(c1)='a'; +c1 +a +a +SELECT * FROM t1 WHERE CONCAT(c1) LIKE 'a '; +c1 +a +SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE 'a'=CONCAT(c1); +c1 +a +a +SELECT * FROM t1 WHERE 'a ' LIKE CONCAT(c1); +c1 +a +SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '% '=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '%'=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +# +# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' +# +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; +a LENGTH(a) +a 1 +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +a LENGTH(a) +a 1 +EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` not like 'a ' and `test`.`t1`.`a` = 'a' +DROP TABLE t1; +# +# End of MDEV-8694 +# +# +# MDEV-7149 Constant condition propagation erroneously applied for LIKE +# +CREATE TABLE t1 AS SELECT REPEAT('a',10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('ae'),('ä'); +SELECT * FROM t1 WHERE c1='ä'; +c1 +ä +SELECT * FROM t1 WHERE c1 LIKE 'ae'; +c1 +ae +SELECT * FROM t1 WHERE c1='ä' AND c1 LIKE 'ae'; +c1 +EXPLAIN EXTENDED SELECT * FROM t1 WHERE c1='ä' AND c1 LIKE 'ae'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where `test`.`t1`.`c1` = 'ä' and `test`.`t1`.`c1` like 'ae' +SELECT * FROM t1 WHERE CONCAT(c1)='ä'; +c1 +ä +SELECT * FROM t1 WHERE CONCAT(c1) LIKE 'ae'; +c1 +ae +SELECT * FROM t1 WHERE CONCAT(c1)='ä' AND CONCAT(c1) LIKE 'ae'; +c1 +EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='ä' AND CONCAT(c1) LIKE 'ae'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'ä' and concat(`test`.`t1`.`c1`) like 'ae' +DROP TABLE IF EXISTS t1; +SET NAMES utf8 COLLATE utf8_german2_ci; +# +# MDEV-7149 Constant condition propagation erroneously applied for LIKE +# +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE CONCAT(c1)='a'; +c1 +a +a +SELECT * FROM t1 WHERE CONCAT(c1) LIKE 'a '; +c1 +a +SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE 'a'=CONCAT(c1); +c1 +a +a +SELECT * FROM t1 WHERE 'a ' LIKE CONCAT(c1); +c1 +a +SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '% '=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '%'=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +# +# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' +# +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; +a LENGTH(a) +a 1 +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +a LENGTH(a) +a 1 +EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` not like 'a ' and `test`.`t1`.`a` = 'a' +DROP TABLE t1; +# +# End of MDEV-8694 +# +# +# MDEV-7149 Constant condition propagation erroneously applied for LIKE +# +CREATE TABLE t1 AS SELECT REPEAT('a',10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_german2_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('ae'),('ä'); +SELECT * FROM t1 WHERE c1='ä'; +c1 +ae +ä +SELECT * FROM t1 WHERE c1 LIKE 'ae'; +c1 +ae +SELECT * FROM t1 WHERE c1='ä' AND c1 LIKE 'ae'; +c1 +ae +EXPLAIN EXTENDED SELECT * FROM t1 WHERE c1='ä' AND c1 LIKE 'ae'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where `test`.`t1`.`c1` = 'ä' and `test`.`t1`.`c1` like 'ae' +SELECT * FROM t1 WHERE CONCAT(c1)='ä'; +c1 +ae +ä +SELECT * FROM t1 WHERE CONCAT(c1) LIKE 'ae'; +c1 +ae +SELECT * FROM t1 WHERE CONCAT(c1)='ä' AND CONCAT(c1) LIKE 'ae'; +c1 +ae +EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='ä' AND CONCAT(c1) LIKE 'ae'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'ä' and concat(`test`.`t1`.`c1`) like 'ae' +DROP TABLE IF EXISTS t1; +# +# MDEV-4929 Myanmar collation +# +SET NAMES utf8 COLLATE utf8_myanmar_ci; +# +# Start of ctype_myanmar.inc +# +SELECT @@collation_connection; +@@collation_connection +utf8_myanmar_ci +CREATE TABLE t1 AS SELECT 100000 AS id, REPEAT(' ', 64) AS s1 LIMIT 0; +SELECT COLLATION(s1) FROM t1; +COLLATION(s1) +DELETE FROM t1; +ALTER TABLE t1 MODIFY id INT NOT NULL AUTO_INCREMENT PRIMARY KEY; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `s1` varchar(64) CHARACTER SET utf8 COLLATE utf8_myanmar_ci DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (s1) VALUES +(_ucs2 0x108C), +(_ucs2 0x1037), +(_ucs2 0x1038), +(_ucs2 0x10371038), +('--- Vowels'), +(_ucs2 0x102C), +(_ucs2 0x102B), +(_ucs2 0x1032), +(_ucs2 0x1031102C), +(_ucs2 0x1031102B), +(_ucs2 0x1031102C103A), +(_ucs2 0x1031102B103A), +(_ucs2 0x1034), +(_ucs2 0x1036), +(_ucs2 0x102D102F), +('--- Vowels with finals'), +(_ucs2 0x10001039), +(_ucs2 0x1000103A), +(_ucs2 0x102C10001039), +(_ucs2 0x102C1000103A), +(_ucs2 0x102B10001039), +(_ucs2 0x102B1000103A), +(_ucs2 0x102D10001039), +(_ucs2 0x102D1000103A), +(_ucs2 0x102F10001039), +(_ucs2 0x102F1000103A), +(_ucs2 0x103110001039), +(_ucs2 0x10311000103A), +(_ucs2 0x1031102C10001039), +(_ucs2 0x1031102C1000103A), +(_ucs2 0x1031102B10001039), +(_ucs2 0x1031102B1000103A), +(_ucs2 0x102D102F10001039), +(_ucs2 0x102D102F1000103A), +(_ucs2 0x10011039), +(_ucs2 0x1001103A), +(_ucs2 0x102C10011039), +(_ucs2 0x102C1001103A), +(_ucs2 0x102B10011039), +(_ucs2 0x102B1001103A), +(_ucs2 0x102D10011039), +(_ucs2 0x102D1001103A), +(_ucs2 0x102F10011039), +(_ucs2 0x102F1001103A), +(_ucs2 0x103110011039), +(_ucs2 0x10311001103A), +(_ucs2 0x1031102C10011039), +(_ucs2 0x1031102C1001103A), +(_ucs2 0x1031102B10011039), +(_ucs2 0x1031102B1001103A), +(_ucs2 0x102D102F10011039), +(_ucs2 0x102D102F1001103A), +(_ucs2 0x10021039), +(_ucs2 0x1002103A), +(_ucs2 0x102C10021039), +(_ucs2 0x102C1002103A), +(_ucs2 0x102B10021039), +(_ucs2 0x102B1002103A), +(_ucs2 0x102D10021039), +(_ucs2 0x102D1002103A), +(_ucs2 0x102F10021039), +(_ucs2 0x102F1002103A), +(_ucs2 0x103110021039), +(_ucs2 0x10311002103A), +(_ucs2 0x1031102C10021039), +(_ucs2 0x1031102C1002103A), +(_ucs2 0x1031102B10021039), +(_ucs2 0x1031102B1002103A), +(_ucs2 0x102D102F10021039), +(_ucs2 0x102D102F1002103A), +(_ucs2 0x10031039), +(_ucs2 0x1003103A), +(_ucs2 0x102C10031039), +(_ucs2 0x102C1003103A), +(_ucs2 0x102B10031039), +(_ucs2 0x102B1003103A), +(_ucs2 0x102D10031039), +(_ucs2 0x102D1003103A), +(_ucs2 0x102F10031039), +(_ucs2 0x102F1003103A), +(_ucs2 0x103110031039), +(_ucs2 0x10311003103A), +(_ucs2 0x1031102C10031039), +(_ucs2 0x1031102C1003103A), +(_ucs2 0x1031102B10031039), +(_ucs2 0x1031102B1003103A), +(_ucs2 0x102D102F10031039), +(_ucs2 0x102D102F1003103A), +(_ucs2 0x1004103A1039), +(_ucs2 0x1004103A), +(_ucs2 0x102C1004103A1039), +(_ucs2 0x102C1004103A), +(_ucs2 0x102B1004103A1039), +(_ucs2 0x102B1004103A), +(_ucs2 0x102D1004103A1039), +(_ucs2 0x102D1004103A), +(_ucs2 0x102F1004103A1039), +(_ucs2 0x102F1004103A), +(_ucs2 0x10311004103A1039), +(_ucs2 0x10311004103A), +(_ucs2 0x1031102C1004103A1039), +(_ucs2 0x1031102C1004103A), +(_ucs2 0x1031102B1004103A1039), +(_ucs2 0x1031102B1004103A), +(_ucs2 0x102D102F1004103A1039), +(_ucs2 0x102D102F1004103A), +(_ucs2 0x10051039), +(_ucs2 0x1005103A), +(_ucs2 0x102C10051039), +(_ucs2 0x102C1005103A), +(_ucs2 0x102B10051039), +(_ucs2 0x102B1005103A), +(_ucs2 0x102D10051039), +(_ucs2 0x102D1005103A), +(_ucs2 0x102F10051039), +(_ucs2 0x102F1005103A), +(_ucs2 0x103110051039), +(_ucs2 0x10311005103A), +(_ucs2 0x1031102C10051039), +(_ucs2 0x1031102C1005103A), +(_ucs2 0x1031102B10051039), +(_ucs2 0x1031102B1005103A), +(_ucs2 0x102D102F10051039), +(_ucs2 0x102D102F1005103A), +(_ucs2 0x10061039), +(_ucs2 0x1006103A), +(_ucs2 0x102C10061039), +(_ucs2 0x102C1006103A), +(_ucs2 0x102B10061039), +(_ucs2 0x102B1006103A), +(_ucs2 0x102D10061039), +(_ucs2 0x102D1006103A), +(_ucs2 0x102F10061039), +(_ucs2 0x102F1006103A), +(_ucs2 0x103110061039), +(_ucs2 0x10311006103A), +(_ucs2 0x1031102C10061039), +(_ucs2 0x1031102C1006103A), +(_ucs2 0x1031102B10061039), +(_ucs2 0x1031102B1006103A), +(_ucs2 0x102D102F10061039), +(_ucs2 0x102D102F1006103A), +(_ucs2 0x10071039), +(_ucs2 0x1007103A), +(_ucs2 0x102C10071039), +(_ucs2 0x102C1007103A), +(_ucs2 0x102B10071039), +(_ucs2 0x102B1007103A), +(_ucs2 0x102D10071039), +(_ucs2 0x102D1007103A), +(_ucs2 0x102F10071039), +(_ucs2 0x102F1007103A), +(_ucs2 0x103110071039), +(_ucs2 0x10311007103A), +(_ucs2 0x1031102C10071039), +(_ucs2 0x1031102C1007103A), +(_ucs2 0x1031102B10071039), +(_ucs2 0x1031102B1007103A), +(_ucs2 0x102D102F10071039), +(_ucs2 0x102D102F1007103A), +(_ucs2 0x1008103A), +(_ucs2 0x102C1008103A), +(_ucs2 0x102B1008103A), +(_ucs2 0x102D1008103A), +(_ucs2 0x102F1008103A), +(_ucs2 0x10311008103A), +(_ucs2 0x1031102C1008103A), +(_ucs2 0x1031102B1008103A), +(_ucs2 0x102D102F1008103A), +(_ucs2 0x10091039), +(_ucs2 0x1009103A), +(_ucs2 0x102C10091039), +(_ucs2 0x102C1009103A), +(_ucs2 0x102B10091039), +(_ucs2 0x102B1009103A), +(_ucs2 0x102D10091039), +(_ucs2 0x102D1009103A), +(_ucs2 0x102F10091039), +(_ucs2 0x102F1009103A), +(_ucs2 0x103110091039), +(_ucs2 0x10311009103A), +(_ucs2 0x1031102C10091039), +(_ucs2 0x1031102C1009103A), +(_ucs2 0x1031102B10091039), +(_ucs2 0x1031102B1009103A), +(_ucs2 0x102D102F10091039), +(_ucs2 0x102D102F1009103A), +(_ucs2 0x100A1039), +(_ucs2 0x100A103A), +(_ucs2 0x102C100A1039), +(_ucs2 0x102C100A103A), +(_ucs2 0x102B100A1039), +(_ucs2 0x102B100A103A), +(_ucs2 0x102D100A1039), +(_ucs2 0x102D100A103A), +(_ucs2 0x102F100A1039), +(_ucs2 0x102F100A103A), +(_ucs2 0x1031100A1039), +(_ucs2 0x1031100A103A), +(_ucs2 0x1031102C100A1039), +(_ucs2 0x1031102C100A103A), +(_ucs2 0x1031102B100A1039), +(_ucs2 0x1031102B100A103A), +(_ucs2 0x102D102F100A1039), +(_ucs2 0x102D102F100A103A), +(_ucs2 0x100B1039), +(_ucs2 0x100B103A), +(_ucs2 0x102C100B1039), +(_ucs2 0x102C100B103A), +(_ucs2 0x102B100B1039), +(_ucs2 0x102B100B103A), +(_ucs2 0x102D100B1039), +(_ucs2 0x102D100B103A), +(_ucs2 0x102F100B1039), +(_ucs2 0x102F100B103A), +(_ucs2 0x1031100B1039), +(_ucs2 0x1031100B103A), +(_ucs2 0x1031102C100B1039), +(_ucs2 0x1031102C100B103A), +(_ucs2 0x1031102B100B1039), +(_ucs2 0x1031102B100B103A), +(_ucs2 0x102D102F100B1039), +(_ucs2 0x102D102F100B103A), +(_ucs2 0x100C1039), +(_ucs2 0x100C103A), +(_ucs2 0x102C100C1039), +(_ucs2 0x102C100C103A), +(_ucs2 0x102B100C1039), +(_ucs2 0x102B100C103A), +(_ucs2 0x102D100C1039), +(_ucs2 0x102D100C103A), +(_ucs2 0x102F100C1039), +(_ucs2 0x102F100C103A), +(_ucs2 0x1031100C1039), +(_ucs2 0x1031100C103A), +(_ucs2 0x1031102C100C1039), +(_ucs2 0x1031102C100C103A), +(_ucs2 0x1031102B100C1039), +(_ucs2 0x1031102B100C103A), +(_ucs2 0x102D102F100C1039), +(_ucs2 0x102D102F100C103A), +(_ucs2 0x100D1039), +(_ucs2 0x100D103A), +(_ucs2 0x102C100D1039), +(_ucs2 0x102C100D103A), +(_ucs2 0x102B100D1039), +(_ucs2 0x102B100D103A), +(_ucs2 0x102D100D1039), +(_ucs2 0x102D100D103A), +(_ucs2 0x102F100D1039), +(_ucs2 0x102F100D103A), +(_ucs2 0x1031100D1039), +(_ucs2 0x1031100D103A), +(_ucs2 0x1031102C100D1039), +(_ucs2 0x1031102C100D103A), +(_ucs2 0x1031102B100D1039), +(_ucs2 0x1031102B100D103A), +(_ucs2 0x102D102F100D1039), +(_ucs2 0x102D102F100D103A), +(_ucs2 0x100E1039), +(_ucs2 0x100E103A), +(_ucs2 0x102C100E1039), +(_ucs2 0x102C100E103A), +(_ucs2 0x102B100E1039), +(_ucs2 0x102B100E103A), +(_ucs2 0x102D100E1039), +(_ucs2 0x102D100E103A), +(_ucs2 0x102F100E1039), +(_ucs2 0x102F100E103A), +(_ucs2 0x1031100E1039), +(_ucs2 0x1031100E103A), +(_ucs2 0x1031102C100E1039), +(_ucs2 0x1031102C100E103A), +(_ucs2 0x1031102B100E1039), +(_ucs2 0x1031102B100E103A), +(_ucs2 0x102D102F100E1039), +(_ucs2 0x102D102F100E103A), +(_ucs2 0x100F1039), +(_ucs2 0x100F103A), +(_ucs2 0x102C100F1039), +(_ucs2 0x102C100F103A), +(_ucs2 0x102B100F1039), +(_ucs2 0x102B100F103A), +(_ucs2 0x102D100F1039), +(_ucs2 0x102D100F103A), +(_ucs2 0x102F100F1039), +(_ucs2 0x102F100F103A), +(_ucs2 0x1031100F1039), +(_ucs2 0x1031100F103A), +(_ucs2 0x1031102C100F1039), +(_ucs2 0x1031102C100F103A), +(_ucs2 0x1031102B100F1039), +(_ucs2 0x1031102B100F103A), +(_ucs2 0x102D102F100F1039), +(_ucs2 0x102D102F100F103A), +(_ucs2 0x10101039), +(_ucs2 0x1010103A), +(_ucs2 0x102C10101039), +(_ucs2 0x102C1010103A), +(_ucs2 0x102B10101039), +(_ucs2 0x102B1010103A), +(_ucs2 0x102D10101039), +(_ucs2 0x102D1010103A), +(_ucs2 0x102F10101039), +(_ucs2 0x102F1010103A), +(_ucs2 0x103110101039), +(_ucs2 0x10311010103A), +(_ucs2 0x1031102C10101039), +(_ucs2 0x1031102C1010103A), +(_ucs2 0x1031102B10101039), +(_ucs2 0x1031102B1010103A), +(_ucs2 0x102D102F10101039), +(_ucs2 0x102D102F1010103A), +(_ucs2 0x10111039), +(_ucs2 0x1011103A), +(_ucs2 0x102C10111039), +(_ucs2 0x102C1011103A), +(_ucs2 0x102B10111039), +(_ucs2 0x102B1011103A), +(_ucs2 0x102D10111039), +(_ucs2 0x102D1011103A), +(_ucs2 0x102F10111039), +(_ucs2 0x102F1011103A), +(_ucs2 0x103110111039), +(_ucs2 0x10311011103A), +(_ucs2 0x1031102C10111039), +(_ucs2 0x1031102C1011103A), +(_ucs2 0x1031102B10111039), +(_ucs2 0x1031102B1011103A), +(_ucs2 0x102D102F10111039), +(_ucs2 0x102D102F1011103A), +(_ucs2 0x10121039), +(_ucs2 0x1012103A), +(_ucs2 0x102C10121039), +(_ucs2 0x102C1012103A), +(_ucs2 0x102B10121039), +(_ucs2 0x102B1012103A), +(_ucs2 0x102D10121039), +(_ucs2 0x102D1012103A), +(_ucs2 0x102F10121039), +(_ucs2 0x102F1012103A), +(_ucs2 0x103110121039), +(_ucs2 0x10311012103A), +(_ucs2 0x1031102C10121039), +(_ucs2 0x1031102C1012103A), +(_ucs2 0x1031102B10121039), +(_ucs2 0x1031102B1012103A), +(_ucs2 0x102D102F10121039), +(_ucs2 0x102D102F1012103A), +(_ucs2 0x10131039), +(_ucs2 0x1013103A), +(_ucs2 0x102C10131039), +(_ucs2 0x102C1013103A), +(_ucs2 0x102B10131039), +(_ucs2 0x102B1013103A), +(_ucs2 0x102D10131039), +(_ucs2 0x102D1013103A), +(_ucs2 0x102F10131039), +(_ucs2 0x102F1013103A), +(_ucs2 0x103110131039), +(_ucs2 0x10311013103A), +(_ucs2 0x1031102C10131039), +(_ucs2 0x1031102C1013103A), +(_ucs2 0x1031102B10131039), +(_ucs2 0x1031102B1013103A), +(_ucs2 0x102D102F10131039), +(_ucs2 0x102D102F1013103A), +(_ucs2 0x10141039), +(_ucs2 0x1014103A), +(_ucs2 0x102C10141039), +(_ucs2 0x102C1014103A), +(_ucs2 0x102B10141039), +(_ucs2 0x102B1014103A), +(_ucs2 0x102D10141039), +(_ucs2 0x102D1014103A), +(_ucs2 0x102F10141039), +(_ucs2 0x102F1014103A), +(_ucs2 0x103110141039), +(_ucs2 0x10311014103A), +(_ucs2 0x1031102C10141039), +(_ucs2 0x1031102C1014103A), +(_ucs2 0x1031102B10141039), +(_ucs2 0x1031102B1014103A), +(_ucs2 0x102D102F10141039), +(_ucs2 0x102D102F1014103A), +(_ucs2 0x10151039), +(_ucs2 0x1015103A), +(_ucs2 0x102C10151039), +(_ucs2 0x102C1015103A), +(_ucs2 0x102B10151039), +(_ucs2 0x102B1015103A), +(_ucs2 0x102D10151039), +(_ucs2 0x102D1015103A), +(_ucs2 0x102F10151039), +(_ucs2 0x102F1015103A), +(_ucs2 0x103110151039), +(_ucs2 0x10311015103A), +(_ucs2 0x1031102C10151039), +(_ucs2 0x1031102C1015103A), +(_ucs2 0x1031102B10151039), +(_ucs2 0x1031102B1015103A), +(_ucs2 0x102D102F10151039), +(_ucs2 0x102D102F1015103A), +(_ucs2 0x10161039), +(_ucs2 0x1016103A), +(_ucs2 0x102C10161039), +(_ucs2 0x102C1016103A), +(_ucs2 0x102B10161039), +(_ucs2 0x102B1016103A), +(_ucs2 0x102D10161039), +(_ucs2 0x102D1016103A), +(_ucs2 0x102F10161039), +(_ucs2 0x102F1016103A), +(_ucs2 0x103110161039), +(_ucs2 0x10311016103A), +(_ucs2 0x1031102C10161039), +(_ucs2 0x1031102C1016103A), +(_ucs2 0x1031102B10161039), +(_ucs2 0x1031102B1016103A), +(_ucs2 0x102D102F10161039), +(_ucs2 0x102D102F1016103A), +(_ucs2 0x10171039), +(_ucs2 0x1017103A), +(_ucs2 0x102C10171039), +(_ucs2 0x102C1017103A), +(_ucs2 0x102B10171039), +(_ucs2 0x102B1017103A), +(_ucs2 0x102D10171039), +(_ucs2 0x102D1017103A), +(_ucs2 0x102F10171039), +(_ucs2 0x102F1017103A), +(_ucs2 0x103110171039), +(_ucs2 0x10311017103A), +(_ucs2 0x1031102C10171039), +(_ucs2 0x1031102C1017103A), +(_ucs2 0x1031102B10171039), +(_ucs2 0x1031102B1017103A), +(_ucs2 0x102D102F10171039), +(_ucs2 0x102D102F1017103A), +(_ucs2 0x10181039), +(_ucs2 0x1018103A), +(_ucs2 0x102C10181039), +(_ucs2 0x102C1018103A), +(_ucs2 0x102B10181039), +(_ucs2 0x102B1018103A), +(_ucs2 0x102D10181039), +(_ucs2 0x102D1018103A), +(_ucs2 0x102F10181039), +(_ucs2 0x102F1018103A), +(_ucs2 0x103110181039), +(_ucs2 0x10311018103A), +(_ucs2 0x1031102C10181039), +(_ucs2 0x1031102C1018103A), +(_ucs2 0x1031102B10181039), +(_ucs2 0x1031102B1018103A), +(_ucs2 0x102D102F10181039), +(_ucs2 0x102D102F1018103A), +(_ucs2 0x10191039), +(_ucs2 0x1019103A), +(_ucs2 0x102C10191039), +(_ucs2 0x102C1019103A), +(_ucs2 0x102B10191039), +(_ucs2 0x102B1019103A), +(_ucs2 0x102D10191039), +(_ucs2 0x102D1019103A), +(_ucs2 0x102F10191039), +(_ucs2 0x102F1019103A), +(_ucs2 0x103110191039), +(_ucs2 0x10311019103A), +(_ucs2 0x1031102C10191039), +(_ucs2 0x1031102C1019103A), +(_ucs2 0x1031102B10191039), +(_ucs2 0x1031102B1019103A), +(_ucs2 0x102D102F10191039), +(_ucs2 0x102D102F1019103A), +(_ucs2 0x101A1039), +(_ucs2 0x101A103A), +(_ucs2 0x102C101A1039), +(_ucs2 0x102C101A103A), +(_ucs2 0x102B101A1039), +(_ucs2 0x102B101A103A), +(_ucs2 0x102D101A1039), +(_ucs2 0x102D101A103A), +(_ucs2 0x102F101A1039), +(_ucs2 0x102F101A103A), +(_ucs2 0x1031101A1039), +(_ucs2 0x1031101A103A), +(_ucs2 0x1031102C101A1039), +(_ucs2 0x1031102C101A103A), +(_ucs2 0x1031102B101A1039), +(_ucs2 0x1031102B101A103A), +(_ucs2 0x102D102F101A1039), +(_ucs2 0x102D102F101A103A), +(_ucs2 0x101B1039), +(_ucs2 0x101B103A), +(_ucs2 0x102C101B1039), +(_ucs2 0x102C101B103A), +(_ucs2 0x102B101B1039), +(_ucs2 0x102B101B103A), +(_ucs2 0x102D101B1039), +(_ucs2 0x102D101B103A), +(_ucs2 0x102F101B1039), +(_ucs2 0x102F101B103A), +(_ucs2 0x1031101B1039), +(_ucs2 0x1031101B103A), +(_ucs2 0x1031102C101B1039), +(_ucs2 0x1031102C101B103A), +(_ucs2 0x1031102B101B1039), +(_ucs2 0x1031102B101B103A), +(_ucs2 0x102D102F101B1039), +(_ucs2 0x102D102F101B103A), +(_ucs2 0x101C1039), +(_ucs2 0x101C103A), +(_ucs2 0x102C101C1039), +(_ucs2 0x102C101C103A), +(_ucs2 0x102B101C1039), +(_ucs2 0x102B101C103A), +(_ucs2 0x102D101C1039), +(_ucs2 0x102D101C103A), +(_ucs2 0x102F101C1039), +(_ucs2 0x102F101C103A), +(_ucs2 0x1031101C1039), +(_ucs2 0x1031101C103A), +(_ucs2 0x1031102C101C1039), +(_ucs2 0x1031102C101C103A), +(_ucs2 0x1031102B101C1039), +(_ucs2 0x1031102B101C103A), +(_ucs2 0x102D102F101C1039), +(_ucs2 0x102D102F101C103A), +(_ucs2 0x101D103A), +(_ucs2 0x102C101D103A), +(_ucs2 0x102B101D103A), +(_ucs2 0x102D101D103A), +(_ucs2 0x102F101D103A), +(_ucs2 0x1031101D103A), +(_ucs2 0x1031102C101D103A), +(_ucs2 0x1031102B101D103A), +(_ucs2 0x102D102F101D103A), +(_ucs2 0x101E1039), +(_ucs2 0x101E103A), +(_ucs2 0x102C101E1039), +(_ucs2 0x102C101E103A), +(_ucs2 0x102B101E1039), +(_ucs2 0x102B101E103A), +(_ucs2 0x102D101E1039), +(_ucs2 0x102D101E103A), +(_ucs2 0x102F101E1039), +(_ucs2 0x102F101E103A), +(_ucs2 0x1031101E1039), +(_ucs2 0x1031101E103A), +(_ucs2 0x1031102C101E1039), +(_ucs2 0x1031102C101E103A), +(_ucs2 0x1031102B101E1039), +(_ucs2 0x1031102B101E103A), +(_ucs2 0x102D102F101E1039), +(_ucs2 0x102D102F101E103A), +(_ucs2 0x101F1039), +(_ucs2 0x101F103A), +(_ucs2 0x102C101F1039), +(_ucs2 0x102C101F103A), +(_ucs2 0x102B101F1039), +(_ucs2 0x102B101F103A), +(_ucs2 0x102D101F1039), +(_ucs2 0x102D101F103A), +(_ucs2 0x102F101F1039), +(_ucs2 0x102F101F103A), +(_ucs2 0x1031101F1039), +(_ucs2 0x1031101F103A), +(_ucs2 0x1031102C101F1039), +(_ucs2 0x1031102C101F103A), +(_ucs2 0x1031102B101F1039), +(_ucs2 0x1031102B101F103A), +(_ucs2 0x102D102F101F1039), +(_ucs2 0x102D102F101F103A), +(_ucs2 0x1020103A), +(_ucs2 0x102C1020103A), +(_ucs2 0x102B1020103A), +(_ucs2 0x102D1020103A), +(_ucs2 0x102F1020103A), +(_ucs2 0x10311020103A), +(_ucs2 0x1031102C1020103A), +(_ucs2 0x1031102B1020103A), +(_ucs2 0x102D102F1020103A), +(_ucs2 0x1021103A), +(_ucs2 0x102C1021103A), +(_ucs2 0x102B1021103A), +(_ucs2 0x102D1021103A), +(_ucs2 0x102F1021103A), +(_ucs2 0x10311021103A), +(_ucs2 0x1031102C1021103A), +(_ucs2 0x1031102B1021103A), +(_ucs2 0x102D102F1021103A), +('--- Medials'), +(_ucs2 0x105E), +(_ucs2 0x105F), +(_ucs2 0x103B), +(_ucs2 0x103C), +(_ucs2 0x1060), +(_ucs2 0x103D), +(_ucs2 0x1082), +(_ucs2 0x103E), +(_ucs2 0x103B103D), +(_ucs2 0x103C103D), +(_ucs2 0x103B103E), +(_ucs2 0x103C103E), +(_ucs2 0x103D103E), +(_ucs2 0x103B103D103E), +(_ucs2 0x103C103D103E), +('--- Independent vowels'), +(_ucs2 0x1021102D), +(_ucs2 0x1023), +(_ucs2 0x1021102E), +(_ucs2 0x1024), +(_ucs2 0x1021102F), +(_ucs2 0x1025), +(_ucs2 0x10211030), +(_ucs2 0x1026), +(_ucs2 0x10211031), +(_ucs2 0x1027), +(_ucs2 0x1028), +(_ucs2 0x10211031102C), +(_ucs2 0x1029), +(_ucs2 0x10211031102C103A), +(_ucs2 0x102A), +(_ucs2 0x102D1019103A), +(_ucs2 0x102D1036), +(_ucs2 0x102D1019103A1037), +(_ucs2 0x102D10361037), +(_ucs2 0x102D1019103A1038), +(_ucs2 0x102D10361038), +(_ucs2 0x102F1019103A), +(_ucs2 0x102F1036), +(_ucs2 0x102F1019103A1037), +(_ucs2 0x102F10361037), +(_ucs2 0x102F1019103A1038), +(_ucs2 0x102F10361038), +(_ucs2 0x1021102F1036), +(_ucs2 0x1025102F1036), +('--- Independent vowels with finals'), +(_ucs2 0x1021102D10001039), +(_ucs2 0x102310001039), +(_ucs2 0x1021102D1000103A), +(_ucs2 0x10231000103A), +(_ucs2 0x1021102F10001039), +(_ucs2 0x102510001039), +(_ucs2 0x1021102F1000103A), +(_ucs2 0x10251000103A), +(_ucs2 0x1021103110001039), +(_ucs2 0x102710001039), +(_ucs2 0x102110311000103A), +(_ucs2 0x10271000103A), +(_ucs2 0x10211031102C10001039), +(_ucs2 0x102910001039), +(_ucs2 0x10211031102C1000103A), +(_ucs2 0x10291000103A), +(_ucs2 0x10211031102C10001039), +(_ucs2 0x10291031102C10001039), +(_ucs2 0x10211031102C1000103A), +(_ucs2 0x10291031102C1000103A), +(_ucs2 0x1021102D10011039), +(_ucs2 0x102310011039), +(_ucs2 0x1021102D1001103A), +(_ucs2 0x10231001103A), +(_ucs2 0x1021102F10011039), +(_ucs2 0x102510011039), +(_ucs2 0x1021102F1001103A), +(_ucs2 0x10251001103A), +(_ucs2 0x1021103110011039), +(_ucs2 0x102710011039), +(_ucs2 0x102110311001103A), +(_ucs2 0x10271001103A), +(_ucs2 0x10211031102C10011039), +(_ucs2 0x102910011039), +(_ucs2 0x10211031102C1001103A), +(_ucs2 0x10291001103A), +(_ucs2 0x10211031102C10011039), +(_ucs2 0x10291031102C10011039), +(_ucs2 0x10211031102C1001103A), +(_ucs2 0x10291031102C1001103A), +(_ucs2 0x1021102D10021039), +(_ucs2 0x102310021039), +(_ucs2 0x1021102D1002103A), +(_ucs2 0x10231002103A), +(_ucs2 0x1021102F10021039), +(_ucs2 0x102510021039), +(_ucs2 0x1021102F1002103A), +(_ucs2 0x10251002103A), +(_ucs2 0x1021103110021039), +(_ucs2 0x102710021039), +(_ucs2 0x102110311002103A), +(_ucs2 0x10271002103A), +(_ucs2 0x10211031102C10021039), +(_ucs2 0x102910021039), +(_ucs2 0x10211031102C1002103A), +(_ucs2 0x10291002103A), +(_ucs2 0x10211031102C10021039), +(_ucs2 0x10291031102C10021039), +(_ucs2 0x10211031102C1002103A), +(_ucs2 0x10291031102C1002103A), +(_ucs2 0x1021102D10031039), +(_ucs2 0x102310031039), +(_ucs2 0x1021102D1003103A), +(_ucs2 0x10231003103A), +(_ucs2 0x1021102F10031039), +(_ucs2 0x102510031039), +(_ucs2 0x1021102F1003103A), +(_ucs2 0x10251003103A), +(_ucs2 0x1021103110031039), +(_ucs2 0x102710031039), +(_ucs2 0x102110311003103A), +(_ucs2 0x10271003103A), +(_ucs2 0x10211031102C10031039), +(_ucs2 0x102910031039), +(_ucs2 0x10211031102C1003103A), +(_ucs2 0x10291003103A), +(_ucs2 0x10211031102C10031039), +(_ucs2 0x10291031102C10031039), +(_ucs2 0x10211031102C1003103A), +(_ucs2 0x10291031102C1003103A), +(_ucs2 0x1021102D10041039), +(_ucs2 0x102310041039), +(_ucs2 0x1021102D1004103A), +(_ucs2 0x10231004103A), +(_ucs2 0x1021102F10041039), +(_ucs2 0x102510041039), +(_ucs2 0x1021102F1004103A), +(_ucs2 0x10251004103A), +(_ucs2 0x1021103110041039), +(_ucs2 0x102710041039), +(_ucs2 0x102110311004103A), +(_ucs2 0x10271004103A), +(_ucs2 0x10211031102C10041039), +(_ucs2 0x102910041039), +(_ucs2 0x10211031102C1004103A), +(_ucs2 0x10291004103A), +(_ucs2 0x10211031102C10041039), +(_ucs2 0x10291031102C10041039), +(_ucs2 0x10211031102C1004103A), +(_ucs2 0x10291031102C1004103A), +(_ucs2 0x1021102D10051039), +(_ucs2 0x102310051039), +(_ucs2 0x1021102D1005103A), +(_ucs2 0x10231005103A), +(_ucs2 0x1021102F10051039), +(_ucs2 0x102510051039), +(_ucs2 0x1021102F1005103A), +(_ucs2 0x10251005103A), +(_ucs2 0x1021103110051039), +(_ucs2 0x102710051039), +(_ucs2 0x102110311005103A), +(_ucs2 0x10271005103A), +(_ucs2 0x10211031102C10051039), +(_ucs2 0x102910051039), +(_ucs2 0x10211031102C1005103A), +(_ucs2 0x10291005103A), +(_ucs2 0x10211031102C10051039), +(_ucs2 0x10291031102C10051039), +(_ucs2 0x10211031102C1005103A), +(_ucs2 0x10291031102C1005103A), +(_ucs2 0x1021102D10061039), +(_ucs2 0x102310061039), +(_ucs2 0x1021102D1006103A), +(_ucs2 0x10231006103A), +(_ucs2 0x1021102F10061039), +(_ucs2 0x102510061039), +(_ucs2 0x1021102F1006103A), +(_ucs2 0x10251006103A), +(_ucs2 0x1021103110061039), +(_ucs2 0x102710061039), +(_ucs2 0x102110311006103A), +(_ucs2 0x10271006103A), +(_ucs2 0x10211031102C10061039), +(_ucs2 0x102910061039), +(_ucs2 0x10211031102C1006103A), +(_ucs2 0x10291006103A), +(_ucs2 0x10211031102C10061039), +(_ucs2 0x10291031102C10061039), +(_ucs2 0x10211031102C1006103A), +(_ucs2 0x10291031102C1006103A), +(_ucs2 0x1021102D10071039), +(_ucs2 0x102310071039), +(_ucs2 0x1021102D1007103A), +(_ucs2 0x10231007103A), +(_ucs2 0x1021102F10071039), +(_ucs2 0x102510071039), +(_ucs2 0x1021102F1007103A), +(_ucs2 0x10251007103A), +(_ucs2 0x1021103110071039), +(_ucs2 0x102710071039), +(_ucs2 0x102110311007103A), +(_ucs2 0x10271007103A), +(_ucs2 0x10211031102C10071039), +(_ucs2 0x102910071039), +(_ucs2 0x10211031102C1007103A), +(_ucs2 0x10291007103A), +(_ucs2 0x10211031102C10071039), +(_ucs2 0x10291031102C10071039), +(_ucs2 0x10211031102C1007103A), +(_ucs2 0x10291031102C1007103A), +(_ucs2 0x1021102D10091039), +(_ucs2 0x102310091039), +(_ucs2 0x1021102D1009103A), +(_ucs2 0x10231009103A), +(_ucs2 0x1021102F10091039), +(_ucs2 0x102510091039), +(_ucs2 0x1021102F1009103A), +(_ucs2 0x10251009103A), +(_ucs2 0x1021103110091039), +(_ucs2 0x102710091039), +(_ucs2 0x102110311009103A), +(_ucs2 0x10271009103A), +(_ucs2 0x10211031102C10091039), +(_ucs2 0x102910091039), +(_ucs2 0x10211031102C1009103A), +(_ucs2 0x10291009103A), +(_ucs2 0x10211031102C10091039), +(_ucs2 0x10291031102C10091039), +(_ucs2 0x10211031102C1009103A), +(_ucs2 0x10291031102C1009103A), +(_ucs2 0x1021102D100A1039), +(_ucs2 0x1023100A1039), +(_ucs2 0x1021102D100A103A), +(_ucs2 0x1023100A103A), +(_ucs2 0x1021102F100A1039), +(_ucs2 0x1025100A1039), +(_ucs2 0x1021102F100A103A), +(_ucs2 0x1025100A103A), +(_ucs2 0x10211031100A1039), +(_ucs2 0x1027100A1039), +(_ucs2 0x10211031100A103A), +(_ucs2 0x1027100A103A), +(_ucs2 0x10211031102C100A1039), +(_ucs2 0x1029100A1039), +(_ucs2 0x10211031102C100A103A), +(_ucs2 0x1029100A103A), +(_ucs2 0x10211031102C100A1039), +(_ucs2 0x10291031102C100A1039), +(_ucs2 0x10211031102C100A103A), +(_ucs2 0x10291031102C100A103A), +(_ucs2 0x1021102D100B1039), +(_ucs2 0x1023100B1039), +(_ucs2 0x1021102D100B103A), +(_ucs2 0x1023100B103A), +(_ucs2 0x1021102F100B1039), +(_ucs2 0x1025100B1039), +(_ucs2 0x1021102F100B103A), +(_ucs2 0x1025100B103A), +(_ucs2 0x10211031100B1039), +(_ucs2 0x1027100B1039), +(_ucs2 0x10211031100B103A), +(_ucs2 0x1027100B103A), +(_ucs2 0x10211031102C100B1039), +(_ucs2 0x1029100B1039), +(_ucs2 0x10211031102C100B103A), +(_ucs2 0x1029100B103A), +(_ucs2 0x10211031102C100B1039), +(_ucs2 0x10291031102C100B1039), +(_ucs2 0x10211031102C100B103A), +(_ucs2 0x10291031102C100B103A), +(_ucs2 0x1021102D100C1039), +(_ucs2 0x1023100C1039), +(_ucs2 0x1021102D100C103A), +(_ucs2 0x1023100C103A), +(_ucs2 0x1021102F100C1039), +(_ucs2 0x1025100C1039), +(_ucs2 0x1021102F100C103A), +(_ucs2 0x1025100C103A), +(_ucs2 0x10211031100C1039), +(_ucs2 0x1027100C1039), +(_ucs2 0x10211031100C103A), +(_ucs2 0x1027100C103A), +(_ucs2 0x10211031102C100C1039), +(_ucs2 0x1029100C1039), +(_ucs2 0x10211031102C100C103A), +(_ucs2 0x1029100C103A), +(_ucs2 0x10211031102C100C1039), +(_ucs2 0x10291031102C100C1039), +(_ucs2 0x10211031102C100C103A), +(_ucs2 0x10291031102C100C103A), +(_ucs2 0x1021102D100D1039), +(_ucs2 0x1023100D1039), +(_ucs2 0x1021102D100D103A), +(_ucs2 0x1023100D103A), +(_ucs2 0x1021102F100D1039), +(_ucs2 0x1025100D1039), +(_ucs2 0x1021102F100D103A), +(_ucs2 0x1025100D103A), +(_ucs2 0x10211031100D1039), +(_ucs2 0x1027100D1039), +(_ucs2 0x10211031100D103A), +(_ucs2 0x1027100D103A), +(_ucs2 0x10211031102C100D1039), +(_ucs2 0x1029100D1039), +(_ucs2 0x10211031102C100D103A), +(_ucs2 0x1029100D103A), +(_ucs2 0x10211031102C100D1039), +(_ucs2 0x10291031102C100D1039), +(_ucs2 0x10211031102C100D103A), +(_ucs2 0x10291031102C100D103A), +(_ucs2 0x1021102D100E1039), +(_ucs2 0x1023100E1039), +(_ucs2 0x1021102D100E103A), +(_ucs2 0x1023100E103A), +(_ucs2 0x1021102F100E1039), +(_ucs2 0x1025100E1039), +(_ucs2 0x1021102F100E103A), +(_ucs2 0x1025100E103A), +(_ucs2 0x10211031100E1039), +(_ucs2 0x1027100E1039), +(_ucs2 0x10211031100E103A), +(_ucs2 0x1027100E103A), +(_ucs2 0x10211031102C100E1039), +(_ucs2 0x1029100E1039), +(_ucs2 0x10211031102C100E103A), +(_ucs2 0x1029100E103A), +(_ucs2 0x10211031102C100E1039), +(_ucs2 0x10291031102C100E1039), +(_ucs2 0x10211031102C100E103A), +(_ucs2 0x10291031102C100E103A), +(_ucs2 0x1021102D100F1039), +(_ucs2 0x1023100F1039), +(_ucs2 0x1021102D100F103A), +(_ucs2 0x1023100F103A), +(_ucs2 0x1021102F100F1039), +(_ucs2 0x1025100F1039), +(_ucs2 0x1021102F100F103A), +(_ucs2 0x1025100F103A), +(_ucs2 0x10211031100F1039), +(_ucs2 0x1027100F1039), +(_ucs2 0x10211031100F103A), +(_ucs2 0x1027100F103A), +(_ucs2 0x10211031102C100F1039), +(_ucs2 0x1029100F1039), +(_ucs2 0x10211031102C100F103A), +(_ucs2 0x1029100F103A), +(_ucs2 0x10211031102C100F1039), +(_ucs2 0x10291031102C100F1039), +(_ucs2 0x10211031102C100F103A), +(_ucs2 0x10291031102C100F103A), +(_ucs2 0x1021102D10101039), +(_ucs2 0x102310101039), +(_ucs2 0x1021102D1010103A), +(_ucs2 0x10231010103A), +(_ucs2 0x1021102F10101039), +(_ucs2 0x102510101039), +(_ucs2 0x1021102F1010103A), +(_ucs2 0x10251010103A), +(_ucs2 0x1021103110101039), +(_ucs2 0x102710101039), +(_ucs2 0x102110311010103A), +(_ucs2 0x10271010103A), +(_ucs2 0x10211031102C10101039), +(_ucs2 0x102910101039), +(_ucs2 0x10211031102C1010103A), +(_ucs2 0x10291010103A), +(_ucs2 0x10211031102C10101039), +(_ucs2 0x10291031102C10101039), +(_ucs2 0x10211031102C1010103A), +(_ucs2 0x10291031102C1010103A), +(_ucs2 0x1021102D10111039), +(_ucs2 0x102310111039), +(_ucs2 0x1021102D1011103A), +(_ucs2 0x10231011103A), +(_ucs2 0x1021102F10111039), +(_ucs2 0x102510111039), +(_ucs2 0x1021102F1011103A), +(_ucs2 0x10251011103A), +(_ucs2 0x1021103110111039), +(_ucs2 0x102710111039), +(_ucs2 0x102110311011103A), +(_ucs2 0x10271011103A), +(_ucs2 0x10211031102C10111039), +(_ucs2 0x102910111039), +(_ucs2 0x10211031102C1011103A), +(_ucs2 0x10291011103A), +(_ucs2 0x10211031102C10111039), +(_ucs2 0x10291031102C10111039), +(_ucs2 0x10211031102C1011103A), +(_ucs2 0x10291031102C1011103A), +(_ucs2 0x1021102D10121039), +(_ucs2 0x102310121039), +(_ucs2 0x1021102D1012103A), +(_ucs2 0x10231012103A), +(_ucs2 0x1021102F10121039), +(_ucs2 0x102510121039), +(_ucs2 0x1021102F1012103A), +(_ucs2 0x10251012103A), +(_ucs2 0x1021103110121039), +(_ucs2 0x102710121039), +(_ucs2 0x102110311012103A), +(_ucs2 0x10271012103A), +(_ucs2 0x10211031102C10121039), +(_ucs2 0x102910121039), +(_ucs2 0x10211031102C1012103A), +(_ucs2 0x10291012103A), +(_ucs2 0x10211031102C10121039), +(_ucs2 0x10291031102C10121039), +(_ucs2 0x10211031102C1012103A), +(_ucs2 0x10291031102C1012103A), +(_ucs2 0x1021102D10131039), +(_ucs2 0x102310131039), +(_ucs2 0x1021102D1013103A), +(_ucs2 0x10231013103A), +(_ucs2 0x1021102F10131039), +(_ucs2 0x102510131039), +(_ucs2 0x1021102F1013103A), +(_ucs2 0x10251013103A), +(_ucs2 0x1021103110131039), +(_ucs2 0x102710131039), +(_ucs2 0x102110311013103A), +(_ucs2 0x10271013103A), +(_ucs2 0x10211031102C10131039), +(_ucs2 0x102910131039), +(_ucs2 0x10211031102C1013103A), +(_ucs2 0x10291013103A), +(_ucs2 0x10211031102C10131039), +(_ucs2 0x10291031102C10131039), +(_ucs2 0x10211031102C1013103A), +(_ucs2 0x10291031102C1013103A), +(_ucs2 0x1021102D10141039), +(_ucs2 0x102310141039), +(_ucs2 0x1021102D1014103A), +(_ucs2 0x10231014103A), +(_ucs2 0x1021102F10141039), +(_ucs2 0x102510141039), +(_ucs2 0x1021102F1014103A), +(_ucs2 0x10251014103A), +(_ucs2 0x1021103110141039), +(_ucs2 0x102710141039), +(_ucs2 0x102110311014103A), +(_ucs2 0x10271014103A), +(_ucs2 0x10211031102C10141039), +(_ucs2 0x102910141039), +(_ucs2 0x10211031102C1014103A), +(_ucs2 0x10291014103A), +(_ucs2 0x10211031102C10141039), +(_ucs2 0x10291031102C10141039), +(_ucs2 0x10211031102C1014103A), +(_ucs2 0x10291031102C1014103A), +(_ucs2 0x1021102D10151039), +(_ucs2 0x102310151039), +(_ucs2 0x1021102D1015103A), +(_ucs2 0x10231015103A), +(_ucs2 0x1021102F10151039), +(_ucs2 0x102510151039), +(_ucs2 0x1021102F1015103A), +(_ucs2 0x10251015103A), +(_ucs2 0x1021103110151039), +(_ucs2 0x102710151039), +(_ucs2 0x102110311015103A), +(_ucs2 0x10271015103A), +(_ucs2 0x10211031102C10151039), +(_ucs2 0x102910151039), +(_ucs2 0x10211031102C1015103A), +(_ucs2 0x10291015103A), +(_ucs2 0x10211031102C10151039), +(_ucs2 0x10291031102C10151039), +(_ucs2 0x10211031102C1015103A), +(_ucs2 0x10291031102C1015103A), +(_ucs2 0x1021102D10161039), +(_ucs2 0x102310161039), +(_ucs2 0x1021102D1016103A), +(_ucs2 0x10231016103A), +(_ucs2 0x1021102F10161039), +(_ucs2 0x102510161039), +(_ucs2 0x1021102F1016103A), +(_ucs2 0x10251016103A), +(_ucs2 0x1021103110161039), +(_ucs2 0x102710161039), +(_ucs2 0x102110311016103A), +(_ucs2 0x10271016103A), +(_ucs2 0x10211031102C10161039), +(_ucs2 0x102910161039), +(_ucs2 0x10211031102C1016103A), +(_ucs2 0x10291016103A), +(_ucs2 0x10211031102C10161039), +(_ucs2 0x10291031102C10161039), +(_ucs2 0x10211031102C1016103A), +(_ucs2 0x10291031102C1016103A), +(_ucs2 0x1021102D10171039), +(_ucs2 0x102310171039), +(_ucs2 0x1021102D1017103A), +(_ucs2 0x10231017103A), +(_ucs2 0x1021102F10171039), +(_ucs2 0x102510171039), +(_ucs2 0x1021102F1017103A), +(_ucs2 0x10251017103A), +(_ucs2 0x1021103110171039), +(_ucs2 0x102710171039), +(_ucs2 0x102110311017103A), +(_ucs2 0x10271017103A), +(_ucs2 0x10211031102C10171039), +(_ucs2 0x102910171039), +(_ucs2 0x10211031102C1017103A), +(_ucs2 0x10291017103A), +(_ucs2 0x10211031102C10171039), +(_ucs2 0x10291031102C10171039), +(_ucs2 0x10211031102C1017103A), +(_ucs2 0x10291031102C1017103A), +(_ucs2 0x1021102D10181039), +(_ucs2 0x102310181039), +(_ucs2 0x1021102D1018103A), +(_ucs2 0x10231018103A), +(_ucs2 0x1021102F10181039), +(_ucs2 0x102510181039), +(_ucs2 0x1021102F1018103A), +(_ucs2 0x10251018103A), +(_ucs2 0x1021103110181039), +(_ucs2 0x102710181039), +(_ucs2 0x102110311018103A), +(_ucs2 0x10271018103A), +(_ucs2 0x10211031102C10181039), +(_ucs2 0x102910181039), +(_ucs2 0x10211031102C1018103A), +(_ucs2 0x10291018103A), +(_ucs2 0x10211031102C10181039), +(_ucs2 0x10291031102C10181039), +(_ucs2 0x10211031102C1018103A), +(_ucs2 0x10291031102C1018103A), +(_ucs2 0x1021102D10191039), +(_ucs2 0x102310191039), +(_ucs2 0x1021102D1019103A), +(_ucs2 0x10231019103A), +(_ucs2 0x1021102F10191039), +(_ucs2 0x102510191039), +(_ucs2 0x1021102F1019103A), +(_ucs2 0x10251019103A), +(_ucs2 0x1021103110191039), +(_ucs2 0x102710191039), +(_ucs2 0x102110311019103A), +(_ucs2 0x10271019103A), +(_ucs2 0x10211031102C10191039), +(_ucs2 0x102910191039), +(_ucs2 0x10211031102C1019103A), +(_ucs2 0x10291019103A), +(_ucs2 0x10211031102C10191039), +(_ucs2 0x10291031102C10191039), +(_ucs2 0x10211031102C1019103A), +(_ucs2 0x10291031102C1019103A), +(_ucs2 0x1021102D101A1039), +(_ucs2 0x1023101A1039), +(_ucs2 0x1021102D101A103A), +(_ucs2 0x1023101A103A), +(_ucs2 0x1021102F101A1039), +(_ucs2 0x1025101A1039), +(_ucs2 0x1021102F101A103A), +(_ucs2 0x1025101A103A), +(_ucs2 0x10211031101A1039), +(_ucs2 0x1027101A1039), +(_ucs2 0x10211031101A103A), +(_ucs2 0x1027101A103A), +(_ucs2 0x10211031102C101A1039), +(_ucs2 0x1029101A1039), +(_ucs2 0x10211031102C101A103A), +(_ucs2 0x1029101A103A), +(_ucs2 0x10211031102C101A1039), +(_ucs2 0x10291031102C101A1039), +(_ucs2 0x10211031102C101A103A), +(_ucs2 0x10291031102C101A103A), +(_ucs2 0x1021102D101B1039), +(_ucs2 0x1023101B1039), +(_ucs2 0x1021102D101B103A), +(_ucs2 0x1023101B103A), +(_ucs2 0x1021102F101B1039), +(_ucs2 0x1025101B1039), +(_ucs2 0x1021102F101B103A), +(_ucs2 0x1025101B103A), +(_ucs2 0x10211031101B1039), +(_ucs2 0x1027101B1039), +(_ucs2 0x10211031101B103A), +(_ucs2 0x1027101B103A), +(_ucs2 0x10211031102C101B1039), +(_ucs2 0x1029101B1039), +(_ucs2 0x10211031102C101B103A), +(_ucs2 0x1029101B103A), +(_ucs2 0x10211031102C101B1039), +(_ucs2 0x10291031102C101B1039), +(_ucs2 0x10211031102C101B103A), +(_ucs2 0x10291031102C101B103A), +(_ucs2 0x1021102D101C1039), +(_ucs2 0x1023101C1039), +(_ucs2 0x1021102D101C103A), +(_ucs2 0x1023101C103A), +(_ucs2 0x1021102F101C1039), +(_ucs2 0x1025101C1039), +(_ucs2 0x1021102F101C103A), +(_ucs2 0x1025101C103A), +(_ucs2 0x10211031101C1039), +(_ucs2 0x1027101C1039), +(_ucs2 0x10211031101C103A), +(_ucs2 0x1027101C103A), +(_ucs2 0x10211031102C101C1039), +(_ucs2 0x1029101C1039), +(_ucs2 0x10211031102C101C103A), +(_ucs2 0x1029101C103A), +(_ucs2 0x10211031102C101C1039), +(_ucs2 0x10291031102C101C1039), +(_ucs2 0x10211031102C101C103A), +(_ucs2 0x10291031102C101C103A), +(_ucs2 0x1021102D101E1039), +(_ucs2 0x1023101E1039), +(_ucs2 0x1021102D101E103A), +(_ucs2 0x1023101E103A), +(_ucs2 0x1021102F101E1039), +(_ucs2 0x1025101E1039), +(_ucs2 0x1021102F101E103A), +(_ucs2 0x1025101E103A), +(_ucs2 0x10211031101E1039), +(_ucs2 0x1027101E1039), +(_ucs2 0x10211031101E103A), +(_ucs2 0x1027101E103A), +(_ucs2 0x10211031102C101E1039), +(_ucs2 0x1029101E1039), +(_ucs2 0x10211031102C101E103A), +(_ucs2 0x1029101E103A), +(_ucs2 0x10211031102C101E1039), +(_ucs2 0x10291031102C101E1039), +(_ucs2 0x10211031102C101E103A), +(_ucs2 0x10291031102C101E103A), +(_ucs2 0x1021102D101F1039), +(_ucs2 0x1023101F1039), +(_ucs2 0x1021102D101F103A), +(_ucs2 0x1023101F103A), +(_ucs2 0x1021102F101F1039), +(_ucs2 0x1025101F1039), +(_ucs2 0x1021102F101F103A), +(_ucs2 0x1025101F103A), +(_ucs2 0x10211031101F1039), +(_ucs2 0x1027101F1039), +(_ucs2 0x10211031101F103A), +(_ucs2 0x1027101F103A), +(_ucs2 0x10211031102C101F1039), +(_ucs2 0x1029101F1039), +(_ucs2 0x10211031102C101F103A), +(_ucs2 0x1029101F103A), +(_ucs2 0x10211031102C101F1039), +(_ucs2 0x10291031102C101F1039), +(_ucs2 0x10211031102C101F103A), +(_ucs2 0x10291031102C101F103A), +('--- Contractions'), +(_ucs2 0x1031102C1000103A1000103B), +(_ucs2 0x1031102C1000103A103B /* (suffix of) man */), +(_ucs2 0x1014103A1014102F1015103A), +(_ucs2 0x1014103A102F1015103A /* (suffix of) I */), +('--- Great Sa'), +(_ucs2 0x1031101E1039101E), +(_ucs2 0x1031103F), +(_ucs2 0x102D101E1039101E), +(_ucs2 0x102D103F), +(_ucs2 0x102F101E1039101E), +(_ucs2 0x102F103F), +(_ucs2 0x1021102D101E1039101E), +(_ucs2 0x1023103F), +(_ucs2 0x1021102F101E1039101E), +(_ucs2 0x1025103F), +(_ucs2 0x101E1039101E), +(_ucs2 0x103F), +('--- Symbols - collate as long form'), +(_ucs2 0x1014103E102D102F1000103A), +(_ucs2 0x104C), +(_ucs2 0x101B103D10311037), +(_ucs2 0x104D), +(_ucs2 0x101C100A103A103810001031102C1004103A1038), +(_ucs2 0x104E1004103A1038), +(_ucs2 0x1021102D), +(_ucs2 0x104F), +('--- Short Forms may need to be added here'), +(_ucs2 0x101C1000103A101A102C), +(_ucs2 0x101C1000103A103B102C /* right hand side */), +(_ucs2 0x101E1019102E), +(_ucs2 0x101E10391019102E /* daughter */), +(_ucs2 0x101110191004103A1038), +(_ucs2 0x1011103910191004103A1038 /* cooked rice */), +(_ucs2 0x101C1000103A10181000103A), +(_ucs2 0x101C103910181000103A /* tea */); +SELECT id, IF(LEFT(s1,1)='-',s1,CONCAT(HEX(WEIGHT_STRING(s1)),'\t', HEX(CONVERT(s1 USING ucs2)))) FROM t1 ORDER BY id; +id IF(LEFT(s1,1)='-',s1,CONCAT(HEX(WEIGHT_STRING(s1)),'\t', HEX(CONVERT(s1 USING ucs2)))) +1 2259 108C +2 22593ACB 1037 +3 22593ACC 1038 +4 22593ACD 10371038 +5 --- Vowels +6 2232 102C +7 2232 102B +8 2246 1032 +9 22463ACB 1031102C +10 22463ACB 1031102B +11 22463ACC 1031102C103A +12 22463ACC 1031102B103A +13 2248 1034 +14 22483ACB 1036 +15 22483ACC 102D102F +16 --- Vowels with finals +17 22483ACD 10001039 +18 22483ACD 1000103A +19 22483ACE 102C10001039 +20 22483ACE 102C1000103A +21 22483ACE 102B10001039 +22 22483ACE 102B1000103A +23 22483ACF 102D10001039 +24 22483ACF 102D1000103A +25 22483AD0 102F10001039 +26 22483AD0 102F1000103A +27 22483AD1 103110001039 +28 22483AD1 10311000103A +29 22483AD2 1031102C10001039 +30 22483AD2 1031102C1000103A +31 22483AD2 1031102B10001039 +32 22483AD2 1031102B1000103A +33 22483AD3 102D102F10001039 +34 22483AD3 102D102F1000103A +35 22483AD4 10011039 +36 22483AD4 1001103A +37 22483AD5 102C10011039 +38 22483AD5 102C1001103A +39 22483AD5 102B10011039 +40 22483AD5 102B1001103A +41 22483AD6 102D10011039 +42 22483AD6 102D1001103A +43 22483AD7 102F10011039 +44 22483AD7 102F1001103A +45 22483AD8 103110011039 +46 22483AD8 10311001103A +47 22483AD9 1031102C10011039 +48 22483AD9 1031102C1001103A +49 22483AD9 1031102B10011039 +50 22483AD9 1031102B1001103A +51 22483ADA 102D102F10011039 +52 22483ADA 102D102F1001103A +53 22483ADB 10021039 +54 22483ADB 1002103A +55 22483ADC 102C10021039 +56 22483ADC 102C1002103A +57 22483ADC 102B10021039 +58 22483ADC 102B1002103A +59 22483ADD 102D10021039 +60 22483ADD 102D1002103A +61 22483ADE 102F10021039 +62 22483ADE 102F1002103A +63 22483ADF 103110021039 +64 22483ADF 10311002103A +65 22483AE0 1031102C10021039 +66 22483AE0 1031102C1002103A +67 22483AE0 1031102B10021039 +68 22483AE0 1031102B1002103A +69 22483AE1 102D102F10021039 +70 22483AE1 102D102F1002103A +71 22483AE2 10031039 +72 22483AE2 1003103A +73 22483AE3 102C10031039 +74 22483AE3 102C1003103A +75 22483AE3 102B10031039 +76 22483AE3 102B1003103A +77 22483AE4 102D10031039 +78 22483AE4 102D1003103A +79 22483AE5 102F10031039 +80 22483AE5 102F1003103A +81 22483AE6 103110031039 +82 22483AE6 10311003103A +83 22483AE7 1031102C10031039 +84 22483AE7 1031102C1003103A +85 22483AE7 1031102B10031039 +86 22483AE7 1031102B1003103A +87 22483AE8 102D102F10031039 +88 22483AE8 102D102F1003103A +89 22483AE9 1004103A1039 +90 22483AE9 1004103A +91 22483AEA 102C1004103A1039 +92 22483AEA 102C1004103A +93 22483AEA 102B1004103A1039 +94 22483AEA 102B1004103A +95 22483AEB 102D1004103A1039 +96 22483AEB 102D1004103A +97 22483AEC 102F1004103A1039 +98 22483AEC 102F1004103A +99 22483AED 10311004103A1039 +100 22483AED 10311004103A +101 22483AEE 1031102C1004103A1039 +102 22483AEE 1031102C1004103A +103 22483AEE 1031102B1004103A1039 +104 22483AEE 1031102B1004103A +105 22483AEF 102D102F1004103A1039 +106 22483AEF 102D102F1004103A +107 22483AF0 10051039 +108 22483AF0 1005103A +109 22483AF1 102C10051039 +110 22483AF1 102C1005103A +111 22483AF1 102B10051039 +112 22483AF1 102B1005103A +113 22483AF2 102D10051039 +114 22483AF2 102D1005103A +115 22483AF3 102F10051039 +116 22483AF3 102F1005103A +117 22483AF4 103110051039 +118 22483AF4 10311005103A +119 22483AF5 1031102C10051039 +120 22483AF5 1031102C1005103A +121 22483AF5 1031102B10051039 +122 22483AF5 1031102B1005103A +123 22483AF6 102D102F10051039 +124 22483AF6 102D102F1005103A +125 22483AF7 10061039 +126 22483AF7 1006103A +127 22483AF8 102C10061039 +128 22483AF8 102C1006103A +129 22483AF8 102B10061039 +130 22483AF8 102B1006103A +131 22483AF9 102D10061039 +132 22483AF9 102D1006103A +133 22483AFA 102F10061039 +134 22483AFA 102F1006103A +135 22483AFB 103110061039 +136 22483AFB 10311006103A +137 22483AFC 1031102C10061039 +138 22483AFC 1031102C1006103A +139 22483AFC 1031102B10061039 +140 22483AFC 1031102B1006103A +141 22483AFD 102D102F10061039 +142 22483AFD 102D102F1006103A +143 22483AFE 10071039 +144 22483AFE 1007103A +145 22483AFF 102C10071039 +146 22483AFF 102C1007103A +147 22483AFF 102B10071039 +148 22483AFF 102B1007103A +149 22483B00 102D10071039 +150 22483B00 102D1007103A +151 22483B01 102F10071039 +152 22483B01 102F1007103A +153 22483B02 103110071039 +154 22483B02 10311007103A +155 22483B03 1031102C10071039 +156 22483B03 1031102C1007103A +157 22483B03 1031102B10071039 +158 22483B03 1031102B1007103A +159 22483B04 102D102F10071039 +160 22483B04 102D102F1007103A +161 22483B05 1008103A +162 22483B06 102C1008103A +163 22483B06 102B1008103A +164 22483B07 102D1008103A +165 22483B08 102F1008103A +166 22483B09 10311008103A +167 22483B0A 1031102C1008103A +168 22483B0A 1031102B1008103A +169 22483B0B 102D102F1008103A +170 22483B0C 10091039 +171 22483B0C 1009103A +172 22483B0D 102C10091039 +173 22483B0D 102C1009103A +174 22483B0D 102B10091039 +175 22483B0D 102B1009103A +176 22483B0E 102D10091039 +177 22483B0E 102D1009103A +178 22483B0F 102F10091039 +179 22483B0F 102F1009103A +180 22483B10 103110091039 +181 22483B10 10311009103A +182 22483B11 1031102C10091039 +183 22483B11 1031102C1009103A +184 22483B11 1031102B10091039 +185 22483B11 1031102B1009103A +186 22483B12 102D102F10091039 +187 22483B12 102D102F1009103A +188 22483B13 100A1039 +189 22483B13 100A103A +190 22483B14 102C100A1039 +191 22483B14 102C100A103A +192 22483B14 102B100A1039 +193 22483B14 102B100A103A +194 22483B15 102D100A1039 +195 22483B15 102D100A103A +196 22483B16 102F100A1039 +197 22483B16 102F100A103A +198 22483B17 1031100A1039 +199 22483B17 1031100A103A +200 22483B18 1031102C100A1039 +201 22483B18 1031102C100A103A +202 22483B18 1031102B100A1039 +203 22483B18 1031102B100A103A +204 22483B19 102D102F100A1039 +205 22483B19 102D102F100A103A +206 22483B1A 100B1039 +207 22483B1A 100B103A +208 22483B1B 102C100B1039 +209 22483B1B 102C100B103A +210 22483B1B 102B100B1039 +211 22483B1B 102B100B103A +212 22483B1C 102D100B1039 +213 22483B1C 102D100B103A +214 22483B1D 102F100B1039 +215 22483B1D 102F100B103A +216 22483B1E 1031100B1039 +217 22483B1E 1031100B103A +218 22483B1F 1031102C100B1039 +219 22483B1F 1031102C100B103A +220 22483B1F 1031102B100B1039 +221 22483B1F 1031102B100B103A +222 22483B20 102D102F100B1039 +223 22483B20 102D102F100B103A +224 22483B21 100C1039 +225 22483B21 100C103A +226 22483B22 102C100C1039 +227 22483B22 102C100C103A +228 22483B22 102B100C1039 +229 22483B22 102B100C103A +230 22483B23 102D100C1039 +231 22483B23 102D100C103A +232 22483B24 102F100C1039 +233 22483B24 102F100C103A +234 22483B25 1031100C1039 +235 22483B25 1031100C103A +236 22483B26 1031102C100C1039 +237 22483B26 1031102C100C103A +238 22483B26 1031102B100C1039 +239 22483B26 1031102B100C103A +240 22483B27 102D102F100C1039 +241 22483B27 102D102F100C103A +242 22483B28 100D1039 +243 22483B28 100D103A +244 22483B29 102C100D1039 +245 22483B29 102C100D103A +246 22483B29 102B100D1039 +247 22483B29 102B100D103A +248 22483B2A 102D100D1039 +249 22483B2A 102D100D103A +250 22483B2B 102F100D1039 +251 22483B2B 102F100D103A +252 22483B2C 1031100D1039 +253 22483B2C 1031100D103A +254 22483B2D 1031102C100D1039 +255 22483B2D 1031102C100D103A +256 22483B2D 1031102B100D1039 +257 22483B2D 1031102B100D103A +258 22483B2E 102D102F100D1039 +259 22483B2E 102D102F100D103A +260 22483B2F 100E1039 +261 22483B2F 100E103A +262 22483B30 102C100E1039 +263 22483B30 102C100E103A +264 22483B30 102B100E1039 +265 22483B30 102B100E103A +266 22483B31 102D100E1039 +267 22483B31 102D100E103A +268 22483B32 102F100E1039 +269 22483B32 102F100E103A +270 22483B33 1031100E1039 +271 22483B33 1031100E103A +272 22483B34 1031102C100E1039 +273 22483B34 1031102C100E103A +274 22483B34 1031102B100E1039 +275 22483B34 1031102B100E103A +276 22483B35 102D102F100E1039 +277 22483B35 102D102F100E103A +278 22483B36 100F1039 +279 22483B36 100F103A +280 22483B37 102C100F1039 +281 22483B37 102C100F103A +282 22483B37 102B100F1039 +283 22483B37 102B100F103A +284 22483B38 102D100F1039 +285 22483B38 102D100F103A +286 22483B39 102F100F1039 +287 22483B39 102F100F103A +288 22483B3A 1031100F1039 +289 22483B3A 1031100F103A +290 22483B3B 1031102C100F1039 +291 22483B3B 1031102C100F103A +292 22483B3B 1031102B100F1039 +293 22483B3B 1031102B100F103A +294 22483B3C 102D102F100F1039 +295 22483B3C 102D102F100F103A +296 22483B3D 10101039 +297 22483B3D 1010103A +298 22483B3E 102C10101039 +299 22483B3E 102C1010103A +300 22483B3E 102B10101039 +301 22483B3E 102B1010103A +302 22483B3F 102D10101039 +303 22483B3F 102D1010103A +304 22483B40 102F10101039 +305 22483B40 102F1010103A +306 22483B41 103110101039 +307 22483B41 10311010103A +308 22483B42 1031102C10101039 +309 22483B42 1031102C1010103A +310 22483B42 1031102B10101039 +311 22483B42 1031102B1010103A +312 22483B43 102D102F10101039 +313 22483B43 102D102F1010103A +314 22483B44 10111039 +315 22483B44 1011103A +316 22483B45 102C10111039 +317 22483B45 102C1011103A +318 22483B45 102B10111039 +319 22483B45 102B1011103A +320 22483B46 102D10111039 +321 22483B46 102D1011103A +322 22483B47 102F10111039 +323 22483B47 102F1011103A +324 22483B48 103110111039 +325 22483B48 10311011103A +326 22483B49 1031102C10111039 +327 22483B49 1031102C1011103A +328 22483B49 1031102B10111039 +329 22483B49 1031102B1011103A +330 22483B4A 102D102F10111039 +331 22483B4A 102D102F1011103A +332 22483B4B 10121039 +333 22483B4B 1012103A +334 22483B4C 102C10121039 +335 22483B4C 102C1012103A +336 22483B4C 102B10121039 +337 22483B4C 102B1012103A +338 22483B4D 102D10121039 +339 22483B4D 102D1012103A +340 22483B4E 102F10121039 +341 22483B4E 102F1012103A +342 22483B4F 103110121039 +343 22483B4F 10311012103A +344 22483B50 1031102C10121039 +345 22483B50 1031102C1012103A +346 22483B50 1031102B10121039 +347 22483B50 1031102B1012103A +348 22483B51 102D102F10121039 +349 22483B51 102D102F1012103A +350 22483B52 10131039 +351 22483B52 1013103A +352 22483B53 102C10131039 +353 22483B53 102C1013103A +354 22483B53 102B10131039 +355 22483B53 102B1013103A +356 22483B54 102D10131039 +357 22483B54 102D1013103A +358 22483B55 102F10131039 +359 22483B55 102F1013103A +360 22483B56 103110131039 +361 22483B56 10311013103A +362 22483B57 1031102C10131039 +363 22483B57 1031102C1013103A +364 22483B57 1031102B10131039 +365 22483B57 1031102B1013103A +366 22483B58 102D102F10131039 +367 22483B58 102D102F1013103A +368 22483B59 10141039 +369 22483B59 1014103A +370 22483B5A 102C10141039 +371 22483B5A 102C1014103A +372 22483B5A 102B10141039 +373 22483B5A 102B1014103A +374 22483B5B 102D10141039 +375 22483B5B 102D1014103A +376 22483B5C 102F10141039 +377 22483B5C 102F1014103A +378 22483B5D 103110141039 +379 22483B5D 10311014103A +380 22483B5E 1031102C10141039 +381 22483B5E 1031102C1014103A +382 22483B5E 1031102B10141039 +383 22483B5E 1031102B1014103A +384 22483B5F 102D102F10141039 +385 22483B5F 102D102F1014103A +386 22483B60 10151039 +387 22483B60 1015103A +388 22483B61 102C10151039 +389 22483B61 102C1015103A +390 22483B61 102B10151039 +391 22483B61 102B1015103A +392 22483B62 102D10151039 +393 22483B62 102D1015103A +394 22483B63 102F10151039 +395 22483B63 102F1015103A +396 22483B64 103110151039 +397 22483B64 10311015103A +398 22483B65 1031102C10151039 +399 22483B65 1031102C1015103A +400 22483B65 1031102B10151039 +401 22483B65 1031102B1015103A +402 22483B66 102D102F10151039 +403 22483B66 102D102F1015103A +404 22483B67 10161039 +405 22483B67 1016103A +406 22483B68 102C10161039 +407 22483B68 102C1016103A +408 22483B68 102B10161039 +409 22483B68 102B1016103A +410 22483B69 102D10161039 +411 22483B69 102D1016103A +412 22483B6A 102F10161039 +413 22483B6A 102F1016103A +414 22483B6B 103110161039 +415 22483B6B 10311016103A +416 22483B6C 1031102C10161039 +417 22483B6C 1031102C1016103A +418 22483B6C 1031102B10161039 +419 22483B6C 1031102B1016103A +420 22483B6D 102D102F10161039 +421 22483B6D 102D102F1016103A +422 22483B6E 10171039 +423 22483B6E 1017103A +424 22483B6F 102C10171039 +425 22483B6F 102C1017103A +426 22483B6F 102B10171039 +427 22483B6F 102B1017103A +428 22483B70 102D10171039 +429 22483B70 102D1017103A +430 22483B71 102F10171039 +431 22483B71 102F1017103A +432 22483B72 103110171039 +433 22483B72 10311017103A +434 22483B73 1031102C10171039 +435 22483B73 1031102C1017103A +436 22483B73 1031102B10171039 +437 22483B73 1031102B1017103A +438 22483B74 102D102F10171039 +439 22483B74 102D102F1017103A +440 22483B75 10181039 +441 22483B75 1018103A +442 22483B76 102C10181039 +443 22483B76 102C1018103A +444 22483B76 102B10181039 +445 22483B76 102B1018103A +446 22483B77 102D10181039 +447 22483B77 102D1018103A +448 22483B78 102F10181039 +449 22483B78 102F1018103A +450 22483B79 103110181039 +451 22483B79 10311018103A +452 22483B7A 1031102C10181039 +453 22483B7A 1031102C1018103A +454 22483B7A 1031102B10181039 +455 22483B7A 1031102B1018103A +456 22483B7B 102D102F10181039 +457 22483B7B 102D102F1018103A +458 22483B7C 10191039 +459 22483B7C 1019103A +460 22483B7D 102C10191039 +461 22483B7D 102C1019103A +462 22483B7D 102B10191039 +463 22483B7D 102B1019103A +464 22483B7E 102D10191039 +465 22483B7E 102D1019103A +466 22483B7F 102F10191039 +467 22483B7F 102F1019103A +468 22483B80 103110191039 +469 22483B80 10311019103A +470 22483B81 1031102C10191039 +471 22483B81 1031102C1019103A +472 22483B81 1031102B10191039 +473 22483B81 1031102B1019103A +474 22483B82 102D102F10191039 +475 22483B82 102D102F1019103A +476 22483B83 101A1039 +477 22483B83 101A103A +478 22483B84 102C101A1039 +479 22483B84 102C101A103A +480 22483B84 102B101A1039 +481 22483B84 102B101A103A +482 22483B85 102D101A1039 +483 22483B85 102D101A103A +484 22483B86 102F101A1039 +485 22483B86 102F101A103A +486 22483B87 1031101A1039 +487 22483B87 1031101A103A +488 22483B88 1031102C101A1039 +489 22483B88 1031102C101A103A +490 22483B88 1031102B101A1039 +491 22483B88 1031102B101A103A +492 22483B89 102D102F101A1039 +493 22483B89 102D102F101A103A +494 22483B8A 101B1039 +495 22483B8A 101B103A +496 22483B8B 102C101B1039 +497 22483B8B 102C101B103A +498 22483B8B 102B101B1039 +499 22483B8B 102B101B103A +500 22483B8C 102D101B1039 +501 22483B8C 102D101B103A +502 22483B8D 102F101B1039 +503 22483B8D 102F101B103A +504 22483B8E 1031101B1039 +505 22483B8E 1031101B103A +506 22483B8F 1031102C101B1039 +507 22483B8F 1031102C101B103A +508 22483B8F 1031102B101B1039 +509 22483B8F 1031102B101B103A +510 22483B90 102D102F101B1039 +511 22483B90 102D102F101B103A +512 22483B91 101C1039 +513 22483B91 101C103A +514 22483B92 102C101C1039 +515 22483B92 102C101C103A +516 22483B92 102B101C1039 +517 22483B92 102B101C103A +518 22483B93 102D101C1039 +519 22483B93 102D101C103A +520 22483B94 102F101C1039 +521 22483B94 102F101C103A +522 22483B95 1031101C1039 +523 22483B95 1031101C103A +524 22483B96 1031102C101C1039 +525 22483B96 1031102C101C103A +526 22483B96 1031102B101C1039 +527 22483B96 1031102B101C103A +528 22483B97 102D102F101C1039 +529 22483B97 102D102F101C103A +530 22483B98 101D103A +531 22483B99 102C101D103A +532 22483B99 102B101D103A +533 22483B9A 102D101D103A +534 22483B9B 102F101D103A +535 22483B9C 1031101D103A +536 22483B9D 1031102C101D103A +537 22483B9D 1031102B101D103A +538 22483B9E 102D102F101D103A +539 22483B9F 101E1039 +540 22483B9F 101E103A +541 22483BA0 102C101E1039 +542 22483BA0 102C101E103A +543 22483BA0 102B101E1039 +544 22483BA0 102B101E103A +545 22483BA1 102D101E1039 +546 22483BA1 102D101E103A +547 22483BA2 102F101E1039 +548 22483BA2 102F101E103A +549 22483BA3 1031101E1039 +550 22483BA3 1031101E103A +551 22483BA4 1031102C101E1039 +552 22483BA4 1031102C101E103A +553 22483BA4 1031102B101E1039 +554 22483BA4 1031102B101E103A +555 22483BA5 102D102F101E1039 +556 22483BA5 102D102F101E103A +557 22483BA6 101F1039 +558 22483BA6 101F103A +559 22483BA7 102C101F1039 +560 22483BA7 102C101F103A +561 22483BA7 102B101F1039 +562 22483BA7 102B101F103A +563 22483BA8 102D101F1039 +564 22483BA8 102D101F103A +565 22483BA9 102F101F1039 +566 22483BA9 102F101F103A +567 22483BAA 1031101F1039 +568 22483BAA 1031101F103A +569 22483BAB 1031102C101F1039 +570 22483BAB 1031102C101F103A +571 22483BAB 1031102B101F1039 +572 22483BAB 1031102B101F103A +573 22483BAC 102D102F101F1039 +574 22483BAC 102D102F101F103A +575 22483BAD 1020103A +576 22483BAE 102C1020103A +577 22483BAE 102B1020103A +578 22483BAF 102D1020103A +579 22483BB0 102F1020103A +580 22483BB1 10311020103A +581 22483BB2 1031102C1020103A +582 22483BB2 1031102B1020103A +583 22483BB3 102D102F1020103A +584 22483BB4 1021103A +585 22483BB5 102C1021103A +586 22483BB5 102B1021103A +587 22483BB6 102D1021103A +588 22483BB7 102F1021103A +589 22483BB8 10311021103A +590 22483BB9 1031102C1021103A +591 22483BB9 1031102B1021103A +592 22483BBA 102D102F1021103A +593 --- Medials +594 22483BBB 105E +595 22483BBC 105F +596 22483BBD 103B +597 22483BBE 103C +598 22483BBF 1060 +599 22483BC0 103D +600 22483BC1 1082 +601 22483BC2 103E +602 22483BC3 103B103D +603 22483BC4 103C103D +604 22483BC5 103B103E +605 22483BC6 103C103E +606 22483BC7 103D103E +607 22483BC8 103B103D103E +608 22483BC9 103C103D103E +609 --- Independent vowels +610 22242236 1021102D +611 22242236 1023 +612 22242238 1021102E +613 22242238 1024 +614 2224223A 1021102F +615 2224223A 1025 +616 2224223D 10211030 +617 2224223D 1026 +618 22242242 10211031 +619 22242242 1027 +620 22242242 1028 +621 222422463ACB 10211031102C +622 222422463ACB 1029 +623 222422463ACC 10211031102C103A +624 222422463ACC 102A +625 22483B7E 102D1019103A +626 22483B7E3ACB 102D1036 +627 22483B7E3ACC 102D1019103A1037 +628 22483B7E3ACD 102D10361037 +629 22483B7E3ACE 102D1019103A1038 +630 22483B7E3ACF 102D10361038 +631 22483B7F 102F1019103A +632 22483B7F3ACB 102F1036 +633 22483B7F3ACC 102F1019103A1037 +634 22483B7F3ACD 102F10361037 +635 22483B7F3ACE 102F1019103A1038 +636 22483B7F3ACF 102F10361038 +637 222422483B7F3ACB 1021102F1036 +638 222422483B7F3ACB 1025102F1036 +639 --- Independent vowels with finals +640 222422483ACF 1021102D10001039 +641 222422483ACF 102310001039 +642 222422483ACF 1021102D1000103A +643 222422483ACF 10231000103A +644 222422483AD0 1021102F10001039 +645 222422483AD0 102510001039 +646 222422483AD0 1021102F1000103A +647 222422483AD0 10251000103A +648 222422483AD1 1021103110001039 +649 222422483AD1 102710001039 +650 222422483AD1 102110311000103A +651 222422483AD1 10271000103A +652 222422483AD2 10211031102C10001039 +653 222422483AD2 102910001039 +654 222422483AD2 10211031102C1000103A +655 222422483AD2 10291000103A +656 222422483AD2 10211031102C10001039 +657 222422483AD2 10291031102C10001039 +658 222422483AD2 10211031102C1000103A +659 222422483AD2 10291031102C1000103A +660 222422483AD6 1021102D10011039 +661 222422483AD6 102310011039 +662 222422483AD6 1021102D1001103A +663 222422483AD6 10231001103A +664 222422483AD7 1021102F10011039 +665 222422483AD7 102510011039 +666 222422483AD7 1021102F1001103A +667 222422483AD7 10251001103A +668 222422483AD8 1021103110011039 +669 222422483AD8 102710011039 +670 222422483AD8 102110311001103A +671 222422483AD8 10271001103A +672 222422483AD9 10211031102C10011039 +673 222422483AD9 102910011039 +674 222422483AD9 10211031102C1001103A +675 222422483AD9 10291001103A +676 222422483AD9 10211031102C10011039 +677 222422483AD9 10291031102C10011039 +678 222422483AD9 10211031102C1001103A +679 222422483AD9 10291031102C1001103A +680 222422483ADD 1021102D10021039 +681 222422483ADD 102310021039 +682 222422483ADD 1021102D1002103A +683 222422483ADD 10231002103A +684 222422483ADE 1021102F10021039 +685 222422483ADE 102510021039 +686 222422483ADE 1021102F1002103A +687 222422483ADE 10251002103A +688 222422483ADF 1021103110021039 +689 222422483ADF 102710021039 +690 222422483ADF 102110311002103A +691 222422483ADF 10271002103A +692 222422483AE0 10211031102C10021039 +693 222422483AE0 102910021039 +694 222422483AE0 10211031102C1002103A +695 222422483AE0 10291002103A +696 222422483AE0 10211031102C10021039 +697 222422483AE0 10291031102C10021039 +698 222422483AE0 10211031102C1002103A +699 222422483AE0 10291031102C1002103A +700 222422483AE4 1021102D10031039 +701 222422483AE4 102310031039 +702 222422483AE4 1021102D1003103A +703 222422483AE4 10231003103A +704 222422483AE5 1021102F10031039 +705 222422483AE5 102510031039 +706 222422483AE5 1021102F1003103A +707 222422483AE5 10251003103A +708 222422483AE6 1021103110031039 +709 222422483AE6 102710031039 +710 222422483AE6 102110311003103A +711 222422483AE6 10271003103A +712 222422483AE7 10211031102C10031039 +713 222422483AE7 102910031039 +714 222422483AE7 10211031102C1003103A +715 222422483AE7 10291003103A +716 222422483AE7 10211031102C10031039 +717 222422483AE7 10291031102C10031039 +718 222422483AE7 10211031102C1003103A +719 222422483AE7 10291031102C1003103A +720 2224223621D5224D 1021102D10041039 +721 2224223621D5224D 102310041039 +722 222422483AEB 1021102D1004103A +723 222422483AEB 10231004103A +724 2224223A21D5224D 1021102F10041039 +725 2224223A21D5224D 102510041039 +726 222422483AEC 1021102F1004103A +727 222422483AEC 10251004103A +728 2224224221D5224D 1021103110041039 +729 2224224221D5224D 102710041039 +730 222422483AED 102110311004103A +731 222422483AED 10271004103A +732 222422463ACB21D5224D 10211031102C10041039 +733 222422463ACB21D5224D 102910041039 +734 222422483AEE 10211031102C1004103A +735 222422483AEE 10291004103A +736 222422463ACB21D5224D 10211031102C10041039 +737 222422463ACB21D5224D 10291031102C10041039 +738 222422483AEE 10211031102C1004103A +739 222422483AEE 10291031102C1004103A +740 222422483AF2 1021102D10051039 +741 222422483AF2 102310051039 +742 222422483AF2 1021102D1005103A +743 222422483AF2 10231005103A +744 222422483AF3 1021102F10051039 +745 222422483AF3 102510051039 +746 222422483AF3 1021102F1005103A +747 222422483AF3 10251005103A +748 222422483AF4 1021103110051039 +749 222422483AF4 102710051039 +750 222422483AF4 102110311005103A +751 222422483AF4 10271005103A +752 222422483AF5 10211031102C10051039 +753 222422483AF5 102910051039 +754 222422483AF5 10211031102C1005103A +755 222422483AF5 10291005103A +756 222422483AF5 10211031102C10051039 +757 222422483AF5 10291031102C10051039 +758 222422483AF5 10211031102C1005103A +759 222422483AF5 10291031102C1005103A +760 222422483AF9 1021102D10061039 +761 222422483AF9 102310061039 +762 222422483AF9 1021102D1006103A +763 222422483AF9 10231006103A +764 222422483AFA 1021102F10061039 +765 222422483AFA 102510061039 +766 222422483AFA 1021102F1006103A +767 222422483AFA 10251006103A +768 222422483AFB 1021103110061039 +769 222422483AFB 102710061039 +770 222422483AFB 102110311006103A +771 222422483AFB 10271006103A +772 222422483AFC 10211031102C10061039 +773 222422483AFC 102910061039 +774 222422483AFC 10211031102C1006103A +775 222422483AFC 10291006103A +776 222422483AFC 10211031102C10061039 +777 222422483AFC 10291031102C10061039 +778 222422483AFC 10211031102C1006103A +779 222422483AFC 10291031102C1006103A +780 222422483B00 1021102D10071039 +781 222422483B00 102310071039 +782 222422483B00 1021102D1007103A +783 222422483B00 10231007103A +784 222422483B01 1021102F10071039 +785 222422483B01 102510071039 +786 222422483B01 1021102F1007103A +787 222422483B01 10251007103A +788 222422483B02 1021103110071039 +789 222422483B02 102710071039 +790 222422483B02 102110311007103A +791 222422483B02 10271007103A +792 222422483B03 10211031102C10071039 +793 222422483B03 102910071039 +794 222422483B03 10211031102C1007103A +795 222422483B03 10291007103A +796 222422483B03 10211031102C10071039 +797 222422483B03 10291031102C10071039 +798 222422483B03 10211031102C1007103A +799 222422483B03 10291031102C1007103A +800 222422483B0E 1021102D10091039 +801 222422483B0E 102310091039 +802 222422483B0E 1021102D1009103A +803 222422483B0E 10231009103A +804 222422483B0F 1021102F10091039 +805 222422483B0F 102510091039 +806 222422483B0F 1021102F1009103A +807 222422483B0F 10251009103A +808 222422483B10 1021103110091039 +809 222422483B10 102710091039 +810 222422483B10 102110311009103A +811 222422483B10 10271009103A +812 222422483B11 10211031102C10091039 +813 222422483B11 102910091039 +814 222422483B11 10211031102C1009103A +815 222422483B11 10291009103A +816 222422483B11 10211031102C10091039 +817 222422483B11 10291031102C10091039 +818 222422483B11 10211031102C1009103A +819 222422483B11 10291031102C1009103A +820 222422483B15 1021102D100A1039 +821 222422483B15 1023100A1039 +822 222422483B15 1021102D100A103A +823 222422483B15 1023100A103A +824 222422483B16 1021102F100A1039 +825 222422483B16 1025100A1039 +826 222422483B16 1021102F100A103A +827 222422483B16 1025100A103A +828 222422483B17 10211031100A1039 +829 222422483B17 1027100A1039 +830 222422483B17 10211031100A103A +831 222422483B17 1027100A103A +832 222422483B18 10211031102C100A1039 +833 222422483B18 1029100A1039 +834 222422483B18 10211031102C100A103A +835 222422483B18 1029100A103A +836 222422483B18 10211031102C100A1039 +837 222422483B18 10291031102C100A1039 +838 222422483B18 10211031102C100A103A +839 222422483B18 10291031102C100A103A +840 222422483B1C 1021102D100B1039 +841 222422483B1C 1023100B1039 +842 222422483B1C 1021102D100B103A +843 222422483B1C 1023100B103A +844 222422483B1D 1021102F100B1039 +845 222422483B1D 1025100B1039 +846 222422483B1D 1021102F100B103A +847 222422483B1D 1025100B103A +848 222422483B1E 10211031100B1039 +849 222422483B1E 1027100B1039 +850 222422483B1E 10211031100B103A +851 222422483B1E 1027100B103A +852 222422483B1F 10211031102C100B1039 +853 222422483B1F 1029100B1039 +854 222422483B1F 10211031102C100B103A +855 222422483B1F 1029100B103A +856 222422483B1F 10211031102C100B1039 +857 222422483B1F 10291031102C100B1039 +858 222422483B1F 10211031102C100B103A +859 222422483B1F 10291031102C100B103A +860 222422483B23 1021102D100C1039 +861 222422483B23 1023100C1039 +862 222422483B23 1021102D100C103A +863 222422483B23 1023100C103A +864 222422483B24 1021102F100C1039 +865 222422483B24 1025100C1039 +866 222422483B24 1021102F100C103A +867 222422483B24 1025100C103A +868 222422483B25 10211031100C1039 +869 222422483B25 1027100C1039 +870 222422483B25 10211031100C103A +871 222422483B25 1027100C103A +872 222422483B26 10211031102C100C1039 +873 222422483B26 1029100C1039 +874 222422483B26 10211031102C100C103A +875 222422483B26 1029100C103A +876 222422483B26 10211031102C100C1039 +877 222422483B26 10291031102C100C1039 +878 222422483B26 10211031102C100C103A +879 222422483B26 10291031102C100C103A +880 222422483B2A 1021102D100D1039 +881 222422483B2A 1023100D1039 +882 222422483B2A 1021102D100D103A +883 222422483B2A 1023100D103A +884 222422483B2B 1021102F100D1039 +885 222422483B2B 1025100D1039 +886 222422483B2B 1021102F100D103A +887 222422483B2B 1025100D103A +888 222422483B2C 10211031100D1039 +889 222422483B2C 1027100D1039 +890 222422483B2C 10211031100D103A +891 222422483B2C 1027100D103A +892 222422483B2D 10211031102C100D1039 +893 222422483B2D 1029100D1039 +894 222422483B2D 10211031102C100D103A +895 222422483B2D 1029100D103A +896 222422483B2D 10211031102C100D1039 +897 222422483B2D 10291031102C100D1039 +898 222422483B2D 10211031102C100D103A +899 222422483B2D 10291031102C100D103A +900 222422483B31 1021102D100E1039 +901 222422483B31 1023100E1039 +902 222422483B31 1021102D100E103A +903 222422483B31 1023100E103A +904 222422483B32 1021102F100E1039 +905 222422483B32 1025100E1039 +906 222422483B32 1021102F100E103A +907 222422483B32 1025100E103A +908 222422483B33 10211031100E1039 +909 222422483B33 1027100E1039 +910 222422483B33 10211031100E103A +911 222422483B33 1027100E103A +912 222422483B34 10211031102C100E1039 +913 222422483B34 1029100E1039 +914 222422483B34 10211031102C100E103A +915 222422483B34 1029100E103A +916 222422483B34 10211031102C100E1039 +917 222422483B34 10291031102C100E1039 +918 222422483B34 10211031102C100E103A +919 222422483B34 10291031102C100E103A +920 222422483B38 1021102D100F1039 +921 222422483B38 1023100F1039 +922 222422483B38 1021102D100F103A +923 222422483B38 1023100F103A +924 222422483B39 1021102F100F1039 +925 222422483B39 1025100F1039 +926 222422483B39 1021102F100F103A +927 222422483B39 1025100F103A +928 222422483B3A 10211031100F1039 +929 222422483B3A 1027100F1039 +930 222422483B3A 10211031100F103A +931 222422483B3A 1027100F103A +932 222422483B3B 10211031102C100F1039 +933 222422483B3B 1029100F1039 +934 222422483B3B 10211031102C100F103A +935 222422483B3B 1029100F103A +936 222422483B3B 10211031102C100F1039 +937 222422483B3B 10291031102C100F1039 +938 222422483B3B 10211031102C100F103A +939 222422483B3B 10291031102C100F103A +940 222422483B3F 1021102D10101039 +941 222422483B3F 102310101039 +942 222422483B3F 1021102D1010103A +943 222422483B3F 10231010103A +944 222422483B40 1021102F10101039 +945 222422483B40 102510101039 +946 222422483B40 1021102F1010103A +947 222422483B40 10251010103A +948 222422483B41 1021103110101039 +949 222422483B41 102710101039 +950 222422483B41 102110311010103A +951 222422483B41 10271010103A +952 222422483B42 10211031102C10101039 +953 222422483B42 102910101039 +954 222422483B42 10211031102C1010103A +955 222422483B42 10291010103A +956 222422483B42 10211031102C10101039 +957 222422483B42 10291031102C10101039 +958 222422483B42 10211031102C1010103A +959 222422483B42 10291031102C1010103A +960 222422483B46 1021102D10111039 +961 222422483B46 102310111039 +962 222422483B46 1021102D1011103A +963 222422483B46 10231011103A +964 222422483B47 1021102F10111039 +965 222422483B47 102510111039 +966 222422483B47 1021102F1011103A +967 222422483B47 10251011103A +968 222422483B48 1021103110111039 +969 222422483B48 102710111039 +970 222422483B48 102110311011103A +971 222422483B48 10271011103A +972 222422483B49 10211031102C10111039 +973 222422483B49 102910111039 +974 222422483B49 10211031102C1011103A +975 222422483B49 10291011103A +976 222422483B49 10211031102C10111039 +977 222422483B49 10291031102C10111039 +978 222422483B49 10211031102C1011103A +979 222422483B49 10291031102C1011103A +980 222422483B4D 1021102D10121039 +981 222422483B4D 102310121039 +982 222422483B4D 1021102D1012103A +983 222422483B4D 10231012103A +984 222422483B4E 1021102F10121039 +985 222422483B4E 102510121039 +986 222422483B4E 1021102F1012103A +987 222422483B4E 10251012103A +988 222422483B4F 1021103110121039 +989 222422483B4F 102710121039 +990 222422483B4F 102110311012103A +991 222422483B4F 10271012103A +992 222422483B50 10211031102C10121039 +993 222422483B50 102910121039 +994 222422483B50 10211031102C1012103A +995 222422483B50 10291012103A +996 222422483B50 10211031102C10121039 +997 222422483B50 10291031102C10121039 +998 222422483B50 10211031102C1012103A +999 222422483B50 10291031102C1012103A +1000 222422483B54 1021102D10131039 +1001 222422483B54 102310131039 +1002 222422483B54 1021102D1013103A +1003 222422483B54 10231013103A +1004 222422483B55 1021102F10131039 +1005 222422483B55 102510131039 +1006 222422483B55 1021102F1013103A +1007 222422483B55 10251013103A +1008 222422483B56 1021103110131039 +1009 222422483B56 102710131039 +1010 222422483B56 102110311013103A +1011 222422483B56 10271013103A +1012 222422483B57 10211031102C10131039 +1013 222422483B57 102910131039 +1014 222422483B57 10211031102C1013103A +1015 222422483B57 10291013103A +1016 222422483B57 10211031102C10131039 +1017 222422483B57 10291031102C10131039 +1018 222422483B57 10211031102C1013103A +1019 222422483B57 10291031102C1013103A +1020 222422483B5B 1021102D10141039 +1021 222422483B5B 102310141039 +1022 222422483B5B 1021102D1014103A +1023 222422483B5B 10231014103A +1024 222422483B5C 1021102F10141039 +1025 222422483B5C 102510141039 +1026 222422483B5C 1021102F1014103A +1027 222422483B5C 10251014103A +1028 222422483B5D 1021103110141039 +1029 222422483B5D 102710141039 +1030 222422483B5D 102110311014103A +1031 222422483B5D 10271014103A +1032 222422483B5E 10211031102C10141039 +1033 222422483B5E 102910141039 +1034 222422483B5E 10211031102C1014103A +1035 222422483B5E 10291014103A +1036 222422483B5E 10211031102C10141039 +1037 222422483B5E 10291031102C10141039 +1038 222422483B5E 10211031102C1014103A +1039 222422483B5E 10291031102C1014103A +1040 222422483B62 1021102D10151039 +1041 222422483B62 102310151039 +1042 222422483B62 1021102D1015103A +1043 222422483B62 10231015103A +1044 222422483B63 1021102F10151039 +1045 222422483B63 102510151039 +1046 222422483B63 1021102F1015103A +1047 222422483B63 10251015103A +1048 222422483B64 1021103110151039 +1049 222422483B64 102710151039 +1050 222422483B64 102110311015103A +1051 222422483B64 10271015103A +1052 222422483B65 10211031102C10151039 +1053 222422483B65 102910151039 +1054 222422483B65 10211031102C1015103A +1055 222422483B65 10291015103A +1056 222422483B65 10211031102C10151039 +1057 222422483B65 10291031102C10151039 +1058 222422483B65 10211031102C1015103A +1059 222422483B65 10291031102C1015103A +1060 222422483B69 1021102D10161039 +1061 222422483B69 102310161039 +1062 222422483B69 1021102D1016103A +1063 222422483B69 10231016103A +1064 222422483B6A 1021102F10161039 +1065 222422483B6A 102510161039 +1066 222422483B6A 1021102F1016103A +1067 222422483B6A 10251016103A +1068 222422483B6B 1021103110161039 +1069 222422483B6B 102710161039 +1070 222422483B6B 102110311016103A +1071 222422483B6B 10271016103A +1072 222422483B6C 10211031102C10161039 +1073 222422483B6C 102910161039 +1074 222422483B6C 10211031102C1016103A +1075 222422483B6C 10291016103A +1076 222422483B6C 10211031102C10161039 +1077 222422483B6C 10291031102C10161039 +1078 222422483B6C 10211031102C1016103A +1079 222422483B6C 10291031102C1016103A +1080 222422483B70 1021102D10171039 +1081 222422483B70 102310171039 +1082 222422483B70 1021102D1017103A +1083 222422483B70 10231017103A +1084 222422483B71 1021102F10171039 +1085 222422483B71 102510171039 +1086 222422483B71 1021102F1017103A +1087 222422483B71 10251017103A +1088 222422483B72 1021103110171039 +1089 222422483B72 102710171039 +1090 222422483B72 102110311017103A +1091 222422483B72 10271017103A +1092 222422483B73 10211031102C10171039 +1093 222422483B73 102910171039 +1094 222422483B73 10211031102C1017103A +1095 222422483B73 10291017103A +1096 222422483B73 10211031102C10171039 +1097 222422483B73 10291031102C10171039 +1098 222422483B73 10211031102C1017103A +1099 222422483B73 10291031102C1017103A +1100 222422483B77 1021102D10181039 +1101 222422483B77 102310181039 +1102 222422483B77 1021102D1018103A +1103 222422483B77 10231018103A +1104 222422483B78 1021102F10181039 +1105 222422483B78 102510181039 +1106 222422483B78 1021102F1018103A +1107 222422483B78 10251018103A +1108 222422483B79 1021103110181039 +1109 222422483B79 102710181039 +1110 222422483B79 102110311018103A +1111 222422483B79 10271018103A +1112 222422483B7A 10211031102C10181039 +1113 222422483B7A 102910181039 +1114 222422483B7A 10211031102C1018103A +1115 222422483B7A 10291018103A +1116 222422483B7A 10211031102C10181039 +1117 222422483B7A 10291031102C10181039 +1118 222422483B7A 10211031102C1018103A +1119 222422483B7A 10291031102C1018103A +1120 222422483B7E 1021102D10191039 +1121 222422483B7E 102310191039 +1122 222422483B7E 1021102D1019103A +1123 222422483B7E 10231019103A +1124 222422483B7F 1021102F10191039 +1125 222422483B7F 102510191039 +1126 222422483B7F 1021102F1019103A +1127 222422483B7F 10251019103A +1128 222422483B80 1021103110191039 +1129 222422483B80 102710191039 +1130 222422483B80 102110311019103A +1131 222422483B80 10271019103A +1132 222422483B81 10211031102C10191039 +1133 222422483B81 102910191039 +1134 222422483B81 10211031102C1019103A +1135 222422483B81 10291019103A +1136 222422483B81 10211031102C10191039 +1137 222422483B81 10291031102C10191039 +1138 222422483B81 10211031102C1019103A +1139 222422483B81 10291031102C1019103A +1140 222422483B85 1021102D101A1039 +1141 222422483B85 1023101A1039 +1142 222422483B85 1021102D101A103A +1143 222422483B85 1023101A103A +1144 222422483B86 1021102F101A1039 +1145 222422483B86 1025101A1039 +1146 222422483B86 1021102F101A103A +1147 222422483B86 1025101A103A +1148 222422483B87 10211031101A1039 +1149 222422483B87 1027101A1039 +1150 222422483B87 10211031101A103A +1151 222422483B87 1027101A103A +1152 222422483B88 10211031102C101A1039 +1153 222422483B88 1029101A1039 +1154 222422483B88 10211031102C101A103A +1155 222422483B88 1029101A103A +1156 222422483B88 10211031102C101A1039 +1157 222422483B88 10291031102C101A1039 +1158 222422483B88 10211031102C101A103A +1159 222422483B88 10291031102C101A103A +1160 222422483B8C 1021102D101B1039 +1161 222422483B8C 1023101B1039 +1162 222422483B8C 1021102D101B103A +1163 222422483B8C 1023101B103A +1164 222422483B8D 1021102F101B1039 +1165 222422483B8D 1025101B1039 +1166 222422483B8D 1021102F101B103A +1167 222422483B8D 1025101B103A +1168 222422483B8E 10211031101B1039 +1169 222422483B8E 1027101B1039 +1170 222422483B8E 10211031101B103A +1171 222422483B8E 1027101B103A +1172 222422483B8F 10211031102C101B1039 +1173 222422483B8F 1029101B1039 +1174 222422483B8F 10211031102C101B103A +1175 222422483B8F 1029101B103A +1176 222422483B8F 10211031102C101B1039 +1177 222422483B8F 10291031102C101B1039 +1178 222422483B8F 10211031102C101B103A +1179 222422483B8F 10291031102C101B103A +1180 222422483B93 1021102D101C1039 +1181 222422483B93 1023101C1039 +1182 222422483B93 1021102D101C103A +1183 222422483B93 1023101C103A +1184 222422483B94 1021102F101C1039 +1185 222422483B94 1025101C1039 +1186 222422483B94 1021102F101C103A +1187 222422483B94 1025101C103A +1188 222422483B95 10211031101C1039 +1189 222422483B95 1027101C1039 +1190 222422483B95 10211031101C103A +1191 222422483B95 1027101C103A +1192 222422483B96 10211031102C101C1039 +1193 222422483B96 1029101C1039 +1194 222422483B96 10211031102C101C103A +1195 222422483B96 1029101C103A +1196 222422483B96 10211031102C101C1039 +1197 222422483B96 10291031102C101C1039 +1198 222422483B96 10211031102C101C103A +1199 222422483B96 10291031102C101C103A +1200 222422483BA1 1021102D101E1039 +1201 222422483BA1 1023101E1039 +1202 222422483BA1 1021102D101E103A +1203 222422483BA1 1023101E103A +1204 222422483BA2 1021102F101E1039 +1205 222422483BA2 1025101E1039 +1206 222422483BA2 1021102F101E103A +1207 222422483BA2 1025101E103A +1208 222422483BA3 10211031101E1039 +1209 222422483BA3 1027101E1039 +1210 222422483BA3 10211031101E103A +1211 222422483BA3 1027101E103A +1212 222422483BA4 10211031102C101E1039 +1213 222422483BA4 1029101E1039 +1214 222422483BA4 10211031102C101E103A +1215 222422483BA4 1029101E103A +1216 222422483BA4 10211031102C101E1039 +1217 222422483BA4 10291031102C101E1039 +1218 222422483BA4 10211031102C101E103A +1219 222422483BA4 10291031102C101E103A +1220 222422483BA8 1021102D101F1039 +1221 222422483BA8 1023101F1039 +1222 222422483BA8 1021102D101F103A +1223 222422483BA8 1023101F103A +1224 222422483BA9 1021102F101F1039 +1225 222422483BA9 1025101F1039 +1226 222422483BA9 1021102F101F103A +1227 222422483BA9 1025101F103A +1228 222422483BAA 10211031101F1039 +1229 222422483BAA 1027101F1039 +1230 222422483BAA 10211031101F103A +1231 222422483BAA 1027101F103A +1232 222422483BAB 10211031102C101F1039 +1233 222422483BAB 1029101F1039 +1234 222422483BAB 10211031102C101F103A +1235 222422483BAB 1029101F103A +1236 222422483BAB 10211031102C101F1039 +1237 222422483BAB 10291031102C101F1039 +1238 222422483BAB 10211031102C101F103A +1239 222422483BAB 10291031102C101F103A +1240 --- Contractions +1241 22483AD221CD22483BBD 1031102C1000103A1000103B +1242 22483AD221CD22483BBD 1031102C1000103A103B +1243 22483B5921F822483B63 1014103A1014102F1015103A +1244 22483B5921F822483B63 1014103A102F1015103A +1245 --- Great Sa +1246 22483BA32216 1031101E1039101E +1247 22483BA32216 1031103F +1248 22483BA12216 102D101E1039101E +1249 22483BA12216 102D103F +1250 22483BA22216 102F101E1039101E +1251 22483BA22216 102F103F +1252 222422483BA12216 1021102D101E1039101E +1253 222422483BA12216 1023103F +1254 222422483BA22216 1021102F101E1039101E +1255 222422483BA22216 1025103F +1256 22483B9F2216 101E1039101E +1257 22483B9F2216 103F +1258 --- Symbols - collate as long form +1259 21F822483BC222483AD3 1014103E102D102F1000103A +1260 21F822483BC222483AD3 104C +1261 220922483BC0224222593ACB 101B103D10311037 +1262 220922483BC0224222593ACB 104D +1263 220D22483B1322593ACC21CD22483AEE22593ACC 101C100A103A103810001031102C1004103A1038 +1264 220D22483B1322593ACC21CD22483AEE22593ACC 104E1004103A1038 +1265 22242236 1021102D +1266 22242236 104F +1267 --- Short Forms may need to be added here +1268 220D22483ACD22072232 101C1000103A101A102C +1269 220D22483ACD22072232 101C1000103A103B102C +1270 221622052238 101E1019102E +1271 221622052238 101E10391019102E +1272 21F3220522483AE922593ACC 101110191004103A1038 +1273 21F3220522483AE922593ACC 1011103910191004103A1038 +1274 220D22483ACD220422483ACD 101C1000103A10181000103A +1275 220D22483ACD220422483ACD 101C103910181000103A +DROP TABLE t1; +# +# END of ctype_myanmar.inc +# +SET collation_connection=ucs2_myanmar_ci; +# +# Start of ctype_myanmar.inc +# +SELECT @@collation_connection; +@@collation_connection +ucs2_myanmar_ci +CREATE TABLE t1 AS SELECT 100000 AS id, REPEAT(' ', 64) AS s1 LIMIT 0; +SELECT COLLATION(s1) FROM t1; +COLLATION(s1) +DELETE FROM t1; +ALTER TABLE t1 MODIFY id INT NOT NULL AUTO_INCREMENT PRIMARY KEY; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `s1` varchar(64) CHARACTER SET ucs2 COLLATE ucs2_myanmar_ci DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (s1) VALUES +(_ucs2 0x108C), +(_ucs2 0x1037), +(_ucs2 0x1038), +(_ucs2 0x10371038), +('--- Vowels'), +(_ucs2 0x102C), +(_ucs2 0x102B), +(_ucs2 0x1032), +(_ucs2 0x1031102C), +(_ucs2 0x1031102B), +(_ucs2 0x1031102C103A), +(_ucs2 0x1031102B103A), +(_ucs2 0x1034), +(_ucs2 0x1036), +(_ucs2 0x102D102F), +('--- Vowels with finals'), +(_ucs2 0x10001039), +(_ucs2 0x1000103A), +(_ucs2 0x102C10001039), +(_ucs2 0x102C1000103A), +(_ucs2 0x102B10001039), +(_ucs2 0x102B1000103A), +(_ucs2 0x102D10001039), +(_ucs2 0x102D1000103A), +(_ucs2 0x102F10001039), +(_ucs2 0x102F1000103A), +(_ucs2 0x103110001039), +(_ucs2 0x10311000103A), +(_ucs2 0x1031102C10001039), +(_ucs2 0x1031102C1000103A), +(_ucs2 0x1031102B10001039), +(_ucs2 0x1031102B1000103A), +(_ucs2 0x102D102F10001039), +(_ucs2 0x102D102F1000103A), +(_ucs2 0x10011039), +(_ucs2 0x1001103A), +(_ucs2 0x102C10011039), +(_ucs2 0x102C1001103A), +(_ucs2 0x102B10011039), +(_ucs2 0x102B1001103A), +(_ucs2 0x102D10011039), +(_ucs2 0x102D1001103A), +(_ucs2 0x102F10011039), +(_ucs2 0x102F1001103A), +(_ucs2 0x103110011039), +(_ucs2 0x10311001103A), +(_ucs2 0x1031102C10011039), +(_ucs2 0x1031102C1001103A), +(_ucs2 0x1031102B10011039), +(_ucs2 0x1031102B1001103A), +(_ucs2 0x102D102F10011039), +(_ucs2 0x102D102F1001103A), +(_ucs2 0x10021039), +(_ucs2 0x1002103A), +(_ucs2 0x102C10021039), +(_ucs2 0x102C1002103A), +(_ucs2 0x102B10021039), +(_ucs2 0x102B1002103A), +(_ucs2 0x102D10021039), +(_ucs2 0x102D1002103A), +(_ucs2 0x102F10021039), +(_ucs2 0x102F1002103A), +(_ucs2 0x103110021039), +(_ucs2 0x10311002103A), +(_ucs2 0x1031102C10021039), +(_ucs2 0x1031102C1002103A), +(_ucs2 0x1031102B10021039), +(_ucs2 0x1031102B1002103A), +(_ucs2 0x102D102F10021039), +(_ucs2 0x102D102F1002103A), +(_ucs2 0x10031039), +(_ucs2 0x1003103A), +(_ucs2 0x102C10031039), +(_ucs2 0x102C1003103A), +(_ucs2 0x102B10031039), +(_ucs2 0x102B1003103A), +(_ucs2 0x102D10031039), +(_ucs2 0x102D1003103A), +(_ucs2 0x102F10031039), +(_ucs2 0x102F1003103A), +(_ucs2 0x103110031039), +(_ucs2 0x10311003103A), +(_ucs2 0x1031102C10031039), +(_ucs2 0x1031102C1003103A), +(_ucs2 0x1031102B10031039), +(_ucs2 0x1031102B1003103A), +(_ucs2 0x102D102F10031039), +(_ucs2 0x102D102F1003103A), +(_ucs2 0x1004103A1039), +(_ucs2 0x1004103A), +(_ucs2 0x102C1004103A1039), +(_ucs2 0x102C1004103A), +(_ucs2 0x102B1004103A1039), +(_ucs2 0x102B1004103A), +(_ucs2 0x102D1004103A1039), +(_ucs2 0x102D1004103A), +(_ucs2 0x102F1004103A1039), +(_ucs2 0x102F1004103A), +(_ucs2 0x10311004103A1039), +(_ucs2 0x10311004103A), +(_ucs2 0x1031102C1004103A1039), +(_ucs2 0x1031102C1004103A), +(_ucs2 0x1031102B1004103A1039), +(_ucs2 0x1031102B1004103A), +(_ucs2 0x102D102F1004103A1039), +(_ucs2 0x102D102F1004103A), +(_ucs2 0x10051039), +(_ucs2 0x1005103A), +(_ucs2 0x102C10051039), +(_ucs2 0x102C1005103A), +(_ucs2 0x102B10051039), +(_ucs2 0x102B1005103A), +(_ucs2 0x102D10051039), +(_ucs2 0x102D1005103A), +(_ucs2 0x102F10051039), +(_ucs2 0x102F1005103A), +(_ucs2 0x103110051039), +(_ucs2 0x10311005103A), +(_ucs2 0x1031102C10051039), +(_ucs2 0x1031102C1005103A), +(_ucs2 0x1031102B10051039), +(_ucs2 0x1031102B1005103A), +(_ucs2 0x102D102F10051039), +(_ucs2 0x102D102F1005103A), +(_ucs2 0x10061039), +(_ucs2 0x1006103A), +(_ucs2 0x102C10061039), +(_ucs2 0x102C1006103A), +(_ucs2 0x102B10061039), +(_ucs2 0x102B1006103A), +(_ucs2 0x102D10061039), +(_ucs2 0x102D1006103A), +(_ucs2 0x102F10061039), +(_ucs2 0x102F1006103A), +(_ucs2 0x103110061039), +(_ucs2 0x10311006103A), +(_ucs2 0x1031102C10061039), +(_ucs2 0x1031102C1006103A), +(_ucs2 0x1031102B10061039), +(_ucs2 0x1031102B1006103A), +(_ucs2 0x102D102F10061039), +(_ucs2 0x102D102F1006103A), +(_ucs2 0x10071039), +(_ucs2 0x1007103A), +(_ucs2 0x102C10071039), +(_ucs2 0x102C1007103A), +(_ucs2 0x102B10071039), +(_ucs2 0x102B1007103A), +(_ucs2 0x102D10071039), +(_ucs2 0x102D1007103A), +(_ucs2 0x102F10071039), +(_ucs2 0x102F1007103A), +(_ucs2 0x103110071039), +(_ucs2 0x10311007103A), +(_ucs2 0x1031102C10071039), +(_ucs2 0x1031102C1007103A), +(_ucs2 0x1031102B10071039), +(_ucs2 0x1031102B1007103A), +(_ucs2 0x102D102F10071039), +(_ucs2 0x102D102F1007103A), +(_ucs2 0x1008103A), +(_ucs2 0x102C1008103A), +(_ucs2 0x102B1008103A), +(_ucs2 0x102D1008103A), +(_ucs2 0x102F1008103A), +(_ucs2 0x10311008103A), +(_ucs2 0x1031102C1008103A), +(_ucs2 0x1031102B1008103A), +(_ucs2 0x102D102F1008103A), +(_ucs2 0x10091039), +(_ucs2 0x1009103A), +(_ucs2 0x102C10091039), +(_ucs2 0x102C1009103A), +(_ucs2 0x102B10091039), +(_ucs2 0x102B1009103A), +(_ucs2 0x102D10091039), +(_ucs2 0x102D1009103A), +(_ucs2 0x102F10091039), +(_ucs2 0x102F1009103A), +(_ucs2 0x103110091039), +(_ucs2 0x10311009103A), +(_ucs2 0x1031102C10091039), +(_ucs2 0x1031102C1009103A), +(_ucs2 0x1031102B10091039), +(_ucs2 0x1031102B1009103A), +(_ucs2 0x102D102F10091039), +(_ucs2 0x102D102F1009103A), +(_ucs2 0x100A1039), +(_ucs2 0x100A103A), +(_ucs2 0x102C100A1039), +(_ucs2 0x102C100A103A), +(_ucs2 0x102B100A1039), +(_ucs2 0x102B100A103A), +(_ucs2 0x102D100A1039), +(_ucs2 0x102D100A103A), +(_ucs2 0x102F100A1039), +(_ucs2 0x102F100A103A), +(_ucs2 0x1031100A1039), +(_ucs2 0x1031100A103A), +(_ucs2 0x1031102C100A1039), +(_ucs2 0x1031102C100A103A), +(_ucs2 0x1031102B100A1039), +(_ucs2 0x1031102B100A103A), +(_ucs2 0x102D102F100A1039), +(_ucs2 0x102D102F100A103A), +(_ucs2 0x100B1039), +(_ucs2 0x100B103A), +(_ucs2 0x102C100B1039), +(_ucs2 0x102C100B103A), +(_ucs2 0x102B100B1039), +(_ucs2 0x102B100B103A), +(_ucs2 0x102D100B1039), +(_ucs2 0x102D100B103A), +(_ucs2 0x102F100B1039), +(_ucs2 0x102F100B103A), +(_ucs2 0x1031100B1039), +(_ucs2 0x1031100B103A), +(_ucs2 0x1031102C100B1039), +(_ucs2 0x1031102C100B103A), +(_ucs2 0x1031102B100B1039), +(_ucs2 0x1031102B100B103A), +(_ucs2 0x102D102F100B1039), +(_ucs2 0x102D102F100B103A), +(_ucs2 0x100C1039), +(_ucs2 0x100C103A), +(_ucs2 0x102C100C1039), +(_ucs2 0x102C100C103A), +(_ucs2 0x102B100C1039), +(_ucs2 0x102B100C103A), +(_ucs2 0x102D100C1039), +(_ucs2 0x102D100C103A), +(_ucs2 0x102F100C1039), +(_ucs2 0x102F100C103A), +(_ucs2 0x1031100C1039), +(_ucs2 0x1031100C103A), +(_ucs2 0x1031102C100C1039), +(_ucs2 0x1031102C100C103A), +(_ucs2 0x1031102B100C1039), +(_ucs2 0x1031102B100C103A), +(_ucs2 0x102D102F100C1039), +(_ucs2 0x102D102F100C103A), +(_ucs2 0x100D1039), +(_ucs2 0x100D103A), +(_ucs2 0x102C100D1039), +(_ucs2 0x102C100D103A), +(_ucs2 0x102B100D1039), +(_ucs2 0x102B100D103A), +(_ucs2 0x102D100D1039), +(_ucs2 0x102D100D103A), +(_ucs2 0x102F100D1039), +(_ucs2 0x102F100D103A), +(_ucs2 0x1031100D1039), +(_ucs2 0x1031100D103A), +(_ucs2 0x1031102C100D1039), +(_ucs2 0x1031102C100D103A), +(_ucs2 0x1031102B100D1039), +(_ucs2 0x1031102B100D103A), +(_ucs2 0x102D102F100D1039), +(_ucs2 0x102D102F100D103A), +(_ucs2 0x100E1039), +(_ucs2 0x100E103A), +(_ucs2 0x102C100E1039), +(_ucs2 0x102C100E103A), +(_ucs2 0x102B100E1039), +(_ucs2 0x102B100E103A), +(_ucs2 0x102D100E1039), +(_ucs2 0x102D100E103A), +(_ucs2 0x102F100E1039), +(_ucs2 0x102F100E103A), +(_ucs2 0x1031100E1039), +(_ucs2 0x1031100E103A), +(_ucs2 0x1031102C100E1039), +(_ucs2 0x1031102C100E103A), +(_ucs2 0x1031102B100E1039), +(_ucs2 0x1031102B100E103A), +(_ucs2 0x102D102F100E1039), +(_ucs2 0x102D102F100E103A), +(_ucs2 0x100F1039), +(_ucs2 0x100F103A), +(_ucs2 0x102C100F1039), +(_ucs2 0x102C100F103A), +(_ucs2 0x102B100F1039), +(_ucs2 0x102B100F103A), +(_ucs2 0x102D100F1039), +(_ucs2 0x102D100F103A), +(_ucs2 0x102F100F1039), +(_ucs2 0x102F100F103A), +(_ucs2 0x1031100F1039), +(_ucs2 0x1031100F103A), +(_ucs2 0x1031102C100F1039), +(_ucs2 0x1031102C100F103A), +(_ucs2 0x1031102B100F1039), +(_ucs2 0x1031102B100F103A), +(_ucs2 0x102D102F100F1039), +(_ucs2 0x102D102F100F103A), +(_ucs2 0x10101039), +(_ucs2 0x1010103A), +(_ucs2 0x102C10101039), +(_ucs2 0x102C1010103A), +(_ucs2 0x102B10101039), +(_ucs2 0x102B1010103A), +(_ucs2 0x102D10101039), +(_ucs2 0x102D1010103A), +(_ucs2 0x102F10101039), +(_ucs2 0x102F1010103A), +(_ucs2 0x103110101039), +(_ucs2 0x10311010103A), +(_ucs2 0x1031102C10101039), +(_ucs2 0x1031102C1010103A), +(_ucs2 0x1031102B10101039), +(_ucs2 0x1031102B1010103A), +(_ucs2 0x102D102F10101039), +(_ucs2 0x102D102F1010103A), +(_ucs2 0x10111039), +(_ucs2 0x1011103A), +(_ucs2 0x102C10111039), +(_ucs2 0x102C1011103A), +(_ucs2 0x102B10111039), +(_ucs2 0x102B1011103A), +(_ucs2 0x102D10111039), +(_ucs2 0x102D1011103A), +(_ucs2 0x102F10111039), +(_ucs2 0x102F1011103A), +(_ucs2 0x103110111039), +(_ucs2 0x10311011103A), +(_ucs2 0x1031102C10111039), +(_ucs2 0x1031102C1011103A), +(_ucs2 0x1031102B10111039), +(_ucs2 0x1031102B1011103A), +(_ucs2 0x102D102F10111039), +(_ucs2 0x102D102F1011103A), +(_ucs2 0x10121039), +(_ucs2 0x1012103A), +(_ucs2 0x102C10121039), +(_ucs2 0x102C1012103A), +(_ucs2 0x102B10121039), +(_ucs2 0x102B1012103A), +(_ucs2 0x102D10121039), +(_ucs2 0x102D1012103A), +(_ucs2 0x102F10121039), +(_ucs2 0x102F1012103A), +(_ucs2 0x103110121039), +(_ucs2 0x10311012103A), +(_ucs2 0x1031102C10121039), +(_ucs2 0x1031102C1012103A), +(_ucs2 0x1031102B10121039), +(_ucs2 0x1031102B1012103A), +(_ucs2 0x102D102F10121039), +(_ucs2 0x102D102F1012103A), +(_ucs2 0x10131039), +(_ucs2 0x1013103A), +(_ucs2 0x102C10131039), +(_ucs2 0x102C1013103A), +(_ucs2 0x102B10131039), +(_ucs2 0x102B1013103A), +(_ucs2 0x102D10131039), +(_ucs2 0x102D1013103A), +(_ucs2 0x102F10131039), +(_ucs2 0x102F1013103A), +(_ucs2 0x103110131039), +(_ucs2 0x10311013103A), +(_ucs2 0x1031102C10131039), +(_ucs2 0x1031102C1013103A), +(_ucs2 0x1031102B10131039), +(_ucs2 0x1031102B1013103A), +(_ucs2 0x102D102F10131039), +(_ucs2 0x102D102F1013103A), +(_ucs2 0x10141039), +(_ucs2 0x1014103A), +(_ucs2 0x102C10141039), +(_ucs2 0x102C1014103A), +(_ucs2 0x102B10141039), +(_ucs2 0x102B1014103A), +(_ucs2 0x102D10141039), +(_ucs2 0x102D1014103A), +(_ucs2 0x102F10141039), +(_ucs2 0x102F1014103A), +(_ucs2 0x103110141039), +(_ucs2 0x10311014103A), +(_ucs2 0x1031102C10141039), +(_ucs2 0x1031102C1014103A), +(_ucs2 0x1031102B10141039), +(_ucs2 0x1031102B1014103A), +(_ucs2 0x102D102F10141039), +(_ucs2 0x102D102F1014103A), +(_ucs2 0x10151039), +(_ucs2 0x1015103A), +(_ucs2 0x102C10151039), +(_ucs2 0x102C1015103A), +(_ucs2 0x102B10151039), +(_ucs2 0x102B1015103A), +(_ucs2 0x102D10151039), +(_ucs2 0x102D1015103A), +(_ucs2 0x102F10151039), +(_ucs2 0x102F1015103A), +(_ucs2 0x103110151039), +(_ucs2 0x10311015103A), +(_ucs2 0x1031102C10151039), +(_ucs2 0x1031102C1015103A), +(_ucs2 0x1031102B10151039), +(_ucs2 0x1031102B1015103A), +(_ucs2 0x102D102F10151039), +(_ucs2 0x102D102F1015103A), +(_ucs2 0x10161039), +(_ucs2 0x1016103A), +(_ucs2 0x102C10161039), +(_ucs2 0x102C1016103A), +(_ucs2 0x102B10161039), +(_ucs2 0x102B1016103A), +(_ucs2 0x102D10161039), +(_ucs2 0x102D1016103A), +(_ucs2 0x102F10161039), +(_ucs2 0x102F1016103A), +(_ucs2 0x103110161039), +(_ucs2 0x10311016103A), +(_ucs2 0x1031102C10161039), +(_ucs2 0x1031102C1016103A), +(_ucs2 0x1031102B10161039), +(_ucs2 0x1031102B1016103A), +(_ucs2 0x102D102F10161039), +(_ucs2 0x102D102F1016103A), +(_ucs2 0x10171039), +(_ucs2 0x1017103A), +(_ucs2 0x102C10171039), +(_ucs2 0x102C1017103A), +(_ucs2 0x102B10171039), +(_ucs2 0x102B1017103A), +(_ucs2 0x102D10171039), +(_ucs2 0x102D1017103A), +(_ucs2 0x102F10171039), +(_ucs2 0x102F1017103A), +(_ucs2 0x103110171039), +(_ucs2 0x10311017103A), +(_ucs2 0x1031102C10171039), +(_ucs2 0x1031102C1017103A), +(_ucs2 0x1031102B10171039), +(_ucs2 0x1031102B1017103A), +(_ucs2 0x102D102F10171039), +(_ucs2 0x102D102F1017103A), +(_ucs2 0x10181039), +(_ucs2 0x1018103A), +(_ucs2 0x102C10181039), +(_ucs2 0x102C1018103A), +(_ucs2 0x102B10181039), +(_ucs2 0x102B1018103A), +(_ucs2 0x102D10181039), +(_ucs2 0x102D1018103A), +(_ucs2 0x102F10181039), +(_ucs2 0x102F1018103A), +(_ucs2 0x103110181039), +(_ucs2 0x10311018103A), +(_ucs2 0x1031102C10181039), +(_ucs2 0x1031102C1018103A), +(_ucs2 0x1031102B10181039), +(_ucs2 0x1031102B1018103A), +(_ucs2 0x102D102F10181039), +(_ucs2 0x102D102F1018103A), +(_ucs2 0x10191039), +(_ucs2 0x1019103A), +(_ucs2 0x102C10191039), +(_ucs2 0x102C1019103A), +(_ucs2 0x102B10191039), +(_ucs2 0x102B1019103A), +(_ucs2 0x102D10191039), +(_ucs2 0x102D1019103A), +(_ucs2 0x102F10191039), +(_ucs2 0x102F1019103A), +(_ucs2 0x103110191039), +(_ucs2 0x10311019103A), +(_ucs2 0x1031102C10191039), +(_ucs2 0x1031102C1019103A), +(_ucs2 0x1031102B10191039), +(_ucs2 0x1031102B1019103A), +(_ucs2 0x102D102F10191039), +(_ucs2 0x102D102F1019103A), +(_ucs2 0x101A1039), +(_ucs2 0x101A103A), +(_ucs2 0x102C101A1039), +(_ucs2 0x102C101A103A), +(_ucs2 0x102B101A1039), +(_ucs2 0x102B101A103A), +(_ucs2 0x102D101A1039), +(_ucs2 0x102D101A103A), +(_ucs2 0x102F101A1039), +(_ucs2 0x102F101A103A), +(_ucs2 0x1031101A1039), +(_ucs2 0x1031101A103A), +(_ucs2 0x1031102C101A1039), +(_ucs2 0x1031102C101A103A), +(_ucs2 0x1031102B101A1039), +(_ucs2 0x1031102B101A103A), +(_ucs2 0x102D102F101A1039), +(_ucs2 0x102D102F101A103A), +(_ucs2 0x101B1039), +(_ucs2 0x101B103A), +(_ucs2 0x102C101B1039), +(_ucs2 0x102C101B103A), +(_ucs2 0x102B101B1039), +(_ucs2 0x102B101B103A), +(_ucs2 0x102D101B1039), +(_ucs2 0x102D101B103A), +(_ucs2 0x102F101B1039), +(_ucs2 0x102F101B103A), +(_ucs2 0x1031101B1039), +(_ucs2 0x1031101B103A), +(_ucs2 0x1031102C101B1039), +(_ucs2 0x1031102C101B103A), +(_ucs2 0x1031102B101B1039), +(_ucs2 0x1031102B101B103A), +(_ucs2 0x102D102F101B1039), +(_ucs2 0x102D102F101B103A), +(_ucs2 0x101C1039), +(_ucs2 0x101C103A), +(_ucs2 0x102C101C1039), +(_ucs2 0x102C101C103A), +(_ucs2 0x102B101C1039), +(_ucs2 0x102B101C103A), +(_ucs2 0x102D101C1039), +(_ucs2 0x102D101C103A), +(_ucs2 0x102F101C1039), +(_ucs2 0x102F101C103A), +(_ucs2 0x1031101C1039), +(_ucs2 0x1031101C103A), +(_ucs2 0x1031102C101C1039), +(_ucs2 0x1031102C101C103A), +(_ucs2 0x1031102B101C1039), +(_ucs2 0x1031102B101C103A), +(_ucs2 0x102D102F101C1039), +(_ucs2 0x102D102F101C103A), +(_ucs2 0x101D103A), +(_ucs2 0x102C101D103A), +(_ucs2 0x102B101D103A), +(_ucs2 0x102D101D103A), +(_ucs2 0x102F101D103A), +(_ucs2 0x1031101D103A), +(_ucs2 0x1031102C101D103A), +(_ucs2 0x1031102B101D103A), +(_ucs2 0x102D102F101D103A), +(_ucs2 0x101E1039), +(_ucs2 0x101E103A), +(_ucs2 0x102C101E1039), +(_ucs2 0x102C101E103A), +(_ucs2 0x102B101E1039), +(_ucs2 0x102B101E103A), +(_ucs2 0x102D101E1039), +(_ucs2 0x102D101E103A), +(_ucs2 0x102F101E1039), +(_ucs2 0x102F101E103A), +(_ucs2 0x1031101E1039), +(_ucs2 0x1031101E103A), +(_ucs2 0x1031102C101E1039), +(_ucs2 0x1031102C101E103A), +(_ucs2 0x1031102B101E1039), +(_ucs2 0x1031102B101E103A), +(_ucs2 0x102D102F101E1039), +(_ucs2 0x102D102F101E103A), +(_ucs2 0x101F1039), +(_ucs2 0x101F103A), +(_ucs2 0x102C101F1039), +(_ucs2 0x102C101F103A), +(_ucs2 0x102B101F1039), +(_ucs2 0x102B101F103A), +(_ucs2 0x102D101F1039), +(_ucs2 0x102D101F103A), +(_ucs2 0x102F101F1039), +(_ucs2 0x102F101F103A), +(_ucs2 0x1031101F1039), +(_ucs2 0x1031101F103A), +(_ucs2 0x1031102C101F1039), +(_ucs2 0x1031102C101F103A), +(_ucs2 0x1031102B101F1039), +(_ucs2 0x1031102B101F103A), +(_ucs2 0x102D102F101F1039), +(_ucs2 0x102D102F101F103A), +(_ucs2 0x1020103A), +(_ucs2 0x102C1020103A), +(_ucs2 0x102B1020103A), +(_ucs2 0x102D1020103A), +(_ucs2 0x102F1020103A), +(_ucs2 0x10311020103A), +(_ucs2 0x1031102C1020103A), +(_ucs2 0x1031102B1020103A), +(_ucs2 0x102D102F1020103A), +(_ucs2 0x1021103A), +(_ucs2 0x102C1021103A), +(_ucs2 0x102B1021103A), +(_ucs2 0x102D1021103A), +(_ucs2 0x102F1021103A), +(_ucs2 0x10311021103A), +(_ucs2 0x1031102C1021103A), +(_ucs2 0x1031102B1021103A), +(_ucs2 0x102D102F1021103A), +('--- Medials'), +(_ucs2 0x105E), +(_ucs2 0x105F), +(_ucs2 0x103B), +(_ucs2 0x103C), +(_ucs2 0x1060), +(_ucs2 0x103D), +(_ucs2 0x1082), +(_ucs2 0x103E), +(_ucs2 0x103B103D), +(_ucs2 0x103C103D), +(_ucs2 0x103B103E), +(_ucs2 0x103C103E), +(_ucs2 0x103D103E), +(_ucs2 0x103B103D103E), +(_ucs2 0x103C103D103E), +('--- Independent vowels'), +(_ucs2 0x1021102D), +(_ucs2 0x1023), +(_ucs2 0x1021102E), +(_ucs2 0x1024), +(_ucs2 0x1021102F), +(_ucs2 0x1025), +(_ucs2 0x10211030), +(_ucs2 0x1026), +(_ucs2 0x10211031), +(_ucs2 0x1027), +(_ucs2 0x1028), +(_ucs2 0x10211031102C), +(_ucs2 0x1029), +(_ucs2 0x10211031102C103A), +(_ucs2 0x102A), +(_ucs2 0x102D1019103A), +(_ucs2 0x102D1036), +(_ucs2 0x102D1019103A1037), +(_ucs2 0x102D10361037), +(_ucs2 0x102D1019103A1038), +(_ucs2 0x102D10361038), +(_ucs2 0x102F1019103A), +(_ucs2 0x102F1036), +(_ucs2 0x102F1019103A1037), +(_ucs2 0x102F10361037), +(_ucs2 0x102F1019103A1038), +(_ucs2 0x102F10361038), +(_ucs2 0x1021102F1036), +(_ucs2 0x1025102F1036), +('--- Independent vowels with finals'), +(_ucs2 0x1021102D10001039), +(_ucs2 0x102310001039), +(_ucs2 0x1021102D1000103A), +(_ucs2 0x10231000103A), +(_ucs2 0x1021102F10001039), +(_ucs2 0x102510001039), +(_ucs2 0x1021102F1000103A), +(_ucs2 0x10251000103A), +(_ucs2 0x1021103110001039), +(_ucs2 0x102710001039), +(_ucs2 0x102110311000103A), +(_ucs2 0x10271000103A), +(_ucs2 0x10211031102C10001039), +(_ucs2 0x102910001039), +(_ucs2 0x10211031102C1000103A), +(_ucs2 0x10291000103A), +(_ucs2 0x10211031102C10001039), +(_ucs2 0x10291031102C10001039), +(_ucs2 0x10211031102C1000103A), +(_ucs2 0x10291031102C1000103A), +(_ucs2 0x1021102D10011039), +(_ucs2 0x102310011039), +(_ucs2 0x1021102D1001103A), +(_ucs2 0x10231001103A), +(_ucs2 0x1021102F10011039), +(_ucs2 0x102510011039), +(_ucs2 0x1021102F1001103A), +(_ucs2 0x10251001103A), +(_ucs2 0x1021103110011039), +(_ucs2 0x102710011039), +(_ucs2 0x102110311001103A), +(_ucs2 0x10271001103A), +(_ucs2 0x10211031102C10011039), +(_ucs2 0x102910011039), +(_ucs2 0x10211031102C1001103A), +(_ucs2 0x10291001103A), +(_ucs2 0x10211031102C10011039), +(_ucs2 0x10291031102C10011039), +(_ucs2 0x10211031102C1001103A), +(_ucs2 0x10291031102C1001103A), +(_ucs2 0x1021102D10021039), +(_ucs2 0x102310021039), +(_ucs2 0x1021102D1002103A), +(_ucs2 0x10231002103A), +(_ucs2 0x1021102F10021039), +(_ucs2 0x102510021039), +(_ucs2 0x1021102F1002103A), +(_ucs2 0x10251002103A), +(_ucs2 0x1021103110021039), +(_ucs2 0x102710021039), +(_ucs2 0x102110311002103A), +(_ucs2 0x10271002103A), +(_ucs2 0x10211031102C10021039), +(_ucs2 0x102910021039), +(_ucs2 0x10211031102C1002103A), +(_ucs2 0x10291002103A), +(_ucs2 0x10211031102C10021039), +(_ucs2 0x10291031102C10021039), +(_ucs2 0x10211031102C1002103A), +(_ucs2 0x10291031102C1002103A), +(_ucs2 0x1021102D10031039), +(_ucs2 0x102310031039), +(_ucs2 0x1021102D1003103A), +(_ucs2 0x10231003103A), +(_ucs2 0x1021102F10031039), +(_ucs2 0x102510031039), +(_ucs2 0x1021102F1003103A), +(_ucs2 0x10251003103A), +(_ucs2 0x1021103110031039), +(_ucs2 0x102710031039), +(_ucs2 0x102110311003103A), +(_ucs2 0x10271003103A), +(_ucs2 0x10211031102C10031039), +(_ucs2 0x102910031039), +(_ucs2 0x10211031102C1003103A), +(_ucs2 0x10291003103A), +(_ucs2 0x10211031102C10031039), +(_ucs2 0x10291031102C10031039), +(_ucs2 0x10211031102C1003103A), +(_ucs2 0x10291031102C1003103A), +(_ucs2 0x1021102D10041039), +(_ucs2 0x102310041039), +(_ucs2 0x1021102D1004103A), +(_ucs2 0x10231004103A), +(_ucs2 0x1021102F10041039), +(_ucs2 0x102510041039), +(_ucs2 0x1021102F1004103A), +(_ucs2 0x10251004103A), +(_ucs2 0x1021103110041039), +(_ucs2 0x102710041039), +(_ucs2 0x102110311004103A), +(_ucs2 0x10271004103A), +(_ucs2 0x10211031102C10041039), +(_ucs2 0x102910041039), +(_ucs2 0x10211031102C1004103A), +(_ucs2 0x10291004103A), +(_ucs2 0x10211031102C10041039), +(_ucs2 0x10291031102C10041039), +(_ucs2 0x10211031102C1004103A), +(_ucs2 0x10291031102C1004103A), +(_ucs2 0x1021102D10051039), +(_ucs2 0x102310051039), +(_ucs2 0x1021102D1005103A), +(_ucs2 0x10231005103A), +(_ucs2 0x1021102F10051039), +(_ucs2 0x102510051039), +(_ucs2 0x1021102F1005103A), +(_ucs2 0x10251005103A), +(_ucs2 0x1021103110051039), +(_ucs2 0x102710051039), +(_ucs2 0x102110311005103A), +(_ucs2 0x10271005103A), +(_ucs2 0x10211031102C10051039), +(_ucs2 0x102910051039), +(_ucs2 0x10211031102C1005103A), +(_ucs2 0x10291005103A), +(_ucs2 0x10211031102C10051039), +(_ucs2 0x10291031102C10051039), +(_ucs2 0x10211031102C1005103A), +(_ucs2 0x10291031102C1005103A), +(_ucs2 0x1021102D10061039), +(_ucs2 0x102310061039), +(_ucs2 0x1021102D1006103A), +(_ucs2 0x10231006103A), +(_ucs2 0x1021102F10061039), +(_ucs2 0x102510061039), +(_ucs2 0x1021102F1006103A), +(_ucs2 0x10251006103A), +(_ucs2 0x1021103110061039), +(_ucs2 0x102710061039), +(_ucs2 0x102110311006103A), +(_ucs2 0x10271006103A), +(_ucs2 0x10211031102C10061039), +(_ucs2 0x102910061039), +(_ucs2 0x10211031102C1006103A), +(_ucs2 0x10291006103A), +(_ucs2 0x10211031102C10061039), +(_ucs2 0x10291031102C10061039), +(_ucs2 0x10211031102C1006103A), +(_ucs2 0x10291031102C1006103A), +(_ucs2 0x1021102D10071039), +(_ucs2 0x102310071039), +(_ucs2 0x1021102D1007103A), +(_ucs2 0x10231007103A), +(_ucs2 0x1021102F10071039), +(_ucs2 0x102510071039), +(_ucs2 0x1021102F1007103A), +(_ucs2 0x10251007103A), +(_ucs2 0x1021103110071039), +(_ucs2 0x102710071039), +(_ucs2 0x102110311007103A), +(_ucs2 0x10271007103A), +(_ucs2 0x10211031102C10071039), +(_ucs2 0x102910071039), +(_ucs2 0x10211031102C1007103A), +(_ucs2 0x10291007103A), +(_ucs2 0x10211031102C10071039), +(_ucs2 0x10291031102C10071039), +(_ucs2 0x10211031102C1007103A), +(_ucs2 0x10291031102C1007103A), +(_ucs2 0x1021102D10091039), +(_ucs2 0x102310091039), +(_ucs2 0x1021102D1009103A), +(_ucs2 0x10231009103A), +(_ucs2 0x1021102F10091039), +(_ucs2 0x102510091039), +(_ucs2 0x1021102F1009103A), +(_ucs2 0x10251009103A), +(_ucs2 0x1021103110091039), +(_ucs2 0x102710091039), +(_ucs2 0x102110311009103A), +(_ucs2 0x10271009103A), +(_ucs2 0x10211031102C10091039), +(_ucs2 0x102910091039), +(_ucs2 0x10211031102C1009103A), +(_ucs2 0x10291009103A), +(_ucs2 0x10211031102C10091039), +(_ucs2 0x10291031102C10091039), +(_ucs2 0x10211031102C1009103A), +(_ucs2 0x10291031102C1009103A), +(_ucs2 0x1021102D100A1039), +(_ucs2 0x1023100A1039), +(_ucs2 0x1021102D100A103A), +(_ucs2 0x1023100A103A), +(_ucs2 0x1021102F100A1039), +(_ucs2 0x1025100A1039), +(_ucs2 0x1021102F100A103A), +(_ucs2 0x1025100A103A), +(_ucs2 0x10211031100A1039), +(_ucs2 0x1027100A1039), +(_ucs2 0x10211031100A103A), +(_ucs2 0x1027100A103A), +(_ucs2 0x10211031102C100A1039), +(_ucs2 0x1029100A1039), +(_ucs2 0x10211031102C100A103A), +(_ucs2 0x1029100A103A), +(_ucs2 0x10211031102C100A1039), +(_ucs2 0x10291031102C100A1039), +(_ucs2 0x10211031102C100A103A), +(_ucs2 0x10291031102C100A103A), +(_ucs2 0x1021102D100B1039), +(_ucs2 0x1023100B1039), +(_ucs2 0x1021102D100B103A), +(_ucs2 0x1023100B103A), +(_ucs2 0x1021102F100B1039), +(_ucs2 0x1025100B1039), +(_ucs2 0x1021102F100B103A), +(_ucs2 0x1025100B103A), +(_ucs2 0x10211031100B1039), +(_ucs2 0x1027100B1039), +(_ucs2 0x10211031100B103A), +(_ucs2 0x1027100B103A), +(_ucs2 0x10211031102C100B1039), +(_ucs2 0x1029100B1039), +(_ucs2 0x10211031102C100B103A), +(_ucs2 0x1029100B103A), +(_ucs2 0x10211031102C100B1039), +(_ucs2 0x10291031102C100B1039), +(_ucs2 0x10211031102C100B103A), +(_ucs2 0x10291031102C100B103A), +(_ucs2 0x1021102D100C1039), +(_ucs2 0x1023100C1039), +(_ucs2 0x1021102D100C103A), +(_ucs2 0x1023100C103A), +(_ucs2 0x1021102F100C1039), +(_ucs2 0x1025100C1039), +(_ucs2 0x1021102F100C103A), +(_ucs2 0x1025100C103A), +(_ucs2 0x10211031100C1039), +(_ucs2 0x1027100C1039), +(_ucs2 0x10211031100C103A), +(_ucs2 0x1027100C103A), +(_ucs2 0x10211031102C100C1039), +(_ucs2 0x1029100C1039), +(_ucs2 0x10211031102C100C103A), +(_ucs2 0x1029100C103A), +(_ucs2 0x10211031102C100C1039), +(_ucs2 0x10291031102C100C1039), +(_ucs2 0x10211031102C100C103A), +(_ucs2 0x10291031102C100C103A), +(_ucs2 0x1021102D100D1039), +(_ucs2 0x1023100D1039), +(_ucs2 0x1021102D100D103A), +(_ucs2 0x1023100D103A), +(_ucs2 0x1021102F100D1039), +(_ucs2 0x1025100D1039), +(_ucs2 0x1021102F100D103A), +(_ucs2 0x1025100D103A), +(_ucs2 0x10211031100D1039), +(_ucs2 0x1027100D1039), +(_ucs2 0x10211031100D103A), +(_ucs2 0x1027100D103A), +(_ucs2 0x10211031102C100D1039), +(_ucs2 0x1029100D1039), +(_ucs2 0x10211031102C100D103A), +(_ucs2 0x1029100D103A), +(_ucs2 0x10211031102C100D1039), +(_ucs2 0x10291031102C100D1039), +(_ucs2 0x10211031102C100D103A), +(_ucs2 0x10291031102C100D103A), +(_ucs2 0x1021102D100E1039), +(_ucs2 0x1023100E1039), +(_ucs2 0x1021102D100E103A), +(_ucs2 0x1023100E103A), +(_ucs2 0x1021102F100E1039), +(_ucs2 0x1025100E1039), +(_ucs2 0x1021102F100E103A), +(_ucs2 0x1025100E103A), +(_ucs2 0x10211031100E1039), +(_ucs2 0x1027100E1039), +(_ucs2 0x10211031100E103A), +(_ucs2 0x1027100E103A), +(_ucs2 0x10211031102C100E1039), +(_ucs2 0x1029100E1039), +(_ucs2 0x10211031102C100E103A), +(_ucs2 0x1029100E103A), +(_ucs2 0x10211031102C100E1039), +(_ucs2 0x10291031102C100E1039), +(_ucs2 0x10211031102C100E103A), +(_ucs2 0x10291031102C100E103A), +(_ucs2 0x1021102D100F1039), +(_ucs2 0x1023100F1039), +(_ucs2 0x1021102D100F103A), +(_ucs2 0x1023100F103A), +(_ucs2 0x1021102F100F1039), +(_ucs2 0x1025100F1039), +(_ucs2 0x1021102F100F103A), +(_ucs2 0x1025100F103A), +(_ucs2 0x10211031100F1039), +(_ucs2 0x1027100F1039), +(_ucs2 0x10211031100F103A), +(_ucs2 0x1027100F103A), +(_ucs2 0x10211031102C100F1039), +(_ucs2 0x1029100F1039), +(_ucs2 0x10211031102C100F103A), +(_ucs2 0x1029100F103A), +(_ucs2 0x10211031102C100F1039), +(_ucs2 0x10291031102C100F1039), +(_ucs2 0x10211031102C100F103A), +(_ucs2 0x10291031102C100F103A), +(_ucs2 0x1021102D10101039), +(_ucs2 0x102310101039), +(_ucs2 0x1021102D1010103A), +(_ucs2 0x10231010103A), +(_ucs2 0x1021102F10101039), +(_ucs2 0x102510101039), +(_ucs2 0x1021102F1010103A), +(_ucs2 0x10251010103A), +(_ucs2 0x1021103110101039), +(_ucs2 0x102710101039), +(_ucs2 0x102110311010103A), +(_ucs2 0x10271010103A), +(_ucs2 0x10211031102C10101039), +(_ucs2 0x102910101039), +(_ucs2 0x10211031102C1010103A), +(_ucs2 0x10291010103A), +(_ucs2 0x10211031102C10101039), +(_ucs2 0x10291031102C10101039), +(_ucs2 0x10211031102C1010103A), +(_ucs2 0x10291031102C1010103A), +(_ucs2 0x1021102D10111039), +(_ucs2 0x102310111039), +(_ucs2 0x1021102D1011103A), +(_ucs2 0x10231011103A), +(_ucs2 0x1021102F10111039), +(_ucs2 0x102510111039), +(_ucs2 0x1021102F1011103A), +(_ucs2 0x10251011103A), +(_ucs2 0x1021103110111039), +(_ucs2 0x102710111039), +(_ucs2 0x102110311011103A), +(_ucs2 0x10271011103A), +(_ucs2 0x10211031102C10111039), +(_ucs2 0x102910111039), +(_ucs2 0x10211031102C1011103A), +(_ucs2 0x10291011103A), +(_ucs2 0x10211031102C10111039), +(_ucs2 0x10291031102C10111039), +(_ucs2 0x10211031102C1011103A), +(_ucs2 0x10291031102C1011103A), +(_ucs2 0x1021102D10121039), +(_ucs2 0x102310121039), +(_ucs2 0x1021102D1012103A), +(_ucs2 0x10231012103A), +(_ucs2 0x1021102F10121039), +(_ucs2 0x102510121039), +(_ucs2 0x1021102F1012103A), +(_ucs2 0x10251012103A), +(_ucs2 0x1021103110121039), +(_ucs2 0x102710121039), +(_ucs2 0x102110311012103A), +(_ucs2 0x10271012103A), +(_ucs2 0x10211031102C10121039), +(_ucs2 0x102910121039), +(_ucs2 0x10211031102C1012103A), +(_ucs2 0x10291012103A), +(_ucs2 0x10211031102C10121039), +(_ucs2 0x10291031102C10121039), +(_ucs2 0x10211031102C1012103A), +(_ucs2 0x10291031102C1012103A), +(_ucs2 0x1021102D10131039), +(_ucs2 0x102310131039), +(_ucs2 0x1021102D1013103A), +(_ucs2 0x10231013103A), +(_ucs2 0x1021102F10131039), +(_ucs2 0x102510131039), +(_ucs2 0x1021102F1013103A), +(_ucs2 0x10251013103A), +(_ucs2 0x1021103110131039), +(_ucs2 0x102710131039), +(_ucs2 0x102110311013103A), +(_ucs2 0x10271013103A), +(_ucs2 0x10211031102C10131039), +(_ucs2 0x102910131039), +(_ucs2 0x10211031102C1013103A), +(_ucs2 0x10291013103A), +(_ucs2 0x10211031102C10131039), +(_ucs2 0x10291031102C10131039), +(_ucs2 0x10211031102C1013103A), +(_ucs2 0x10291031102C1013103A), +(_ucs2 0x1021102D10141039), +(_ucs2 0x102310141039), +(_ucs2 0x1021102D1014103A), +(_ucs2 0x10231014103A), +(_ucs2 0x1021102F10141039), +(_ucs2 0x102510141039), +(_ucs2 0x1021102F1014103A), +(_ucs2 0x10251014103A), +(_ucs2 0x1021103110141039), +(_ucs2 0x102710141039), +(_ucs2 0x102110311014103A), +(_ucs2 0x10271014103A), +(_ucs2 0x10211031102C10141039), +(_ucs2 0x102910141039), +(_ucs2 0x10211031102C1014103A), +(_ucs2 0x10291014103A), +(_ucs2 0x10211031102C10141039), +(_ucs2 0x10291031102C10141039), +(_ucs2 0x10211031102C1014103A), +(_ucs2 0x10291031102C1014103A), +(_ucs2 0x1021102D10151039), +(_ucs2 0x102310151039), +(_ucs2 0x1021102D1015103A), +(_ucs2 0x10231015103A), +(_ucs2 0x1021102F10151039), +(_ucs2 0x102510151039), +(_ucs2 0x1021102F1015103A), +(_ucs2 0x10251015103A), +(_ucs2 0x1021103110151039), +(_ucs2 0x102710151039), +(_ucs2 0x102110311015103A), +(_ucs2 0x10271015103A), +(_ucs2 0x10211031102C10151039), +(_ucs2 0x102910151039), +(_ucs2 0x10211031102C1015103A), +(_ucs2 0x10291015103A), +(_ucs2 0x10211031102C10151039), +(_ucs2 0x10291031102C10151039), +(_ucs2 0x10211031102C1015103A), +(_ucs2 0x10291031102C1015103A), +(_ucs2 0x1021102D10161039), +(_ucs2 0x102310161039), +(_ucs2 0x1021102D1016103A), +(_ucs2 0x10231016103A), +(_ucs2 0x1021102F10161039), +(_ucs2 0x102510161039), +(_ucs2 0x1021102F1016103A), +(_ucs2 0x10251016103A), +(_ucs2 0x1021103110161039), +(_ucs2 0x102710161039), +(_ucs2 0x102110311016103A), +(_ucs2 0x10271016103A), +(_ucs2 0x10211031102C10161039), +(_ucs2 0x102910161039), +(_ucs2 0x10211031102C1016103A), +(_ucs2 0x10291016103A), +(_ucs2 0x10211031102C10161039), +(_ucs2 0x10291031102C10161039), +(_ucs2 0x10211031102C1016103A), +(_ucs2 0x10291031102C1016103A), +(_ucs2 0x1021102D10171039), +(_ucs2 0x102310171039), +(_ucs2 0x1021102D1017103A), +(_ucs2 0x10231017103A), +(_ucs2 0x1021102F10171039), +(_ucs2 0x102510171039), +(_ucs2 0x1021102F1017103A), +(_ucs2 0x10251017103A), +(_ucs2 0x1021103110171039), +(_ucs2 0x102710171039), +(_ucs2 0x102110311017103A), +(_ucs2 0x10271017103A), +(_ucs2 0x10211031102C10171039), +(_ucs2 0x102910171039), +(_ucs2 0x10211031102C1017103A), +(_ucs2 0x10291017103A), +(_ucs2 0x10211031102C10171039), +(_ucs2 0x10291031102C10171039), +(_ucs2 0x10211031102C1017103A), +(_ucs2 0x10291031102C1017103A), +(_ucs2 0x1021102D10181039), +(_ucs2 0x102310181039), +(_ucs2 0x1021102D1018103A), +(_ucs2 0x10231018103A), +(_ucs2 0x1021102F10181039), +(_ucs2 0x102510181039), +(_ucs2 0x1021102F1018103A), +(_ucs2 0x10251018103A), +(_ucs2 0x1021103110181039), +(_ucs2 0x102710181039), +(_ucs2 0x102110311018103A), +(_ucs2 0x10271018103A), +(_ucs2 0x10211031102C10181039), +(_ucs2 0x102910181039), +(_ucs2 0x10211031102C1018103A), +(_ucs2 0x10291018103A), +(_ucs2 0x10211031102C10181039), +(_ucs2 0x10291031102C10181039), +(_ucs2 0x10211031102C1018103A), +(_ucs2 0x10291031102C1018103A), +(_ucs2 0x1021102D10191039), +(_ucs2 0x102310191039), +(_ucs2 0x1021102D1019103A), +(_ucs2 0x10231019103A), +(_ucs2 0x1021102F10191039), +(_ucs2 0x102510191039), +(_ucs2 0x1021102F1019103A), +(_ucs2 0x10251019103A), +(_ucs2 0x1021103110191039), +(_ucs2 0x102710191039), +(_ucs2 0x102110311019103A), +(_ucs2 0x10271019103A), +(_ucs2 0x10211031102C10191039), +(_ucs2 0x102910191039), +(_ucs2 0x10211031102C1019103A), +(_ucs2 0x10291019103A), +(_ucs2 0x10211031102C10191039), +(_ucs2 0x10291031102C10191039), +(_ucs2 0x10211031102C1019103A), +(_ucs2 0x10291031102C1019103A), +(_ucs2 0x1021102D101A1039), +(_ucs2 0x1023101A1039), +(_ucs2 0x1021102D101A103A), +(_ucs2 0x1023101A103A), +(_ucs2 0x1021102F101A1039), +(_ucs2 0x1025101A1039), +(_ucs2 0x1021102F101A103A), +(_ucs2 0x1025101A103A), +(_ucs2 0x10211031101A1039), +(_ucs2 0x1027101A1039), +(_ucs2 0x10211031101A103A), +(_ucs2 0x1027101A103A), +(_ucs2 0x10211031102C101A1039), +(_ucs2 0x1029101A1039), +(_ucs2 0x10211031102C101A103A), +(_ucs2 0x1029101A103A), +(_ucs2 0x10211031102C101A1039), +(_ucs2 0x10291031102C101A1039), +(_ucs2 0x10211031102C101A103A), +(_ucs2 0x10291031102C101A103A), +(_ucs2 0x1021102D101B1039), +(_ucs2 0x1023101B1039), +(_ucs2 0x1021102D101B103A), +(_ucs2 0x1023101B103A), +(_ucs2 0x1021102F101B1039), +(_ucs2 0x1025101B1039), +(_ucs2 0x1021102F101B103A), +(_ucs2 0x1025101B103A), +(_ucs2 0x10211031101B1039), +(_ucs2 0x1027101B1039), +(_ucs2 0x10211031101B103A), +(_ucs2 0x1027101B103A), +(_ucs2 0x10211031102C101B1039), +(_ucs2 0x1029101B1039), +(_ucs2 0x10211031102C101B103A), +(_ucs2 0x1029101B103A), +(_ucs2 0x10211031102C101B1039), +(_ucs2 0x10291031102C101B1039), +(_ucs2 0x10211031102C101B103A), +(_ucs2 0x10291031102C101B103A), +(_ucs2 0x1021102D101C1039), +(_ucs2 0x1023101C1039), +(_ucs2 0x1021102D101C103A), +(_ucs2 0x1023101C103A), +(_ucs2 0x1021102F101C1039), +(_ucs2 0x1025101C1039), +(_ucs2 0x1021102F101C103A), +(_ucs2 0x1025101C103A), +(_ucs2 0x10211031101C1039), +(_ucs2 0x1027101C1039), +(_ucs2 0x10211031101C103A), +(_ucs2 0x1027101C103A), +(_ucs2 0x10211031102C101C1039), +(_ucs2 0x1029101C1039), +(_ucs2 0x10211031102C101C103A), +(_ucs2 0x1029101C103A), +(_ucs2 0x10211031102C101C1039), +(_ucs2 0x10291031102C101C1039), +(_ucs2 0x10211031102C101C103A), +(_ucs2 0x10291031102C101C103A), +(_ucs2 0x1021102D101E1039), +(_ucs2 0x1023101E1039), +(_ucs2 0x1021102D101E103A), +(_ucs2 0x1023101E103A), +(_ucs2 0x1021102F101E1039), +(_ucs2 0x1025101E1039), +(_ucs2 0x1021102F101E103A), +(_ucs2 0x1025101E103A), +(_ucs2 0x10211031101E1039), +(_ucs2 0x1027101E1039), +(_ucs2 0x10211031101E103A), +(_ucs2 0x1027101E103A), +(_ucs2 0x10211031102C101E1039), +(_ucs2 0x1029101E1039), +(_ucs2 0x10211031102C101E103A), +(_ucs2 0x1029101E103A), +(_ucs2 0x10211031102C101E1039), +(_ucs2 0x10291031102C101E1039), +(_ucs2 0x10211031102C101E103A), +(_ucs2 0x10291031102C101E103A), +(_ucs2 0x1021102D101F1039), +(_ucs2 0x1023101F1039), +(_ucs2 0x1021102D101F103A), +(_ucs2 0x1023101F103A), +(_ucs2 0x1021102F101F1039), +(_ucs2 0x1025101F1039), +(_ucs2 0x1021102F101F103A), +(_ucs2 0x1025101F103A), +(_ucs2 0x10211031101F1039), +(_ucs2 0x1027101F1039), +(_ucs2 0x10211031101F103A), +(_ucs2 0x1027101F103A), +(_ucs2 0x10211031102C101F1039), +(_ucs2 0x1029101F1039), +(_ucs2 0x10211031102C101F103A), +(_ucs2 0x1029101F103A), +(_ucs2 0x10211031102C101F1039), +(_ucs2 0x10291031102C101F1039), +(_ucs2 0x10211031102C101F103A), +(_ucs2 0x10291031102C101F103A), +('--- Contractions'), +(_ucs2 0x1031102C1000103A1000103B), +(_ucs2 0x1031102C1000103A103B /* (suffix of) man */), +(_ucs2 0x1014103A1014102F1015103A), +(_ucs2 0x1014103A102F1015103A /* (suffix of) I */), +('--- Great Sa'), +(_ucs2 0x1031101E1039101E), +(_ucs2 0x1031103F), +(_ucs2 0x102D101E1039101E), +(_ucs2 0x102D103F), +(_ucs2 0x102F101E1039101E), +(_ucs2 0x102F103F), +(_ucs2 0x1021102D101E1039101E), +(_ucs2 0x1023103F), +(_ucs2 0x1021102F101E1039101E), +(_ucs2 0x1025103F), +(_ucs2 0x101E1039101E), +(_ucs2 0x103F), +('--- Symbols - collate as long form'), +(_ucs2 0x1014103E102D102F1000103A), +(_ucs2 0x104C), +(_ucs2 0x101B103D10311037), +(_ucs2 0x104D), +(_ucs2 0x101C100A103A103810001031102C1004103A1038), +(_ucs2 0x104E1004103A1038), +(_ucs2 0x1021102D), +(_ucs2 0x104F), +('--- Short Forms may need to be added here'), +(_ucs2 0x101C1000103A101A102C), +(_ucs2 0x101C1000103A103B102C /* right hand side */), +(_ucs2 0x101E1019102E), +(_ucs2 0x101E10391019102E /* daughter */), +(_ucs2 0x101110191004103A1038), +(_ucs2 0x1011103910191004103A1038 /* cooked rice */), +(_ucs2 0x101C1000103A10181000103A), +(_ucs2 0x101C103910181000103A /* tea */); +SELECT id, IF(LEFT(s1,1)='-',s1,CONCAT(HEX(WEIGHT_STRING(s1)),'\t', HEX(CONVERT(s1 USING ucs2)))) FROM t1 ORDER BY id; +id IF(LEFT(s1,1)='-',s1,CONCAT(HEX(WEIGHT_STRING(s1)),'\t', HEX(CONVERT(s1 USING ucs2)))) +1 2259 108C +2 22593ACB 1037 +3 22593ACC 1038 +4 22593ACD 10371038 +5 --- Vowels +6 2232 102C +7 2232 102B +8 2246 1032 +9 22463ACB 1031102C +10 22463ACB 1031102B +11 22463ACC 1031102C103A +12 22463ACC 1031102B103A +13 2248 1034 +14 22483ACB 1036 +15 22483ACC 102D102F +16 --- Vowels with finals +17 22483ACD 10001039 +18 22483ACD 1000103A +19 22483ACE 102C10001039 +20 22483ACE 102C1000103A +21 22483ACE 102B10001039 +22 22483ACE 102B1000103A +23 22483ACF 102D10001039 +24 22483ACF 102D1000103A +25 22483AD0 102F10001039 +26 22483AD0 102F1000103A +27 22483AD1 103110001039 +28 22483AD1 10311000103A +29 22483AD2 1031102C10001039 +30 22483AD2 1031102C1000103A +31 22483AD2 1031102B10001039 +32 22483AD2 1031102B1000103A +33 22483AD3 102D102F10001039 +34 22483AD3 102D102F1000103A +35 22483AD4 10011039 +36 22483AD4 1001103A +37 22483AD5 102C10011039 +38 22483AD5 102C1001103A +39 22483AD5 102B10011039 +40 22483AD5 102B1001103A +41 22483AD6 102D10011039 +42 22483AD6 102D1001103A +43 22483AD7 102F10011039 +44 22483AD7 102F1001103A +45 22483AD8 103110011039 +46 22483AD8 10311001103A +47 22483AD9 1031102C10011039 +48 22483AD9 1031102C1001103A +49 22483AD9 1031102B10011039 +50 22483AD9 1031102B1001103A +51 22483ADA 102D102F10011039 +52 22483ADA 102D102F1001103A +53 22483ADB 10021039 +54 22483ADB 1002103A +55 22483ADC 102C10021039 +56 22483ADC 102C1002103A +57 22483ADC 102B10021039 +58 22483ADC 102B1002103A +59 22483ADD 102D10021039 +60 22483ADD 102D1002103A +61 22483ADE 102F10021039 +62 22483ADE 102F1002103A +63 22483ADF 103110021039 +64 22483ADF 10311002103A +65 22483AE0 1031102C10021039 +66 22483AE0 1031102C1002103A +67 22483AE0 1031102B10021039 +68 22483AE0 1031102B1002103A +69 22483AE1 102D102F10021039 +70 22483AE1 102D102F1002103A +71 22483AE2 10031039 +72 22483AE2 1003103A +73 22483AE3 102C10031039 +74 22483AE3 102C1003103A +75 22483AE3 102B10031039 +76 22483AE3 102B1003103A +77 22483AE4 102D10031039 +78 22483AE4 102D1003103A +79 22483AE5 102F10031039 +80 22483AE5 102F1003103A +81 22483AE6 103110031039 +82 22483AE6 10311003103A +83 22483AE7 1031102C10031039 +84 22483AE7 1031102C1003103A +85 22483AE7 1031102B10031039 +86 22483AE7 1031102B1003103A +87 22483AE8 102D102F10031039 +88 22483AE8 102D102F1003103A +89 22483AE9 1004103A1039 +90 22483AE9 1004103A +91 22483AEA 102C1004103A1039 +92 22483AEA 102C1004103A +93 22483AEA 102B1004103A1039 +94 22483AEA 102B1004103A +95 22483AEB 102D1004103A1039 +96 22483AEB 102D1004103A +97 22483AEC 102F1004103A1039 +98 22483AEC 102F1004103A +99 22483AED 10311004103A1039 +100 22483AED 10311004103A +101 22483AEE 1031102C1004103A1039 +102 22483AEE 1031102C1004103A +103 22483AEE 1031102B1004103A1039 +104 22483AEE 1031102B1004103A +105 22483AEF 102D102F1004103A1039 +106 22483AEF 102D102F1004103A +107 22483AF0 10051039 +108 22483AF0 1005103A +109 22483AF1 102C10051039 +110 22483AF1 102C1005103A +111 22483AF1 102B10051039 +112 22483AF1 102B1005103A +113 22483AF2 102D10051039 +114 22483AF2 102D1005103A +115 22483AF3 102F10051039 +116 22483AF3 102F1005103A +117 22483AF4 103110051039 +118 22483AF4 10311005103A +119 22483AF5 1031102C10051039 +120 22483AF5 1031102C1005103A +121 22483AF5 1031102B10051039 +122 22483AF5 1031102B1005103A +123 22483AF6 102D102F10051039 +124 22483AF6 102D102F1005103A +125 22483AF7 10061039 +126 22483AF7 1006103A +127 22483AF8 102C10061039 +128 22483AF8 102C1006103A +129 22483AF8 102B10061039 +130 22483AF8 102B1006103A +131 22483AF9 102D10061039 +132 22483AF9 102D1006103A +133 22483AFA 102F10061039 +134 22483AFA 102F1006103A +135 22483AFB 103110061039 +136 22483AFB 10311006103A +137 22483AFC 1031102C10061039 +138 22483AFC 1031102C1006103A +139 22483AFC 1031102B10061039 +140 22483AFC 1031102B1006103A +141 22483AFD 102D102F10061039 +142 22483AFD 102D102F1006103A +143 22483AFE 10071039 +144 22483AFE 1007103A +145 22483AFF 102C10071039 +146 22483AFF 102C1007103A +147 22483AFF 102B10071039 +148 22483AFF 102B1007103A +149 22483B00 102D10071039 +150 22483B00 102D1007103A +151 22483B01 102F10071039 +152 22483B01 102F1007103A +153 22483B02 103110071039 +154 22483B02 10311007103A +155 22483B03 1031102C10071039 +156 22483B03 1031102C1007103A +157 22483B03 1031102B10071039 +158 22483B03 1031102B1007103A +159 22483B04 102D102F10071039 +160 22483B04 102D102F1007103A +161 22483B05 1008103A +162 22483B06 102C1008103A +163 22483B06 102B1008103A +164 22483B07 102D1008103A +165 22483B08 102F1008103A +166 22483B09 10311008103A +167 22483B0A 1031102C1008103A +168 22483B0A 1031102B1008103A +169 22483B0B 102D102F1008103A +170 22483B0C 10091039 +171 22483B0C 1009103A +172 22483B0D 102C10091039 +173 22483B0D 102C1009103A +174 22483B0D 102B10091039 +175 22483B0D 102B1009103A +176 22483B0E 102D10091039 +177 22483B0E 102D1009103A +178 22483B0F 102F10091039 +179 22483B0F 102F1009103A +180 22483B10 103110091039 +181 22483B10 10311009103A +182 22483B11 1031102C10091039 +183 22483B11 1031102C1009103A +184 22483B11 1031102B10091039 +185 22483B11 1031102B1009103A +186 22483B12 102D102F10091039 +187 22483B12 102D102F1009103A +188 22483B13 100A1039 +189 22483B13 100A103A +190 22483B14 102C100A1039 +191 22483B14 102C100A103A +192 22483B14 102B100A1039 +193 22483B14 102B100A103A +194 22483B15 102D100A1039 +195 22483B15 102D100A103A +196 22483B16 102F100A1039 +197 22483B16 102F100A103A +198 22483B17 1031100A1039 +199 22483B17 1031100A103A +200 22483B18 1031102C100A1039 +201 22483B18 1031102C100A103A +202 22483B18 1031102B100A1039 +203 22483B18 1031102B100A103A +204 22483B19 102D102F100A1039 +205 22483B19 102D102F100A103A +206 22483B1A 100B1039 +207 22483B1A 100B103A +208 22483B1B 102C100B1039 +209 22483B1B 102C100B103A +210 22483B1B 102B100B1039 +211 22483B1B 102B100B103A +212 22483B1C 102D100B1039 +213 22483B1C 102D100B103A +214 22483B1D 102F100B1039 +215 22483B1D 102F100B103A +216 22483B1E 1031100B1039 +217 22483B1E 1031100B103A +218 22483B1F 1031102C100B1039 +219 22483B1F 1031102C100B103A +220 22483B1F 1031102B100B1039 +221 22483B1F 1031102B100B103A +222 22483B20 102D102F100B1039 +223 22483B20 102D102F100B103A +224 22483B21 100C1039 +225 22483B21 100C103A +226 22483B22 102C100C1039 +227 22483B22 102C100C103A +228 22483B22 102B100C1039 +229 22483B22 102B100C103A +230 22483B23 102D100C1039 +231 22483B23 102D100C103A +232 22483B24 102F100C1039 +233 22483B24 102F100C103A +234 22483B25 1031100C1039 +235 22483B25 1031100C103A +236 22483B26 1031102C100C1039 +237 22483B26 1031102C100C103A +238 22483B26 1031102B100C1039 +239 22483B26 1031102B100C103A +240 22483B27 102D102F100C1039 +241 22483B27 102D102F100C103A +242 22483B28 100D1039 +243 22483B28 100D103A +244 22483B29 102C100D1039 +245 22483B29 102C100D103A +246 22483B29 102B100D1039 +247 22483B29 102B100D103A +248 22483B2A 102D100D1039 +249 22483B2A 102D100D103A +250 22483B2B 102F100D1039 +251 22483B2B 102F100D103A +252 22483B2C 1031100D1039 +253 22483B2C 1031100D103A +254 22483B2D 1031102C100D1039 +255 22483B2D 1031102C100D103A +256 22483B2D 1031102B100D1039 +257 22483B2D 1031102B100D103A +258 22483B2E 102D102F100D1039 +259 22483B2E 102D102F100D103A +260 22483B2F 100E1039 +261 22483B2F 100E103A +262 22483B30 102C100E1039 +263 22483B30 102C100E103A +264 22483B30 102B100E1039 +265 22483B30 102B100E103A +266 22483B31 102D100E1039 +267 22483B31 102D100E103A +268 22483B32 102F100E1039 +269 22483B32 102F100E103A +270 22483B33 1031100E1039 +271 22483B33 1031100E103A +272 22483B34 1031102C100E1039 +273 22483B34 1031102C100E103A +274 22483B34 1031102B100E1039 +275 22483B34 1031102B100E103A +276 22483B35 102D102F100E1039 +277 22483B35 102D102F100E103A +278 22483B36 100F1039 +279 22483B36 100F103A +280 22483B37 102C100F1039 +281 22483B37 102C100F103A +282 22483B37 102B100F1039 +283 22483B37 102B100F103A +284 22483B38 102D100F1039 +285 22483B38 102D100F103A +286 22483B39 102F100F1039 +287 22483B39 102F100F103A +288 22483B3A 1031100F1039 +289 22483B3A 1031100F103A +290 22483B3B 1031102C100F1039 +291 22483B3B 1031102C100F103A +292 22483B3B 1031102B100F1039 +293 22483B3B 1031102B100F103A +294 22483B3C 102D102F100F1039 +295 22483B3C 102D102F100F103A +296 22483B3D 10101039 +297 22483B3D 1010103A +298 22483B3E 102C10101039 +299 22483B3E 102C1010103A +300 22483B3E 102B10101039 +301 22483B3E 102B1010103A +302 22483B3F 102D10101039 +303 22483B3F 102D1010103A +304 22483B40 102F10101039 +305 22483B40 102F1010103A +306 22483B41 103110101039 +307 22483B41 10311010103A +308 22483B42 1031102C10101039 +309 22483B42 1031102C1010103A +310 22483B42 1031102B10101039 +311 22483B42 1031102B1010103A +312 22483B43 102D102F10101039 +313 22483B43 102D102F1010103A +314 22483B44 10111039 +315 22483B44 1011103A +316 22483B45 102C10111039 +317 22483B45 102C1011103A +318 22483B45 102B10111039 +319 22483B45 102B1011103A +320 22483B46 102D10111039 +321 22483B46 102D1011103A +322 22483B47 102F10111039 +323 22483B47 102F1011103A +324 22483B48 103110111039 +325 22483B48 10311011103A +326 22483B49 1031102C10111039 +327 22483B49 1031102C1011103A +328 22483B49 1031102B10111039 +329 22483B49 1031102B1011103A +330 22483B4A 102D102F10111039 +331 22483B4A 102D102F1011103A +332 22483B4B 10121039 +333 22483B4B 1012103A +334 22483B4C 102C10121039 +335 22483B4C 102C1012103A +336 22483B4C 102B10121039 +337 22483B4C 102B1012103A +338 22483B4D 102D10121039 +339 22483B4D 102D1012103A +340 22483B4E 102F10121039 +341 22483B4E 102F1012103A +342 22483B4F 103110121039 +343 22483B4F 10311012103A +344 22483B50 1031102C10121039 +345 22483B50 1031102C1012103A +346 22483B50 1031102B10121039 +347 22483B50 1031102B1012103A +348 22483B51 102D102F10121039 +349 22483B51 102D102F1012103A +350 22483B52 10131039 +351 22483B52 1013103A +352 22483B53 102C10131039 +353 22483B53 102C1013103A +354 22483B53 102B10131039 +355 22483B53 102B1013103A +356 22483B54 102D10131039 +357 22483B54 102D1013103A +358 22483B55 102F10131039 +359 22483B55 102F1013103A +360 22483B56 103110131039 +361 22483B56 10311013103A +362 22483B57 1031102C10131039 +363 22483B57 1031102C1013103A +364 22483B57 1031102B10131039 +365 22483B57 1031102B1013103A +366 22483B58 102D102F10131039 +367 22483B58 102D102F1013103A +368 22483B59 10141039 +369 22483B59 1014103A +370 22483B5A 102C10141039 +371 22483B5A 102C1014103A +372 22483B5A 102B10141039 +373 22483B5A 102B1014103A +374 22483B5B 102D10141039 +375 22483B5B 102D1014103A +376 22483B5C 102F10141039 +377 22483B5C 102F1014103A +378 22483B5D 103110141039 +379 22483B5D 10311014103A +380 22483B5E 1031102C10141039 +381 22483B5E 1031102C1014103A +382 22483B5E 1031102B10141039 +383 22483B5E 1031102B1014103A +384 22483B5F 102D102F10141039 +385 22483B5F 102D102F1014103A +386 22483B60 10151039 +387 22483B60 1015103A +388 22483B61 102C10151039 +389 22483B61 102C1015103A +390 22483B61 102B10151039 +391 22483B61 102B1015103A +392 22483B62 102D10151039 +393 22483B62 102D1015103A +394 22483B63 102F10151039 +395 22483B63 102F1015103A +396 22483B64 103110151039 +397 22483B64 10311015103A +398 22483B65 1031102C10151039 +399 22483B65 1031102C1015103A +400 22483B65 1031102B10151039 +401 22483B65 1031102B1015103A +402 22483B66 102D102F10151039 +403 22483B66 102D102F1015103A +404 22483B67 10161039 +405 22483B67 1016103A +406 22483B68 102C10161039 +407 22483B68 102C1016103A +408 22483B68 102B10161039 +409 22483B68 102B1016103A +410 22483B69 102D10161039 +411 22483B69 102D1016103A +412 22483B6A 102F10161039 +413 22483B6A 102F1016103A +414 22483B6B 103110161039 +415 22483B6B 10311016103A +416 22483B6C 1031102C10161039 +417 22483B6C 1031102C1016103A +418 22483B6C 1031102B10161039 +419 22483B6C 1031102B1016103A +420 22483B6D 102D102F10161039 +421 22483B6D 102D102F1016103A +422 22483B6E 10171039 +423 22483B6E 1017103A +424 22483B6F 102C10171039 +425 22483B6F 102C1017103A +426 22483B6F 102B10171039 +427 22483B6F 102B1017103A +428 22483B70 102D10171039 +429 22483B70 102D1017103A +430 22483B71 102F10171039 +431 22483B71 102F1017103A +432 22483B72 103110171039 +433 22483B72 10311017103A +434 22483B73 1031102C10171039 +435 22483B73 1031102C1017103A +436 22483B73 1031102B10171039 +437 22483B73 1031102B1017103A +438 22483B74 102D102F10171039 +439 22483B74 102D102F1017103A +440 22483B75 10181039 +441 22483B75 1018103A +442 22483B76 102C10181039 +443 22483B76 102C1018103A +444 22483B76 102B10181039 +445 22483B76 102B1018103A +446 22483B77 102D10181039 +447 22483B77 102D1018103A +448 22483B78 102F10181039 +449 22483B78 102F1018103A +450 22483B79 103110181039 +451 22483B79 10311018103A +452 22483B7A 1031102C10181039 +453 22483B7A 1031102C1018103A +454 22483B7A 1031102B10181039 +455 22483B7A 1031102B1018103A +456 22483B7B 102D102F10181039 +457 22483B7B 102D102F1018103A +458 22483B7C 10191039 +459 22483B7C 1019103A +460 22483B7D 102C10191039 +461 22483B7D 102C1019103A +462 22483B7D 102B10191039 +463 22483B7D 102B1019103A +464 22483B7E 102D10191039 +465 22483B7E 102D1019103A +466 22483B7F 102F10191039 +467 22483B7F 102F1019103A +468 22483B80 103110191039 +469 22483B80 10311019103A +470 22483B81 1031102C10191039 +471 22483B81 1031102C1019103A +472 22483B81 1031102B10191039 +473 22483B81 1031102B1019103A +474 22483B82 102D102F10191039 +475 22483B82 102D102F1019103A +476 22483B83 101A1039 +477 22483B83 101A103A +478 22483B84 102C101A1039 +479 22483B84 102C101A103A +480 22483B84 102B101A1039 +481 22483B84 102B101A103A +482 22483B85 102D101A1039 +483 22483B85 102D101A103A +484 22483B86 102F101A1039 +485 22483B86 102F101A103A +486 22483B87 1031101A1039 +487 22483B87 1031101A103A +488 22483B88 1031102C101A1039 +489 22483B88 1031102C101A103A +490 22483B88 1031102B101A1039 +491 22483B88 1031102B101A103A +492 22483B89 102D102F101A1039 +493 22483B89 102D102F101A103A +494 22483B8A 101B1039 +495 22483B8A 101B103A +496 22483B8B 102C101B1039 +497 22483B8B 102C101B103A +498 22483B8B 102B101B1039 +499 22483B8B 102B101B103A +500 22483B8C 102D101B1039 +501 22483B8C 102D101B103A +502 22483B8D 102F101B1039 +503 22483B8D 102F101B103A +504 22483B8E 1031101B1039 +505 22483B8E 1031101B103A +506 22483B8F 1031102C101B1039 +507 22483B8F 1031102C101B103A +508 22483B8F 1031102B101B1039 +509 22483B8F 1031102B101B103A +510 22483B90 102D102F101B1039 +511 22483B90 102D102F101B103A +512 22483B91 101C1039 +513 22483B91 101C103A +514 22483B92 102C101C1039 +515 22483B92 102C101C103A +516 22483B92 102B101C1039 +517 22483B92 102B101C103A +518 22483B93 102D101C1039 +519 22483B93 102D101C103A +520 22483B94 102F101C1039 +521 22483B94 102F101C103A +522 22483B95 1031101C1039 +523 22483B95 1031101C103A +524 22483B96 1031102C101C1039 +525 22483B96 1031102C101C103A +526 22483B96 1031102B101C1039 +527 22483B96 1031102B101C103A +528 22483B97 102D102F101C1039 +529 22483B97 102D102F101C103A +530 22483B98 101D103A +531 22483B99 102C101D103A +532 22483B99 102B101D103A +533 22483B9A 102D101D103A +534 22483B9B 102F101D103A +535 22483B9C 1031101D103A +536 22483B9D 1031102C101D103A +537 22483B9D 1031102B101D103A +538 22483B9E 102D102F101D103A +539 22483B9F 101E1039 +540 22483B9F 101E103A +541 22483BA0 102C101E1039 +542 22483BA0 102C101E103A +543 22483BA0 102B101E1039 +544 22483BA0 102B101E103A +545 22483BA1 102D101E1039 +546 22483BA1 102D101E103A +547 22483BA2 102F101E1039 +548 22483BA2 102F101E103A +549 22483BA3 1031101E1039 +550 22483BA3 1031101E103A +551 22483BA4 1031102C101E1039 +552 22483BA4 1031102C101E103A +553 22483BA4 1031102B101E1039 +554 22483BA4 1031102B101E103A +555 22483BA5 102D102F101E1039 +556 22483BA5 102D102F101E103A +557 22483BA6 101F1039 +558 22483BA6 101F103A +559 22483BA7 102C101F1039 +560 22483BA7 102C101F103A +561 22483BA7 102B101F1039 +562 22483BA7 102B101F103A +563 22483BA8 102D101F1039 +564 22483BA8 102D101F103A +565 22483BA9 102F101F1039 +566 22483BA9 102F101F103A +567 22483BAA 1031101F1039 +568 22483BAA 1031101F103A +569 22483BAB 1031102C101F1039 +570 22483BAB 1031102C101F103A +571 22483BAB 1031102B101F1039 +572 22483BAB 1031102B101F103A +573 22483BAC 102D102F101F1039 +574 22483BAC 102D102F101F103A +575 22483BAD 1020103A +576 22483BAE 102C1020103A +577 22483BAE 102B1020103A +578 22483BAF 102D1020103A +579 22483BB0 102F1020103A +580 22483BB1 10311020103A +581 22483BB2 1031102C1020103A +582 22483BB2 1031102B1020103A +583 22483BB3 102D102F1020103A +584 22483BB4 1021103A +585 22483BB5 102C1021103A +586 22483BB5 102B1021103A +587 22483BB6 102D1021103A +588 22483BB7 102F1021103A +589 22483BB8 10311021103A +590 22483BB9 1031102C1021103A +591 22483BB9 1031102B1021103A +592 22483BBA 102D102F1021103A +593 --- Medials +594 22483BBB 105E +595 22483BBC 105F +596 22483BBD 103B +597 22483BBE 103C +598 22483BBF 1060 +599 22483BC0 103D +600 22483BC1 1082 +601 22483BC2 103E +602 22483BC3 103B103D +603 22483BC4 103C103D +604 22483BC5 103B103E +605 22483BC6 103C103E +606 22483BC7 103D103E +607 22483BC8 103B103D103E +608 22483BC9 103C103D103E +609 --- Independent vowels +610 22242236 1021102D +611 22242236 1023 +612 22242238 1021102E +613 22242238 1024 +614 2224223A 1021102F +615 2224223A 1025 +616 2224223D 10211030 +617 2224223D 1026 +618 22242242 10211031 +619 22242242 1027 +620 22242242 1028 +621 222422463ACB 10211031102C +622 222422463ACB 1029 +623 222422463ACC 10211031102C103A +624 222422463ACC 102A +625 22483B7E 102D1019103A +626 22483B7E3ACB 102D1036 +627 22483B7E3ACC 102D1019103A1037 +628 22483B7E3ACD 102D10361037 +629 22483B7E3ACE 102D1019103A1038 +630 22483B7E3ACF 102D10361038 +631 22483B7F 102F1019103A +632 22483B7F3ACB 102F1036 +633 22483B7F3ACC 102F1019103A1037 +634 22483B7F3ACD 102F10361037 +635 22483B7F3ACE 102F1019103A1038 +636 22483B7F3ACF 102F10361038 +637 222422483B7F3ACB 1021102F1036 +638 222422483B7F3ACB 1025102F1036 +639 --- Independent vowels with finals +640 222422483ACF 1021102D10001039 +641 222422483ACF 102310001039 +642 222422483ACF 1021102D1000103A +643 222422483ACF 10231000103A +644 222422483AD0 1021102F10001039 +645 222422483AD0 102510001039 +646 222422483AD0 1021102F1000103A +647 222422483AD0 10251000103A +648 222422483AD1 1021103110001039 +649 222422483AD1 102710001039 +650 222422483AD1 102110311000103A +651 222422483AD1 10271000103A +652 222422483AD2 10211031102C10001039 +653 222422483AD2 102910001039 +654 222422483AD2 10211031102C1000103A +655 222422483AD2 10291000103A +656 222422483AD2 10211031102C10001039 +657 222422483AD2 10291031102C10001039 +658 222422483AD2 10211031102C1000103A +659 222422483AD2 10291031102C1000103A +660 222422483AD6 1021102D10011039 +661 222422483AD6 102310011039 +662 222422483AD6 1021102D1001103A +663 222422483AD6 10231001103A +664 222422483AD7 1021102F10011039 +665 222422483AD7 102510011039 +666 222422483AD7 1021102F1001103A +667 222422483AD7 10251001103A +668 222422483AD8 1021103110011039 +669 222422483AD8 102710011039 +670 222422483AD8 102110311001103A +671 222422483AD8 10271001103A +672 222422483AD9 10211031102C10011039 +673 222422483AD9 102910011039 +674 222422483AD9 10211031102C1001103A +675 222422483AD9 10291001103A +676 222422483AD9 10211031102C10011039 +677 222422483AD9 10291031102C10011039 +678 222422483AD9 10211031102C1001103A +679 222422483AD9 10291031102C1001103A +680 222422483ADD 1021102D10021039 +681 222422483ADD 102310021039 +682 222422483ADD 1021102D1002103A +683 222422483ADD 10231002103A +684 222422483ADE 1021102F10021039 +685 222422483ADE 102510021039 +686 222422483ADE 1021102F1002103A +687 222422483ADE 10251002103A +688 222422483ADF 1021103110021039 +689 222422483ADF 102710021039 +690 222422483ADF 102110311002103A +691 222422483ADF 10271002103A +692 222422483AE0 10211031102C10021039 +693 222422483AE0 102910021039 +694 222422483AE0 10211031102C1002103A +695 222422483AE0 10291002103A +696 222422483AE0 10211031102C10021039 +697 222422483AE0 10291031102C10021039 +698 222422483AE0 10211031102C1002103A +699 222422483AE0 10291031102C1002103A +700 222422483AE4 1021102D10031039 +701 222422483AE4 102310031039 +702 222422483AE4 1021102D1003103A +703 222422483AE4 10231003103A +704 222422483AE5 1021102F10031039 +705 222422483AE5 102510031039 +706 222422483AE5 1021102F1003103A +707 222422483AE5 10251003103A +708 222422483AE6 1021103110031039 +709 222422483AE6 102710031039 +710 222422483AE6 102110311003103A +711 222422483AE6 10271003103A +712 222422483AE7 10211031102C10031039 +713 222422483AE7 102910031039 +714 222422483AE7 10211031102C1003103A +715 222422483AE7 10291003103A +716 222422483AE7 10211031102C10031039 +717 222422483AE7 10291031102C10031039 +718 222422483AE7 10211031102C1003103A +719 222422483AE7 10291031102C1003103A +720 2224223621D5224D 1021102D10041039 +721 2224223621D5224D 102310041039 +722 222422483AEB 1021102D1004103A +723 222422483AEB 10231004103A +724 2224223A21D5224D 1021102F10041039 +725 2224223A21D5224D 102510041039 +726 222422483AEC 1021102F1004103A +727 222422483AEC 10251004103A +728 2224224221D5224D 1021103110041039 +729 2224224221D5224D 102710041039 +730 222422483AED 102110311004103A +731 222422483AED 10271004103A +732 222422463ACB21D5224D 10211031102C10041039 +733 222422463ACB21D5224D 102910041039 +734 222422483AEE 10211031102C1004103A +735 222422483AEE 10291004103A +736 222422463ACB21D5224D 10211031102C10041039 +737 222422463ACB21D5224D 10291031102C10041039 +738 222422483AEE 10211031102C1004103A +739 222422483AEE 10291031102C1004103A +740 222422483AF2 1021102D10051039 +741 222422483AF2 102310051039 +742 222422483AF2 1021102D1005103A +743 222422483AF2 10231005103A +744 222422483AF3 1021102F10051039 +745 222422483AF3 102510051039 +746 222422483AF3 1021102F1005103A +747 222422483AF3 10251005103A +748 222422483AF4 1021103110051039 +749 222422483AF4 102710051039 +750 222422483AF4 102110311005103A +751 222422483AF4 10271005103A +752 222422483AF5 10211031102C10051039 +753 222422483AF5 102910051039 +754 222422483AF5 10211031102C1005103A +755 222422483AF5 10291005103A +756 222422483AF5 10211031102C10051039 +757 222422483AF5 10291031102C10051039 +758 222422483AF5 10211031102C1005103A +759 222422483AF5 10291031102C1005103A +760 222422483AF9 1021102D10061039 +761 222422483AF9 102310061039 +762 222422483AF9 1021102D1006103A +763 222422483AF9 10231006103A +764 222422483AFA 1021102F10061039 +765 222422483AFA 102510061039 +766 222422483AFA 1021102F1006103A +767 222422483AFA 10251006103A +768 222422483AFB 1021103110061039 +769 222422483AFB 102710061039 +770 222422483AFB 102110311006103A +771 222422483AFB 10271006103A +772 222422483AFC 10211031102C10061039 +773 222422483AFC 102910061039 +774 222422483AFC 10211031102C1006103A +775 222422483AFC 10291006103A +776 222422483AFC 10211031102C10061039 +777 222422483AFC 10291031102C10061039 +778 222422483AFC 10211031102C1006103A +779 222422483AFC 10291031102C1006103A +780 222422483B00 1021102D10071039 +781 222422483B00 102310071039 +782 222422483B00 1021102D1007103A +783 222422483B00 10231007103A +784 222422483B01 1021102F10071039 +785 222422483B01 102510071039 +786 222422483B01 1021102F1007103A +787 222422483B01 10251007103A +788 222422483B02 1021103110071039 +789 222422483B02 102710071039 +790 222422483B02 102110311007103A +791 222422483B02 10271007103A +792 222422483B03 10211031102C10071039 +793 222422483B03 102910071039 +794 222422483B03 10211031102C1007103A +795 222422483B03 10291007103A +796 222422483B03 10211031102C10071039 +797 222422483B03 10291031102C10071039 +798 222422483B03 10211031102C1007103A +799 222422483B03 10291031102C1007103A +800 222422483B0E 1021102D10091039 +801 222422483B0E 102310091039 +802 222422483B0E 1021102D1009103A +803 222422483B0E 10231009103A +804 222422483B0F 1021102F10091039 +805 222422483B0F 102510091039 +806 222422483B0F 1021102F1009103A +807 222422483B0F 10251009103A +808 222422483B10 1021103110091039 +809 222422483B10 102710091039 +810 222422483B10 102110311009103A +811 222422483B10 10271009103A +812 222422483B11 10211031102C10091039 +813 222422483B11 102910091039 +814 222422483B11 10211031102C1009103A +815 222422483B11 10291009103A +816 222422483B11 10211031102C10091039 +817 222422483B11 10291031102C10091039 +818 222422483B11 10211031102C1009103A +819 222422483B11 10291031102C1009103A +820 222422483B15 1021102D100A1039 +821 222422483B15 1023100A1039 +822 222422483B15 1021102D100A103A +823 222422483B15 1023100A103A +824 222422483B16 1021102F100A1039 +825 222422483B16 1025100A1039 +826 222422483B16 1021102F100A103A +827 222422483B16 1025100A103A +828 222422483B17 10211031100A1039 +829 222422483B17 1027100A1039 +830 222422483B17 10211031100A103A +831 222422483B17 1027100A103A +832 222422483B18 10211031102C100A1039 +833 222422483B18 1029100A1039 +834 222422483B18 10211031102C100A103A +835 222422483B18 1029100A103A +836 222422483B18 10211031102C100A1039 +837 222422483B18 10291031102C100A1039 +838 222422483B18 10211031102C100A103A +839 222422483B18 10291031102C100A103A +840 222422483B1C 1021102D100B1039 +841 222422483B1C 1023100B1039 +842 222422483B1C 1021102D100B103A +843 222422483B1C 1023100B103A +844 222422483B1D 1021102F100B1039 +845 222422483B1D 1025100B1039 +846 222422483B1D 1021102F100B103A +847 222422483B1D 1025100B103A +848 222422483B1E 10211031100B1039 +849 222422483B1E 1027100B1039 +850 222422483B1E 10211031100B103A +851 222422483B1E 1027100B103A +852 222422483B1F 10211031102C100B1039 +853 222422483B1F 1029100B1039 +854 222422483B1F 10211031102C100B103A +855 222422483B1F 1029100B103A +856 222422483B1F 10211031102C100B1039 +857 222422483B1F 10291031102C100B1039 +858 222422483B1F 10211031102C100B103A +859 222422483B1F 10291031102C100B103A +860 222422483B23 1021102D100C1039 +861 222422483B23 1023100C1039 +862 222422483B23 1021102D100C103A +863 222422483B23 1023100C103A +864 222422483B24 1021102F100C1039 +865 222422483B24 1025100C1039 +866 222422483B24 1021102F100C103A +867 222422483B24 1025100C103A +868 222422483B25 10211031100C1039 +869 222422483B25 1027100C1039 +870 222422483B25 10211031100C103A +871 222422483B25 1027100C103A +872 222422483B26 10211031102C100C1039 +873 222422483B26 1029100C1039 +874 222422483B26 10211031102C100C103A +875 222422483B26 1029100C103A +876 222422483B26 10211031102C100C1039 +877 222422483B26 10291031102C100C1039 +878 222422483B26 10211031102C100C103A +879 222422483B26 10291031102C100C103A +880 222422483B2A 1021102D100D1039 +881 222422483B2A 1023100D1039 +882 222422483B2A 1021102D100D103A +883 222422483B2A 1023100D103A +884 222422483B2B 1021102F100D1039 +885 222422483B2B 1025100D1039 +886 222422483B2B 1021102F100D103A +887 222422483B2B 1025100D103A +888 222422483B2C 10211031100D1039 +889 222422483B2C 1027100D1039 +890 222422483B2C 10211031100D103A +891 222422483B2C 1027100D103A +892 222422483B2D 10211031102C100D1039 +893 222422483B2D 1029100D1039 +894 222422483B2D 10211031102C100D103A +895 222422483B2D 1029100D103A +896 222422483B2D 10211031102C100D1039 +897 222422483B2D 10291031102C100D1039 +898 222422483B2D 10211031102C100D103A +899 222422483B2D 10291031102C100D103A +900 222422483B31 1021102D100E1039 +901 222422483B31 1023100E1039 +902 222422483B31 1021102D100E103A +903 222422483B31 1023100E103A +904 222422483B32 1021102F100E1039 +905 222422483B32 1025100E1039 +906 222422483B32 1021102F100E103A +907 222422483B32 1025100E103A +908 222422483B33 10211031100E1039 +909 222422483B33 1027100E1039 +910 222422483B33 10211031100E103A +911 222422483B33 1027100E103A +912 222422483B34 10211031102C100E1039 +913 222422483B34 1029100E1039 +914 222422483B34 10211031102C100E103A +915 222422483B34 1029100E103A +916 222422483B34 10211031102C100E1039 +917 222422483B34 10291031102C100E1039 +918 222422483B34 10211031102C100E103A +919 222422483B34 10291031102C100E103A +920 222422483B38 1021102D100F1039 +921 222422483B38 1023100F1039 +922 222422483B38 1021102D100F103A +923 222422483B38 1023100F103A +924 222422483B39 1021102F100F1039 +925 222422483B39 1025100F1039 +926 222422483B39 1021102F100F103A +927 222422483B39 1025100F103A +928 222422483B3A 10211031100F1039 +929 222422483B3A 1027100F1039 +930 222422483B3A 10211031100F103A +931 222422483B3A 1027100F103A +932 222422483B3B 10211031102C100F1039 +933 222422483B3B 1029100F1039 +934 222422483B3B 10211031102C100F103A +935 222422483B3B 1029100F103A +936 222422483B3B 10211031102C100F1039 +937 222422483B3B 10291031102C100F1039 +938 222422483B3B 10211031102C100F103A +939 222422483B3B 10291031102C100F103A +940 222422483B3F 1021102D10101039 +941 222422483B3F 102310101039 +942 222422483B3F 1021102D1010103A +943 222422483B3F 10231010103A +944 222422483B40 1021102F10101039 +945 222422483B40 102510101039 +946 222422483B40 1021102F1010103A +947 222422483B40 10251010103A +948 222422483B41 1021103110101039 +949 222422483B41 102710101039 +950 222422483B41 102110311010103A +951 222422483B41 10271010103A +952 222422483B42 10211031102C10101039 +953 222422483B42 102910101039 +954 222422483B42 10211031102C1010103A +955 222422483B42 10291010103A +956 222422483B42 10211031102C10101039 +957 222422483B42 10291031102C10101039 +958 222422483B42 10211031102C1010103A +959 222422483B42 10291031102C1010103A +960 222422483B46 1021102D10111039 +961 222422483B46 102310111039 +962 222422483B46 1021102D1011103A +963 222422483B46 10231011103A +964 222422483B47 1021102F10111039 +965 222422483B47 102510111039 +966 222422483B47 1021102F1011103A +967 222422483B47 10251011103A +968 222422483B48 1021103110111039 +969 222422483B48 102710111039 +970 222422483B48 102110311011103A +971 222422483B48 10271011103A +972 222422483B49 10211031102C10111039 +973 222422483B49 102910111039 +974 222422483B49 10211031102C1011103A +975 222422483B49 10291011103A +976 222422483B49 10211031102C10111039 +977 222422483B49 10291031102C10111039 +978 222422483B49 10211031102C1011103A +979 222422483B49 10291031102C1011103A +980 222422483B4D 1021102D10121039 +981 222422483B4D 102310121039 +982 222422483B4D 1021102D1012103A +983 222422483B4D 10231012103A +984 222422483B4E 1021102F10121039 +985 222422483B4E 102510121039 +986 222422483B4E 1021102F1012103A +987 222422483B4E 10251012103A +988 222422483B4F 1021103110121039 +989 222422483B4F 102710121039 +990 222422483B4F 102110311012103A +991 222422483B4F 10271012103A +992 222422483B50 10211031102C10121039 +993 222422483B50 102910121039 +994 222422483B50 10211031102C1012103A +995 222422483B50 10291012103A +996 222422483B50 10211031102C10121039 +997 222422483B50 10291031102C10121039 +998 222422483B50 10211031102C1012103A +999 222422483B50 10291031102C1012103A +1000 222422483B54 1021102D10131039 +1001 222422483B54 102310131039 +1002 222422483B54 1021102D1013103A +1003 222422483B54 10231013103A +1004 222422483B55 1021102F10131039 +1005 222422483B55 102510131039 +1006 222422483B55 1021102F1013103A +1007 222422483B55 10251013103A +1008 222422483B56 1021103110131039 +1009 222422483B56 102710131039 +1010 222422483B56 102110311013103A +1011 222422483B56 10271013103A +1012 222422483B57 10211031102C10131039 +1013 222422483B57 102910131039 +1014 222422483B57 10211031102C1013103A +1015 222422483B57 10291013103A +1016 222422483B57 10211031102C10131039 +1017 222422483B57 10291031102C10131039 +1018 222422483B57 10211031102C1013103A +1019 222422483B57 10291031102C1013103A +1020 222422483B5B 1021102D10141039 +1021 222422483B5B 102310141039 +1022 222422483B5B 1021102D1014103A +1023 222422483B5B 10231014103A +1024 222422483B5C 1021102F10141039 +1025 222422483B5C 102510141039 +1026 222422483B5C 1021102F1014103A +1027 222422483B5C 10251014103A +1028 222422483B5D 1021103110141039 +1029 222422483B5D 102710141039 +1030 222422483B5D 102110311014103A +1031 222422483B5D 10271014103A +1032 222422483B5E 10211031102C10141039 +1033 222422483B5E 102910141039 +1034 222422483B5E 10211031102C1014103A +1035 222422483B5E 10291014103A +1036 222422483B5E 10211031102C10141039 +1037 222422483B5E 10291031102C10141039 +1038 222422483B5E 10211031102C1014103A +1039 222422483B5E 10291031102C1014103A +1040 222422483B62 1021102D10151039 +1041 222422483B62 102310151039 +1042 222422483B62 1021102D1015103A +1043 222422483B62 10231015103A +1044 222422483B63 1021102F10151039 +1045 222422483B63 102510151039 +1046 222422483B63 1021102F1015103A +1047 222422483B63 10251015103A +1048 222422483B64 1021103110151039 +1049 222422483B64 102710151039 +1050 222422483B64 102110311015103A +1051 222422483B64 10271015103A +1052 222422483B65 10211031102C10151039 +1053 222422483B65 102910151039 +1054 222422483B65 10211031102C1015103A +1055 222422483B65 10291015103A +1056 222422483B65 10211031102C10151039 +1057 222422483B65 10291031102C10151039 +1058 222422483B65 10211031102C1015103A +1059 222422483B65 10291031102C1015103A +1060 222422483B69 1021102D10161039 +1061 222422483B69 102310161039 +1062 222422483B69 1021102D1016103A +1063 222422483B69 10231016103A +1064 222422483B6A 1021102F10161039 +1065 222422483B6A 102510161039 +1066 222422483B6A 1021102F1016103A +1067 222422483B6A 10251016103A +1068 222422483B6B 1021103110161039 +1069 222422483B6B 102710161039 +1070 222422483B6B 102110311016103A +1071 222422483B6B 10271016103A +1072 222422483B6C 10211031102C10161039 +1073 222422483B6C 102910161039 +1074 222422483B6C 10211031102C1016103A +1075 222422483B6C 10291016103A +1076 222422483B6C 10211031102C10161039 +1077 222422483B6C 10291031102C10161039 +1078 222422483B6C 10211031102C1016103A +1079 222422483B6C 10291031102C1016103A +1080 222422483B70 1021102D10171039 +1081 222422483B70 102310171039 +1082 222422483B70 1021102D1017103A +1083 222422483B70 10231017103A +1084 222422483B71 1021102F10171039 +1085 222422483B71 102510171039 +1086 222422483B71 1021102F1017103A +1087 222422483B71 10251017103A +1088 222422483B72 1021103110171039 +1089 222422483B72 102710171039 +1090 222422483B72 102110311017103A +1091 222422483B72 10271017103A +1092 222422483B73 10211031102C10171039 +1093 222422483B73 102910171039 +1094 222422483B73 10211031102C1017103A +1095 222422483B73 10291017103A +1096 222422483B73 10211031102C10171039 +1097 222422483B73 10291031102C10171039 +1098 222422483B73 10211031102C1017103A +1099 222422483B73 10291031102C1017103A +1100 222422483B77 1021102D10181039 +1101 222422483B77 102310181039 +1102 222422483B77 1021102D1018103A +1103 222422483B77 10231018103A +1104 222422483B78 1021102F10181039 +1105 222422483B78 102510181039 +1106 222422483B78 1021102F1018103A +1107 222422483B78 10251018103A +1108 222422483B79 1021103110181039 +1109 222422483B79 102710181039 +1110 222422483B79 102110311018103A +1111 222422483B79 10271018103A +1112 222422483B7A 10211031102C10181039 +1113 222422483B7A 102910181039 +1114 222422483B7A 10211031102C1018103A +1115 222422483B7A 10291018103A +1116 222422483B7A 10211031102C10181039 +1117 222422483B7A 10291031102C10181039 +1118 222422483B7A 10211031102C1018103A +1119 222422483B7A 10291031102C1018103A +1120 222422483B7E 1021102D10191039 +1121 222422483B7E 102310191039 +1122 222422483B7E 1021102D1019103A +1123 222422483B7E 10231019103A +1124 222422483B7F 1021102F10191039 +1125 222422483B7F 102510191039 +1126 222422483B7F 1021102F1019103A +1127 222422483B7F 10251019103A +1128 222422483B80 1021103110191039 +1129 222422483B80 102710191039 +1130 222422483B80 102110311019103A +1131 222422483B80 10271019103A +1132 222422483B81 10211031102C10191039 +1133 222422483B81 102910191039 +1134 222422483B81 10211031102C1019103A +1135 222422483B81 10291019103A +1136 222422483B81 10211031102C10191039 +1137 222422483B81 10291031102C10191039 +1138 222422483B81 10211031102C1019103A +1139 222422483B81 10291031102C1019103A +1140 222422483B85 1021102D101A1039 +1141 222422483B85 1023101A1039 +1142 222422483B85 1021102D101A103A +1143 222422483B85 1023101A103A +1144 222422483B86 1021102F101A1039 +1145 222422483B86 1025101A1039 +1146 222422483B86 1021102F101A103A +1147 222422483B86 1025101A103A +1148 222422483B87 10211031101A1039 +1149 222422483B87 1027101A1039 +1150 222422483B87 10211031101A103A +1151 222422483B87 1027101A103A +1152 222422483B88 10211031102C101A1039 +1153 222422483B88 1029101A1039 +1154 222422483B88 10211031102C101A103A +1155 222422483B88 1029101A103A +1156 222422483B88 10211031102C101A1039 +1157 222422483B88 10291031102C101A1039 +1158 222422483B88 10211031102C101A103A +1159 222422483B88 10291031102C101A103A +1160 222422483B8C 1021102D101B1039 +1161 222422483B8C 1023101B1039 +1162 222422483B8C 1021102D101B103A +1163 222422483B8C 1023101B103A +1164 222422483B8D 1021102F101B1039 +1165 222422483B8D 1025101B1039 +1166 222422483B8D 1021102F101B103A +1167 222422483B8D 1025101B103A +1168 222422483B8E 10211031101B1039 +1169 222422483B8E 1027101B1039 +1170 222422483B8E 10211031101B103A +1171 222422483B8E 1027101B103A +1172 222422483B8F 10211031102C101B1039 +1173 222422483B8F 1029101B1039 +1174 222422483B8F 10211031102C101B103A +1175 222422483B8F 1029101B103A +1176 222422483B8F 10211031102C101B1039 +1177 222422483B8F 10291031102C101B1039 +1178 222422483B8F 10211031102C101B103A +1179 222422483B8F 10291031102C101B103A +1180 222422483B93 1021102D101C1039 +1181 222422483B93 1023101C1039 +1182 222422483B93 1021102D101C103A +1183 222422483B93 1023101C103A +1184 222422483B94 1021102F101C1039 +1185 222422483B94 1025101C1039 +1186 222422483B94 1021102F101C103A +1187 222422483B94 1025101C103A +1188 222422483B95 10211031101C1039 +1189 222422483B95 1027101C1039 +1190 222422483B95 10211031101C103A +1191 222422483B95 1027101C103A +1192 222422483B96 10211031102C101C1039 +1193 222422483B96 1029101C1039 +1194 222422483B96 10211031102C101C103A +1195 222422483B96 1029101C103A +1196 222422483B96 10211031102C101C1039 +1197 222422483B96 10291031102C101C1039 +1198 222422483B96 10211031102C101C103A +1199 222422483B96 10291031102C101C103A +1200 222422483BA1 1021102D101E1039 +1201 222422483BA1 1023101E1039 +1202 222422483BA1 1021102D101E103A +1203 222422483BA1 1023101E103A +1204 222422483BA2 1021102F101E1039 +1205 222422483BA2 1025101E1039 +1206 222422483BA2 1021102F101E103A +1207 222422483BA2 1025101E103A +1208 222422483BA3 10211031101E1039 +1209 222422483BA3 1027101E1039 +1210 222422483BA3 10211031101E103A +1211 222422483BA3 1027101E103A +1212 222422483BA4 10211031102C101E1039 +1213 222422483BA4 1029101E1039 +1214 222422483BA4 10211031102C101E103A +1215 222422483BA4 1029101E103A +1216 222422483BA4 10211031102C101E1039 +1217 222422483BA4 10291031102C101E1039 +1218 222422483BA4 10211031102C101E103A +1219 222422483BA4 10291031102C101E103A +1220 222422483BA8 1021102D101F1039 +1221 222422483BA8 1023101F1039 +1222 222422483BA8 1021102D101F103A +1223 222422483BA8 1023101F103A +1224 222422483BA9 1021102F101F1039 +1225 222422483BA9 1025101F1039 +1226 222422483BA9 1021102F101F103A +1227 222422483BA9 1025101F103A +1228 222422483BAA 10211031101F1039 +1229 222422483BAA 1027101F1039 +1230 222422483BAA 10211031101F103A +1231 222422483BAA 1027101F103A +1232 222422483BAB 10211031102C101F1039 +1233 222422483BAB 1029101F1039 +1234 222422483BAB 10211031102C101F103A +1235 222422483BAB 1029101F103A +1236 222422483BAB 10211031102C101F1039 +1237 222422483BAB 10291031102C101F1039 +1238 222422483BAB 10211031102C101F103A +1239 222422483BAB 10291031102C101F103A +1240 --- Contractions +1241 22483AD221CD22483BBD 1031102C1000103A1000103B +1242 22483AD221CD22483BBD 1031102C1000103A103B +1243 22483B5921F822483B63 1014103A1014102F1015103A +1244 22483B5921F822483B63 1014103A102F1015103A +1245 --- Great Sa +1246 22483BA32216 1031101E1039101E +1247 22483BA32216 1031103F +1248 22483BA12216 102D101E1039101E +1249 22483BA12216 102D103F +1250 22483BA22216 102F101E1039101E +1251 22483BA22216 102F103F +1252 222422483BA12216 1021102D101E1039101E +1253 222422483BA12216 1023103F +1254 222422483BA22216 1021102F101E1039101E +1255 222422483BA22216 1025103F +1256 22483B9F2216 101E1039101E +1257 22483B9F2216 103F +1258 --- Symbols - collate as long form +1259 21F822483BC222483AD3 1014103E102D102F1000103A +1260 21F822483BC222483AD3 104C +1261 220922483BC0224222593ACB 101B103D10311037 +1262 220922483BC0224222593ACB 104D +1263 220D22483B1322593ACC21CD22483AEE22593ACC 101C100A103A103810001031102C1004103A1038 +1264 220D22483B1322593ACC21CD22483AEE22593ACC 104E1004103A1038 +1265 22242236 1021102D +1266 22242236 104F +1267 --- Short Forms may need to be added here +1268 220D22483ACD22072232 101C1000103A101A102C +1269 220D22483ACD22072232 101C1000103A103B102C +1270 221622052238 101E1019102E +1271 221622052238 101E10391019102E +1272 21F3220522483AE922593ACC 101110191004103A1038 +1273 21F3220522483AE922593ACC 1011103910191004103A1038 +1274 220D22483ACD220422483ACD 101C1000103A10181000103A +1275 220D22483ACD220422483ACD 101C103910181000103A +DROP TABLE t1; +# +# END of ctype_myanmar.inc +# +# +# MDEV-7366 SELECT 'a' = BINARY 'A' returns 1 (utf8 charset, utf8_unicode_ci collation) +# +SET NAMES utf8 COLLATE utf8_unicode_ci; +SELECT 'a' = BINARY 'A'; +'a' = BINARY 'A' +0 +SELECT BINARY 'A' = 'a'; +BINARY 'A' = 'a' +0 +# +# Wrong result set for WHERE a='oe' COLLATE utf8_german2_ci AND a='oe' +# +SET NAMES utf8 COLLATE utf8_german2_ci; +CREATE TABLE t1 (a CHAR(10) CHARACTER SET utf8); +INSERT INTO t1 VALUES ('ö'),('oe'); +SELECT * FROM t1 WHERE a='oe' AND a='oe' COLLATE utf8_german2_ci; +a +oe +SELECT * FROM t1 WHERE a='oe' COLLATE utf8_german2_ci AND a='oe'; +a +oe +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='oe' AND a='oe' COLLATE utf8_german2_ci; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'oe' and `test`.`t1`.`a` = 'oe' +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='oe' COLLATE utf8_german2_ci AND a='oe'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'oe' and `test`.`t1`.`a` = 'oe' +DROP TABLE t1; +# +# MDEV-17064 LIKE function has error behavior on the fields in which the collation is xxx_unicode_xx +# +CREATE TABLE t1 (name VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci); +INSERT INTO t1 VALUES ('radio! test'); +SELECT * FROM t1 WHERE name LIKE '%!!%' ESCAPE '!'; +name +radio! test +ALTER TABLE t1 CHANGE COLUMN name name VARCHAR(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'; +SELECT * FROM t1 WHERE name LIKE '%!!%' ESCAPE '!'; +name +radio! test +DROP TABLE t1; +CREATE TABLE t1 (name VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci); +INSERT INTO t1 VALUES ('radio! test'); +SELECT name LIKE '%!!%' ESCAPE '!' AS c1, +name LIKE '%!!%' COLLATE utf8_general_ci ESCAPE '!' AS c2 +FROM t1; +c1 c2 +1 1 +DROP TABLE t1; +# +# End of MariaDB-10.0 tests +# +# +# Start of MariaDB-10.1 tests +# +# +# MDEV-6973 XOR aggregates argument collations +# +SELECT '10' COLLATE utf8_general_ci XOR '20' COLLATE utf8_unicode_ci; +'10' COLLATE utf8_general_ci XOR '20' COLLATE utf8_unicode_ci +0 +# +# MDEV-8705 Wrong result for SELECT..WHERE latin1_bin_column='a' AND latin1_bin_column='A' +# +SET NAMES utf8 COLLATE utf8_german2_ci; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_bin); +INSERT INTO t1 VALUES ('a'),('A'); +SELECT * FROM t1 WHERE a='a'; +a +a +SELECT * FROM t1 WHERE a=_utf8'a'; +a +a +SELECT * FROM t1 WHERE a='a' AND a=_utf8'a'; +a +a +DROP TABLE t1; +SET NAMES utf8 COLLATE utf8_thai_520_w2; +# +# Start of ctype_uca_w2.inc +# +SELECT @@collation_connection; +@@collation_connection +utf8_thai_520_w2 +SELECT ID, SORTLEN, COLLATION_NAME, CHARACTER_SET_NAME +FROM INFORMATION_SCHEMA.COLLATIONS +WHERE COLLATION_NAME LIKE @@collation_connection; +ID SORTLEN COLLATION_NAME CHARACTER_SET_NAME +578 4 utf8_thai_520_w2 utf8 +# +# Testing strnxfrm +# +CREATE TABLE t1 AS SELECT SPACE(3) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(3) CHARACTER SET utf8 COLLATE utf8_thai_520_w2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (SPACE(0)),(SPACE(1)),(SPACE(2)); +SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(8))) FROM t1; +HEX(a) HEX(WEIGHT_STRING(a AS CHAR(8))) + 020A020A020A020A020A020A020A020A00200020002000200020002000200020 +20 020A020A020A020A020A020A020A020A00200020002000200020002000200020 +2020 020A020A020A020A020A020A020A020A00200020002000200020002000200020 +SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4))) FROM t1; +HEX(a) HEX(WEIGHT_STRING(a AS CHAR(4))) + 020A020A020A020A0020002000200020 +20 020A020A020A020A0020002000200020 +2020 020A020A020A020A0020002000200020 +SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 1)) FROM t1; +HEX(a) HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 1)) + 020A020A020A020A +20 020A020A020A020A +2020 020A020A020A020A +SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 2)) FROM t1; +HEX(a) HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 2)) + 0020002000200020 +20 0020002000200020 +2020 0020002000200020 +SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 3)) FROM t1; +HEX(a) HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 3)) + 0020002000200020 +20 0020002000200020 +2020 0020002000200020 +DROP TABLE t1; +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET utf8 COLLATE utf8_thai_520_w2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (_ucs2 0x3400); +INSERT INTO t1 VALUES (_ucs2 0xF001); +SELECT HEX(CONVERT(a USING ucs2)) AS ucs2, HEX(a), HEX(WEIGHT_STRING(a)) FROM t1; +ucs2 HEX(a) HEX(WEIGHT_STRING(a)) +3400 E39080 FB80B4000020 +F001 EF8081 FBC1F0010020 +DROP TABLE t1; +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET utf8 COLLATE utf8_thai_520_w2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('A'),('À'),('Á'),('Â'),('Ã'),('Ä'),('Å'); +SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a; +a HEX(WEIGHT_STRING(a LEVEL 2)) +A 0020 +Á 00200032 +À 00200035 + 0020003C +Å 00200043 +Ä 00200047 +à 0020004E +SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a DESC; +a HEX(WEIGHT_STRING(a LEVEL 2)) +à 0020004E +Ä 00200047 +Å 00200043 + 0020003C +À 00200035 +Á 00200032 +A 0020 +SET @backup_character_set_connection=@@character_set_connection; +SET @backup_collation_connection=@@collation_connection; +SET NAMES utf8; +SET @stmt= CONCAT('ALTER TABLE t1 MODIFY a CHAR(10)' COLLATE utf8_bin, +' CHARACTER SET ', @backup_character_set_connection, +' COLLATE ', @backup_collation_connection); +PREPARE stmt FROM @stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +SET collation_connection=@backup_collation_connection; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) CHARACTER SET utf8 COLLATE utf8_thai_520_w2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a; +a HEX(WEIGHT_STRING(a LEVEL 2)) +A 0020 +Á 00200032 +À 00200035 + 0020003C +Å 00200043 +Ä 00200047 +à 0020004E +SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a DESC; +a HEX(WEIGHT_STRING(a LEVEL 2)) +à 0020004E +Ä 00200047 +Å 00200043 + 0020003C +À 00200035 +Á 00200032 +A 0020 +DROP TABLE t1; +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET utf8 COLLATE utf8_thai_520_w2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('cota'),('cote'),('cotz'); +INSERT INTO t1 VALUES ('coté'),('côte'),('côté'),('cotë'),('côtë'); +SELECT * FROM t1 ORDER BY a; +a +cota +cote +coté +cotë +côte +côté +côtë +cotz +SELECT * FROM t1 ORDER BY a DESC; +a +cotz +côtë +côté +côte +cotë +coté +cote +cota +DROP TABLE t1; +# +# End of ctype_uca_w2.inc +# +# +# Start of ctype_thai.inc +# +CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_bin); +INSERT INTO t1 VALUES ('-กระแย่ง'); +INSERT INTO t1 VALUES ('กก'); +INSERT INTO t1 VALUES ('กราบ'); +INSERT INTO t1 VALUES ('ข่าง'); +INSERT INTO t1 VALUES ('ข้าง'); +INSERT INTO t1 VALUES ('ข้างกระดาน'); +INSERT INTO t1 VALUES ('ข้างขึ้น'); +INSERT INTO t1 VALUES ('ข้างควาย'); +INSERT INTO t1 VALUES ('ข้างเงิน'); +INSERT INTO t1 VALUES ('ข้างแรม'); +INSERT INTO t1 VALUES ('ข้างออก'); +INSERT INTO t1 VALUES ('ข้างๆ'); +INSERT INTO t1 VALUES ('ข้างๆ คูๆ'); +INSERT INTO t1 VALUES ('ขาง'); +INSERT INTO t1 VALUES ('แข็ง'); +INSERT INTO t1 VALUES ('แข่ง'); +INSERT INTO t1 VALUES ('แข่งขัน'); +INSERT INTO t1 VALUES ('แข้ง'); +INSERT INTO t1 VALUES ('แข้งขวา'); +INSERT INTO t1 VALUES ('แข็งขัน'); +INSERT INTO t1 VALUES ('ทูลเกล้า'); +INSERT INTO t1 VALUES ('ทูลเกล้าทูลกระหม่อม'); +INSERT INTO t1 VALUES ('ทูลเกล้าฯ'); +INSERT INTO t1 VALUES ('บุญญา'); +INSERT INTO t1 VALUES ('บุญ-หลง'); +INSERT INTO t1 VALUES ('บุญหลง'); +INSERT INTO t1 VALUES ('ป่า'); +INSERT INTO t1 VALUES ('ป่าน'); +INSERT INTO t1 VALUES ('ป้า'); +INSERT INTO t1 VALUES ('ป้าน'); +INSERT INTO t1 VALUES ('ป๊า'); +INSERT INTO t1 VALUES ('ป๊าน'); +INSERT INTO t1 VALUES ('ป๋า'); +INSERT INTO t1 VALUES ('ป๋าน'); +INSERT INTO t1 VALUES ('ปา'); +INSERT INTO t1 VALUES ('ปาน'); +INSERT INTO t1 VALUES ('แป้ง'); +INSERT INTO t1 VALUES ('พณิชย์'); +INSERT INTO t1 VALUES ('ม้า'); +INSERT INTO t1 VALUES ('ฯพณฯ'); +INSERT INTO t1 VALUES ('A'); +INSERT INTO t1 VALUES ('a'); +INSERT INTO t1 VALUES ('a\''); +INSERT INTO t1 VALUES ('A-'); +INSERT INTO t1 VALUES ('a-'); +INSERT INTO t1 VALUES ('-a'); +INSERT INTO t1 VALUES ('A.'); +INSERT INTO t1 VALUES ('a.'); +INSERT INTO t1 VALUES ('A-1'); +INSERT INTO t1 VALUES ('aa'); +INSERT INTO t1 VALUES ('AA'); +INSERT INTO t1 VALUES ('A.A.'); +INSERT INTO t1 VALUES ('a.a.'); +INSERT INTO t1 VALUES ('AAA'); +INSERT INTO t1 VALUES ('A.A.A.'); +INSERT INTO t1 VALUES ('AAAA'); +INSERT INTO t1 VALUES ('A.A.A.L.'); +INSERT INTO t1 VALUES ('A.A.A.S.'); +INSERT INTO t1 VALUES ('Aachen'); +INSERT INTO t1 VALUES ('A.A.E.'); +INSERT INTO t1 VALUES ('A.Ae.E.'); +INSERT INTO t1 VALUES ('A.A.E.E.'); +INSERT INTO t1 VALUES ('AAES'); +INSERT INTO t1 VALUES ('AAF'); +INSERT INTO t1 VALUES ('A.Agr'); +INSERT INTO t1 VALUES ('aah'); +INSERT INTO t1 VALUES ('@@@@@'); +INSERT INTO t1 VALUES ('0000'); +INSERT INTO t1 VALUES ('9999'); +INSERT INTO t1 VALUES ('Aalborg'); +INSERT INTO t1 VALUES ('aide'); +INSERT INTO t1 VALUES ('air'); +INSERT INTO t1 VALUES ('@@@air'); +INSERT INTO t1 VALUES ('air@@@'); +INSERT INTO t1 VALUES ('C.A.F'); +INSERT INTO t1 VALUES ('Canon'); +INSERT INTO t1 VALUES ('coop'); +INSERT INTO t1 VALUES ('co-op'); +INSERT INTO t1 VALUES ('COOP'); +INSERT INTO t1 VALUES ('CO-OP'); +INSERT INTO t1 VALUES ('Copenhegen'); +INSERT INTO t1 VALUES ('McArthur'); +INSERT INTO t1 VALUES ('Mc Arthur'); +INSERT INTO t1 VALUES ('Mc Mahon'); +INSERT INTO t1 VALUES ('vice-president'); +INSERT INTO t1 VALUES ('vice versa'); +INSERT INTO t1 VALUES ('vice-versa'); +INSERT INTO t1 VALUES ('10 ลิตร'); +INSERT INTO t1 VALUES ('๑๐ ลิตร'); +INSERT INTO t1 VALUES ('10 litre'); +INSERT INTO t1 VALUES ('10 litre (10 ลิตร)'); +INSERT INTO t1 VALUES ('10 ลิตร (10 litre)'); +INSERT INTO t1 VALUES ('10 litre (๑๐ ลิตร)'); +INSERT INTO t1 VALUES ('๑๐ ลิตร (10 litre)'); +INSERT INTO t1 VALUES ('๑๐ ลิตร [10 litre]'); +INSERT INTO t1 VALUES ('๑๐ ลิตร {10 litre}'); +ALTER TABLE t1 ORDER BY a; +SET @backup_character_set_connection=@@character_set_connection; +SET @backup_collation_connection=@@collation_connection; +SET NAMES utf8; +SET @stmt= CONCAT('ALTER TABLE t1 MODIFY a VARCHAR(30)', +' CHARACTER SET ', @backup_character_set_connection, +' COLLATE ', @backup_collation_connection, +' , ADD id INT NOT NULL AUTO_INCREMENT PRIMARY KEY' + ' , ADD KEY a_id (a, id)'); +PREPARE stmt FROM @stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +SET collation_connection=@backup_collation_connection; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(30) CHARACTER SET utf8 COLLATE utf8_thai_520_w2 DEFAULT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`), + KEY `a_id` (`a`,`id`) +) ENGINE=MyISAM AUTO_INCREMENT=97 DEFAULT CHARSET=latin1 +# +# Ascending sort, using filesort +# +EXPLAIN SELECT a FROM t1 ORDER BY a, BINARY a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a_id 97 NULL 96 Using index; Using filesort +SELECT a FROM t1 ORDER BY a, BINARY a; +a +-a +-กระแย่ง +@@@@@ +@@@air +0000 +10 litre +10 litre (10 ลิตร) +10 litre (๑๐ ลิตร) +10 ลิตร +๑๐ ลิตร +10 ลิตร (10 litre) +๑๐ ลิตร (10 litre) +๑๐ ลิตร [10 litre] +๑๐ ลิตร {10 litre} +9999 +A +a +A- +a- +A-1 +A. +a. +A.A. +a.a. +A.A.A. +A.A.A.L. +A.A.A.S. +A.A.E. +A.A.E.E. +A.Ae.E. +A.Agr +a' +AA +aa +AAA +AAAA +Aachen +AAES +AAF +aah +Aalborg +aide +air +air@@@ +C.A.F +Canon +CO-OP +co-op +COOP +coop +Copenhegen +Mc Arthur +Mc Mahon +McArthur +vice versa +vice-president +vice-versa +กก +กราบ +ขาง +ข่าง +ข้าง +ข้างๆ +ข้างๆ คูๆ +ข้างกระดาน +ข้างขึ้น +ข้างควาย +ข้างเงิน +ข้างแรม +ข้างออก +แข็ง +แข่ง +แข้ง +แข้งขวา +แข็งขัน +แข่งขัน +ทูลเกล้า +ทูลเกล้าทูลกระหม่อม +ทูลเกล้าฯ +บุญ-หลง +บุญญา +บุญหลง +ปา +ป่า +ป้า +ป๊า +ป๋า +ปาน +ป่าน +ป้าน +ป๊าน +ป๋าน +แป้ง +พณิชย์ +ม้า +ฯพณฯ +# +# Descending sort, using filesort +# +EXPLAIN SELECT a FROM t1 ORDER BY a DESC, BINARY a DESC; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a_id 97 NULL 96 Using index; Using filesort +SELECT a FROM t1 ORDER BY a DESC, BINARY a DESC; +a +ฯพณฯ +ม้า +พณิชย์ +แป้ง +ป๋าน +ป๊าน +ป้าน +ป่าน +ปาน +ป๋า +ป๊า +ป้า +ป่า +ปา +บุญหลง +บุญญา +บุญ-หลง +ทูลเกล้าฯ +ทูลเกล้าทูลกระหม่อม +ทูลเกล้า +แข่งขัน +แข็งขัน +แข้งขวา +แข้ง +แข่ง +แข็ง +ข้างออก +ข้างแรม +ข้างเงิน +ข้างควาย +ข้างขึ้น +ข้างกระดาน +ข้างๆ คูๆ +ข้างๆ +ข้าง +ข่าง +ขาง +กราบ +กก +vice-versa +vice-president +vice versa +McArthur +Mc Mahon +Mc Arthur +Copenhegen +coop +COOP +co-op +CO-OP +Canon +C.A.F +air@@@ +air +aide +Aalborg +aah +AAF +AAES +Aachen +AAAA +AAA +aa +AA +a' +A.Agr +A.Ae.E. +A.A.E.E. +A.A.E. +A.A.A.S. +A.A.A.L. +A.A.A. +a.a. +A.A. +a. +A. +A-1 +a- +A- +a +A +9999 +๑๐ ลิตร {10 litre} +๑๐ ลิตร [10 litre] +๑๐ ลิตร (10 litre) +10 ลิตร (10 litre) +๑๐ ลิตร +10 ลิตร +10 litre (๑๐ ลิตร) +10 litre (10 ลิตร) +10 litre +0000 +@@@air +@@@@@ +-กระแย่ง +-a +# +# Ascending sort, using index +# +EXPLAIN SELECT a FROM t1 ORDER BY a, id; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a_id 97 NULL 96 Using index +SELECT a FROM t1 ORDER BY a, id; +a +-a +-กระแย่ง +@@@@@ +@@@air +0000 +10 litre +10 litre (10 ลิตร) +10 litre (๑๐ ลิตร) +10 ลิตร +๑๐ ลิตร +10 ลิตร (10 litre) +๑๐ ลิตร (10 litre) +๑๐ ลิตร [10 litre] +๑๐ ลิตร {10 litre} +9999 +A +a +A- +a- +A-1 +A. +a. +A.A. +a.a. +A.A.A. +A.A.A.L. +A.A.A.S. +A.A.E. +A.A.E.E. +A.Ae.E. +A.Agr +a' +AA +aa +AAA +AAAA +Aachen +AAES +AAF +aah +Aalborg +aide +air +air@@@ +C.A.F +Canon +CO-OP +co-op +COOP +coop +Copenhegen +Mc Arthur +Mc Mahon +McArthur +vice versa +vice-president +vice-versa +กก +กราบ +ขาง +ข่าง +ข้าง +ข้างๆ +ข้างๆ คูๆ +ข้างกระดาน +ข้างขึ้น +ข้างควาย +ข้างเงิน +ข้างแรม +ข้างออก +แข็ง +แข่ง +แข้ง +แข้งขวา +แข็งขัน +แข่งขัน +ทูลเกล้า +ทูลเกล้าทูลกระหม่อม +ทูลเกล้าฯ +บุญ-หลง +บุญญา +บุญหลง +ปา +ป่า +ป้า +ป๊า +ป๋า +ปาน +ป่าน +ป้าน +ป๊าน +ป๋าน +แป้ง +พณิชย์ +ม้า +ฯพณฯ +# +# Descending sort, using index +# +EXPLAIN SELECT a FROM t1 ORDER BY a DESC, id DESC; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a_id 97 NULL 96 Using index +SELECT a FROM t1 ORDER BY a DESC, id DESC; +a +ฯพณฯ +ม้า +พณิชย์ +แป้ง +ป๋าน +ป๊าน +ป้าน +ป่าน +ปาน +ป๋า +ป๊า +ป้า +ป่า +ปา +บุญหลง +บุญญา +บุญ-หลง +ทูลเกล้าฯ +ทูลเกล้าทูลกระหม่อม +ทูลเกล้า +แข่งขัน +แข็งขัน +แข้งขวา +แข้ง +แข่ง +แข็ง +ข้างออก +ข้างแรม +ข้างเงิน +ข้างควาย +ข้างขึ้น +ข้างกระดาน +ข้างๆ คูๆ +ข้างๆ +ข้าง +ข่าง +ขาง +กราบ +กก +vice-versa +vice-president +vice versa +McArthur +Mc Mahon +Mc Arthur +Copenhegen +coop +COOP +co-op +CO-OP +Canon +C.A.F +air@@@ +air +aide +Aalborg +aah +AAF +AAES +Aachen +AAAA +AAA +aa +AA +a' +A.Agr +A.Ae.E. +A.A.E.E. +A.A.E. +A.A.A.S. +A.A.A.L. +A.A.A. +a.a. +A.A. +a. +A. +A-1 +a- +A- +a +A +9999 +๑๐ ลิตร {10 litre} +๑๐ ลิตร [10 litre] +๑๐ ลิตร (10 litre) +10 ลิตร (10 litre) +๑๐ ลิตร +10 ลิตร +10 litre (๑๐ ลิตร) +10 litre (10 ลิตร) +10 litre +0000 +@@@air +@@@@@ +-กระแย่ง +-a +DROP TABLE t1; +# +# End of ctype_thai.inc +# +SET NAMES utf8; +SET collation_connection=ucs2_thai_520_w2; +# +# Start of ctype_uca_w2.inc +# +SELECT @@collation_connection; +@@collation_connection +ucs2_thai_520_w2 +SELECT ID, SORTLEN, COLLATION_NAME, CHARACTER_SET_NAME +FROM INFORMATION_SCHEMA.COLLATIONS +WHERE COLLATION_NAME LIKE @@collation_connection; +ID SORTLEN COLLATION_NAME CHARACTER_SET_NAME +642 4 ucs2_thai_520_w2 ucs2 +# +# Testing strnxfrm +# +CREATE TABLE t1 AS SELECT SPACE(3) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(3) CHARACTER SET ucs2 COLLATE ucs2_thai_520_w2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (SPACE(0)),(SPACE(1)),(SPACE(2)); +SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(8))) FROM t1; +HEX(a) HEX(WEIGHT_STRING(a AS CHAR(8))) + 020A020A020A020A020A020A020A020A00200020002000200020002000200020 +0020 020A020A020A020A020A020A020A020A00200020002000200020002000200020 +00200020 020A020A020A020A020A020A020A020A00200020002000200020002000200020 +SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4))) FROM t1; +HEX(a) HEX(WEIGHT_STRING(a AS CHAR(4))) + 020A020A020A020A0020002000200020 +0020 020A020A020A020A0020002000200020 +00200020 020A020A020A020A0020002000200020 +SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 1)) FROM t1; +HEX(a) HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 1)) + 020A020A020A020A +0020 020A020A020A020A +00200020 020A020A020A020A +SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 2)) FROM t1; +HEX(a) HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 2)) + 0020002000200020 +0020 0020002000200020 +00200020 0020002000200020 +SELECT HEX(a), HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 3)) FROM t1; +HEX(a) HEX(WEIGHT_STRING(a AS CHAR(4) LEVEL 3)) + 0020002000200020 +0020 0020002000200020 +00200020 0020002000200020 +DROP TABLE t1; +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_thai_520_w2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (_ucs2 0x3400); +INSERT INTO t1 VALUES (_ucs2 0xF001); +SELECT HEX(CONVERT(a USING ucs2)) AS ucs2, HEX(a), HEX(WEIGHT_STRING(a)) FROM t1; +ucs2 HEX(a) HEX(WEIGHT_STRING(a)) +3400 3400 FB80B4000020 +F001 F001 FBC1F0010020 +DROP TABLE t1; +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_thai_520_w2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('A'),('À'),('Á'),('Â'),('Ã'),('Ä'),('Å'); +SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a; +a HEX(WEIGHT_STRING(a LEVEL 2)) +A 0020 +Á 00200032 +À 00200035 + 0020003C +Å 00200043 +Ä 00200047 +à 0020004E +SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a DESC; +a HEX(WEIGHT_STRING(a LEVEL 2)) +à 0020004E +Ä 00200047 +Å 00200043 + 0020003C +À 00200035 +Á 00200032 +A 0020 +SET @backup_character_set_connection=@@character_set_connection; +SET @backup_collation_connection=@@collation_connection; +SET NAMES utf8; +SET @stmt= CONCAT('ALTER TABLE t1 MODIFY a CHAR(10)' COLLATE utf8_bin, +' CHARACTER SET ', @backup_character_set_connection, +' COLLATE ', @backup_collation_connection); +PREPARE stmt FROM @stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +SET collation_connection=@backup_collation_connection; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(10) CHARACTER SET ucs2 COLLATE ucs2_thai_520_w2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a; +a HEX(WEIGHT_STRING(a LEVEL 2)) +A 0020 +Á 00200032 +À 00200035 + 0020003C +Å 00200043 +Ä 00200047 +à 0020004E +SELECT a, HEX(WEIGHT_STRING(a LEVEL 2)) FROM t1 ORDER BY a DESC; +a HEX(WEIGHT_STRING(a LEVEL 2)) +à 0020004E +Ä 00200047 +Å 00200043 + 0020003C +À 00200035 +Á 00200032 +A 0020 +DROP TABLE t1; +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_thai_520_w2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('cota'),('cote'),('cotz'); +INSERT INTO t1 VALUES ('coté'),('côte'),('côté'),('cotë'),('côtë'); +SELECT * FROM t1 ORDER BY a; +a +cota +cote +coté +cotë +côte +côté +côtë +cotz +SELECT * FROM t1 ORDER BY a DESC; +a +cotz +côtë +côté +côte +cotë +coté +cote +cota +DROP TABLE t1; +# +# End of ctype_uca_w2.inc +# +# +# Start of ctype_thai.inc +# +CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_bin); +INSERT INTO t1 VALUES ('-กระแย่ง'); +INSERT INTO t1 VALUES ('กก'); +INSERT INTO t1 VALUES ('กราบ'); +INSERT INTO t1 VALUES ('ข่าง'); +INSERT INTO t1 VALUES ('ข้าง'); +INSERT INTO t1 VALUES ('ข้างกระดาน'); +INSERT INTO t1 VALUES ('ข้างขึ้น'); +INSERT INTO t1 VALUES ('ข้างควาย'); +INSERT INTO t1 VALUES ('ข้างเงิน'); +INSERT INTO t1 VALUES ('ข้างแรม'); +INSERT INTO t1 VALUES ('ข้างออก'); +INSERT INTO t1 VALUES ('ข้างๆ'); +INSERT INTO t1 VALUES ('ข้างๆ คูๆ'); +INSERT INTO t1 VALUES ('ขาง'); +INSERT INTO t1 VALUES ('แข็ง'); +INSERT INTO t1 VALUES ('แข่ง'); +INSERT INTO t1 VALUES ('แข่งขัน'); +INSERT INTO t1 VALUES ('แข้ง'); +INSERT INTO t1 VALUES ('แข้งขวา'); +INSERT INTO t1 VALUES ('แข็งขัน'); +INSERT INTO t1 VALUES ('ทูลเกล้า'); +INSERT INTO t1 VALUES ('ทูลเกล้าทูลกระหม่อม'); +INSERT INTO t1 VALUES ('ทูลเกล้าฯ'); +INSERT INTO t1 VALUES ('บุญญา'); +INSERT INTO t1 VALUES ('บุญ-หลง'); +INSERT INTO t1 VALUES ('บุญหลง'); +INSERT INTO t1 VALUES ('ป่า'); +INSERT INTO t1 VALUES ('ป่าน'); +INSERT INTO t1 VALUES ('ป้า'); +INSERT INTO t1 VALUES ('ป้าน'); +INSERT INTO t1 VALUES ('ป๊า'); +INSERT INTO t1 VALUES ('ป๊าน'); +INSERT INTO t1 VALUES ('ป๋า'); +INSERT INTO t1 VALUES ('ป๋าน'); +INSERT INTO t1 VALUES ('ปา'); +INSERT INTO t1 VALUES ('ปาน'); +INSERT INTO t1 VALUES ('แป้ง'); +INSERT INTO t1 VALUES ('พณิชย์'); +INSERT INTO t1 VALUES ('ม้า'); +INSERT INTO t1 VALUES ('ฯพณฯ'); +INSERT INTO t1 VALUES ('A'); +INSERT INTO t1 VALUES ('a'); +INSERT INTO t1 VALUES ('a\''); +INSERT INTO t1 VALUES ('A-'); +INSERT INTO t1 VALUES ('a-'); +INSERT INTO t1 VALUES ('-a'); +INSERT INTO t1 VALUES ('A.'); +INSERT INTO t1 VALUES ('a.'); +INSERT INTO t1 VALUES ('A-1'); +INSERT INTO t1 VALUES ('aa'); +INSERT INTO t1 VALUES ('AA'); +INSERT INTO t1 VALUES ('A.A.'); +INSERT INTO t1 VALUES ('a.a.'); +INSERT INTO t1 VALUES ('AAA'); +INSERT INTO t1 VALUES ('A.A.A.'); +INSERT INTO t1 VALUES ('AAAA'); +INSERT INTO t1 VALUES ('A.A.A.L.'); +INSERT INTO t1 VALUES ('A.A.A.S.'); +INSERT INTO t1 VALUES ('Aachen'); +INSERT INTO t1 VALUES ('A.A.E.'); +INSERT INTO t1 VALUES ('A.Ae.E.'); +INSERT INTO t1 VALUES ('A.A.E.E.'); +INSERT INTO t1 VALUES ('AAES'); +INSERT INTO t1 VALUES ('AAF'); +INSERT INTO t1 VALUES ('A.Agr'); +INSERT INTO t1 VALUES ('aah'); +INSERT INTO t1 VALUES ('@@@@@'); +INSERT INTO t1 VALUES ('0000'); +INSERT INTO t1 VALUES ('9999'); +INSERT INTO t1 VALUES ('Aalborg'); +INSERT INTO t1 VALUES ('aide'); +INSERT INTO t1 VALUES ('air'); +INSERT INTO t1 VALUES ('@@@air'); +INSERT INTO t1 VALUES ('air@@@'); +INSERT INTO t1 VALUES ('C.A.F'); +INSERT INTO t1 VALUES ('Canon'); +INSERT INTO t1 VALUES ('coop'); +INSERT INTO t1 VALUES ('co-op'); +INSERT INTO t1 VALUES ('COOP'); +INSERT INTO t1 VALUES ('CO-OP'); +INSERT INTO t1 VALUES ('Copenhegen'); +INSERT INTO t1 VALUES ('McArthur'); +INSERT INTO t1 VALUES ('Mc Arthur'); +INSERT INTO t1 VALUES ('Mc Mahon'); +INSERT INTO t1 VALUES ('vice-president'); +INSERT INTO t1 VALUES ('vice versa'); +INSERT INTO t1 VALUES ('vice-versa'); +INSERT INTO t1 VALUES ('10 ลิตร'); +INSERT INTO t1 VALUES ('๑๐ ลิตร'); +INSERT INTO t1 VALUES ('10 litre'); +INSERT INTO t1 VALUES ('10 litre (10 ลิตร)'); +INSERT INTO t1 VALUES ('10 ลิตร (10 litre)'); +INSERT INTO t1 VALUES ('10 litre (๑๐ ลิตร)'); +INSERT INTO t1 VALUES ('๑๐ ลิตร (10 litre)'); +INSERT INTO t1 VALUES ('๑๐ ลิตร [10 litre]'); +INSERT INTO t1 VALUES ('๑๐ ลิตร {10 litre}'); +ALTER TABLE t1 ORDER BY a; +SET @backup_character_set_connection=@@character_set_connection; +SET @backup_collation_connection=@@collation_connection; +SET NAMES utf8; +SET @stmt= CONCAT('ALTER TABLE t1 MODIFY a VARCHAR(30)', +' CHARACTER SET ', @backup_character_set_connection, +' COLLATE ', @backup_collation_connection, +' , ADD id INT NOT NULL AUTO_INCREMENT PRIMARY KEY' + ' , ADD KEY a_id (a, id)'); +PREPARE stmt FROM @stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +SET collation_connection=@backup_collation_connection; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(30) CHARACTER SET ucs2 COLLATE ucs2_thai_520_w2 DEFAULT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`), + KEY `a_id` (`a`,`id`) +) ENGINE=MyISAM AUTO_INCREMENT=97 DEFAULT CHARSET=latin1 +# +# Ascending sort, using filesort +# +EXPLAIN SELECT a FROM t1 ORDER BY a, BINARY a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a_id 67 NULL 96 Using index; Using filesort +SELECT a FROM t1 ORDER BY a, BINARY a; +a +-a +-กระแย่ง +@@@@@ +@@@air +0000 +10 litre +10 litre (10 ลิตร) +10 litre (๑๐ ลิตร) +10 ลิตร +๑๐ ลิตร +10 ลิตร (10 litre) +๑๐ ลิตร (10 litre) +๑๐ ลิตร [10 litre] +๑๐ ลิตร {10 litre} +9999 +A +a +A- +a- +A-1 +A. +a. +A.A. +a.a. +A.A.A. +A.A.A.L. +A.A.A.S. +A.A.E. +A.A.E.E. +A.Ae.E. +A.Agr +a' +AA +aa +AAA +AAAA +Aachen +AAES +AAF +aah +Aalborg +aide +air +air@@@ +C.A.F +Canon +CO-OP +co-op +COOP +coop +Copenhegen +Mc Arthur +Mc Mahon +McArthur +vice versa +vice-president +vice-versa +กก +กราบ +ขาง +ข่าง +ข้าง +ข้างๆ +ข้างๆ คูๆ +ข้างกระดาน +ข้างขึ้น +ข้างควาย +ข้างเงิน +ข้างแรม +ข้างออก +แข็ง +แข่ง +แข้ง +แข้งขวา +แข็งขัน +แข่งขัน +ทูลเกล้า +ทูลเกล้าทูลกระหม่อม +ทูลเกล้าฯ +บุญ-หลง +บุญญา +บุญหลง +ปา +ป่า +ป้า +ป๊า +ป๋า +ปาน +ป่าน +ป้าน +ป๊าน +ป๋าน +แป้ง +พณิชย์ +ม้า +ฯพณฯ +# +# Descending sort, using filesort +# +EXPLAIN SELECT a FROM t1 ORDER BY a DESC, BINARY a DESC; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a_id 67 NULL 96 Using index; Using filesort +SELECT a FROM t1 ORDER BY a DESC, BINARY a DESC; +a +ฯพณฯ +ม้า +พณิชย์ +แป้ง +ป๋าน +ป๊าน +ป้าน +ป่าน +ปาน +ป๋า +ป๊า +ป้า +ป่า +ปา +บุญหลง +บุญญา +บุญ-หลง +ทูลเกล้าฯ +ทูลเกล้าทูลกระหม่อม +ทูลเกล้า +แข่งขัน +แข็งขัน +แข้งขวา +แข้ง +แข่ง +แข็ง +ข้างออก +ข้างแรม +ข้างเงิน +ข้างควาย +ข้างขึ้น +ข้างกระดาน +ข้างๆ คูๆ +ข้างๆ +ข้าง +ข่าง +ขาง +กราบ +กก +vice-versa +vice-president +vice versa +McArthur +Mc Mahon +Mc Arthur +Copenhegen +coop +COOP +co-op +CO-OP +Canon +C.A.F +air@@@ +air +aide +Aalborg +aah +AAF +AAES +Aachen +AAAA +AAA +aa +AA +a' +A.Agr +A.Ae.E. +A.A.E.E. +A.A.E. +A.A.A.S. +A.A.A.L. +A.A.A. +a.a. +A.A. +a. +A. +A-1 +a- +A- +a +A +9999 +๑๐ ลิตร {10 litre} +๑๐ ลิตร [10 litre] +๑๐ ลิตร (10 litre) +10 ลิตร (10 litre) +๑๐ ลิตร +10 ลิตร +10 litre (๑๐ ลิตร) +10 litre (10 ลิตร) +10 litre +0000 +@@@air +@@@@@ +-กระแย่ง +-a +# +# Ascending sort, using index +# +EXPLAIN SELECT a FROM t1 ORDER BY a, id; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a_id 67 NULL 96 Using index +SELECT a FROM t1 ORDER BY a, id; +a +-a +-กระแย่ง +@@@@@ +@@@air +0000 +10 litre +10 litre (10 ลิตร) +10 litre (๑๐ ลิตร) +10 ลิตร +๑๐ ลิตร +10 ลิตร (10 litre) +๑๐ ลิตร (10 litre) +๑๐ ลิตร [10 litre] +๑๐ ลิตร {10 litre} +9999 +A +a +A- +a- +A-1 +A. +a. +A.A. +a.a. +A.A.A. +A.A.A.L. +A.A.A.S. +A.A.E. +A.A.E.E. +A.Ae.E. +A.Agr +a' +AA +aa +AAA +AAAA +Aachen +AAES +AAF +aah +Aalborg +aide +air +air@@@ +C.A.F +Canon +CO-OP +co-op +COOP +coop +Copenhegen +Mc Arthur +Mc Mahon +McArthur +vice versa +vice-president +vice-versa +กก +กราบ +ขาง +ข่าง +ข้าง +ข้างๆ +ข้างๆ คูๆ +ข้างกระดาน +ข้างขึ้น +ข้างควาย +ข้างเงิน +ข้างแรม +ข้างออก +แข็ง +แข่ง +แข้ง +แข้งขวา +แข็งขัน +แข่งขัน +ทูลเกล้า +ทูลเกล้าทูลกระหม่อม +ทูลเกล้าฯ +บุญ-หลง +บุญญา +บุญหลง +ปา +ป่า +ป้า +ป๊า +ป๋า +ปาน +ป่าน +ป้าน +ป๊าน +ป๋าน +แป้ง +พณิชย์ +ม้า +ฯพณฯ +# +# Descending sort, using index +# +EXPLAIN SELECT a FROM t1 ORDER BY a DESC, id DESC; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a_id 67 NULL 96 Using index +SELECT a FROM t1 ORDER BY a DESC, id DESC; +a +ฯพณฯ +ม้า +พณิชย์ +แป้ง +ป๋าน +ป๊าน +ป้าน +ป่าน +ปาน +ป๋า +ป๊า +ป้า +ป่า +ปา +บุญหลง +บุญญา +บุญ-หลง +ทูลเกล้าฯ +ทูลเกล้าทูลกระหม่อม +ทูลเกล้า +แข่งขัน +แข็งขัน +แข้งขวา +แข้ง +แข่ง +แข็ง +ข้างออก +ข้างแรม +ข้างเงิน +ข้างควาย +ข้างขึ้น +ข้างกระดาน +ข้างๆ คูๆ +ข้างๆ +ข้าง +ข่าง +ขาง +กราบ +กก +vice-versa +vice-president +vice versa +McArthur +Mc Mahon +Mc Arthur +Copenhegen +coop +COOP +co-op +CO-OP +Canon +C.A.F +air@@@ +air +aide +Aalborg +aah +AAF +AAES +Aachen +AAAA +AAA +aa +AA +a' +A.Agr +A.Ae.E. +A.A.E.E. +A.A.E. +A.A.A.S. +A.A.A.L. +A.A.A. +a.a. +A.A. +a. +A. +A-1 +a- +A- +a +A +9999 +๑๐ ลิตร {10 litre} +๑๐ ลิตร [10 litre] +๑๐ ลิตร (10 litre) +10 ลิตร (10 litre) +๑๐ ลิตร +10 ลิตร +10 litre (๑๐ ลิตร) +10 litre (10 ลิตร) +10 litre +0000 +@@@air +@@@@@ +-กระแย่ง +-a +DROP TABLE t1; +# +# End of ctype_thai.inc +# +# +# End of MariaDB-10.1 tests +# +# +# Start of MariaDB-10.2 tests +# +# +# MDEV-9407 Illegal mix of collation when using GROUP_CONCAT in a VIEW +# +SET NAMES utf8; +CREATE TABLE t1 (col1 VARCHAR(12) CHARACTER SET utf8 COLLATE utf8_unicode_ci); +INSERT INTO t1 VALUES ('a'),('b'); +CREATE VIEW v1 AS SELECT group_concat('f') AS col1; +SELECT col1 FROM v1 UNION SELECT col1 FROM t1; +col1 +f +a +b +DROP VIEW v1; +DROP TABLE t1; +# +# End of MariaDB-10.2 tests +# diff --cc mysql-test/main/ctype_ucs.result index dee9da3ce87,00000000000..9d88ba93153 mode 100644,000000..100644 --- a/mysql-test/main/ctype_ucs.result +++ b/mysql-test/main/ctype_ucs.result @@@ -1,6381 -1,0 +1,6393 @@@ +DROP TABLE IF EXISTS t1; +SET @test_character_set= 'ucs2'; +SET @test_collation= 'ucs2_general_ci'; +SET @safe_character_set_server= @@character_set_server; +SET @safe_collation_server= @@collation_server; +SET @safe_character_set_client= @@character_set_client; +SET @safe_character_set_results= @@character_set_results; +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) ucs2_general_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) ucs2_general_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; +create table t1 (a set('a') not null); +insert ignore into t1 values (),(); +Warnings: +Warning 1364 Field 'a' doesn't have a default value +select cast(a as char(1)) from t1; +cast(a as char(1)) + + +select a sounds like a from t1; +a sounds like a +1 +1 +select 1 from t1 order by cast(a as char(1)); +1 +1 +1 +drop table t1; +# +# MDEV-6134 SUBSTRING_INDEX returns wrong result for 8bit character sets when delimiter is not found +# +SET character_set_client=latin1; +SET character_set_connection= @test_character_set; +SET collation_connection= @test_collation; +SELECT COLLATION('.'), SUBSTRING_INDEX('.wwwmysqlcom', '.', -2) AS c1; +COLLATION('.') c1 +ucs2_general_ci .wwwmysqlcom +set names utf8; +create table t1 ( +name varchar(10), +level smallint unsigned); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `name` varchar(10) DEFAULT NULL, + `level` smallint(5) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +insert into t1 values ('string',1); +select concat(name,space(level)), concat(name, repeat(' ',level)) from t1; +concat(name,space(level)) concat(name, repeat(' ',level)) +string string +drop table t1; +DROP DATABASE d1; +USE test; +SET character_set_server= @safe_character_set_server; +SET collation_server= @safe_collation_server; +SET character_set_client= @safe_character_set_client; +SET character_set_results= @safe_character_set_results; +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 (a varchar(2) character set ucs2 collate ucs2_bin, key(a)); +insert into t1 values ('A'),('A'),('B'),('C'),('D'),('A\t'); +insert into t1 values ('A\0'),('A\0'),('A\0'),('A\0'),('AZ'); +select hex(a) from t1 where a like 'A_' order by a; +hex(a) +00410000 +00410000 +00410000 +00410000 +00410009 +0041005A +select hex(a) from t1 ignore key(a) where a like 'A_' order by a; +hex(a) +00410000 +00410000 +00410000 +00410000 +00410009 +0041005A +drop table t1; +CREATE TABLE t1 (word VARCHAR(64) CHARACTER SET ucs2, word2 CHAR(64) CHARACTER SET ucs2); +INSERT INTO t1 VALUES (_koi8r'�',_koi8r'�'), (X'2004',X'2004'); +SELECT hex(word) FROM t1 ORDER BY word; +hex(word) +0420 +2004 +SELECT hex(word2) FROM t1 ORDER BY word2; +hex(word2) +0420 +2004 +DELETE FROM t1; +INSERT INTO t1 VALUES (X'042000200020',X'042000200020'), (X'200400200020', X'200400200020'); +SELECT hex(word) FROM t1 ORDER BY word; +hex(word) +042000200020 +200400200020 +SELECT hex(word2) FROM t1 ORDER BY word2; +hex(word2) +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` varchar(10) CHARACTER SET ucs2 DEFAULT NULL, + `r` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# Bug #51876 : crash/memory underrun when loading data with ucs2 +# and reverse() function +# +# Problem # 1 (original report): wrong parsing of ucs2 data +SET character_set_connection=ucs2; +SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt'; +CREATE TABLE t1(a INT); +LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 +(@b) SET a=REVERSE(@b); +# should return 2 zeroes (as the value is truncated) +SELECT * FROM t1; +a +0 +1 +DROP TABLE t1; +# Problem # 2 : if you write and read ucs2 data to a file they're lost +SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2; +CREATE TABLE t1(a INT); +LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2 +(@b) SET a=REVERSE(@b); +# should return 0 and 1 (10 reversed) +SELECT * FROM t1; +a +0 +1 +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; +select @@collation_connection; +@@collation_connection +ucs2_general_ci +create table t1 as select repeat(' ',10) as a union select null; +alter table t1 add key(a); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET ucs2 DEFAULT NULL, + KEY `a` (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +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 23 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 23 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 130 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 130 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 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; +SET collation_connection='ucs2_general_ci'; +create table t1 select repeat('a',4000) a; +delete from t1; +insert into t1 values ('a'), ('a '), ('a\t'); +select collation(a),hex(a) from t1 order by a; +collation(a) hex(a) +ucs2_general_ci 00610009 +ucs2_general_ci 0061 +ucs2_general_ci 00610020 +drop table t1; +# +# MDEV-5453 Assertion `src' fails in my_strnxfrm_unicode on GROUP BY MID(..) WITH ROLLUP +# +SELECT @@collation_connection; +@@collation_connection +ucs2_general_ci +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +SELECT * FROM t1 GROUP BY MID(CURRENT_USER,0) WITH ROLLUP; +i +1 +1 +SELECT * FROM t1 GROUP BY MID('test',0) WITH ROLLUP; +i +1 +1 +DROP TABLE t1; +# +# MDEV-6170 Incorrect ordering with utf8_bin and utf8mb4_bin collations +# +SELECT @@collation_connection; +@@collation_connection +ucs2_general_ci +CREATE TABLE t1 ENGINE=MEMORY AS SELECT REPEAT('a',5) AS a LIMIT 0; +INSERT INTO t1 (a) VALUES ("a"); +INSERT INTO t1 (a) VALUES ("b"); +INSERT INTO t1 (a) VALUES ("c"); +INSERT INTO t1 (a) VALUES ("d"); +INSERT INTO t1 (a) VALUES ("e"); +INSERT INTO t1 (a) VALUES ("f"); +INSERT INTO t1 (a) VALUES ("g"); +INSERT INTO t1 (a) VALUES ("h"); +INSERT INTO t1 (a) VALUES ("i"); +INSERT INTO t1 (a) VALUES ("j"); +INSERT INTO t1 (a) VALUES ("k"); +INSERT INTO t1 (a) VALUES ("l"); +INSERT INTO t1 (a) VALUES ("m"); +SELECT * FROM t1 ORDER BY LOWER(a); +a +a +b +c +d +e +f +g +h +i +j +k +l +m +SELECT * FROM t1 ORDER BY LOWER(a) DESC; +a +m +l +k +j +i +h +g +f +e +d +c +b +a +DROP TABLE t1; +select @@collation_connection; +@@collation_connection +ucs2_general_ci +create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ; +insert into t1 values('abcdef'); +insert into t1 values('_bcdef'); +insert into t1 values('a_cdef'); +insert into t1 values('ab_def'); +insert into t1 values('abc_ef'); +insert into t1 values('abcd_f'); +insert into t1 values('abcde_'); +select c1 as c1u from t1 where c1 like 'ab\_def'; +c1u +ab_def +select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; +c2h +ab_def +drop table t1; ++SELECT @@collation_connection; ++@@collation_connection ++ucs2_general_ci ++SELECT '\%b' LIKE '%\%'; ++'\%b' LIKE '%\%' ++0 +"BEGIN ctype_german.inc" +drop table if exists t1; +create table t1 as select repeat(' ', 64) as s1; +select collation(s1) from t1; +collation(s1) +ucs2_general_ci +delete from t1; +INSERT INTO t1 VALUES ('ud'),('uf'); +INSERT INTO t1 VALUES ('od'),('of'); +INSERT INTO t1 VALUES ('e'); +INSERT INTO t1 VALUES ('ad'),('af'); +insert into t1 values ('a'),('ae'),(_latin1 0xE4); +insert into t1 values ('o'),('oe'),(_latin1 0xF6); +insert into t1 values ('s'),('ss'),(_latin1 0xDF); +insert into t1 values ('u'),('ue'),(_latin1 0xFC); +INSERT INTO t1 VALUES (_latin1 0xE6), (_latin1 0xC6); +INSERT INTO t1 VALUES (_latin1 0x9C), (_latin1 0x8C); +select s1, hex(s1) from t1 order by s1, binary s1; +s1 hex(s1) +a 0061 +� 00E4 +ad 00610064 +ae 00610065 +af 00610066 +e 0065 +o 006F +� 00F6 +od 006F0064 +oe 006F0065 +of 006F0066 +s 0073 +� 00DF +ss 00730073 +u 0075 +� 00FC +ud 00750064 +ue 00750065 +uf 00750066 +� 00C6 +� 00E6 +� 0152 +� 0153 +select group_concat(s1 order by binary s1) from t1 group by s1; +group_concat(s1 order by binary s1) +a,� +ad +ae +af +e +o,� +od +oe +of +s,� +ss +u,� +ud +ue +uf +�,� +�,� +SELECT s1, hex(s1), hex(weight_string(s1)) FROM t1 ORDER BY s1, BINARY(s1); +s1 hex(s1) hex(weight_string(s1)) +a 0061 0041 +� 00E4 0041 +ad 00610064 00410044 +ae 00610065 00410045 +af 00610066 00410046 +e 0065 0045 +o 006F 004F +� 00F6 004F +od 006F0064 004F0044 +oe 006F0065 004F0045 +of 006F0066 004F0046 +s 0073 0053 +� 00DF 0053 +ss 00730073 00530053 +u 0075 0055 +� 00FC 0055 +ud 00750064 00550044 +ue 00750065 00550045 +uf 00750066 00550046 +� 00C6 00C6 +� 00E6 00C6 +� 0152 0152 +� 0153 0152 +SELECT s1, hex(s1) FROM t1 WHERE s1='ae' ORDER BY s1, BINARY(s1); +s1 hex(s1) +ae 00610065 +drop table t1; +CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1) CHARACTER SET ucs2 DEFAULT NULL, + `b` int(1) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); +SELECT * FROM t1 ORDER BY a, b; +a b +s 0 +� 1 +SELECT * FROM t1 ORDER BY a DESC, b; +a b +s 0 +� 1 +SELECT * FROM t1 ORDER BY CONCAT(a), b; +a b +s 0 +� 1 +SELECT * FROM t1 ORDER BY CONCAT(a) DESC, b; +a b +s 0 +� 1 +DROP TABLE t1; +"END ctype_german.inc" +CREATE TABLE t1 AS +SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; +ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); +INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +SELECT hex(concat(repeat(0xF1F2, 10), '%')); +hex(concat(repeat(0xF1F2, 10), '%')) +F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F20025 +3 rows expected +SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); +a hex(b) c +2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL +3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL +4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL +DROP TABLE t1; +# +# MDEV-4842 STR_TO_DATE does not work with UCS2/UTF16/UTF32 +# +SELECT @@character_set_connection, HEX(CAST(_utf8'÷' AS CHAR)); +@@character_set_connection HEX(CAST(_utf8'÷' AS CHAR)) +ucs2 00F7 +SELECT STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR)); +STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR)) +2001-01-01 +CREATE TABLE t1 AS SELECT REPEAT(' ', 64) AS subject, REPEAT(' ',64) AS pattern LIMIT 0; +SHOW COLUMNS FROM t1; +Field Type Null Key Default Extra +subject varchar(64) YES NULL +pattern varchar(64) YES NULL +INSERT INTO t1 VALUES (_utf8'2001÷01÷01',_utf8'%Y÷%m÷%d'); +SELECT HEX(subject),HEX(pattern),STR_TO_DATE(subject, pattern) FROM t1; +HEX(subject) HEX(pattern) STR_TO_DATE(subject, pattern) +003200300030003100F70030003100F700300031 0025005900F70025006D00F700250064 2001-01-01 00:00:00.000000 +DROP TABLE t1; +SET NAMES latin1; +SET collation_connection='ucs2_bin'; +create table t1 select repeat('a',4000) a; +delete from t1; +insert into t1 values ('a'), ('a '), ('a\t'); +select collation(a),hex(a) from t1 order by a; +collation(a) hex(a) +ucs2_bin 00610009 +ucs2_bin 0061 +ucs2_bin 00610020 +drop table t1; +# +# MDEV-5453 Assertion `src' fails in my_strnxfrm_unicode on GROUP BY MID(..) WITH ROLLUP +# +SELECT @@collation_connection; +@@collation_connection +ucs2_bin +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +SELECT * FROM t1 GROUP BY MID(CURRENT_USER,0) WITH ROLLUP; +i +1 +1 +SELECT * FROM t1 GROUP BY MID('test',0) WITH ROLLUP; +i +1 +1 +DROP TABLE t1; +# +# MDEV-6170 Incorrect ordering with utf8_bin and utf8mb4_bin collations +# +SELECT @@collation_connection; +@@collation_connection +ucs2_bin +CREATE TABLE t1 ENGINE=MEMORY AS SELECT REPEAT('a',5) AS a LIMIT 0; +INSERT INTO t1 (a) VALUES ("a"); +INSERT INTO t1 (a) VALUES ("b"); +INSERT INTO t1 (a) VALUES ("c"); +INSERT INTO t1 (a) VALUES ("d"); +INSERT INTO t1 (a) VALUES ("e"); +INSERT INTO t1 (a) VALUES ("f"); +INSERT INTO t1 (a) VALUES ("g"); +INSERT INTO t1 (a) VALUES ("h"); +INSERT INTO t1 (a) VALUES ("i"); +INSERT INTO t1 (a) VALUES ("j"); +INSERT INTO t1 (a) VALUES ("k"); +INSERT INTO t1 (a) VALUES ("l"); +INSERT INTO t1 (a) VALUES ("m"); +SELECT * FROM t1 ORDER BY LOWER(a); +a +a +b +c +d +e +f +g +h +i +j +k +l +m +SELECT * FROM t1 ORDER BY LOWER(a) DESC; +a +m +l +k +j +i +h +g +f +e +d +c +b +a +DROP TABLE t1; +select @@collation_connection; +@@collation_connection +ucs2_bin +create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ; +insert into t1 values('abcdef'); +insert into t1 values('_bcdef'); +insert into t1 values('a_cdef'); +insert into t1 values('ab_def'); +insert into t1 values('abc_ef'); +insert into t1 values('abcd_f'); +insert into t1 values('abcde_'); +select c1 as c1u from t1 where c1 like 'ab\_def'; +c1u +ab_def +select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; +c2h +ab_def +drop table t1; ++SELECT @@collation_connection; ++@@collation_connection ++ucs2_bin ++SELECT '\%b' LIKE '%\%'; ++'\%b' LIKE '%\%' ++0 +CREATE TABLE t1 AS +SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; +ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); +INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +SELECT hex(concat(repeat(0xF1F2, 10), '%')); +hex(concat(repeat(0xF1F2, 10), '%')) +F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F20025 +3 rows expected +SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); +a hex(b) c +2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL +3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL +4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 NULL +DROP TABLE t1; +select hex(substr(_ucs2 0x00e400e50068,1)); +hex(substr(_ucs2 0x00e400e50068,1)) +00E400E50068 +select hex(substr(_ucs2 0x00e400e50068,2)); +hex(substr(_ucs2 0x00e400e50068,2)) +00E50068 +select hex(substr(_ucs2 0x00e400e50068,3)); +hex(substr(_ucs2 0x00e400e50068,3)) +0068 +select hex(substr(_ucs2 0x00e400e50068,-1)); +hex(substr(_ucs2 0x00e400e50068,-1)) +0068 +select hex(substr(_ucs2 0x00e400e50068,-2)); +hex(substr(_ucs2 0x00e400e50068,-2)) +00E50068 +select hex(substr(_ucs2 0x00e400e50068,-3)); +hex(substr(_ucs2 0x00e400e50068,-3)) +00E400E50068 +SET NAMES latin1; +SET collation_connection='ucs2_swedish_ci'; +CREATE TABLE t1 (Field1 int(10) default '0'); +INSERT INTO t1 VALUES ('-1'); +SELECT * FROM t1; +Field1 +-1 +DROP TABLE t1; +CREATE TABLE t1 (Field1 int(10) unsigned default '0'); +INSERT IGNORE INTO t1 VALUES ('-1'); +Warnings: +Warning 1264 Out of range value for column 'Field1' at row 1 +DROP TABLE t1; +SET NAMES latin1; +SELECT CONVERT(103, CHAR(50) UNICODE); +CONVERT(103, CHAR(50) UNICODE) +103 +SELECT CONVERT(103.0, CHAR(50) UNICODE); +CONVERT(103.0, CHAR(50) UNICODE) +103.0 +SELECT CONVERT(-103, CHAR(50) UNICODE); +CONVERT(-103, CHAR(50) UNICODE) +-103 +SELECT CONVERT(-103.0, CHAR(50) UNICODE); +CONVERT(-103.0, CHAR(50) UNICODE) +-103.0 +CREATE TABLE t1 ( +a varchar(255) NOT NULL default '', +KEY a (a) +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE ucs2_general_ci; +insert into t1 values (0x803d); +insert into t1 values (0x005b); +select hex(a) from t1; +hex(a) +005B +803D +drop table t1; +set sql_mode=""; +create table t1(f1 varchar(5) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL) engine=InnoDB; +set sql_mode=default; +insert into t1 values('a'); +create index t1f1 on t1(f1); +select f1 from t1 where f1 like 'a%'; +f1 +a +drop table t1; +create table t1 (utext varchar(20) character set ucs2); +insert into t1 values ("lily"); +insert into t1 values ("river"); +prepare stmt from 'select utext from t1 where utext like ?'; +set @param1='%%'; +execute stmt using @param1; +utext +lily +river +execute stmt using @param1; +utext +lily +river +select utext from t1 where utext like '%%'; +utext +lily +river +drop table t1; +deallocate prepare stmt; +create table t1 ( +a char(10) unicode not null, +index a (a) +) engine=myisam; +insert into t1 values (repeat(0x201f, 10)); +insert into t1 values (repeat(0x2020, 10)); +insert into t1 values (repeat(0x2021, 10)); +explain select hex(a) from t1 order by a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a 20 NULL 3 Using index +select hex(a) from t1 order by a; +hex(a) +201F201F201F201F201F201F201F201F201F201F +2020202020202020202020202020202020202020 +2021202120212021202120212021202120212021 +alter table t1 drop index a; +select hex(a) from t1 order by a; +hex(a) +201F201F201F201F201F201F201F201F201F201F +2020202020202020202020202020202020202020 +2021202120212021202120212021202120212021 +drop table t1; +CREATE TABLE t1 (id int, s char(5) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci); +INSERT INTO t1 VALUES (1, 'ZZZZZ'), (1, 'ZZZ'), (2, 'ZZZ'), (2, 'ZZZZZ'); +SELECT id, MIN(s) FROM t1 GROUP BY id; +id MIN(s) +1 ZZZ +2 ZZZ +DROP TABLE t1; +drop table if exists bug20536; +set names latin1; +create table bug20536 (id bigint not null auto_increment primary key, name +varchar(255) character set ucs2 not null); +insert into `bug20536` (`id`,`name`) values (1, _latin1 x'7465737431'), (2, "'test\\_2'"); +select md5(name) from bug20536; +md5(name) +f4b7ce8b45a20e3c4e84bef515d1525c +48d95db0d8305c2fe11548a3635c9385 +select sha1(name) from bug20536; +sha1(name) +e0b52f38deddb9f9e8d5336b153592794cb49baf +677d4d505355eb5b0549b865fcae4b7f0c28aef5 +select make_set(3, name, upper(name)) from bug20536; +make_set(3, name, upper(name)) +test1,TEST1 +'test\_2','TEST\_2' +select export_set(5, name, upper(name)) from bug20536; +export_set(5, name, upper(name)) +test1,TEST1,test1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1 +'test\_2','TEST\_2','test\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2' +select export_set(5, name, upper(name), ",", 5) from bug20536; +export_set(5, name, upper(name), ",", 5) +test1,TEST1,test1,TEST1,TEST1 +'test\_2','TEST\_2','test\_2','TEST\_2','TEST\_2' +CREATE TABLE t1 ( +status enum('active','passive') collate latin1_general_ci +NOT NULL default 'passive' +); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `status` enum('active','passive') CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT 'passive' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +ALTER TABLE t1 ADD a int NOT NULL AFTER status; +CREATE TABLE t2 ( +status enum('active','passive') collate ucs2_turkish_ci +NOT NULL default 'passive' +); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `status` enum('active','passive') CHARACTER SET ucs2 COLLATE ucs2_turkish_ci NOT NULL DEFAULT 'passive' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +ALTER TABLE t2 ADD a int NOT NULL AFTER status; +DROP TABLE t1,t2; +select password(name) from bug20536; +password(name) +*286C12C0F32248BD65B30EE65F3ECFB2AA3F7849 +*947A5674312754578F132655C74A11533B105FF6 +select old_password(name) from bug20536; +old_password(name) +10e155cb44e2adb5 +14e500b131773991 +select quote(name) from bug20536; +quote(name) +'test1' +'\'test\\_2\'' +drop table bug20536; +set names ucs2; +ERROR 42000: Variable 'character_set_client' can't be set to the value of 'ucs2' +set names ucs2 collate ucs2_bin; +ERROR 42000: Variable 'character_set_client' can't be set to the value of 'ucs2' +set character_set_client= ucs2; +ERROR 42000: Variable 'character_set_client' can't be set to the value of 'ucs2' +set character_set_client= concat('ucs', substr('2', 1)); +ERROR 42000: Variable 'character_set_client' can't be set to the value of 'ucs2' +CREATE TABLE t1(a TEXT CHARSET ucs2 COLLATE ucs2_unicode_ci); +INSERT INTO t1 VALUES('abcd'); +SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abcd' IN BOOLEAN MODE); +a +abcd +DROP TABLE t1; +End of 4.1 tests +CREATE TABLE t1 (a varchar(64) character set ucs2, b decimal(10,3)); +INSERT INTO t1 VALUES ("1.1", 0), ("2.1", 0); +update t1 set b=a; +SELECT * FROM t1; +a b +1.1 1.100 +2.1 2.100 +DROP TABLE t1; +create table t1 (utext varchar(20) character set ucs2); +insert into t1 values ("lily"); +insert into t1 values ("river"); +prepare stmt from 'select utext from t1 where utext like ?'; +set @param1='%%'; +execute stmt using @param1; +utext +lily +river +execute stmt using @param1; +utext +lily +river +select utext from t1 where utext like '%%'; +utext +lily +river +drop table t1; +deallocate prepare stmt; +set names latin1; +set character_set_connection=ucs2; +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 hex(soundex('')),hex(soundex('he')),hex(soundex('hello all folks')),hex(soundex('#3556 in bugdb')); +hex(soundex('')) hex(soundex('he')) hex(soundex('hello all folks')) hex(soundex('#3556 in bugdb')) + 0048003000300030 00480034003100340032 004900350031003200330031 +select 'mood' sounds like 'mud'; +'mood' sounds like 'mud' +1 +select hex(soundex(_ucs2 0x041004110412)); +hex(soundex(_ucs2 0x041004110412)) +0410003000300030 +select hex(soundex(_ucs2 0x00BF00C0)); +hex(soundex(_ucs2 0x00BF00C0)) +00C0003000300030 +set names latin1; +create table t1(a blob, b text charset utf8, c text charset ucs2); +select data_type, character_octet_length, character_maximum_length +from information_schema.columns where table_name='t1'; +data_type character_octet_length character_maximum_length +blob 65535 65535 +text 65535 65535 +text 65535 32767 +drop table t1; +create table t1 (a char(1) character set ucs2); +insert into t1 values ('a'),('b'),('c'); +select hex(group_concat(a)) from t1; +hex(group_concat(a)) +0061002C0062002C0063 +select collation(group_concat(a)) from t1; +collation(group_concat(a)) +ucs2_general_ci +drop table t1; +set names latin1; +create table t1 (a char(1) character set latin1); +insert into t1 values ('a'),('b'),('c'); +set character_set_connection=ucs2; +select hex(group_concat(a separator ',')) from t1; +hex(group_concat(a separator ',')) +612C622C63 +select collation(group_concat(a separator ',')) from t1; +collation(group_concat(a separator ',')) +latin1_swedish_ci +drop table t1; +set names latin1; +create table t1 (s1 char(1) character set ascii, s2 char(1) character set ucs2); +insert into t1 (s1) values (0x7f); +update t1 set s2 = s1; +select hex(s2) from t1; +hex(s2) +007F +select hex(convert(s1 using latin1)) from t1; +hex(convert(s1 using latin1)) +7F +drop table t1; +create table t1 (a varchar(15) character set ascii not null, b int); +insert into t1 values ('a',1); +select concat(a,if(b<10,_ucs2 0x0061,_ucs2 0x0062)) from t1; +concat(a,if(b<10,_ucs2 0x0061,_ucs2 0x0062)) +aa +select concat(a,if(b>10,_ucs2 0x0061,_ucs2 0x0062)) from t1; +concat(a,if(b>10,_ucs2 0x0061,_ucs2 0x0062)) +ab +select * from t1 where a=if(b<10,_ucs2 0x0061,_ucs2 0x0062); +a b +a 1 +select * from t1 where a=if(b>10,_ucs2 0x0061,_ucs2 0x0062); +a b +select concat(a,if(b<10,_ucs2 0x00C0,_ucs2 0x0062)) from t1; +ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation 'concat' +select concat(a,if(b>10,_ucs2 0x00C0,_ucs2 0x0062)) from t1; +ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation 'concat' +select concat(a,if(b<10,_ucs2 0x0062,_ucs2 0x00C0)) from t1; +ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation 'concat' +select concat(a,if(b>10,_ucs2 0x0062,_ucs2 0x00C0)) from t1; +ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation 'concat' +select * from t1 where a=if(b<10,_ucs2 0x00C0,_ucs2 0x0062); +ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation '=' +select * from t1 where a=if(b<10,_ucs2 0x0062,_ucs2 0x00C0); +ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation '=' +drop table t1; +CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET UCS2); +INSERT INTO t1 VALUES ('a'); +SET @@sql_mode=pad_char_to_full_length; +SELECT HEX(s1) FROM t1; +HEX(s1) +00610020002000200020 +SET @@sql_mode=default; +SELECT HEX(s1) FROM t1; +HEX(s1) +0061 +DROP TABLE t1; +set collation_connection=ucs2_general_ci; +drop table if exists t1; +create table t1 as +select repeat(' ', 64) as s1, repeat(' ',64) as s2 +union +select null, null; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `s1` varchar(64) CHARACTER SET ucs2 DEFAULT NULL, + `s2` varchar(64) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +delete from t1; +insert into t1 values('aaa','aaa'); +insert into t1 values('aaa|qqq','qqq'); +insert into t1 values('gheis','^[^a-dXYZ]+$'); +insert into t1 values('aab','^aa?b'); +insert into t1 values('Baaan','^Ba*n'); +insert into t1 values('aaa','qqq|aaa'); +insert into t1 values('qqq','qqq|aaa'); +insert into t1 values('bbb','qqq|aaa'); +insert into t1 values('bbb','qqq'); +insert into t1 values('aaa','aba'); +insert into t1 values(null,'abc'); +insert into t1 values('def',null); +insert into t1 values(null,null); +insert into t1 values('ghi','ghi['); +select HIGH_PRIORITY s1 regexp s2 from t1; +s1 regexp s2 +0 +0 +0 +1 +1 +1 +1 +1 +1 +1 +NULL +NULL +NULL +NULL +drop table t1; +set names latin1; +select hex(char(0x41 using ucs2)); +hex(char(0x41 using ucs2)) +0041 +SET character_set_connection=ucs2; +SELECT CHARSET(DAYNAME(19700101)); +CHARSET(DAYNAME(19700101)) +ucs2 +SELECT CHARSET(MONTHNAME(19700101)); +CHARSET(MONTHNAME(19700101)) +ucs2 +SELECT LOWER(DAYNAME(19700101)); +LOWER(DAYNAME(19700101)) +thursday +SELECT LOWER(MONTHNAME(19700101)); +LOWER(MONTHNAME(19700101)) +january +SELECT UPPER(DAYNAME(19700101)); +UPPER(DAYNAME(19700101)) +THURSDAY +SELECT UPPER(MONTHNAME(19700101)); +UPPER(MONTHNAME(19700101)) +JANUARY +SELECT HEX(MONTHNAME(19700101)); +HEX(MONTHNAME(19700101)) +004A0061006E0075006100720079 +SELECT HEX(DAYNAME(19700101)); +HEX(DAYNAME(19700101)) +00540068007500720073006400610079 +SET LC_TIME_NAMES=ru_RU; +SET NAMES utf8; +SET character_set_connection=ucs2; +SELECT CHARSET(DAYNAME(19700101)); +CHARSET(DAYNAME(19700101)) +ucs2 +SELECT CHARSET(MONTHNAME(19700101)); +CHARSET(MONTHNAME(19700101)) +ucs2 +SELECT LOWER(DAYNAME(19700101)); +LOWER(DAYNAME(19700101)) +четверг +SELECT LOWER(MONTHNAME(19700101)); +LOWER(MONTHNAME(19700101)) +января +SELECT UPPER(DAYNAME(19700101)); +UPPER(DAYNAME(19700101)) +ЧЕТВЕРГ +SELECT UPPER(MONTHNAME(19700101)); +UPPER(MONTHNAME(19700101)) +ЯНВАРЯ +SELECT HEX(MONTHNAME(19700101)); +HEX(MONTHNAME(19700101)) +042F043D043204300440044F +SELECT HEX(DAYNAME(19700101)); +HEX(DAYNAME(19700101)) +0427043504420432043504400433 +SET character_set_connection=latin1; +# +# Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817 +# +CREATE TABLE t1 (a CHAR(1) CHARSET ascii, b CHAR(1) CHARSET latin1); +CREATE VIEW v1 AS SELECT 1 from t1 +WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1')); +DROP VIEW v1; +DROP TABLE t1; +# +# Bug#59648 my_strtoll10_mb2: Assertion `(*endptr - s) % 2 == 0' failed. +# +SELECT HEX(CHAR(COALESCE(NULL, CHAR(COUNT('%s') USING ucs2), 1, @@global.license, NULL) USING cp850)); +HEX(CHAR(COALESCE(NULL, CHAR(COUNT('%s') USING ucs2), 1, @@global.license, NULL) USING cp850)) +00 +SELECT CONVERT(QUOTE(CHAR(0xf5 using ucs2)), SIGNED); +CONVERT(QUOTE(CHAR(0xf5 using ucs2)), SIGNED) +0 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: ''õ'' +End of 5.0 tests +# +# Start of 5.1 tests +# +SET NAMES utf8; +CREATE TABLE t1 ( +a varchar(10) CHARACTER SET ucs2 COLLATE ucs2_czech_ci, +key(a) +); +INSERT INTO t1 VALUES +('aa'),('bb'),('cc'),('dd'),('ee'),('ff'),('gg'),('hh'),('ii'), +('jj'),('kk'),('ll'),('mm'),('nn'),('oo'),('pp'),('rr'),('ss'), +('tt'),('uu'),('vv'),('ww'),('xx'),('yy'),('zz'); +INSERT INTO t1 VALUES ('ca'),('cz'),('ch'); +INSERT INTO t1 VALUES ('da'),('dz'), (X'0064017E'); +EXPLAIN SELECT * FROM t1 WHERE a LIKE 'b%'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 23 NULL 1 Using where; Using index +EXPLAIN SELECT * FROM t1 WHERE a LIKE 'c%'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 23 NULL 30 Using where; Using index +SELECT * FROM t1 WHERE a LIKE 'c%'; +a +ca +cc +cz +ch +EXPLAIN SELECT * FROM t1 WHERE a LIKE 'ch%'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 23 NULL 1 Using where; Using index +SELECT * FROM t1 WHERE a LIKE 'ch%'; +a +ch +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ucs2 COLLATE ucs2_croatian_ci; +EXPLAIN SELECT * FROM t1 WHERE a LIKE 'd%'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 23 NULL 30 Using where; Using index +SELECT hex(concat('d',_ucs2 0x017E,'%')); +hex(concat('d',_ucs2 0x017E,'%')) +0064017E0025 +EXPLAIN SELECT * FROM t1 WHERE a LIKE concat('d',_ucs2 0x017E,'%'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 23 NULL 1 Using where; Using index +SELECT hex(a) FROM t1 WHERE a LIKE concat('D',_ucs2 0x017E,'%'); +hex(a) +0064017E +DROP TABLE t1; +# +# End of 5.1 tests +# +# +# Start of 5.5 tests +# +SET NAMES latin1; +SET collation_connection=ucs2_general_ci; +SET TIME_ZONE = _latin1 '+03:00'; +# +# Start of WL#2649 Number-to-string conversions +# +select hex(concat(1)); +hex(concat(1)) +0031 +create table t1 as select concat(1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select hex(c1) from t1; +hex(c1) +0031 +drop table t1; +select hex(concat(18446744073709551615)); +hex(concat(18446744073709551615)) +00310038003400340036003700340034003000370033003700300039003500350031003600310035 +create table t1 as select concat(18446744073709551615) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(20) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select hex(c1) from t1; +hex(c1) +00310038003400340036003700340034003000370033003700300039003500350031003600310035 +drop table t1; +select hex(concat(1.1)); +hex(concat(1.1)) +0031002E0031 +create table t1 as select concat(1.1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select hex(c1) from t1; +hex(c1) +0031002E0031 +drop table t1; +select hex(concat('a', 1+2)), charset(concat(1+2)); +hex(concat('a', 1+2)) charset(concat(1+2)) +00610033 ucs2 +create table t1 as select concat(1+2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(1-2)); +hex(concat(1-2)) +002D0031 +create table t1 as select concat(1-2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(1*2)); +hex(concat(1*2)) +0032 +create table t1 as select concat(1*2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(1/2)); +hex(concat(1/2)) +0030002E0035003000300030 +create table t1 as select concat(1/2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(7) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(1 div 2)); +hex(concat(1 div 2)) +0030 +create table t1 as select concat(1 div 2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(1 % 2)); +hex(concat(1 % 2)) +0031 +create table t1 as select concat(1 % 2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(-1)); +hex(concat(-1)) +002D0031 +create table t1 as select concat(-1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(-(1+2))); +hex(concat(-(1+2))) +002D0033 +create table t1 as select concat(-(1+2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(1|2)); +hex(concat(1|2)) +0033 +create table t1 as select concat(1|2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(1&2)); +hex(concat(1&2)) +0030 +create table t1 as select concat(1&2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(bit_count(12))); +hex(concat(bit_count(12))) +0032 +create table t1 as select concat(bit_count(12)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(2<<1)); +hex(concat(2<<1)) +0034 +create table t1 as select concat(2<<1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(2>>1)); +hex(concat(2>>1)) +0031 +create table t1 as select concat(2>>1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(~0)); +hex(concat(~0)) +00310038003400340036003700340034003000370033003700300039003500350031003600310035 +create table t1 as select concat(~0) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(3^2)); +hex(concat(3^2)) +0031 +create table t1 as select concat(3^2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(abs(-2))); +hex(concat(abs(-2))) +0032 +create table t1 as select concat(abs(-2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(exp(2)),1)); +hex(left(concat(exp(2)),1)) +0037 +create table t1 as select concat(exp(2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(log(2)),1)); +hex(left(concat(log(2)),1)) +0030 +create table t1 as select concat(log(2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(log2(2)),1)); +hex(left(concat(log2(2)),1)) +0031 +create table t1 as select concat(log2(2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(log10(2)),1)); +hex(left(concat(log10(2)),1)) +0030 +create table t1 as select concat(log10(2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(sqrt(2)),1)); +hex(left(concat(sqrt(2)),1)) +0031 +create table t1 as select concat(sqrt(2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(pow(2,2)),1)); +hex(left(concat(pow(2,2)),1)) +0034 +create table t1 as select concat(pow(2,2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(acos(0.5)),1)); +hex(left(concat(acos(0.5)),1)) +0031 +create table t1 as select concat(acos(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(asin(0.5)),1)); +hex(left(concat(asin(0.5)),1)) +0030 +create table t1 as select concat(asin(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(atan(0.5)),1)); +hex(left(concat(atan(0.5)),1)) +0030 +create table t1 as select concat(atan(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(cos(0.5)),1)); +hex(left(concat(cos(0.5)),1)) +0030 +create table t1 as select concat(cos(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(sin(0.5)),1)); +hex(left(concat(sin(0.5)),1)) +0030 +create table t1 as select concat(sin(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(tan(0.5)),1)); +hex(left(concat(tan(0.5)),1)) +0030 +create table t1 as select concat(tan(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(degrees(0))); +hex(concat(degrees(0))) +0030 +create table t1 as select concat(degrees(0)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(radians(0))); +hex(concat(radians(0))) +0030 +create table t1 as select concat(radians(0)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(ceiling(0.5))); +hex(concat(ceiling(0.5))) +0031 +create table t1 as select concat(ceiling(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(floor(0.5))); +hex(concat(floor(0.5))) +0030 +create table t1 as select concat(floor(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(round(0.5))); +hex(concat(round(0.5))) +0031 +create table t1 as select concat(round(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(sign(0.5))); +hex(concat(sign(0.5))) +0031 +create table t1 as select concat(sign(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(rand()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(length('a'))); +hex(concat(length('a'))) +0032 +create table t1 as select concat(length('a')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(char_length('a'))); +hex(concat(char_length('a'))) +0031 +create table t1 as select concat(char_length('a')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(bit_length('a'))); +hex(concat(bit_length('a'))) +00310036 +create table t1 as select concat(bit_length('a')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(11) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(coercibility('a'))); +hex(concat(coercibility('a'))) +0034 +create table t1 as select concat(coercibility('a')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(locate('a','a'))); +hex(concat(locate('a','a'))) +0031 +create table t1 as select concat(locate('a','a')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(11) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(field('c','a','b','c'))); +hex(concat(field('c','a','b','c'))) +0033 +create table t1 as select concat(field('c','a','b','c')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(ascii(61))); +hex(concat(ascii(61))) +00350034 +create table t1 as select concat(ascii(61)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(ord(61))); +hex(concat(ord(61))) +00350034 +create table t1 as select concat(ord(61)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(7) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(find_in_set('b','a,b,c,d'))); +hex(concat(find_in_set('b','a,b,c,d'))) +0032 +create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select md5('a'), hex(md5('a')); +md5('a') hex(md5('a')) +760f753576f2955b0074758acb4d5fa6 00370036003000660037003500330035003700360066003200390035003500620030003000370034003700350038006100630062003400640035006600610036 +create table t1 as select md5('a') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(32) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select old_password('a'), hex(old_password('a')); +old_password('a') hex(old_password('a')) +0705298948d1f92f 0030003700300035003200390038003900340038006400310066003900320066 +create table t1 as select old_password('a') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(16) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select password('a'), hex(password('a')); +password('a') hex(password('a')) +*9A48A662559C49521B25C43077059DD109FBD84A 002A0039004100340038004100360036003200350035003900430034003900350032003100420032003500430034003300300037003700300035003900440044003100300039004600420044003800340041 +create table t1 as select password('a') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(41) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select sha('a'), hex(sha('a')); +sha('a') hex(sha('a')) +3106600e0327ca77371f2526df794ed84322585c 0033003100300036003600300030006500300033003200370063006100370037003300370031006600320035003200360064006600370039003400650064003800340033003200320035003800350063 +create table t1 as select sha('a') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(40) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select sha1('a'), hex(sha1('a')); +sha1('a') hex(sha1('a')) +3106600e0327ca77371f2526df794ed84322585c 0033003100300036003600300030006500300033003200370063006100370037003300370031006600320035003200360064006600370039003400650064003800340033003200320035003800350063 +create table t1 as select sha1('a') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(40) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(cast('-1' as signed))); +hex(concat(cast('-1' as signed))) +002D0031 +create table t1 as select concat(cast('-1' as signed)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(cast('1' as unsigned))); +hex(concat(cast('1' as unsigned))) +0031 +create table t1 as select concat(cast('1' as unsigned)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(cast(1/2 as decimal(5,5)))); +hex(concat(cast(1/2 as decimal(5,5)))) +0030002E00350030003000300030 +create table t1 as select concat(cast(1/2 as decimal(5,5))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(7) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(cast('2001-01-02 03:04:05' as date))); +hex(concat(cast('2001-01-02 03:04:05' as date))) +0032003000300031002D00300031002D00300032 +create table t1 as select concat(cast('2001-01-02 03:04:05' as date)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t1; +c1 +2001-01-02 +drop table t1; +select hex(concat(cast('2001-01-02 03:04:05' as time))); +hex(concat(cast('2001-01-02 03:04:05' as time))) +00300033003A00300034003A00300035 +create table t1 as select concat(cast('2001-01-02 03:04:05' as time)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t1; +c1 +03:04:05 +drop table t1; +select hex(concat(cast('2001-01-02' as datetime))); +hex(concat(cast('2001-01-02' as datetime))) +0032003000300031002D00300031002D00300032002000300030003A00300030003A00300030 +create table t1 as select concat(cast('2001-01-02' as datetime)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t1; +c1 +2001-01-02 00:00:00 +drop table t1; +select hex(concat(least(1,2))); +hex(concat(least(1,2))) +0031 +create table t1 as select concat(least(1,2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(greatest(1,2))); +hex(concat(greatest(1,2))) +0032 +create table t1 as select concat(greatest(1,2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(case when 11 then 22 else 33 end)); +hex(concat(case when 11 then 22 else 33 end)) +00320032 +create table t1 as select concat(case when 11 then 22 else 33 end) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(coalesce(1,2))); +hex(concat(coalesce(1,2))) +0031 +create table t1 as select concat(coalesce(1,2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat_ws(1,2,3)); +hex(concat_ws(1,2,3)) +003200310033 +create table t1 as select concat_ws(1,2,3) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(group_concat(1,2,3)); +hex(group_concat(1,2,3)) +003100320033 +create table t1 as select group_concat(1,2,3) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` mediumtext CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select 1 as c1 union select 'a'; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select hex(c1) from t1 order by c1; +hex(c1) +0031 +0061 +drop table t1; +create table t1 as select concat(last_insert_id()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(benchmark(0,0))); +hex(concat(benchmark(0,0))) +0030 +create table t1 as select concat(benchmark(0,0)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(sleep(0))); +hex(concat(sleep(0))) +0030 +create table t1 as select concat(sleep(0)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(is_free_lock('xxxx'))); +hex(concat(is_free_lock('xxxx'))) +0031 +create table t1 as select concat(is_free_lock('xxxx')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(is_used_lock('a')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(release_lock('a')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(crc32(''))); +hex(concat(crc32(''))) +0030 +create table t1 as select concat(crc32('')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(uncompressed_length(''))); +hex(concat(uncompressed_length(''))) +0030 +create table t1 as select concat(uncompressed_length('')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(connection_id()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(inet_aton('127.1.1.1'))); +hex(concat(inet_aton('127.1.1.1'))) +0032003100330030003700370032003200320035 +create table t1 as select concat(inet_aton('127.1.1.1')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(inet_ntoa(2130772225))); +hex(concat(inet_ntoa(2130772225))) +003100320037002E0031002E0031002E0031 +create table t1 as select concat(inet_ntoa(2130772225)) as c1; +select * from t1; +c1 +127.1.1.1 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(31) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select 1; +1 +1 +select hex(concat(row_count())); +hex(concat(row_count())) +002D0031 +create table t1 as select concat(row_count()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(found_rows())); +hex(concat(found_rows())) +0030 +create table t1 as select concat(found_rows()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(uuid_short()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(uuid()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(36) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select coercibility(uuid()), coercibility(cast('a' as char character set latin1)); +coercibility(uuid()) coercibility(cast('a' as char character set latin1)) +4 2 +select charset(concat(uuid(), cast('a' as char character set latin1))); +charset(concat(uuid(), cast('a' as char character set latin1))) +latin1 +create table t1 as select concat(uuid(), cast('a' as char character set latin1)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(37) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(master_pos_wait('non-existent',0,2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(@a1:=1)); +hex(concat(@a1:=1)) +0031 +create table t1 as select concat(@a2:=2) as c1, @a3:=3 as c2; +select hex(c1) from t1; +hex(c1) +0032 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL, + `c2` int(1) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +set @a2=1; +select hex(concat(@a2)); +hex(concat(@a2)) +0031 +create table t1 as select concat(@a2) as c1, @a2 as c2; +select hex(c1) from t1; +hex(c1) +0031 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(20) CHARACTER SET ucs2 DEFAULT NULL, + `c2` bigint(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(@a1:=sqrt(1))); +hex(concat(@a1:=sqrt(1))) +0031 +create table t1 as select concat(@a2:=sqrt(1)) as c1, @a3:=sqrt(1) as c2; +select hex(c1) from t1; +hex(c1) +0031 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL, + `c2` double DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +set @a2=sqrt(1); +select hex(concat(@a2)); +hex(concat(@a2)) +0031 +create table t1 as select concat(@a2) as c1, @a2 as c2; +select hex(c1) from t1; +hex(c1) +0031 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL, + `c2` double DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(@a1:=1.1)); +hex(concat(@a1:=1.1)) +0031002E0031 +create table t1 as select concat(@a2:=1.1) as c1, @a3:=1.1 as c2; +select hex(c1) from t1; +hex(c1) +0031002E0031 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL, + `c2` decimal(2,1) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +set @a2=1.1; +select hex(concat(@a2)); +hex(concat(@a2)) +0031002E0031 +create table t1 as select concat(@a2) as c1, @a2 as c2; +select hex(c1) from t1; +hex(c1) +0031002E0031 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(83) CHARACTER SET ucs2 DEFAULT NULL, + `c2` decimal(65,38) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(@@ft_max_word_len)); +hex(concat(@@ft_max_word_len)) +00380034 +create table t1 as select concat(@@ft_max_word_len) as c1; +select hex(c1) from t1; +hex(c1) +00380034 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat('a'='a' IS TRUE)); +hex(concat('a'='a' IS TRUE)) +0031 +create table t1 as select concat('a'='a' IS TRUE) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat('a'='a' IS NOT TRUE)); +hex(concat('a'='a' IS NOT TRUE)) +0030 +create table t1 as select concat('a'='a' IS NOT TRUE) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(NOT 'a'='a')); +hex(concat(NOT 'a'='a')) +0030 +create table t1 as select concat(NOT 'a'='a') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat('a' IS NULL)); +hex(concat('a' IS NULL)) +0030 +create table t1 as select concat('a' IS NULL) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat('a' IS NOT NULL)); +hex(concat('a' IS NOT NULL)) +0031 +create table t1 as select concat('a' IS NOT NULL) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat('a' rlike 'a')); +hex(concat('a' rlike 'a')) +0031 +create table t1 as select concat('a' IS NOT NULL) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(strcmp('a','b'))); +hex(concat(strcmp('a','b'))) +002D0031 +create table t1 as select concat(strcmp('a','b')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat('a' like 'a')); +hex(concat('a' like 'a')) +0031 +create table t1 as select concat('a' like 'b') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat('a' between 'b' and 'c')); +hex(concat('a' between 'b' and 'c')) +0030 +create table t1 as select concat('a' between 'b' and 'c') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat('a' in ('a','b'))); +hex(concat('a' in ('a','b'))) +0031 +create table t1 as select concat('a' in ('a','b')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(interval(23, 1, 15, 17, 30, 44, 200))); +hex(concat(interval(23, 1, 15, 17, 30, 44, 200))) +0033 +create table t1 as select concat(interval(23, 1, 15, 17, 30, 44, 200)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 (a varchar(10), fulltext key(a)); +insert into t1 values ('a'); +select hex(concat(match (a) against ('a'))) from t1; +hex(concat(match (a) against ('a'))) +0030 +create table t2 as select concat(match (a) against ('a')) as a from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` varchar(23) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +select hex(ifnull(1,'a')); +hex(ifnull(1,'a')) +0031 +create table t1 as select ifnull(1,'a') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(ifnull(1,1))); +hex(concat(ifnull(1,1))) +0031 +create table t1 as select concat(ifnull(1,1)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(ifnull(1.1,1.1))); +hex(concat(ifnull(1.1,1.1))) +0031002E0031 +create table t1 as select concat(ifnull(1.1,1.1)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(if(1,'b',1)); +hex(if(1,'b',1)) +0062 +create table t1 as select if(1,'b',1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(if(1,1,'b')); +hex(if(1,1,'b')) +0031 +create table t1 as select if(1,1,'b') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(if(1,1,1))); +hex(concat(if(1,1,1))) +0031 +create table t1 as select concat(if(1,1,1)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(nullif(1,2))); +hex(concat(nullif(1,2))) +0031 +create table t1 as select concat(nullif(1,2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)')))); +hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)')))) +0031 +create table t1 as select concat(Dimension(GeomFromText('LINSTRING(0 0,10 10)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); +hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) +0032 +create table t1 as select concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))); +hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))) +0032 +create table t1 as select concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); +hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) +0030 +create table t1 as select concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))); +hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))) +0031 +create table t1 as select concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))); +hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))) +0030 +create table t1 as select concat(IsEmpty(GeomFromText('Point(1 1)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(IsSimple(GeomFromText('POINT(1 1)')))); +hex(concat(IsSimple(GeomFromText('POINT(1 1)')))) +0031 +create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))); +hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))) +0030 +create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))); +hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))) +0031 +create table t1 as select concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))) as c1; +drop table t1; +select hex(concat(x(GeomFromText('Point(1 2)')))); +hex(concat(x(GeomFromText('Point(1 2)')))) +0031 +create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(y(GeomFromText('Point(1 2)')))); +hex(concat(y(GeomFromText('Point(1 2)')))) +0032 +create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))); +hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))) +0031 +create table t1 as select concat(GLength(GeomFromText('LineString(1 2, 2 2)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))); +hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))) +0031 +create table t1 as select concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(GeometryType(GeomFromText('Point(1 2)')))); +hex(concat(GeometryType(GeomFromText('Point(1 2)')))) +0050004F0049004E0054 +create table t1 as select concat(GeometryType(GeomFromText('Point(1 2)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(20) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(AsText(GeomFromText('Point(1 2)')))); +hex(concat(AsText(GeomFromText('Point(1 2)')))) +0050004F0049004E005400280031002000320029 +create table t1 as select concat(AsText(GeomFromText('Point(1 2)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` longtext CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(period_add(200902, 2))); +hex(concat(period_add(200902, 2))) +003200300030003900300034 +create table t1 as select concat(period_add(200902, 2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(6) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(period_diff(200902, 200802))); +hex(concat(period_diff(200902, 200802))) +00310032 +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +create table t1 as select concat(period_add(200902, 200802)) as c1; +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(6) CHARACTER SET ucs2 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(to_days(20090224))); +hex(concat(to_days(20090224))) +003700330033003800320037 +create table t1 as select concat(to_days(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(6) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(dayofmonth(20090224))); +hex(concat(dayofmonth(20090224))) +00320034 +create table t1 as select concat(dayofmonth(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(dayofyear(20090224))); +hex(concat(dayofyear(20090224))) +00350035 +create table t1 as select concat(dayofyear(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(hour('10:11:12'))); +hex(concat(hour('10:11:12'))) +00310030 +create table t1 as select concat(hour('10:11:12')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(minute('10:11:12'))); +hex(concat(minute('10:11:12'))) +00310031 +create table t1 as select concat(minute('10:11:12')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(second('10:11:12'))); +hex(concat(second('10:11:12'))) +00310032 +create table t1 as select concat(second('10:11:12')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(quarter(20090224))); +hex(concat(quarter(20090224))) +0031 +create table t1 as select concat(quarter(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(week(20090224))); +hex(concat(week(20090224))) +0038 +create table t1 as select concat(week(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(yearweek(20090224))); +hex(concat(yearweek(20090224))) +003200300030003900300038 +create table t1 as select concat(yearweek(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(6) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(year(20090224))); +hex(concat(year(20090224))) +0032003000300039 +create table t1 as select concat(year(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(weekday(20090224))); +hex(concat(weekday(20090224))) +0031 +create table t1 as select concat(weekday(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(dayofweek(20090224))); +hex(concat(dayofweek(20090224))) +0033 +create table t1 as select concat(dayofweek(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(unix_timestamp(20090224))); +hex(concat(unix_timestamp(20090224))) +0031003200330035003400320032003800300030 +create table t1 as select concat(unix_timestamp(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(17) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(time_to_sec('10:11:12'))); +hex(concat(time_to_sec('10:11:12'))) +00330036003600370032 +create table t1 as select concat(time_to_sec('10:11:12')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(17) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(extract(year from 20090702))); +hex(concat(extract(year from 20090702))) +0032003000300039 +create table t1 as select concat(extract(year from 20090702)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(microsecond('12:00:00.123456'))); +hex(concat(microsecond('12:00:00.123456'))) +003100320033003400350036 +create table t1 as select concat(microsecond('12:00:00.123456')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(6) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(month(20090224))); +hex(concat(month(20090224))) +0032 +create table t1 as select concat(month(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(last_day('2003-02-05')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select c1, hex(c1) from t1; +c1 hex(c1) +2003-02-28 0032003000300033002D00300032002D00320038 +drop table t1; +create table t1 as select concat(from_days(730669)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select c1, hex(c1) from t1; +c1 hex(c1) +2000-07-03 0032003000300030002D00300037002D00300033 +drop table t1; +create table t1 as select concat(curdate()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(utc_date()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(curtime()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select repeat('a',20) as c1 limit 0; +set timestamp=1216359724; +insert into t1 values (current_date); +insert into t1 values (current_time); +select c1, hex(c1) from t1; +c1 hex(c1) +2008-07-18 0032003000300038002D00300037002D00310038 +08:42:04 00300038003A00340032003A00300034 +drop table t1; +create table t1 as select concat(utc_time()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(sec_to_time(2378))); +hex(concat(sec_to_time(2378))) +00300030003A00330039003A00330038 +create table t1 as select concat(sec_to_time(2378)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))); +hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))) +00320034003A00300030003A00300030 +create table t1 as select concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(maketime(10,11,12))); +hex(concat(maketime(10,11,12))) +00310030003A00310031003A00310032 +create table t1 as select concat(maketime(10,11,12)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(get_format(DATE,'USA')); +hex(get_format(DATE,'USA')) +0025006D002E00250064002E00250059 +create table t1 as select get_format(DATE,'USA') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(17) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(from_unixtime(1111885200)),4)); +hex(left(concat(from_unixtime(1111885200)),4)) +0032003000300035 +create table t1 as select concat(from_unixtime(1111885200)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))); +hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))) +0032003000300033002D00310032002D00330031002000320030003A00300030003A00300030 +create table t1 as select concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))); +hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))) +0032003000300034002D00300031002D00300032002000310032003A00300030003A00300030 +create table t1 as select concat(date_add('2004-01-01 12:00:00', interval 1 day)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t1; +c1 +2004-01-02 12:00:00 +drop table t1; +select hex(concat(makedate(2009,1))); +hex(concat(makedate(2009,1))) +0032003000300039002D00300031002D00300031 +create table t1 as select concat(makedate(2009,1)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t1; +c1 +2009-01-01 +drop table t1; +create table t1 as select concat(now()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(utc_timestamp()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(sysdate()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(addtime('00:00:00','11:22:33'))); +hex(concat(addtime('00:00:00','11:22:33'))) +00310031003A00320032003A00330033 +create table t1 as select concat(addtime('00:00:00','11:22:33')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(26) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(subtime('23:59:59','11:22:33'))); +hex(concat(subtime('23:59:59','11:22:33'))) +00310032003A00330037003A00320036 +create table t1 as select concat(subtime('23:59:59','11:22:33')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(26) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(elt(1,2,3)); +hex(elt(1,2,3)) +0032 +create table t1 as select elt(1,2,3) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(export_set(1,2,3,4,2)); +hex(export_set(1,2,3,4,2)) +003200340033 +create table t1 as select export_set(1,2,3,4,2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(127) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(insert(1133,3,0,22)); +hex(insert(1133,3,0,22)) +003100310032003200330033 +create table t1 as select insert(1133,3,0,22) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(6) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(lcase(123)); +hex(lcase(123)) +003100320033 +create table t1 as select lcase(123) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(123,1)); +hex(left(123,1)) +0031 +create table t1 as select left(123,1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(lower(123)); +hex(lower(123)) +003100320033 +create table t1 as select lower(123) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(lpad(1,2,0)); +hex(lpad(1,2,0)) +00300031 +create table t1 as select lpad(1,2,0) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(ltrim(1)); +hex(ltrim(1)) +0031 +create table t1 as select ltrim(1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(mid(1,1,1)); +hex(mid(1,1,1)) +0031 +create table t1 as select mid(1,1,1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(repeat(1,2)); +hex(repeat(1,2)) +00310031 +create table t1 as select repeat(1,2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(replace(1,1,2)); +hex(replace(1,1,2)) +0032 +create table t1 as select replace(1,1,2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(reverse(12)); +hex(reverse(12)) +00320031 +create table t1 as select reverse(12) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(right(123,1)); +hex(right(123,1)) +0033 +create table t1 as select right(123,1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(rpad(1,2,0)); +hex(rpad(1,2,0)) +00310030 +create table t1 as select rpad(1,2,0) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(rtrim(1)); +hex(rtrim(1)) +0031 +create table t1 as select rtrim(1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(soundex(1)); +hex(soundex(1)) + +create table t1 as select soundex(1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(substring(1,1,1)); +hex(substring(1,1,1)) +0031 +create table t1 as select substring(1,1,1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(trim(1)); +hex(trim(1)) +0031 +create table t1 as select trim(1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(ucase(1)); +hex(ucase(1)) +0031 +create table t1 as select ucase(1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(upper(1)); +hex(upper(1)) +0031 +create table t1 as select upper(1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select repeat(' ', 64) as a limit 0; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(64) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ("1.1"), ("2.1"); +select a, hex(a) from t1; +a hex(a) +1.1 0031002E0031 +2.1 0032002E0031 +update t1 set a= a + 0.1; +select a, hex(a) from t1; +a hex(a) +1.2000000000000002 0031002E0032003000300030003000300030003000300030003000300030003000300032 +2.2 0032002E0032 +drop table t1; +create table t1 (a tinyint); +insert into t1 values (1); +select hex(concat(a)) from t1; +hex(concat(a)) +0031 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(4) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a tinyint zerofill); +insert into t1 values (1), (10), (100); +select hex(concat(a)), a from t1; +hex(concat(a)) a +003000300031 001 +003000310030 010 +003100300030 100 +drop table t1; +create table t1 (a tinyint(4) zerofill); +insert into t1 values (1), (10), (100); +select hex(concat(a)), a from t1; +hex(concat(a)) a +0030003000300031 0001 +0030003000310030 0010 +0030003100300030 0100 +drop table t1; +create table t1 (a decimal(10,2)); +insert into t1 values (123.45); +select hex(concat(a)) from t1; +hex(concat(a)) +003100320033002E00340035 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(12) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a smallint); +insert into t1 values (1); +select hex(concat(a)) from t1; +hex(concat(a)) +0031 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(6) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a smallint zerofill); +insert into t1 values (1), (10), (100), (1000), (10000); +select hex(concat(a)), a from t1; +hex(concat(a)) a +00300030003000300031 00001 +00300030003000310030 00010 +00300030003100300030 00100 +00300031003000300030 01000 +00310030003000300030 10000 +drop table t1; +create table t1 (a mediumint); +insert into t1 values (1); +select hex(concat(a)) from t1; +hex(concat(a)) +0031 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(9) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a mediumint zerofill); +insert into t1 values (1), (10), (100), (1000), (10000); +select hex(concat(a)), a from t1; +hex(concat(a)) a +00300030003000300030003000300031 00000001 +00300030003000300030003000310030 00000010 +00300030003000300030003100300030 00000100 +00300030003000300031003000300030 00001000 +00300030003000310030003000300030 00010000 +drop table t1; +create table t1 (a int); +insert into t1 values (1); +select hex(concat(a)) from t1; +hex(concat(a)) +0031 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(11) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a int zerofill); +insert into t1 values (1), (10), (100), (1000), (10000); +select hex(concat(a)), a from t1; +hex(concat(a)) a +0030003000300030003000300030003000300031 0000000001 +0030003000300030003000300030003000310030 0000000010 +0030003000300030003000300030003100300030 0000000100 +0030003000300030003000300031003000300030 0000001000 +0030003000300030003000310030003000300030 0000010000 +drop table t1; +create table t1 (a bigint); +insert into t1 values (1); +select hex(concat(a)) from t1; +hex(concat(a)) +0031 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(20) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a bigint zerofill); +insert into t1 values (1), (10), (100), (1000), (10000); +select hex(concat(a)), a from t1; +hex(concat(a)) a +00300030003000300030003000300030003000300030003000300030003000300030003000300031 00000000000000000001 +00300030003000300030003000300030003000300030003000300030003000300030003000310030 00000000000000000010 +00300030003000300030003000300030003000300030003000300030003000300030003100300030 00000000000000000100 +00300030003000300030003000300030003000300030003000300030003000300031003000300030 00000000000000001000 +00300030003000300030003000300030003000300030003000300030003000310030003000300030 00000000000000010000 +drop table t1; +create table t1 (a float); +insert into t1 values (123.456); +select hex(concat(a)) from t1; +hex(concat(a)) +003100320033002E003400350036 +select concat(a) from t1; +concat(a) +123.456 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(12) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a float zerofill); +insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1); +select hex(concat(a)), a from t1; +hex(concat(a)) a +0030003000300030003000300030003000300031002E0031 0000000001.1 +0030003000300030003000300030003000310030002E0031 0000000010.1 +0030003000300030003000300030003100300030002E0031 0000000100.1 +0030003000300030003000300031003000300030002E0031 0000001000.1 +0030003000300030003000310030003000300030002E0031 0000010000.1 +drop table t1; +create table t1 (a double); +insert into t1 values (123.456); +select hex(concat(a)) from t1; +hex(concat(a)) +003100320033002E003400350036 +select concat(a) from t1; +concat(a) +123.456 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(22) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a double zerofill); +insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1); +select hex(concat(a)), a from t1; +hex(concat(a)) a +00300030003000300030003000300030003000300030003000300030003000300030003000300031002E0031 00000000000000000001.1 +00300030003000300030003000300030003000300030003000300030003000300030003000310030002E0031 00000000000000000010.1 +00300030003000300030003000300030003000300030003000300030003000300030003100300030002E0031 00000000000000000100.1 +00300030003000300030003000300030003000300030003000300030003000300031003000300030002E0031 00000000000000001000.1 +00300030003000300030003000300030003000300030003000300030003000310030003000300030002E0031 00000000000000010000.1 +drop table t1; +create table t1 (a year(2)); +Warnings: +Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead +insert into t1 values (1); +select hex(concat(a)) from t1; +hex(concat(a)) +00300031 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(2) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a year); +insert into t1 values (1); +select hex(concat(a)) from t1; +hex(concat(a)) +0032003000300031 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(4) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a bit(64)); +insert into t1 values (1); +select hex(concat(a)) from t1; +hex(concat(a)) +0000000000000001 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varbinary(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); +insert into t1 values (0); +insert into t1 values (20010203040506); +insert into t1 values (19800203040506); +insert into t1 values ('2001-02-03 04:05:06'); +select hex(concat(a)) from t1; +hex(concat(a)) +0030003000300030002D00300030002D00300030002000300030003A00300030003A00300030 +0032003000300031002D00300032002D00300033002000300034003A00300035003A00300036 +0031003900380030002D00300032002D00300033002000300034003A00300035003A00300036 +0032003000300031002D00300032002D00300033002000300034003A00300035003A00300036 +select concat(a) from t1; +concat(a) +0000-00-00 00:00:00 +2001-02-03 04:05:06 +1980-02-03 04:05:06 +2001-02-03 04:05:06 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(19) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a date); +insert into t1 values ('2001-02-03'); +insert into t1 values (20010203); +select hex(concat(a)) from t1; +hex(concat(a)) +0032003000300031002D00300032002D00300033 +0032003000300031002D00300032002D00300033 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a time); +insert into t1 values (1); +insert into t1 values ('01:02:03'); +select hex(concat(a)) from t1; +hex(concat(a)) +00300030003A00300030003A00300031 +00300031003A00300032003A00300033 +select concat(a) from t1; +concat(a) +00:00:01 +01:02:03 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a datetime); +insert into t1 values ('2001-02-03 04:05:06'); +insert into t1 values (20010203040506); +select hex(concat(a)) from t1; +hex(concat(a)) +0032003000300031002D00300032002D00300033002000300034003A00300035003A00300036 +0032003000300031002D00300032002D00300033002000300034003A00300035003A00300036 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(19) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a tinyint); +insert into t1 values (1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(4) YES NULL +select hex(a) from v1; +hex(a) +0031 +drop table t1; +drop view v1; +create table t1 (a tinyint zerofill); +insert into t1 values (1), (10), (100); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(3) YES NULL +select hex(a) from v1; +hex(a) +003000300031 +003000310030 +003100300030 +drop table t1; +drop view v1; +create table t1 (a tinyint(30) zerofill); +insert into t1 values (1), (10), (100); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(30) YES NULL +select hex(a) from v1; +hex(a) +003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300031 +003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000310030 +003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300030003100300030 +drop table t1; +drop view v1; +create table t1 (a decimal(10,2)); +insert into t1 values (123.45); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(12) YES NULL +select hex(a) from v1; +hex(a) +003100320033002E00340035 +drop table t1; +drop view v1; +create table t1 (a smallint); +insert into t1 values (1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(6) YES NULL +select hex(a) from v1; +hex(a) +0031 +drop table t1; +drop view v1; +create table t1 (a smallint zerofill); +insert into t1 values (1), (10), (100), (1000), (10000); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(5) YES NULL +select hex(a) from v1; +hex(a) +00300030003000300031 +00300030003000310030 +00300030003100300030 +00300031003000300030 +00310030003000300030 +drop table t1; +drop view v1; +create table t1 (a mediumint); +insert into t1 values (1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(9) YES NULL +select hex(a) from v1; +hex(a) +0031 +drop table t1; +drop view v1; +create table t1 (a mediumint zerofill); +insert into t1 values (1), (10), (100), (1000), (10000); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(8) YES NULL +select hex(a) from v1; +hex(a) +00300030003000300030003000300031 +00300030003000300030003000310030 +00300030003000300030003100300030 +00300030003000300031003000300030 +00300030003000310030003000300030 +drop table t1; +drop view v1; +create table t1 (a int); +insert into t1 values (1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(11) YES NULL +select hex(a) from v1; +hex(a) +0031 +drop table t1; +drop view v1; +create table t1 (a int zerofill); +insert into t1 values (1), (10), (100), (1000), (10000); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(10) YES NULL +select hex(a) from v1; +hex(a) +0030003000300030003000300030003000300031 +0030003000300030003000300030003000310030 +0030003000300030003000300030003100300030 +0030003000300030003000300031003000300030 +0030003000300030003000310030003000300030 +drop table t1; +drop view v1; +create table t1 (a bigint); +insert into t1 values (1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(20) YES NULL +select hex(a) from v1; +hex(a) +0031 +drop table t1; +drop view v1; +create table t1 (a bigint zerofill); +insert into t1 values (1), (10), (100), (1000), (10000); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(20) YES NULL +select hex(a) from v1; +hex(a) +00300030003000300030003000300030003000300030003000300030003000300030003000300031 +00300030003000300030003000300030003000300030003000300030003000300030003000310030 +00300030003000300030003000300030003000300030003000300030003000300030003100300030 +00300030003000300030003000300030003000300030003000300030003000300031003000300030 +00300030003000300030003000300030003000300030003000300030003000310030003000300030 +drop table t1; +drop view v1; +create table t1 (a float); +insert into t1 values (123.456); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(12) YES NULL +select hex(a) from v1; +hex(a) +003100320033002E003400350036 +drop table t1; +drop view v1; +create table t1 (a float zerofill); +insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(12) YES NULL +select hex(a) from v1; +hex(a) +0030003000300030003000300030003000300031002E0031 +0030003000300030003000300030003000310030002E0031 +0030003000300030003000300030003100300030002E0031 +0030003000300030003000300031003000300030002E0031 +0030003000300030003000310030003000300030002E0031 +drop table t1; +drop view v1; +create table t1 (a double); +insert into t1 values (123.456); +select concat(a) from t1; +concat(a) +123.456 +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(22) YES NULL +select hex(a) from v1; +hex(a) +003100320033002E003400350036 +drop table t1; +drop view v1; +create table t1 (a double zerofill); +insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(22) YES NULL +select hex(a) from v1; +hex(a) +00300030003000300030003000300030003000300030003000300030003000300030003000300031002E0031 +00300030003000300030003000300030003000300030003000300030003000300030003000310030002E0031 +00300030003000300030003000300030003000300030003000300030003000300030003100300030002E0031 +00300030003000300030003000300030003000300030003000300030003000300031003000300030002E0031 +00300030003000300030003000300030003000300030003000300030003000310030003000300030002E0031 +drop table t1; +drop view v1; +create table t1 (a year(2)); +Warnings: +Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead +insert into t1 values (1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(2) YES NULL +select hex(a) from v1; +hex(a) +00300031 +drop table t1; +drop view v1; +create table t1 (a year); +insert into t1 values (1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(4) YES NULL +select hex(a) from v1; +hex(a) +0032003000300031 +drop table t1; +drop view v1; +create table t1 (a bit(64)); +insert into t1 values (1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varbinary(64) YES NULL +select hex(a) from v1; +hex(a) +0000000000000001 +drop table t1; +drop view v1; +create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); +insert into t1 values (0); +insert into t1 values (20010203040506); +insert into t1 values (19800203040506); +insert into t1 values ('2001-02-03 04:05:06'); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(19) YES NULL +select hex(a) from v1; +hex(a) +0030003000300030002D00300030002D00300030002000300030003A00300030003A00300030 +0032003000300031002D00300032002D00300033002000300034003A00300035003A00300036 +0031003900380030002D00300032002D00300033002000300034003A00300035003A00300036 +0032003000300031002D00300032002D00300033002000300034003A00300035003A00300036 +drop table t1; +drop view v1; +create table t1 (a date); +insert into t1 values ('2001-02-03'); +insert into t1 values (20010203); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(10) YES NULL +select hex(a) from v1; +hex(a) +0032003000300031002D00300032002D00300033 +0032003000300031002D00300032002D00300033 +drop table t1; +drop view v1; +create table t1 (a time); +insert into t1 values (1); +insert into t1 values ('01:02:03'); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(10) YES NULL +select hex(a) from v1; +hex(a) +00300030003A00300030003A00300031 +00300031003A00300032003A00300033 +drop table t1; +drop view v1; +create table t1 (a datetime); +insert into t1 values ('2001-02-03 04:05:06'); +insert into t1 values (20010203040506); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(19) YES NULL +select hex(a) from v1; +hex(a) +0032003000300031002D00300032002D00300033002000300034003A00300035003A00300036 +0032003000300031002D00300032002D00300033002000300034003A00300035003A00300036 +drop table t1; +drop view v1; +create function f1 (par1 int) returns int +begin +return concat(par1); +end| +set @a= f1(1); +select hex(@a); +hex(@a) +1 +select hex(concat(f1(1))); +hex(concat(f1(1))) +31 +create table t1 as select f1(1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(f1(1)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create view v1 as select concat(f1(1)) as c1; +show columns from v1; +Field Type Null Key Default Extra +c1 varchar(11) YES NULL +drop table t1; +drop view v1; +drop function f1; +create function f1 (par1 decimal(18,2)) returns decimal(18,2) +begin +return concat(par1); +end| +set @a= f1(123.45); +select hex(@a); +hex(@a) +7B +select hex(concat(f1(123.45))); +hex(concat(f1(123.45))) +3132332E3435 +create table t1 as select f1(123.45) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` decimal(18,2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(f1(123.45)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create view v1 as select concat(f1(123.45)) as c1; +show columns from v1; +Field Type Null Key Default Extra +c1 varchar(20) YES NULL +drop table t1; +drop view v1; +drop function f1; +create function f1 (par1 float) returns float +begin +return concat(par1); +end| +set @a= f1(123.45); +select hex(@a); +hex(@a) +7B +select hex(concat(f1(123.45))); +hex(concat(f1(123.45))) +3132332E3435 +create table t1 as select f1(123.45) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` float DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(f1(123.45)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(12) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create view v1 as select concat(f1(123.45)) as c1; +show columns from v1; +Field Type Null Key Default Extra +c1 varchar(12) YES NULL +drop table t1; +drop view v1; +drop function f1; +create function f1 (par1 date) returns date +begin +return concat(par1); +end| +set @a= f1(cast('2001-01-02' as date)); +select hex(@a); +hex(@a) +323030312D30312D3032 +select hex(concat(f1(cast('2001-01-02' as date)))); +hex(concat(f1(cast('2001-01-02' as date)))) +323030312D30312D3032 +create table t1 as select f1(cast('2001-01-02' as date)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(f1(cast('2001-01-02' as date))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create view v1 as select concat(f1(cast('2001-01-02' as date))) as c1; +show columns from v1; +Field Type Null Key Default Extra +c1 varchar(10) YES NULL +drop table t1; +drop view v1; +drop function f1; +# +# End of WL#2649 Number-to-string conversions +# +# +# Bug#54668 User variable assignments get wrong type +# +SET @x=md5('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +ucs2 ucs2_general_ci +SET @x=old_password('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +ucs2 ucs2_general_ci +SET @x=password('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +ucs2 ucs2_general_ci +SET @x=sha('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +ucs2 ucs2_general_ci +SET @x=sha1('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +ucs2 ucs2_general_ci +SET @x=astext(point(1,2)); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +ucs2 ucs2_general_ci +SET @x=aswkt(point(1,2)); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +ucs2 ucs2_general_ci +# +# Bug#54916 GROUP_CONCAT + IFNULL truncates output +# +SELECT @@collation_connection; +@@collation_connection +ucs2_general_ci +CREATE TABLE t1 (a MEDIUMINT NULL) ENGINE=MYISAM; +INSERT INTO t1 VALUES (1234567); +SELECT GROUP_CONCAT(IFNULL(a,'')) FROM t1; +GROUP_CONCAT(IFNULL(a,'')) +1234567 +SELECT GROUP_CONCAT(IF(a,a,'')) FROM t1; +GROUP_CONCAT(IF(a,a,'')) +1234567 +SELECT GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END) FROM t1; +GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END) +1234567 +SELECT COALESCE(a,'') FROM t1 GROUP BY 1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(a,'') 253 9 7 Y 0 39 8 +COALESCE(a,'') +1234567 +# All columns must be VARCHAR(9) with the same length: +CREATE TABLE t2 AS +SELECT +CONCAT(a), +IFNULL(a,''), +IF(a,a,''), +CASE WHEN a THEN a ELSE '' END, +COALESCE(a,'') +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `CONCAT(a)` varchar(9) CHARACTER SET ucs2 DEFAULT NULL, + `IFNULL(a,'')` varchar(9) CHARACTER SET ucs2 NOT NULL, + `IF(a,a,'')` varchar(9) CHARACTER SET ucs2 DEFAULT NULL, + `CASE WHEN a THEN a ELSE '' END` varchar(9) CHARACTER SET ucs2 DEFAULT NULL, + `COALESCE(a,'')` varchar(9) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT LCASE(a) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `LCASE(a)` varchar(9) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT UCASE(a) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `UCASE(a)` varchar(9) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `REPEAT(1,2)` varchar(2) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `LEFT(123,2)` varchar(2) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `RIGHT(123,2)` varchar(2) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `LTRIM(123)` varchar(3) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `RTRIM(123)` varchar(3) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ELT(1,111,222,333)` varchar(3) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `REPLACE(111,2,3)` varchar(3) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `SOUNDEX(1)` varchar(4) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +# End of Bug#54916 +# +# +# Bug#58190 BETWEEN no longer uses indexes for date or datetime fields +# +SELECT @@collation_connection; +@@collation_connection +ucs2_general_ci +CREATE TABLE t1 ( +id INT(11) DEFAULT NULL, +date_column DATE DEFAULT NULL, +KEY(date_column)); +INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01'); +EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range date_column date_column 4 NULL 1 Using index condition +ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL; +EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range date_column date_column 6 NULL 1 Using index condition +DROP TABLE t1; +# +# Bug #31384 DATE_ADD() and DATE_SUB() return binary data +# +SELECT @@collation_connection, @@character_set_results; +@@collation_connection @@character_set_results +ucs2_general_ci latin1 +SELECT +CHARSET(DATE_SUB('2007-08-03', INTERVAL 1 MINUTE)) AS field_str1, +CHARSET(DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE)) AS field_str2, +CHARSET(DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY)) AS field_date, +CHARSET(DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE)) AS field_datetime; +field_str1 field_str2 field_date field_datetime +ucs2 ucs2 binary binary +CREATE TABLE t1 AS +SELECT +DATE_SUB('2007-08-03', INTERVAL 1 MINUTE) AS field_str1, +DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2, +DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date, +DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `field_str1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL, + `field1_str2` varchar(19) CHARACTER SET ucs2 DEFAULT NULL, + `field_date` date DEFAULT NULL, + `field_datetime` datetime DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +SELECT +DATE_SUB('2007-08-03', INTERVAL 1 DAY) AS field_str1, +DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2, +DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date, +DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def field_str1 254 19 10 Y 0 0 8 +def field1_str2 254 19 19 Y 0 0 8 +def field_date 10 10 10 Y 128 0 63 +def field_datetime 12 19 19 Y 128 0 63 +field_str1 field1_str2 field_date field_datetime +2007-08-02 2007-08-03 17:32:00 2007-08-02 2007-08-03 17:32:00 +SELECT +HEX(DATE_SUB('2007-08-03', INTERVAL 1 MINUTE)) AS field_str1, +HEX(DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE)) AS field1_str2, +HEX(DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY)) AS field_date, +HEX(DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE)) AS field_datetime; +field_str1 field1_str2 field_date field_datetime +0032003000300037002D00300038002D00300032002000320033003A00350039003A00300030 0032003000300037002D00300038002D00300033002000310037003A00330032003A00300030 323030372D30382D3032 323030372D30382D30332031373A33323A3030 +# +# MDEV-4841 Wrong character set of ADDTIME() and DATE_ADD() +# +SELECT @@collation_connection, @@character_set_results; +@@collation_connection @@character_set_results +ucs2_general_ci latin1 +SELECT +CHARSET(ADDTIME(_latin1'10:01:01',_latin1'10:00:00')) AS addtime1, +CHARSET(ADDTIME('10:01:01','10:00:00')) AS addtime2, +CHARSET(DATE_ADD(_latin1'2001-01-01 10:01:01',interval 10 second)) AS date_add1, +CHARSET(DATE_ADD('2001-01-01 10:01:01',interval 10 second)) AS date_add2; +addtime1 addtime2 date_add1 date_add2 +ucs2 ucs2 ucs2 ucs2 +CREATE TABLE t1 AS +SELECT +ADDTIME(_latin1'10:01:01',_latin1'10:00:00') AS addtime1, +ADDTIME('10:01:01','10:00:00') AS addtime2, +DATE_ADD(_latin1'2001-01-01 10:01:01',interval 10 second) AS date_add1, +DATE_ADD('2001-01-01 10:01:01',interval 10 second) AS date_add2; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `addtime1` varchar(26) CHARACTER SET ucs2 DEFAULT NULL, + `addtime2` varchar(26) CHARACTER SET ucs2 DEFAULT NULL, + `date_add1` varchar(19) CHARACTER SET ucs2 DEFAULT NULL, + `date_add2` varchar(19) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT * FROM t1; +addtime1 addtime2 date_add1 date_add2 +20:01:01 20:01:01 2001-01-01 10:01:11 2001-01-01 10:01:11 +DROP TABLE t1; +# +# Bug#11926811 / Bug#60625 Illegal mix of collations +# +SELECT @@collation_connection; +@@collation_connection +ucs2_general_ci +CREATE PROCEDURE p1() +BEGIN +DECLARE v_LastPaymentDate DATETIME DEFAULT NULL; +SELECT v_LastPaymentDate < NOW(); +EXPLAIN EXTENDED SELECT v_LastPaymentDate < NOW(); +SHOW WARNINGS; +EXPLAIN EXTENDED SELECT CONCAT(v_LastPaymentDate, NOW()); +END// +CALL p1; +v_LastPaymentDate < NOW() +NULL +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Level Code Message +Note 1003 select v_LastPaymentDate@0 < current_timestamp() AS `v_LastPaymentDate < NOW()` +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select concat(convert(v_LastPaymentDate@0 using ucs2),convert(current_timestamp() using ucs2)) AS `CONCAT(v_LastPaymentDate, NOW())` +DROP PROCEDURE p1; +# +# Bug#52159 returning time type from function and empty left join causes debug assertion +# +CREATE FUNCTION f1() RETURNS TIME RETURN 1; +CREATE TABLE t1 (b INT); +INSERT INTO t1 VALUES (0); +SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY a; +f1() +00:00:01 +DROP FUNCTION f1; +DROP TABLE t1; +# +# MDEV-9662 Assertion `precision || !scale' failed in my_decimal_precision_to_length_no_truncation(uint, uint8, bool) +# +SELECT @@collation_connection; +@@collation_connection +ucs2_general_ci +SELECT CASE 1 WHEN 2 THEN ( - '3' ) END; +CASE 1 WHEN 2 THEN ( - '3' ) END +NULL +# +# MDEV-5702 Incorrect results are returned with NULLIF() +# +CREATE TABLE t1 (d DATE); +INSERT INTO t1 VALUES ('1999-11-11'),('2014-02-04'); +SELECT DISTINCT d, CAST(d AS CHAR), NULLIF(d,"2000-01-01") AS bad, NULLIF(CAST(d AS CHAR),"2000-01-01") AS good FROM t1; +d CAST(d AS CHAR) bad good +1999-11-11 1999-11-11 1999-11-11 1999-11-11 +2014-02-04 2014-02-04 2014-02-04 2014-02-04 +CREATE TABLE t2 AS SELECT DISTINCT d, NULLIF(d,'2000-01-01') AS bad FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `d` date DEFAULT NULL, + `bad` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +SET NAMES latin1; +SET sql_mode=''; +CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a)); +INSERT INTO t1 VALUES (); +SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1; +maketime(`a`,`a`,`a`) +00:00:00.000000 +DROP TABLE t1; +SET sql_mode=default; +SET NAMES latin1; +# +# Bug #13832953 MY_STRNXFRM_UNICODE: ASSERTION `SRC' FAILED +# +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +CREATE TABLE t1 (c1 SET('','') CHARACTER SET ucs2); +Warnings: +Note 1291 Column 'c1' has duplicated value '' in SET +INSERT INTO t1 VALUES (''); +SELECT COALESCE(c1) FROM t1 ORDER BY 1; +COALESCE(c1) + +DROP TABLE t1; +# +# MDEV-5745 analyze MySQL fix for bug#12368495 +# +SELECT CHAR_LENGTH(TRIM(LEADING 0x000000 FROM _ucs2 0x0061)); +CHAR_LENGTH(TRIM(LEADING 0x000000 FROM _ucs2 0x0061)) +2 +SELECT CHAR_LENGTH(TRIM(LEADING 0x0001 FROM _ucs2 0x0061)); +CHAR_LENGTH(TRIM(LEADING 0x0001 FROM _ucs2 0x0061)) +2 +SELECT CHAR_LENGTH(TRIM(LEADING 0x00 FROM _ucs2 0x0061)); +CHAR_LENGTH(TRIM(LEADING 0x00 FROM _ucs2 0x0061)) +1 +SELECT CHAR_LENGTH(TRIM(TRAILING 0x000000 FROM _ucs2 0x0061)); +CHAR_LENGTH(TRIM(TRAILING 0x000000 FROM _ucs2 0x0061)) +2 +SELECT CHAR_LENGTH(TRIM(TRAILING 0x0001 FROM _ucs2 0x0061)); +CHAR_LENGTH(TRIM(TRAILING 0x0001 FROM _ucs2 0x0061)) +2 +SELECT CHAR_LENGTH(TRIM(TRAILING 0x61 FROM _ucs2 0x0061)); +CHAR_LENGTH(TRIM(TRAILING 0x61 FROM _ucs2 0x0061)) +1 +SELECT CHAR_LENGTH(TRIM(BOTH 0x000000 FROM _ucs2 0x0061)); +CHAR_LENGTH(TRIM(BOTH 0x000000 FROM _ucs2 0x0061)) +2 +SELECT CHAR_LENGTH(TRIM(BOTH 0x0001 FROM _ucs2 0x0061)); +CHAR_LENGTH(TRIM(BOTH 0x0001 FROM _ucs2 0x0061)) +2 +SELECT CHAR_LENGTH(TRIM(BOTH 0x61 FROM _ucs2 0x0061)); +CHAR_LENGTH(TRIM(BOTH 0x61 FROM _ucs2 0x0061)) +1 +SELECT CHAR_LENGTH(TRIM(BOTH 0x00 FROM _ucs2 0x0061)); +CHAR_LENGTH(TRIM(BOTH 0x00 FROM _ucs2 0x0061)) +1 +# +# MDEV-11685: sql_mode can't be set with non-ascii connection charset +# +SET character_set_connection=ucs2; +SET sql_mode='NO_ENGINE_SUBSTITUTION'; +SELECT @@sql_mode; +@@sql_mode +NO_ENGINE_SUBSTITUTION +SET sql_mode=DEFAULT; +SET NAMES utf8; +# +# MDEV-13972 crash in Item_func_sec_to_time::get_date +# +SELECT SEC_TO_TIME(CONVERT(900*24*60*60 USING ucs2)); +SEC_TO_TIME(CONVERT(900*24*60*60 USING ucs2)) +838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '77760000' +# +# MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535 +# +set sql_mode=""; +CREATE TABLE t1 (c1 VARCHAR(32766) CHARACTER SET ucs2); +DESCRIBE t1; +Field Type Null Key Default Extra +c1 varchar(32766) YES NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 VARCHAR(32767) CHARACTER SET ucs2); +Warnings: +Note 1246 Converting column 'c1' from VARCHAR to TEXT +DESCRIBE t1; +Field Type Null Key Default Extra +c1 text YES NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 VARCHAR(32768) CHARACTER SET ucs2); +Warnings: +Note 1246 Converting column 'c1' from VARCHAR to TEXT +DESCRIBE t1; +Field Type Null Key Default Extra +c1 mediumtext YES NULL +DROP TABLE t1; +set sql_mode=default; +# +# MDEV-15624 Changing the default character set to utf8mb4 changes query evaluation in a very surprising way +# +SET NAMES utf8; +CREATE TABLE t1 (id INT); +INSERT INTO t1 VALUES (1),(2),(3); +SELECT COUNT(DISTINCT c) FROM (SELECT id, REPLACE(uuid_short(), '0', CAST('o' AS CHAR CHARACTER SET ucs2)) AS c FROM t1) AS d1; +COUNT(DISTINCT c) +3 +SELECT DISTINCT REPLACE(uuid_short(), '0', CAST('o' AS CHAR CHARACTER SET ucs2)) AS c FROM t1; +c +xxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxx +SELECT COUNT(DISTINCT c) FROM (SELECT id, INSERT(uuid_short(), 1, 1, CAST('0' AS CHAR CHARACTER SET ucs2)) AS c FROM t1) AS d1; +COUNT(DISTINCT c) +3 +SELECT DISTINCT INSERT(uuid_short(), 1, 1, CAST('0' AS CHAR CHARACTER SET ucs2)) AS c FROM t1; +c +xxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxx +SELECT COUNT(DISTINCT c) FROM (SELECT id, CONCAT(uuid_short(), CAST('0' AS CHAR CHARACTER SET ucs2)) AS c FROM t1) AS d1; +COUNT(DISTINCT c) +3 +SELECT DISTINCT CONCAT(uuid_short(), CAST('0' AS CHAR CHARACTER SET ucs2)) AS c FROM t1; +c +xxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxx +xxxxxxxxxxxxxxxxx +DROP TABLE t1; +# +# End of 5.5 tests +# +# +# Start of 5.6 tests +# +# +# WL#3664 WEIGHT_STRING +# +set collation_connection=ucs2_general_ci; +select @@collation_connection; +@@collation_connection +ucs2_general_ci +CREATE TABLE t1 AS SELECT 'a' AS a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1) CHARACTER SET ucs2 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a)) FROM t1; +HEX(WEIGHT_STRING(a)) +0041 +SELECT HEX(ws) FROM t2; +HEX(ws) +0041 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(5) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a)) FROM t1; +HEX(WEIGHT_STRING(a)) +00410041004100410041 +SELECT HEX(ws) FROM t2; +HEX(ws) +00410041004100410041 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(3))) +004100410041 +SELECT HEX(ws) FROM t2; +HEX(ws) +004100410041 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0041004100410041004100200020002000200020 +SELECT HEX(ws) FROM t2; +HEX(ws) +0041004100410041004100200020002000200020 +DROP TABLE t2; +DROP TABLE t1; +select hex(weight_string('a')); +hex(weight_string('a')) +0041 +select hex(weight_string('A')); +hex(weight_string('A')) +0041 +select hex(weight_string('abc')); +hex(weight_string('abc')) +004100420043 +select hex(weight_string('abc' as char(2))); +hex(weight_string('abc' as char(2))) +00410042 +select hex(weight_string('abc' as char(3))); +hex(weight_string('abc' as char(3))) +004100420043 +select hex(weight_string('abc' as char(5))); +hex(weight_string('abc' as char(5))) +00410042004300200020 +select hex(weight_string('abc', 1, 2, 0xC0)); +hex(weight_string('abc', 1, 2, 0xC0)) +00 +select hex(weight_string('abc', 2, 2, 0xC0)); +hex(weight_string('abc', 2, 2, 0xC0)) +0041 +select hex(weight_string('abc', 3, 2, 0xC0)); +hex(weight_string('abc', 3, 2, 0xC0)) +004100 +select hex(weight_string('abc', 4, 2, 0xC0)); +hex(weight_string('abc', 4, 2, 0xC0)) +00410042 +select hex(weight_string('abc', 5, 2, 0xC0)); +hex(weight_string('abc', 5, 2, 0xC0)) +0041004200 +select hex(weight_string('abc',25, 2, 0xC0)); +hex(weight_string('abc',25, 2, 0xC0)) +00410042002000200020002000200020002000200020002000 +select hex(weight_string('abc', 1, 3, 0xC0)); +hex(weight_string('abc', 1, 3, 0xC0)) +00 +select hex(weight_string('abc', 2, 3, 0xC0)); +hex(weight_string('abc', 2, 3, 0xC0)) +0041 +select hex(weight_string('abc', 3, 3, 0xC0)); +hex(weight_string('abc', 3, 3, 0xC0)) +004100 +select hex(weight_string('abc', 4, 3, 0xC0)); +hex(weight_string('abc', 4, 3, 0xC0)) +00410042 +select hex(weight_string('abc', 5, 3, 0xC0)); +hex(weight_string('abc', 5, 3, 0xC0)) +0041004200 +select hex(weight_string('abc',25, 3, 0xC0)); +hex(weight_string('abc',25, 3, 0xC0)) +00410042004300200020002000200020002000200020002000 +select hex(weight_string('abc', 1, 4, 0xC0)); +hex(weight_string('abc', 1, 4, 0xC0)) +00 +select hex(weight_string('abc', 2, 4, 0xC0)); +hex(weight_string('abc', 2, 4, 0xC0)) +0041 +select hex(weight_string('abc', 3, 4, 0xC0)); +hex(weight_string('abc', 3, 4, 0xC0)) +004100 +select hex(weight_string('abc', 4, 4, 0xC0)); +hex(weight_string('abc', 4, 4, 0xC0)) +00410042 +select hex(weight_string('abc', 5, 4, 0xC0)); +hex(weight_string('abc', 5, 4, 0xC0)) +0041004200 +select hex(weight_string('abc',25, 4, 0xC0)); +hex(weight_string('abc',25, 4, 0xC0)) +00410042004300200020002000200020002000200020002000 +select @@collation_connection; +@@collation_connection +ucs2_general_ci +select hex(weight_string(cast(_latin1 0x80 as char))); +hex(weight_string(cast(_latin1 0x80 as char))) +20AC +select hex(weight_string(cast(_latin1 0x808080 as char))); +hex(weight_string(cast(_latin1 0x808080 as char))) +20AC20AC20AC +select hex(weight_string(cast(_latin1 0x808080 as char) as char(2))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(2))) +20AC20AC +select hex(weight_string(cast(_latin1 0x808080 as char) as char(3))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(3))) +20AC20AC20AC +select hex(weight_string(cast(_latin1 0x808080 as char) as char(5))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(5))) +20AC20AC20AC00200020 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0)) +20 +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0)) +20AC +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0)) +20AC20 +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0)) +20AC20AC +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0)) +20AC20AC00 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0)) +20AC20AC002000200020002000200020002000200020002000 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0)) +20 +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0)) +20AC +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0)) +20AC20 +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0)) +20AC20AC +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0)) +20AC20AC20 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0)) +20AC20AC20AC00200020002000200020002000200020002000 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0)) +20 +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0)) +20AC +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0)) +20AC20 +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0)) +20AC20AC +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0)) +20AC20AC20 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0)) +20AC20AC20AC00200020002000200020002000200020002000 +select @@collation_connection; +@@collation_connection +ucs2_general_ci +select hex(weight_string('a' LEVEL 1)); +hex(weight_string('a' LEVEL 1)) +0041 +select hex(weight_string('A' LEVEL 1)); +hex(weight_string('A' LEVEL 1)) +0041 +select hex(weight_string('abc' LEVEL 1)); +hex(weight_string('abc' LEVEL 1)) +004100420043 +select hex(weight_string('abc' as char(2) LEVEL 1)); +hex(weight_string('abc' as char(2) LEVEL 1)) +00410042 +select hex(weight_string('abc' as char(3) LEVEL 1)); +hex(weight_string('abc' as char(3) LEVEL 1)) +004100420043 +select hex(weight_string('abc' as char(5) LEVEL 1)); +hex(weight_string('abc' as char(5) LEVEL 1)) +00410042004300200020 +select hex(weight_string('abc' as char(5) LEVEL 1 REVERSE)); +hex(weight_string('abc' as char(5) LEVEL 1 REVERSE)) +20002000430042004100 +select hex(weight_string('abc' as char(5) LEVEL 1 DESC)); +hex(weight_string('abc' as char(5) LEVEL 1 DESC)) +FFBEFFBDFFBCFFDFFFDF +select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE)); +hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE)) +DFFFDFFFBCFFBDFFBEFF +set collation_connection=ucs2_bin; +select @@collation_connection; +@@collation_connection +ucs2_bin +CREATE TABLE t1 AS SELECT 'a' AS a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a)) FROM t1; +HEX(WEIGHT_STRING(a)) +0061 +SELECT HEX(ws) FROM t2; +HEX(ws) +0061 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(5) CHARACTER SET ucs2 COLLATE ucs2_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a)) FROM t1; +HEX(WEIGHT_STRING(a)) +00610061006100610061 +SELECT HEX(ws) FROM t2; +HEX(ws) +00610061006100610061 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(3))) +006100610061 +SELECT HEX(ws) FROM t2; +HEX(ws) +006100610061 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0061006100610061006100200020002000200020 +SELECT HEX(ws) FROM t2; +HEX(ws) +0061006100610061006100200020002000200020 +DROP TABLE t2; +DROP TABLE t1; +select hex(weight_string('a')); +hex(weight_string('a')) +0061 +select hex(weight_string('A')); +hex(weight_string('A')) +0041 +select hex(weight_string('abc')); +hex(weight_string('abc')) +006100620063 +select hex(weight_string('abc' as char(2))); +hex(weight_string('abc' as char(2))) +00610062 +select hex(weight_string('abc' as char(3))); +hex(weight_string('abc' as char(3))) +006100620063 +select hex(weight_string('abc' as char(5))); +hex(weight_string('abc' as char(5))) +00610062006300200020 +select hex(weight_string('abc', 1, 2, 0xC0)); +hex(weight_string('abc', 1, 2, 0xC0)) +00 +select hex(weight_string('abc', 2, 2, 0xC0)); +hex(weight_string('abc', 2, 2, 0xC0)) +0061 +select hex(weight_string('abc', 3, 2, 0xC0)); +hex(weight_string('abc', 3, 2, 0xC0)) +006100 +select hex(weight_string('abc', 4, 2, 0xC0)); +hex(weight_string('abc', 4, 2, 0xC0)) +00610062 +select hex(weight_string('abc', 5, 2, 0xC0)); +hex(weight_string('abc', 5, 2, 0xC0)) +0061006200 +select hex(weight_string('abc',25, 2, 0xC0)); +hex(weight_string('abc',25, 2, 0xC0)) +00610062002000200020002000200020002000200020002000 +select hex(weight_string('abc', 1, 3, 0xC0)); +hex(weight_string('abc', 1, 3, 0xC0)) +00 +select hex(weight_string('abc', 2, 3, 0xC0)); +hex(weight_string('abc', 2, 3, 0xC0)) +0061 +select hex(weight_string('abc', 3, 3, 0xC0)); +hex(weight_string('abc', 3, 3, 0xC0)) +006100 +select hex(weight_string('abc', 4, 3, 0xC0)); +hex(weight_string('abc', 4, 3, 0xC0)) +00610062 +select hex(weight_string('abc', 5, 3, 0xC0)); +hex(weight_string('abc', 5, 3, 0xC0)) +0061006200 +select hex(weight_string('abc',25, 3, 0xC0)); +hex(weight_string('abc',25, 3, 0xC0)) +00610062006300200020002000200020002000200020002000 +select hex(weight_string('abc', 1, 4, 0xC0)); +hex(weight_string('abc', 1, 4, 0xC0)) +00 +select hex(weight_string('abc', 2, 4, 0xC0)); +hex(weight_string('abc', 2, 4, 0xC0)) +0061 +select hex(weight_string('abc', 3, 4, 0xC0)); +hex(weight_string('abc', 3, 4, 0xC0)) +006100 +select hex(weight_string('abc', 4, 4, 0xC0)); +hex(weight_string('abc', 4, 4, 0xC0)) +00610062 +select hex(weight_string('abc', 5, 4, 0xC0)); +hex(weight_string('abc', 5, 4, 0xC0)) +0061006200 +select hex(weight_string('abc',25, 4, 0xC0)); +hex(weight_string('abc',25, 4, 0xC0)) +00610062006300200020002000200020002000200020002000 +select @@collation_connection; +@@collation_connection +ucs2_bin +select hex(weight_string(cast(_latin1 0x80 as char))); +hex(weight_string(cast(_latin1 0x80 as char))) +20AC +select hex(weight_string(cast(_latin1 0x808080 as char))); +hex(weight_string(cast(_latin1 0x808080 as char))) +20AC20AC20AC +select hex(weight_string(cast(_latin1 0x808080 as char) as char(2))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(2))) +20AC20AC +select hex(weight_string(cast(_latin1 0x808080 as char) as char(3))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(3))) +20AC20AC20AC +select hex(weight_string(cast(_latin1 0x808080 as char) as char(5))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(5))) +20AC20AC20AC00200020 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0)) +20 +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0)) +20AC +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0)) +20AC20 +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0)) +20AC20AC +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0)) +20AC20AC00 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0)) +20AC20AC002000200020002000200020002000200020002000 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0)) +20 +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0)) +20AC +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0)) +20AC20 +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0)) +20AC20AC +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0)) +20AC20AC20 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0)) +20AC20AC20AC00200020002000200020002000200020002000 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0)) +20 +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0)) +20AC +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0)) +20AC20 +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0)) +20AC20AC +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0)) +20AC20AC20 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0)) +20AC20AC20AC00200020002000200020002000200020002000 +select @@collation_connection; +@@collation_connection +ucs2_bin +select hex(weight_string('a' LEVEL 1)); +hex(weight_string('a' LEVEL 1)) +0061 +select hex(weight_string('A' LEVEL 1)); +hex(weight_string('A' LEVEL 1)) +0041 +select hex(weight_string('abc' LEVEL 1)); +hex(weight_string('abc' LEVEL 1)) +006100620063 +select hex(weight_string('abc' as char(2) LEVEL 1)); +hex(weight_string('abc' as char(2) LEVEL 1)) +00610062 +select hex(weight_string('abc' as char(3) LEVEL 1)); +hex(weight_string('abc' as char(3) LEVEL 1)) +006100620063 +select hex(weight_string('abc' as char(5) LEVEL 1)); +hex(weight_string('abc' as char(5) LEVEL 1)) +00610062006300200020 +select hex(weight_string('abc' as char(5) LEVEL 1 REVERSE)); +hex(weight_string('abc' as char(5) LEVEL 1 REVERSE)) +20002000630062006100 +select hex(weight_string('abc' as char(5) LEVEL 1 DESC)); +hex(weight_string('abc' as char(5) LEVEL 1 DESC)) +FF9EFF9DFF9CFFDFFFDF +select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE)); +hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE)) +DFFFDFFF9CFF9DFF9EFF +# +# Bug #36418 Character sets: crash if char(256 using utf32) +# +select hex(char(0x01 using ucs2)); +hex(char(0x01 using ucs2)) +0001 +select hex(char(0x0102 using ucs2)); +hex(char(0x0102 using ucs2)) +0102 +select hex(char(0x010203 using ucs2)); +hex(char(0x010203 using ucs2)) +00010203 +select hex(char(0x01020304 using ucs2)); +hex(char(0x01020304 using ucs2)) +01020304 +# +# Bug#10094 Displays wrong error message for UNIQUE key index on CHAR(255) Unicode datatype +# +CREATE TABLE t1 (f1 CHAR(255) unicode); +INSERT INTO t1 values ('abc'),('bcd'),('abc'); +ALTER TABLE t1 ADD UNIQUE Index_1 (f1); +ERROR 23000: Duplicate entry 'abc' for key 'Index_1' +DROP TABLE t1; +# +# Test how character set works with date/time +# +SET collation_connection=ucs2_general_ci; +# +# Bug#32390 Character sets: casting utf32 to/from date doesn't work +# +CREATE TABLE t1 AS SELECT repeat('a',20) AS s1 LIMIT 0; +SET time_zone=_latin1'+03:00'; +SET timestamp=1216359724; +INSERT INTO t1 VALUES (current_date); +INSERT INTO t1 VALUES (current_time); +INSERT INTO t1 VALUES (current_timestamp); +SELECT s1, hex(s1) FROM t1; +s1 hex(s1) +2008-07-18 0032003000300038002D00300037002D00310038 +08:42:04 00300038003A00340032003A00300034 +2008-07-18 08:42:04 0032003000300038002D00300037002D00310038002000300038003A00340032003A00300034 +DROP TABLE t1; +SET timestamp=0; +SET time_zone=default; +# +# MDEV-5298 Illegal mix of collations on timestamp +# +SELECT CHARSET('2013-11-15 00:41:28' - INTERVAL 7 DAY); +CHARSET('2013-11-15 00:41:28' - INTERVAL 7 DAY) +ucs2 +SELECT COERCIBILITY('2013-11-15 00:41:28' - INTERVAL 7 DAY); +COERCIBILITY('2013-11-15 00:41:28' - INTERVAL 7 DAY) +4 +SELECT CHARSET(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY); +CHARSET(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY) +binary +SELECT COERCIBILITY(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY); +COERCIBILITY(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY) +5 +SELECT CHARSET(CONCAT('2013-11-15 00:41:28' - INTERVAL 7 DAY)); +CHARSET(CONCAT('2013-11-15 00:41:28' - INTERVAL 7 DAY)) +ucs2 +SELECT COERCIBILITY(CONCAT('2013-11-15 00:41:28' - INTERVAL 7 DAY)); +COERCIBILITY(CONCAT('2013-11-15 00:41:28' - INTERVAL 7 DAY)) +4 +SELECT CHARSET(CONCAT(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY)); +CHARSET(CONCAT(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY)) +ucs2 +SELECT COERCIBILITY(CONCAT(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY)); +COERCIBILITY(CONCAT(TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY)) +4 +SELECT CHARSET(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)); +CHARSET(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)) +ucs2 +SELECT COERCIBILITY(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)); +COERCIBILITY(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)) +4 +SELECT HEX(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)); +HEX(CONCAT('','2001-01-08 00:00:00' - INTERVAL 7 DAY)) +0032003000300031002D00300031002D00300031002000300030003A00300030003A00300030 +SELECT CHARSET(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)); +CHARSET(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)) +ucs2 +SELECT COERCIBILITY(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)); +COERCIBILITY(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)) +4 +SELECT HEX(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)); +HEX(CONCAT('',TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)) +0032003000300031002D00300031002D00300031002000300030003A00300030003A00300030 +CREATE TABLE t1 AS SELECT REPEAT('a', 64) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(64) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (''); +SELECT CHARSET(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) FROM t1; +CHARSET(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) +ucs2 +SELECT COERCIBILITY(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) FROM t1; +COERCIBILITY(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) +2 +SELECT HEX(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) FROM t1; +HEX(CONCAT(a,'2001-01-08 00:00:00' - INTERVAL 7 DAY)) +0032003000300031002D00300031002D00300031002000300030003A00300030003A00300030 +SELECT CHARSET(CONCAT(a,TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)) FROM t1; +CHARSET(CONCAT(a,TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)) +ucs2 +SELECT COERCIBILITY(CONCAT(a,TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)) FROM t1; +COERCIBILITY(CONCAT(a,TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)) +2 +SELECT HEX(CONCAT(a,TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)) FROM t1; +HEX(CONCAT(a,TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY)) +0032003000300031002D00300031002D00300031002000300030003A00300030003A00300030 +DROP TABLE t1; +CREATE TABLE t1 (t TIMESTAMP NOT NULL); +INSERT INTO t1 VALUES ('2001-01-01 00:00:00'); +SELECT * FROM t1 WHERE t < '2013-11-15 00:41:28' - INTERVAL 7 DAY; +t +2001-01-01 00:00:00 +SELECT * FROM t1 WHERE t = '2001-01-08 00:00:00' - INTERVAL 7 DAY; +t +2001-01-01 00:00:00 +SELECT * FROM t1 WHERE t < CONCAT('2013-11-15 00:41:28',LEFT(RAND(),0)) - INTERVAL 7 DAY; +t +2001-01-01 00:00:00 +SELECT * FROM t1 WHERE t = CONCAT('2001-01-08 00:00:00',LEFT(RAND(),0)) - INTERVAL 7 DAY; +t +2001-01-01 00:00:00 +SELECT * FROM t1 WHERE t < TIMESTAMP'2013-11-15 00:41:28' - INTERVAL 7 DAY; +t +2001-01-01 00:00:00 +SELECT * FROM t1 WHERE t = TIMESTAMP'2001-01-08 00:00:00' - INTERVAL 7 DAY; +t +2001-01-01 00:00:00 +DROP TABLE t1; +SET NAMES latin1; +# +# WL#4013 Unicode german2 collation +# +SET collation_connection=ucs2_german2_ci; +"BEGIN ctype_german.inc" +drop table if exists t1; +create table t1 as select repeat(' ', 64) as s1; +select collation(s1) from t1; +collation(s1) +ucs2_german2_ci +delete from t1; +INSERT INTO t1 VALUES ('ud'),('uf'); +INSERT INTO t1 VALUES ('od'),('of'); +INSERT INTO t1 VALUES ('e'); +INSERT INTO t1 VALUES ('ad'),('af'); +insert into t1 values ('a'),('ae'),(_latin1 0xE4); +insert into t1 values ('o'),('oe'),(_latin1 0xF6); +insert into t1 values ('s'),('ss'),(_latin1 0xDF); +insert into t1 values ('u'),('ue'),(_latin1 0xFC); +INSERT INTO t1 VALUES (_latin1 0xE6), (_latin1 0xC6); +INSERT INTO t1 VALUES (_latin1 0x9C), (_latin1 0x8C); +select s1, hex(s1) from t1 order by s1, binary s1; +s1 hex(s1) +a 0061 +ad 00610064 +ae 00610065 +� 00C6 +� 00E4 +� 00E6 +af 00610066 +e 0065 +o 006F +od 006F0064 +oe 006F0065 +� 00F6 +� 0152 +� 0153 +of 006F0066 +s 0073 +ss 00730073 +� 00DF +u 0075 +ud 00750064 +ue 00750065 +� 00FC +uf 00750066 +select group_concat(s1 order by binary s1) from t1 group by s1; +group_concat(s1 order by binary s1) +a +ad +ae,�,�,� +af +e +o +od +oe,�,�,� +of +s +ss,� +u +ud +ue,� +uf +SELECT s1, hex(s1), hex(weight_string(s1)) FROM t1 ORDER BY s1, BINARY(s1); +s1 hex(s1) hex(weight_string(s1)) +a 0061 0E33 +ad 00610064 0E330E6D +ae 00610065 0E330E8B +� 00C6 0E330E8B +� 00E4 0E330E8B +� 00E6 0E330E8B +af 00610066 0E330EB9 +e 0065 0E8B +o 006F 0F82 +od 006F0064 0F820E6D +oe 006F0065 0F820E8B +� 00F6 0F820E8B +� 0152 0F820E8B +� 0153 0F820E8B +of 006F0066 0F820EB9 +s 0073 0FEA +ss 00730073 0FEA0FEA +� 00DF 0FEA0FEA +u 0075 101F +ud 00750064 101F0E6D +ue 00750065 101F0E8B +� 00FC 101F0E8B +uf 00750066 101F0EB9 +SELECT s1, hex(s1) FROM t1 WHERE s1='ae' ORDER BY s1, BINARY(s1); +s1 hex(s1) +ae 00610065 +� 00C6 +� 00E4 +� 00E6 +drop table t1; +CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1) CHARACTER SET ucs2 COLLATE ucs2_german2_ci DEFAULT NULL, + `b` int(1) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); +SELECT * FROM t1 ORDER BY a, b; +a b +s 0 +� 1 +SELECT * FROM t1 ORDER BY a DESC, b; +a b +� 1 +s 0 +SELECT * FROM t1 ORDER BY CONCAT(a), b; +a b +s 0 +� 1 +SELECT * FROM t1 ORDER BY CONCAT(a) DESC, b; +a b +� 1 +s 0 +DROP TABLE t1; +"END ctype_german.inc" +# +# Bug#59145 valgrind warnings for uninitialized values in my_strtoll10_mb2 +# +SET NAMES latin1; +SELECT CONVERT(CHAR(NULL USING ucs2), UNSIGNED); +CONVERT(CHAR(NULL USING ucs2), UNSIGNED) +0 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '' +DO IFNULL(CHAR(NULL USING ucs2), ''); +DO CAST(CONVERT('' USING ucs2) AS UNSIGNED); +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '' +# +# Test error message for conversion using different charset +# +CREATE TABLE t1 (a DECIMAL(2,0)); +SET sql_mode='strict_all_tables'; +INSERT INTO t1 VALUES (CONVERT('9e99999999' USING ucs2)); +ERROR 22003: Out of range value for column 'a' at row 1 +SET sql_mode=DEFAULT; +INSERT IGNORE INTO t1 VALUES (CONVERT('aaa' USING ucs2)); +Warnings: +Warning 1366 Incorrect decimal value: 'aaa' for column `test`.`t1`.`a` at row 1 +DROP TABLE t1; +# +# End of 5.6 tests +# +# +# Start of 10.0 tests +# +SET NAMES latin1, collation_connection=ucs2_bin; +# +# MDEV-7149 Constant condition propagation erroneously applied for LIKE +# +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE CONCAT(c1)='a'; +c1 +a +a +SELECT * FROM t1 WHERE CONCAT(c1) LIKE 'a '; +c1 +a +SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE 'a'=CONCAT(c1); +c1 +a +a +SELECT * FROM t1 WHERE 'a ' LIKE CONCAT(c1); +c1 +a +SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '% '=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '%'=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +# +# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' +# +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET ucs2 COLLATE ucs2_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; +a LENGTH(a) +a 2 +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +a LENGTH(a) +a 2 +EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a ' +DROP TABLE t1; +# +# End of MDEV-8694 +# +SET NAMES latin1, collation_connection=ucs2_general_ci; +# +# MDEV-7149 Constant condition propagation erroneously applied for LIKE +# +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE CONCAT(c1)='a'; +c1 +a +a +SELECT * FROM t1 WHERE CONCAT(c1) LIKE 'a '; +c1 +a +SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE 'a'=CONCAT(c1); +c1 +a +a +SELECT * FROM t1 WHERE 'a ' LIKE CONCAT(c1); +c1 +a +SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '% '=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '%'=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +# +# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' +# +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; +a LENGTH(a) +a 2 +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +a LENGTH(a) +a 2 +EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a ' +DROP TABLE t1; +# +# End of MDEV-8694 +# +SET NAMES latin1; +# +# MDEV-6661 PI() does not work well in UCS2/UTF16/UTF32 context +# +SELECT CONCAT(CONVERT('pi=' USING ucs2),PI()) AS PI; +PI +pi=3.141593 +# +# MDEV-6695 Bad column name for UCS2 string literals +# +SET NAMES utf8, character_set_connection=ucs2; +SELECT 'a','aa'; +a aa +a aa +# +# MDEV-10306 Wrong results with combination of CONCAT, SUBSTR and CONVERT in subquery +# +SET NAMES utf8, character_set_connection=ucs2; +SET @save_optimizer_switch=@@optimizer_switch; +SET optimizer_switch=_utf8'derived_merge=on'; +CREATE TABLE t1 (t VARCHAR(10) CHARSET latin1); +INSERT INTO t1 VALUES('abcdefghi'); +SET NAMES utf8, character_set_connection=ucs2; +SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT HEX(t) t2 FROM t1) sub; +c2 +616263646566676869-616263646566676869 +SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT TO_BASE64(t) t2 FROM t1) sub; +c2 +YWJjZGVmZ2hp-YWJjZGVmZ2hp +DROP TABLE t1; +SET optimizer_switch=@save_optimizer_switch; +SET NAMES utf8, character_set_connection=ucs2; +# +# MDEV-13118 Wrong results with LOWER and UPPER and subquery +# +SET @save_optimizer_switch=@@optimizer_switch; +SET optimizer_switch=_latin1'derived_merge=on'; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `t` varchar(10) CHARACTER SET ucs2 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI'); +SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub; +c2 +abcdefghi-abcdefghi +abcdefghi-abcdefghi +SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT UPPER(t) t2 FROM t1) sub; +c2 +ABCDEFGHI-ABCDEFGHI +ABCDEFGHI-ABCDEFGHI +DROP TABLE t1; +SET optimizer_switch=@save_optimizer_switch; +# +# End of 10.0 tests +# +select collation(cast("a" as char(10) unicode binary)); +collation(cast("a" as char(10) unicode binary)) +ucs2_bin +select collation(cast("a" as char(10) binary unicode)); +collation(cast("a" as char(10) binary unicode)) +ucs2_bin +# +# MDEV-8222 "string_field LIKE int_const" returns a wrong result in case of UCS2 +# +CREATE TABLE t1 (a VARCHAR(10) CHARSET ucs2); +INSERT INTO t1 VALUES ('1'); +SELECT * FROM t1 WHERE a LIKE 1; +a +1 +DROP TABLE t1; +# +# MDEV-8253 EXPLAIN SELECT prints unexpected characters +# +SET NAMES latin1, character_set_connection=ucs2; +CREATE TABLE t1 (a DECIMAL(10,1),b DECIMAL(10,1),c VARCHAR(10),d VARCHAR(10)); +INSERT INTO t1 VALUES (1.5,1.5,'1','1'),(3.5,3.5,'3','3'); +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE COALESCE(c,0)='3 ' AND COALESCE(d,0)=COALESCE(c,0); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` where coalesce(`test`.`t1`.`c`,0) = '3 ' and coalesce(`test`.`t1`.`d`,0) = '3 ' +DROP TABLE t1; +# +# MDEV-9178 Wrong result for CAST(CONVERT('1IJ3' USING ucs2) AS SIGNED) +# +SET NAMES utf8; +SELECT CAST(CONVERT('1IJ3' USING ucs2) AS SIGNED); +CAST(CONVERT('1IJ3' USING ucs2) AS SIGNED) +1 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '1IJ3' +# +# End of 10.1 tests +# +# +# Start of 10.2 tests +# +# +# MDEV-9711 NO PAD Collatons +# +SET character_set_connection=ucs2; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ucs2_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE ucs2_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +00200061 a +002000610020 a +0061002000200020 a +006100620063 abc +00610062006300200020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +00200061 a +002000610020 a +0061002000200020 a +006100620063 abc +00610062006300200020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +00610062006300200020 abc +006100620063 abc +0061002000200020 a +002000610020 a +00200061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ucs2_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +00200061 a +002000610020 a +00610020 a +0061002000200020 a +006100620063 abc +0061006200630020 abc +00610062006300200020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +00200061 a +002000610020 a +0061 a +006100200020 a +0061002000200020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +0061002000200020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ucs2_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +00610061 1 +0061006100200020 1 +00610062 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0041000000000000000000000000000000000000 +0041002000200000000000000000000000000000 +0020004100000000000000000000000000000000 +0020004100200000000000000000000000000000 +0041002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'ucs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'ucs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')) +0061006200630020 +SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')) +00610062006300200020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ucs2_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ucs2_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE ucs2_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +00200061 a +002000610020 a +0061002000200020 a +006100620063 abc +00610062006300200020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +00200061 a +002000610020 a +0061002000200020 a +006100620063 abc +00610062006300200020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +00610062006300200020 abc +006100620063 abc +0061002000200020 a +002000610020 a +00200061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ucs2_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +00200061 a +002000610020 a +00610020 a +0061002000200020 a +006100620063 abc +0061006200630020 abc +00610062006300200020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +00200061 a +002000610020 a +0061 a +006100200020 a +0061002000200020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +0061002000200020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ucs2_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +00610061 1 +0061006100200020 1 +00610062 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0041000000000000000000000000000000000000 +0041002000200000000000000000000000000000 +0020004100000000000000000000000000000000 +0020004100200000000000000000000000000000 +0041002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'ucs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'ucs2_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'ucs2_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')) +0061006200630020 +SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'ucs2_general_nopad_ci', 'abc ')) +00610062006300200020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ucs2_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ucs2_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE ucs2_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE=ucs2_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +00200061 a +002000610020 a +0061002000200020 a +006100620063 abc +00610062006300200020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +00200061 a +002000610020 a +0061002000200020 a +006100620063 abc +00610062006300200020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +00610062006300200020 abc +006100620063 abc +0061002000200020 a +002000610020 a +00200061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ucs2_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +00200061 a +002000610020 a +00610020 a +0061002000200020 a +006100620063 abc +0061006200630020 abc +00610062006300200020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +00200061 a +002000610020 a +0061 a +006100200020 a +0061002000200020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +0061002000200020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ucs2_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +00610061 1 +0061006100200020 1 +00610062 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0061000000000000000000000000000000000000 +0061002000200000000000000000000000000000 +0020006100000000000000000000000000000000 +0020006100200000000000000000000000000000 +0061002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'ucs2_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'ucs2_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'ucs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'ucs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'ucs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'ucs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')) +0061006200630020 +SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')) +00610062006300200020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ucs2_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'ucs2_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE ucs2_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=ucs2 COLLATE=ucs2_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +00200061 a +002000610020 a +0061002000200020 a +006100620063 abc +00610062006300200020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +00200061 a +002000610020 a +0061002000200020 a +006100620063 abc +00610062006300200020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +00610062006300200020 abc +006100620063 abc +0061002000200020 a +002000610020 a +00200061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'ucs2_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +00200061 a +002000610020 a +00610020 a +0061002000200020 a +006100620063 abc +0061006200630020 abc +00610062006300200020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +00200061 a +002000610020 a +0061 a +006100200020 a +0061002000200020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +0061002000200020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'ucs2_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +00610061 1 +0061006100200020 1 +00610062 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0061000000000000000000000000000000000000 +0061002000200000000000000000000000000000 +0020006100000000000000000000000000000000 +0020006100200000000000000000000000000000 +0061002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'ucs2_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'ucs2_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'ucs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'ucs2_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'ucs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'ucs2_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')) +0061006200630020 +SELECT HEX(GREATEST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'ucs2_nopad_bin', 'abc ')) +00610062006300200020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'ucs2_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'ucs2_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'ucs2_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +# +# MDEV-10585 EXECUTE IMMEDIATE statement +# +SET character_set_connection=ucs2; +EXECUTE IMMEDIATE 'SELECT COLLATION("a")'; +COLLATION("a") +ucs2_general_ci +SET @stmt='SELECT COLLATION("a")'; +EXECUTE IMMEDIATE @stmt; +COLLATION("a") +ucs2_general_ci +# +# MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions +# +SET NAMES utf8, collation_connection=ucs2_bin; +SET @stmt='SELECT COLLATION(''a'')'; +EXECUTE IMMEDIATE @stmt; +COLLATION('a') +ucs2_bin +SET NAMES utf8, character_set_connection=ucs2; +SET @stmt='SELECT COLLATION(''a'')'; +EXECUTE IMMEDIATE @stmt; +COLLATION('a') +ucs2_general_ci +EXECUTE IMMEDIATE CONCAT('SELECT ''a'' FROM DUAL'); +a +a +SELECT HEX('aä') FROM DUAL; +HEX('aä') +006100E4 +EXECUTE IMMEDIATE 'SELECT HEX(''aä'') FROM DUAL'; +HEX('aä') +006100E4 +EXECUTE IMMEDIATE CONCAT('SELECT HEX(''aä'') FROM DUAL'); +HEX('aä') +006100E4 +EXECUTE IMMEDIATE CONCAT('SELECT HEX(''aä'') FROM ', 'DUAL'); +HEX('aä') +006100E4 +PREPARE stmt FROM 'SELECT HEX(''aä'') FROM DUAL'; +EXECUTE stmt; +HEX('aä') +006100E4 +DEALLOCATE PREPARE stmt; +SET @table='DUAL'; +SELECT HEX(@table); +HEX(@table) +004400550041004C +EXECUTE IMMEDIATE CONCAT('SELECT HEX(''aä'') FROM ', @table); +HEX('aä') +006100E4 +EXECUTE IMMEDIATE CONCAT('SELECT HEX(''aä'') FROM ', CONVERT(@table USING utf8)); +HEX('aä') +006100E4 +SET @stmt='SELECT HEX(''aä'') FROM DUAL'; +EXECUTE IMMEDIATE @stmt; +HEX('aä') +006100E4 +PREPARE stmt FROM @stmt; +EXECUTE stmt; +HEX('aä') +006100E4 +DEALLOCATE PREPARE stmt; +# +# End of 10.2 tests +# diff --cc mysql-test/main/ctype_utf8.result index 6a72f60a437,00000000000..a1f5537a8d7 mode 100644,000000..100644 --- a/mysql-test/main/ctype_utf8.result +++ b/mysql-test/main/ctype_utf8.result @@@ -1,11372 -1,0 +1,11384 @@@ +SET TIME_ZONE='+03:00'; +drop table if exists t1,t2,t3,t4; +drop database if exists mysqltest; +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 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")` varchar(10) CHARACTER SET utf8 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 utf8; +set LC_TIME_NAMES='fr_FR'; +create table t1 (s1 char(20) character set latin1); +insert into t1 values (date_format('2004-02-02','%M')); +select hex(s1) from t1; +hex(s1) +66E97672696572 +drop table t1; +create table t1 (s1 char(20) character set koi8r); +set LC_TIME_NAMES='ru_RU'; +insert into t1 values (date_format('2004-02-02','%M')); +insert into t1 values (date_format('2004-02-02','%b')); +insert into t1 values (date_format('2004-02-02','%W')); +insert into t1 values (date_format('2004-02-02','%a')); +select hex(s1), s1 from t1; +hex(s1) s1 +E6C5D7D2C1CCD1 Февраля +E6C5D7 Фев +F0CFCEC5C4C5CCD8CEC9CB Понедельник +F0CEC4 Пнд +drop table t1; +set LC_TIME_NAMES='en_US'; +set names koi8r; +create table t1 (s1 char(1) character set utf8); +insert ignore 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 ignore into t1 select repeat('a',300); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +insert ignore into t1 select repeat('�',300); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +insert ignore into t1 select repeat('a�',300); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +insert ignore into t1 select repeat('�a',300); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +insert ignore 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 ignore into t1 select repeat('a',66000); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +insert ignore into t1 select repeat('�',66000); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +insert ignore into t1 select repeat('a�',66000); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +insert ignore into t1 select repeat('�a',66000); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +insert ignore 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 ignore into t1 values (0x41FF); +Warnings: +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1 +select hex(s1) from t1; +hex(s1) +413F +drop table t1; +create table t1 (s1 varchar(10) character set utf8); +insert ignore into t1 values (0x41FF); +Warnings: +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1 +select hex(s1) from t1; +hex(s1) +413F +drop table t1; +create table t1 (s1 text character set utf8); +insert ignore into t1 values (0x41FF); +Warnings: +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1 +select hex(s1) from t1; +hex(s1) +413F +drop table t1; +create table t1 (a text character set utf8, primary key(a(371))); +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; +drop table if exists t1; +create table t1 as +select repeat(' ', 64) as s1, repeat(' ',64) as s2 +union +select null, null; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `s1` varchar(64) CHARACTER SET utf8 DEFAULT NULL, + `s2` varchar(64) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +delete from t1; +insert into t1 values('aaa','aaa'); +insert into t1 values('aaa|qqq','qqq'); +insert into t1 values('gheis','^[^a-dXYZ]+$'); +insert into t1 values('aab','^aa?b'); +insert into t1 values('Baaan','^Ba*n'); +insert into t1 values('aaa','qqq|aaa'); +insert into t1 values('qqq','qqq|aaa'); +insert into t1 values('bbb','qqq|aaa'); +insert into t1 values('bbb','qqq'); +insert into t1 values('aaa','aba'); +insert into t1 values(null,'abc'); +insert into t1 values('def',null); +insert into t1 values(null,null); +insert into t1 values('ghi','ghi['); +select HIGH_PRIORITY s1 regexp s2 from t1; +s1 regexp s2 +0 +0 +0 +1 +1 +1 +1 +1 +1 +1 +NULL +NULL +NULL +NULL +drop table t1; +SELECT @@character_set_client, @@collation_connection; +@@character_set_client @@collation_connection +utf8 utf8_general_ci +select 'вася' rlike '\\bвася\\b'; +'вася' rlike '\\bвася\\b' +1 +select 'вася ' rlike '\\bвася\\b'; +'вася ' rlike '\\bвася\\b' +1 +select ' вася' rlike '\\bвася\\b'; +' вася' rlike '\\bвася\\b' +1 +select ' вася ' rlike '\\bвася\\b'; +' вася ' rlike '\\bвася\\b' +1 +select 'вася' rlike '[[:<:]]вася[[:>:]]'; +'вася' rlike '[[:<:]]вася[[:>:]]' +1 +select 'вася ' rlike '[[:<:]]вася[[:>:]]'; +'вася ' rlike '[[:<:]]вася[[:>:]]' +1 +select ' вася' rlike '[[:<:]]вася[[:>:]]'; +' вася' rlike '[[:<:]]вася[[:>:]]' +1 +select ' вася ' rlike '[[:<:]]вася[[:>:]]'; +' вася ' rlike '[[:<:]]вася[[:>:]]' +1 +select 'васяz' rlike '\\bвася\\b'; +'васяz' rlike '\\bвася\\b' +0 +select 'zвася' rlike '\\bвася\\b'; +'zвася' rlike '\\bвася\\b' +0 +select 'zвасяz' rlike '\\bвася\\b'; +'zвасяz' rlike '\\bвася\\b' +0 +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)` varchar(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 'aaaaaaaaaa' for key 'c' +insert into t1 values ('aaaaaaaaaaaa'); +ERROR 23000: Duplicate entry 'aaaaaaaaaa' for key 'c' +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 'aaaaaaaaaa' for key 'c' +insert into t1 values ('aaaaaaaaaaaa'); +ERROR 23000: Duplicate entry 'aaaaaaaaaa' for key 'c' +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 'aa' for key 'c' +insert into t1 values ('b'); +insert into t1 values ('bb'); +insert into t1 values ('bbb'); +ERROR 23000: Duplicate entry 'bb' for key 'c' +insert into t1 values ('а'); +insert into t1 values ('аа'); +insert into t1 values ('ааа'); +ERROR 23000: Duplicate entry 'аа' for key 'c' +insert into t1 values ('б'); +insert into t1 values ('бб'); +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'бб' for key 'c' +insert into t1 values ('ꪪ'); +insert into t1 values ('ꪪꪪ'); +insert into t1 values ('ꪪꪪꪪ'); +ERROR 23000: Duplicate entry 'ꪪꪪ' for key 'c' +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 'aa' for key 'c' +insert into t1 values ('b'); +insert into t1 values ('bb'); +insert into t1 values ('bbb'); +ERROR 23000: Duplicate entry 'bb' for key 'c' +insert into t1 values ('а'); +insert into t1 values ('аа'); +insert into t1 values ('ааа'); +ERROR 23000: Duplicate entry 'аа' for key 'c' +insert into t1 values ('б'); +insert into t1 values ('бб'); +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'бб' for key 'c' +insert into t1 values ('ꪪ'); +insert into t1 values ('ꪪꪪ'); +insert into t1 values ('ꪪꪪꪪ'); +ERROR 23000: Duplicate entry 'ꪪꪪ' for key 'c' +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)) USING HASH +) ENGINE=MEMORY DEFAULT CHARSET=latin1 +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +insert into t1 values ('aa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('aaa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('б'); +insert into t1 values ('бб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +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` (`c`(1)) USING BTREE +) ENGINE=MEMORY DEFAULT CHARSET=latin1 +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +insert into t1 values ('aa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('aaa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('б'); +insert into t1 values ('бб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +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=innodb; +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +insert into t1 values ('aa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('aaa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('б'); +insert into t1 values ('бб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +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 'aaaaaaaaaa' for key 'c' +insert into t1 values ('aaaaaaaaaaaa'); +ERROR 23000: Duplicate entry 'aaaaaaaaaa' for key 'c' +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 'aa' for key 'c' +insert into t1 values ('b'); +insert into t1 values ('bb'); +insert into t1 values ('bbb'); +ERROR 23000: Duplicate entry 'bb' for key 'c' +insert into t1 values ('а'); +insert into t1 values ('аа'); +insert into t1 values ('ааа'); +ERROR 23000: Duplicate entry 'аа' for key 'c' +insert into t1 values ('б'); +insert into t1 values ('бб'); +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'бб' for key 'c' +insert into t1 values ('ꪪ'); +insert into t1 values ('ꪪꪪ'); +insert into t1 values ('ꪪꪪꪪ'); +ERROR 23000: Duplicate entry 'ꪪꪪ' for key 'c' +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)) USING HASH +) ENGINE=MEMORY DEFAULT CHARSET=latin1 +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +insert into t1 values ('aa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('aaa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('б'); +insert into t1 values ('бб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +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` (`c`(1)) USING BTREE +) ENGINE=MEMORY DEFAULT CHARSET=latin1 +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +insert into t1 values ('aa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('aaa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('б'); +insert into t1 values ('бб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +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=innodb; +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +insert into t1 values ('aa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('aaa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('б'); +insert into t1 values ('бб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +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=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 (a varchar(32) BINARY) CHARACTER SET utf8; +INSERT INTO t1 VALUES ('test'); +SELECT a FROM t1 WHERE a LIKE '%te'; +a +DROP TABLE t1; +SET NAMES utf8; +CREATE TABLE t1 ( +subject varchar(255) character set utf8 collate utf8_unicode_ci, +p varchar(15) character set utf8 +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES ('谷川俊二と申しますが、インターネット予約の会員登録をしましたところ、メールアドレスを間違えてしまい会員IDが受け取ることが出来ませんでした。間違えアドレスはtani-shun@n.vodafone.ne.jpを書き込みました。どうすればよいですか? その他、住所等は間違えありません。連絡ください。よろしくお願いします。m(__)m','040312-000057'); +INSERT INTO t1 VALUES ('aaa','bbb'); +SELECT length(subject) FROM t1; +length(subject) +432 +3 +SELECT length(subject) FROM t1 ORDER BY 1; +length(subject) +3 +432 +DROP TABLE t1; +CREATE TABLE t1 ( +id int unsigned NOT NULL auto_increment, +list_id smallint unsigned NOT NULL, +term TEXT NOT NULL, +PRIMARY KEY(id), +INDEX(list_id, term(4)) +) ENGINE=MYISAM CHARSET=utf8; +INSERT INTO t1 SET list_id = 1, term = "letterc"; +INSERT INTO t1 SET list_id = 1, term = "letterb"; +INSERT INTO t1 SET list_id = 1, term = "lettera"; +INSERT INTO t1 SET list_id = 1, term = "letterd"; +SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterc"); +id +1 +SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterb"); +id +2 +SELECT id FROM t1 WHERE (list_id = 1) AND (term = "lettera"); +id +3 +SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd"); +id +4 +DROP TABLE t1; +SET NAMES latin1; +CREATE TABLE t1 ( +id int unsigned NOT NULL auto_increment, +list_id smallint unsigned NOT NULL, +term text NOT NULL, +PRIMARY KEY(id), +INDEX(list_id, term(19)) +) ENGINE=MyISAM CHARSET=utf8; +INSERT INTO t1 set list_id = 1, term = "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=innodb; +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` varchar(5) CHARACTER SET utf8 DEFAULT NULL, + `b` varchar(15) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t2; +drop table t1; +select 'c' like '\_' as want0; +want0 +0 +SELECT SUBSTR('вася',-2); +SUBSTR('вася',-2) +ся +create table t1 (id integer, a varchar(100) character set utf8 collate utf8_unicode_ci); +insert into t1 values (1, 'Test'); +select * from t1 where soundex(a) = soundex('Test'); +id a +1 Test +select * from t1 where soundex(a) = soundex('TEST'); +id a +1 Test +select * from t1 where soundex(a) = soundex('test'); +id a +1 Test +drop table t1; +select soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB); +soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB) +阅000 +select hex(soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)); +hex(soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)) +E99885303030 +select soundex(_utf8 0xD091D092D093); +soundex(_utf8 0xD091D092D093) +Б000 +select hex(soundex(_utf8 0xD091D092D093)); +hex(soundex(_utf8 0xD091D092D093)) +D091303030 +SET collation_connection='utf8_general_ci'; +create table t1 select repeat('a',4000) a; +delete from t1; +insert into t1 values ('a'), ('a '), ('a\t'); +select collation(a),hex(a) from t1 order by a; +collation(a) hex(a) +utf8_general_ci 6109 +utf8_general_ci 61 +utf8_general_ci 6120 +drop table t1; +# +# MDEV-5453 Assertion `src' fails in my_strnxfrm_unicode on GROUP BY MID(..) WITH ROLLUP +# +SELECT @@collation_connection; +@@collation_connection +utf8_general_ci +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +SELECT * FROM t1 GROUP BY MID(CURRENT_USER,0) WITH ROLLUP; +i +1 +1 +SELECT * FROM t1 GROUP BY MID('test',0) WITH ROLLUP; +i +1 +1 +DROP TABLE t1; +# +# MDEV-6170 Incorrect ordering with utf8_bin and utf8mb4_bin collations +# +SELECT @@collation_connection; +@@collation_connection +utf8_general_ci +CREATE TABLE t1 ENGINE=MEMORY AS SELECT REPEAT('a',5) AS a LIMIT 0; +INSERT INTO t1 (a) VALUES ("a"); +INSERT INTO t1 (a) VALUES ("b"); +INSERT INTO t1 (a) VALUES ("c"); +INSERT INTO t1 (a) VALUES ("d"); +INSERT INTO t1 (a) VALUES ("e"); +INSERT INTO t1 (a) VALUES ("f"); +INSERT INTO t1 (a) VALUES ("g"); +INSERT INTO t1 (a) VALUES ("h"); +INSERT INTO t1 (a) VALUES ("i"); +INSERT INTO t1 (a) VALUES ("j"); +INSERT INTO t1 (a) VALUES ("k"); +INSERT INTO t1 (a) VALUES ("l"); +INSERT INTO t1 (a) VALUES ("m"); +SELECT * FROM t1 ORDER BY LOWER(a); +a +a +b +c +d +e +f +g +h +i +j +k +l +m +SELECT * FROM t1 ORDER BY LOWER(a) DESC; +a +m +l +k +j +i +h +g +f +e +d +c +b +a +DROP TABLE t1; +select @@collation_connection; +@@collation_connection +utf8_general_ci +create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ; +insert into t1 values('abcdef'); +insert into t1 values('_bcdef'); +insert into t1 values('a_cdef'); +insert into t1 values('ab_def'); +insert into t1 values('abc_ef'); +insert into t1 values('abcd_f'); +insert into t1 values('abcde_'); +select c1 as c1u from t1 where c1 like 'ab\_def'; +c1u +ab_def +select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; +c2h +ab_def +drop table t1; ++SELECT @@collation_connection; ++@@collation_connection ++utf8_general_ci ++SELECT '\%b' LIKE '%\%'; ++'\%b' LIKE '%\%' ++0 +"BEGIN ctype_german.inc" +drop table if exists t1; +create table t1 as select repeat(' ', 64) as s1; +select collation(s1) from t1; +collation(s1) +utf8_general_ci +delete from t1; +INSERT INTO t1 VALUES ('ud'),('uf'); +INSERT INTO t1 VALUES ('od'),('of'); +INSERT INTO t1 VALUES ('e'); +INSERT INTO t1 VALUES ('ad'),('af'); +insert into t1 values ('a'),('ae'),(_latin1 0xE4); +insert into t1 values ('o'),('oe'),(_latin1 0xF6); +insert into t1 values ('s'),('ss'),(_latin1 0xDF); +insert into t1 values ('u'),('ue'),(_latin1 0xFC); +INSERT INTO t1 VALUES (_latin1 0xE6), (_latin1 0xC6); +INSERT INTO t1 VALUES (_latin1 0x9C), (_latin1 0x8C); +select s1, hex(s1) from t1 order by s1, binary s1; +s1 hex(s1) +a 61 +ä C3A4 +ad 6164 +ae 6165 +af 6166 +e 65 +o 6F +ö C3B6 +od 6F64 +oe 6F65 +of 6F66 +s 73 +ß C39F +ss 7373 +u 75 +ü C3BC +ud 7564 +ue 7565 +uf 7566 +Æ C386 +æ C3A6 +Œ C592 +œ C593 +select group_concat(s1 order by binary s1) from t1 group by s1; +group_concat(s1 order by binary s1) +a,ä +ad +ae +af +e +o,ö +od +oe +of +s,ß +ss +u,ü +ud +ue +uf +Æ,æ +Œ,œ +SELECT s1, hex(s1), hex(weight_string(s1)) FROM t1 ORDER BY s1, BINARY(s1); +s1 hex(s1) hex(weight_string(s1)) +a 61 0041 +ä C3A4 0041 +ad 6164 00410044 +ae 6165 00410045 +af 6166 00410046 +e 65 0045 +o 6F 004F +ö C3B6 004F +od 6F64 004F0044 +oe 6F65 004F0045 +of 6F66 004F0046 +s 73 0053 +ß C39F 0053 +ss 7373 00530053 +u 75 0055 +ü C3BC 0055 +ud 7564 00550044 +ue 7565 00550045 +uf 7566 00550046 +Æ C386 00C6 +æ C3A6 00C6 +Œ C592 0152 +œ C593 0152 +SELECT s1, hex(s1) FROM t1 WHERE s1='ae' ORDER BY s1, BINARY(s1); +s1 hex(s1) +ae 6165 +drop table t1; +CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1) CHARACTER SET utf8 DEFAULT NULL, + `b` int(1) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); +SELECT * FROM t1 ORDER BY a, b; +a b +s 0 +ß 1 +SELECT * FROM t1 ORDER BY a DESC, b; +a b +s 0 +ß 1 +SELECT * FROM t1 ORDER BY CONCAT(a), b; +a b +s 0 +ß 1 +SELECT * FROM t1 ORDER BY CONCAT(a) DESC, b; +a b +s 0 +ß 1 +DROP TABLE t1; +"END ctype_german.inc" +# +# MDEV-4842 STR_TO_DATE does not work with UCS2/UTF16/UTF32 +# +SELECT @@character_set_connection, HEX(CAST(_utf8'÷' AS CHAR)); +@@character_set_connection HEX(CAST(_utf8'÷' AS CHAR)) +utf8 C3B7 +SELECT STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR)); +STR_TO_DATE(CAST(_utf8'2001÷01÷01' AS CHAR),CAST(_utf8'%Y÷%m÷%d' AS CHAR)) +2001-01-01 +CREATE TABLE t1 AS SELECT REPEAT(' ', 64) AS subject, REPEAT(' ',64) AS pattern LIMIT 0; +SHOW COLUMNS FROM t1; +Field Type Null Key Default Extra +subject varchar(64) YES NULL +pattern varchar(64) YES NULL +INSERT INTO t1 VALUES (_utf8'2001÷01÷01',_utf8'%Y÷%m÷%d'); +SELECT HEX(subject),HEX(pattern),STR_TO_DATE(subject, pattern) FROM t1; +HEX(subject) HEX(pattern) STR_TO_DATE(subject, pattern) +32303031C3B73031C3B73031 2559C3B7256DC3B72564 2001-01-01 00:00:00.000000 +DROP TABLE t1; +SET collation_connection='utf8_bin'; +create table t1 select repeat('a',4000) a; +delete from t1; +insert into t1 values ('a'), ('a '), ('a\t'); +select collation(a),hex(a) from t1 order by a; +collation(a) hex(a) +utf8_bin 6109 +utf8_bin 61 +utf8_bin 6120 +drop table t1; +# +# MDEV-5453 Assertion `src' fails in my_strnxfrm_unicode on GROUP BY MID(..) WITH ROLLUP +# +SELECT @@collation_connection; +@@collation_connection +utf8_bin +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +SELECT * FROM t1 GROUP BY MID(CURRENT_USER,0) WITH ROLLUP; +i +1 +1 +SELECT * FROM t1 GROUP BY MID('test',0) WITH ROLLUP; +i +1 +1 +DROP TABLE t1; +# +# MDEV-6170 Incorrect ordering with utf8_bin and utf8mb4_bin collations +# +SELECT @@collation_connection; +@@collation_connection +utf8_bin +CREATE TABLE t1 ENGINE=MEMORY AS SELECT REPEAT('a',5) AS a LIMIT 0; +INSERT INTO t1 (a) VALUES ("a"); +INSERT INTO t1 (a) VALUES ("b"); +INSERT INTO t1 (a) VALUES ("c"); +INSERT INTO t1 (a) VALUES ("d"); +INSERT INTO t1 (a) VALUES ("e"); +INSERT INTO t1 (a) VALUES ("f"); +INSERT INTO t1 (a) VALUES ("g"); +INSERT INTO t1 (a) VALUES ("h"); +INSERT INTO t1 (a) VALUES ("i"); +INSERT INTO t1 (a) VALUES ("j"); +INSERT INTO t1 (a) VALUES ("k"); +INSERT INTO t1 (a) VALUES ("l"); +INSERT INTO t1 (a) VALUES ("m"); +SELECT * FROM t1 ORDER BY LOWER(a); +a +a +b +c +d +e +f +g +h +i +j +k +l +m +SELECT * FROM t1 ORDER BY LOWER(a) DESC; +a +m +l +k +j +i +h +g +f +e +d +c +b +a +DROP TABLE t1; +select @@collation_connection; +@@collation_connection +utf8_bin +create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ; +insert into t1 values('abcdef'); +insert into t1 values('_bcdef'); +insert into t1 values('a_cdef'); +insert into t1 values('ab_def'); +insert into t1 values('abc_ef'); +insert into t1 values('abcd_f'); +insert into t1 values('abcde_'); +select c1 as c1u from t1 where c1 like 'ab\_def'; +c1u +ab_def +select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; +c2h +ab_def +drop table t1; ++SELECT @@collation_connection; ++@@collation_connection ++utf8_bin ++SELECT '\%b' LIKE '%\%'; ++'\%b' LIKE '%\%' ++0 +CREATE TABLE t1 ( +user varchar(255) NOT NULL default '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES ('one'),('two'); +SELECT CHARSET('a'); +CHARSET('a') +utf8 +SELECT user, CONCAT('<', user, '>') AS c FROM t1; +user c +one <one> +two <two> +DROP TABLE t1; +create table t1 (f1 varchar(1) not null) default charset utf8; +insert into t1 values (''), (''); +select concat(concat(_latin1'->',f1),_latin1'<-') from t1; +concat(concat(_latin1'->',f1),_latin1'<-') +-><- +-><- +drop table t1; +select convert(_koi8r'�' using utf8) < convert(_koi8r'�' using utf8); +convert(_koi8r'�' using utf8) < convert(_koi8r'�' using utf8) +1 +set names latin1; +create table t1 (a varchar(10)) character set utf8; +insert into t1 values ('test'); +select ifnull(a,'') from t1; +ifnull(a,'') +test +drop table t1; +select repeat(_utf8'+',3) as h union select NULL; +h ++++ +NULL +select ifnull(NULL, _utf8'string'); +ifnull(NULL, _utf8'string') +string +set names utf8; +create table t1 (s1 char(5) character set utf8 collate utf8_lithuanian_ci); +insert into t1 values ('I'),('K'),('Y'); +select * from t1 where s1 < 'K' and s1 = 'Y'; +s1 +I +Y +select * from t1 where 'K' > s1 and s1 = 'Y'; +s1 +I +Y +drop table t1; +create table t1 (s1 char(5) character set utf8 collate utf8_czech_ci); +insert into t1 values ('c'),('d'),('h'),('ch'),('CH'),('cH'),('Ch'),('i'); +select * from t1 where s1 > 'd' and s1 = 'CH'; +s1 +ch +CH +Ch +select * from t1 where 'd' < s1 and s1 = 'CH'; +s1 +ch +CH +Ch +select * from t1 where s1 = 'cH' and s1 <> 'ch'; +s1 +cH +select * from t1 where 'cH' = s1 and s1 <> 'ch'; +s1 +cH +drop table t1; +create table t1 (a varchar(255)) default character set utf8; +insert into t1 values (1.0); +drop table t1; +create table t1 ( +id int not null, +city varchar(20) not null, +key (city(7),id) +) character set=utf8; +insert into t1 values (1,'Durban North'); +insert into t1 values (2,'Durban'); +select * from t1 where city = 'Durban'; +id city +2 Durban +select * from t1 where city = 'Durban '; +id city +2 Durban +drop table t1; +create table t1 (x set('A', 'B') default 0) character set utf8; +ERROR 42000: Invalid default value for 'x' +create table t1 (x enum('A', 'B') default 0) character set utf8; +ERROR 42000: Invalid default value for 'x' +SET NAMES UTF8; +CREATE TABLE t1 ( +`id` int(20) NOT NULL auto_increment, +`country` varchar(100) NOT NULL default '', +`shortcode` varchar(100) NOT NULL default '', +`operator` varchar(100) NOT NULL default '', +`momid` varchar(30) NOT NULL default '', +`keyword` varchar(160) NOT NULL default '', +`content` varchar(160) NOT NULL default '', +`second_token` varchar(160) default NULL, +`gateway_id` int(11) NOT NULL default '0', +`created` datetime NOT NULL default '0000-00-00 00:00:00', +`msisdn` varchar(15) NOT NULL default '', +PRIMARY KEY (`id`), +UNIQUE KEY `MSCCSPK_20030521130957121` (`momid`), +KEY `IX_mobile_originated_message_keyword` (`keyword`), +KEY `IX_mobile_originated_message_created` (`created`), +KEY `IX_mobile_originated_message_support` (`msisdn`,`momid`,`keyword`,`gateway_id`,`created`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +INSERT INTO t1 VALUES +(1,'blah','464','aaa','fkc1c9ilc20x0hgae7lx6j09','ERR','ERR Имри.Афимим.Аеимимримдмримрмрирор имримримримр имридм ирбднримрфмририримрфмфмим.Ад.Д имдимримрад.Адимримримрмдиримримримр м.Дадимфшьмримд им.Адимимрн имадми','ИМРИ.АФИМИМ.АЕИМИМРИМДМРИМРМРИРОР',3,'2005-06-01 17:30:43','1234567890'), +(2,'blah','464','aaa','haxpl2ilc20x00bj4tt2m5ti','11','11 g','G',3,'2005-06-02 22:43:10','1234567890'); +CREATE TABLE t2 ( +`msisdn` varchar(15) NOT NULL default '', +`operator_id` int(11) NOT NULL default '0', +`created` datetime NOT NULL default '0000-00-00 00:00:00', +UNIQUE KEY `PK_user` (`msisdn`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +INSERT INTO t2 VALUES ('1234567890',2,'2005-05-24 13:53:25'); +SELECT content, t2.msisdn FROM t1, t2 WHERE t1.msisdn = '1234567890'; +content msisdn +ERR Имри.Афимим.Аеимимримдмримрмрирор имримримримр имридм ирбднримрфмририримрфмфмим.Ад.Д имдимримрад.Адимримримрмдиримримримр м.Дадимфшьмримд им.Адимимрн имадми 1234567890 +11 g 1234567890 +DROP TABLE t1,t2; +create table t1 (a char(20) character set utf8); +insert into t1 values ('123456'),('андрей'); +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +alter table t1 modify a char(2) character set utf8; +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +Warning 1265 Data truncated for column 'a' at row 2 +select char_length(a), length(a), a from t1 order by a; +char_length(a) length(a) a +2 2 12 +2 4 ан +drop table t1; +set names utf8; +select 'andre%' like 'andreñ%' escape 'ñ'; +'andre%' like 'andreñ%' escape 'ñ' +1 +set names utf8; +select 'a\\' like 'a\\'; +'a\\' like 'a\\' +1 +select 'aa\\' like 'a%\\'; +'aa\\' like 'a%\\' +1 +create table t1 (a char(10), key(a)) character set utf8; +insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); +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; +CREATE TABLE t1 ( +a varchar(255) NOT NULL default '', +KEY a (a) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE utf8_general_ci; +insert into t1 values (_utf8 0xe880bd); +insert into t1 values (_utf8 0x5b); +select hex(a) from t1; +hex(a) +5B +E880BD +drop table t1; +set names 'latin1'; +create table t1 (a varchar(255)) default charset=utf8; +select * from t1 where find_in_set('-1', a); +a +drop table t1; +create table t1 (a int); +insert into t1 values (48),(49),(50); +set names utf8; +select distinct char(a) from t1; +char(a) +0 +1 +2 +drop table t1; +CREATE TABLE t1 (t TINYTEXT CHARACTER SET utf8); +INSERT INTO t1 VALUES(REPEAT('a', 100)); +CREATE TEMPORARY TABLE t2 SELECT COALESCE(t) AS bug FROM t1; +SELECT LENGTH(bug) FROM t2; +LENGTH(bug) +100 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (item varchar(255)) default character set utf8; +INSERT INTO t1 VALUES (N'\\'); +INSERT INTO t1 VALUES (_utf8'\\'); +INSERT INTO t1 VALUES (N'Cote d\'Ivoire'); +INSERT INTO t1 VALUES (_utf8'Cote d\'Ivoire'); +SELECT item FROM t1 ORDER BY item; +item +Cote d'Ivoire +Cote d'Ivoire +\ +\ +DROP TABLE t1; +SET NAMES utf8; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1(a VARCHAR(255), KEY(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8; +INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'); +INSERT INTO t1 VALUES('uu'); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t1 VALUES('uU'); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t1 VALUES('uu'); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t1 VALUES('uuABC'); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t1 VALUES('UuABC'); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t1 VALUES('uuABC'); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +alter table t1 add b int; +INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',1); +INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',2); +delete from t1 where b=1; +INSERT INTO t1 VALUES('UUABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',1); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',3); +INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',4); +delete from t1 where b=3; +INSERT INTO t1 VALUES('uUABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',3); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; +set names utf8; +create table t1 (s1 char(5) character set utf8); +insert into t1 values +('a'),('b'),(null),('ペテルグル'),('ü'),('Y'); +create index it1 on t1 (s1); +select s1 as before_delete_general_ci from t1 where s1 like 'ペテ%'; +before_delete_general_ci +ペテルグル +delete from t1 where s1 = 'Y'; +select s1 as after_delete_general_ci from t1 where s1 like 'ペテ%'; +after_delete_general_ci +ペテルグル +drop table t1; +set names utf8; +create table t1 (s1 char(5) character set utf8 collate utf8_unicode_ci); +insert into t1 values +('a'),('b'),(null),('ペテルグル'),('ü'),('Y'); +create index it1 on t1 (s1); +select s1 as before_delete_unicode_ci from t1 where s1 like 'ペテ%'; +before_delete_unicode_ci +ペテルグル +delete from t1 where s1 = 'Y'; +select s1 as after_delete_unicode_ci from t1 where s1 like 'ペテ%'; +after_delete_unicode_ci +ペテルグル +drop table t1; +set names utf8; +create table t1 (s1 char(5) character set utf8 collate utf8_bin); +insert into t1 values +('a'),('b'),(null),('ペテルグル'),('ü'),('Y'); +create index it1 on t1 (s1); +select s1 as before_delete_bin from t1 where s1 like 'ペテ%'; +before_delete_bin +ペテルグル +delete from t1 where s1 = 'Y'; +select s1 as after_delete_bin from t1 where s1 like 'ペテ%'; +after_delete_bin +ペテルグル +drop table t1; +set names utf8; +create table t1 (a varchar(30) not null primary key) +engine=innodb default character set utf8 collate utf8_general_ci; +insert into t1 values ('あいうえおかきくけこさしすせそ'); +insert into t1 values ('さしすせそかきくけこあいうえお'); +select a as gci1 from t1 where a like 'さしすせそかきくけこあいうえお%'; +gci1 +さしすせそかきくけこあいうえお +select a as gci2 from t1 where a like 'あいうえおかきくけこさしすせそ'; +gci2 +あいうえおかきくけこさしすせそ +drop table t1; +set names utf8; +create table t1 (a varchar(30) not null primary key) +engine=innodb default character set utf8 collate utf8_unicode_ci; +insert into t1 values ('あいうえおかきくけこさしすせそ'); +insert into t1 values ('さしすせそかきくけこあいうえお'); +select a as uci1 from t1 where a like 'さしすせそかきくけこあいうえお%'; +uci1 +さしすせそかきくけこあいうえお +select a as uci2 from t1 where a like 'あいうえおかきくけこさしすせそ'; +uci2 +あいうえおかきくけこさしすせそ +drop table t1; +set names utf8; +create table t1 (a varchar(30) not null primary key) +engine=innodb default character set utf8 collate utf8_bin; +insert into t1 values ('あいうえおかきくけこさしすせそ'); +insert into t1 values ('さしすせそかきくけこあいうえお'); +select a as bin1 from t1 where a like 'さしすせそかきくけこあいうえお%'; +bin1 +さしすせそかきくけこあいうえお +select a as bin2 from t1 where a like 'あいうえおかきくけこさしすせそ'; +bin2 +あいうえおかきくけこさしすせそ +drop table t1; +SET NAMES utf8; +CREATE TABLE t1 (id int PRIMARY KEY, +a varchar(16) collate utf8_unicode_ci NOT NULL default '', +b int, +f varchar(128) default 'XXX', +INDEX (a(4)) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +INSERT INTO t1(id, a, b) VALUES +(1, 'cccc', 50), (2, 'cccc', 70), (3, 'cccc', 30), +(4, 'cccc', 30), (5, 'cccc', 20), (6, 'bbbbbb', 40), +(7, 'dddd', 30), (8, 'aaaa', 10), (9, 'aaaa', 50), +(10, 'eeeee', 40), (11, 'bbbbbb', 60); +SELECT id, a, b FROM t1; +id a b +1 cccc 50 +2 cccc 70 +3 cccc 30 +4 cccc 30 +5 cccc 20 +6 bbbbbb 40 +7 dddd 30 +8 aaaa 10 +9 aaaa 50 +10 eeeee 40 +11 bbbbbb 60 +SELECT id, a, b FROM t1 WHERE a BETWEEN 'aaaa' AND 'bbbbbb'; +id a b +8 aaaa 10 +9 aaaa 50 +6 bbbbbb 40 +11 bbbbbb 60 +SELECT id, a FROM t1 WHERE a='bbbbbb'; +id a +6 bbbbbb +11 bbbbbb +SELECT id, a FROM t1 WHERE a='bbbbbb' ORDER BY b; +id a +6 bbbbbb +11 bbbbbb +DROP TABLE t1; +SET NAMES utf8; +CREATE TABLE t1 ( +a CHAR(13) DEFAULT '', +INDEX(a) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; +INSERT INTO t1 VALUES +('Käli Käli 2-4'), ('Käli Käli 2-4'), +('Käli Käli 2+4'), ('Käli Käli 2+4'), +('Käli Käli 2-6'), ('Käli Käli 2-6'); +INSERT INTO t1 SELECT * FROM t1; +CREATE TABLE t2 ( +a CHAR(13) DEFAULT '', +INDEX(a) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; +INSERT INTO t2 VALUES +('Kali Kali 2-4'), ('Kali Kali 2-4'), +('Kali Kali 2+4'), ('Kali Kali 2+4'), +('Kali Kali 2-6'), ('Kali Kali 2-6'); +INSERT INTO t2 SELECT * FROM t2; +SELECT a FROM t1 WHERE a LIKE 'Käli Käli 2+4'; +a +Käli Käli 2+4 +Käli Käli 2+4 +Käli Käli 2+4 +Käli Käli 2+4 +SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4'; +a +Kali Kali 2+4 +Kali Kali 2+4 +Kali Kali 2+4 +Kali Kali 2+4 +EXPLAIN SELECT a FROM t1 WHERE a LIKE 'Käli Käli 2+4'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 40 NULL 4 Using where; Using index +EXPLAIN SELECT a FROM t1 WHERE a = 'Käli Käli 2+4'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 40 const 4 Using where; Using index +EXPLAIN SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range a a 14 NULL 4 Using where; Using index +EXPLAIN SELECT a FROM t2 WHERE a = 'Kali Kali 2+4'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref a a 14 const 4 Using where; Using index +DROP TABLE t1,t2; +CREATE TABLE t1 ( +a char(255) DEFAULT '', +KEY(a(10)) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; +INSERT INTO t1 VALUES ('Käli Käli 2-4'); +SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%'; +a +Käli Käli 2-4 +INSERT INTO t1 VALUES ('Käli Käli 2-4'); +SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%'; +a +Käli Käli 2-4 +Käli Käli 2-4 +DROP TABLE t1; +CREATE TABLE t1 ( +a char(255) DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; +INSERT INTO t1 VALUES ('Käli Käli 2-4'); +INSERT INTO t1 VALUES ('Käli Käli 2-4'); +SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%'; +a +Käli Käli 2-4 +Käli Käli 2-4 +ALTER TABLE t1 ADD KEY (a(10)); +SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%'; +a +Käli Käli 2-4 +Käli Käli 2-4 +DROP TABLE t1; +SET NAMES latin2; +CREATE TABLE t1 ( +id int(11) NOT NULL default '0', +tid int(11) NOT NULL default '0', +val text NOT NULL, +INDEX idx(tid, val(10)) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +INSERT INTO t1 VALUES +(40988,72,'VOLN� ADSL'),(41009,72,'VOLN� ADSL'), +(41032,72,'VOLN� ADSL'),(41038,72,'VOLN� ADSL'), +(41063,72,'VOLN� ADSL'),(41537,72,'VOLN� ADSL Office'), +(42141,72,'VOLN� ADSL'),(42565,72,'VOLN� ADSL Combi'), +(42749,72,'VOLN� ADSL'),(44205,72,'VOLN� ADSL'); +SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLNY ADSL'; +id tid val +40988 72 VOLN� ADSL +41009 72 VOLN� ADSL +41032 72 VOLN� ADSL +41038 72 VOLN� ADSL +41063 72 VOLN� ADSL +42141 72 VOLN� ADSL +42749 72 VOLN� ADSL +44205 72 VOLN� ADSL +SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLN� ADSL'; +id tid val +40988 72 VOLN� ADSL +41009 72 VOLN� ADSL +41032 72 VOLN� ADSL +41038 72 VOLN� ADSL +41063 72 VOLN� ADSL +42141 72 VOLN� ADSL +42749 72 VOLN� ADSL +44205 72 VOLN� ADSL +SELECT * FROM t1 WHERE tid=72 and val LIKE '%VOLN� ADSL'; +id tid val +40988 72 VOLN� ADSL +41009 72 VOLN� ADSL +41032 72 VOLN� ADSL +41038 72 VOLN� ADSL +41063 72 VOLN� ADSL +42141 72 VOLN� ADSL +42749 72 VOLN� ADSL +44205 72 VOLN� ADSL +ALTER TABLE t1 DROP KEY idx; +ALTER TABLE t1 ADD KEY idx (tid,val(11)); +SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLN� ADSL'; +id tid val +40988 72 VOLN� ADSL +41009 72 VOLN� ADSL +41032 72 VOLN� ADSL +41038 72 VOLN� ADSL +41063 72 VOLN� ADSL +42141 72 VOLN� ADSL +42749 72 VOLN� ADSL +44205 72 VOLN� ADSL +DROP TABLE t1; +create table t1(a char(200) collate utf8_unicode_ci NOT NULL default '') +default charset=utf8 collate=utf8_unicode_ci; +insert into t1 values (unhex('65')), (unhex('C3A9')), (unhex('65')); +explain select distinct a from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary +select distinct a from t1; +a +e +explain select a 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 3 Using temporary; Using filesort +select a from t1 group by a; +a +e +drop table t1; +create table t1(a char(10)) default charset utf8; +insert into t1 values ('123'), ('456'); +explain +select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE Y ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +1 SIMPLE Z ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1; +substr(Z.a,-1) a +3 123 +6 456 +drop table t1; +SET CHARACTER SET utf8; +SHOW VARIABLES LIKE 'character\_set\_%'; +Variable_name Value +character_set_client utf8 +character_set_connection latin1 +character_set_database latin1 +character_set_filesystem binary +character_set_results utf8 +character_set_server latin1 +character_set_system utf8 +CREATE DATABASE crashtest DEFAULT CHARACTER SET utf8 COLLATE utf8_bin; +USE crashtest; +CREATE TABLE crashtest (crash char(10)) DEFAULT CHARSET=utf8; +INSERT INTO crashtest VALUES ('35'), ('36'), ('37'); +SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8); +crash +35 +36 +37 +INSERT INTO crashtest VALUES ('-1000'); +EXPLAIN SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE crashtest ALL NULL NULL NULL NULL 4 Using filesort +SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8); +crash +-1000 +35 +36 +37 +Warnings: +Warning 1300 Invalid utf8 character string: 'FFFFFC' +DROP TABLE crashtest; +DROP DATABASE crashtest; +USE test; +SET CHARACTER SET default; +CREATE TABLE t1(id varchar(20) NOT NULL) DEFAULT CHARSET=utf8; +INSERT INTO t1 VALUES ('xxx'), ('aa'), ('yyy'), ('aa'); +SELECT id FROM t1; +id +xxx +aa +yyy +aa +SELECT DISTINCT id FROM t1; +id +xxx +aa +yyy +SELECT DISTINCT id FROM t1 ORDER BY id; +id +aa +xxx +yyy +DROP TABLE t1; +create table t1 ( +a varchar(26) not null +) default character set utf8; +insert into t1 (a) values ('abcdefghijklmnopqrstuvwxyz'); +select * from t1; +a +abcdefghijklmnopqrstuvwxyz +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +alter table t1 change a a varchar(20) character set utf8 not null; +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +select * from t1; +a +abcdefghijklmnopqrst +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +alter table t1 change a a char(15) character set utf8 not null; +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +select * from t1; +a +abcdefghijklmno +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +alter table t1 change a a char(10) character set utf8 not null; +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +select * from t1; +a +abcdefghij +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +alter table t1 change a a varchar(5) character set utf8 not null; +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +select * from t1; +a +abcde +drop table t1; +create table t1 ( +a varchar(4000) not null +) default character set utf8; +insert into t1 values (repeat('a',4000)); +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +alter table t1 change a a varchar(3000) character set utf8 not null; +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +select length(a) from t1; +length(a) +3000 +drop table t1; +set names utf8; +select hex(char(1 using utf8)); +hex(char(1 using utf8)) +01 +select char(0xd1,0x8f using utf8); +char(0xd1,0x8f using utf8) +я +select char(0xd18f using utf8); +char(0xd18f using utf8) +я +select char(53647 using utf8); +char(53647 using utf8) +я +select char(0xff,0x8f using utf8); +char(0xff,0x8f using utf8) +NULL +Warnings: +Warning 1300 Invalid utf8 character string: 'FF8F' +select convert(char(0xff,0x8f) using utf8); +convert(char(0xff,0x8f) using utf8) +?? +Warnings: +Warning 1300 Invalid utf8 character string: '\xFF\x8F' +set sql_mode=traditional; +select char(0xff,0x8f using utf8); +char(0xff,0x8f using utf8) +NULL +Warnings: +Warning 1300 Invalid utf8 character string: 'FF8F' +select char(195 using utf8); +char(195 using utf8) +NULL +Warnings: +Warning 1300 Invalid utf8 character string: 'C3' +select char(196 using utf8); +char(196 using utf8) +NULL +Warnings: +Warning 1300 Invalid utf8 character string: 'C4' +select char(2557 using utf8); +char(2557 using utf8) +NULL +Warnings: +Warning 1300 Invalid utf8 character string: 'FD' +select convert(char(0xff,0x8f) using utf8); +convert(char(0xff,0x8f) using utf8) +?? +Warnings: +Warning 1300 Invalid utf8 character string: '\xFF\x8F' +select hex(convert(char(2557 using latin1) using utf8)); +hex(convert(char(2557 using latin1) using utf8)) +09C3BD +select hex(char(195)); +hex(char(195)) +C3 +select hex(char(196)); +hex(char(196)) +C4 +select hex(char(2557)); +hex(char(2557)) +09FD +set names utf8; +create table t1 (a char(1)) default character set utf8; +create table t2 (a char(1)) default character set utf8; +insert into t1 values('a'),('a'),(0xE38182),(0xE38182); +insert into t1 values('i'),('i'),(0xE38184),(0xE38184); +select * from t1 union distinct select * from t2; +a +a +あ +i +い +drop table t1,t2; +set names utf8; +create table t1 (a char(10), b varchar(10)); +insert into t1 values ('bar','kostja'); +insert into t1 values ('kostja','bar'); +prepare my_stmt from "select * from t1 where a=?"; +set @a:='bar'; +execute my_stmt using @a; +a b +bar kostja +set @a:='kostja'; +execute my_stmt using @a; +a b +kostja bar +set @a:=null; +execute my_stmt using @a; +a b +drop table if exists t1; +drop table if exists t1; +drop view if exists v1, v2; +set names utf8; +create table t1(col1 varchar(12) character set utf8 collate utf8_unicode_ci); +insert into t1 values('t1_val'); +create view v1 as select 'v1_val' as col1; +select coercibility(col1), collation(col1) from v1; +coercibility(col1) collation(col1) +4 utf8_general_ci +create view v2 as select col1 from v1 union select col1 from t1; +select coercibility(col1), collation(col1)from v2; +coercibility(col1) collation(col1) +2 utf8_unicode_ci +2 utf8_unicode_ci +drop view v1, v2; +create view v1 as select 'v1_val' collate utf8_swedish_ci as col1; +select coercibility(col1), collation(col1) from v1; +coercibility(col1) collation(col1) +0 utf8_swedish_ci +create view v2 as select col1 from v1 union select col1 from t1; +select coercibility(col1), collation(col1) from v2; +coercibility(col1) collation(col1) +0 utf8_swedish_ci +0 utf8_swedish_ci +drop view v1, v2; +drop table t1; +set names utf8; +create table t1 (a varchar(10) character set latin1, b int); +insert into t1 values ('a',1); +select concat(a, if(b>10, N'x', N'y')) from t1; +concat(a, if(b>10, N'x', N'y')) +ay +select concat(a, if(b>10, N'æ', N'ß')) from t1; +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'concat' +drop table t1; +set names utf8; +create table t1 (a varchar(10) character set latin1, b int); +insert into t1 values ('a',1); +select concat(a, if(b>10, _utf8'x', _utf8'y')) from t1; +concat(a, if(b>10, _utf8'x', _utf8'y')) +ay +select concat(a, if(b>10, _utf8'æ', _utf8'ß')) from t1; +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'concat' +drop table t1; +set names utf8; +create table t1 (a varchar(10) character set latin1, b int); +insert into t1 values ('a',1); +select concat(a, if(b>10, _utf8 0x78, _utf8 0x79)) from t1; +concat(a, if(b>10, _utf8 0x78, _utf8 0x79)) +ay +select concat(a, if(b>10, _utf8 0xC3A6, _utf8 0xC3AF)) from t1; +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'concat' +drop table t1; +set names utf8; +create table t1 (a varchar(10) character set latin1, b int); +insert into t1 values ('a',1); +select concat(a, if(b>10, 'x' 'x', 'y' 'y')) from t1; +concat(a, if(b>10, 'x' 'x', 'y' 'y')) +ayy +select concat(a, if(b>10, 'x' 'æ', 'y' 'ß')) from t1; +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'concat' +drop table t1; +CREATE TABLE t1 ( +colA int(11) NOT NULL, +colB varchar(255) character set utf8 NOT NULL, +PRIMARY KEY (colA) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t1 (colA, colB) VALUES (1, 'foo'), (2, 'foo bar'); +CREATE TABLE t2 ( +colA int(11) NOT NULL, +colB varchar(255) character set utf8 NOT NULL, +KEY bad (colA,colB(3)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t2 (colA, colB) VALUES (1, 'foo'),(2, 'foo bar'); +SELECT * FROM t1 JOIN t2 ON t1.colA=t2.colA AND t1.colB=t2.colB +WHERE t1.colA < 3; +colA colB colA colB +1 foo 1 foo +2 foo bar 2 foo bar +DROP TABLE t1, t2; +SELECT 'н1234567890' UNION SELECT _binary '1'; +н1234567890 +н1234567890 +1 +SELECT 'н1234567890' UNION SELECT 1; +н1234567890 +н1234567890 +1 +SELECT '1' UNION SELECT 'н1234567890'; +1 +1 +н1234567890 +SELECT 1 UNION SELECT 'н1234567890'; +1 +1 +н1234567890 +CREATE TABLE t1 (c VARCHAR(11)) CHARACTER SET utf8; +CREATE TABLE t2 (b CHAR(1) CHARACTER SET binary, i INT); +INSERT INTO t1 (c) VALUES ('н1234567890'); +INSERT INTO t2 (b, i) VALUES ('1', 1); +SELECT c FROM t1 UNION SELECT b FROM t2; +c +н1234567890 +1 +SELECT c FROM t1 UNION SELECT i FROM t2; +c +н1234567890 +1 +SELECT b FROM t2 UNION SELECT c FROM t1; +b +1 +н1234567890 +SELECT i FROM t2 UNION SELECT c FROM t1; +i +1 +н1234567890 +DROP TABLE t1, t2; +set sql_mode=traditional; +select hex(char(0xFF using utf8)); +hex(char(0xFF using utf8)) +NULL +Warnings: +Warning 1300 Invalid utf8 character string: 'FF' +select hex(convert(0xFF using utf8)); +hex(convert(0xFF using utf8)) +3F +Warnings: +Warning 1300 Invalid utf8 character string: '\xFF' +select hex(_utf8 0x616263FF); +ERROR HY000: Invalid utf8 character string: 'FF' +select hex(_utf8 X'616263FF'); +ERROR HY000: Invalid utf8 character string: 'FF' +select hex(_utf8 B'001111111111'); +ERROR HY000: Invalid utf8 character string: 'FF' +select (_utf8 X'616263FF'); +ERROR HY000: Invalid utf8 character string: 'FF' +set sql_mode=default; +select hex(char(0xFF using utf8)); +hex(char(0xFF using utf8)) +NULL +Warnings: +Warning 1300 Invalid utf8 character string: 'FF' +select hex(convert(0xFF using utf8)); +hex(convert(0xFF using utf8)) +3F +Warnings: +Warning 1300 Invalid utf8 character string: '\xFF' +select hex(_utf8 0x616263FF); +ERROR HY000: Invalid utf8 character string: 'FF' +select hex(_utf8 X'616263FF'); +ERROR HY000: Invalid utf8 character string: 'FF' +select hex(_utf8 B'001111111111'); +ERROR HY000: Invalid utf8 character string: 'FF' +select (_utf8 X'616263FF'); +ERROR HY000: Invalid utf8 character string: 'FF' +# +# Bug#44131 Binary-mode "order by" returns records in incorrect order for UTF-8 strings +# +CREATE TABLE t1 (id int not null primary key, name varchar(10)) character set utf8; +INSERT INTO t1 VALUES +(2,'一二三01'),(3,'一二三09'),(4,'一二三02'),(5,'一二三08'), +(6,'一二三11'),(7,'一二三91'),(8,'一二三21'),(9,'一二三81'); +SELECT * FROM t1 ORDER BY BINARY(name); +id name +2 一二三01 +4 一二三02 +5 一二三08 +3 一二三09 +6 一二三11 +8 一二三21 +9 一二三81 +7 一二三91 +DROP TABLE t1; +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL); +INSERT INTO t1 VALUES (70000, 1092), (70001, 1085), (70002, 1065); +SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b; +CONVERT(a, CHAR) CONVERT(b, CHAR) +70002 1065 +70001 1085 +70000 1092 +SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1; +CONVERT(a, CHAR) CONVERT(b, CHAR) +70000 1092 +70001 1085 +70002 1065 +ALTER TABLE t1 ADD UNIQUE (b); +SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b; +CONVERT(a, CHAR) CONVERT(b, CHAR) +70002 1065 +70001 1085 +70000 1092 +DROP INDEX b ON t1; +SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b; +CONVERT(a, CHAR) CONVERT(b, CHAR) +70002 1065 +70001 1085 +70000 1092 +ALTER TABLE t1 ADD INDEX (b); +SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) from t1 GROUP BY b; +CONVERT(a, CHAR) CONVERT(b, CHAR) +70002 1065 +70001 1085 +70000 1092 +DROP TABLE t1; +End of 5.0 tests +SELECT LENGTH(RPAD(0.0115E88, 61297, _utf8'яэюя')); +LENGTH(RPAD(0.0115E88, 61297, _utf8'яэюя')) +122587 +SELECT LENGTH(RPAD(0.0115E88, 61297, _utf8'йцуя')); +LENGTH(RPAD(0.0115E88, 61297, _utf8'йцуя')) +122587 +SELECT HEX(RPAD(0x20, 2, _utf8 0xD18F)); +HEX(RPAD(0x20, 2, _utf8 0xD18F)) +20D1 +SELECT HEX(RPAD(0x20, 4, _utf8 0xD18F)); +HEX(RPAD(0x20, 4, _utf8 0xD18F)) +20D18FD1 +SELECT HEX(LPAD(0x20, 2, _utf8 0xD18F)); +HEX(LPAD(0x20, 2, _utf8 0xD18F)) +D120 +SELECT HEX(LPAD(0x20, 4, _utf8 0xD18F)); +HEX(LPAD(0x20, 4, _utf8 0xD18F)) +D18FD120 +SELECT HEX(RPAD(_utf8 0xD18F, 3, 0x20)); +HEX(RPAD(_utf8 0xD18F, 3, 0x20)) +D18F20 +SELECT HEX(LPAD(_utf8 0xD18F, 3, 0x20)); +HEX(LPAD(_utf8 0xD18F, 3, 0x20)) +20D18F +SELECT HEX(INSERT(_utf8 0xD18F, 2, 1, 0x20)); +HEX(INSERT(_utf8 0xD18F, 2, 1, 0x20)) +D120 +SELECT HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20)); +HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20)) +D120D18E +# +# Bug#11752408 - 43593: DUMP/BACKUP/RESTORE/UPGRADE TOOLS FAILS BECAUSE OF UTF8_GENERAL_CI +# +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_general_mysql500_ci); +INSERT INTO t1 VALUES ('a'),('r'),('s'),(_latin1 0xDF),(_latin1 0xF7),('t'),('z'); +SELECT * FROM t1 ORDER BY a; +a +a +r +s +t +z +ß +÷ +SELECT a, COUNT(*) FROM t1 GROUP BY a; +a COUNT(*) +a 1 +r 1 +s 1 +t 1 +z 1 +ß 1 +÷ 1 +DROP TABLE t1; +End of 5.1 tests +Start of 5.4 tests +SET NAMES utf8mb3; +SHOW VARIABLES LIKE 'character_set_results%'; +Variable_name Value +character_set_results utf8 +CREATE TABLE t1 (a CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_bin); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(1) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +SELECT _utf8mb3'test'; +test +test +CREATE TABLE t1 ( +clipid INT NOT NULL, +Tape TINYTEXT, +PRIMARY KEY (clipid), +KEY tape(Tape(255)) +) CHARACTER SET=utf8; +ALTER TABLE t1 ADD mos TINYINT DEFAULT 0 AFTER clipid; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `clipid` int(11) NOT NULL, + `mos` tinyint(4) DEFAULT 0, + `Tape` tinytext DEFAULT NULL, + PRIMARY KEY (`clipid`), + KEY `tape` (`Tape`(255)) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +DROP TABLE t1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +predicted_order int NOT NULL, +utf8_encoding VARCHAR(10) NOT NULL +) CHARACTER SET utf8; +INSERT INTO t1 VALUES (19, x'E0B696'), (30, x'E0B69AE0B798'), (61, x'E0B6AF'), (93, x'E0B799'), (52, x'E0B6A6'), (73, x'E0B6BBE0B78AE2808D'), (3, x'E0B686'), (56, x'E0B6AA'), (55, x'E0B6A9'), (70, x'E0B6B9'), (94, x'E0B79A'), (80, x'E0B785'), (25, x'E0B69AE0B791'), (48, x'E0B6A2'), (13, x'E0B690'), (86, x'E0B793'), (91, x'E0B79F'), (81, x'E0B786'), (79, x'E0B784'), (14, x'E0B691'), (99, x'E0B78A'), (8, x'E0B68B'), (68, x'E0B6B7'), (22, x'E0B69A'), (16, x'E0B693'), (33, x'E0B69AE0B7B3'), (38, x'E0B69AE0B79D'), (21, x'E0B683'), (11, x'E0B68E'), (77, x'E0B782'), (40, x'E0B69AE0B78A'), (101, x'E0B78AE2808DE0B6BB'), (35, x'E0B69AE0B79A'), (1, x'E0B7B4'), (9, x'E0B68C'), (96, x'E0B79C'), (6, x'E0B689'), (95, x'E0B79B'), (88, x'E0B796'), (64, x'E0B6B3'), (26, x'E0B69AE0B792'), (82, x'E0B78F'), (28, x'E0B69AE0B794'), (39, x'E0B69AE0B79E'), (97, x'E0B79D'), (2, x'E0B685'), (75, x'E0B780'), (34, x'E0B69AE0B799'), (69, x'E0B6B8'), (83, x'E0B790'), (18, x'E0B695'), (90, x'E0B7B2'), (17 , x'E0B694'), (72, x'E0B6BB'), (66, x'E0B6B5'), (59, x'E0B6AD'), (44, x'E0B69E'), (15, x'E0B692'), (23, x'E0B69AE0B78F'), (65, x'E0B6B4'), (42, x'E0B69C'), (63, x'E0B6B1'), (85, x'E0B792'), (47, x'E0B6A1'), (49, x'E0B6A3'), (92, x'E0B7B3'), (78, x'E0B783'), (36, x'E0B69AE0B79B'), (4, x'E0B687'), (24, x'E0B69AE0B790'), (87, x'E0B794'), (37, x'E0B69AE0B79C'), (32, x'E0B69AE0B79F'), (29, x'E0B69AE0B796'), (43, x'E0B69D'), (62, x'E0B6B0'), (100, x'E0B78AE2808DE0B6BA'), (60, x'E0B6AE'), (45, x'E0B69F'), (12, x'E0B68F'), (46, x'E0B6A0'), (50, x'E0B6A5'), (51, x'E0B6A4'), (5, x'E0B688'), (76, x'E0B781'), (89, x'E0B798'), (74, x'E0B6BD'), (10, x'E0B68D'), (57, x'E0B6AB'), (71, x'E0B6BA'), (58, x'E0B6AC'), (27, x'E0B69AE0B793'), (54, x'E0B6A8'), (84, x'E0B791'), (31, x'E0B69AE0B7B2'), (98, x'E0B79E'), (53, x'E0B6A7'), (41, x'E0B69B'), (67, x'E0B6B6'), (7, x'E0B68A'), (20, x'E0B682'); +SELECT predicted_order, hex(utf8_encoding) FROM t1 ORDER BY utf8_encoding COLLATE utf8_sinhala_ci; +predicted_order hex(utf8_encoding) +1 E0B7B4 +2 E0B685 +3 E0B686 +4 E0B687 +5 E0B688 +6 E0B689 +7 E0B68A +8 E0B68B +9 E0B68C +10 E0B68D +11 E0B68E +12 E0B68F +13 E0B690 +14 E0B691 +15 E0B692 +16 E0B693 +17 E0B694 +18 E0B695 +19 E0B696 +20 E0B682 +21 E0B683 +22 E0B69A +23 E0B69AE0B78F +24 E0B69AE0B790 +25 E0B69AE0B791 +26 E0B69AE0B792 +27 E0B69AE0B793 +28 E0B69AE0B794 +29 E0B69AE0B796 +30 E0B69AE0B798 +31 E0B69AE0B7B2 +32 E0B69AE0B79F +33 E0B69AE0B7B3 +34 E0B69AE0B799 +35 E0B69AE0B79A +36 E0B69AE0B79B +37 E0B69AE0B79C +38 E0B69AE0B79D +39 E0B69AE0B79E +40 E0B69AE0B78A +41 E0B69B +42 E0B69C +43 E0B69D +44 E0B69E +45 E0B69F +46 E0B6A0 +47 E0B6A1 +48 E0B6A2 +49 E0B6A3 +50 E0B6A5 +51 E0B6A4 +52 E0B6A6 +53 E0B6A7 +54 E0B6A8 +55 E0B6A9 +56 E0B6AA +57 E0B6AB +58 E0B6AC +59 E0B6AD +60 E0B6AE +61 E0B6AF +62 E0B6B0 +63 E0B6B1 +64 E0B6B3 +65 E0B6B4 +66 E0B6B5 +67 E0B6B6 +68 E0B6B7 +69 E0B6B8 +70 E0B6B9 +71 E0B6BA +72 E0B6BB +73 E0B6BBE0B78AE2808D +74 E0B6BD +75 E0B780 +76 E0B781 +77 E0B782 +78 E0B783 +79 E0B784 +80 E0B785 +81 E0B786 +82 E0B78F +83 E0B790 +84 E0B791 +85 E0B792 +86 E0B793 +87 E0B794 +88 E0B796 +89 E0B798 +90 E0B7B2 +91 E0B79F +92 E0B7B3 +93 E0B799 +94 E0B79A +95 E0B79B +96 E0B79C +97 E0B79D +98 E0B79E +99 E0B78A +100 E0B78AE2808DE0B6BA +101 E0B78AE2808DE0B6BB +DROP TABLE t1; +SET NAMES utf8 COLLATE utf8_sinhala_ci; +CREATE TABLE t1 (s1 VARCHAR(10) COLLATE utf8_sinhala_ci); +INSERT INTO t1 VALUES ('a'),('ae'),('af'); +SELECT s1,hex(s1) FROM t1 ORDER BY s1; +s1 hex(s1) +a 61 +ae 6165 +af 6166 +SELECT * FROM t1 ORDER BY s1; +s1 +a +ae +af +DROP TABLE t1; +End of 5.4 tests +# +# Start of 5.5 tests +# +# +# Bug#52520 Difference in tinytext utf column metadata +# +CREATE TABLE t1 ( +s1 TINYTEXT CHARACTER SET utf8, +s2 TEXT CHARACTER SET utf8, +s3 MEDIUMTEXT CHARACTER SET utf8, +s4 LONGTEXT CHARACTER SET utf8 +); +SET NAMES utf8, @@character_set_results=NULL; +SELECT *, HEX(s1) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 s1 s1 252 255 0 Y 16 0 33 +def test t1 t1 s2 s2 252 65535 0 Y 16 0 33 +def test t1 t1 s3 s3 252 16777215 0 Y 16 0 33 +def test t1 t1 s4 s4 252 4294967295 0 Y 16 0 33 +def HEX(s1) 253 4590 0 Y 0 0 33 +s1 s2 s3 s4 HEX(s1) +SET NAMES latin1; +SELECT *, HEX(s1) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 s1 s1 252 255 0 Y 16 0 8 +def test t1 t1 s2 s2 252 65535 0 Y 16 0 8 +def test t1 t1 s3 s3 252 16777215 0 Y 16 0 8 +def test t1 t1 s4 s4 252 4294967295 0 Y 16 0 8 +def HEX(s1) 253 1530 0 Y 0 0 8 +s1 s2 s3 s4 HEX(s1) +SET NAMES utf8; +SELECT *, HEX(s1) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 s1 s1 252 765 0 Y 16 0 33 +def test t1 t1 s2 s2 252 196605 0 Y 16 0 33 +def test t1 t1 s3 s3 252 50331645 0 Y 16 0 33 +def test t1 t1 s4 s4 252 4294967295 0 Y 16 0 33 +def HEX(s1) 253 4590 0 Y 0 0 33 +s1 s2 s3 s4 HEX(s1) +CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `CONCAT(s1)` varchar(255) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +SET NAMES utf8; +SET TIME_ZONE = _latin1 '+03:00'; +# +# Start of WL#2649 Number-to-string conversions +# +select hex(concat(1)); +hex(concat(1)) +31 +create table t1 as select concat(1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select hex(c1) from t1; +hex(c1) +31 +drop table t1; +select hex(concat(18446744073709551615)); +hex(concat(18446744073709551615)) +3138343436373434303733373039353531363135 +create table t1 as select concat(18446744073709551615) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(20) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select hex(c1) from t1; +hex(c1) +3138343436373434303733373039353531363135 +drop table t1; +select hex(concat(1.1)); +hex(concat(1.1)) +312E31 +create table t1 as select concat(1.1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select hex(c1) from t1; +hex(c1) +312E31 +drop table t1; +select hex(concat('a', 1+2)), charset(concat(1+2)); +hex(concat('a', 1+2)) charset(concat(1+2)) +6133 utf8 +create table t1 as select concat(1+2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(1-2)); +hex(concat(1-2)) +2D31 +create table t1 as select concat(1-2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(1*2)); +hex(concat(1*2)) +32 +create table t1 as select concat(1*2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(1/2)); +hex(concat(1/2)) +302E35303030 +create table t1 as select concat(1/2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(7) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(1 div 2)); +hex(concat(1 div 2)) +30 +create table t1 as select concat(1 div 2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(1 % 2)); +hex(concat(1 % 2)) +31 +create table t1 as select concat(1 % 2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(-1)); +hex(concat(-1)) +2D31 +create table t1 as select concat(-1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(-(1+2))); +hex(concat(-(1+2))) +2D33 +create table t1 as select concat(-(1+2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(1|2)); +hex(concat(1|2)) +33 +create table t1 as select concat(1|2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(1&2)); +hex(concat(1&2)) +30 +create table t1 as select concat(1&2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(bit_count(12))); +hex(concat(bit_count(12))) +32 +create table t1 as select concat(bit_count(12)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(2<<1)); +hex(concat(2<<1)) +34 +create table t1 as select concat(2<<1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(2>>1)); +hex(concat(2>>1)) +31 +create table t1 as select concat(2>>1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(~0)); +hex(concat(~0)) +3138343436373434303733373039353531363135 +create table t1 as select concat(~0) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(3^2)); +hex(concat(3^2)) +31 +create table t1 as select concat(3^2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(abs(-2))); +hex(concat(abs(-2))) +32 +create table t1 as select concat(abs(-2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(exp(2)),1)); +hex(left(concat(exp(2)),1)) +37 +create table t1 as select concat(exp(2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(log(2)),1)); +hex(left(concat(log(2)),1)) +30 +create table t1 as select concat(log(2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(log2(2)),1)); +hex(left(concat(log2(2)),1)) +31 +create table t1 as select concat(log2(2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(log10(2)),1)); +hex(left(concat(log10(2)),1)) +30 +create table t1 as select concat(log10(2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(sqrt(2)),1)); +hex(left(concat(sqrt(2)),1)) +31 +create table t1 as select concat(sqrt(2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(pow(2,2)),1)); +hex(left(concat(pow(2,2)),1)) +34 +create table t1 as select concat(pow(2,2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(acos(0.5)),1)); +hex(left(concat(acos(0.5)),1)) +31 +create table t1 as select concat(acos(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(asin(0.5)),1)); +hex(left(concat(asin(0.5)),1)) +30 +create table t1 as select concat(asin(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(atan(0.5)),1)); +hex(left(concat(atan(0.5)),1)) +30 +create table t1 as select concat(atan(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(cos(0.5)),1)); +hex(left(concat(cos(0.5)),1)) +30 +create table t1 as select concat(cos(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(sin(0.5)),1)); +hex(left(concat(sin(0.5)),1)) +30 +create table t1 as select concat(sin(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(tan(0.5)),1)); +hex(left(concat(tan(0.5)),1)) +30 +create table t1 as select concat(tan(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(degrees(0))); +hex(concat(degrees(0))) +30 +create table t1 as select concat(degrees(0)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(radians(0))); +hex(concat(radians(0))) +30 +create table t1 as select concat(radians(0)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(ceiling(0.5))); +hex(concat(ceiling(0.5))) +31 +create table t1 as select concat(ceiling(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(floor(0.5))); +hex(concat(floor(0.5))) +30 +create table t1 as select concat(floor(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(round(0.5))); +hex(concat(round(0.5))) +31 +create table t1 as select concat(round(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(sign(0.5))); +hex(concat(sign(0.5))) +31 +create table t1 as select concat(sign(0.5)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(rand()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(length('a'))); +hex(concat(length('a'))) +31 +create table t1 as select concat(length('a')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(char_length('a'))); +hex(concat(char_length('a'))) +31 +create table t1 as select concat(char_length('a')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(bit_length('a'))); +hex(concat(bit_length('a'))) +38 +create table t1 as select concat(bit_length('a')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(11) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(coercibility('a'))); +hex(concat(coercibility('a'))) +34 +create table t1 as select concat(coercibility('a')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(locate('a','a'))); +hex(concat(locate('a','a'))) +31 +create table t1 as select concat(locate('a','a')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(11) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(field('c','a','b','c'))); +hex(concat(field('c','a','b','c'))) +33 +create table t1 as select concat(field('c','a','b','c')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(ascii(61))); +hex(concat(ascii(61))) +3534 +create table t1 as select concat(ascii(61)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(ord(61))); +hex(concat(ord(61))) +3534 +create table t1 as select concat(ord(61)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(7) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(find_in_set('b','a,b,c,d'))); +hex(concat(find_in_set('b','a,b,c,d'))) +32 +create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select md5('a'), hex(md5('a')); +md5('a') hex(md5('a')) +0cc175b9c0f1b6a831c399e269772661 3063633137356239633066316236613833316333393965323639373732363631 +create table t1 as select md5('a') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(32) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select old_password('a'), hex(old_password('a')); +old_password('a') hex(old_password('a')) +60671c896665c3fa 36303637316338393636363563336661 +create table t1 as select old_password('a') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(16) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select password('a'), hex(password('a')); +password('a') hex(password('a')) +*667F407DE7C6AD07358FA38DAED7828A72014B4E 2A36363746343037444537433641443037333538464133384441454437383238413732303134423445 +create table t1 as select password('a') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(41) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select sha('a'), hex(sha('a')); +sha('a') hex(sha('a')) +86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 38366637653433376661613561376663653135643164646362396561656165613337373636376238 +create table t1 as select sha('a') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(40) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select sha1('a'), hex(sha1('a')); +sha1('a') hex(sha1('a')) +86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 38366637653433376661613561376663653135643164646362396561656165613337373636376238 +create table t1 as select sha1('a') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(40) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(cast('-1' as signed))); +hex(concat(cast('-1' as signed))) +2D31 +create table t1 as select concat(cast('-1' as signed)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(cast('1' as unsigned))); +hex(concat(cast('1' as unsigned))) +31 +create table t1 as select concat(cast('1' as unsigned)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(cast(1/2 as decimal(5,5)))); +hex(concat(cast(1/2 as decimal(5,5)))) +302E3530303030 +create table t1 as select concat(cast(1/2 as decimal(5,5))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(7) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(cast('2001-01-02 03:04:05' as date))); +hex(concat(cast('2001-01-02 03:04:05' as date))) +323030312D30312D3032 +create table t1 as select concat(cast('2001-01-02 03:04:05' as date)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t1; +c1 +2001-01-02 +drop table t1; +select hex(concat(cast('2001-01-02 03:04:05' as time))); +hex(concat(cast('2001-01-02 03:04:05' as time))) +30333A30343A3035 +create table t1 as select concat(cast('2001-01-02 03:04:05' as time)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t1; +c1 +03:04:05 +drop table t1; +select hex(concat(cast('2001-01-02' as datetime))); +hex(concat(cast('2001-01-02' as datetime))) +323030312D30312D30322030303A30303A3030 +create table t1 as select concat(cast('2001-01-02' as datetime)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(19) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t1; +c1 +2001-01-02 00:00:00 +drop table t1; +select hex(concat(least(1,2))); +hex(concat(least(1,2))) +31 +create table t1 as select concat(least(1,2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(greatest(1,2))); +hex(concat(greatest(1,2))) +32 +create table t1 as select concat(greatest(1,2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(case when 11 then 22 else 33 end)); +hex(concat(case when 11 then 22 else 33 end)) +3232 +create table t1 as select concat(case when 11 then 22 else 33 end) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(coalesce(1,2))); +hex(concat(coalesce(1,2))) +31 +create table t1 as select concat(coalesce(1,2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat_ws(1,2,3)); +hex(concat_ws(1,2,3)) +323133 +create table t1 as select concat_ws(1,2,3) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(group_concat(1,2,3)); +hex(group_concat(1,2,3)) +313233 +create table t1 as select group_concat(1,2,3) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` mediumtext CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select 1 as c1 union select 'a'; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select hex(c1) from t1 order by c1; +hex(c1) +31 +61 +drop table t1; +create table t1 as select concat(last_insert_id()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(benchmark(0,0))); +hex(concat(benchmark(0,0))) +30 +create table t1 as select concat(benchmark(0,0)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(sleep(0))); +hex(concat(sleep(0))) +30 +create table t1 as select concat(sleep(0)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(is_free_lock('xxxx'))); +hex(concat(is_free_lock('xxxx'))) +31 +create table t1 as select concat(is_free_lock('xxxx')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(is_used_lock('a')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(release_lock('a')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(crc32(''))); +hex(concat(crc32(''))) +30 +create table t1 as select concat(crc32('')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(uncompressed_length(''))); +hex(concat(uncompressed_length(''))) +30 +create table t1 as select concat(uncompressed_length('')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(connection_id()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(inet_aton('127.1.1.1'))); +hex(concat(inet_aton('127.1.1.1'))) +32313330373732323235 +create table t1 as select concat(inet_aton('127.1.1.1')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(inet_ntoa(2130772225))); +hex(concat(inet_ntoa(2130772225))) +3132372E312E312E31 +create table t1 as select concat(inet_ntoa(2130772225)) as c1; +select * from t1; +c1 +127.1.1.1 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(31) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select 1; +1 +1 +select hex(concat(row_count())); +hex(concat(row_count())) +2D31 +create table t1 as select concat(row_count()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(found_rows())); +hex(concat(found_rows())) +30 +create table t1 as select concat(found_rows()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(uuid_short()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(uuid()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(36) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select coercibility(uuid()), coercibility(cast('a' as char character set latin1)); +coercibility(uuid()) coercibility(cast('a' as char character set latin1)) +4 2 +select charset(concat(uuid(), cast('a' as char character set latin1))); +charset(concat(uuid(), cast('a' as char character set latin1))) +latin1 +create table t1 as select concat(uuid(), cast('a' as char character set latin1)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(37) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(master_pos_wait('non-existent',0,2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(@a1:=1)); +hex(concat(@a1:=1)) +31 +create table t1 as select concat(@a2:=2) as c1, @a3:=3 as c2; +select hex(c1) from t1; +hex(c1) +32 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL, + `c2` int(1) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +set @a2=1; +select hex(concat(@a2)); +hex(concat(@a2)) +31 +create table t1 as select concat(@a2) as c1, @a2 as c2; +select hex(c1) from t1; +hex(c1) +31 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(20) CHARACTER SET utf8 DEFAULT NULL, + `c2` bigint(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(@a1:=sqrt(1))); +hex(concat(@a1:=sqrt(1))) +31 +create table t1 as select concat(@a2:=sqrt(1)) as c1, @a3:=sqrt(1) as c2; +select hex(c1) from t1; +hex(c1) +31 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL, + `c2` double DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +set @a2=sqrt(1); +select hex(concat(@a2)); +hex(concat(@a2)) +31 +create table t1 as select concat(@a2) as c1, @a2 as c2; +select hex(c1) from t1; +hex(c1) +31 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL, + `c2` double DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(@a1:=1.1)); +hex(concat(@a1:=1.1)) +312E31 +create table t1 as select concat(@a2:=1.1) as c1, @a3:=1.1 as c2; +select hex(c1) from t1; +hex(c1) +312E31 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) CHARACTER SET utf8 DEFAULT NULL, + `c2` decimal(2,1) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +set @a2=1.1; +select hex(concat(@a2)); +hex(concat(@a2)) +312E31 +create table t1 as select concat(@a2) as c1, @a2 as c2; +select hex(c1) from t1; +hex(c1) +312E31 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(83) CHARACTER SET utf8 DEFAULT NULL, + `c2` decimal(65,38) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(@@ft_max_word_len)); +hex(concat(@@ft_max_word_len)) +3834 +create table t1 as select concat(@@ft_max_word_len) as c1; +select hex(c1) from t1; +hex(c1) +3834 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat('a'='a' IS TRUE)); +hex(concat('a'='a' IS TRUE)) +31 +create table t1 as select concat('a'='a' IS TRUE) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat('a'='a' IS NOT TRUE)); +hex(concat('a'='a' IS NOT TRUE)) +30 +create table t1 as select concat('a'='a' IS NOT TRUE) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(NOT 'a'='a')); +hex(concat(NOT 'a'='a')) +30 +create table t1 as select concat(NOT 'a'='a') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat('a' IS NULL)); +hex(concat('a' IS NULL)) +30 +create table t1 as select concat('a' IS NULL) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat('a' IS NOT NULL)); +hex(concat('a' IS NOT NULL)) +31 +create table t1 as select concat('a' IS NOT NULL) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat('a' rlike 'a')); +hex(concat('a' rlike 'a')) +31 +create table t1 as select concat('a' IS NOT NULL) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(strcmp('a','b'))); +hex(concat(strcmp('a','b'))) +2D31 +create table t1 as select concat(strcmp('a','b')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat('a' like 'a')); +hex(concat('a' like 'a')) +31 +create table t1 as select concat('a' like 'b') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat('a' between 'b' and 'c')); +hex(concat('a' between 'b' and 'c')) +30 +create table t1 as select concat('a' between 'b' and 'c') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat('a' in ('a','b'))); +hex(concat('a' in ('a','b'))) +31 +create table t1 as select concat('a' in ('a','b')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(interval(23, 1, 15, 17, 30, 44, 200))); +hex(concat(interval(23, 1, 15, 17, 30, 44, 200))) +33 +create table t1 as select concat(interval(23, 1, 15, 17, 30, 44, 200)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 (a varchar(10), fulltext key(a)); +insert into t1 values ('a'); +select hex(concat(match (a) against ('a'))) from t1; +hex(concat(match (a) against ('a'))) +30 +create table t2 as select concat(match (a) against ('a')) as a from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` varchar(23) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +select hex(ifnull(1,'a')); +hex(ifnull(1,'a')) +31 +create table t1 as select ifnull(1,'a') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(ifnull(1,1))); +hex(concat(ifnull(1,1))) +31 +create table t1 as select concat(ifnull(1,1)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(ifnull(1.1,1.1))); +hex(concat(ifnull(1.1,1.1))) +312E31 +create table t1 as select concat(ifnull(1.1,1.1)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(if(1,'b',1)); +hex(if(1,'b',1)) +62 +create table t1 as select if(1,'b',1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(if(1,1,'b')); +hex(if(1,1,'b')) +31 +create table t1 as select if(1,1,'b') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(if(1,1,1))); +hex(concat(if(1,1,1))) +31 +create table t1 as select concat(if(1,1,1)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(nullif(1,2))); +hex(concat(nullif(1,2))) +31 +create table t1 as select concat(nullif(1,2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)')))); +hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)')))) +31 +create table t1 as select concat(Dimension(GeomFromText('LINSTRING(0 0,10 10)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); +hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) +32 +create table t1 as select concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))); +hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)')))) +32 +create table t1 as select concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))); +hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)')))) +30 +create table t1 as select concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))); +hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')))) +31 +create table t1 as select concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))); +hex(concat(IsEmpty(GeomFromText('POINT(1 1)')))) +30 +create table t1 as select concat(IsEmpty(GeomFromText('Point(1 1)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(IsSimple(GeomFromText('POINT(1 1)')))); +hex(concat(IsSimple(GeomFromText('POINT(1 1)')))) +31 +create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))); +hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))) +30 +create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))); +hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))) +31 +create table t1 as select concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))) as c1; +drop table t1; +select hex(concat(x(GeomFromText('Point(1 2)')))); +hex(concat(x(GeomFromText('Point(1 2)')))) +31 +create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(y(GeomFromText('Point(1 2)')))); +hex(concat(y(GeomFromText('Point(1 2)')))) +32 +create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))); +hex(concat(GLength(GeomFromText('LineString(1 2,2 2)')))) +31 +create table t1 as select concat(GLength(GeomFromText('LineString(1 2, 2 2)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))); +hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))')))) +31 +create table t1 as select concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(GeometryType(GeomFromText('Point(1 2)')))); +hex(concat(GeometryType(GeomFromText('Point(1 2)')))) +504F494E54 +create table t1 as select concat(GeometryType(GeomFromText('Point(1 2)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(20) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(AsText(GeomFromText('Point(1 2)')))); +hex(concat(AsText(GeomFromText('Point(1 2)')))) +504F494E542831203229 +create table t1 as select concat(AsText(GeomFromText('Point(1 2)'))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` longtext CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(period_add(200902, 2))); +hex(concat(period_add(200902, 2))) +323030393034 +create table t1 as select concat(period_add(200902, 2)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(6) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(period_diff(200902, 200802))); +hex(concat(period_diff(200902, 200802))) +3132 +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +create table t1 as select concat(period_add(200902, 200802)) as c1; +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(6) CHARACTER SET utf8 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(to_days(20090224))); +hex(concat(to_days(20090224))) +373333383237 +create table t1 as select concat(to_days(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(6) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(dayofmonth(20090224))); +hex(concat(dayofmonth(20090224))) +3234 +create table t1 as select concat(dayofmonth(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(dayofyear(20090224))); +hex(concat(dayofyear(20090224))) +3535 +create table t1 as select concat(dayofyear(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(hour('10:11:12'))); +hex(concat(hour('10:11:12'))) +3130 +create table t1 as select concat(hour('10:11:12')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(minute('10:11:12'))); +hex(concat(minute('10:11:12'))) +3131 +create table t1 as select concat(minute('10:11:12')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(second('10:11:12'))); +hex(concat(second('10:11:12'))) +3132 +create table t1 as select concat(second('10:11:12')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(quarter(20090224))); +hex(concat(quarter(20090224))) +31 +create table t1 as select concat(quarter(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(week(20090224))); +hex(concat(week(20090224))) +38 +create table t1 as select concat(week(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(yearweek(20090224))); +hex(concat(yearweek(20090224))) +323030393038 +create table t1 as select concat(yearweek(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(6) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(year(20090224))); +hex(concat(year(20090224))) +32303039 +create table t1 as select concat(year(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(weekday(20090224))); +hex(concat(weekday(20090224))) +31 +create table t1 as select concat(weekday(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(dayofweek(20090224))); +hex(concat(dayofweek(20090224))) +33 +create table t1 as select concat(dayofweek(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(unix_timestamp(20090224))); +hex(concat(unix_timestamp(20090224))) +31323335343232383030 +create table t1 as select concat(unix_timestamp(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(17) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(time_to_sec('10:11:12'))); +hex(concat(time_to_sec('10:11:12'))) +3336363732 +create table t1 as select concat(time_to_sec('10:11:12')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(17) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(extract(year from 20090702))); +hex(concat(extract(year from 20090702))) +32303039 +create table t1 as select concat(extract(year from 20090702)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(microsecond('12:00:00.123456'))); +hex(concat(microsecond('12:00:00.123456'))) +313233343536 +create table t1 as select concat(microsecond('12:00:00.123456')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(6) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(month(20090224))); +hex(concat(month(20090224))) +32 +create table t1 as select concat(month(20090224)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(last_day('2003-02-05')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select c1, hex(c1) from t1; +c1 hex(c1) +2003-02-28 323030332D30322D3238 +drop table t1; +create table t1 as select concat(from_days(730669)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select c1, hex(c1) from t1; +c1 hex(c1) +2000-07-03 323030302D30372D3033 +drop table t1; +create table t1 as select concat(curdate()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(utc_date()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(curtime()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select repeat('a',20) as c1 limit 0; +set timestamp=1216359724; +insert into t1 values (current_date); +insert into t1 values (current_time); +select c1, hex(c1) from t1; +c1 hex(c1) +2008-07-18 323030382D30372D3138 +08:42:04 30383A34323A3034 +drop table t1; +create table t1 as select concat(utc_time()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(sec_to_time(2378))); +hex(concat(sec_to_time(2378))) +30303A33393A3338 +create table t1 as select concat(sec_to_time(2378)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))); +hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00'))) +32343A30303A3030 +create table t1 as select concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(maketime(10,11,12))); +hex(concat(maketime(10,11,12))) +31303A31313A3132 +create table t1 as select concat(maketime(10,11,12)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(get_format(DATE,'USA')); +hex(get_format(DATE,'USA')) +256D2E25642E2559 +create table t1 as select get_format(DATE,'USA') as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(17) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(concat(from_unixtime(1111885200)),4)); +hex(left(concat(from_unixtime(1111885200)),4)) +32303035 +create table t1 as select concat(from_unixtime(1111885200)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(19) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))); +hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00'))) +323030332D31322D33312032303A30303A3030 +create table t1 as select concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(19) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))); +hex(concat(date_add('2004-01-01 12:00:00', interval 1 day))) +323030342D30312D30322031323A30303A3030 +create table t1 as select concat(date_add('2004-01-01 12:00:00', interval 1 day)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(19) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t1; +c1 +2004-01-02 12:00:00 +drop table t1; +select hex(concat(makedate(2009,1))); +hex(concat(makedate(2009,1))) +323030392D30312D3031 +create table t1 as select concat(makedate(2009,1)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t1; +c1 +2009-01-01 +drop table t1; +create table t1 as select concat(now()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(19) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(utc_timestamp()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(19) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(sysdate()) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(19) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(addtime('00:00:00','11:22:33'))); +hex(concat(addtime('00:00:00','11:22:33'))) +31313A32323A3333 +create table t1 as select concat(addtime('00:00:00','11:22:33')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(26) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(concat(subtime('23:59:59','11:22:33'))); +hex(concat(subtime('23:59:59','11:22:33'))) +31323A33373A3236 +create table t1 as select concat(subtime('23:59:59','11:22:33')) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(26) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(elt(1,2,3)); +hex(elt(1,2,3)) +32 +create table t1 as select elt(1,2,3) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(export_set(1,2,3,4,2)); +hex(export_set(1,2,3,4,2)) +323433 +create table t1 as select export_set(1,2,3,4,2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(127) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(insert(1133,3,0,22)); +hex(insert(1133,3,0,22)) +313132323333 +create table t1 as select insert(1133,3,0,22) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(6) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(lcase(123)); +hex(lcase(123)) +313233 +create table t1 as select lcase(123) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(left(123,1)); +hex(left(123,1)) +31 +create table t1 as select left(123,1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(lower(123)); +hex(lower(123)) +313233 +create table t1 as select lower(123) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(lpad(1,2,0)); +hex(lpad(1,2,0)) +3031 +create table t1 as select lpad(1,2,0) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(ltrim(1)); +hex(ltrim(1)) +31 +create table t1 as select ltrim(1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(mid(1,1,1)); +hex(mid(1,1,1)) +31 +create table t1 as select mid(1,1,1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(repeat(1,2)); +hex(repeat(1,2)) +3131 +create table t1 as select repeat(1,2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(replace(1,1,2)); +hex(replace(1,1,2)) +32 +create table t1 as select replace(1,1,2) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(reverse(12)); +hex(reverse(12)) +3231 +create table t1 as select reverse(12) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(right(123,1)); +hex(right(123,1)) +33 +create table t1 as select right(123,1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(rpad(1,2,0)); +hex(rpad(1,2,0)) +3130 +create table t1 as select rpad(1,2,0) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(rtrim(1)); +hex(rtrim(1)) +31 +create table t1 as select rtrim(1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(soundex(1)); +hex(soundex(1)) + +create table t1 as select soundex(1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(4) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(substring(1,1,1)); +hex(substring(1,1,1)) +31 +create table t1 as select substring(1,1,1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(trim(1)); +hex(trim(1)) +31 +create table t1 as select trim(1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(ucase(1)); +hex(ucase(1)) +31 +create table t1 as select ucase(1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select hex(upper(1)); +hex(upper(1)) +31 +create table t1 as select upper(1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select repeat(' ', 64) as a limit 0; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(64) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ("1.1"), ("2.1"); +select a, hex(a) from t1; +a hex(a) +1.1 312E31 +2.1 322E31 +update t1 set a= a + 0.1; +select a, hex(a) from t1; +a hex(a) +1.2000000000000002 312E32303030303030303030303030303032 +2.2 322E32 +drop table t1; +create table t1 (a tinyint); +insert into t1 values (1); +select hex(concat(a)) from t1; +hex(concat(a)) +31 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(4) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a tinyint zerofill); +insert into t1 values (1), (10), (100); +select hex(concat(a)), a from t1; +hex(concat(a)) a +303031 001 +303130 010 +313030 100 +drop table t1; +create table t1 (a tinyint(4) zerofill); +insert into t1 values (1), (10), (100); +select hex(concat(a)), a from t1; +hex(concat(a)) a +30303031 0001 +30303130 0010 +30313030 0100 +drop table t1; +create table t1 (a decimal(10,2)); +insert into t1 values (123.45); +select hex(concat(a)) from t1; +hex(concat(a)) +3132332E3435 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(12) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a smallint); +insert into t1 values (1); +select hex(concat(a)) from t1; +hex(concat(a)) +31 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(6) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a smallint zerofill); +insert into t1 values (1), (10), (100), (1000), (10000); +select hex(concat(a)), a from t1; +hex(concat(a)) a +3030303031 00001 +3030303130 00010 +3030313030 00100 +3031303030 01000 +3130303030 10000 +drop table t1; +create table t1 (a mediumint); +insert into t1 values (1); +select hex(concat(a)) from t1; +hex(concat(a)) +31 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(9) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a mediumint zerofill); +insert into t1 values (1), (10), (100), (1000), (10000); +select hex(concat(a)), a from t1; +hex(concat(a)) a +3030303030303031 00000001 +3030303030303130 00000010 +3030303030313030 00000100 +3030303031303030 00001000 +3030303130303030 00010000 +drop table t1; +create table t1 (a int); +insert into t1 values (1); +select hex(concat(a)) from t1; +hex(concat(a)) +31 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(11) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a int zerofill); +insert into t1 values (1), (10), (100), (1000), (10000); +select hex(concat(a)), a from t1; +hex(concat(a)) a +30303030303030303031 0000000001 +30303030303030303130 0000000010 +30303030303030313030 0000000100 +30303030303031303030 0000001000 +30303030303130303030 0000010000 +drop table t1; +create table t1 (a bigint); +insert into t1 values (1); +select hex(concat(a)) from t1; +hex(concat(a)) +31 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(20) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a bigint zerofill); +insert into t1 values (1), (10), (100), (1000), (10000); +select hex(concat(a)), a from t1; +hex(concat(a)) a +3030303030303030303030303030303030303031 00000000000000000001 +3030303030303030303030303030303030303130 00000000000000000010 +3030303030303030303030303030303030313030 00000000000000000100 +3030303030303030303030303030303031303030 00000000000000001000 +3030303030303030303030303030303130303030 00000000000000010000 +drop table t1; +create table t1 (a float); +insert into t1 values (123.456); +select hex(concat(a)) from t1; +hex(concat(a)) +3132332E343536 +select concat(a) from t1; +concat(a) +123.456 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(12) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a float zerofill); +insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1); +select hex(concat(a)), a from t1; +hex(concat(a)) a +303030303030303030312E31 0000000001.1 +303030303030303031302E31 0000000010.1 +303030303030303130302E31 0000000100.1 +303030303030313030302E31 0000001000.1 +303030303031303030302E31 0000010000.1 +drop table t1; +create table t1 (a double); +insert into t1 values (123.456); +select hex(concat(a)) from t1; +hex(concat(a)) +3132332E343536 +select concat(a) from t1; +concat(a) +123.456 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(22) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a double zerofill); +insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1); +select hex(concat(a)), a from t1; +hex(concat(a)) a +30303030303030303030303030303030303030312E31 00000000000000000001.1 +30303030303030303030303030303030303031302E31 00000000000000000010.1 +30303030303030303030303030303030303130302E31 00000000000000000100.1 +30303030303030303030303030303030313030302E31 00000000000000001000.1 +30303030303030303030303030303031303030302E31 00000000000000010000.1 +drop table t1; +create table t1 (a year(2)); +Warnings: +Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead +insert into t1 values (1); +select hex(concat(a)) from t1; +hex(concat(a)) +3031 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(2) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a year); +insert into t1 values (1); +select hex(concat(a)) from t1; +hex(concat(a)) +32303031 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(4) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a bit(64)); +insert into t1 values (1); +select hex(concat(a)) from t1; +hex(concat(a)) +0000000000000001 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varbinary(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); +insert into t1 values (0); +insert into t1 values (20010203040506); +insert into t1 values (19800203040506); +insert into t1 values ('2001-02-03 04:05:06'); +select hex(concat(a)) from t1; +hex(concat(a)) +303030302D30302D30302030303A30303A3030 +323030312D30322D30332030343A30353A3036 +313938302D30322D30332030343A30353A3036 +323030312D30322D30332030343A30353A3036 +select concat(a) from t1; +concat(a) +0000-00-00 00:00:00 +2001-02-03 04:05:06 +1980-02-03 04:05:06 +2001-02-03 04:05:06 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(19) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a date); +insert into t1 values ('2001-02-03'); +insert into t1 values (20010203); +select hex(concat(a)) from t1; +hex(concat(a)) +323030312D30322D3033 +323030312D30322D3033 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a time); +insert into t1 values (1); +insert into t1 values ('01:02:03'); +select hex(concat(a)) from t1; +hex(concat(a)) +30303A30303A3031 +30313A30323A3033 +select concat(a) from t1; +concat(a) +00:00:01 +01:02:03 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a datetime); +insert into t1 values ('2001-02-03 04:05:06'); +insert into t1 values (20010203040506); +select hex(concat(a)) from t1; +hex(concat(a)) +323030312D30322D30332030343A30353A3036 +323030312D30322D30332030343A30353A3036 +create table t2 as select concat(a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `concat(a)` varchar(19) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1, t2; +create table t1 (a tinyint); +insert into t1 values (1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(4) YES NULL +select hex(a) from v1; +hex(a) +31 +drop table t1; +drop view v1; +create table t1 (a tinyint zerofill); +insert into t1 values (1), (10), (100); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(3) YES NULL +select hex(a) from v1; +hex(a) +303031 +303130 +313030 +drop table t1; +drop view v1; +create table t1 (a tinyint(30) zerofill); +insert into t1 values (1), (10), (100); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(30) YES NULL +select hex(a) from v1; +hex(a) +303030303030303030303030303030303030303030303030303030303031 +303030303030303030303030303030303030303030303030303030303130 +303030303030303030303030303030303030303030303030303030313030 +drop table t1; +drop view v1; +create table t1 (a decimal(10,2)); +insert into t1 values (123.45); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(12) YES NULL +select hex(a) from v1; +hex(a) +3132332E3435 +drop table t1; +drop view v1; +create table t1 (a smallint); +insert into t1 values (1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(6) YES NULL +select hex(a) from v1; +hex(a) +31 +drop table t1; +drop view v1; +create table t1 (a smallint zerofill); +insert into t1 values (1), (10), (100), (1000), (10000); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(5) YES NULL +select hex(a) from v1; +hex(a) +3030303031 +3030303130 +3030313030 +3031303030 +3130303030 +drop table t1; +drop view v1; +create table t1 (a mediumint); +insert into t1 values (1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(9) YES NULL +select hex(a) from v1; +hex(a) +31 +drop table t1; +drop view v1; +create table t1 (a mediumint zerofill); +insert into t1 values (1), (10), (100), (1000), (10000); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(8) YES NULL +select hex(a) from v1; +hex(a) +3030303030303031 +3030303030303130 +3030303030313030 +3030303031303030 +3030303130303030 +drop table t1; +drop view v1; +create table t1 (a int); +insert into t1 values (1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(11) YES NULL +select hex(a) from v1; +hex(a) +31 +drop table t1; +drop view v1; +create table t1 (a int zerofill); +insert into t1 values (1), (10), (100), (1000), (10000); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(10) YES NULL +select hex(a) from v1; +hex(a) +30303030303030303031 +30303030303030303130 +30303030303030313030 +30303030303031303030 +30303030303130303030 +drop table t1; +drop view v1; +create table t1 (a bigint); +insert into t1 values (1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(20) YES NULL +select hex(a) from v1; +hex(a) +31 +drop table t1; +drop view v1; +create table t1 (a bigint zerofill); +insert into t1 values (1), (10), (100), (1000), (10000); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(20) YES NULL +select hex(a) from v1; +hex(a) +3030303030303030303030303030303030303031 +3030303030303030303030303030303030303130 +3030303030303030303030303030303030313030 +3030303030303030303030303030303031303030 +3030303030303030303030303030303130303030 +drop table t1; +drop view v1; +create table t1 (a float); +insert into t1 values (123.456); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(12) YES NULL +select hex(a) from v1; +hex(a) +3132332E343536 +drop table t1; +drop view v1; +create table t1 (a float zerofill); +insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(12) YES NULL +select hex(a) from v1; +hex(a) +303030303030303030312E31 +303030303030303031302E31 +303030303030303130302E31 +303030303030313030302E31 +303030303031303030302E31 +drop table t1; +drop view v1; +create table t1 (a double); +insert into t1 values (123.456); +select concat(a) from t1; +concat(a) +123.456 +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(22) YES NULL +select hex(a) from v1; +hex(a) +3132332E343536 +drop table t1; +drop view v1; +create table t1 (a double zerofill); +insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(22) YES NULL +select hex(a) from v1; +hex(a) +30303030303030303030303030303030303030312E31 +30303030303030303030303030303030303031302E31 +30303030303030303030303030303030303130302E31 +30303030303030303030303030303030313030302E31 +30303030303030303030303030303031303030302E31 +drop table t1; +drop view v1; +create table t1 (a year(2)); +Warnings: +Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead +insert into t1 values (1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(2) YES NULL +select hex(a) from v1; +hex(a) +3031 +drop table t1; +drop view v1; +create table t1 (a year); +insert into t1 values (1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(4) YES NULL +select hex(a) from v1; +hex(a) +32303031 +drop table t1; +drop view v1; +create table t1 (a bit(64)); +insert into t1 values (1); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varbinary(64) YES NULL +select hex(a) from v1; +hex(a) +0000000000000001 +drop table t1; +drop view v1; +create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); +insert into t1 values (0); +insert into t1 values (20010203040506); +insert into t1 values (19800203040506); +insert into t1 values ('2001-02-03 04:05:06'); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(19) YES NULL +select hex(a) from v1; +hex(a) +303030302D30302D30302030303A30303A3030 +323030312D30322D30332030343A30353A3036 +313938302D30322D30332030343A30353A3036 +323030312D30322D30332030343A30353A3036 +drop table t1; +drop view v1; +create table t1 (a date); +insert into t1 values ('2001-02-03'); +insert into t1 values (20010203); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(10) YES NULL +select hex(a) from v1; +hex(a) +323030312D30322D3033 +323030312D30322D3033 +drop table t1; +drop view v1; +create table t1 (a time); +insert into t1 values (1); +insert into t1 values ('01:02:03'); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(10) YES NULL +select hex(a) from v1; +hex(a) +30303A30303A3031 +30313A30323A3033 +drop table t1; +drop view v1; +create table t1 (a datetime); +insert into t1 values ('2001-02-03 04:05:06'); +insert into t1 values (20010203040506); +create view v1(a) as select concat(a) from t1; +show columns from v1; +Field Type Null Key Default Extra +a varchar(19) YES NULL +select hex(a) from v1; +hex(a) +323030312D30322D30332030343A30353A3036 +323030312D30322D30332030343A30353A3036 +drop table t1; +drop view v1; +create function f1 (par1 int) returns int +begin +return concat(par1); +end| +set @a= f1(1); +select hex(@a); +hex(@a) +1 +select hex(concat(f1(1))); +hex(concat(f1(1))) +31 +create table t1 as select f1(1) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(f1(1)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create view v1 as select concat(f1(1)) as c1; +show columns from v1; +Field Type Null Key Default Extra +c1 varchar(11) YES NULL +drop table t1; +drop view v1; +drop function f1; +create function f1 (par1 decimal(18,2)) returns decimal(18,2) +begin +return concat(par1); +end| +set @a= f1(123.45); +select hex(@a); +hex(@a) +7B +select hex(concat(f1(123.45))); +hex(concat(f1(123.45))) +3132332E3435 +create table t1 as select f1(123.45) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` decimal(18,2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(f1(123.45)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create view v1 as select concat(f1(123.45)) as c1; +show columns from v1; +Field Type Null Key Default Extra +c1 varchar(20) YES NULL +drop table t1; +drop view v1; +drop function f1; +create function f1 (par1 float) returns float +begin +return concat(par1); +end| +set @a= f1(123.45); +select hex(@a); +hex(@a) +7B +select hex(concat(f1(123.45))); +hex(concat(f1(123.45))) +3132332E3435 +create table t1 as select f1(123.45) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` float DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(f1(123.45)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(12) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create view v1 as select concat(f1(123.45)) as c1; +show columns from v1; +Field Type Null Key Default Extra +c1 varchar(12) YES NULL +drop table t1; +drop view v1; +drop function f1; +create function f1 (par1 date) returns date +begin +return concat(par1); +end| +set @a= f1(cast('2001-01-02' as date)); +select hex(@a); +hex(@a) +323030312D30312D3032 +select hex(concat(f1(cast('2001-01-02' as date)))); +hex(concat(f1(cast('2001-01-02' as date)))) +323030312D30312D3032 +create table t1 as select f1(cast('2001-01-02' as date)) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 as select concat(f1(cast('2001-01-02' as date))) as c1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create view v1 as select concat(f1(cast('2001-01-02' as date))) as c1; +show columns from v1; +Field Type Null Key Default Extra +c1 varchar(10) YES NULL +drop table t1; +drop view v1; +drop function f1; +# +# End of WL#2649 Number-to-string conversions +# +# +# Bug#54668 User variable assignments get wrong type +# +SET @x=md5('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +utf8 utf8_general_ci +SET @x=old_password('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +utf8 utf8_general_ci +SET @x=password('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +utf8 utf8_general_ci +SET @x=sha('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +utf8 utf8_general_ci +SET @x=sha1('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +utf8 utf8_general_ci +SET @x=astext(point(1,2)); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +utf8 utf8_general_ci +SET @x=aswkt(point(1,2)); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +utf8 utf8_general_ci +# +# Bug#54916 GROUP_CONCAT + IFNULL truncates output +# +SELECT @@collation_connection; +@@collation_connection +utf8_general_ci +CREATE TABLE t1 (a MEDIUMINT NULL) ENGINE=MYISAM; +INSERT INTO t1 VALUES (1234567); +SELECT GROUP_CONCAT(IFNULL(a,'')) FROM t1; +GROUP_CONCAT(IFNULL(a,'')) +1234567 +SELECT GROUP_CONCAT(IF(a,a,'')) FROM t1; +GROUP_CONCAT(IF(a,a,'')) +1234567 +SELECT GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END) FROM t1; +GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END) +1234567 +SELECT COALESCE(a,'') FROM t1 GROUP BY 1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(a,'') 253 27 7 Y 0 39 33 +COALESCE(a,'') +1234567 +# All columns must be VARCHAR(9) with the same length: +CREATE TABLE t2 AS +SELECT +CONCAT(a), +IFNULL(a,''), +IF(a,a,''), +CASE WHEN a THEN a ELSE '' END, +COALESCE(a,'') +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `CONCAT(a)` varchar(9) CHARACTER SET utf8 DEFAULT NULL, + `IFNULL(a,'')` varchar(9) CHARACTER SET utf8 NOT NULL, + `IF(a,a,'')` varchar(9) CHARACTER SET utf8 DEFAULT NULL, + `CASE WHEN a THEN a ELSE '' END` varchar(9) CHARACTER SET utf8 DEFAULT NULL, + `COALESCE(a,'')` varchar(9) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT LCASE(a) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `LCASE(a)` varchar(9) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT UCASE(a) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `UCASE(a)` varchar(9) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `REPEAT(1,2)` varchar(2) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `LEFT(123,2)` varchar(2) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `RIGHT(123,2)` varchar(2) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `LTRIM(123)` varchar(3) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `RTRIM(123)` varchar(3) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ELT(1,111,222,333)` varchar(3) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `REPLACE(111,2,3)` varchar(3) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `SOUNDEX(1)` varchar(4) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +# End of Bug#54916 +# +# +# Bug#58190 BETWEEN no longer uses indexes for date or datetime fields +# +SELECT @@collation_connection; +@@collation_connection +utf8_general_ci +CREATE TABLE t1 ( +id INT(11) DEFAULT NULL, +date_column DATE DEFAULT NULL, +KEY(date_column)); +INSERT INTO t1 VALUES (1,'2010-09-01'),(2,'2010-10-01'); +EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range date_column date_column 4 NULL 1 Using index condition +ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL; +EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range date_column date_column 6 NULL 1 Using index condition +DROP TABLE t1; +# +# Bug #31384 DATE_ADD() and DATE_SUB() return binary data +# +SELECT @@collation_connection, @@character_set_results; +@@collation_connection @@character_set_results +utf8_general_ci utf8 +SELECT +CHARSET(DATE_SUB('2007-08-03', INTERVAL 1 MINUTE)) AS field_str1, +CHARSET(DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE)) AS field_str2, +CHARSET(DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY)) AS field_date, +CHARSET(DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE)) AS field_datetime; +field_str1 field_str2 field_date field_datetime +utf8 utf8 binary binary +CREATE TABLE t1 AS +SELECT +DATE_SUB('2007-08-03', INTERVAL 1 MINUTE) AS field_str1, +DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2, +DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date, +DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `field_str1` varchar(19) CHARACTER SET utf8 DEFAULT NULL, + `field1_str2` varchar(19) CHARACTER SET utf8 DEFAULT NULL, + `field_date` date DEFAULT NULL, + `field_datetime` datetime DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +SELECT +DATE_SUB('2007-08-03', INTERVAL 1 DAY) AS field_str1, +DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE) AS field1_str2, +DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY) AS field_date, +DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE) AS field_datetime; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def field_str1 254 57 10 Y 0 0 33 +def field1_str2 254 57 19 Y 0 0 33 +def field_date 10 10 10 Y 128 0 63 +def field_datetime 12 19 19 Y 128 0 63 +field_str1 field1_str2 field_date field_datetime +2007-08-02 2007-08-03 17:32:00 2007-08-02 2007-08-03 17:32:00 +SELECT +HEX(DATE_SUB('2007-08-03', INTERVAL 1 MINUTE)) AS field_str1, +HEX(DATE_SUB('2007-08-03 17:33:00', INTERVAL 1 MINUTE)) AS field1_str2, +HEX(DATE_SUB(DATE('2007-08-03'), INTERVAL 1 DAY)) AS field_date, +HEX(DATE_SUB(CAST('2007-08-03 17:33:00' AS DATETIME), INTERVAL 1 MINUTE)) AS field_datetime; +field_str1 field1_str2 field_date field_datetime +323030372D30382D30322032333A35393A3030 323030372D30382D30332031373A33323A3030 323030372D30382D3032 323030372D30382D30332031373A33323A3030 +# +# MDEV-4841 Wrong character set of ADDTIME() and DATE_ADD() +# +SELECT @@collation_connection, @@character_set_results; +@@collation_connection @@character_set_results +utf8_general_ci utf8 +SELECT +CHARSET(ADDTIME(_latin1'10:01:01',_latin1'10:00:00')) AS addtime1, +CHARSET(ADDTIME('10:01:01','10:00:00')) AS addtime2, +CHARSET(DATE_ADD(_latin1'2001-01-01 10:01:01',interval 10 second)) AS date_add1, +CHARSET(DATE_ADD('2001-01-01 10:01:01',interval 10 second)) AS date_add2; +addtime1 addtime2 date_add1 date_add2 +utf8 utf8 utf8 utf8 +CREATE TABLE t1 AS +SELECT +ADDTIME(_latin1'10:01:01',_latin1'10:00:00') AS addtime1, +ADDTIME('10:01:01','10:00:00') AS addtime2, +DATE_ADD(_latin1'2001-01-01 10:01:01',interval 10 second) AS date_add1, +DATE_ADD('2001-01-01 10:01:01',interval 10 second) AS date_add2; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `addtime1` varchar(26) CHARACTER SET utf8 DEFAULT NULL, + `addtime2` varchar(26) CHARACTER SET utf8 DEFAULT NULL, + `date_add1` varchar(19) CHARACTER SET utf8 DEFAULT NULL, + `date_add2` varchar(19) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT * FROM t1; +addtime1 addtime2 date_add1 date_add2 +20:01:01 20:01:01 2001-01-01 10:01:11 2001-01-01 10:01:11 +DROP TABLE t1; +# +# Bug#11926811 / Bug#60625 Illegal mix of collations +# +SELECT @@collation_connection; +@@collation_connection +utf8_general_ci +CREATE PROCEDURE p1() +BEGIN +DECLARE v_LastPaymentDate DATETIME DEFAULT NULL; +SELECT v_LastPaymentDate < NOW(); +EXPLAIN EXTENDED SELECT v_LastPaymentDate < NOW(); +SHOW WARNINGS; +EXPLAIN EXTENDED SELECT CONCAT(v_LastPaymentDate, NOW()); +END// +CALL p1; +v_LastPaymentDate < NOW() +NULL +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Level Code Message +Note 1003 select v_LastPaymentDate@0 < current_timestamp() AS `v_LastPaymentDate < NOW()` +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select concat(convert(v_LastPaymentDate@0 using utf8),current_timestamp()) AS `CONCAT(v_LastPaymentDate, NOW())` +DROP PROCEDURE p1; +# +# Bug#52159 returning time type from function and empty left join causes debug assertion +# +CREATE FUNCTION f1() RETURNS TIME RETURN 1; +CREATE TABLE t1 (b INT); +INSERT INTO t1 VALUES (0); +SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY a; +f1() +00:00:01 +DROP FUNCTION f1; +DROP TABLE t1; +# +# MDEV-9662 Assertion `precision || !scale' failed in my_decimal_precision_to_length_no_truncation(uint, uint8, bool) +# +SELECT @@collation_connection; +@@collation_connection +utf8_general_ci +SELECT CASE 1 WHEN 2 THEN ( - '3' ) END; +CASE 1 WHEN 2 THEN ( - '3' ) END +NULL +# +# MDEV-5702 Incorrect results are returned with NULLIF() +# +CREATE TABLE t1 (d DATE); +INSERT INTO t1 VALUES ('1999-11-11'),('2014-02-04'); +SELECT DISTINCT d, CAST(d AS CHAR), NULLIF(d,"2000-01-01") AS bad, NULLIF(CAST(d AS CHAR),"2000-01-01") AS good FROM t1; +d CAST(d AS CHAR) bad good +1999-11-11 1999-11-11 1999-11-11 1999-11-11 +2014-02-04 2014-02-04 2014-02-04 2014-02-04 +CREATE TABLE t2 AS SELECT DISTINCT d, NULLIF(d,'2000-01-01') AS bad FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `d` date DEFAULT NULL, + `bad` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +SET NAMES latin1; +SET sql_mode=''; +CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a)); +INSERT INTO t1 VALUES (); +SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1; +maketime(`a`,`a`,`a`) +00:00:00.000000 +DROP TABLE t1; +SET sql_mode=default; +# +# Bug#57687 crash when reporting duplicate group_key error and utf8 +# Bug#58081 Duplicate entry error when doing GROUP BY +# MDEV-9332 Bug after upgrade to 10.1.10 +# +SET NAMES utf8; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (0), (0), (1), (0), (0); +SELECT COUNT(*) FROM t1, t1 t2 +GROUP BY INSERT('', t2.a, t1.a, (@@global.max_binlog_size)); +COUNT(*) +25 +DROP TABLE t1; +# +# Bug#11764503 (Bug#57341) Query in EXPLAIN EXTENDED shows wrong characters +# +SET NAMES latin1; +EXPLAIN EXTENDED SELECT 'abcdÁÂÃÄÅ', _latin1'abcdÁÂÃÄÅ', _utf8'abcdÁÂÃÄÅ' AS u; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select 'abcdÁÂÃÄÅ' AS `abcdÁÂÃÄÅ`,_latin1'abcd\xC3\x81\xC3\x82\xC3\x83\xC3\x84\xC3\x85' AS `abcdÁÂÃÄÅ`,_utf8'abcd\xC3\x81\xC3\x82\xC3\x83\xC3\x84\xC3\x85' AS `u` +SET NAMES utf8; +EXPLAIN EXTENDED SELECT 'abcdÁÂÃÄÅ', _latin1'abcdÁÂÃÄÅ', _utf8'abcdÁÂÃÄÅ'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select 'abcdÁÂÃÄÅ' AS `abcdÁÂÃÄÅ`,_latin1'abcd\xC3\x81\xC3\x82\xC3\x83\xC3\x84\xC3\x85' AS `abcdÃÂÃÄÅ`,_utf8'abcd\xC3\x81\xC3\x82\xC3\x83\xC3\x84\xC3\x85' AS `abcdÁÂÃÄÅ` +# +# Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT +# +SET NAMES utf8; +SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l +FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body +UNION ALL +SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1 +GROUP BY id +ORDER BY l DESC; +id l +a 1401 +SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l +FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body +UNION ALL +SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1; +id l +a 1401 +# +# MDEV-7814 Assertion `args[0]->fixed' fails in Item_func_conv_charset::Item_func_conv_charset +# +CREATE TABLE t1(a CHAR(1) CHARACTER SET latin1, b INT NOT NULL); +CREATE TABLE t2(a CHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci, b INT NOT NULL); +SELECT (SELECT t2.a FROM t2 WHERE t2.a=t1.a) AS aa, b, COUNT(b) FROM t1 GROUP BY aa; +aa b COUNT(b) +DROP TABLE t1,t2; +# +# MDEV-7649 wrong result when comparing utf8 column with an invalid literal +# +SET NAMES utf8 COLLATE utf8_general_ci; +# +# Start of ctype_utf8_ilseq.inc +# +CREATE TABLE t1 ENGINE=InnoDB AS SELECT REPEAT(' ', 60) AS ch LIMIT 0;; +ALTER TABLE t1 +ADD id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, +ADD KEY(ch); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `ch` varchar(60) CHARACTER SET utf8 DEFAULT NULL, + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`), + KEY `ch` (`ch`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); +SELECT ch FROM t1 WHERE ch='admin𝌆'; +ch +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆'; +ch +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆'; +ch +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +DELETE FROM t1; +INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????'); +INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b'); +INSERT INTO t1 (ch) VALUES ('az'),('a?z'),('a??z'),('a???z'),('a????z'); +INSERT INTO t1 (ch) VALUES ('z'); +INSERT INTO t1 (ch) VALUES (_utf8 0x61D080); +INSERT INTO t1 (ch) VALUES (_utf8 0x61D680); +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; +ch +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; +ch +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; +ch +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; +ch +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; +ch +a +a? +a?? +a??? +a???? +a????b +a????z +a???b +a???z +a??b +a??z +a?b +a?z +ab +az +aЀ +aր +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; +ch +a +a? +a?? +a??? +a???? +a????b +a????z +a???b +a???z +a??b +a??z +a?b +a?z +ab +az +aЀ +aր +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; +ch +a +a? +a?? +a??? +a???? +a????b +a????z +a???b +a???z +a??b +a??z +a?b +a?z +ab +az +aЀ +aր +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; +ch +a +a? +a?? +a??? +a???? +a????b +a????z +a???b +a???z +a??b +a??z +a?b +a?z +ab +az +aЀ +aր +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; +ch +z +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; +ch +z +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; +ch +z +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; +ch +z +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 +ALTER TABLE t1 DROP KEY ch; +# 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,''''); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'b'''); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch<''a', 0xD1,''' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +a +a? +a?? +a??? +a???? +a????b +a????z +a???b +a???z +a??b +a??z +a?b +a?z +ab +az +aЀ +aր +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch>''a', 0xD1,''' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +z +# 0xEA9A96 would be a good 3-byte character, 0xEA9A is an incomplete sequence +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,''' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,'b'' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +# 0x8F is a bad byte sequence (an mb2tail without mb2head) +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F,''' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F,'b'' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +# 0x8F8F is a bad byte sequence (an mb2tail without mb2head, two times) +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F8F,''' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F8F,'b'' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +DROP TABLE t1; +# +# End of ctype_utf8_ilseq.inc +# +# +# Start of ctype_utf8_ilseq.inc +# +CREATE TABLE t1 ENGINE=MyISAM AS SELECT REPEAT(' ', 60) AS ch LIMIT 0;; +ALTER TABLE t1 +ADD id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, +ADD KEY(ch); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `ch` varchar(60) CHARACTER SET utf8 DEFAULT NULL, + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`), + KEY `ch` (`ch`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); +SELECT ch FROM t1 WHERE ch='admin𝌆'; +ch +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆'; +ch +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆'; +ch +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +DELETE FROM t1; +INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????'); +INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b'); +INSERT INTO t1 (ch) VALUES ('az'),('a?z'),('a??z'),('a???z'),('a????z'); +INSERT INTO t1 (ch) VALUES ('z'); +INSERT INTO t1 (ch) VALUES (_utf8 0x61D080); +INSERT INTO t1 (ch) VALUES (_utf8 0x61D680); +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; +ch +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; +ch +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; +ch +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; +ch +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; +ch +a +a? +a?? +a??? +a???? +a????b +a????z +a???b +a???z +a??b +a??z +a?b +a?z +ab +az +aЀ +aր +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; +ch +a +a? +a?? +a??? +a???? +a????b +a????z +a???b +a???z +a??b +a??z +a?b +a?z +ab +az +aЀ +aր +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; +ch +a +a? +a?? +a??? +a???? +a????b +a????z +a???b +a???z +a??b +a??z +a?b +a?z +ab +az +aЀ +aր +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; +ch +a +a? +a?? +a??? +a???? +a????b +a????z +a???b +a???z +a??b +a??z +a?b +a?z +ab +az +aЀ +aր +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; +ch +z +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; +ch +z +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; +ch +z +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; +ch +z +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 +ALTER TABLE t1 DROP KEY ch; +# 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,''''); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'b'''); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch<''a', 0xD1,''' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +a +a? +a?? +a??? +a???? +a????b +a????z +a???b +a???z +a??b +a??z +a?b +a?z +ab +az +aЀ +aր +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch>''a', 0xD1,''' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +z +# 0xEA9A96 would be a good 3-byte character, 0xEA9A is an incomplete sequence +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,''' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,'b'' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +# 0x8F is a bad byte sequence (an mb2tail without mb2head) +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F,''' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F,'b'' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +# 0x8F8F is a bad byte sequence (an mb2tail without mb2head, two times) +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F8F,''' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F8F,'b'' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +DROP TABLE t1; +# +# End of ctype_utf8_ilseq.inc +# +# +# Start of ctype_utf8_ilseq.inc +# +CREATE TABLE t1 ENGINE=HEAP AS SELECT REPEAT(' ', 60) AS ch LIMIT 0;; +ALTER TABLE t1 +ADD id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, +ADD KEY(ch); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `ch` varchar(60) CHARACTER SET utf8 DEFAULT NULL, + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`), + KEY `ch` (`ch`) +) ENGINE=MEMORY DEFAULT CHARSET=latin1 +INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); +SELECT ch FROM t1 WHERE ch='admin𝌆'; +ch +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆'; +ch +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆'; +ch +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +DELETE FROM t1; +INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????'); +INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b'); +INSERT INTO t1 (ch) VALUES ('az'),('a?z'),('a??z'),('a???z'),('a????z'); +INSERT INTO t1 (ch) VALUES ('z'); +INSERT INTO t1 (ch) VALUES (_utf8 0x61D080); +INSERT INTO t1 (ch) VALUES (_utf8 0x61D680); +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; +ch +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; +ch +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; +ch +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; +ch +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; +ch +a +a? +a?? +a??? +a???? +a????b +a????z +a???b +a???z +a??b +a??z +a?b +a?z +ab +az +aЀ +aր +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; +ch +a +a? +a?? +a??? +a???? +a????b +a????z +a???b +a???z +a??b +a??z +a?b +a?z +ab +az +aЀ +aր +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL ch NULL NULL NULL # Using where; Using filesort +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; +ch +a +a? +a?? +a??? +a???? +a????b +a????z +a???b +a???z +a??b +a??z +a?b +a?z +ab +az +aЀ +aր +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL ch NULL NULL NULL # Using where; Using filesort +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; +ch +a +a? +a?? +a??? +a???? +a????b +a????z +a???b +a???z +a??b +a??z +a?b +a?z +ab +az +aЀ +aր +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; +ch +z +SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; +ch +z +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL ch NULL NULL NULL # Using where; Using filesort +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; +ch +z +EXPLAIN +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL ch NULL NULL NULL # Using where; Using filesort +SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; +ch +z +ALTER TABLE t1 DROP KEY ch; +# 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,''''); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,'b'''); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch<''a', 0xD1,''' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +a +a? +a?? +a??? +a???? +a????b +a????z +a???b +a???z +a??b +a??z +a?b +a?z +ab +az +aЀ +aր +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch>''a', 0xD1,''' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +z +# 0xEA9A96 would be a good 3-byte character, 0xEA9A is an incomplete sequence +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,''' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xEA9A,'b'' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +# 0x8F is a bad byte sequence (an mb2tail without mb2head) +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F,''' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F,'b'' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +# 0x8F8F is a bad byte sequence (an mb2tail without mb2head, two times) +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F8F,''' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0x8F8F,'b'' ORDER BY ch'); +PREPARE stmt FROM @query; +EXECUTE stmt; +ch +DROP TABLE t1; +# +# End of ctype_utf8_ilseq.inc +# +# +# MDEV-8067 correct fix for MySQL Bug # 19699237: UNINITIALIZED VARIABLE IN ITEM_FIELD::STR_RESULT +# +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8); +CREATE TABLE t2 (a VARCHAR(10) CHARACTER SET latin1); +INSERT INTO t1 VALUES ('aaa'); +INSERT INTO t2 VALUES ('aaa'); +SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2); +(SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2) +1 +INSERT INTO t1 VALUES ('aaa'); +INSERT INTO t2 VALUES ('aaa'); +SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2); +ERROR 21000: Subquery returns more than 1 row +DROP TABLE t1, t2; +# +# MDEV-8630 Datetime value dropped in "INSERT ... SELECT ... ON DUPLICATE KEY" +# +SET NAMES utf8; +CREATE TABLE t1 (id2 int, ts timestamp); +INSERT INTO t1 VALUES (1,'2012-06-11 15:17:34'),(2,'2012-06-11 15:18:24'); +CREATE TABLE t2 AS SELECT +COALESCE(ts, 0) AS c0, +GREATEST(COALESCE(ts, 0), COALESCE(ts, 0)) AS c1, +GREATEST(CASE WHEN 1 THEN ts ELSE 0 END, CASE WHEN 1 THEN ts ELSE 0 END) AS c2, +GREATEST(IFNULL(ts,0), IFNULL(ts,0)) AS c3, +GREATEST(IF(1,ts,0), IF(1,ts,0)) AS c4 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c0` varchar(19) CHARACTER SET utf8 NOT NULL, + `c1` varchar(19) CHARACTER SET utf8 NOT NULL, + `c2` varchar(19) CHARACTER SET utf8 NOT NULL, + `c3` varchar(19) CHARACTER SET utf8 NOT NULL, + `c4` varchar(19) CHARACTER SET utf8 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT * FROM t2; +c0 c1 c2 c3 c4 +2012-06-11 15:17:34 2012-06-11 15:17:34 2012-06-11 15:17:34 2012-06-11 15:17:34 2012-06-11 15:17:34 +2012-06-11 15:18:24 2012-06-11 15:18:24 2012-06-11 15:18:24 2012-06-11 15:18:24 2012-06-11 15:18:24 +DROP TABLE t2, t1; +# +# MDEV-9319 ALTER from a bigger to a smaller blob type truncates too much data +# +SET NAMES utf8; +CREATE TABLE t1 (a TEXT CHARACTER SET utf8); +INSERT INTO t1 VALUES (REPEAT('A',100)); +SELECT OCTET_LENGTH(a) FROM t1; +OCTET_LENGTH(a) +300 +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +ALTER TABLE t1 MODIFY a TINYTEXT CHARACTER SET utf8; +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +SELECT OCTET_LENGTH(a),a FROM t1; +OCTET_LENGTH(a) a +255 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +DROP TABLE t1; +# +# MDEV-8402 Bug#77473 Bug#21317406 TRUNCATED DATA WITH SUBQUERY & UTF8 +# +# +SET NAMES utf8; +SELECT length(rpad(_utf8 0xD0B1, 65536, _utf8 0xD0B2)) AS data; +data +131072 +SELECT length(data) AS len FROM ( +SELECT rpad(_utf8 0xD0B1, 65536, _utf8 0xD0B2) AS data +) AS sub; +len +131072 +SELECT length(rpad(_utf8 0xD0B1, 65535, _utf8 0xD0B2)) AS data; +data +131070 +SELECT length(data) AS len FROM ( +SELECT rpad(_utf8 0xD0B1, 65535, _utf8 0xD0B2) AS data +) AS sub; +len +131070 +SELECT length(data) AS len FROM (SELECT REPEAT('ä', 36766) AS data) AS sub; +len +73532 +SELECT length(data) AS len FROM (SELECT REPEAT('ä', 36767) AS data) AS sub; +len +73534 +SELECT length(data) AS len FROM (SELECT REPEAT('ä', 36778) AS data) AS sub; +len +73556 +SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65535) AS data) AS sub; +len +131070 +SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65536) AS data) AS sub; +len +131072 +SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65537) AS data) AS sub; +len +131074 +# +# MDEV-10717 Assertion `!null_value' failed in virtual bool Item::send(Protocol*, String*) +# +CREATE TABLE t1 (i INT, KEY(i)); +INSERT INTO t1 VALUES (20081205),(20050327); +SELECT HEX(i), HEX(CHAR(i USING utf8)) FROM t1; +HEX(i) HEX(CHAR(i USING utf8)) +131F197 NULL +1326A35 01326A35 +Warnings: +Warning 1300 Invalid utf8 character string: 'F197' +SET sql_mode='STRICT_ALL_TABLES'; +SELECT HEX(i), HEX(CHAR(i USING utf8)) FROM t1; +HEX(i) HEX(CHAR(i USING utf8)) +131F197 NULL +1326A35 01326A35 +Warnings: +Warning 1300 Invalid utf8 character string: 'F197' +SELECT CHAR(i USING utf8) FROM t1; +CHAR(i USING utf8) +### +### +Warnings: +### 1300 Invalid utf8 character string: 'F197' +SET sql_mode=DEFAULT; +DROP TABLE t1; +# +# MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535 +# +SET sql_mode=''; +CREATE TABLE t1 (c1 VARCHAR(21844) CHARACTER SET utf8); +DESCRIBE t1; +Field Type Null Key Default Extra +c1 varchar(21844) YES NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 VARCHAR(21845) CHARACTER SET utf8); +Warnings: +Note 1246 Converting column 'c1' from VARCHAR to TEXT +DESCRIBE t1; +Field Type Null Key Default Extra +c1 text YES NULL +DROP TABLE t1; +CREATE TABLE t1 (c1 VARCHAR(21846) CHARACTER SET utf8); +Warnings: +Note 1246 Converting column 'c1' from VARCHAR to TEXT +DESCRIBE t1; +Field Type Null Key Default Extra +c1 mediumtext YES NULL +DROP TABLE t1; +SET sql_mode=default; +# +# End of 5.5 tests +# +# +# Start of 5.6 tests +# +# +# WL#3664 WEIGHT_STRING +# +set names utf8; +select @@collation_connection; +@@collation_connection +utf8_general_ci +CREATE TABLE t1 AS SELECT 'a' AS a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1) CHARACTER SET utf8 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a)) FROM t1; +HEX(WEIGHT_STRING(a)) +0041 +SELECT HEX(ws) FROM t2; +HEX(ws) +0041 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(5) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a)) FROM t1; +HEX(WEIGHT_STRING(a)) +00410041004100410041 +SELECT HEX(ws) FROM t2; +HEX(ws) +00410041004100410041 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(3))) +004100410041 +SELECT HEX(ws) FROM t2; +HEX(ws) +004100410041 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0041004100410041004100200020002000200020 +SELECT HEX(ws) FROM t2; +HEX(ws) +0041004100410041004100200020002000200020 +DROP TABLE t2; +DROP TABLE t1; +select hex(weight_string('a')); +hex(weight_string('a')) +0041 +select hex(weight_string('A')); +hex(weight_string('A')) +0041 +select hex(weight_string('abc')); +hex(weight_string('abc')) +004100420043 +select hex(weight_string('abc' as char(2))); +hex(weight_string('abc' as char(2))) +00410042 +select hex(weight_string('abc' as char(3))); +hex(weight_string('abc' as char(3))) +004100420043 +select hex(weight_string('abc' as char(5))); +hex(weight_string('abc' as char(5))) +00410042004300200020 +select hex(weight_string('abc', 1, 2, 0xC0)); +hex(weight_string('abc', 1, 2, 0xC0)) +00 +select hex(weight_string('abc', 2, 2, 0xC0)); +hex(weight_string('abc', 2, 2, 0xC0)) +0041 +select hex(weight_string('abc', 3, 2, 0xC0)); +hex(weight_string('abc', 3, 2, 0xC0)) +004100 +select hex(weight_string('abc', 4, 2, 0xC0)); +hex(weight_string('abc', 4, 2, 0xC0)) +00410042 +select hex(weight_string('abc', 5, 2, 0xC0)); +hex(weight_string('abc', 5, 2, 0xC0)) +0041004200 +select hex(weight_string('abc',25, 2, 0xC0)); +hex(weight_string('abc',25, 2, 0xC0)) +00410042002000200020002000200020002000200020002000 +select hex(weight_string('abc', 1, 3, 0xC0)); +hex(weight_string('abc', 1, 3, 0xC0)) +00 +select hex(weight_string('abc', 2, 3, 0xC0)); +hex(weight_string('abc', 2, 3, 0xC0)) +0041 +select hex(weight_string('abc', 3, 3, 0xC0)); +hex(weight_string('abc', 3, 3, 0xC0)) +004100 +select hex(weight_string('abc', 4, 3, 0xC0)); +hex(weight_string('abc', 4, 3, 0xC0)) +00410042 +select hex(weight_string('abc', 5, 3, 0xC0)); +hex(weight_string('abc', 5, 3, 0xC0)) +0041004200 +select hex(weight_string('abc',25, 3, 0xC0)); +hex(weight_string('abc',25, 3, 0xC0)) +00410042004300200020002000200020002000200020002000 +select hex(weight_string('abc', 1, 4, 0xC0)); +hex(weight_string('abc', 1, 4, 0xC0)) +00 +select hex(weight_string('abc', 2, 4, 0xC0)); +hex(weight_string('abc', 2, 4, 0xC0)) +0041 +select hex(weight_string('abc', 3, 4, 0xC0)); +hex(weight_string('abc', 3, 4, 0xC0)) +004100 +select hex(weight_string('abc', 4, 4, 0xC0)); +hex(weight_string('abc', 4, 4, 0xC0)) +00410042 +select hex(weight_string('abc', 5, 4, 0xC0)); +hex(weight_string('abc', 5, 4, 0xC0)) +0041004200 +select hex(weight_string('abc',25, 4, 0xC0)); +hex(weight_string('abc',25, 4, 0xC0)) +00410042004300200020002000200020002000200020002000 +select @@collation_connection; +@@collation_connection +utf8_general_ci +select hex(weight_string(cast(_latin1 0x80 as char))); +hex(weight_string(cast(_latin1 0x80 as char))) +20AC +select hex(weight_string(cast(_latin1 0x808080 as char))); +hex(weight_string(cast(_latin1 0x808080 as char))) +20AC20AC20AC +select hex(weight_string(cast(_latin1 0x808080 as char) as char(2))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(2))) +20AC20AC +select hex(weight_string(cast(_latin1 0x808080 as char) as char(3))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(3))) +20AC20AC20AC +select hex(weight_string(cast(_latin1 0x808080 as char) as char(5))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(5))) +20AC20AC20AC00200020 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0)) +20 +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0)) +20AC +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0)) +20AC20 +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0)) +20AC20AC +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0)) +20AC20AC00 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0)) +20AC20AC002000200020002000200020002000200020002000 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0)) +20 +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0)) +20AC +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0)) +20AC20 +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0)) +20AC20AC +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0)) +20AC20AC20 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0)) +20AC20AC20AC00200020002000200020002000200020002000 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0)) +20 +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0)) +20AC +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0)) +20AC20 +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0)) +20AC20AC +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0)) +20AC20AC20 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0)) +20AC20AC20AC00200020002000200020002000200020002000 +select @@collation_connection; +@@collation_connection +utf8_general_ci +select hex(weight_string('a' LEVEL 1)); +hex(weight_string('a' LEVEL 1)) +0041 +select hex(weight_string('A' LEVEL 1)); +hex(weight_string('A' LEVEL 1)) +0041 +select hex(weight_string('abc' LEVEL 1)); +hex(weight_string('abc' LEVEL 1)) +004100420043 +select hex(weight_string('abc' as char(2) LEVEL 1)); +hex(weight_string('abc' as char(2) LEVEL 1)) +00410042 +select hex(weight_string('abc' as char(3) LEVEL 1)); +hex(weight_string('abc' as char(3) LEVEL 1)) +004100420043 +select hex(weight_string('abc' as char(5) LEVEL 1)); +hex(weight_string('abc' as char(5) LEVEL 1)) +00410042004300200020 +select hex(weight_string('abc' as char(5) LEVEL 1 REVERSE)); +hex(weight_string('abc' as char(5) LEVEL 1 REVERSE)) +20002000430042004100 +select hex(weight_string('abc' as char(5) LEVEL 1 DESC)); +hex(weight_string('abc' as char(5) LEVEL 1 DESC)) +FFBEFFBDFFBCFFDFFFDF +select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE)); +hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE)) +DFFFDFFFBCFFBDFFBEFF +set @@collation_connection=utf8_bin; +select @@collation_connection; +@@collation_connection +utf8_bin +CREATE TABLE t1 AS SELECT 'a' AS a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a)) FROM t1; +HEX(WEIGHT_STRING(a)) +0061 +SELECT HEX(ws) FROM t2; +HEX(ws) +0061 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a',5) AS a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(5) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a)) FROM t1; +HEX(WEIGHT_STRING(a)) +00610061006100610061 +SELECT HEX(ws) FROM t2; +HEX(ws) +00610061006100610061 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(3)) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a AS CHAR(3))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(3))) +006100610061 +SELECT HEX(ws) FROM t2; +HEX(ws) +006100610061 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT WEIGHT_STRING(a AS CHAR(10)) AS ws FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ws` varbinary(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0061006100610061006100200020002000200020 +SELECT HEX(ws) FROM t2; +HEX(ws) +0061006100610061006100200020002000200020 +DROP TABLE t2; +DROP TABLE t1; +select hex(weight_string('a')); +hex(weight_string('a')) +0061 +select hex(weight_string('A')); +hex(weight_string('A')) +0041 +select hex(weight_string('abc')); +hex(weight_string('abc')) +006100620063 +select hex(weight_string('abc' as char(2))); +hex(weight_string('abc' as char(2))) +00610062 +select hex(weight_string('abc' as char(3))); +hex(weight_string('abc' as char(3))) +006100620063 +select hex(weight_string('abc' as char(5))); +hex(weight_string('abc' as char(5))) +00610062006300200020 +select hex(weight_string('abc', 1, 2, 0xC0)); +hex(weight_string('abc', 1, 2, 0xC0)) +00 +select hex(weight_string('abc', 2, 2, 0xC0)); +hex(weight_string('abc', 2, 2, 0xC0)) +0061 +select hex(weight_string('abc', 3, 2, 0xC0)); +hex(weight_string('abc', 3, 2, 0xC0)) +006100 +select hex(weight_string('abc', 4, 2, 0xC0)); +hex(weight_string('abc', 4, 2, 0xC0)) +00610062 +select hex(weight_string('abc', 5, 2, 0xC0)); +hex(weight_string('abc', 5, 2, 0xC0)) +0061006200 +select hex(weight_string('abc',25, 2, 0xC0)); +hex(weight_string('abc',25, 2, 0xC0)) +00610062002000200020002000200020002000200020002000 +select hex(weight_string('abc', 1, 3, 0xC0)); +hex(weight_string('abc', 1, 3, 0xC0)) +00 +select hex(weight_string('abc', 2, 3, 0xC0)); +hex(weight_string('abc', 2, 3, 0xC0)) +0061 +select hex(weight_string('abc', 3, 3, 0xC0)); +hex(weight_string('abc', 3, 3, 0xC0)) +006100 +select hex(weight_string('abc', 4, 3, 0xC0)); +hex(weight_string('abc', 4, 3, 0xC0)) +00610062 +select hex(weight_string('abc', 5, 3, 0xC0)); +hex(weight_string('abc', 5, 3, 0xC0)) +0061006200 +select hex(weight_string('abc',25, 3, 0xC0)); +hex(weight_string('abc',25, 3, 0xC0)) +00610062006300200020002000200020002000200020002000 +select hex(weight_string('abc', 1, 4, 0xC0)); +hex(weight_string('abc', 1, 4, 0xC0)) +00 +select hex(weight_string('abc', 2, 4, 0xC0)); +hex(weight_string('abc', 2, 4, 0xC0)) +0061 +select hex(weight_string('abc', 3, 4, 0xC0)); +hex(weight_string('abc', 3, 4, 0xC0)) +006100 +select hex(weight_string('abc', 4, 4, 0xC0)); +hex(weight_string('abc', 4, 4, 0xC0)) +00610062 +select hex(weight_string('abc', 5, 4, 0xC0)); +hex(weight_string('abc', 5, 4, 0xC0)) +0061006200 +select hex(weight_string('abc',25, 4, 0xC0)); +hex(weight_string('abc',25, 4, 0xC0)) +00610062006300200020002000200020002000200020002000 +select @@collation_connection; +@@collation_connection +utf8_bin +select hex(weight_string(cast(_latin1 0x80 as char))); +hex(weight_string(cast(_latin1 0x80 as char))) +20AC +select hex(weight_string(cast(_latin1 0x808080 as char))); +hex(weight_string(cast(_latin1 0x808080 as char))) +20AC20AC20AC +select hex(weight_string(cast(_latin1 0x808080 as char) as char(2))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(2))) +20AC20AC +select hex(weight_string(cast(_latin1 0x808080 as char) as char(3))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(3))) +20AC20AC20AC +select hex(weight_string(cast(_latin1 0x808080 as char) as char(5))); +hex(weight_string(cast(_latin1 0x808080 as char) as char(5))) +20AC20AC20AC00200020 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 2, 0xC0)) +20 +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 2, 0xC0)) +20AC +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 2, 0xC0)) +20AC20 +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 2, 0xC0)) +20AC20AC +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 2, 0xC0)) +20AC20AC00 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 2, 0xC0)) +20AC20AC002000200020002000200020002000200020002000 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 3, 0xC0)) +20 +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 3, 0xC0)) +20AC +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 3, 0xC0)) +20AC20 +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 3, 0xC0)) +20AC20AC +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 3, 0xC0)) +20AC20AC20 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 3, 0xC0)) +20AC20AC20AC00200020002000200020002000200020002000 +select hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 1, 4, 0xC0)) +20 +select hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 2, 4, 0xC0)) +20AC +select hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 3, 4, 0xC0)) +20AC20 +select hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 4, 4, 0xC0)) +20AC20AC +select hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char), 5, 4, 0xC0)) +20AC20AC20 +select hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0)); +hex(weight_string(cast(_latin1 0x808080 as char),25, 4, 0xC0)) +20AC20AC20AC00200020002000200020002000200020002000 +select @@collation_connection; +@@collation_connection +utf8_bin +select hex(weight_string('a' LEVEL 1)); +hex(weight_string('a' LEVEL 1)) +0061 +select hex(weight_string('A' LEVEL 1)); +hex(weight_string('A' LEVEL 1)) +0041 +select hex(weight_string('abc' LEVEL 1)); +hex(weight_string('abc' LEVEL 1)) +006100620063 +select hex(weight_string('abc' as char(2) LEVEL 1)); +hex(weight_string('abc' as char(2) LEVEL 1)) +00610062 +select hex(weight_string('abc' as char(3) LEVEL 1)); +hex(weight_string('abc' as char(3) LEVEL 1)) +006100620063 +select hex(weight_string('abc' as char(5) LEVEL 1)); +hex(weight_string('abc' as char(5) LEVEL 1)) +00610062006300200020 +select hex(weight_string('abc' as char(5) LEVEL 1 REVERSE)); +hex(weight_string('abc' as char(5) LEVEL 1 REVERSE)) +20002000630062006100 +select hex(weight_string('abc' as char(5) LEVEL 1 DESC)); +hex(weight_string('abc' as char(5) LEVEL 1 DESC)) +FF9EFF9DFF9CFFDFFFDF +select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE)); +hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE)) +DFFFDFFF9CFF9DFF9EFF +# +# Checking strnxfrm() with odd length +# +set max_sort_length=5; +select @@max_sort_length; +@@max_sort_length +5 +create table t1 (a varchar(128) character set utf8 collate utf8_general_ci); +insert into t1 values ('a'),('b'),('c'); +select * from t1 order by a; +a +a +b +c +alter table t1 modify a varchar(128) character set utf8 collate utf8_bin; +select * from t1 order by a; +a +a +b +c +drop table t1; +set max_sort_length=default; +# +# End of 5.6 tests +# +# +# Start of 10.0 tests +# +SET NAMES utf8 COLLATE utf8_bin; +# +# MDEV-7149 Constant condition propagation erroneously applied for LIKE +# +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE CONCAT(c1)='a'; +c1 +a +a +SELECT * FROM t1 WHERE CONCAT(c1) LIKE 'a '; +c1 +a +SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE 'a'=CONCAT(c1); +c1 +a +a +SELECT * FROM t1 WHERE 'a ' LIKE CONCAT(c1); +c1 +a +SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '% '=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '%'=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +# +# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' +# +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; +a LENGTH(a) +a 1 +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +a LENGTH(a) +a 1 +EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` = 'a' and `test`.`t1`.`a` not like 'a ' +DROP TABLE t1; +# +# End of MDEV-8694 +# +SET NAMES utf8; +# +# MDEV-7149 Constant condition propagation erroneously applied for LIKE +# +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE CONCAT(c1)='a'; +c1 +a +a +SELECT * FROM t1 WHERE CONCAT(c1) LIKE 'a '; +c1 +a +SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='a' AND CONCAT(c1) LIKE 'a '; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'a' and concat(`test`.`t1`.`c1`) like 'a ' +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT * FROM t1 WHERE 'a'=CONCAT(c1); +c1 +a +a +SELECT * FROM t1 WHERE 'a ' LIKE CONCAT(c1); +c1 +a +SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +c1 +a +EXPLAIN EXTENDED SELECT * FROM t1 WHERE 'a'=CONCAT(c1) AND 'a ' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where 'a' = concat(`test`.`t1`.`c1`) and 'a ' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '% '=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '% '=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '% ' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('%'),('% '); +SELECT * FROM t1 WHERE '%'=CONCAT(c1); +c1 +% +% +SELECT * FROM t1 WHERE 'a' LIKE CONCAT(c1); +c1 +% +SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +c1 +% +EXPLAIN EXTENDED SELECT * FROM t1 WHERE '%'=CONCAT(c1) AND 'a' LIKE CONCAT(c1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where '%' = concat(`test`.`t1`.`c1`) and 'a' like concat(`test`.`t1`.`c1`) +DROP TABLE t1; +# +# MDEV-8694 Wrong result for SELECT..WHERE a NOT LIKE 'a ' AND a='a' +# +CREATE TABLE t1 AS SELECT SPACE(10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('a'),('a '); +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a '; +a LENGTH(a) +a 1 +SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +a LENGTH(a) +a 1 +EXPLAIN EXTENDED SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,octet_length(`test`.`t1`.`a`) AS `LENGTH(a)` from `test`.`t1` where `test`.`t1`.`a` not like 'a ' and `test`.`t1`.`a` = 'a' +DROP TABLE t1; +# +# End of MDEV-8694 +# +# +# MDEV-7149 Constant condition propagation erroneously applied for LIKE +# +CREATE TABLE t1 AS SELECT REPEAT('a',10) AS c1 LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('ae'),('ä'); +SELECT * FROM t1 WHERE c1='ä'; +c1 +ä +SELECT * FROM t1 WHERE c1 LIKE 'ae'; +c1 +ae +SELECT * FROM t1 WHERE c1='ä' AND c1 LIKE 'ae'; +c1 +EXPLAIN EXTENDED SELECT * FROM t1 WHERE c1='ä' AND c1 LIKE 'ae'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where `test`.`t1`.`c1` = 'ä' and `test`.`t1`.`c1` like 'ae' +SELECT * FROM t1 WHERE CONCAT(c1)='ä'; +c1 +ä +SELECT * FROM t1 WHERE CONCAT(c1) LIKE 'ae'; +c1 +ae +SELECT * FROM t1 WHERE CONCAT(c1)='ä' AND CONCAT(c1) LIKE 'ae'; +c1 +EXPLAIN EXTENDED SELECT * FROM t1 WHERE CONCAT(c1)='ä' AND CONCAT(c1) LIKE 'ae'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` where concat(`test`.`t1`.`c1`) = 'ä' and concat(`test`.`t1`.`c1`) like 'ae' +DROP TABLE IF EXISTS t1; +# +# MDEV-6666 Malformed result for CONCAT(utf8_column, binary_string) +# +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8); +INSERT INTO t1 VALUES ('a'); +SELECT CONCAT(a,0xFF) FROM t1; +ERROR HY000: Invalid utf8 character string: 'FF' +SELECT CONCAT(a,0xC3BF) FROM t1; +CONCAT(a,0xC3BF) +aÿ +DROP TABLE t1; +SELECT CONCAT('a' COLLATE utf8_unicode_ci, _binary 0xFF); +ERROR HY000: Invalid utf8 character string: 'FF' +PREPARE stmt FROM "SELECT CONCAT('a' COLLATE utf8_unicode_ci, ?)"; +SET @arg00=_binary 0xFF; +EXECUTE stmt USING @arg00; +ERROR HY000: Invalid utf8 character string: 'FF' +DEALLOCATE PREPARE stmt; +SET NAMES latin1; +PREPARE stmt FROM "SELECT CONCAT(_utf8'a' COLLATE utf8_unicode_ci, ?)"; +EXECUTE stmt USING @no_such_var; +CONCAT(_utf8'a' COLLATE utf8_unicode_ci, ?) +NULL +DEALLOCATE PREPARE stmt; +SET NAMES utf8; +# +# MDEV-6679 Different optimizer plan for "a BETWEEN 'string' AND ?" and "a BETWEEN ? AND 'string'" +# +SET NAMES utf8, collation_connection=utf8_swedish_ci; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8, b INT NOT NULL DEFAULT 0, key(a)); +INSERT INTO t1 (a) VALUES ('a'),('b'),('c'),('d'),('¢'); +SET @arg='¢'; +PREPARE stmt FROM "EXPLAIN SELECT * FROM t1 WHERE a BETWEEN _utf8'¢' and ?"; +EXECUTE stmt USING @arg; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 33 NULL 1 Using index condition +PREPARE stmt FROM "EXPLAIN SELECT * FROM t1 WHERE a between ? and _utf8'¢'"; +EXECUTE stmt USING @arg; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 33 NULL 1 Using index condition +DEALLOCATE PREPARE stmt; +DROP TABLE t1; +# +# MDEV-6683 A parameter and a string literal with the same values are not recognized as equal by the optimizer +# +SET NAMES utf8, collation_connection=utf8_swedish_ci; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1, b INT NOT NULL DEFAULT 0, key(a)); +INSERT INTO t1 (a) VALUES ('a'),('b'),('c'),('d'),('¢'); +SET @arg='¢'; +PREPARE stmt FROM "EXPLAIN SELECT * FROM t1 WHERE a BETWEEN _utf8'¢' and ?"; +EXECUTE stmt USING @arg; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 13 const 1 Using index condition +PREPARE stmt FROM "EXPLAIN SELECT * FROM t1 WHERE a between ? and _utf8'¢'"; +EXECUTE stmt USING @arg; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 13 const 1 Using index condition +DEALLOCATE PREPARE stmt; +DROP TABLE t1; +# +# MDEV-6688 Illegal mix of collation with bit string B'01100001' +# +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1, b INT); +INSERT INTO t1 VALUES ('a',1); +SELECT CONCAT(a, IF(b>10, _utf8 X'61', _utf8 X'61')) FROM t1; +CONCAT(a, IF(b>10, _utf8 X'61', _utf8 X'61')) +aa +SELECT CONCAT(a, IF(b>10, _utf8 X'61', _utf8 B'01100001')) FROM t1; +CONCAT(a, IF(b>10, _utf8 X'61', _utf8 B'01100001')) +aa +DROP TABLE t1; +# +# MDEV-6694 Illegal mix of collation with a PS parameter +# +SET NAMES utf8; +CREATE TABLE t1 (a INT, b VARCHAR(10) CHARACTER SET latin1); +INSERT INTO t1 VALUES (1,'a'); +SELECT CONCAT(b,IF(a,'b','b')) FROM t1; +CONCAT(b,IF(a,'b','b')) +ab +PREPARE stmt FROM "SELECT CONCAT(b,IF(a,?,?)) FROM t1"; +SET @b='b'; +EXECUTE stmt USING @b,@b; +CONCAT(b,IF(a,?,?)) +ab +SET @b=''; +EXECUTE stmt USING @b,@b; +CONCAT(b,IF(a,?,?)) +a +SET @b='я'; +EXECUTE stmt USING @b,@b; +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'concat' +DEALLOCATE PREPARE stmt; +DROP TABLE t1; +# +# MDEV-7629 Regression: Bit and hex string literals changed column names in 10.0.14 +# +SELECT _utf8 0x7E, _utf8 X'7E', _utf8 B'01111110'; +_utf8 0x7E _utf8 X'7E' _utf8 B'01111110' +~ ~ ~ +# Start of ctype_unescape.inc +SET sql_mode = ''; +SET @query=_binary'SELECT CHARSET(\'test\'),@@character_set_client,@@character_set_connection'; +PREPARE stmt FROM @query; +EXECUTE stmt; +CHARSET('test') @@character_set_client @@character_set_connection +utf8 utf8 utf8 +DEALLOCATE PREPARE stmt; +CREATE TABLE allbytes (a VARBINARY(10)); +# Using selected bytes combinations +CREATE TABLE halfs (a INT); +INSERT INTO halfs VALUES (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07); +INSERT INTO halfs VALUES (0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F); +CREATE TEMPORARY TABLE bytes (a BINARY(1), KEY(a)) ENGINE=MyISAM; +INSERT INTO bytes SELECT CHAR((t1.a << 4) | t2.a USING BINARY) FROM halfs t1, halfs t2; +DROP TABLE halfs; +CREATE TABLE selected_bytes (a VARBINARY(10)); +INSERT INTO selected_bytes (a) VALUES ('\0'),('\b'),('\t'),('\r'),('\n'),('\Z'); +INSERT INTO selected_bytes (a) VALUES ('0'),('b'),('t'),('r'),('n'),('Z'); +INSERT INTO selected_bytes (a) VALUES ('\\'),('_'),('%'),(0x22),(0x27); +INSERT INTO selected_bytes (a) VALUES ('a'); +INSERT INTO selected_bytes (a) VALUES +(0x3F), # 7bit +(0x40), # 7bit mbtail +(0x7E), # 7bit mbtail nonascii-8bit +(0x7F), # 7bit nonascii-8bit +(0x80), # mbtail bad-mb +(0x81), # mbhead mbtail +(0x9F), # mbhead mbtail bad-mb +(0xA0), # mbhead mbtail bad-mb +(0xA1), # mbhead mbtail nonascii-8bit +(0xE0), # mbhead mbtai +(0xEF), # mbhead mbtail +(0xF9), # mbhead mbtail +(0xFA), # mbhead mbtail bad-mb +(0xFC), # mbhead mbtail bad-mb +(0xFD), # mbhead mbtail bad-mb +(0xFE), # mbhead mbtial bad-mb +(0xFF); +INSERT INTO allbytes (a) SELECT a FROM bytes; +INSERT INTO allbytes (a) SELECT CONCAT(t1.a,t2.a) FROM selected_bytes t1,selected_bytes t2; +INSERT INTO allbytes (a) SELECT CONCAT(0x5C,t1.a,t2.a) FROM selected_bytes t1,selected_bytes t2; +INSERT INTO allbytes (a) SELECT CONCAT(0x5C,t1.a,0x5C,t2.a) FROM selected_bytes t1,selected_bytes t2; +DROP TABLE selected_bytes; +DELETE FROM allbytes WHERE +OCTET_LENGTH(a)>1 AND +LOCATE(0x5C,a)=0 AND +a NOT LIKE '%\'%' AND + a NOT LIKE '%"%'; +CREATE PROCEDURE p1(val VARBINARY(10)) +BEGIN +DECLARE EXIT HANDLER FOR SQLSTATE '42000' INSERT INTO t1 (a,b) VALUES(val,NULL); +SET @query=CONCAT(_binary"INSERT INTO t1 (a,b) VALUES (0x",HEX(val),",'",val,"')"); +PREPARE stmt FROM @query; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +END// +CREATE PROCEDURE p2() +BEGIN +DECLARE val VARBINARY(10); +DECLARE done INT DEFAULT FALSE; +DECLARE stmt CURSOR FOR SELECT a FROM allbytes; +DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=TRUE; +OPEN stmt; +read_loop1: LOOP +FETCH stmt INTO val; +IF done THEN +LEAVE read_loop1; +END IF; +CALL p1(val); +END LOOP; +CLOSE stmt; +END// +CREATE FUNCTION iswellformed(a VARBINARY(256)) RETURNS INT RETURN a=BINARY CONVERT(a USING utf8);// +CREATE FUNCTION unescape(a VARBINARY(256)) RETURNS VARBINARY(256) +BEGIN +# We need to do it in a way to avoid producing new escape sequences +# First, enclose all known escsape sequences to '{{xx}}' + # - Backslash not followed by a LIKE pattern characters _ and % +# - Double escapes +# This uses PCRE Branch Reset Groups: (?|(alt1)|(alt2)|(alt3)). +# So '\\1' in the last argument always means the match, no matter +# which alternative it came from. +SET a=REGEXP_REPLACE(a,'(?|(\\\\[^_%])|(\\x{27}\\x{27}))','{{\\1}}'); +# Now unescape all enclosed standard escape sequences +SET a=REPLACE(a,'{{\\0}}', '\0'); +SET a=REPLACE(a,'{{\\b}}', '\b'); +SET a=REPLACE(a,'{{\\t}}', '\t'); +SET a=REPLACE(a,'{{\\r}}', '\r'); +SET a=REPLACE(a,'{{\\n}}', '\n'); +SET a=REPLACE(a,'{{\\Z}}', '\Z'); +SET a=REPLACE(a,'{{\\\'}}', '\''); +# Unescape double quotes +SET a=REPLACE(a,'{{\'\'}}', '\''); + # Unescape the rest: all other \x sequences mean just 'x' + SET a=REGEXP_REPLACE(a, '{{\\\\(.|\\R)}}', '\\1'); + RETURN a; +END// +CREATE FUNCTION unescape_type(a VARBINARY(256),b VARBINARY(256)) RETURNS VARBINARY(256) +BEGIN +RETURN CASE +WHEN b IS NULL THEN '[SyntErr]' + WHEN a=b THEN CASE +WHEN OCTET_LENGTH(a)=1 THEN '[Preserve]' + WHEN a RLIKE '\\\\[_%]' THEN '[Preserve][LIKE]' + WHEN a RLIKE '^[[:ascii:]]+$' THEN '[Preserve][ASCII]' + ELSE '[Preserv][MB]' END +WHEN REPLACE(a,0x5C,'')=b THEN '[Trivial]' + WHEN UNESCAPE(a)=b THEN '[Regular]' + ELSE '[Special]' END; +END// +CREATE FUNCTION wellformedness(a VARBINARY(256), b VARBINARY(256)) +RETURNS VARBINARY(256) +BEGIN +RETURN CASE +WHEN b IS NULL THEN '' + WHEN NOT iswellformed(a) AND iswellformed(b) THEN '[FIXED]' + WHEN iswellformed(a) AND NOT iswellformed(b) THEN '[BROKE]' + WHEN NOT iswellformed(a) AND NOT iswellformed(b) THEN '[ILSEQ]' + ELSE '' + END; +END// +CREATE FUNCTION mysql_real_escape_string_generated(a VARBINARY(256)) +RETURNS VARBINARY(256) +BEGIN +DECLARE a1 BINARY(1) DEFAULT SUBSTR(a,1,1); +DECLARE a2 BINARY(1) DEFAULT SUBSTR(a,2,1); +DECLARE a3 BINARY(1) DEFAULT SUBSTR(a,3,1); +DECLARE a4 BINARY(1) DEFAULT SUBSTR(a,4,1); +DECLARE a2a4 BINARY(2) DEFAULT CONCAT(a2,a4); +RETURN CASE +WHEN (a1=0x5C) AND +(a3=0x5C) AND +(a2>0x7F) AND +(a4 NOT IN ('_','%','0','t','r','n','Z')) AND +iswellformed(a2a4) THEN '[USER]' + ELSE '' + END; +END// +CREATE TABLE t1 (a VARBINARY(10),b VARBINARY(10)); +CALL p2(); +SELECT HEX(a),HEX(b), +CONCAT(unescape_type(a,b), +wellformedness(a,b), +mysql_real_escape_string_generated(a), +IF(UNESCAPE(a)<>b,CONCAT('[BAD',HEX(UNESCAPE(a)),']'),'')) AS comment +FROM t1 ORDER BY LENGTH(a),a; +HEX(a) HEX(b) comment +00 00 [Preserve] +01 01 [Preserve] +02 02 [Preserve] +03 03 [Preserve] +04 04 [Preserve] +05 05 [Preserve] +06 06 [Preserve] +07 07 [Preserve] +08 08 [Preserve] +09 09 [Preserve] +0A 0A [Preserve] +0B 0B [Preserve] +0C 0C [Preserve] +0D 0D [Preserve] +0E 0E [Preserve] +0F 0F [Preserve] +10 10 [Preserve] +11 11 [Preserve] +12 12 [Preserve] +13 13 [Preserve] +14 14 [Preserve] +15 15 [Preserve] +16 16 [Preserve] +17 17 [Preserve] +18 18 [Preserve] +19 19 [Preserve] +1A 1A [Preserve] +1B 1B [Preserve] +1C 1C [Preserve] +1D 1D [Preserve] +1E 1E [Preserve] +1F 1F [Preserve] +20 20 [Preserve] +21 21 [Preserve] +22 22 [Preserve] +23 23 [Preserve] +24 24 [Preserve] +25 25 [Preserve] +26 26 [Preserve] +27 NULL [SyntErr] +28 28 [Preserve] +29 29 [Preserve] +2A 2A [Preserve] +2B 2B [Preserve] +2C 2C [Preserve] +2D 2D [Preserve] +2E 2E [Preserve] +2F 2F [Preserve] +30 30 [Preserve] +31 31 [Preserve] +32 32 [Preserve] +33 33 [Preserve] +34 34 [Preserve] +35 35 [Preserve] +36 36 [Preserve] +37 37 [Preserve] +38 38 [Preserve] +39 39 [Preserve] +3A 3A [Preserve] +3B 3B [Preserve] +3C 3C [Preserve] +3D 3D [Preserve] +3E 3E [Preserve] +3F 3F [Preserve] +40 40 [Preserve] +41 41 [Preserve] +42 42 [Preserve] +43 43 [Preserve] +44 44 [Preserve] +45 45 [Preserve] +46 46 [Preserve] +47 47 [Preserve] +48 48 [Preserve] +49 49 [Preserve] +4A 4A [Preserve] +4B 4B [Preserve] +4C 4C [Preserve] +4D 4D [Preserve] +4E 4E [Preserve] +4F 4F [Preserve] +50 50 [Preserve] +51 51 [Preserve] +52 52 [Preserve] +53 53 [Preserve] +54 54 [Preserve] +55 55 [Preserve] +56 56 [Preserve] +57 57 [Preserve] +58 58 [Preserve] +59 59 [Preserve] +5A 5A [Preserve] +5B 5B [Preserve] +5C NULL [SyntErr] +5D 5D [Preserve] +5E 5E [Preserve] +5F 5F [Preserve] +60 60 [Preserve] +61 61 [Preserve] +62 62 [Preserve] +63 63 [Preserve] +64 64 [Preserve] +65 65 [Preserve] +66 66 [Preserve] +67 67 [Preserve] +68 68 [Preserve] +69 69 [Preserve] +6A 6A [Preserve] +6B 6B [Preserve] +6C 6C [Preserve] +6D 6D [Preserve] +6E 6E [Preserve] +6F 6F [Preserve] +70 70 [Preserve] +71 71 [Preserve] +72 72 [Preserve] +73 73 [Preserve] +74 74 [Preserve] +75 75 [Preserve] +76 76 [Preserve] +77 77 [Preserve] +78 78 [Preserve] +79 79 [Preserve] +7A 7A [Preserve] +7B 7B [Preserve] +7C 7C [Preserve] +7D 7D [Preserve] +7E 7E [Preserve] +7F 7F [Preserve] +80 80 [Preserve][ILSEQ] +81 81 [Preserve][ILSEQ] +82 82 [Preserve][ILSEQ] +83 83 [Preserve][ILSEQ] +84 84 [Preserve][ILSEQ] +85 85 [Preserve][ILSEQ] +86 86 [Preserve][ILSEQ] +87 87 [Preserve][ILSEQ] +88 88 [Preserve][ILSEQ] +89 89 [Preserve][ILSEQ] +8A 8A [Preserve][ILSEQ] +8B 8B [Preserve][ILSEQ] +8C 8C [Preserve][ILSEQ] +8D 8D [Preserve][ILSEQ] +8E 8E [Preserve][ILSEQ] +8F 8F [Preserve][ILSEQ] +90 90 [Preserve][ILSEQ] +91 91 [Preserve][ILSEQ] +92 92 [Preserve][ILSEQ] +93 93 [Preserve][ILSEQ] +94 94 [Preserve][ILSEQ] +95 95 [Preserve][ILSEQ] +96 96 [Preserve][ILSEQ] +97 97 [Preserve][ILSEQ] +98 98 [Preserve][ILSEQ] +99 99 [Preserve][ILSEQ] +9A 9A [Preserve][ILSEQ] +9B 9B [Preserve][ILSEQ] +9C 9C [Preserve][ILSEQ] +9D 9D [Preserve][ILSEQ] +9E 9E [Preserve][ILSEQ] +9F 9F [Preserve][ILSEQ] +A0 A0 [Preserve][ILSEQ] +A1 A1 [Preserve][ILSEQ] +A2 A2 [Preserve][ILSEQ] +A3 A3 [Preserve][ILSEQ] +A4 A4 [Preserve][ILSEQ] +A5 A5 [Preserve][ILSEQ] +A6 A6 [Preserve][ILSEQ] +A7 A7 [Preserve][ILSEQ] +A8 A8 [Preserve][ILSEQ] +A9 A9 [Preserve][ILSEQ] +AA AA [Preserve][ILSEQ] +AB AB [Preserve][ILSEQ] +AC AC [Preserve][ILSEQ] +AD AD [Preserve][ILSEQ] +AE AE [Preserve][ILSEQ] +AF AF [Preserve][ILSEQ] +B0 B0 [Preserve][ILSEQ] +B1 B1 [Preserve][ILSEQ] +B2 B2 [Preserve][ILSEQ] +B3 B3 [Preserve][ILSEQ] +B4 B4 [Preserve][ILSEQ] +B5 B5 [Preserve][ILSEQ] +B6 B6 [Preserve][ILSEQ] +B7 B7 [Preserve][ILSEQ] +B8 B8 [Preserve][ILSEQ] +B9 B9 [Preserve][ILSEQ] +BA BA [Preserve][ILSEQ] +BB BB [Preserve][ILSEQ] +BC BC [Preserve][ILSEQ] +BD BD [Preserve][ILSEQ] +BE BE [Preserve][ILSEQ] +BF BF [Preserve][ILSEQ] +C0 C0 [Preserve][ILSEQ] +C1 C1 [Preserve][ILSEQ] +C2 C2 [Preserve][ILSEQ] +C3 C3 [Preserve][ILSEQ] +C4 C4 [Preserve][ILSEQ] +C5 C5 [Preserve][ILSEQ] +C6 C6 [Preserve][ILSEQ] +C7 C7 [Preserve][ILSEQ] +C8 C8 [Preserve][ILSEQ] +C9 C9 [Preserve][ILSEQ] +CA CA [Preserve][ILSEQ] +CB CB [Preserve][ILSEQ] +CC CC [Preserve][ILSEQ] +CD CD [Preserve][ILSEQ] +CE CE [Preserve][ILSEQ] +CF CF [Preserve][ILSEQ] +D0 D0 [Preserve][ILSEQ] +D1 D1 [Preserve][ILSEQ] +D2 D2 [Preserve][ILSEQ] +D3 D3 [Preserve][ILSEQ] +D4 D4 [Preserve][ILSEQ] +D5 D5 [Preserve][ILSEQ] +D6 D6 [Preserve][ILSEQ] +D7 D7 [Preserve][ILSEQ] +D8 D8 [Preserve][ILSEQ] +D9 D9 [Preserve][ILSEQ] +DA DA [Preserve][ILSEQ] +DB DB [Preserve][ILSEQ] +DC DC [Preserve][ILSEQ] +DD DD [Preserve][ILSEQ] +DE DE [Preserve][ILSEQ] +DF DF [Preserve][ILSEQ] +E0 E0 [Preserve][ILSEQ] +E1 E1 [Preserve][ILSEQ] +E2 E2 [Preserve][ILSEQ] +E3 E3 [Preserve][ILSEQ] +E4 E4 [Preserve][ILSEQ] +E5 E5 [Preserve][ILSEQ] +E6 E6 [Preserve][ILSEQ] +E7 E7 [Preserve][ILSEQ] +E8 E8 [Preserve][ILSEQ] +E9 E9 [Preserve][ILSEQ] +EA EA [Preserve][ILSEQ] +EB EB [Preserve][ILSEQ] +EC EC [Preserve][ILSEQ] +ED ED [Preserve][ILSEQ] +EE EE [Preserve][ILSEQ] +EF EF [Preserve][ILSEQ] +F0 F0 [Preserve][ILSEQ] +F1 F1 [Preserve][ILSEQ] +F2 F2 [Preserve][ILSEQ] +F3 F3 [Preserve][ILSEQ] +F4 F4 [Preserve][ILSEQ] +F5 F5 [Preserve][ILSEQ] +F6 F6 [Preserve][ILSEQ] +F7 F7 [Preserve][ILSEQ] +F8 F8 [Preserve][ILSEQ] +F9 F9 [Preserve][ILSEQ] +FA FA [Preserve][ILSEQ] +FB FB [Preserve][ILSEQ] +FC FC [Preserve][ILSEQ] +FD FD [Preserve][ILSEQ] +FE FE [Preserve][ILSEQ] +FF FF [Preserve][ILSEQ] +0022 0022 [Preserve][ASCII] +0027 NULL [SyntErr] +005C NULL [SyntErr] +0822 0822 [Preserve][ASCII] +0827 NULL [SyntErr] +085C NULL [SyntErr] +0922 0922 [Preserve][ASCII] +0927 NULL [SyntErr] +095C NULL [SyntErr] +0A22 0A22 [Preserve][ASCII] +0A27 NULL [SyntErr] +0A5C NULL [SyntErr] +0D22 0D22 [Preserve][ASCII] +0D27 NULL [SyntErr] +0D5C NULL [SyntErr] +1A22 1A22 [Preserve][ASCII] +1A27 NULL [SyntErr] +1A5C NULL [SyntErr] +2200 2200 [Preserve][ASCII] +2208 2208 [Preserve][ASCII] +2209 2209 [Preserve][ASCII] +220A 220A [Preserve][ASCII] +220D 220D [Preserve][ASCII] +221A 221A [Preserve][ASCII] +2222 2222 [Preserve][ASCII] +2225 2225 [Preserve][ASCII] +2227 NULL [SyntErr] +2230 2230 [Preserve][ASCII] +223F 223F [Preserve][ASCII] +2240 2240 [Preserve][ASCII] +225A 225A [Preserve][ASCII] +225C NULL [SyntErr] +225F 225F [Preserve][ASCII] +2261 2261 [Preserve][ASCII] +2262 2262 [Preserve][ASCII] +226E 226E [Preserve][ASCII] +2272 2272 [Preserve][ASCII] +2274 2274 [Preserve][ASCII] +227E 227E [Preserve][ASCII] +227F 227F [Preserve][ASCII] +2280 2280 [Preserv][MB][ILSEQ] +2281 2281 [Preserv][MB][ILSEQ] +229F 229F [Preserv][MB][ILSEQ] +22A0 22A0 [Preserv][MB][ILSEQ] +22A1 22A1 [Preserv][MB][ILSEQ] +22E0 22E0 [Preserv][MB][ILSEQ] +22EF 22EF [Preserv][MB][ILSEQ] +22F9 22F9 [Preserv][MB][ILSEQ] +22FA 22FA [Preserv][MB][ILSEQ] +22FC 22FC [Preserv][MB][ILSEQ] +22FD 22FD [Preserv][MB][ILSEQ] +22FE 22FE [Preserv][MB][ILSEQ] +22FF 22FF [Preserv][MB][ILSEQ] +2522 2522 [Preserve][ASCII] +2527 NULL [SyntErr] +255C NULL [SyntErr] +2700 NULL [SyntErr] +2708 NULL [SyntErr] +2709 NULL [SyntErr] +270A NULL [SyntErr] +270D NULL [SyntErr] +271A NULL [SyntErr] +2722 NULL [SyntErr] +2725 NULL [SyntErr] +2727 27 [Regular] +2730 NULL [SyntErr] +273F NULL [SyntErr] +2740 NULL [SyntErr] +275A NULL [SyntErr] +275C NULL [SyntErr] +275F NULL [SyntErr] +2761 NULL [SyntErr] +2762 NULL [SyntErr] +276E NULL [SyntErr] +2772 NULL [SyntErr] +2774 NULL [SyntErr] +277E NULL [SyntErr] +277F NULL [SyntErr] +2780 NULL [SyntErr] +2781 NULL [SyntErr] +279F NULL [SyntErr] +27A0 NULL [SyntErr] +27A1 NULL [SyntErr] +27E0 NULL [SyntErr] +27EF NULL [SyntErr] +27F9 NULL [SyntErr] +27FA NULL [SyntErr] +27FC NULL [SyntErr] +27FD NULL [SyntErr] +27FE NULL [SyntErr] +27FF NULL [SyntErr] +3022 3022 [Preserve][ASCII] +3027 NULL [SyntErr] +305C NULL [SyntErr] +3F22 3F22 [Preserve][ASCII] +3F27 NULL [SyntErr] +3F5C NULL [SyntErr] +4022 4022 [Preserve][ASCII] +4027 NULL [SyntErr] +405C NULL [SyntErr] +5A22 5A22 [Preserve][ASCII] +5A27 NULL [SyntErr] +5A5C NULL [SyntErr] +5C00 00 [Trivial] +5C08 08 [Trivial] +5C09 09 [Trivial] +5C0A 0A [Trivial] +5C0D 0D [Trivial] +5C1A 1A [Trivial] +5C22 22 [Trivial] +5C25 5C25 [Preserve][LIKE] +5C27 27 [Trivial] +5C30 00 [Regular] +5C3F 3F [Trivial] +5C40 40 [Trivial] +5C5A 1A [Regular] +5C5C 5C [Regular] +5C5F 5C5F [Preserve][LIKE] +5C61 61 [Trivial] +5C62 08 [Regular] +5C6E 0A [Regular] +5C72 0D [Regular] +5C74 09 [Regular] +5C7E 7E [Trivial] +5C7F 7F [Trivial] +5C80 80 [Trivial][ILSEQ] +5C81 81 [Trivial][ILSEQ] +5C9F 9F [Trivial][ILSEQ] +5CA0 A0 [Trivial][ILSEQ] +5CA1 A1 [Trivial][ILSEQ] +5CE0 E0 [Trivial][ILSEQ] +5CEF EF [Trivial][ILSEQ] +5CF9 F9 [Trivial][ILSEQ] +5CFA FA [Trivial][ILSEQ] +5CFC FC [Trivial][ILSEQ] +5CFD FD [Trivial][ILSEQ] +5CFE FE [Trivial][ILSEQ] +5CFF FF [Trivial][ILSEQ] +5F22 5F22 [Preserve][ASCII] +5F27 NULL [SyntErr] +5F5C NULL [SyntErr] +6122 6122 [Preserve][ASCII] +6127 NULL [SyntErr] +615C NULL [SyntErr] +6222 6222 [Preserve][ASCII] +6227 NULL [SyntErr] +625C NULL [SyntErr] +6E22 6E22 [Preserve][ASCII] +6E27 NULL [SyntErr] +6E5C NULL [SyntErr] +7222 7222 [Preserve][ASCII] +7227 NULL [SyntErr] +725C NULL [SyntErr] +7422 7422 [Preserve][ASCII] +7427 NULL [SyntErr] +745C NULL [SyntErr] +7E22 7E22 [Preserve][ASCII] +7E27 NULL [SyntErr] +7E5C NULL [SyntErr] +7F22 7F22 [Preserve][ASCII] +7F27 NULL [SyntErr] +7F5C NULL [SyntErr] +8022 8022 [Preserv][MB][ILSEQ] +8027 NULL [SyntErr] +805C NULL [SyntErr] +8122 8122 [Preserv][MB][ILSEQ] +8127 NULL [SyntErr] +815C NULL [SyntErr] +9F22 9F22 [Preserv][MB][ILSEQ] +9F27 NULL [SyntErr] +9F5C NULL [SyntErr] +A022 A022 [Preserv][MB][ILSEQ] +A027 NULL [SyntErr] +A05C NULL [SyntErr] +A122 A122 [Preserv][MB][ILSEQ] +A127 NULL [SyntErr] +A15C NULL [SyntErr] +E022 E022 [Preserv][MB][ILSEQ] +E027 NULL [SyntErr] +E05C NULL [SyntErr] +EF22 EF22 [Preserv][MB][ILSEQ] +EF27 NULL [SyntErr] +EF5C NULL [SyntErr] +F922 F922 [Preserv][MB][ILSEQ] +F927 NULL [SyntErr] +F95C NULL [SyntErr] +FA22 FA22 [Preserv][MB][ILSEQ] +FA27 NULL [SyntErr] +FA5C NULL [SyntErr] +FC22 FC22 [Preserv][MB][ILSEQ] +FC27 NULL [SyntErr] +FC5C NULL [SyntErr] +FD22 FD22 [Preserv][MB][ILSEQ] +FD27 NULL [SyntErr] +FD5C NULL [SyntErr] +FE22 FE22 [Preserv][MB][ILSEQ] +FE27 NULL [SyntErr] +FE5C NULL [SyntErr] +FF22 FF22 [Preserv][MB][ILSEQ] +FF27 NULL [SyntErr] +FF5C NULL [SyntErr] +5C0000 0000 [Trivial] +5C0008 0008 [Trivial] +5C0009 0009 [Trivial] +5C000A 000A [Trivial] +5C000D 000D [Trivial] +5C001A 001A [Trivial] +5C0022 0022 [Trivial] +5C0025 0025 [Trivial] +5C0027 NULL [SyntErr] +5C0030 0030 [Trivial] +5C003F 003F [Trivial] +5C0040 0040 [Trivial] +5C005A 005A [Trivial] +5C005C NULL [SyntErr] +5C005F 005F [Trivial] +5C0061 0061 [Trivial] +5C0062 0062 [Trivial] +5C006E 006E [Trivial] +5C0072 0072 [Trivial] +5C0074 0074 [Trivial] +5C007E 007E [Trivial] +5C007F 007F [Trivial] +5C0080 0080 [Trivial][ILSEQ] +5C0081 0081 [Trivial][ILSEQ] +5C009F 009F [Trivial][ILSEQ] +5C00A0 00A0 [Trivial][ILSEQ] +5C00A1 00A1 [Trivial][ILSEQ] +5C00E0 00E0 [Trivial][ILSEQ] +5C00EF 00EF [Trivial][ILSEQ] +5C00F9 00F9 [Trivial][ILSEQ] +5C00FA 00FA [Trivial][ILSEQ] +5C00FC 00FC [Trivial][ILSEQ] +5C00FD 00FD [Trivial][ILSEQ] +5C00FE 00FE [Trivial][ILSEQ] +5C00FF 00FF [Trivial][ILSEQ] +5C0800 0800 [Trivial] +5C0808 0808 [Trivial] +5C0809 0809 [Trivial] +5C080A 080A [Trivial] +5C080D 080D [Trivial] +5C081A 081A [Trivial] +5C0822 0822 [Trivial] +5C0825 0825 [Trivial] +5C0827 NULL [SyntErr] +5C0830 0830 [Trivial] +5C083F 083F [Trivial] +5C0840 0840 [Trivial] +5C085A 085A [Trivial] +5C085C NULL [SyntErr] +5C085F 085F [Trivial] +5C0861 0861 [Trivial] +5C0862 0862 [Trivial] +5C086E 086E [Trivial] +5C0872 0872 [Trivial] +5C0874 0874 [Trivial] +5C087E 087E [Trivial] +5C087F 087F [Trivial] +5C0880 0880 [Trivial][ILSEQ] +5C0881 0881 [Trivial][ILSEQ] +5C089F 089F [Trivial][ILSEQ] +5C08A0 08A0 [Trivial][ILSEQ] +5C08A1 08A1 [Trivial][ILSEQ] +5C08E0 08E0 [Trivial][ILSEQ] +5C08EF 08EF [Trivial][ILSEQ] +5C08F9 08F9 [Trivial][ILSEQ] +5C08FA 08FA [Trivial][ILSEQ] +5C08FC 08FC [Trivial][ILSEQ] +5C08FD 08FD [Trivial][ILSEQ] +5C08FE 08FE [Trivial][ILSEQ] +5C08FF 08FF [Trivial][ILSEQ] +5C0900 0900 [Trivial] +5C0908 0908 [Trivial] +5C0909 0909 [Trivial] +5C090A 090A [Trivial] +5C090D 090D [Trivial] +5C091A 091A [Trivial] +5C0922 0922 [Trivial] +5C0925 0925 [Trivial] +5C0927 NULL [SyntErr] +5C0930 0930 [Trivial] +5C093F 093F [Trivial] +5C0940 0940 [Trivial] +5C095A 095A [Trivial] +5C095C NULL [SyntErr] +5C095F 095F [Trivial] +5C0961 0961 [Trivial] +5C0962 0962 [Trivial] +5C096E 096E [Trivial] +5C0972 0972 [Trivial] +5C0974 0974 [Trivial] +5C097E 097E [Trivial] +5C097F 097F [Trivial] +5C0980 0980 [Trivial][ILSEQ] +5C0981 0981 [Trivial][ILSEQ] +5C099F 099F [Trivial][ILSEQ] +5C09A0 09A0 [Trivial][ILSEQ] +5C09A1 09A1 [Trivial][ILSEQ] +5C09E0 09E0 [Trivial][ILSEQ] +5C09EF 09EF [Trivial][ILSEQ] +5C09F9 09F9 [Trivial][ILSEQ] +5C09FA 09FA [Trivial][ILSEQ] +5C09FC 09FC [Trivial][ILSEQ] +5C09FD 09FD [Trivial][ILSEQ] +5C09FE 09FE [Trivial][ILSEQ] +5C09FF 09FF [Trivial][ILSEQ] +5C0A00 0A00 [Trivial] +5C0A08 0A08 [Trivial] +5C0A09 0A09 [Trivial] +5C0A0A 0A0A [Trivial] +5C0A0D 0A0D [Trivial] +5C0A1A 0A1A [Trivial] +5C0A22 0A22 [Trivial] +5C0A25 0A25 [Trivial] +5C0A27 NULL [SyntErr] +5C0A30 0A30 [Trivial] +5C0A3F 0A3F [Trivial] +5C0A40 0A40 [Trivial] +5C0A5A 0A5A [Trivial] +5C0A5C NULL [SyntErr] +5C0A5F 0A5F [Trivial] +5C0A61 0A61 [Trivial] +5C0A62 0A62 [Trivial] +5C0A6E 0A6E [Trivial] +5C0A72 0A72 [Trivial] +5C0A74 0A74 [Trivial] +5C0A7E 0A7E [Trivial] +5C0A7F 0A7F [Trivial] +5C0A80 0A80 [Trivial][ILSEQ] +5C0A81 0A81 [Trivial][ILSEQ] +5C0A9F 0A9F [Trivial][ILSEQ] +5C0AA0 0AA0 [Trivial][ILSEQ] +5C0AA1 0AA1 [Trivial][ILSEQ] +5C0AE0 0AE0 [Trivial][ILSEQ] +5C0AEF 0AEF [Trivial][ILSEQ] +5C0AF9 0AF9 [Trivial][ILSEQ] +5C0AFA 0AFA [Trivial][ILSEQ] +5C0AFC 0AFC [Trivial][ILSEQ] +5C0AFD 0AFD [Trivial][ILSEQ] +5C0AFE 0AFE [Trivial][ILSEQ] +5C0AFF 0AFF [Trivial][ILSEQ] +5C0D00 0D00 [Trivial] +5C0D08 0D08 [Trivial] +5C0D09 0D09 [Trivial] +5C0D0A 0D0A [Trivial] +5C0D0D 0D0D [Trivial] +5C0D1A 0D1A [Trivial] +5C0D22 0D22 [Trivial] +5C0D25 0D25 [Trivial] +5C0D27 NULL [SyntErr] +5C0D30 0D30 [Trivial] +5C0D3F 0D3F [Trivial] +5C0D40 0D40 [Trivial] +5C0D5A 0D5A [Trivial] +5C0D5C NULL [SyntErr] +5C0D5F 0D5F [Trivial] +5C0D61 0D61 [Trivial] +5C0D62 0D62 [Trivial] +5C0D6E 0D6E [Trivial] +5C0D72 0D72 [Trivial] +5C0D74 0D74 [Trivial] +5C0D7E 0D7E [Trivial] +5C0D7F 0D7F [Trivial] +5C0D80 0D80 [Trivial][ILSEQ] +5C0D81 0D81 [Trivial][ILSEQ] +5C0D9F 0D9F [Trivial][ILSEQ] +5C0DA0 0DA0 [Trivial][ILSEQ] +5C0DA1 0DA1 [Trivial][ILSEQ] +5C0DE0 0DE0 [Trivial][ILSEQ] +5C0DEF 0DEF [Trivial][ILSEQ] +5C0DF9 0DF9 [Trivial][ILSEQ] +5C0DFA 0DFA [Trivial][ILSEQ] +5C0DFC 0DFC [Trivial][ILSEQ] +5C0DFD 0DFD [Trivial][ILSEQ] +5C0DFE 0DFE [Trivial][ILSEQ] +5C0DFF 0DFF [Trivial][ILSEQ] +5C1A00 1A00 [Trivial] +5C1A08 1A08 [Trivial] +5C1A09 1A09 [Trivial] +5C1A0A 1A0A [Trivial] +5C1A0D 1A0D [Trivial] +5C1A1A 1A1A [Trivial] +5C1A22 1A22 [Trivial] +5C1A25 1A25 [Trivial] +5C1A27 NULL [SyntErr] +5C1A30 1A30 [Trivial] +5C1A3F 1A3F [Trivial] +5C1A40 1A40 [Trivial] +5C1A5A 1A5A [Trivial] +5C1A5C NULL [SyntErr] +5C1A5F 1A5F [Trivial] +5C1A61 1A61 [Trivial] +5C1A62 1A62 [Trivial] +5C1A6E 1A6E [Trivial] +5C1A72 1A72 [Trivial] +5C1A74 1A74 [Trivial] +5C1A7E 1A7E [Trivial] +5C1A7F 1A7F [Trivial] +5C1A80 1A80 [Trivial][ILSEQ] +5C1A81 1A81 [Trivial][ILSEQ] +5C1A9F 1A9F [Trivial][ILSEQ] +5C1AA0 1AA0 [Trivial][ILSEQ] +5C1AA1 1AA1 [Trivial][ILSEQ] +5C1AE0 1AE0 [Trivial][ILSEQ] +5C1AEF 1AEF [Trivial][ILSEQ] +5C1AF9 1AF9 [Trivial][ILSEQ] +5C1AFA 1AFA [Trivial][ILSEQ] +5C1AFC 1AFC [Trivial][ILSEQ] +5C1AFD 1AFD [Trivial][ILSEQ] +5C1AFE 1AFE [Trivial][ILSEQ] +5C1AFF 1AFF [Trivial][ILSEQ] +5C2200 2200 [Trivial] +5C2208 2208 [Trivial] +5C2209 2209 [Trivial] +5C220A 220A [Trivial] +5C220D 220D [Trivial] +5C221A 221A [Trivial] +5C2222 2222 [Trivial] +5C2225 2225 [Trivial] +5C2227 NULL [SyntErr] +5C2230 2230 [Trivial] +5C223F 223F [Trivial] +5C2240 2240 [Trivial] +5C225A 225A [Trivial] +5C225C NULL [SyntErr] +5C225F 225F [Trivial] +5C2261 2261 [Trivial] +5C2262 2262 [Trivial] +5C226E 226E [Trivial] +5C2272 2272 [Trivial] +5C2274 2274 [Trivial] +5C227E 227E [Trivial] +5C227F 227F [Trivial] +5C2280 2280 [Trivial][ILSEQ] +5C2281 2281 [Trivial][ILSEQ] +5C229F 229F [Trivial][ILSEQ] +5C22A0 22A0 [Trivial][ILSEQ] +5C22A1 22A1 [Trivial][ILSEQ] +5C22E0 22E0 [Trivial][ILSEQ] +5C22EF 22EF [Trivial][ILSEQ] +5C22F9 22F9 [Trivial][ILSEQ] +5C22FA 22FA [Trivial][ILSEQ] +5C22FC 22FC [Trivial][ILSEQ] +5C22FD 22FD [Trivial][ILSEQ] +5C22FE 22FE [Trivial][ILSEQ] +5C22FF 22FF [Trivial][ILSEQ] +5C2500 5C2500 [Preserve][LIKE] +5C2508 5C2508 [Preserve][LIKE] +5C2509 5C2509 [Preserve][LIKE] +5C250A 5C250A [Preserve][LIKE] +5C250D 5C250D [Preserve][LIKE] +5C251A 5C251A [Preserve][LIKE] +5C2522 5C2522 [Preserve][LIKE] +5C2525 5C2525 [Preserve][LIKE] +5C2527 NULL [SyntErr] +5C2530 5C2530 [Preserve][LIKE] +5C253F 5C253F [Preserve][LIKE] +5C2540 5C2540 [Preserve][LIKE] +5C255A 5C255A [Preserve][LIKE] +5C255C NULL [SyntErr] +5C255F 5C255F [Preserve][LIKE] +5C2561 5C2561 [Preserve][LIKE] +5C2562 5C2562 [Preserve][LIKE] +5C256E 5C256E [Preserve][LIKE] +5C2572 5C2572 [Preserve][LIKE] +5C2574 5C2574 [Preserve][LIKE] +5C257E 5C257E [Preserve][LIKE] +5C257F 5C257F [Preserve][LIKE] +5C2580 5C2580 [Preserve][LIKE][ILSEQ] +5C2581 5C2581 [Preserve][LIKE][ILSEQ] +5C259F 5C259F [Preserve][LIKE][ILSEQ] +5C25A0 5C25A0 [Preserve][LIKE][ILSEQ] +5C25A1 5C25A1 [Preserve][LIKE][ILSEQ] +5C25E0 5C25E0 [Preserve][LIKE][ILSEQ] +5C25EF 5C25EF [Preserve][LIKE][ILSEQ] +5C25F9 5C25F9 [Preserve][LIKE][ILSEQ] +5C25FA 5C25FA [Preserve][LIKE][ILSEQ] +5C25FC 5C25FC [Preserve][LIKE][ILSEQ] +5C25FD 5C25FD [Preserve][LIKE][ILSEQ] +5C25FE 5C25FE [Preserve][LIKE][ILSEQ] +5C25FF 5C25FF [Preserve][LIKE][ILSEQ] +5C2700 2700 [Trivial] +5C2708 2708 [Trivial] +5C2709 2709 [Trivial] +5C270A 270A [Trivial] +5C270D 270D [Trivial] +5C271A 271A [Trivial] +5C2722 2722 [Trivial] +5C2725 2725 [Trivial] +5C2727 NULL [SyntErr] +5C2730 2730 [Trivial] +5C273F 273F [Trivial] +5C2740 2740 [Trivial] +5C275A 275A [Trivial] +5C275C NULL [SyntErr] +5C275F 275F [Trivial] +5C2761 2761 [Trivial] +5C2762 2762 [Trivial] +5C276E 276E [Trivial] +5C2772 2772 [Trivial] +5C2774 2774 [Trivial] +5C277E 277E [Trivial] +5C277F 277F [Trivial] +5C2780 2780 [Trivial][ILSEQ] +5C2781 2781 [Trivial][ILSEQ] +5C279F 279F [Trivial][ILSEQ] +5C27A0 27A0 [Trivial][ILSEQ] +5C27A1 27A1 [Trivial][ILSEQ] +5C27E0 27E0 [Trivial][ILSEQ] +5C27EF 27EF [Trivial][ILSEQ] +5C27F9 27F9 [Trivial][ILSEQ] +5C27FA 27FA [Trivial][ILSEQ] +5C27FC 27FC [Trivial][ILSEQ] +5C27FD 27FD [Trivial][ILSEQ] +5C27FE 27FE [Trivial][ILSEQ] +5C27FF 27FF [Trivial][ILSEQ] +5C3000 0000 [Regular] +5C3008 0008 [Regular] +5C3009 0009 [Regular] +5C300A 000A [Regular] +5C300D 000D [Regular] +5C301A 001A [Regular] +5C3022 0022 [Regular] +5C3025 0025 [Regular] +5C3027 NULL [SyntErr] +5C3030 0030 [Regular] +5C303F 003F [Regular] +5C3040 0040 [Regular] +5C305A 005A [Regular] +5C305C NULL [SyntErr] +5C305F 005F [Regular] +5C3061 0061 [Regular] +5C3062 0062 [Regular] +5C306E 006E [Regular] +5C3072 0072 [Regular] +5C3074 0074 [Regular] +5C307E 007E [Regular] +5C307F 007F [Regular] +5C3080 0080 [Regular][ILSEQ] +5C3081 0081 [Regular][ILSEQ] +5C309F 009F [Regular][ILSEQ] +5C30A0 00A0 [Regular][ILSEQ] +5C30A1 00A1 [Regular][ILSEQ] +5C30E0 00E0 [Regular][ILSEQ] +5C30EF 00EF [Regular][ILSEQ] +5C30F9 00F9 [Regular][ILSEQ] +5C30FA 00FA [Regular][ILSEQ] +5C30FC 00FC [Regular][ILSEQ] +5C30FD 00FD [Regular][ILSEQ] +5C30FE 00FE [Regular][ILSEQ] +5C30FF 00FF [Regular][ILSEQ] +5C3F00 3F00 [Trivial] +5C3F08 3F08 [Trivial] +5C3F09 3F09 [Trivial] +5C3F0A 3F0A [Trivial] +5C3F0D 3F0D [Trivial] +5C3F1A 3F1A [Trivial] +5C3F22 3F22 [Trivial] +5C3F25 3F25 [Trivial] +5C3F27 NULL [SyntErr] +5C3F30 3F30 [Trivial] +5C3F3F 3F3F [Trivial] +5C3F40 3F40 [Trivial] +5C3F5A 3F5A [Trivial] +5C3F5C NULL [SyntErr] +5C3F5F 3F5F [Trivial] +5C3F61 3F61 [Trivial] +5C3F62 3F62 [Trivial] +5C3F6E 3F6E [Trivial] +5C3F72 3F72 [Trivial] +5C3F74 3F74 [Trivial] +5C3F7E 3F7E [Trivial] +5C3F7F 3F7F [Trivial] +5C3F80 3F80 [Trivial][ILSEQ] +5C3F81 3F81 [Trivial][ILSEQ] +5C3F9F 3F9F [Trivial][ILSEQ] +5C3FA0 3FA0 [Trivial][ILSEQ] +5C3FA1 3FA1 [Trivial][ILSEQ] +5C3FE0 3FE0 [Trivial][ILSEQ] +5C3FEF 3FEF [Trivial][ILSEQ] +5C3FF9 3FF9 [Trivial][ILSEQ] +5C3FFA 3FFA [Trivial][ILSEQ] +5C3FFC 3FFC [Trivial][ILSEQ] +5C3FFD 3FFD [Trivial][ILSEQ] +5C3FFE 3FFE [Trivial][ILSEQ] +5C3FFF 3FFF [Trivial][ILSEQ] +5C4000 4000 [Trivial] +5C4008 4008 [Trivial] +5C4009 4009 [Trivial] +5C400A 400A [Trivial] +5C400D 400D [Trivial] +5C401A 401A [Trivial] +5C4022 4022 [Trivial] +5C4025 4025 [Trivial] +5C4027 NULL [SyntErr] +5C4030 4030 [Trivial] +5C403F 403F [Trivial] +5C4040 4040 [Trivial] +5C405A 405A [Trivial] +5C405C NULL [SyntErr] +5C405F 405F [Trivial] +5C4061 4061 [Trivial] +5C4062 4062 [Trivial] +5C406E 406E [Trivial] +5C4072 4072 [Trivial] +5C4074 4074 [Trivial] +5C407E 407E [Trivial] +5C407F 407F [Trivial] +5C4080 4080 [Trivial][ILSEQ] +5C4081 4081 [Trivial][ILSEQ] +5C409F 409F [Trivial][ILSEQ] +5C40A0 40A0 [Trivial][ILSEQ] +5C40A1 40A1 [Trivial][ILSEQ] +5C40E0 40E0 [Trivial][ILSEQ] +5C40EF 40EF [Trivial][ILSEQ] +5C40F9 40F9 [Trivial][ILSEQ] +5C40FA 40FA [Trivial][ILSEQ] +5C40FC 40FC [Trivial][ILSEQ] +5C40FD 40FD [Trivial][ILSEQ] +5C40FE 40FE [Trivial][ILSEQ] +5C40FF 40FF [Trivial][ILSEQ] +5C5A00 1A00 [Regular] +5C5A08 1A08 [Regular] +5C5A09 1A09 [Regular] +5C5A0A 1A0A [Regular] +5C5A0D 1A0D [Regular] +5C5A1A 1A1A [Regular] +5C5A22 1A22 [Regular] +5C5A25 1A25 [Regular] +5C5A27 NULL [SyntErr] +5C5A30 1A30 [Regular] +5C5A3F 1A3F [Regular] +5C5A40 1A40 [Regular] +5C5A5A 1A5A [Regular] +5C5A5C NULL [SyntErr] +5C5A5F 1A5F [Regular] +5C5A61 1A61 [Regular] +5C5A62 1A62 [Regular] +5C5A6E 1A6E [Regular] +5C5A72 1A72 [Regular] +5C5A74 1A74 [Regular] +5C5A7E 1A7E [Regular] +5C5A7F 1A7F [Regular] +5C5A80 1A80 [Regular][ILSEQ] +5C5A81 1A81 [Regular][ILSEQ] +5C5A9F 1A9F [Regular][ILSEQ] +5C5AA0 1AA0 [Regular][ILSEQ] +5C5AA1 1AA1 [Regular][ILSEQ] +5C5AE0 1AE0 [Regular][ILSEQ] +5C5AEF 1AEF [Regular][ILSEQ] +5C5AF9 1AF9 [Regular][ILSEQ] +5C5AFA 1AFA [Regular][ILSEQ] +5C5AFC 1AFC [Regular][ILSEQ] +5C5AFD 1AFD [Regular][ILSEQ] +5C5AFE 1AFE [Regular][ILSEQ] +5C5AFF 1AFF [Regular][ILSEQ] +5C5C00 5C00 [Regular] +5C5C08 5C08 [Regular] +5C5C09 5C09 [Regular] +5C5C0A 5C0A [Regular] +5C5C0D 5C0D [Regular] +5C5C1A 5C1A [Regular] +5C5C22 5C22 [Regular] +5C5C25 5C25 [Regular] +5C5C27 NULL [SyntErr] +5C5C30 5C30 [Regular] +5C5C3F 5C3F [Regular] +5C5C40 5C40 [Regular] +5C5C5A 5C5A [Regular] +5C5C5C NULL [SyntErr] +5C5C5F 5C5F [Regular] +5C5C61 5C61 [Regular] +5C5C62 5C62 [Regular] +5C5C6E 5C6E [Regular] +5C5C72 5C72 [Regular] +5C5C74 5C74 [Regular] +5C5C7E 5C7E [Regular] +5C5C7F 5C7F [Regular] +5C5C80 5C80 [Regular][ILSEQ] +5C5C81 5C81 [Regular][ILSEQ] +5C5C9F 5C9F [Regular][ILSEQ] +5C5CA0 5CA0 [Regular][ILSEQ] +5C5CA1 5CA1 [Regular][ILSEQ] +5C5CE0 5CE0 [Regular][ILSEQ] +5C5CEF 5CEF [Regular][ILSEQ] +5C5CF9 5CF9 [Regular][ILSEQ] +5C5CFA 5CFA [Regular][ILSEQ] +5C5CFC 5CFC [Regular][ILSEQ] +5C5CFD 5CFD [Regular][ILSEQ] +5C5CFE 5CFE [Regular][ILSEQ] +5C5CFF 5CFF [Regular][ILSEQ] +5C5F00 5C5F00 [Preserve][LIKE] +5C5F08 5C5F08 [Preserve][LIKE] +5C5F09 5C5F09 [Preserve][LIKE] +5C5F0A 5C5F0A [Preserve][LIKE] +5C5F0D 5C5F0D [Preserve][LIKE] +5C5F1A 5C5F1A [Preserve][LIKE] +5C5F22 5C5F22 [Preserve][LIKE] +5C5F25 5C5F25 [Preserve][LIKE] +5C5F27 NULL [SyntErr] +5C5F30 5C5F30 [Preserve][LIKE] +5C5F3F 5C5F3F [Preserve][LIKE] +5C5F40 5C5F40 [Preserve][LIKE] +5C5F5A 5C5F5A [Preserve][LIKE] +5C5F5C NULL [SyntErr] +5C5F5F 5C5F5F [Preserve][LIKE] +5C5F61 5C5F61 [Preserve][LIKE] +5C5F62 5C5F62 [Preserve][LIKE] +5C5F6E 5C5F6E [Preserve][LIKE] +5C5F72 5C5F72 [Preserve][LIKE] +5C5F74 5C5F74 [Preserve][LIKE] +5C5F7E 5C5F7E [Preserve][LIKE] +5C5F7F 5C5F7F [Preserve][LIKE] +5C5F80 5C5F80 [Preserve][LIKE][ILSEQ] +5C5F81 5C5F81 [Preserve][LIKE][ILSEQ] +5C5F9F 5C5F9F [Preserve][LIKE][ILSEQ] +5C5FA0 5C5FA0 [Preserve][LIKE][ILSEQ] +5C5FA1 5C5FA1 [Preserve][LIKE][ILSEQ] +5C5FE0 5C5FE0 [Preserve][LIKE][ILSEQ] +5C5FEF 5C5FEF [Preserve][LIKE][ILSEQ] +5C5FF9 5C5FF9 [Preserve][LIKE][ILSEQ] +5C5FFA 5C5FFA [Preserve][LIKE][ILSEQ] +5C5FFC 5C5FFC [Preserve][LIKE][ILSEQ] +5C5FFD 5C5FFD [Preserve][LIKE][ILSEQ] +5C5FFE 5C5FFE [Preserve][LIKE][ILSEQ] +5C5FFF 5C5FFF [Preserve][LIKE][ILSEQ] +5C6100 6100 [Trivial] +5C6108 6108 [Trivial] +5C6109 6109 [Trivial] +5C610A 610A [Trivial] +5C610D 610D [Trivial] +5C611A 611A [Trivial] +5C6122 6122 [Trivial] +5C6125 6125 [Trivial] +5C6127 NULL [SyntErr] +5C6130 6130 [Trivial] +5C613F 613F [Trivial] +5C6140 6140 [Trivial] +5C615A 615A [Trivial] +5C615C NULL [SyntErr] +5C615F 615F [Trivial] +5C6161 6161 [Trivial] +5C6162 6162 [Trivial] +5C616E 616E [Trivial] +5C6172 6172 [Trivial] +5C6174 6174 [Trivial] +5C617E 617E [Trivial] +5C617F 617F [Trivial] +5C6180 6180 [Trivial][ILSEQ] +5C6181 6181 [Trivial][ILSEQ] +5C619F 619F [Trivial][ILSEQ] +5C61A0 61A0 [Trivial][ILSEQ] +5C61A1 61A1 [Trivial][ILSEQ] +5C61E0 61E0 [Trivial][ILSEQ] +5C61EF 61EF [Trivial][ILSEQ] +5C61F9 61F9 [Trivial][ILSEQ] +5C61FA 61FA [Trivial][ILSEQ] +5C61FC 61FC [Trivial][ILSEQ] +5C61FD 61FD [Trivial][ILSEQ] +5C61FE 61FE [Trivial][ILSEQ] +5C61FF 61FF [Trivial][ILSEQ] +5C6200 0800 [Regular] +5C6208 0808 [Regular] +5C6209 0809 [Regular] +5C620A 080A [Regular] +5C620D 080D [Regular] +5C621A 081A [Regular] +5C6222 0822 [Regular] +5C6225 0825 [Regular] +5C6227 NULL [SyntErr] +5C6230 0830 [Regular] +5C623F 083F [Regular] +5C6240 0840 [Regular] +5C625A 085A [Regular] +5C625C NULL [SyntErr] +5C625F 085F [Regular] +5C6261 0861 [Regular] +5C6262 0862 [Regular] +5C626E 086E [Regular] +5C6272 0872 [Regular] +5C6274 0874 [Regular] +5C627E 087E [Regular] +5C627F 087F [Regular] +5C6280 0880 [Regular][ILSEQ] +5C6281 0881 [Regular][ILSEQ] +5C629F 089F [Regular][ILSEQ] +5C62A0 08A0 [Regular][ILSEQ] +5C62A1 08A1 [Regular][ILSEQ] +5C62E0 08E0 [Regular][ILSEQ] +5C62EF 08EF [Regular][ILSEQ] +5C62F9 08F9 [Regular][ILSEQ] +5C62FA 08FA [Regular][ILSEQ] +5C62FC 08FC [Regular][ILSEQ] +5C62FD 08FD [Regular][ILSEQ] +5C62FE 08FE [Regular][ILSEQ] +5C62FF 08FF [Regular][ILSEQ] +5C6E00 0A00 [Regular] +5C6E08 0A08 [Regular] +5C6E09 0A09 [Regular] +5C6E0A 0A0A [Regular] +5C6E0D 0A0D [Regular] +5C6E1A 0A1A [Regular] +5C6E22 0A22 [Regular] +5C6E25 0A25 [Regular] +5C6E27 NULL [SyntErr] +5C6E30 0A30 [Regular] +5C6E3F 0A3F [Regular] +5C6E40 0A40 [Regular] +5C6E5A 0A5A [Regular] +5C6E5C NULL [SyntErr] +5C6E5F 0A5F [Regular] +5C6E61 0A61 [Regular] +5C6E62 0A62 [Regular] +5C6E6E 0A6E [Regular] +5C6E72 0A72 [Regular] +5C6E74 0A74 [Regular] +5C6E7E 0A7E [Regular] +5C6E7F 0A7F [Regular] +5C6E80 0A80 [Regular][ILSEQ] +5C6E81 0A81 [Regular][ILSEQ] +5C6E9F 0A9F [Regular][ILSEQ] +5C6EA0 0AA0 [Regular][ILSEQ] +5C6EA1 0AA1 [Regular][ILSEQ] +5C6EE0 0AE0 [Regular][ILSEQ] +5C6EEF 0AEF [Regular][ILSEQ] +5C6EF9 0AF9 [Regular][ILSEQ] +5C6EFA 0AFA [Regular][ILSEQ] +5C6EFC 0AFC [Regular][ILSEQ] +5C6EFD 0AFD [Regular][ILSEQ] +5C6EFE 0AFE [Regular][ILSEQ] +5C6EFF 0AFF [Regular][ILSEQ] +5C7200 0D00 [Regular] +5C7208 0D08 [Regular] +5C7209 0D09 [Regular] +5C720A 0D0A [Regular] +5C720D 0D0D [Regular] +5C721A 0D1A [Regular] +5C7222 0D22 [Regular] +5C7225 0D25 [Regular] +5C7227 NULL [SyntErr] +5C7230 0D30 [Regular] +5C723F 0D3F [Regular] +5C7240 0D40 [Regular] +5C725A 0D5A [Regular] +5C725C NULL [SyntErr] +5C725F 0D5F [Regular] +5C7261 0D61 [Regular] +5C7262 0D62 [Regular] +5C726E 0D6E [Regular] +5C7272 0D72 [Regular] +5C7274 0D74 [Regular] +5C727E 0D7E [Regular] +5C727F 0D7F [Regular] +5C7280 0D80 [Regular][ILSEQ] +5C7281 0D81 [Regular][ILSEQ] +5C729F 0D9F [Regular][ILSEQ] +5C72A0 0DA0 [Regular][ILSEQ] +5C72A1 0DA1 [Regular][ILSEQ] +5C72E0 0DE0 [Regular][ILSEQ] +5C72EF 0DEF [Regular][ILSEQ] +5C72F9 0DF9 [Regular][ILSEQ] +5C72FA 0DFA [Regular][ILSEQ] +5C72FC 0DFC [Regular][ILSEQ] +5C72FD 0DFD [Regular][ILSEQ] +5C72FE 0DFE [Regular][ILSEQ] +5C72FF 0DFF [Regular][ILSEQ] +5C7400 0900 [Regular] +5C7408 0908 [Regular] +5C7409 0909 [Regular] +5C740A 090A [Regular] +5C740D 090D [Regular] +5C741A 091A [Regular] +5C7422 0922 [Regular] +5C7425 0925 [Regular] +5C7427 NULL [SyntErr] +5C7430 0930 [Regular] +5C743F 093F [Regular] +5C7440 0940 [Regular] +5C745A 095A [Regular] +5C745C NULL [SyntErr] +5C745F 095F [Regular] +5C7461 0961 [Regular] +5C7462 0962 [Regular] +5C746E 096E [Regular] +5C7472 0972 [Regular] +5C7474 0974 [Regular] +5C747E 097E [Regular] +5C747F 097F [Regular] +5C7480 0980 [Regular][ILSEQ] +5C7481 0981 [Regular][ILSEQ] +5C749F 099F [Regular][ILSEQ] +5C74A0 09A0 [Regular][ILSEQ] +5C74A1 09A1 [Regular][ILSEQ] +5C74E0 09E0 [Regular][ILSEQ] +5C74EF 09EF [Regular][ILSEQ] +5C74F9 09F9 [Regular][ILSEQ] +5C74FA 09FA [Regular][ILSEQ] +5C74FC 09FC [Regular][ILSEQ] +5C74FD 09FD [Regular][ILSEQ] +5C74FE 09FE [Regular][ILSEQ] +5C74FF 09FF [Regular][ILSEQ] +5C7E00 7E00 [Trivial] +5C7E08 7E08 [Trivial] +5C7E09 7E09 [Trivial] +5C7E0A 7E0A [Trivial] +5C7E0D 7E0D [Trivial] +5C7E1A 7E1A [Trivial] +5C7E22 7E22 [Trivial] +5C7E25 7E25 [Trivial] +5C7E27 NULL [SyntErr] +5C7E30 7E30 [Trivial] +5C7E3F 7E3F [Trivial] +5C7E40 7E40 [Trivial] +5C7E5A 7E5A [Trivial] +5C7E5C NULL [SyntErr] +5C7E5F 7E5F [Trivial] +5C7E61 7E61 [Trivial] +5C7E62 7E62 [Trivial] +5C7E6E 7E6E [Trivial] +5C7E72 7E72 [Trivial] +5C7E74 7E74 [Trivial] +5C7E7E 7E7E [Trivial] +5C7E7F 7E7F [Trivial] +5C7E80 7E80 [Trivial][ILSEQ] +5C7E81 7E81 [Trivial][ILSEQ] +5C7E9F 7E9F [Trivial][ILSEQ] +5C7EA0 7EA0 [Trivial][ILSEQ] +5C7EA1 7EA1 [Trivial][ILSEQ] +5C7EE0 7EE0 [Trivial][ILSEQ] +5C7EEF 7EEF [Trivial][ILSEQ] +5C7EF9 7EF9 [Trivial][ILSEQ] +5C7EFA 7EFA [Trivial][ILSEQ] +5C7EFC 7EFC [Trivial][ILSEQ] +5C7EFD 7EFD [Trivial][ILSEQ] +5C7EFE 7EFE [Trivial][ILSEQ] +5C7EFF 7EFF [Trivial][ILSEQ] +5C7F00 7F00 [Trivial] +5C7F08 7F08 [Trivial] +5C7F09 7F09 [Trivial] +5C7F0A 7F0A [Trivial] +5C7F0D 7F0D [Trivial] +5C7F1A 7F1A [Trivial] +5C7F22 7F22 [Trivial] +5C7F25 7F25 [Trivial] +5C7F27 NULL [SyntErr] +5C7F30 7F30 [Trivial] +5C7F3F 7F3F [Trivial] +5C7F40 7F40 [Trivial] +5C7F5A 7F5A [Trivial] +5C7F5C NULL [SyntErr] +5C7F5F 7F5F [Trivial] +5C7F61 7F61 [Trivial] +5C7F62 7F62 [Trivial] +5C7F6E 7F6E [Trivial] +5C7F72 7F72 [Trivial] +5C7F74 7F74 [Trivial] +5C7F7E 7F7E [Trivial] +5C7F7F 7F7F [Trivial] +5C7F80 7F80 [Trivial][ILSEQ] +5C7F81 7F81 [Trivial][ILSEQ] +5C7F9F 7F9F [Trivial][ILSEQ] +5C7FA0 7FA0 [Trivial][ILSEQ] +5C7FA1 7FA1 [Trivial][ILSEQ] +5C7FE0 7FE0 [Trivial][ILSEQ] +5C7FEF 7FEF [Trivial][ILSEQ] +5C7FF9 7FF9 [Trivial][ILSEQ] +5C7FFA 7FFA [Trivial][ILSEQ] +5C7FFC 7FFC [Trivial][ILSEQ] +5C7FFD 7FFD [Trivial][ILSEQ] +5C7FFE 7FFE [Trivial][ILSEQ] +5C7FFF 7FFF [Trivial][ILSEQ] +5C8000 8000 [Trivial][ILSEQ] +5C8008 8008 [Trivial][ILSEQ] +5C8009 8009 [Trivial][ILSEQ] +5C800A 800A [Trivial][ILSEQ] +5C800D 800D [Trivial][ILSEQ] +5C801A 801A [Trivial][ILSEQ] +5C8022 8022 [Trivial][ILSEQ] +5C8025 8025 [Trivial][ILSEQ] +5C8027 NULL [SyntErr] +5C8030 8030 [Trivial][ILSEQ] +5C803F 803F [Trivial][ILSEQ] +5C8040 8040 [Trivial][ILSEQ] +5C805A 805A [Trivial][ILSEQ] +5C805C NULL [SyntErr] +5C805F 805F [Trivial][ILSEQ] +5C8061 8061 [Trivial][ILSEQ] +5C8062 8062 [Trivial][ILSEQ] +5C806E 806E [Trivial][ILSEQ] +5C8072 8072 [Trivial][ILSEQ] +5C8074 8074 [Trivial][ILSEQ] +5C807E 807E [Trivial][ILSEQ] +5C807F 807F [Trivial][ILSEQ] +5C8080 8080 [Trivial][ILSEQ] +5C8081 8081 [Trivial][ILSEQ] +5C809F 809F [Trivial][ILSEQ] +5C80A0 80A0 [Trivial][ILSEQ] +5C80A1 80A1 [Trivial][ILSEQ] +5C80E0 80E0 [Trivial][ILSEQ] +5C80EF 80EF [Trivial][ILSEQ] +5C80F9 80F9 [Trivial][ILSEQ] +5C80FA 80FA [Trivial][ILSEQ] +5C80FC 80FC [Trivial][ILSEQ] +5C80FD 80FD [Trivial][ILSEQ] +5C80FE 80FE [Trivial][ILSEQ] +5C80FF 80FF [Trivial][ILSEQ] +5C8100 8100 [Trivial][ILSEQ] +5C8108 8108 [Trivial][ILSEQ] +5C8109 8109 [Trivial][ILSEQ] +5C810A 810A [Trivial][ILSEQ] +5C810D 810D [Trivial][ILSEQ] +5C811A 811A [Trivial][ILSEQ] +5C8122 8122 [Trivial][ILSEQ] +5C8125 8125 [Trivial][ILSEQ] +5C8127 NULL [SyntErr] +5C8130 8130 [Trivial][ILSEQ] +5C813F 813F [Trivial][ILSEQ] +5C8140 8140 [Trivial][ILSEQ] +5C815A 815A [Trivial][ILSEQ] +5C815C NULL [SyntErr] +5C815F 815F [Trivial][ILSEQ] +5C8161 8161 [Trivial][ILSEQ] +5C8162 8162 [Trivial][ILSEQ] +5C816E 816E [Trivial][ILSEQ] +5C8172 8172 [Trivial][ILSEQ] +5C8174 8174 [Trivial][ILSEQ] +5C817E 817E [Trivial][ILSEQ] +5C817F 817F [Trivial][ILSEQ] +5C8180 8180 [Trivial][ILSEQ] +5C8181 8181 [Trivial][ILSEQ] +5C819F 819F [Trivial][ILSEQ] +5C81A0 81A0 [Trivial][ILSEQ] +5C81A1 81A1 [Trivial][ILSEQ] +5C81E0 81E0 [Trivial][ILSEQ] +5C81EF 81EF [Trivial][ILSEQ] +5C81F9 81F9 [Trivial][ILSEQ] +5C81FA 81FA [Trivial][ILSEQ] +5C81FC 81FC [Trivial][ILSEQ] +5C81FD 81FD [Trivial][ILSEQ] +5C81FE 81FE [Trivial][ILSEQ] +5C81FF 81FF [Trivial][ILSEQ] +5C9F00 9F00 [Trivial][ILSEQ] +5C9F08 9F08 [Trivial][ILSEQ] +5C9F09 9F09 [Trivial][ILSEQ] +5C9F0A 9F0A [Trivial][ILSEQ] +5C9F0D 9F0D [Trivial][ILSEQ] +5C9F1A 9F1A [Trivial][ILSEQ] +5C9F22 9F22 [Trivial][ILSEQ] +5C9F25 9F25 [Trivial][ILSEQ] +5C9F27 NULL [SyntErr] +5C9F30 9F30 [Trivial][ILSEQ] +5C9F3F 9F3F [Trivial][ILSEQ] +5C9F40 9F40 [Trivial][ILSEQ] +5C9F5A 9F5A [Trivial][ILSEQ] +5C9F5C NULL [SyntErr] +5C9F5F 9F5F [Trivial][ILSEQ] +5C9F61 9F61 [Trivial][ILSEQ] +5C9F62 9F62 [Trivial][ILSEQ] +5C9F6E 9F6E [Trivial][ILSEQ] +5C9F72 9F72 [Trivial][ILSEQ] +5C9F74 9F74 [Trivial][ILSEQ] +5C9F7E 9F7E [Trivial][ILSEQ] +5C9F7F 9F7F [Trivial][ILSEQ] +5C9F80 9F80 [Trivial][ILSEQ] +5C9F81 9F81 [Trivial][ILSEQ] +5C9F9F 9F9F [Trivial][ILSEQ] +5C9FA0 9FA0 [Trivial][ILSEQ] +5C9FA1 9FA1 [Trivial][ILSEQ] +5C9FE0 9FE0 [Trivial][ILSEQ] +5C9FEF 9FEF [Trivial][ILSEQ] +5C9FF9 9FF9 [Trivial][ILSEQ] +5C9FFA 9FFA [Trivial][ILSEQ] +5C9FFC 9FFC [Trivial][ILSEQ] +5C9FFD 9FFD [Trivial][ILSEQ] +5C9FFE 9FFE [Trivial][ILSEQ] +5C9FFF 9FFF [Trivial][ILSEQ] +5CA000 A000 [Trivial][ILSEQ] +5CA008 A008 [Trivial][ILSEQ] +5CA009 A009 [Trivial][ILSEQ] +5CA00A A00A [Trivial][ILSEQ] +5CA00D A00D [Trivial][ILSEQ] +5CA01A A01A [Trivial][ILSEQ] +5CA022 A022 [Trivial][ILSEQ] +5CA025 A025 [Trivial][ILSEQ] +5CA027 NULL [SyntErr] +5CA030 A030 [Trivial][ILSEQ] +5CA03F A03F [Trivial][ILSEQ] +5CA040 A040 [Trivial][ILSEQ] +5CA05A A05A [Trivial][ILSEQ] +5CA05C NULL [SyntErr] +5CA05F A05F [Trivial][ILSEQ] +5CA061 A061 [Trivial][ILSEQ] +5CA062 A062 [Trivial][ILSEQ] +5CA06E A06E [Trivial][ILSEQ] +5CA072 A072 [Trivial][ILSEQ] +5CA074 A074 [Trivial][ILSEQ] +5CA07E A07E [Trivial][ILSEQ] +5CA07F A07F [Trivial][ILSEQ] +5CA080 A080 [Trivial][ILSEQ] +5CA081 A081 [Trivial][ILSEQ] +5CA09F A09F [Trivial][ILSEQ] +5CA0A0 A0A0 [Trivial][ILSEQ] +5CA0A1 A0A1 [Trivial][ILSEQ] +5CA0E0 A0E0 [Trivial][ILSEQ] +5CA0EF A0EF [Trivial][ILSEQ] +5CA0F9 A0F9 [Trivial][ILSEQ] +5CA0FA A0FA [Trivial][ILSEQ] +5CA0FC A0FC [Trivial][ILSEQ] +5CA0FD A0FD [Trivial][ILSEQ] +5CA0FE A0FE [Trivial][ILSEQ] +5CA0FF A0FF [Trivial][ILSEQ] +5CA100 A100 [Trivial][ILSEQ] +5CA108 A108 [Trivial][ILSEQ] +5CA109 A109 [Trivial][ILSEQ] +5CA10A A10A [Trivial][ILSEQ] +5CA10D A10D [Trivial][ILSEQ] +5CA11A A11A [Trivial][ILSEQ] +5CA122 A122 [Trivial][ILSEQ] +5CA125 A125 [Trivial][ILSEQ] +5CA127 NULL [SyntErr] +5CA130 A130 [Trivial][ILSEQ] +5CA13F A13F [Trivial][ILSEQ] +5CA140 A140 [Trivial][ILSEQ] +5CA15A A15A [Trivial][ILSEQ] +5CA15C NULL [SyntErr] +5CA15F A15F [Trivial][ILSEQ] +5CA161 A161 [Trivial][ILSEQ] +5CA162 A162 [Trivial][ILSEQ] +5CA16E A16E [Trivial][ILSEQ] +5CA172 A172 [Trivial][ILSEQ] +5CA174 A174 [Trivial][ILSEQ] +5CA17E A17E [Trivial][ILSEQ] +5CA17F A17F [Trivial][ILSEQ] +5CA180 A180 [Trivial][ILSEQ] +5CA181 A181 [Trivial][ILSEQ] +5CA19F A19F [Trivial][ILSEQ] +5CA1A0 A1A0 [Trivial][ILSEQ] +5CA1A1 A1A1 [Trivial][ILSEQ] +5CA1E0 A1E0 [Trivial][ILSEQ] +5CA1EF A1EF [Trivial][ILSEQ] +5CA1F9 A1F9 [Trivial][ILSEQ] +5CA1FA A1FA [Trivial][ILSEQ] +5CA1FC A1FC [Trivial][ILSEQ] +5CA1FD A1FD [Trivial][ILSEQ] +5CA1FE A1FE [Trivial][ILSEQ] +5CA1FF A1FF [Trivial][ILSEQ] +5CE000 E000 [Trivial][ILSEQ] +5CE008 E008 [Trivial][ILSEQ] +5CE009 E009 [Trivial][ILSEQ] +5CE00A E00A [Trivial][ILSEQ] +5CE00D E00D [Trivial][ILSEQ] +5CE01A E01A [Trivial][ILSEQ] +5CE022 E022 [Trivial][ILSEQ] +5CE025 E025 [Trivial][ILSEQ] +5CE027 NULL [SyntErr] +5CE030 E030 [Trivial][ILSEQ] +5CE03F E03F [Trivial][ILSEQ] +5CE040 E040 [Trivial][ILSEQ] +5CE05A E05A [Trivial][ILSEQ] +5CE05C NULL [SyntErr] +5CE05F E05F [Trivial][ILSEQ] +5CE061 E061 [Trivial][ILSEQ] +5CE062 E062 [Trivial][ILSEQ] +5CE06E E06E [Trivial][ILSEQ] +5CE072 E072 [Trivial][ILSEQ] +5CE074 E074 [Trivial][ILSEQ] +5CE07E E07E [Trivial][ILSEQ] +5CE07F E07F [Trivial][ILSEQ] +5CE080 E080 [Trivial][ILSEQ] +5CE081 E081 [Trivial][ILSEQ] +5CE09F E09F [Trivial][ILSEQ] +5CE0A0 E0A0 [Trivial][ILSEQ] +5CE0A1 E0A1 [Trivial][ILSEQ] +5CE0E0 E0E0 [Trivial][ILSEQ] +5CE0EF E0EF [Trivial][ILSEQ] +5CE0F9 E0F9 [Trivial][ILSEQ] +5CE0FA E0FA [Trivial][ILSEQ] +5CE0FC E0FC [Trivial][ILSEQ] +5CE0FD E0FD [Trivial][ILSEQ] +5CE0FE E0FE [Trivial][ILSEQ] +5CE0FF E0FF [Trivial][ILSEQ] +5CEF00 EF00 [Trivial][ILSEQ] +5CEF08 EF08 [Trivial][ILSEQ] +5CEF09 EF09 [Trivial][ILSEQ] +5CEF0A EF0A [Trivial][ILSEQ] +5CEF0D EF0D [Trivial][ILSEQ] +5CEF1A EF1A [Trivial][ILSEQ] +5CEF22 EF22 [Trivial][ILSEQ] +5CEF25 EF25 [Trivial][ILSEQ] +5CEF27 NULL [SyntErr] +5CEF30 EF30 [Trivial][ILSEQ] +5CEF3F EF3F [Trivial][ILSEQ] +5CEF40 EF40 [Trivial][ILSEQ] +5CEF5A EF5A [Trivial][ILSEQ] +5CEF5C NULL [SyntErr] +5CEF5F EF5F [Trivial][ILSEQ] +5CEF61 EF61 [Trivial][ILSEQ] +5CEF62 EF62 [Trivial][ILSEQ] +5CEF6E EF6E [Trivial][ILSEQ] +5CEF72 EF72 [Trivial][ILSEQ] +5CEF74 EF74 [Trivial][ILSEQ] +5CEF7E EF7E [Trivial][ILSEQ] +5CEF7F EF7F [Trivial][ILSEQ] +5CEF80 EF80 [Trivial][ILSEQ] +5CEF81 EF81 [Trivial][ILSEQ] +5CEF9F EF9F [Trivial][ILSEQ] +5CEFA0 EFA0 [Trivial][ILSEQ] +5CEFA1 EFA1 [Trivial][ILSEQ] +5CEFE0 EFE0 [Trivial][ILSEQ] +5CEFEF EFEF [Trivial][ILSEQ] +5CEFF9 EFF9 [Trivial][ILSEQ] +5CEFFA EFFA [Trivial][ILSEQ] +5CEFFC EFFC [Trivial][ILSEQ] +5CEFFD EFFD [Trivial][ILSEQ] +5CEFFE EFFE [Trivial][ILSEQ] +5CEFFF EFFF [Trivial][ILSEQ] +5CF900 F900 [Trivial][ILSEQ] +5CF908 F908 [Trivial][ILSEQ] +5CF909 F909 [Trivial][ILSEQ] +5CF90A F90A [Trivial][ILSEQ] +5CF90D F90D [Trivial][ILSEQ] +5CF91A F91A [Trivial][ILSEQ] +5CF922 F922 [Trivial][ILSEQ] +5CF925 F925 [Trivial][ILSEQ] +5CF927 NULL [SyntErr] +5CF930 F930 [Trivial][ILSEQ] +5CF93F F93F [Trivial][ILSEQ] +5CF940 F940 [Trivial][ILSEQ] +5CF95A F95A [Trivial][ILSEQ] +5CF95C NULL [SyntErr] +5CF95F F95F [Trivial][ILSEQ] +5CF961 F961 [Trivial][ILSEQ] +5CF962 F962 [Trivial][ILSEQ] +5CF96E F96E [Trivial][ILSEQ] +5CF972 F972 [Trivial][ILSEQ] +5CF974 F974 [Trivial][ILSEQ] +5CF97E F97E [Trivial][ILSEQ] +5CF97F F97F [Trivial][ILSEQ] +5CF980 F980 [Trivial][ILSEQ] +5CF981 F981 [Trivial][ILSEQ] +5CF99F F99F [Trivial][ILSEQ] +5CF9A0 F9A0 [Trivial][ILSEQ] +5CF9A1 F9A1 [Trivial][ILSEQ] +5CF9E0 F9E0 [Trivial][ILSEQ] +5CF9EF F9EF [Trivial][ILSEQ] +5CF9F9 F9F9 [Trivial][ILSEQ] +5CF9FA F9FA [Trivial][ILSEQ] +5CF9FC F9FC [Trivial][ILSEQ] +5CF9FD F9FD [Trivial][ILSEQ] +5CF9FE F9FE [Trivial][ILSEQ] +5CF9FF F9FF [Trivial][ILSEQ] +5CFA00 FA00 [Trivial][ILSEQ] +5CFA08 FA08 [Trivial][ILSEQ] +5CFA09 FA09 [Trivial][ILSEQ] +5CFA0A FA0A [Trivial][ILSEQ] +5CFA0D FA0D [Trivial][ILSEQ] +5CFA1A FA1A [Trivial][ILSEQ] +5CFA22 FA22 [Trivial][ILSEQ] +5CFA25 FA25 [Trivial][ILSEQ] +5CFA27 NULL [SyntErr] +5CFA30 FA30 [Trivial][ILSEQ] +5CFA3F FA3F [Trivial][ILSEQ] +5CFA40 FA40 [Trivial][ILSEQ] +5CFA5A FA5A [Trivial][ILSEQ] +5CFA5C NULL [SyntErr] +5CFA5F FA5F [Trivial][ILSEQ] +5CFA61 FA61 [Trivial][ILSEQ] +5CFA62 FA62 [Trivial][ILSEQ] +5CFA6E FA6E [Trivial][ILSEQ] +5CFA72 FA72 [Trivial][ILSEQ] +5CFA74 FA74 [Trivial][ILSEQ] +5CFA7E FA7E [Trivial][ILSEQ] +5CFA7F FA7F [Trivial][ILSEQ] +5CFA80 FA80 [Trivial][ILSEQ] +5CFA81 FA81 [Trivial][ILSEQ] +5CFA9F FA9F [Trivial][ILSEQ] +5CFAA0 FAA0 [Trivial][ILSEQ] +5CFAA1 FAA1 [Trivial][ILSEQ] +5CFAE0 FAE0 [Trivial][ILSEQ] +5CFAEF FAEF [Trivial][ILSEQ] +5CFAF9 FAF9 [Trivial][ILSEQ] +5CFAFA FAFA [Trivial][ILSEQ] +5CFAFC FAFC [Trivial][ILSEQ] +5CFAFD FAFD [Trivial][ILSEQ] +5CFAFE FAFE [Trivial][ILSEQ] +5CFAFF FAFF [Trivial][ILSEQ] +5CFC00 FC00 [Trivial][ILSEQ] +5CFC08 FC08 [Trivial][ILSEQ] +5CFC09 FC09 [Trivial][ILSEQ] +5CFC0A FC0A [Trivial][ILSEQ] +5CFC0D FC0D [Trivial][ILSEQ] +5CFC1A FC1A [Trivial][ILSEQ] +5CFC22 FC22 [Trivial][ILSEQ] +5CFC25 FC25 [Trivial][ILSEQ] +5CFC27 NULL [SyntErr] +5CFC30 FC30 [Trivial][ILSEQ] +5CFC3F FC3F [Trivial][ILSEQ] +5CFC40 FC40 [Trivial][ILSEQ] +5CFC5A FC5A [Trivial][ILSEQ] +5CFC5C NULL [SyntErr] +5CFC5F FC5F [Trivial][ILSEQ] +5CFC61 FC61 [Trivial][ILSEQ] +5CFC62 FC62 [Trivial][ILSEQ] +5CFC6E FC6E [Trivial][ILSEQ] +5CFC72 FC72 [Trivial][ILSEQ] +5CFC74 FC74 [Trivial][ILSEQ] +5CFC7E FC7E [Trivial][ILSEQ] +5CFC7F FC7F [Trivial][ILSEQ] +5CFC80 FC80 [Trivial][ILSEQ] +5CFC81 FC81 [Trivial][ILSEQ] +5CFC9F FC9F [Trivial][ILSEQ] +5CFCA0 FCA0 [Trivial][ILSEQ] +5CFCA1 FCA1 [Trivial][ILSEQ] +5CFCE0 FCE0 [Trivial][ILSEQ] +5CFCEF FCEF [Trivial][ILSEQ] +5CFCF9 FCF9 [Trivial][ILSEQ] +5CFCFA FCFA [Trivial][ILSEQ] +5CFCFC FCFC [Trivial][ILSEQ] +5CFCFD FCFD [Trivial][ILSEQ] +5CFCFE FCFE [Trivial][ILSEQ] +5CFCFF FCFF [Trivial][ILSEQ] +5CFD00 FD00 [Trivial][ILSEQ] +5CFD08 FD08 [Trivial][ILSEQ] +5CFD09 FD09 [Trivial][ILSEQ] +5CFD0A FD0A [Trivial][ILSEQ] +5CFD0D FD0D [Trivial][ILSEQ] +5CFD1A FD1A [Trivial][ILSEQ] +5CFD22 FD22 [Trivial][ILSEQ] +5CFD25 FD25 [Trivial][ILSEQ] +5CFD27 NULL [SyntErr] +5CFD30 FD30 [Trivial][ILSEQ] +5CFD3F FD3F [Trivial][ILSEQ] +5CFD40 FD40 [Trivial][ILSEQ] +5CFD5A FD5A [Trivial][ILSEQ] +5CFD5C NULL [SyntErr] +5CFD5F FD5F [Trivial][ILSEQ] +5CFD61 FD61 [Trivial][ILSEQ] +5CFD62 FD62 [Trivial][ILSEQ] +5CFD6E FD6E [Trivial][ILSEQ] +5CFD72 FD72 [Trivial][ILSEQ] +5CFD74 FD74 [Trivial][ILSEQ] +5CFD7E FD7E [Trivial][ILSEQ] +5CFD7F FD7F [Trivial][ILSEQ] +5CFD80 FD80 [Trivial][ILSEQ] +5CFD81 FD81 [Trivial][ILSEQ] +5CFD9F FD9F [Trivial][ILSEQ] +5CFDA0 FDA0 [Trivial][ILSEQ] +5CFDA1 FDA1 [Trivial][ILSEQ] +5CFDE0 FDE0 [Trivial][ILSEQ] +5CFDEF FDEF [Trivial][ILSEQ] +5CFDF9 FDF9 [Trivial][ILSEQ] +5CFDFA FDFA [Trivial][ILSEQ] +5CFDFC FDFC [Trivial][ILSEQ] +5CFDFD FDFD [Trivial][ILSEQ] +5CFDFE FDFE [Trivial][ILSEQ] +5CFDFF FDFF [Trivial][ILSEQ] +5CFE00 FE00 [Trivial][ILSEQ] +5CFE08 FE08 [Trivial][ILSEQ] +5CFE09 FE09 [Trivial][ILSEQ] +5CFE0A FE0A [Trivial][ILSEQ] +5CFE0D FE0D [Trivial][ILSEQ] +5CFE1A FE1A [Trivial][ILSEQ] +5CFE22 FE22 [Trivial][ILSEQ] +5CFE25 FE25 [Trivial][ILSEQ] +5CFE27 NULL [SyntErr] +5CFE30 FE30 [Trivial][ILSEQ] +5CFE3F FE3F [Trivial][ILSEQ] +5CFE40 FE40 [Trivial][ILSEQ] +5CFE5A FE5A [Trivial][ILSEQ] +5CFE5C NULL [SyntErr] +5CFE5F FE5F [Trivial][ILSEQ] +5CFE61 FE61 [Trivial][ILSEQ] +5CFE62 FE62 [Trivial][ILSEQ] +5CFE6E FE6E [Trivial][ILSEQ] +5CFE72 FE72 [Trivial][ILSEQ] +5CFE74 FE74 [Trivial][ILSEQ] +5CFE7E FE7E [Trivial][ILSEQ] +5CFE7F FE7F [Trivial][ILSEQ] +5CFE80 FE80 [Trivial][ILSEQ] +5CFE81 FE81 [Trivial][ILSEQ] +5CFE9F FE9F [Trivial][ILSEQ] +5CFEA0 FEA0 [Trivial][ILSEQ] +5CFEA1 FEA1 [Trivial][ILSEQ] +5CFEE0 FEE0 [Trivial][ILSEQ] +5CFEEF FEEF [Trivial][ILSEQ] +5CFEF9 FEF9 [Trivial][ILSEQ] +5CFEFA FEFA [Trivial][ILSEQ] +5CFEFC FEFC [Trivial][ILSEQ] +5CFEFD FEFD [Trivial][ILSEQ] +5CFEFE FEFE [Trivial][ILSEQ] +5CFEFF FEFF [Trivial][ILSEQ] +5CFF00 FF00 [Trivial][ILSEQ] +5CFF08 FF08 [Trivial][ILSEQ] +5CFF09 FF09 [Trivial][ILSEQ] +5CFF0A FF0A [Trivial][ILSEQ] +5CFF0D FF0D [Trivial][ILSEQ] +5CFF1A FF1A [Trivial][ILSEQ] +5CFF22 FF22 [Trivial][ILSEQ] +5CFF25 FF25 [Trivial][ILSEQ] +5CFF27 NULL [SyntErr] +5CFF30 FF30 [Trivial][ILSEQ] +5CFF3F FF3F [Trivial][ILSEQ] +5CFF40 FF40 [Trivial][ILSEQ] +5CFF5A FF5A [Trivial][ILSEQ] +5CFF5C NULL [SyntErr] +5CFF5F FF5F [Trivial][ILSEQ] +5CFF61 FF61 [Trivial][ILSEQ] +5CFF62 FF62 [Trivial][ILSEQ] +5CFF6E FF6E [Trivial][ILSEQ] +5CFF72 FF72 [Trivial][ILSEQ] +5CFF74 FF74 [Trivial][ILSEQ] +5CFF7E FF7E [Trivial][ILSEQ] +5CFF7F FF7F [Trivial][ILSEQ] +5CFF80 FF80 [Trivial][ILSEQ] +5CFF81 FF81 [Trivial][ILSEQ] +5CFF9F FF9F [Trivial][ILSEQ] +5CFFA0 FFA0 [Trivial][ILSEQ] +5CFFA1 FFA1 [Trivial][ILSEQ] +5CFFE0 FFE0 [Trivial][ILSEQ] +5CFFEF FFEF [Trivial][ILSEQ] +5CFFF9 FFF9 [Trivial][ILSEQ] +5CFFFA FFFA [Trivial][ILSEQ] +5CFFFC FFFC [Trivial][ILSEQ] +5CFFFD FFFD [Trivial][ILSEQ] +5CFFFE FFFE [Trivial][ILSEQ] +5CFFFF FFFF [Trivial][ILSEQ] +5C005C00 0000 [Trivial] +5C005C08 0008 [Trivial] +5C005C09 0009 [Trivial] +5C005C0A 000A [Trivial] +5C005C0D 000D [Trivial] +5C005C1A 001A [Trivial] +5C005C22 0022 [Trivial] +5C005C25 005C25 [Regular] +5C005C27 0027 [Trivial] +5C005C30 0000 [Regular] +5C005C3F 003F [Trivial] +5C005C40 0040 [Trivial] +5C005C5A 001A [Regular] +5C005C5C 005C [Regular] +5C005C5F 005C5F [Regular] +5C005C61 0061 [Trivial] +5C005C62 0008 [Regular] +5C005C6E 000A [Regular] +5C005C72 000D [Regular] +5C005C74 0009 [Regular] +5C005C7E 007E [Trivial] +5C005C7F 007F [Trivial] +5C005C80 0080 [Trivial][ILSEQ] +5C005C81 0081 [Trivial][ILSEQ] +5C005C9F 009F [Trivial][ILSEQ] +5C005CA0 00A0 [Trivial][ILSEQ] +5C005CA1 00A1 [Trivial][ILSEQ] +5C005CE0 00E0 [Trivial][ILSEQ] +5C005CEF 00EF [Trivial][ILSEQ] +5C005CF9 00F9 [Trivial][ILSEQ] +5C005CFA 00FA [Trivial][ILSEQ] +5C005CFC 00FC [Trivial][ILSEQ] +5C005CFD 00FD [Trivial][ILSEQ] +5C005CFE 00FE [Trivial][ILSEQ] +5C005CFF 00FF [Trivial][ILSEQ] +5C085C00 0800 [Trivial] +5C085C08 0808 [Trivial] +5C085C09 0809 [Trivial] +5C085C0A 080A [Trivial] +5C085C0D 080D [Trivial] +5C085C1A 081A [Trivial] +5C085C22 0822 [Trivial] +5C085C25 085C25 [Regular] +5C085C27 0827 [Trivial] +5C085C30 0800 [Regular] +5C085C3F 083F [Trivial] +5C085C40 0840 [Trivial] +5C085C5A 081A [Regular] +5C085C5C 085C [Regular] +5C085C5F 085C5F [Regular] +5C085C61 0861 [Trivial] +5C085C62 0808 [Regular] +5C085C6E 080A [Regular] +5C085C72 080D [Regular] +5C085C74 0809 [Regular] +5C085C7E 087E [Trivial] +5C085C7F 087F [Trivial] +5C085C80 0880 [Trivial][ILSEQ] +5C085C81 0881 [Trivial][ILSEQ] +5C085C9F 089F [Trivial][ILSEQ] +5C085CA0 08A0 [Trivial][ILSEQ] +5C085CA1 08A1 [Trivial][ILSEQ] +5C085CE0 08E0 [Trivial][ILSEQ] +5C085CEF 08EF [Trivial][ILSEQ] +5C085CF9 08F9 [Trivial][ILSEQ] +5C085CFA 08FA [Trivial][ILSEQ] +5C085CFC 08FC [Trivial][ILSEQ] +5C085CFD 08FD [Trivial][ILSEQ] +5C085CFE 08FE [Trivial][ILSEQ] +5C085CFF 08FF [Trivial][ILSEQ] +5C095C00 0900 [Trivial] +5C095C08 0908 [Trivial] +5C095C09 0909 [Trivial] +5C095C0A 090A [Trivial] +5C095C0D 090D [Trivial] +5C095C1A 091A [Trivial] +5C095C22 0922 [Trivial] +5C095C25 095C25 [Regular] +5C095C27 0927 [Trivial] +5C095C30 0900 [Regular] +5C095C3F 093F [Trivial] +5C095C40 0940 [Trivial] +5C095C5A 091A [Regular] +5C095C5C 095C [Regular] +5C095C5F 095C5F [Regular] +5C095C61 0961 [Trivial] +5C095C62 0908 [Regular] +5C095C6E 090A [Regular] +5C095C72 090D [Regular] +5C095C74 0909 [Regular] +5C095C7E 097E [Trivial] +5C095C7F 097F [Trivial] +5C095C80 0980 [Trivial][ILSEQ] +5C095C81 0981 [Trivial][ILSEQ] +5C095C9F 099F [Trivial][ILSEQ] +5C095CA0 09A0 [Trivial][ILSEQ] +5C095CA1 09A1 [Trivial][ILSEQ] +5C095CE0 09E0 [Trivial][ILSEQ] +5C095CEF 09EF [Trivial][ILSEQ] +5C095CF9 09F9 [Trivial][ILSEQ] +5C095CFA 09FA [Trivial][ILSEQ] +5C095CFC 09FC [Trivial][ILSEQ] +5C095CFD 09FD [Trivial][ILSEQ] +5C095CFE 09FE [Trivial][ILSEQ] +5C095CFF 09FF [Trivial][ILSEQ] +5C0A5C00 0A00 [Trivial] +5C0A5C08 0A08 [Trivial] +5C0A5C09 0A09 [Trivial] +5C0A5C0A 0A0A [Trivial] +5C0A5C0D 0A0D [Trivial] +5C0A5C1A 0A1A [Trivial] +5C0A5C22 0A22 [Trivial] +5C0A5C25 0A5C25 [Regular] +5C0A5C27 0A27 [Trivial] +5C0A5C30 0A00 [Regular] +5C0A5C3F 0A3F [Trivial] +5C0A5C40 0A40 [Trivial] +5C0A5C5A 0A1A [Regular] +5C0A5C5C 0A5C [Regular] +5C0A5C5F 0A5C5F [Regular] +5C0A5C61 0A61 [Trivial] +5C0A5C62 0A08 [Regular] +5C0A5C6E 0A0A [Regular] +5C0A5C72 0A0D [Regular] +5C0A5C74 0A09 [Regular] +5C0A5C7E 0A7E [Trivial] +5C0A5C7F 0A7F [Trivial] +5C0A5C80 0A80 [Trivial][ILSEQ] +5C0A5C81 0A81 [Trivial][ILSEQ] +5C0A5C9F 0A9F [Trivial][ILSEQ] +5C0A5CA0 0AA0 [Trivial][ILSEQ] +5C0A5CA1 0AA1 [Trivial][ILSEQ] +5C0A5CE0 0AE0 [Trivial][ILSEQ] +5C0A5CEF 0AEF [Trivial][ILSEQ] +5C0A5CF9 0AF9 [Trivial][ILSEQ] +5C0A5CFA 0AFA [Trivial][ILSEQ] +5C0A5CFC 0AFC [Trivial][ILSEQ] +5C0A5CFD 0AFD [Trivial][ILSEQ] +5C0A5CFE 0AFE [Trivial][ILSEQ] +5C0A5CFF 0AFF [Trivial][ILSEQ] +5C0D5C00 0D00 [Trivial] +5C0D5C08 0D08 [Trivial] +5C0D5C09 0D09 [Trivial] +5C0D5C0A 0D0A [Trivial] +5C0D5C0D 0D0D [Trivial] +5C0D5C1A 0D1A [Trivial] +5C0D5C22 0D22 [Trivial] +5C0D5C25 0D5C25 [Regular] +5C0D5C27 0D27 [Trivial] +5C0D5C30 0D00 [Regular] +5C0D5C3F 0D3F [Trivial] +5C0D5C40 0D40 [Trivial] +5C0D5C5A 0D1A [Regular] +5C0D5C5C 0D5C [Regular] +5C0D5C5F 0D5C5F [Regular] +5C0D5C61 0D61 [Trivial] +5C0D5C62 0D08 [Regular] +5C0D5C6E 0D0A [Regular] +5C0D5C72 0D0D [Regular] +5C0D5C74 0D09 [Regular] +5C0D5C7E 0D7E [Trivial] +5C0D5C7F 0D7F [Trivial] +5C0D5C80 0D80 [Trivial][ILSEQ] +5C0D5C81 0D81 [Trivial][ILSEQ] +5C0D5C9F 0D9F [Trivial][ILSEQ] +5C0D5CA0 0DA0 [Trivial][ILSEQ] +5C0D5CA1 0DA1 [Trivial][ILSEQ] +5C0D5CE0 0DE0 [Trivial][ILSEQ] +5C0D5CEF 0DEF [Trivial][ILSEQ] +5C0D5CF9 0DF9 [Trivial][ILSEQ] +5C0D5CFA 0DFA [Trivial][ILSEQ] +5C0D5CFC 0DFC [Trivial][ILSEQ] +5C0D5CFD 0DFD [Trivial][ILSEQ] +5C0D5CFE 0DFE [Trivial][ILSEQ] +5C0D5CFF 0DFF [Trivial][ILSEQ] +5C1A5C00 1A00 [Trivial] +5C1A5C08 1A08 [Trivial] +5C1A5C09 1A09 [Trivial] +5C1A5C0A 1A0A [Trivial] +5C1A5C0D 1A0D [Trivial] +5C1A5C1A 1A1A [Trivial] +5C1A5C22 1A22 [Trivial] +5C1A5C25 1A5C25 [Regular] +5C1A5C27 1A27 [Trivial] +5C1A5C30 1A00 [Regular] +5C1A5C3F 1A3F [Trivial] +5C1A5C40 1A40 [Trivial] +5C1A5C5A 1A1A [Regular] +5C1A5C5C 1A5C [Regular] +5C1A5C5F 1A5C5F [Regular] +5C1A5C61 1A61 [Trivial] +5C1A5C62 1A08 [Regular] +5C1A5C6E 1A0A [Regular] +5C1A5C72 1A0D [Regular] +5C1A5C74 1A09 [Regular] +5C1A5C7E 1A7E [Trivial] +5C1A5C7F 1A7F [Trivial] +5C1A5C80 1A80 [Trivial][ILSEQ] +5C1A5C81 1A81 [Trivial][ILSEQ] +5C1A5C9F 1A9F [Trivial][ILSEQ] +5C1A5CA0 1AA0 [Trivial][ILSEQ] +5C1A5CA1 1AA1 [Trivial][ILSEQ] +5C1A5CE0 1AE0 [Trivial][ILSEQ] +5C1A5CEF 1AEF [Trivial][ILSEQ] +5C1A5CF9 1AF9 [Trivial][ILSEQ] +5C1A5CFA 1AFA [Trivial][ILSEQ] +5C1A5CFC 1AFC [Trivial][ILSEQ] +5C1A5CFD 1AFD [Trivial][ILSEQ] +5C1A5CFE 1AFE [Trivial][ILSEQ] +5C1A5CFF 1AFF [Trivial][ILSEQ] +5C225C00 2200 [Trivial] +5C225C08 2208 [Trivial] +5C225C09 2209 [Trivial] +5C225C0A 220A [Trivial] +5C225C0D 220D [Trivial] +5C225C1A 221A [Trivial] +5C225C22 2222 [Trivial] +5C225C25 225C25 [Regular] +5C225C27 2227 [Trivial] +5C225C30 2200 [Regular] +5C225C3F 223F [Trivial] +5C225C40 2240 [Trivial] +5C225C5A 221A [Regular] +5C225C5C 225C [Regular] +5C225C5F 225C5F [Regular] +5C225C61 2261 [Trivial] +5C225C62 2208 [Regular] +5C225C6E 220A [Regular] +5C225C72 220D [Regular] +5C225C74 2209 [Regular] +5C225C7E 227E [Trivial] +5C225C7F 227F [Trivial] +5C225C80 2280 [Trivial][ILSEQ] +5C225C81 2281 [Trivial][ILSEQ] +5C225C9F 229F [Trivial][ILSEQ] +5C225CA0 22A0 [Trivial][ILSEQ] +5C225CA1 22A1 [Trivial][ILSEQ] +5C225CE0 22E0 [Trivial][ILSEQ] +5C225CEF 22EF [Trivial][ILSEQ] +5C225CF9 22F9 [Trivial][ILSEQ] +5C225CFA 22FA [Trivial][ILSEQ] +5C225CFC 22FC [Trivial][ILSEQ] +5C225CFD 22FD [Trivial][ILSEQ] +5C225CFE 22FE [Trivial][ILSEQ] +5C225CFF 22FF [Trivial][ILSEQ] +5C255C00 5C2500 [Regular] +5C255C08 5C2508 [Regular] +5C255C09 5C2509 [Regular] +5C255C0A 5C250A [Regular] +5C255C0D 5C250D [Regular] +5C255C1A 5C251A [Regular] +5C255C22 5C2522 [Regular] +5C255C25 5C255C25 [Preserve][LIKE] +5C255C27 5C2527 [Regular] +5C255C30 5C2500 [Regular] +5C255C3F 5C253F [Regular] +5C255C40 5C2540 [Regular] +5C255C5A 5C251A [Regular] +5C255C5C 5C255C [Regular] +5C255C5F 5C255C5F [Preserve][LIKE] +5C255C61 5C2561 [Regular] +5C255C62 5C2508 [Regular] +5C255C6E 5C250A [Regular] +5C255C72 5C250D [Regular] +5C255C74 5C2509 [Regular] +5C255C7E 5C257E [Regular] +5C255C7F 5C257F [Regular] +5C255C80 5C2580 [Regular][ILSEQ] +5C255C81 5C2581 [Regular][ILSEQ] +5C255C9F 5C259F [Regular][ILSEQ] +5C255CA0 5C25A0 [Regular][ILSEQ] +5C255CA1 5C25A1 [Regular][ILSEQ] +5C255CE0 5C25E0 [Regular][ILSEQ] +5C255CEF 5C25EF [Regular][ILSEQ] +5C255CF9 5C25F9 [Regular][ILSEQ] +5C255CFA 5C25FA [Regular][ILSEQ] +5C255CFC 5C25FC [Regular][ILSEQ] +5C255CFD 5C25FD [Regular][ILSEQ] +5C255CFE 5C25FE [Regular][ILSEQ] +5C255CFF 5C25FF [Regular][ILSEQ] +5C275C00 2700 [Trivial] +5C275C08 2708 [Trivial] +5C275C09 2709 [Trivial] +5C275C0A 270A [Trivial] +5C275C0D 270D [Trivial] +5C275C1A 271A [Trivial] +5C275C22 2722 [Trivial] +5C275C25 275C25 [Regular] +5C275C27 2727 [Trivial] +5C275C30 2700 [Regular] +5C275C3F 273F [Trivial] +5C275C40 2740 [Trivial] +5C275C5A 271A [Regular] +5C275C5C 275C [Regular] +5C275C5F 275C5F [Regular] +5C275C61 2761 [Trivial] +5C275C62 2708 [Regular] +5C275C6E 270A [Regular] +5C275C72 270D [Regular] +5C275C74 2709 [Regular] +5C275C7E 277E [Trivial] +5C275C7F 277F [Trivial] +5C275C80 2780 [Trivial][ILSEQ] +5C275C81 2781 [Trivial][ILSEQ] +5C275C9F 279F [Trivial][ILSEQ] +5C275CA0 27A0 [Trivial][ILSEQ] +5C275CA1 27A1 [Trivial][ILSEQ] +5C275CE0 27E0 [Trivial][ILSEQ] +5C275CEF 27EF [Trivial][ILSEQ] +5C275CF9 27F9 [Trivial][ILSEQ] +5C275CFA 27FA [Trivial][ILSEQ] +5C275CFC 27FC [Trivial][ILSEQ] +5C275CFD 27FD [Trivial][ILSEQ] +5C275CFE 27FE [Trivial][ILSEQ] +5C275CFF 27FF [Trivial][ILSEQ] +5C305C00 0000 [Regular] +5C305C08 0008 [Regular] +5C305C09 0009 [Regular] +5C305C0A 000A [Regular] +5C305C0D 000D [Regular] +5C305C1A 001A [Regular] +5C305C22 0022 [Regular] +5C305C25 005C25 [Regular] +5C305C27 0027 [Regular] +5C305C30 0000 [Regular] +5C305C3F 003F [Regular] +5C305C40 0040 [Regular] +5C305C5A 001A [Regular] +5C305C5C 005C [Regular] +5C305C5F 005C5F [Regular] +5C305C61 0061 [Regular] +5C305C62 0008 [Regular] +5C305C6E 000A [Regular] +5C305C72 000D [Regular] +5C305C74 0009 [Regular] +5C305C7E 007E [Regular] +5C305C7F 007F [Regular] +5C305C80 0080 [Regular][ILSEQ] +5C305C81 0081 [Regular][ILSEQ] +5C305C9F 009F [Regular][ILSEQ] +5C305CA0 00A0 [Regular][ILSEQ] +5C305CA1 00A1 [Regular][ILSEQ] +5C305CE0 00E0 [Regular][ILSEQ] +5C305CEF 00EF [Regular][ILSEQ] +5C305CF9 00F9 [Regular][ILSEQ] +5C305CFA 00FA [Regular][ILSEQ] +5C305CFC 00FC [Regular][ILSEQ] +5C305CFD 00FD [Regular][ILSEQ] +5C305CFE 00FE [Regular][ILSEQ] +5C305CFF 00FF [Regular][ILSEQ] +5C3F5C00 3F00 [Trivial] +5C3F5C08 3F08 [Trivial] +5C3F5C09 3F09 [Trivial] +5C3F5C0A 3F0A [Trivial] +5C3F5C0D 3F0D [Trivial] +5C3F5C1A 3F1A [Trivial] +5C3F5C22 3F22 [Trivial] +5C3F5C25 3F5C25 [Regular] +5C3F5C27 3F27 [Trivial] +5C3F5C30 3F00 [Regular] +5C3F5C3F 3F3F [Trivial] +5C3F5C40 3F40 [Trivial] +5C3F5C5A 3F1A [Regular] +5C3F5C5C 3F5C [Regular] +5C3F5C5F 3F5C5F [Regular] +5C3F5C61 3F61 [Trivial] +5C3F5C62 3F08 [Regular] +5C3F5C6E 3F0A [Regular] +5C3F5C72 3F0D [Regular] +5C3F5C74 3F09 [Regular] +5C3F5C7E 3F7E [Trivial] +5C3F5C7F 3F7F [Trivial] +5C3F5C80 3F80 [Trivial][ILSEQ] +5C3F5C81 3F81 [Trivial][ILSEQ] +5C3F5C9F 3F9F [Trivial][ILSEQ] +5C3F5CA0 3FA0 [Trivial][ILSEQ] +5C3F5CA1 3FA1 [Trivial][ILSEQ] +5C3F5CE0 3FE0 [Trivial][ILSEQ] +5C3F5CEF 3FEF [Trivial][ILSEQ] +5C3F5CF9 3FF9 [Trivial][ILSEQ] +5C3F5CFA 3FFA [Trivial][ILSEQ] +5C3F5CFC 3FFC [Trivial][ILSEQ] +5C3F5CFD 3FFD [Trivial][ILSEQ] +5C3F5CFE 3FFE [Trivial][ILSEQ] +5C3F5CFF 3FFF [Trivial][ILSEQ] +5C405C00 4000 [Trivial] +5C405C08 4008 [Trivial] +5C405C09 4009 [Trivial] +5C405C0A 400A [Trivial] +5C405C0D 400D [Trivial] +5C405C1A 401A [Trivial] +5C405C22 4022 [Trivial] +5C405C25 405C25 [Regular] +5C405C27 4027 [Trivial] +5C405C30 4000 [Regular] +5C405C3F 403F [Trivial] +5C405C40 4040 [Trivial] +5C405C5A 401A [Regular] +5C405C5C 405C [Regular] +5C405C5F 405C5F [Regular] +5C405C61 4061 [Trivial] +5C405C62 4008 [Regular] +5C405C6E 400A [Regular] +5C405C72 400D [Regular] +5C405C74 4009 [Regular] +5C405C7E 407E [Trivial] +5C405C7F 407F [Trivial] +5C405C80 4080 [Trivial][ILSEQ] +5C405C81 4081 [Trivial][ILSEQ] +5C405C9F 409F [Trivial][ILSEQ] +5C405CA0 40A0 [Trivial][ILSEQ] +5C405CA1 40A1 [Trivial][ILSEQ] +5C405CE0 40E0 [Trivial][ILSEQ] +5C405CEF 40EF [Trivial][ILSEQ] +5C405CF9 40F9 [Trivial][ILSEQ] +5C405CFA 40FA [Trivial][ILSEQ] +5C405CFC 40FC [Trivial][ILSEQ] +5C405CFD 40FD [Trivial][ILSEQ] +5C405CFE 40FE [Trivial][ILSEQ] +5C405CFF 40FF [Trivial][ILSEQ] +5C5A5C00 1A00 [Regular] +5C5A5C08 1A08 [Regular] +5C5A5C09 1A09 [Regular] +5C5A5C0A 1A0A [Regular] +5C5A5C0D 1A0D [Regular] +5C5A5C1A 1A1A [Regular] +5C5A5C22 1A22 [Regular] +5C5A5C25 1A5C25 [Regular] +5C5A5C27 1A27 [Regular] +5C5A5C30 1A00 [Regular] +5C5A5C3F 1A3F [Regular] +5C5A5C40 1A40 [Regular] +5C5A5C5A 1A1A [Regular] +5C5A5C5C 1A5C [Regular] +5C5A5C5F 1A5C5F [Regular] +5C5A5C61 1A61 [Regular] +5C5A5C62 1A08 [Regular] +5C5A5C6E 1A0A [Regular] +5C5A5C72 1A0D [Regular] +5C5A5C74 1A09 [Regular] +5C5A5C7E 1A7E [Regular] +5C5A5C7F 1A7F [Regular] +5C5A5C80 1A80 [Regular][ILSEQ] +5C5A5C81 1A81 [Regular][ILSEQ] +5C5A5C9F 1A9F [Regular][ILSEQ] +5C5A5CA0 1AA0 [Regular][ILSEQ] +5C5A5CA1 1AA1 [Regular][ILSEQ] +5C5A5CE0 1AE0 [Regular][ILSEQ] +5C5A5CEF 1AEF [Regular][ILSEQ] +5C5A5CF9 1AF9 [Regular][ILSEQ] +5C5A5CFA 1AFA [Regular][ILSEQ] +5C5A5CFC 1AFC [Regular][ILSEQ] +5C5A5CFD 1AFD [Regular][ILSEQ] +5C5A5CFE 1AFE [Regular][ILSEQ] +5C5A5CFF 1AFF [Regular][ILSEQ] +5C5C5C00 5C00 [Regular] +5C5C5C08 5C08 [Regular] +5C5C5C09 5C09 [Regular] +5C5C5C0A 5C0A [Regular] +5C5C5C0D 5C0D [Regular] +5C5C5C1A 5C1A [Regular] +5C5C5C22 5C22 [Regular] +5C5C5C25 5C5C25 [Regular] +5C5C5C27 5C27 [Regular] +5C5C5C30 5C00 [Regular] +5C5C5C3F 5C3F [Regular] +5C5C5C40 5C40 [Regular] +5C5C5C5A 5C1A [Regular] +5C5C5C5C 5C5C [Regular] +5C5C5C5F 5C5C5F [Regular] +5C5C5C61 5C61 [Regular] +5C5C5C62 5C08 [Regular] +5C5C5C6E 5C0A [Regular] +5C5C5C72 5C0D [Regular] +5C5C5C74 5C09 [Regular] +5C5C5C7E 5C7E [Regular] +5C5C5C7F 5C7F [Regular] +5C5C5C80 5C80 [Regular][ILSEQ] +5C5C5C81 5C81 [Regular][ILSEQ] +5C5C5C9F 5C9F [Regular][ILSEQ] +5C5C5CA0 5CA0 [Regular][ILSEQ] +5C5C5CA1 5CA1 [Regular][ILSEQ] +5C5C5CE0 5CE0 [Regular][ILSEQ] +5C5C5CEF 5CEF [Regular][ILSEQ] +5C5C5CF9 5CF9 [Regular][ILSEQ] +5C5C5CFA 5CFA [Regular][ILSEQ] +5C5C5CFC 5CFC [Regular][ILSEQ] +5C5C5CFD 5CFD [Regular][ILSEQ] +5C5C5CFE 5CFE [Regular][ILSEQ] +5C5C5CFF 5CFF [Regular][ILSEQ] +5C5F5C00 5C5F00 [Regular] +5C5F5C08 5C5F08 [Regular] +5C5F5C09 5C5F09 [Regular] +5C5F5C0A 5C5F0A [Regular] +5C5F5C0D 5C5F0D [Regular] +5C5F5C1A 5C5F1A [Regular] +5C5F5C22 5C5F22 [Regular] +5C5F5C25 5C5F5C25 [Preserve][LIKE] +5C5F5C27 5C5F27 [Regular] +5C5F5C30 5C5F00 [Regular] +5C5F5C3F 5C5F3F [Regular] +5C5F5C40 5C5F40 [Regular] +5C5F5C5A 5C5F1A [Regular] +5C5F5C5C 5C5F5C [Regular] +5C5F5C5F 5C5F5C5F [Preserve][LIKE] +5C5F5C61 5C5F61 [Regular] +5C5F5C62 5C5F08 [Regular] +5C5F5C6E 5C5F0A [Regular] +5C5F5C72 5C5F0D [Regular] +5C5F5C74 5C5F09 [Regular] +5C5F5C7E 5C5F7E [Regular] +5C5F5C7F 5C5F7F [Regular] +5C5F5C80 5C5F80 [Regular][ILSEQ] +5C5F5C81 5C5F81 [Regular][ILSEQ] +5C5F5C9F 5C5F9F [Regular][ILSEQ] +5C5F5CA0 5C5FA0 [Regular][ILSEQ] +5C5F5CA1 5C5FA1 [Regular][ILSEQ] +5C5F5CE0 5C5FE0 [Regular][ILSEQ] +5C5F5CEF 5C5FEF [Regular][ILSEQ] +5C5F5CF9 5C5FF9 [Regular][ILSEQ] +5C5F5CFA 5C5FFA [Regular][ILSEQ] +5C5F5CFC 5C5FFC [Regular][ILSEQ] +5C5F5CFD 5C5FFD [Regular][ILSEQ] +5C5F5CFE 5C5FFE [Regular][ILSEQ] +5C5F5CFF 5C5FFF [Regular][ILSEQ] +5C615C00 6100 [Trivial] +5C615C08 6108 [Trivial] +5C615C09 6109 [Trivial] +5C615C0A 610A [Trivial] +5C615C0D 610D [Trivial] +5C615C1A 611A [Trivial] +5C615C22 6122 [Trivial] +5C615C25 615C25 [Regular] +5C615C27 6127 [Trivial] +5C615C30 6100 [Regular] +5C615C3F 613F [Trivial] +5C615C40 6140 [Trivial] +5C615C5A 611A [Regular] +5C615C5C 615C [Regular] +5C615C5F 615C5F [Regular] +5C615C61 6161 [Trivial] +5C615C62 6108 [Regular] +5C615C6E 610A [Regular] +5C615C72 610D [Regular] +5C615C74 6109 [Regular] +5C615C7E 617E [Trivial] +5C615C7F 617F [Trivial] +5C615C80 6180 [Trivial][ILSEQ] +5C615C81 6181 [Trivial][ILSEQ] +5C615C9F 619F [Trivial][ILSEQ] +5C615CA0 61A0 [Trivial][ILSEQ] +5C615CA1 61A1 [Trivial][ILSEQ] +5C615CE0 61E0 [Trivial][ILSEQ] +5C615CEF 61EF [Trivial][ILSEQ] +5C615CF9 61F9 [Trivial][ILSEQ] +5C615CFA 61FA [Trivial][ILSEQ] +5C615CFC 61FC [Trivial][ILSEQ] +5C615CFD 61FD [Trivial][ILSEQ] +5C615CFE 61FE [Trivial][ILSEQ] +5C615CFF 61FF [Trivial][ILSEQ] +5C625C00 0800 [Regular] +5C625C08 0808 [Regular] +5C625C09 0809 [Regular] +5C625C0A 080A [Regular] +5C625C0D 080D [Regular] +5C625C1A 081A [Regular] +5C625C22 0822 [Regular] +5C625C25 085C25 [Regular] +5C625C27 0827 [Regular] +5C625C30 0800 [Regular] +5C625C3F 083F [Regular] +5C625C40 0840 [Regular] +5C625C5A 081A [Regular] +5C625C5C 085C [Regular] +5C625C5F 085C5F [Regular] +5C625C61 0861 [Regular] +5C625C62 0808 [Regular] +5C625C6E 080A [Regular] +5C625C72 080D [Regular] +5C625C74 0809 [Regular] +5C625C7E 087E [Regular] +5C625C7F 087F [Regular] +5C625C80 0880 [Regular][ILSEQ] +5C625C81 0881 [Regular][ILSEQ] +5C625C9F 089F [Regular][ILSEQ] +5C625CA0 08A0 [Regular][ILSEQ] +5C625CA1 08A1 [Regular][ILSEQ] +5C625CE0 08E0 [Regular][ILSEQ] +5C625CEF 08EF [Regular][ILSEQ] +5C625CF9 08F9 [Regular][ILSEQ] +5C625CFA 08FA [Regular][ILSEQ] +5C625CFC 08FC [Regular][ILSEQ] +5C625CFD 08FD [Regular][ILSEQ] +5C625CFE 08FE [Regular][ILSEQ] +5C625CFF 08FF [Regular][ILSEQ] +5C6E5C00 0A00 [Regular] +5C6E5C08 0A08 [Regular] +5C6E5C09 0A09 [Regular] +5C6E5C0A 0A0A [Regular] +5C6E5C0D 0A0D [Regular] +5C6E5C1A 0A1A [Regular] +5C6E5C22 0A22 [Regular] +5C6E5C25 0A5C25 [Regular] +5C6E5C27 0A27 [Regular] +5C6E5C30 0A00 [Regular] +5C6E5C3F 0A3F [Regular] +5C6E5C40 0A40 [Regular] +5C6E5C5A 0A1A [Regular] +5C6E5C5C 0A5C [Regular] +5C6E5C5F 0A5C5F [Regular] +5C6E5C61 0A61 [Regular] +5C6E5C62 0A08 [Regular] +5C6E5C6E 0A0A [Regular] +5C6E5C72 0A0D [Regular] +5C6E5C74 0A09 [Regular] +5C6E5C7E 0A7E [Regular] +5C6E5C7F 0A7F [Regular] +5C6E5C80 0A80 [Regular][ILSEQ] +5C6E5C81 0A81 [Regular][ILSEQ] +5C6E5C9F 0A9F [Regular][ILSEQ] +5C6E5CA0 0AA0 [Regular][ILSEQ] +5C6E5CA1 0AA1 [Regular][ILSEQ] +5C6E5CE0 0AE0 [Regular][ILSEQ] +5C6E5CEF 0AEF [Regular][ILSEQ] +5C6E5CF9 0AF9 [Regular][ILSEQ] +5C6E5CFA 0AFA [Regular][ILSEQ] +5C6E5CFC 0AFC [Regular][ILSEQ] +5C6E5CFD 0AFD [Regular][ILSEQ] +5C6E5CFE 0AFE [Regular][ILSEQ] +5C6E5CFF 0AFF [Regular][ILSEQ] +5C725C00 0D00 [Regular] +5C725C08 0D08 [Regular] +5C725C09 0D09 [Regular] +5C725C0A 0D0A [Regular] +5C725C0D 0D0D [Regular] +5C725C1A 0D1A [Regular] +5C725C22 0D22 [Regular] +5C725C25 0D5C25 [Regular] +5C725C27 0D27 [Regular] +5C725C30 0D00 [Regular] +5C725C3F 0D3F [Regular] +5C725C40 0D40 [Regular] +5C725C5A 0D1A [Regular] +5C725C5C 0D5C [Regular] +5C725C5F 0D5C5F [Regular] +5C725C61 0D61 [Regular] +5C725C62 0D08 [Regular] +5C725C6E 0D0A [Regular] +5C725C72 0D0D [Regular] +5C725C74 0D09 [Regular] +5C725C7E 0D7E [Regular] +5C725C7F 0D7F [Regular] +5C725C80 0D80 [Regular][ILSEQ] +5C725C81 0D81 [Regular][ILSEQ] +5C725C9F 0D9F [Regular][ILSEQ] +5C725CA0 0DA0 [Regular][ILSEQ] +5C725CA1 0DA1 [Regular][ILSEQ] +5C725CE0 0DE0 [Regular][ILSEQ] +5C725CEF 0DEF [Regular][ILSEQ] +5C725CF9 0DF9 [Regular][ILSEQ] +5C725CFA 0DFA [Regular][ILSEQ] +5C725CFC 0DFC [Regular][ILSEQ] +5C725CFD 0DFD [Regular][ILSEQ] +5C725CFE 0DFE [Regular][ILSEQ] +5C725CFF 0DFF [Regular][ILSEQ] +5C745C00 0900 [Regular] +5C745C08 0908 [Regular] +5C745C09 0909 [Regular] +5C745C0A 090A [Regular] +5C745C0D 090D [Regular] +5C745C1A 091A [Regular] +5C745C22 0922 [Regular] +5C745C25 095C25 [Regular] +5C745C27 0927 [Regular] +5C745C30 0900 [Regular] +5C745C3F 093F [Regular] +5C745C40 0940 [Regular] +5C745C5A 091A [Regular] +5C745C5C 095C [Regular] +5C745C5F 095C5F [Regular] +5C745C61 0961 [Regular] +5C745C62 0908 [Regular] +5C745C6E 090A [Regular] +5C745C72 090D [Regular] +5C745C74 0909 [Regular] +5C745C7E 097E [Regular] +5C745C7F 097F [Regular] +5C745C80 0980 [Regular][ILSEQ] +5C745C81 0981 [Regular][ILSEQ] +5C745C9F 099F [Regular][ILSEQ] +5C745CA0 09A0 [Regular][ILSEQ] +5C745CA1 09A1 [Regular][ILSEQ] +5C745CE0 09E0 [Regular][ILSEQ] +5C745CEF 09EF [Regular][ILSEQ] +5C745CF9 09F9 [Regular][ILSEQ] +5C745CFA 09FA [Regular][ILSEQ] +5C745CFC 09FC [Regular][ILSEQ] +5C745CFD 09FD [Regular][ILSEQ] +5C745CFE 09FE [Regular][ILSEQ] +5C745CFF 09FF [Regular][ILSEQ] +5C7E5C00 7E00 [Trivial] +5C7E5C08 7E08 [Trivial] +5C7E5C09 7E09 [Trivial] +5C7E5C0A 7E0A [Trivial] +5C7E5C0D 7E0D [Trivial] +5C7E5C1A 7E1A [Trivial] +5C7E5C22 7E22 [Trivial] +5C7E5C25 7E5C25 [Regular] +5C7E5C27 7E27 [Trivial] +5C7E5C30 7E00 [Regular] +5C7E5C3F 7E3F [Trivial] +5C7E5C40 7E40 [Trivial] +5C7E5C5A 7E1A [Regular] +5C7E5C5C 7E5C [Regular] +5C7E5C5F 7E5C5F [Regular] +5C7E5C61 7E61 [Trivial] +5C7E5C62 7E08 [Regular] +5C7E5C6E 7E0A [Regular] +5C7E5C72 7E0D [Regular] +5C7E5C74 7E09 [Regular] +5C7E5C7E 7E7E [Trivial] +5C7E5C7F 7E7F [Trivial] +5C7E5C80 7E80 [Trivial][ILSEQ] +5C7E5C81 7E81 [Trivial][ILSEQ] +5C7E5C9F 7E9F [Trivial][ILSEQ] +5C7E5CA0 7EA0 [Trivial][ILSEQ] +5C7E5CA1 7EA1 [Trivial][ILSEQ] +5C7E5CE0 7EE0 [Trivial][ILSEQ] +5C7E5CEF 7EEF [Trivial][ILSEQ] +5C7E5CF9 7EF9 [Trivial][ILSEQ] +5C7E5CFA 7EFA [Trivial][ILSEQ] +5C7E5CFC 7EFC [Trivial][ILSEQ] +5C7E5CFD 7EFD [Trivial][ILSEQ] +5C7E5CFE 7EFE [Trivial][ILSEQ] +5C7E5CFF 7EFF [Trivial][ILSEQ] +5C7F5C00 7F00 [Trivial] +5C7F5C08 7F08 [Trivial] +5C7F5C09 7F09 [Trivial] +5C7F5C0A 7F0A [Trivial] +5C7F5C0D 7F0D [Trivial] +5C7F5C1A 7F1A [Trivial] +5C7F5C22 7F22 [Trivial] +5C7F5C25 7F5C25 [Regular] +5C7F5C27 7F27 [Trivial] +5C7F5C30 7F00 [Regular] +5C7F5C3F 7F3F [Trivial] +5C7F5C40 7F40 [Trivial] +5C7F5C5A 7F1A [Regular] +5C7F5C5C 7F5C [Regular] +5C7F5C5F 7F5C5F [Regular] +5C7F5C61 7F61 [Trivial] +5C7F5C62 7F08 [Regular] +5C7F5C6E 7F0A [Regular] +5C7F5C72 7F0D [Regular] +5C7F5C74 7F09 [Regular] +5C7F5C7E 7F7E [Trivial] +5C7F5C7F 7F7F [Trivial] +5C7F5C80 7F80 [Trivial][ILSEQ] +5C7F5C81 7F81 [Trivial][ILSEQ] +5C7F5C9F 7F9F [Trivial][ILSEQ] +5C7F5CA0 7FA0 [Trivial][ILSEQ] +5C7F5CA1 7FA1 [Trivial][ILSEQ] +5C7F5CE0 7FE0 [Trivial][ILSEQ] +5C7F5CEF 7FEF [Trivial][ILSEQ] +5C7F5CF9 7FF9 [Trivial][ILSEQ] +5C7F5CFA 7FFA [Trivial][ILSEQ] +5C7F5CFC 7FFC [Trivial][ILSEQ] +5C7F5CFD 7FFD [Trivial][ILSEQ] +5C7F5CFE 7FFE [Trivial][ILSEQ] +5C7F5CFF 7FFF [Trivial][ILSEQ] +5C805C00 8000 [Trivial][ILSEQ] +5C805C08 8008 [Trivial][ILSEQ] +5C805C09 8009 [Trivial][ILSEQ] +5C805C0A 800A [Trivial][ILSEQ] +5C805C0D 800D [Trivial][ILSEQ] +5C805C1A 801A [Trivial][ILSEQ] +5C805C22 8022 [Trivial][ILSEQ] +5C805C25 805C25 [Regular][ILSEQ] +5C805C27 8027 [Trivial][ILSEQ] +5C805C30 8000 [Regular][ILSEQ] +5C805C3F 803F [Trivial][ILSEQ] +5C805C40 8040 [Trivial][ILSEQ] +5C805C5A 801A [Regular][ILSEQ] +5C805C5C 805C [Regular][ILSEQ] +5C805C5F 805C5F [Regular][ILSEQ] +5C805C61 8061 [Trivial][ILSEQ] +5C805C62 8008 [Regular][ILSEQ] +5C805C6E 800A [Regular][ILSEQ] +5C805C72 800D [Regular][ILSEQ] +5C805C74 8009 [Regular][ILSEQ] +5C805C7E 807E [Trivial][ILSEQ] +5C805C7F 807F [Trivial][ILSEQ] +5C805C80 8080 [Trivial][ILSEQ] +5C805C81 8081 [Trivial][ILSEQ] +5C805C9F 809F [Trivial][ILSEQ] +5C805CA0 80A0 [Trivial][ILSEQ] +5C805CA1 80A1 [Trivial][ILSEQ] +5C805CE0 80E0 [Trivial][ILSEQ] +5C805CEF 80EF [Trivial][ILSEQ] +5C805CF9 80F9 [Trivial][ILSEQ] +5C805CFA 80FA [Trivial][ILSEQ] +5C805CFC 80FC [Trivial][ILSEQ] +5C805CFD 80FD [Trivial][ILSEQ] +5C805CFE 80FE [Trivial][ILSEQ] +5C805CFF 80FF [Trivial][ILSEQ] +5C815C00 8100 [Trivial][ILSEQ] +5C815C08 8108 [Trivial][ILSEQ] +5C815C09 8109 [Trivial][ILSEQ] +5C815C0A 810A [Trivial][ILSEQ] +5C815C0D 810D [Trivial][ILSEQ] +5C815C1A 811A [Trivial][ILSEQ] +5C815C22 8122 [Trivial][ILSEQ] +5C815C25 815C25 [Regular][ILSEQ] +5C815C27 8127 [Trivial][ILSEQ] +5C815C30 8100 [Regular][ILSEQ] +5C815C3F 813F [Trivial][ILSEQ] +5C815C40 8140 [Trivial][ILSEQ] +5C815C5A 811A [Regular][ILSEQ] +5C815C5C 815C [Regular][ILSEQ] +5C815C5F 815C5F [Regular][ILSEQ] +5C815C61 8161 [Trivial][ILSEQ] +5C815C62 8108 [Regular][ILSEQ] +5C815C6E 810A [Regular][ILSEQ] +5C815C72 810D [Regular][ILSEQ] +5C815C74 8109 [Regular][ILSEQ] +5C815C7E 817E [Trivial][ILSEQ] +5C815C7F 817F [Trivial][ILSEQ] +5C815C80 8180 [Trivial][ILSEQ] +5C815C81 8181 [Trivial][ILSEQ] +5C815C9F 819F [Trivial][ILSEQ] +5C815CA0 81A0 [Trivial][ILSEQ] +5C815CA1 81A1 [Trivial][ILSEQ] +5C815CE0 81E0 [Trivial][ILSEQ] +5C815CEF 81EF [Trivial][ILSEQ] +5C815CF9 81F9 [Trivial][ILSEQ] +5C815CFA 81FA [Trivial][ILSEQ] +5C815CFC 81FC [Trivial][ILSEQ] +5C815CFD 81FD [Trivial][ILSEQ] +5C815CFE 81FE [Trivial][ILSEQ] +5C815CFF 81FF [Trivial][ILSEQ] +5C9F5C00 9F00 [Trivial][ILSEQ] +5C9F5C08 9F08 [Trivial][ILSEQ] +5C9F5C09 9F09 [Trivial][ILSEQ] +5C9F5C0A 9F0A [Trivial][ILSEQ] +5C9F5C0D 9F0D [Trivial][ILSEQ] +5C9F5C1A 9F1A [Trivial][ILSEQ] +5C9F5C22 9F22 [Trivial][ILSEQ] +5C9F5C25 9F5C25 [Regular][ILSEQ] +5C9F5C27 9F27 [Trivial][ILSEQ] +5C9F5C30 9F00 [Regular][ILSEQ] +5C9F5C3F 9F3F [Trivial][ILSEQ] +5C9F5C40 9F40 [Trivial][ILSEQ] +5C9F5C5A 9F1A [Regular][ILSEQ] +5C9F5C5C 9F5C [Regular][ILSEQ] +5C9F5C5F 9F5C5F [Regular][ILSEQ] +5C9F5C61 9F61 [Trivial][ILSEQ] +5C9F5C62 9F08 [Regular][ILSEQ] +5C9F5C6E 9F0A [Regular][ILSEQ] +5C9F5C72 9F0D [Regular][ILSEQ] +5C9F5C74 9F09 [Regular][ILSEQ] +5C9F5C7E 9F7E [Trivial][ILSEQ] +5C9F5C7F 9F7F [Trivial][ILSEQ] +5C9F5C80 9F80 [Trivial][ILSEQ] +5C9F5C81 9F81 [Trivial][ILSEQ] +5C9F5C9F 9F9F [Trivial][ILSEQ] +5C9F5CA0 9FA0 [Trivial][ILSEQ] +5C9F5CA1 9FA1 [Trivial][ILSEQ] +5C9F5CE0 9FE0 [Trivial][ILSEQ] +5C9F5CEF 9FEF [Trivial][ILSEQ] +5C9F5CF9 9FF9 [Trivial][ILSEQ] +5C9F5CFA 9FFA [Trivial][ILSEQ] +5C9F5CFC 9FFC [Trivial][ILSEQ] +5C9F5CFD 9FFD [Trivial][ILSEQ] +5C9F5CFE 9FFE [Trivial][ILSEQ] +5C9F5CFF 9FFF [Trivial][ILSEQ] +5CA05C00 A000 [Trivial][ILSEQ] +5CA05C08 A008 [Trivial][ILSEQ] +5CA05C09 A009 [Trivial][ILSEQ] +5CA05C0A A00A [Trivial][ILSEQ] +5CA05C0D A00D [Trivial][ILSEQ] +5CA05C1A A01A [Trivial][ILSEQ] +5CA05C22 A022 [Trivial][ILSEQ] +5CA05C25 A05C25 [Regular][ILSEQ] +5CA05C27 A027 [Trivial][ILSEQ] +5CA05C30 A000 [Regular][ILSEQ] +5CA05C3F A03F [Trivial][ILSEQ] +5CA05C40 A040 [Trivial][ILSEQ] +5CA05C5A A01A [Regular][ILSEQ] +5CA05C5C A05C [Regular][ILSEQ] +5CA05C5F A05C5F [Regular][ILSEQ] +5CA05C61 A061 [Trivial][ILSEQ] +5CA05C62 A008 [Regular][ILSEQ] +5CA05C6E A00A [Regular][ILSEQ] +5CA05C72 A00D [Regular][ILSEQ] +5CA05C74 A009 [Regular][ILSEQ] +5CA05C7E A07E [Trivial][ILSEQ] +5CA05C7F A07F [Trivial][ILSEQ] +5CA05C80 A080 [Trivial][ILSEQ] +5CA05C81 A081 [Trivial][ILSEQ] +5CA05C9F A09F [Trivial][ILSEQ] +5CA05CA0 A0A0 [Trivial][ILSEQ] +5CA05CA1 A0A1 [Trivial][ILSEQ] +5CA05CE0 A0E0 [Trivial][ILSEQ] +5CA05CEF A0EF [Trivial][ILSEQ] +5CA05CF9 A0F9 [Trivial][ILSEQ] +5CA05CFA A0FA [Trivial][ILSEQ] +5CA05CFC A0FC [Trivial][ILSEQ] +5CA05CFD A0FD [Trivial][ILSEQ] +5CA05CFE A0FE [Trivial][ILSEQ] +5CA05CFF A0FF [Trivial][ILSEQ] +5CA15C00 A100 [Trivial][ILSEQ] +5CA15C08 A108 [Trivial][ILSEQ] +5CA15C09 A109 [Trivial][ILSEQ] +5CA15C0A A10A [Trivial][ILSEQ] +5CA15C0D A10D [Trivial][ILSEQ] +5CA15C1A A11A [Trivial][ILSEQ] +5CA15C22 A122 [Trivial][ILSEQ] +5CA15C25 A15C25 [Regular][ILSEQ] +5CA15C27 A127 [Trivial][ILSEQ] +5CA15C30 A100 [Regular][ILSEQ] +5CA15C3F A13F [Trivial][ILSEQ] +5CA15C40 A140 [Trivial][ILSEQ] +5CA15C5A A11A [Regular][ILSEQ] +5CA15C5C A15C [Regular][ILSEQ] +5CA15C5F A15C5F [Regular][ILSEQ] +5CA15C61 A161 [Trivial][ILSEQ] +5CA15C62 A108 [Regular][ILSEQ] +5CA15C6E A10A [Regular][ILSEQ] +5CA15C72 A10D [Regular][ILSEQ] +5CA15C74 A109 [Regular][ILSEQ] +5CA15C7E A17E [Trivial][ILSEQ] +5CA15C7F A17F [Trivial][ILSEQ] +5CA15C80 A180 [Trivial][ILSEQ] +5CA15C81 A181 [Trivial][ILSEQ] +5CA15C9F A19F [Trivial][ILSEQ] +5CA15CA0 A1A0 [Trivial][ILSEQ] +5CA15CA1 A1A1 [Trivial][ILSEQ] +5CA15CE0 A1E0 [Trivial][ILSEQ] +5CA15CEF A1EF [Trivial][ILSEQ] +5CA15CF9 A1F9 [Trivial][ILSEQ] +5CA15CFA A1FA [Trivial][ILSEQ] +5CA15CFC A1FC [Trivial][ILSEQ] +5CA15CFD A1FD [Trivial][ILSEQ] +5CA15CFE A1FE [Trivial][ILSEQ] +5CA15CFF A1FF [Trivial][ILSEQ] +5CE05C00 E000 [Trivial][ILSEQ] +5CE05C08 E008 [Trivial][ILSEQ] +5CE05C09 E009 [Trivial][ILSEQ] +5CE05C0A E00A [Trivial][ILSEQ] +5CE05C0D E00D [Trivial][ILSEQ] +5CE05C1A E01A [Trivial][ILSEQ] +5CE05C22 E022 [Trivial][ILSEQ] +5CE05C25 E05C25 [Regular][ILSEQ] +5CE05C27 E027 [Trivial][ILSEQ] +5CE05C30 E000 [Regular][ILSEQ] +5CE05C3F E03F [Trivial][ILSEQ] +5CE05C40 E040 [Trivial][ILSEQ] +5CE05C5A E01A [Regular][ILSEQ] +5CE05C5C E05C [Regular][ILSEQ] +5CE05C5F E05C5F [Regular][ILSEQ] +5CE05C61 E061 [Trivial][ILSEQ] +5CE05C62 E008 [Regular][ILSEQ] +5CE05C6E E00A [Regular][ILSEQ] +5CE05C72 E00D [Regular][ILSEQ] +5CE05C74 E009 [Regular][ILSEQ] +5CE05C7E E07E [Trivial][ILSEQ] +5CE05C7F E07F [Trivial][ILSEQ] +5CE05C80 E080 [Trivial][ILSEQ] +5CE05C81 E081 [Trivial][ILSEQ] +5CE05C9F E09F [Trivial][ILSEQ] +5CE05CA0 E0A0 [Trivial][ILSEQ] +5CE05CA1 E0A1 [Trivial][ILSEQ] +5CE05CE0 E0E0 [Trivial][ILSEQ] +5CE05CEF E0EF [Trivial][ILSEQ] +5CE05CF9 E0F9 [Trivial][ILSEQ] +5CE05CFA E0FA [Trivial][ILSEQ] +5CE05CFC E0FC [Trivial][ILSEQ] +5CE05CFD E0FD [Trivial][ILSEQ] +5CE05CFE E0FE [Trivial][ILSEQ] +5CE05CFF E0FF [Trivial][ILSEQ] +5CEF5C00 EF00 [Trivial][ILSEQ] +5CEF5C08 EF08 [Trivial][ILSEQ] +5CEF5C09 EF09 [Trivial][ILSEQ] +5CEF5C0A EF0A [Trivial][ILSEQ] +5CEF5C0D EF0D [Trivial][ILSEQ] +5CEF5C1A EF1A [Trivial][ILSEQ] +5CEF5C22 EF22 [Trivial][ILSEQ] +5CEF5C25 EF5C25 [Regular][ILSEQ] +5CEF5C27 EF27 [Trivial][ILSEQ] +5CEF5C30 EF00 [Regular][ILSEQ] +5CEF5C3F EF3F [Trivial][ILSEQ] +5CEF5C40 EF40 [Trivial][ILSEQ] +5CEF5C5A EF1A [Regular][ILSEQ] +5CEF5C5C EF5C [Regular][ILSEQ] +5CEF5C5F EF5C5F [Regular][ILSEQ] +5CEF5C61 EF61 [Trivial][ILSEQ] +5CEF5C62 EF08 [Regular][ILSEQ] +5CEF5C6E EF0A [Regular][ILSEQ] +5CEF5C72 EF0D [Regular][ILSEQ] +5CEF5C74 EF09 [Regular][ILSEQ] +5CEF5C7E EF7E [Trivial][ILSEQ] +5CEF5C7F EF7F [Trivial][ILSEQ] +5CEF5C80 EF80 [Trivial][ILSEQ] +5CEF5C81 EF81 [Trivial][ILSEQ] +5CEF5C9F EF9F [Trivial][ILSEQ] +5CEF5CA0 EFA0 [Trivial][ILSEQ] +5CEF5CA1 EFA1 [Trivial][ILSEQ] +5CEF5CE0 EFE0 [Trivial][ILSEQ] +5CEF5CEF EFEF [Trivial][ILSEQ] +5CEF5CF9 EFF9 [Trivial][ILSEQ] +5CEF5CFA EFFA [Trivial][ILSEQ] +5CEF5CFC EFFC [Trivial][ILSEQ] +5CEF5CFD EFFD [Trivial][ILSEQ] +5CEF5CFE EFFE [Trivial][ILSEQ] +5CEF5CFF EFFF [Trivial][ILSEQ] +5CF95C00 F900 [Trivial][ILSEQ] +5CF95C08 F908 [Trivial][ILSEQ] +5CF95C09 F909 [Trivial][ILSEQ] +5CF95C0A F90A [Trivial][ILSEQ] +5CF95C0D F90D [Trivial][ILSEQ] +5CF95C1A F91A [Trivial][ILSEQ] +5CF95C22 F922 [Trivial][ILSEQ] +5CF95C25 F95C25 [Regular][ILSEQ] +5CF95C27 F927 [Trivial][ILSEQ] +5CF95C30 F900 [Regular][ILSEQ] +5CF95C3F F93F [Trivial][ILSEQ] +5CF95C40 F940 [Trivial][ILSEQ] +5CF95C5A F91A [Regular][ILSEQ] +5CF95C5C F95C [Regular][ILSEQ] +5CF95C5F F95C5F [Regular][ILSEQ] +5CF95C61 F961 [Trivial][ILSEQ] +5CF95C62 F908 [Regular][ILSEQ] +5CF95C6E F90A [Regular][ILSEQ] +5CF95C72 F90D [Regular][ILSEQ] +5CF95C74 F909 [Regular][ILSEQ] +5CF95C7E F97E [Trivial][ILSEQ] +5CF95C7F F97F [Trivial][ILSEQ] +5CF95C80 F980 [Trivial][ILSEQ] +5CF95C81 F981 [Trivial][ILSEQ] +5CF95C9F F99F [Trivial][ILSEQ] +5CF95CA0 F9A0 [Trivial][ILSEQ] +5CF95CA1 F9A1 [Trivial][ILSEQ] +5CF95CE0 F9E0 [Trivial][ILSEQ] +5CF95CEF F9EF [Trivial][ILSEQ] +5CF95CF9 F9F9 [Trivial][ILSEQ] +5CF95CFA F9FA [Trivial][ILSEQ] +5CF95CFC F9FC [Trivial][ILSEQ] +5CF95CFD F9FD [Trivial][ILSEQ] +5CF95CFE F9FE [Trivial][ILSEQ] +5CF95CFF F9FF [Trivial][ILSEQ] +5CFA5C00 FA00 [Trivial][ILSEQ] +5CFA5C08 FA08 [Trivial][ILSEQ] +5CFA5C09 FA09 [Trivial][ILSEQ] +5CFA5C0A FA0A [Trivial][ILSEQ] +5CFA5C0D FA0D [Trivial][ILSEQ] +5CFA5C1A FA1A [Trivial][ILSEQ] +5CFA5C22 FA22 [Trivial][ILSEQ] +5CFA5C25 FA5C25 [Regular][ILSEQ] +5CFA5C27 FA27 [Trivial][ILSEQ] +5CFA5C30 FA00 [Regular][ILSEQ] +5CFA5C3F FA3F [Trivial][ILSEQ] +5CFA5C40 FA40 [Trivial][ILSEQ] +5CFA5C5A FA1A [Regular][ILSEQ] +5CFA5C5C FA5C [Regular][ILSEQ] +5CFA5C5F FA5C5F [Regular][ILSEQ] +5CFA5C61 FA61 [Trivial][ILSEQ] +5CFA5C62 FA08 [Regular][ILSEQ] +5CFA5C6E FA0A [Regular][ILSEQ] +5CFA5C72 FA0D [Regular][ILSEQ] +5CFA5C74 FA09 [Regular][ILSEQ] +5CFA5C7E FA7E [Trivial][ILSEQ] +5CFA5C7F FA7F [Trivial][ILSEQ] +5CFA5C80 FA80 [Trivial][ILSEQ] +5CFA5C81 FA81 [Trivial][ILSEQ] +5CFA5C9F FA9F [Trivial][ILSEQ] +5CFA5CA0 FAA0 [Trivial][ILSEQ] +5CFA5CA1 FAA1 [Trivial][ILSEQ] +5CFA5CE0 FAE0 [Trivial][ILSEQ] +5CFA5CEF FAEF [Trivial][ILSEQ] +5CFA5CF9 FAF9 [Trivial][ILSEQ] +5CFA5CFA FAFA [Trivial][ILSEQ] +5CFA5CFC FAFC [Trivial][ILSEQ] +5CFA5CFD FAFD [Trivial][ILSEQ] +5CFA5CFE FAFE [Trivial][ILSEQ] +5CFA5CFF FAFF [Trivial][ILSEQ] +5CFC5C00 FC00 [Trivial][ILSEQ] +5CFC5C08 FC08 [Trivial][ILSEQ] +5CFC5C09 FC09 [Trivial][ILSEQ] +5CFC5C0A FC0A [Trivial][ILSEQ] +5CFC5C0D FC0D [Trivial][ILSEQ] +5CFC5C1A FC1A [Trivial][ILSEQ] +5CFC5C22 FC22 [Trivial][ILSEQ] +5CFC5C25 FC5C25 [Regular][ILSEQ] +5CFC5C27 FC27 [Trivial][ILSEQ] +5CFC5C30 FC00 [Regular][ILSEQ] +5CFC5C3F FC3F [Trivial][ILSEQ] +5CFC5C40 FC40 [Trivial][ILSEQ] +5CFC5C5A FC1A [Regular][ILSEQ] +5CFC5C5C FC5C [Regular][ILSEQ] +5CFC5C5F FC5C5F [Regular][ILSEQ] +5CFC5C61 FC61 [Trivial][ILSEQ] +5CFC5C62 FC08 [Regular][ILSEQ] +5CFC5C6E FC0A [Regular][ILSEQ] +5CFC5C72 FC0D [Regular][ILSEQ] +5CFC5C74 FC09 [Regular][ILSEQ] +5CFC5C7E FC7E [Trivial][ILSEQ] +5CFC5C7F FC7F [Trivial][ILSEQ] +5CFC5C80 FC80 [Trivial][ILSEQ] +5CFC5C81 FC81 [Trivial][ILSEQ] +5CFC5C9F FC9F [Trivial][ILSEQ] +5CFC5CA0 FCA0 [Trivial][ILSEQ] +5CFC5CA1 FCA1 [Trivial][ILSEQ] +5CFC5CE0 FCE0 [Trivial][ILSEQ] +5CFC5CEF FCEF [Trivial][ILSEQ] +5CFC5CF9 FCF9 [Trivial][ILSEQ] +5CFC5CFA FCFA [Trivial][ILSEQ] +5CFC5CFC FCFC [Trivial][ILSEQ] +5CFC5CFD FCFD [Trivial][ILSEQ] +5CFC5CFE FCFE [Trivial][ILSEQ] +5CFC5CFF FCFF [Trivial][ILSEQ] +5CFD5C00 FD00 [Trivial][ILSEQ] +5CFD5C08 FD08 [Trivial][ILSEQ] +5CFD5C09 FD09 [Trivial][ILSEQ] +5CFD5C0A FD0A [Trivial][ILSEQ] +5CFD5C0D FD0D [Trivial][ILSEQ] +5CFD5C1A FD1A [Trivial][ILSEQ] +5CFD5C22 FD22 [Trivial][ILSEQ] +5CFD5C25 FD5C25 [Regular][ILSEQ] +5CFD5C27 FD27 [Trivial][ILSEQ] +5CFD5C30 FD00 [Regular][ILSEQ] +5CFD5C3F FD3F [Trivial][ILSEQ] +5CFD5C40 FD40 [Trivial][ILSEQ] +5CFD5C5A FD1A [Regular][ILSEQ] +5CFD5C5C FD5C [Regular][ILSEQ] +5CFD5C5F FD5C5F [Regular][ILSEQ] +5CFD5C61 FD61 [Trivial][ILSEQ] +5CFD5C62 FD08 [Regular][ILSEQ] +5CFD5C6E FD0A [Regular][ILSEQ] +5CFD5C72 FD0D [Regular][ILSEQ] +5CFD5C74 FD09 [Regular][ILSEQ] +5CFD5C7E FD7E [Trivial][ILSEQ] +5CFD5C7F FD7F [Trivial][ILSEQ] +5CFD5C80 FD80 [Trivial][ILSEQ] +5CFD5C81 FD81 [Trivial][ILSEQ] +5CFD5C9F FD9F [Trivial][ILSEQ] +5CFD5CA0 FDA0 [Trivial][ILSEQ] +5CFD5CA1 FDA1 [Trivial][ILSEQ] +5CFD5CE0 FDE0 [Trivial][ILSEQ] +5CFD5CEF FDEF [Trivial][ILSEQ] +5CFD5CF9 FDF9 [Trivial][ILSEQ] +5CFD5CFA FDFA [Trivial][ILSEQ] +5CFD5CFC FDFC [Trivial][ILSEQ] +5CFD5CFD FDFD [Trivial][ILSEQ] +5CFD5CFE FDFE [Trivial][ILSEQ] +5CFD5CFF FDFF [Trivial][ILSEQ] +5CFE5C00 FE00 [Trivial][ILSEQ] +5CFE5C08 FE08 [Trivial][ILSEQ] +5CFE5C09 FE09 [Trivial][ILSEQ] +5CFE5C0A FE0A [Trivial][ILSEQ] +5CFE5C0D FE0D [Trivial][ILSEQ] +5CFE5C1A FE1A [Trivial][ILSEQ] +5CFE5C22 FE22 [Trivial][ILSEQ] +5CFE5C25 FE5C25 [Regular][ILSEQ] +5CFE5C27 FE27 [Trivial][ILSEQ] +5CFE5C30 FE00 [Regular][ILSEQ] +5CFE5C3F FE3F [Trivial][ILSEQ] +5CFE5C40 FE40 [Trivial][ILSEQ] +5CFE5C5A FE1A [Regular][ILSEQ] +5CFE5C5C FE5C [Regular][ILSEQ] +5CFE5C5F FE5C5F [Regular][ILSEQ] +5CFE5C61 FE61 [Trivial][ILSEQ] +5CFE5C62 FE08 [Regular][ILSEQ] +5CFE5C6E FE0A [Regular][ILSEQ] +5CFE5C72 FE0D [Regular][ILSEQ] +5CFE5C74 FE09 [Regular][ILSEQ] +5CFE5C7E FE7E [Trivial][ILSEQ] +5CFE5C7F FE7F [Trivial][ILSEQ] +5CFE5C80 FE80 [Trivial][ILSEQ] +5CFE5C81 FE81 [Trivial][ILSEQ] +5CFE5C9F FE9F [Trivial][ILSEQ] +5CFE5CA0 FEA0 [Trivial][ILSEQ] +5CFE5CA1 FEA1 [Trivial][ILSEQ] +5CFE5CE0 FEE0 [Trivial][ILSEQ] +5CFE5CEF FEEF [Trivial][ILSEQ] +5CFE5CF9 FEF9 [Trivial][ILSEQ] +5CFE5CFA FEFA [Trivial][ILSEQ] +5CFE5CFC FEFC [Trivial][ILSEQ] +5CFE5CFD FEFD [Trivial][ILSEQ] +5CFE5CFE FEFE [Trivial][ILSEQ] +5CFE5CFF FEFF [Trivial][ILSEQ] +5CFF5C00 FF00 [Trivial][ILSEQ] +5CFF5C08 FF08 [Trivial][ILSEQ] +5CFF5C09 FF09 [Trivial][ILSEQ] +5CFF5C0A FF0A [Trivial][ILSEQ] +5CFF5C0D FF0D [Trivial][ILSEQ] +5CFF5C1A FF1A [Trivial][ILSEQ] +5CFF5C22 FF22 [Trivial][ILSEQ] +5CFF5C25 FF5C25 [Regular][ILSEQ] +5CFF5C27 FF27 [Trivial][ILSEQ] +5CFF5C30 FF00 [Regular][ILSEQ] +5CFF5C3F FF3F [Trivial][ILSEQ] +5CFF5C40 FF40 [Trivial][ILSEQ] +5CFF5C5A FF1A [Regular][ILSEQ] +5CFF5C5C FF5C [Regular][ILSEQ] +5CFF5C5F FF5C5F [Regular][ILSEQ] +5CFF5C61 FF61 [Trivial][ILSEQ] +5CFF5C62 FF08 [Regular][ILSEQ] +5CFF5C6E FF0A [Regular][ILSEQ] +5CFF5C72 FF0D [Regular][ILSEQ] +5CFF5C74 FF09 [Regular][ILSEQ] +5CFF5C7E FF7E [Trivial][ILSEQ] +5CFF5C7F FF7F [Trivial][ILSEQ] +5CFF5C80 FF80 [Trivial][ILSEQ] +5CFF5C81 FF81 [Trivial][ILSEQ] +5CFF5C9F FF9F [Trivial][ILSEQ] +5CFF5CA0 FFA0 [Trivial][ILSEQ] +5CFF5CA1 FFA1 [Trivial][ILSEQ] +5CFF5CE0 FFE0 [Trivial][ILSEQ] +5CFF5CEF FFEF [Trivial][ILSEQ] +5CFF5CF9 FFF9 [Trivial][ILSEQ] +5CFF5CFA FFFA [Trivial][ILSEQ] +5CFF5CFC FFFC [Trivial][ILSEQ] +5CFF5CFD FFFD [Trivial][ILSEQ] +5CFF5CFE FFFE [Trivial][ILSEQ] +5CFF5CFF FFFF [Trivial][ILSEQ] +DROP TABLE t1; +DROP PROCEDURE p1; +DROP PROCEDURE p2; +DROP FUNCTION unescape; +DROP FUNCTION unescape_type; +DROP FUNCTION wellformedness; +DROP FUNCTION mysql_real_escape_string_generated; +DROP FUNCTION iswellformed; +DROP TABLE allbytes; +SET sql_mode = DEFAULT; +# End of ctype_backslash.inc +# +# MDEV-12681 Wrong VIEW results for CHAR(0xDF USING latin1) +# +SET NAMES utf8; +SELECT CHAR(0xDF USING latin1); +CHAR(0xDF USING latin1) +ß +CREATE OR REPLACE VIEW v1 AS SELECT CHAR(0xDF USING latin1) AS c; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select char(0xdf using latin1) AS `c` utf8 utf8_general_ci +SELECT * FROM v1; +c +ß +DROP VIEW v1; +SET NAMES utf8; +# +# MDEV-13118 Wrong results with LOWER and UPPER and subquery +# +SET @save_optimizer_switch=@@optimizer_switch; +SET optimizer_switch=_latin1'derived_merge=on'; +CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `t` varchar(10) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI'); +SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub; +c2 +abcdefghi-abcdefghi +abcdefghi-abcdefghi +SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT UPPER(t) t2 FROM t1) sub; +c2 +ABCDEFGHI-ABCDEFGHI +ABCDEFGHI-ABCDEFGHI +DROP TABLE t1; +SET optimizer_switch=@save_optimizer_switch; +# +# End of 10.0 tests +# +# +# Start of 10.1 tests +# +# +# MDEV-6572 "USE dbname" with a bad sequence erroneously connects to a wrong database +# +SET NAMES utf8; +SELECT * FROM `test😁😁test`; +ERROR HY000: Invalid utf8 character string: 'test\xF0\x9F\x98\x81\xF0\x9F\x98\x81test' +# +#MDEV-8256 A part of a ROW comparison is erroneously optimized away +# +SET NAMES utf8; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8); +INSERT INTO t1 VALUES ('1e1'),('1é1'); +SELECT * FROM t1 WHERE a=10; +a +1e1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1é1' +SELECT * FROM t1 WHERE a='1e1'; +a +1e1 +1é1 +SELECT * FROM t1 WHERE a=10 AND a='1e1'; +a +1e1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1é1' +SELECT * FROM t1 WHERE (a,a)=(10,'1e1'); +a +1e1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1é1' +EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a,a)=(10,'1e1'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 10 and `test`.`t1`.`a` = '1e1' +DROP TABLE t1; +# +# MDEV-8688 Wrong result for SELECT..WHERE varchar_column IN (1,2,3) AND varchar_column=' 1'; +# +SET NAMES utf8; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1); +INSERT INTO t1 VALUES ('1e1'),('1ë1'); +SELECT * FROM t1 WHERE a IN (1,2); +a +1ë1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1ë1' +SELECT * FROM t1 WHERE a IN (1,2) AND a='1ë1'; +a +1ë1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1ë1' +SELECT * FROM t1 WHERE a IN (1,2,'x') AND a='1ë1'; +a +1ë1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1ë1' +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2) AND a='1ë1'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '1ë1' and `test`.`t1`.`a` in (1,2) +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,'x') AND a='1ë1'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = '1ë1' and `test`.`t1`.`a` in (1,2,'x') +DROP TABLE IF EXISTS t1; +# +# MDEV-8816 Equal field propagation is not applied for WHERE varbinary_column>=_utf8'a' COLLATE utf8_swedish_ci AND varbinary_column='A'; +# +CREATE TABLE t1 (c VARBINARY(10)); +INSERT INTO t1 VALUES ('a'),('A'); +SELECT * FROM t1 WHERE c>=_utf8'a' COLLATE utf8_general_ci AND c='A'; +c +A +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE c>=_utf8'a' COLLATE utf8_general_ci AND c='A'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`c` AS `c` from `test`.`t1` where `test`.`t1`.`c` = 'A' +DROP TABLE t1; +# +# MDEV-7231 Field ROUTINE_DEFINITION in INFORMATION_SCHEMA.`ROUTINES` contains broken procedure body when used shielding quotes inside. +# +CREATE PROCEDURE p1() +BEGIN +SELECT CONCAT('ABC = ''',1,''''), CONCAT('ABC = ',2); +SELECT '''', """", '\'', "\""; +SELECT '<tab> <tab>\t<tab>'; +SELECT '<nl> +<nl>\n<nl>'; +SELECT 'test'; +SELECT 'tëst'; +SELECT 'test\0'; +SELECT 'tëst\0'; +SELECT _binary'test'; +SELECT _binary'test\0'; +SELECT N'''', N"""", N'\'', N"\""; +SELECT N'<tab> <tab>\t<tab>'; +SELECT N'<nl> +<nl>\n<nl>'; +SELECT N'test'; +SELECT N'tëst'; +SELECT N'test\0'; +SELECT N'tëst\0'; +END$$ +SELECT ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES +WHERE ROUTINE_SCHEMA='test' AND SPECIFIC_NAME ='p1'; +ROUTINE_DEFINITION +BEGIN +SELECT CONCAT('ABC = ''',1,''''), CONCAT('ABC = ',2); +SELECT '''', """", '''', """"; +SELECT '<tab>\t<tab>\t<tab>'; +SELECT '<nl>\n<nl>\n<nl>'; +SELECT 'test'; +SELECT 'tëst'; +SELECT 'test\0'; +SELECT 'tëst\0'; +SELECT 'test'; +SELECT 'test\0'; +SELECT N'''', N"""", N'''', N""""; +SELECT N'<tab>\t<tab>\t<tab>'; +SELECT N'<nl>\n<nl>\n<nl>'; +SELECT N'test'; +SELECT N'tëst'; +SELECT N'test\0'; +SELECT N'tëst\0'; +END +SELECT body_utf8 FROM mysql.proc WHERE name='p1'; +body_utf8 +BEGIN +SELECT CONCAT('ABC = ''',1,''''), CONCAT('ABC = ',2); +SELECT '''', """", '''', """"; +SELECT '<tab>\t<tab>\t<tab>'; +SELECT '<nl>\n<nl>\n<nl>'; +SELECT 'test'; +SELECT 'tëst'; +SELECT 'test\0'; +SELECT 'tëst\0'; +SELECT 'test'; +SELECT 'test\0'; +SELECT N'''', N"""", N'''', N""""; +SELECT N'<tab>\t<tab>\t<tab>'; +SELECT N'<nl>\n<nl>\n<nl>'; +SELECT N'test'; +SELECT N'tëst'; +SELECT N'test\0'; +SELECT N'tëst\0'; +END +DROP PROCEDURE p1; +SET @@SQL_MODE='NO_BACKSLASH_ESCAPES'; +CREATE PROCEDURE p1() +BEGIN +SELECT CONCAT('ABC = ''',1,''''), CONCAT('ABC = ',2); +SELECT '''', """"; +SELECT '<tab> <tab>\t<tab>'; +SELECT '<nl> +<nl>\n<nl>'; +SELECT 'test'; +SELECT 'tëst'; +SELECT 'test\0'; +SELECT 'tëst\0'; +SELECT _binary'test'; +SELECT _binary'test\0'; +SELECT N'''', N""""; +SELECT N'<tab> <tab>\t<tab>'; +SELECT N'<nl> +<nl>\n<nl>'; +SELECT N'test'; +SELECT N'tëst'; +SELECT N'test\0'; +SELECT N'tëst\0'; +END$$ +SELECT ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES +WHERE ROUTINE_SCHEMA='test' AND SPECIFIC_NAME ='p1'; +ROUTINE_DEFINITION +BEGIN +SELECT CONCAT('ABC = ''',1,''''), CONCAT('ABC = ',2); +SELECT '''', """"; +SELECT '<tab> <tab>\t<tab>'; +SELECT '<nl> +<nl>\n<nl>'; +SELECT 'test'; +SELECT 'tëst'; +SELECT 'test\0'; +SELECT 'tëst\0'; +SELECT 'test'; +SELECT 'test\0'; +SELECT N'''', N""""; +SELECT N'<tab> <tab>\t<tab>'; +SELECT N'<nl> +<nl>\n<nl>'; +SELECT N'test'; +SELECT N'tëst'; +SELECT N'test\0'; +SELECT N'tëst\0'; +END +SELECT body_utf8 FROM mysql.proc WHERE name='p1'; +body_utf8 +BEGIN +SELECT CONCAT('ABC = ''',1,''''), CONCAT('ABC = ',2); +SELECT '''', """"; +SELECT '<tab> <tab>\t<tab>'; +SELECT '<nl> +<nl>\n<nl>'; +SELECT 'test'; +SELECT 'tëst'; +SELECT 'test\0'; +SELECT 'tëst\0'; +SELECT 'test'; +SELECT 'test\0'; +SELECT N'''', N""""; +SELECT N'<tab> <tab>\t<tab>'; +SELECT N'<nl> +<nl>\n<nl>'; +SELECT N'test'; +SELECT N'tëst'; +SELECT N'test\0'; +SELECT N'tëst\0'; +END +DROP PROCEDURE p1; +SET @@SQL_MODE=default; +# +# MDEV-10191 non convertible chars convert() resulted in Null instead "?" on Windows +# +SET sql_mode='STRICT_TRANS_TABLES'; +SELECT CONVERT(_utf8 0xC499 USING latin1); +CONVERT(_utf8 0xC499 USING latin1) +? +Warnings: +Warning 1977 Cannot convert 'utf8' character 0xC499 to 'latin1' +SELECT CAST(_utf8 0xC499 AS CHAR CHARACTER SET latin1); +CAST(_utf8 0xC499 AS CHAR CHARACTER SET latin1) +? +Warnings: +Warning 1977 Cannot convert 'utf8' character 0xC499 to 'latin1' +SET sql_mode=default; +SELECT CONVERT(_utf8 0xC499 USING latin1); +CONVERT(_utf8 0xC499 USING latin1) +? +Warnings: +Warning 1977 Cannot convert 'utf8' character 0xC499 to 'latin1' +SELECT CAST(_utf8 0xC499 AS CHAR CHARACTER SET latin1); +CAST(_utf8 0xC499 AS CHAR CHARACTER SET latin1) +? +Warnings: +Warning 1977 Cannot convert 'utf8' character 0xC499 to 'latin1' +# +# MDEV-15005 ASAN: stack-buffer-overflow in my_strnncollsp_simple +# +SET NAMES utf8; +SELECT CONVERT(1, CHAR) IN ('100', 10, '101'); +CONVERT(1, CHAR) IN ('100', 10, '101') +0 +SELECT CONVERT(1, CHAR) IN ('100', 10, '1'); +CONVERT(1, CHAR) IN ('100', 10, '1') +1 +SELECT CONVERT(1, CHAR) IN ('100', '10', '1'); +CONVERT(1, CHAR) IN ('100', '10', '1') +1 +# +# End of 10.1 tests +# +# +# Start of 10.2 tests +# +# +# MDEV-9824 LOAD DATA does not work with multi-byte strings in LINES TERMINATED BY when IGNORE is specified +# +CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET utf8); +LOAD DATA INFILE '../../std_data/loaddata/mdev9824.txt' INTO TABLE t1 CHARACTER SET utf8 LINES TERMINATED BY 'ёё'; +Warnings: +Warning 1638 Non-ASCII separator arguments are not fully supported +SELECT c1 FROM t1; +c1 +a +b +c +DELETE FROM t1; +LOAD DATA INFILE '../../std_data/loaddata/mdev9824.txt' INTO TABLE t1 CHARACTER SET utf8 LINES TERMINATED BY 'ёё' IGNORE 1 LINES; +Warnings: +Warning 1638 Non-ASCII separator arguments are not fully supported +SELECT c1 FROM t1 ORDER BY c1; +c1 +b +c +DROP TABLE t1; +# +# MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis +# +CREATE TABLE t1 (a TEXT CHARACTER SET utf8); +LOAD DATA INFILE '../../std_data/loaddata/mdev9823.utf8mb4.txt' IGNORE INTO TABLE t1 CHARACTER SET utf8 IGNORE 4 LINES; +Warnings: +Warning 1366 Incorrect string value: '\xD0' for column `test`.`t1`.`a` at row 1 +Warning 1366 Incorrect string value: '\xE1\x80' for column `test`.`t1`.`a` at row 3 +Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column `test`.`t1`.`a` at row 5 +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x8E' for column `test`.`t1`.`a` at row 7 +Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column `test`.`t1`.`a` at row 8 +SELECT HEX(a) FROM t1; +HEX(a) +3F +78787831 +3F3F +78787832 +3F3F3F +78787833 +3F3F3F3F +3F3F3F +DROP TABLE t1; +# +# MDEV-9874 LOAD XML INFILE does not handle well broken multi-byte characters +# +CREATE TABLE t1 (a TEXT CHARACTER SET utf8); +LOAD XML INFILE '../../std_data/loaddata/mdev9874.xml' IGNORE INTO TABLE t1 CHARACTER SET utf8 ROWS IDENTIFIED BY '<row>'; +Warnings: +Warning 1366 Incorrect string value: '\xD0' for column `test`.`t1`.`a` at row 1 +SELECT HEX(a) FROM t1; +HEX(a) +613F +DROP TABLE t1; +# +# MDEV-10134 Add full support for DEFAULT +# +SET NAMES latin1; +CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET latin1 DEFAULT CONCAT('ß')); +SET NAMES utf8; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(30) DEFAULT concat('ß') +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (DEFAULT); +SELECT HEX(a),a FROM t1; +HEX(a) a +C39F ß +SET NAMES latin1; +ALTER TABLE t1 ADD b VARCHAR(30) CHARACTER SET latin1 DEFAULT CONCAT('ß'); +SET NAMES utf8; +ALTER TABLE t1 ADD c VARCHAR(30) CHARACTER SET latin1 DEFAULT CONCAT('ß'); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(30) DEFAULT concat('ß'), + `b` varchar(30) DEFAULT concat('ß'), + `c` varchar(30) DEFAULT concat('ß') +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DELETE FROM t1; +INSERT INTO t1 VALUES(); +SELECT * FROM t1; +a b c +ß ß ß +SET NAMES latin1; +DELETE FROM t1; +INSERT INTO t1 VALUES(); +SET NAMES utf8; +SELECT * FROM t1; +a b c +ß ß ß +DROP TABLE t1; +SET NAMES latin1; +CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET utf8 DEFAULT CONCAT('ß')); +SET NAMES utf8; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(30) CHARACTER SET utf8 DEFAULT concat('ß') +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (DEFAULT); +SELECT HEX(a), a FROM t1; +HEX(a) a +C383C5B8 ß +DROP TABLE t1; +SET NAMES utf8; +CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET latin1 DEFAULT CONCAT('ß')); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(30) DEFAULT concat('ß') +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (DEFAULT); +SELECT HEX(a) FROM t1; +HEX(a) +DF +DROP TABLE t1; +SET NAMES utf8; +CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET utf8 DEFAULT CONCAT('ß')); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(30) CHARACTER SET utf8 DEFAULT concat('ß') +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (DEFAULT); +SELECT HEX(a) FROM t1; +HEX(a) +C39F +DROP TABLE t1; +# +# MDEV-9711 NO PAD Collatons +# +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf8_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0041000000000000000000000000000000000000 +0041002000200000000000000000000000000000 +0020004100000000000000000000000000000000 +0020004100200000000000000000000000000000 +0041002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf8_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf8_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_general_nopad_ci'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf8_general_nopad_ci NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_general_nopad_ci +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8_general_nopad_ci'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_general_nopad_ci'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8_general_nopad_ci'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0041000000000000000000000000000000000000 +0041002000200000000000000000000000000000 +0020004100000000000000000000000000000000 +0020004100200000000000000000000000000000 +0041002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf8_general_nopad_ci' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf8_general_nopad_ci' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf8_general_nopad_ci' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf8_general_nopad_ci' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf8_general_nopad_ci', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_general_ci'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_nopad_ci'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8_general_nopad_ci'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_ci'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_general_nopad_ci'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +SET STORAGE_ENGINE=MyISAM; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf8_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0061000000000000000000000000000000000000 +0061002000200000000000000000000000000000 +0020006100000000000000000000000000000000 +0020006100200000000000000000000000000000 +0061002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf8_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf8_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=HEAP; +# +# Start of ctype_pad.inc +# +# +# Unique indexes +# +CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) COLLATE 'utf8_nopad_bin'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) COLLATE utf8_nopad_bin NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_nopad_bin +INSERT INTO t1 VALUES ('abc'),('abc '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM t1 ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a; +HEX(a) a +2061 a +206120 a +61202020 a +616263 abc +6162632020 abc +SELECT HEX(a), a FROM t1 IGNORE INDEX(PRIMARY) ORDER BY a DESC; +HEX(a) a +6162632020 abc +616263 abc +61202020 a +206120 a +2061 a +# +# UNION +# +CREATE TABLE t2 (a VARCHAR(10)) COLLATE 'utf8_nopad_bin'; +INSERT INTO t2 VALUES ('abc '),('abc '),(' a'),('a '); +SELECT HEX(a),a FROM (SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +6120 a +61202020 a +616263 abc +61626320 abc +6162632020 abc +DROP TABLE t1; +DROP TABLE t2; +# +# DISTINCT, COUNT, MAX +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_nopad_bin'; +INSERT INTO t1 VALUES ('a'),('a '),(' a'),(' a '),('a '); +SELECT HEX(a), a FROM (SELECT DISTINCT a FROM t1 ORDER BY a) td; +HEX(a) a +2061 a +206120 a +61 a +612020 a +61202020 a +SELECT COUNT(DISTINCT a) FROM t1 ORDER BY a; +COUNT(DISTINCT a) +5 +SELECT HEX(MAX(a)), MAX(a) FROM t1; +HEX(MAX(a)) MAX(a) +61202020 a +# +# GROUP BY +# +CREATE TABLE t2 (a VARCHAR(10), b int, c varchar(10)) COLLATE 'utf8_nopad_bin'; +INSERT t2 values('ab', 12, 'cd'), ('ab', 2, 'ed'), ('aa', 20, 'er'), ('aa ', 0, 'er '); +SELECT HEX(a), cnt FROM (SELECT a, COUNT(a) AS cnt FROM t2 GROUP BY a ORDER BY a) AS td; +HEX(a) cnt +6161 1 +61612020 1 +6162 2 +DROP TABLE t2; +# +# Weights +# +SELECT HEX(WEIGHT_STRING(a AS CHAR(10))) FROM t1; +HEX(WEIGHT_STRING(a AS CHAR(10))) +0061000000000000000000000000000000000000 +0061002000200000000000000000000000000000 +0020006100000000000000000000000000000000 +0020006100200000000000000000000000000000 +0061002000200020000000000000000000000000 +DROP TABLE t1; +# +# IF, CASE, LEAST +# +SELECT IF('abc' COLLATE 'utf8_nopad_bin' = 'abc ', 'pad', 'nopad'); +IF('abc' COLLATE 'utf8_nopad_bin' = 'abc ', 'pad', 'nopad') +nopad +SELECT CASE 'abc' COLLATE 'utf8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE 'abc' COLLATE 'utf8_nopad_bin' WHEN 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT CASE WHEN 'abc' COLLATE 'utf8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END; +CASE WHEN 'abc' COLLATE 'utf8_nopad_bin' = 'abc ' THEN 'pad' ELSE 'nopad' END +nopad +SELECT HEX(LEAST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')); +HEX(LEAST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')) +61626320 +SELECT HEX(GREATEST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')); +HEX(GREATEST('abc ' COLLATE 'utf8_nopad_bin', 'abc ')) +6162632020 +# +# Collation mix +# +CREATE TABLE t1 (a VARCHAR(10)) COLLATE 'utf8_bin'; +INSERT INTO t1 VALUES ('a'),('a '); +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_nopad_bin'; +COUNT(*) +1 +ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE 'utf8_nopad_bin'; +SELECT COUNT(*) FROM t1 WHERE a='a'; +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_bin'; +COUNT(*) +2 +SELECT COUNT(*) FROM t1 WHERE a='a' COLLATE 'utf8_nopad_bin'; +COUNT(*) +1 +DROP TABLE t1; +# +# End of ctype_pad.inc +# +SET STORAGE_ENGINE=Default; +# +# End of 10.2 tests +# +# +# Start of 10.3 tests +# +# +# MDEV-11155 Bad error message when creating a SET column with comma and non-ASCII characters +# +SET NAMES utf8; +CREATE TABLE t1 (a SET('a,bü')); +ERROR 22007: Illegal set 'a,bü' value found during parsing +# +# MDEV-12607 Hybrid functions create wrong VARBINARY length when mixing character and binary data +# +SET sql_mode=''; +SET NAMES utf8; +CREATE OR REPLACE TABLE t1 AS SELECT COALESCE('ßa',_binary 'a'); +SELECT * FROM t1; +COALESCE('ßa',_binary 'a') +ßa +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `COALESCE('ßa',_binary 'a')` varbinary(6) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +SET sql_mode=DEFAULT; +# +# MDEV-19239 ERROR 1300 (HY000): Invalid utf8 character string in 10.3.13-MariaDB +# +SET NAMES utf8; +SELECT +x.消息ID, +x.消息TITLE, +x.消息类型, +x.发送时间, +x.阅读时间,x.老师ID, +IF(x.四天内最近一次登录时间='2100-01-01 00:00:00','',x.四天内最近一次登录时间) 四天内最近一次登录时间 +FROM ( +SELECT +msg.*, +CASE +WHEN login.login_time BETWEEN msg.发送时间 AND DATE_ADD(msg.发送时间,INTERVAL 4 DAY) +THEN login.login_time +WHEN (login.login_time NOT BETWEEN msg.发送时间 AND DATE_ADD(msg.发送时间,INTERVAL 4 DAY)) AND login.login_time>0 +THEN '2100-01-01 00:00:00' ELSE '' + END 四天内最近一次登录时间 +FROM ( +SELECT +me.id 消息ID, +me.title 消息TITLE, +CASE +WHEN me.type=1 +THEN 'Interview Message' + WHEN me.type=2 +THEN 'Orientation Message' + WHEN me.type=3 +THEN 'Warning Message' + WHEN me.type=4 +THEN 'Fail Message' + WHEN me.type=5 +THEN 'FM Message' + WHEN me.type=6 +THEN 'Training Message' + WHEN me.type=7 +THEN 'TUrgent Message' + END 消息类型, +FROM_UNIXTIME(me.sending_time) 发送时间, +IF(tar.is_read=1,FROM_UNIXTIME(tar.read_time),'') 阅读时间, +tar.tid 老师ID +FROM ebk_message me +LEFT JOIN ebk_message_target tar +ON me.id=tar.msg_id +WHERE +FROM_UNIXTIME(me.sending_time,'%Y-%m-%d') BETWEEN 'start' AND 'end' AND me.status=1 AND tar.tid>0 +GROUP BY +tar.tid, +me.sending_time,me.id) msg +LEFT JOIN ( +SELECT tid,FROM_UNIXTIME(login_time) login_time +FROM ebk_teacher_login_log +WHERE FROM_UNIXTIME(login_time,'%Y-%m-%d') BETWEEN 'start' AND DATE_ADD('end',INTERVAL 4 DAY) +ORDER BY tid,FROM_UNIXTIME(login_time)) login +ON +msg.老师ID=login.tid +ORDER BY msg.消息ID,msg.发送时间,msg.老师ID,login_time) x +GROUP BY x.消息ID,x.发送时间,x.老师ID; +ERROR 42S02: Table 'test.ebk_message' doesn't exist +SET NAMES utf8; +CREATE TABLE t1 (x INT); +INSERT INTO t1 VALUES (1); +SELECT x AS 5天内最近一次登录时间 FROM t1; +5天内最近一次登录时间 +1 +DROP TABLE t1; +# +# End of 10.3 tests +# diff --cc mysql-test/main/ctype_utf8mb4_innodb.result index 82f0ddff1c4,00000000000..baa22f0ffc4 mode 100644,000000..100644 --- a/mysql-test/main/ctype_utf8mb4_innodb.result +++ b/mysql-test/main/ctype_utf8mb4_innodb.result @@@ -1,2710 -1,0 +1,2722 @@@ +drop table if exists t1,t2; +# +# Start of 5.5 tests +# +set names utf8mb4; +select left(_utf8mb4 0xD0B0D0B1D0B2,1); +left(_utf8mb4 0xD0B0D0B1D0B2,1) +а +select right(_utf8mb4 0xD0B0D0B2D0B2,1); +right(_utf8mb4 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 utf8mb4_bin); +locate('HE','hello' collate utf8mb4_bin) +0 +select locate('HE','hello' collate utf8mb4_bin,2); +locate('HE','hello' collate utf8mb4_bin,2) +0 +select locate('LO','hello' collate utf8mb4_bin,2); +locate('LO','hello' collate utf8mb4_bin,2) +0 +select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D0B1D0B2); +locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D0B1D0B2) +2 +select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2); +locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2) +2 +select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2); +locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2) +2 +select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2 collate utf8mb4_bin); +locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2 collate utf8mb4_bin) +0 +select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2 collate utf8mb4_bin); +locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2 collate utf8mb4_bin) +0 +select length(_utf8mb4 0xD0B1), bit_length(_utf8mb4 0xD0B1), char_length(_utf8mb4 0xD0B1); +length(_utf8mb4 0xD0B1) bit_length(_utf8mb4 0xD0B1) char_length(_utf8mb4 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 utf8mb4_bin; +'A' like 'a' collate utf8mb4_bin +0 +select _utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4 '%'); +_utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4 '%') +1 +select convert(_latin1'G�nter Andr�' using utf8mb4) like CONVERT(_latin1'G�NTER%' USING utf8mb4); +convert(_latin1'G?nter Andr?' using utf8mb4) like CONVERT(_latin1'G?NTER%' USING utf8mb4) +1 +select CONVERT(_koi8r'����' USING utf8mb4) LIKE CONVERT(_koi8r'����' USING utf8mb4); +CONVERT(_koi8r'????' USING utf8mb4) LIKE CONVERT(_koi8r'????' USING utf8mb4) +1 +select CONVERT(_koi8r'����' USING utf8mb4) LIKE CONVERT(_koi8r'����' USING utf8mb4); +CONVERT(_koi8r'????' USING utf8mb4) LIKE CONVERT(_koi8r'????' USING utf8mb4) +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 utf8mb4_bin; +'a' = 'a ' collate utf8mb4_bin +1 +SELECT 'a\0' < 'a' collate utf8mb4_bin; +'a\0' < 'a' collate utf8mb4_bin +1 +SELECT 'a\0' < 'a ' collate utf8mb4_bin; +'a\0' < 'a ' collate utf8mb4_bin +1 +SELECT 'a\t' < 'a' collate utf8mb4_bin; +'a\t' < 'a' collate utf8mb4_bin +1 +SELECT 'a\t' < 'a ' collate utf8mb4_bin; +'a\t' < 'a ' collate utf8mb4_bin +1 +CREATE TABLE t1 (a char(10) character set utf8mb4 not null) ENGINE InnoDB; +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 +61 0 0 +6100 -1 -1 +6109 -1 -1 +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 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 ENGINE InnoDB 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")` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL +) ENGINE=InnoDB 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 utf8mb4; +set LC_TIME_NAMES='fr_FR'; +create table t1 (s1 char(20) character set latin1) engine InnoDB; +insert into t1 values (date_format('2004-02-02','%M')); +select hex(s1) from t1; +hex(s1) +66E97672696572 +drop table t1; +create table t1 (s1 char(20) character set koi8r) engine InnoDB; +set LC_TIME_NAMES='ru_RU'; +insert into t1 values (date_format('2004-02-02','%M')); +insert into t1 values (date_format('2004-02-02','%b')); +insert into t1 values (date_format('2004-02-02','%W')); +insert into t1 values (date_format('2004-02-02','%a')); +select hex(s1), s1 from t1; +hex(s1) s1 +E6C5D7 Фев +E6C5D7D2C1CCD1 Февраля +F0CEC4 Пнд +F0CFCEC5C4C5CCD8CEC9CB Понедельник +drop table t1; +set LC_TIME_NAMES='en_US'; +set names koi8r; +create table t1 (s1 char(1) character set utf8mb4) engine InnoDB; +insert ignore 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 utf8mb4) engine InnoDB; +insert ignore into t1 select repeat('a',300); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +insert ignore into t1 select repeat('�',300); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +insert ignore into t1 select repeat('a�',300); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +insert ignore into t1 select repeat('�a',300); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +insert ignore into t1 select repeat('��',300); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +select hex(s1) from t1; +hex(s1) +616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161 +61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F +D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61 +D18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18F +D18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18F +select length(s1),char_length(s1) from t1; +length(s1) char_length(s1) +254 127 +254 127 +255 170 +255 170 +255 255 +drop table t1; +create table t1 (s1 text character set utf8mb4) engine InnoDB; +insert ignore into t1 select repeat('a',66000); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +insert ignore into t1 select repeat('�',66000); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +insert ignore into t1 select repeat('a�',66000); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +insert ignore into t1 select repeat('�a',66000); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +insert ignore 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) +65534 32767 +65534 32767 +65535 43690 +65535 43690 +65535 65535 +drop table t1; +create table t1 (s1 char(10) character set utf8mb4) engine InnoDB; +insert ignore into t1 values (0x41FF); +Warnings: +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1 +select hex(s1) from t1; +hex(s1) +413F +drop table t1; +create table t1 (s1 varchar(10) character set utf8mb4) engine InnoDB; +insert ignore into t1 values (0x41FF); +Warnings: +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1 +select hex(s1) from t1; +hex(s1) +413F +drop table t1; +create table t1 (s1 text character set utf8mb4) engine InnoDB; +insert ignore into t1 values (0x41FF); +Warnings: +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1 +select hex(s1) from t1; +hex(s1) +413F +drop table t1; +create table t1 (a text character set utf8mb4, primary key(a(371))) engine InnoDB; +show warnings; +Level Code Message +drop table if exists t1; +CREATE TABLE t1 ( a varchar(10) ) CHARACTER SET utf8mb4 ENGINE InnoDB; +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 utf8mb4) engine InnoDB; +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 utf8mb4; +drop table if exists t1; +create table t1 as +select repeat(' ', 64) as s1, repeat(' ',64) as s2 +union +select null, null; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `s1` varchar(64) CHARACTER SET utf8mb4 DEFAULT NULL, + `s2` varchar(64) CHARACTER SET utf8mb4 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +delete from t1; +insert into t1 values('aaa','aaa'); +insert into t1 values('aaa|qqq','qqq'); +insert into t1 values('gheis','^[^a-dXYZ]+$'); +insert into t1 values('aab','^aa?b'); +insert into t1 values('Baaan','^Ba*n'); +insert into t1 values('aaa','qqq|aaa'); +insert into t1 values('qqq','qqq|aaa'); +insert into t1 values('bbb','qqq|aaa'); +insert into t1 values('bbb','qqq'); +insert into t1 values('aaa','aba'); +insert into t1 values(null,'abc'); +insert into t1 values('def',null); +insert into t1 values(null,null); +insert into t1 values('ghi','ghi['); +select HIGH_PRIORITY s1 regexp s2 from t1; +s1 regexp s2 +0 +0 +0 +1 +1 +1 +1 +1 +1 +1 +NULL +NULL +NULL +NULL +drop table t1; +SELECT @@character_set_client, @@collation_connection; +@@character_set_client @@collation_connection +utf8mb4 utf8mb4_general_ci +select 'вася' rlike '\\bвася\\b'; +'вася' rlike '\\bвася\\b' +1 +select 'вася ' rlike '\\bвася\\b'; +'вася ' rlike '\\bвася\\b' +1 +select ' вася' rlike '\\bвася\\b'; +' вася' rlike '\\bвася\\b' +1 +select ' вася ' rlike '\\bвася\\b'; +' вася ' rlike '\\bвася\\b' +1 +select 'вася' rlike '[[:<:]]вася[[:>:]]'; +'вася' rlike '[[:<:]]вася[[:>:]]' +1 +select 'вася ' rlike '[[:<:]]вася[[:>:]]'; +'вася ' rlike '[[:<:]]вася[[:>:]]' +1 +select ' вася' rlike '[[:<:]]вася[[:>:]]'; +' вася' rlike '[[:<:]]вася[[:>:]]' +1 +select ' вася ' rlike '[[:<:]]вася[[:>:]]'; +' вася ' rlike '[[:<:]]вася[[:>:]]' +1 +select 'васяz' rlike '\\bвася\\b'; +'васяz' rlike '\\bвася\\b' +0 +select 'zвася' rlike '\\bвася\\b'; +'zвася' rlike '\\bвася\\b' +0 +select 'zвасяz' rlike '\\bвася\\b'; +'zвасяz' rlike '\\bвася\\b' +0 +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 utf8mb4_unicode_ci) ENGINE InnoDB; +ALTER TABLE t1 ADD COLUMN b CHAR(20); +DROP TABLE t1; +set names utf8mb4; +create table t1 (a enum('aaaa','проба') character set utf8mb4) engine InnoDB; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` enum('aaaa','проба') CHARACTER SET utf8mb4 DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('проба'); +select * from t1; +a +проба +create table t2 engine InnoDB select ifnull(a,a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ifnull(a,a)` varchar(5) CHARACTER SET utf8mb4 DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +select * from t2; +ifnull(a,a) +проба +drop table t1; +drop table t2; +create table t1 (c varchar(30) character set utf8mb4, 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 'aaaaaaaaaa' for key 'c' +insert into t1 values ('aaaaaaaaaaaa'); +ERROR 23000: Duplicate entry 'aaaaaaaaaa' for key 'c' +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 utf8mb4, 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 'aaaaaaaaaa' for key 'c' +insert into t1 values ('aaaaaaaaaaaa'); +ERROR 23000: Duplicate entry 'aaaaaaaaaa' for key 'c' +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 utf8mb4, 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 'aa' for key 'c' +insert into t1 values ('b'); +insert into t1 values ('bb'); +insert into t1 values ('bbb'); +ERROR 23000: Duplicate entry 'bb' for key 'c' +insert into t1 values ('а'); +insert into t1 values ('аа'); +insert into t1 values ('ааа'); +ERROR 23000: Duplicate entry 'аа' for key 'c' +insert into t1 values ('б'); +insert into t1 values ('бб'); +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'бб' for key 'c' +insert into t1 values ('ꪪ'); +insert into t1 values ('ꪪꪪ'); +insert into t1 values ('ꪪꪪꪪ'); +ERROR 23000: Duplicate entry 'ꪪꪪ' for key 'c' +drop table t1; +create table t1 (c char(3) character set utf8mb4, 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 'aa' for key 'c' +insert into t1 values ('b'); +insert into t1 values ('bb'); +insert into t1 values ('bbb'); +ERROR 23000: Duplicate entry 'bb' for key 'c' +insert into t1 values ('а'); +insert into t1 values ('аа'); +insert into t1 values ('ааа'); +ERROR 23000: Duplicate entry 'аа' for key 'c' +insert into t1 values ('б'); +insert into t1 values ('бб'); +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'бб' for key 'c' +insert into t1 values ('ꪪ'); +insert into t1 values ('ꪪꪪ'); +insert into t1 values ('ꪪꪪꪪ'); +ERROR 23000: Duplicate entry 'ꪪꪪ' for key 'c' +drop table t1; +create table t1 ( +c char(10) character set utf8mb4, +unique key a using hash (c(1)) +) engine=InnoDB; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(10) CHARACTER SET utf8mb4 DEFAULT NULL, + UNIQUE KEY `a` (`c`(1)) USING HASH +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +insert into t1 values ('aa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('aaa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('б'); +insert into t1 values ('бб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +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 utf8mb4, +unique key a using btree (c(1)) +) engine=InnoDB; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(10) CHARACTER SET utf8mb4 DEFAULT NULL, + UNIQUE KEY `a` (`c`(1)) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +insert into t1 values ('aa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('aaa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('б'); +insert into t1 values ('бб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +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 utf8mb4, +unique key a (c(1)) +) engine=InnoDB; +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +insert into t1 values ('aa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('aaa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('б'); +insert into t1 values ('бб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +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 utf8mb4 collate utf8mb4_bin, 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 'aaaaaaaaaa' for key 'c' +insert into t1 values ('aaaaaaaaaaaa'); +ERROR 23000: Duplicate entry 'aaaaaaaaaa' for key 'c' +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 utf8mb4 collate utf8mb4_bin, 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 'aa' for key 'c' +insert into t1 values ('b'); +insert into t1 values ('bb'); +insert into t1 values ('bbb'); +ERROR 23000: Duplicate entry 'bb' for key 'c' +insert into t1 values ('а'); +insert into t1 values ('аа'); +insert into t1 values ('ааа'); +ERROR 23000: Duplicate entry 'аа' for key 'c' +insert into t1 values ('б'); +insert into t1 values ('бб'); +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'бб' for key 'c' +insert into t1 values ('ꪪ'); +insert into t1 values ('ꪪꪪ'); +insert into t1 values ('ꪪꪪꪪ'); +ERROR 23000: Duplicate entry 'ꪪꪪ' for key 'c' +drop table t1; +create table t1 ( +c char(10) character set utf8mb4 collate utf8mb4_bin, +unique key a using hash (c(1)) +) engine=InnoDB; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, + UNIQUE KEY `a` (`c`(1)) USING HASH +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +insert into t1 values ('aa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('aaa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('б'); +insert into t1 values ('бб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +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 utf8mb4 collate utf8mb4_bin, +unique key a using btree (c(1)) +) engine=InnoDB; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, + UNIQUE KEY `a` (`c`(1)) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +insert into t1 values ('aa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('aaa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('б'); +insert into t1 values ('бб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +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 utf8mb4 collate utf8mb4_bin, +unique key a (c(1)) +) engine=InnoDB; +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +insert into t1 values ('aa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('aaa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('б'); +insert into t1 values ('бб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +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 utf8mb4 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 utf8mb4 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 utf8mb4 not null, +key str using btree (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 utf8mb4 not null, +key str using hash (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 utf8mb4 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 (a varchar(32) BINARY) CHARACTER SET utf8mb4 ENGINE InnoDB; +INSERT INTO t1 VALUES ('test'); +SELECT a FROM t1 WHERE a LIKE '%te'; +a +DROP TABLE t1; +SET NAMES utf8mb4; +CREATE TABLE t1 ( +subject varchar(255) character set utf8mb4 collate utf8mb4_unicode_ci, +p varchar(15) character set utf8mb4 +) ENGINE= InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES ('谷川俊二と申しますが、インターネット予約の会員登録をしましたところ、メールアドレスを間違えてしまい会員IDが受け取ることが出来ませんでした。間違えアドレスはtani-shun@n.vodafone.ne.jpを書き込みました。どうすればよいですか? その他、住所等は間違えありません。連絡ください。よろしくお願いします。m(__)m','040312-000057'); +INSERT INTO t1 VALUES ('aaa','bbb'); +SELECT length(subject) FROM t1; +length(subject) +3 +432 +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=InnoDB CHARSET=utf8mb4; +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=InnoDB CHARSET=utf8mb4; +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 utf8mb4; +create table t1 ( +a int primary key, +b varchar(6), +index b3(b(3)) +) engine=InnoDB character set=utf8mb4; +insert into t1 values(1,'foo'),(2,'foobar'); +select * from t1 where b like 'foob%'; +a b +2 foobar +alter table t1 engine=innodb; +select * from t1 where b like 'foob%'; +a b +2 foobar +drop table t1; +create table t1 ( +a enum('петя','вася','анюта') character set utf8mb4 not null default 'анюта', +b set('петя','вася','анюта') character set utf8mb4 not null default 'анюта' +) engine InnoDB; +create table t2 engine InnoDB select concat(a,_utf8mb4'') as a, concat(b,_utf8mb4'')as b from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` varchar(5) CHARACTER SET utf8mb4 DEFAULT NULL, + `b` varchar(15) CHARACTER SET utf8mb4 DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t2; +drop table t1; +select 'c' like '\_' as want0; +want0 +0 +SELECT SUBSTR('вася',-2); +SUBSTR('вася',-2) +ся +create table t1 (id integer, a varchar(100) character set utf8mb4 collate utf8mb4_unicode_ci) engine InnoDB; +insert into t1 values (1, 'Test'); +select * from t1 where soundex(a) = soundex('Test'); +id a +1 Test +select * from t1 where soundex(a) = soundex('TEST'); +id a +1 Test +select * from t1 where soundex(a) = soundex('test'); +id a +1 Test +drop table t1; +select soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB); +soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB) +阅000 +select hex(soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)); +hex(soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)) +E99885303030 +select soundex(_utf8mb4 0xD091D092D093); +soundex(_utf8mb4 0xD091D092D093) +Б000 +select hex(soundex(_utf8mb4 0xD091D092D093)); +hex(soundex(_utf8mb4 0xD091D092D093)) +D091303030 +SET collation_connection='utf8mb4_general_ci'; +create table t1 select repeat('a',4000) a; +delete from t1; +insert into t1 values ('a'), ('a '), ('a\t'); +select collation(a),hex(a) from t1 order by a; +collation(a) hex(a) +utf8mb4_general_ci 6109 +utf8mb4_general_ci 61 +utf8mb4_general_ci 6120 +drop table t1; +# +# MDEV-5453 Assertion `src' fails in my_strnxfrm_unicode on GROUP BY MID(..) WITH ROLLUP +# +SELECT @@collation_connection; +@@collation_connection +utf8mb4_general_ci +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +SELECT * FROM t1 GROUP BY MID(CURRENT_USER,0) WITH ROLLUP; +i +1 +1 +SELECT * FROM t1 GROUP BY MID('test',0) WITH ROLLUP; +i +1 +1 +DROP TABLE t1; +# +# MDEV-6170 Incorrect ordering with utf8_bin and utf8mb4_bin collations +# +SELECT @@collation_connection; +@@collation_connection +utf8mb4_general_ci +CREATE TABLE t1 ENGINE=MEMORY AS SELECT REPEAT('a',5) AS a LIMIT 0; +INSERT INTO t1 (a) VALUES ("a"); +INSERT INTO t1 (a) VALUES ("b"); +INSERT INTO t1 (a) VALUES ("c"); +INSERT INTO t1 (a) VALUES ("d"); +INSERT INTO t1 (a) VALUES ("e"); +INSERT INTO t1 (a) VALUES ("f"); +INSERT INTO t1 (a) VALUES ("g"); +INSERT INTO t1 (a) VALUES ("h"); +INSERT INTO t1 (a) VALUES ("i"); +INSERT INTO t1 (a) VALUES ("j"); +INSERT INTO t1 (a) VALUES ("k"); +INSERT INTO t1 (a) VALUES ("l"); +INSERT INTO t1 (a) VALUES ("m"); +SELECT * FROM t1 ORDER BY LOWER(a); +a +a +b +c +d +e +f +g +h +i +j +k +l +m +SELECT * FROM t1 ORDER BY LOWER(a) DESC; +a +m +l +k +j +i +h +g +f +e +d +c +b +a +DROP TABLE t1; +select @@collation_connection; +@@collation_connection +utf8mb4_general_ci +create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ; +insert into t1 values('abcdef'); +insert into t1 values('_bcdef'); +insert into t1 values('a_cdef'); +insert into t1 values('ab_def'); +insert into t1 values('abc_ef'); +insert into t1 values('abcd_f'); +insert into t1 values('abcde_'); +select c1 as c1u from t1 where c1 like 'ab\_def'; +c1u +ab_def +select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; +c2h +ab_def +drop table t1; ++SELECT @@collation_connection; ++@@collation_connection ++utf8mb4_general_ci ++SELECT '\%b' LIKE '%\%'; ++'\%b' LIKE '%\%' ++0 +"BEGIN ctype_german.inc" +drop table if exists t1; +create table t1 as select repeat(' ', 64) as s1; +select collation(s1) from t1; +collation(s1) +utf8mb4_general_ci +delete from t1; +INSERT INTO t1 VALUES ('ud'),('uf'); +INSERT INTO t1 VALUES ('od'),('of'); +INSERT INTO t1 VALUES ('e'); +INSERT INTO t1 VALUES ('ad'),('af'); +insert into t1 values ('a'),('ae'),(_latin1 0xE4); +insert into t1 values ('o'),('oe'),(_latin1 0xF6); +insert into t1 values ('s'),('ss'),(_latin1 0xDF); +insert into t1 values ('u'),('ue'),(_latin1 0xFC); +INSERT INTO t1 VALUES (_latin1 0xE6), (_latin1 0xC6); +INSERT INTO t1 VALUES (_latin1 0x9C), (_latin1 0x8C); +select s1, hex(s1) from t1 order by s1, binary s1; +s1 hex(s1) +a 61 +ä C3A4 +ad 6164 +ae 6165 +af 6166 +e 65 +o 6F +ö C3B6 +od 6F64 +oe 6F65 +of 6F66 +s 73 +ß C39F +ss 7373 +u 75 +ü C3BC +ud 7564 +ue 7565 +uf 7566 +Æ C386 +æ C3A6 +Œ C592 +œ C593 +select group_concat(s1 order by binary s1) from t1 group by s1; +group_concat(s1 order by binary s1) +a,ä +ad +ae +af +e +o,ö +od +oe +of +s,ß +ss +u,ü +ud +ue +uf +Æ,æ +Œ,œ +SELECT s1, hex(s1), hex(weight_string(s1)) FROM t1 ORDER BY s1, BINARY(s1); +s1 hex(s1) hex(weight_string(s1)) +a 61 0041 +ä C3A4 0041 +ad 6164 00410044 +ae 6165 00410045 +af 6166 00410046 +e 65 0045 +o 6F 004F +ö C3B6 004F +od 6F64 004F0044 +oe 6F65 004F0045 +of 6F66 004F0046 +s 73 0053 +ß C39F 0053 +ss 7373 00530053 +u 75 0055 +ü C3BC 0055 +ud 7564 00550044 +ue 7565 00550045 +uf 7566 00550046 +Æ C386 00C6 +æ C3A6 00C6 +Œ C592 0152 +œ C593 0152 +SELECT s1, hex(s1) FROM t1 WHERE s1='ae' ORDER BY s1, BINARY(s1); +s1 hex(s1) +ae 6165 +drop table t1; +CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1) CHARACTER SET utf8mb4 DEFAULT NULL, + `b` int(1) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); +SELECT * FROM t1 ORDER BY a, b; +a b +s 0 +ß 1 +SELECT * FROM t1 ORDER BY a DESC, b; +a b +s 0 +ß 1 +SELECT * FROM t1 ORDER BY CONCAT(a), b; +a b +s 0 +ß 1 +SELECT * FROM t1 ORDER BY CONCAT(a) DESC, b; +a b +s 0 +ß 1 +DROP TABLE t1; +"END ctype_german.inc" +SET collation_connection='utf8mb4_bin'; +create table t1 select repeat('a',4000) a; +delete from t1; +insert into t1 values ('a'), ('a '), ('a\t'); +select collation(a),hex(a) from t1 order by a; +collation(a) hex(a) +utf8mb4_bin 6109 +utf8mb4_bin 61 +utf8mb4_bin 6120 +drop table t1; +# +# MDEV-5453 Assertion `src' fails in my_strnxfrm_unicode on GROUP BY MID(..) WITH ROLLUP +# +SELECT @@collation_connection; +@@collation_connection +utf8mb4_bin +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +SELECT * FROM t1 GROUP BY MID(CURRENT_USER,0) WITH ROLLUP; +i +1 +1 +SELECT * FROM t1 GROUP BY MID('test',0) WITH ROLLUP; +i +1 +1 +DROP TABLE t1; +# +# MDEV-6170 Incorrect ordering with utf8_bin and utf8mb4_bin collations +# +SELECT @@collation_connection; +@@collation_connection +utf8mb4_bin +CREATE TABLE t1 ENGINE=MEMORY AS SELECT REPEAT('a',5) AS a LIMIT 0; +INSERT INTO t1 (a) VALUES ("a"); +INSERT INTO t1 (a) VALUES ("b"); +INSERT INTO t1 (a) VALUES ("c"); +INSERT INTO t1 (a) VALUES ("d"); +INSERT INTO t1 (a) VALUES ("e"); +INSERT INTO t1 (a) VALUES ("f"); +INSERT INTO t1 (a) VALUES ("g"); +INSERT INTO t1 (a) VALUES ("h"); +INSERT INTO t1 (a) VALUES ("i"); +INSERT INTO t1 (a) VALUES ("j"); +INSERT INTO t1 (a) VALUES ("k"); +INSERT INTO t1 (a) VALUES ("l"); +INSERT INTO t1 (a) VALUES ("m"); +SELECT * FROM t1 ORDER BY LOWER(a); +a +a +b +c +d +e +f +g +h +i +j +k +l +m +SELECT * FROM t1 ORDER BY LOWER(a) DESC; +a +m +l +k +j +i +h +g +f +e +d +c +b +a +DROP TABLE t1; +select @@collation_connection; +@@collation_connection +utf8mb4_bin +create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ; +insert into t1 values('abcdef'); +insert into t1 values('_bcdef'); +insert into t1 values('a_cdef'); +insert into t1 values('ab_def'); +insert into t1 values('abc_ef'); +insert into t1 values('abcd_f'); +insert into t1 values('abcde_'); +select c1 as c1u from t1 where c1 like 'ab\_def'; +c1u +ab_def +select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; +c2h +ab_def +drop table t1; ++SELECT @@collation_connection; ++@@collation_connection ++utf8mb4_bin ++SELECT '\%b' LIKE '%\%'; ++'\%b' LIKE '%\%' ++0 +CREATE TABLE t1 ( +user varchar(255) NOT NULL default '' +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES ('one'),('two'); +SELECT CHARSET('a'); +CHARSET('a') +utf8mb4 +SELECT user, CONCAT('<', user, '>') AS c FROM t1; +user c +one <one> +two <two> +DROP TABLE t1; +create table t1 (f1 varchar(1) not null) default charset utf8mb4 engine InnoDB; +insert into t1 values (''), (''); +select concat(concat(_latin1'->',f1),_latin1'<-') from t1; +concat(concat(_latin1'->',f1),_latin1'<-') +-><- +-><- +drop table t1; +select convert(_koi8r'�' using utf8mb4) < convert(_koi8r'�' using utf8mb4); +convert(_koi8r'?' using utf8mb4) < convert(_koi8r'?' using utf8mb4) +1 +set names latin1; +create table t1 (a varchar(10)) character set utf8mb4 engine InnoDB; +insert into t1 values ('test'); +select ifnull(a,'') from t1; +ifnull(a,'') +test +drop table t1; +select repeat(_utf8mb4'+',3) as h union select NULL; +h ++++ +NULL +select ifnull(NULL, _utf8mb4'string'); +ifnull(NULL, _utf8mb4'string') +string +set names utf8mb4; +create table t1 (s1 char(5) character set utf8mb4 collate utf8mb4_lithuanian_ci) engine InnoDB; +insert into t1 values ('I'),('K'),('Y'); +select * from t1 where s1 < 'K' and s1 = 'Y'; +s1 +I +Y +select * from t1 where 'K' > s1 and s1 = 'Y'; +s1 +I +Y +drop table t1; +create table t1 (s1 char(5) character set utf8mb4 collate utf8mb4_czech_ci) engine InnoDB; +insert into t1 values ('c'),('d'),('h'),('ch'),('CH'),('cH'),('Ch'),('i'); +select * from t1 where s1 > 'd' and s1 = 'CH'; +s1 +CH +Ch +ch +select * from t1 where 'd' < s1 and s1 = 'CH'; +s1 +CH +Ch +ch +select * from t1 where s1 = 'cH' and s1 <> 'ch'; +s1 +cH +select * from t1 where 'cH' = s1 and s1 <> 'ch'; +s1 +cH +drop table t1; +create table t1 (a varchar(255)) default character set utf8mb4 engine InnoDB; +insert into t1 values (1.0); +drop table t1; +create table t1 ( +id int not null, +city varchar(20) not null, +key (city(7),id) +) character set=utf8mb4 engine InnoDB; +insert into t1 values (1,'Durban North'); +insert into t1 values (2,'Durban'); +select * from t1 where city = 'Durban'; +id city +2 Durban +select * from t1 where city = 'Durban '; +id city +2 Durban +drop table t1; +create table t1 (x set('A', 'B') default 0) character set utf8mb4 engine InnoDB; +ERROR 42000: Invalid default value for 'x' +create table t1 (x enum('A', 'B') default 0) character set utf8mb4 engine InnoDB; +ERROR 42000: Invalid default value for 'x' +SET NAMES UTF8; +CREATE TABLE t1 ( +`id` int(20) NOT NULL auto_increment, +`country` varchar(100) NOT NULL default '', +`shortcode` varchar(100) NOT NULL default '', +`operator` varchar(100) NOT NULL default '', +`momid` varchar(30) NOT NULL default '', +`keyword` varchar(160) NOT NULL default '', +`content` varchar(160) NOT NULL default '', +`second_token` varchar(160) default NULL, +`gateway_id` int(11) NOT NULL default '0', +`created` datetime NOT NULL default '0000-00-00 00:00:00', +`msisdn` varchar(15) NOT NULL default '', +PRIMARY KEY (`id`), +UNIQUE KEY `MSCCSPK_20030521130957121` (`momid`), +KEY `IX_mobile_originated_message_keyword` (`keyword`), +KEY `IX_mobile_originated_message_created` (`created`), +KEY `IX_mobile_originated_message_support` (`msisdn`,`momid`,`keyword`,`gateway_id`,`created`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +INSERT INTO t1 VALUES +(1,'blah','464','aaa','fkc1c9ilc20x0hgae7lx6j09','ERR','ERR Имри.Афимим.Аеимимримдмримрмрирор имримримримр имридм ирбднримрфмририримрфмфмим.Ад.Д имдимримрад.Адимримримрмдиримримримр м.Дадимфшьмримд им.Адимимрн имадми','ИМРИ.АФИМИМ.АЕИМИМРИМДМРИМРМРИРОР',3,'2005-06-01 17:30:43','1234567890'), +(2,'blah','464','aaa','haxpl2ilc20x00bj4tt2m5ti','11','11 g','G',3,'2005-06-02 22:43:10','1234567890'); +CREATE TABLE t2 ( +`msisdn` varchar(15) NOT NULL default '', +`operator_id` int(11) NOT NULL default '0', +`created` datetime NOT NULL default '0000-00-00 00:00:00', +UNIQUE KEY `PK_user` (`msisdn`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +INSERT INTO t2 VALUES ('1234567890',2,'2005-05-24 13:53:25'); +SELECT content, t2.msisdn FROM t1, t2 WHERE t1.msisdn = '1234567890'; +content msisdn +ERR Имри.Афимим.Аеимимримдмримрмрирор имримримримр имридм ирбднримрфмририримрфмфмим.Ад.Д имдимримрад.Адимримримрмдиримримримр м.Дадимфшьмримд им.Адимимрн имадми 1234567890 +11 g 1234567890 +DROP TABLE t1,t2; +create table t1 (a char(20) character set utf8mb4) engine InnoDB; +insert into t1 values ('123456'),('андрей'); +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +alter table t1 modify a char(2) character set utf8mb4; +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +Warning 1265 Data truncated for column 'a' at row 2 +select char_length(a), length(a), a from t1 order by a; +char_length(a) length(a) a +2 2 12 +2 4 ан +drop table t1; +set names utf8mb4; +select 'andre%' like 'andreñ%' escape 'ñ'; +'andre%' like 'andreñ%' escape 'ñ' +1 +set names utf8mb4; +select 'a\\' like 'a\\'; +'a\\' like 'a\\' +1 +select 'aa\\' like 'a%\\'; +'aa\\' like 'a%\\' +1 +create table t1 (a char(10), key(a)) character set utf8mb4 engine InnoDB; +insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); +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; +CREATE TABLE t1 ( +a varchar(255) NOT NULL default '', +KEY a (a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci; +insert into t1 values (_utf8mb4 0xe880bd); +insert into t1 values (_utf8mb4 0x5b); +select hex(a) from t1; +hex(a) +5B +E880BD +drop table t1; +set names 'latin1'; +create table t1 (a varchar(255)) default charset=utf8mb4 engine InnoDB; +select * from t1 where find_in_set('-1', a); +a +drop table t1; +create table t1 (a int) engine InnoDB; +insert into t1 values (48),(49),(50); +set names utf8mb4; +select distinct char(a) from t1; +char(a) +0 +1 +2 +drop table t1; +CREATE TABLE t1 (t TINYTEXT CHARACTER SET utf8mb4) ENGINE InnoDB; +INSERT INTO t1 VALUES(REPEAT('a', 100)); +CREATE TEMPORARY TABLE t2 ENGINE InnoDB SELECT COALESCE(t) AS bug FROM t1; +SELECT LENGTH(bug) FROM t2; +LENGTH(bug) +100 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (item varchar(255)) default character set utf8mb4 ENGINE InnoDB; +INSERT INTO t1 VALUES (N'\\'); +INSERT INTO t1 VALUES (_utf8mb4'\\'); +INSERT INTO t1 VALUES (N'Cote d\'Ivoire'); +INSERT INTO t1 VALUES (_utf8mb4'Cote d\'Ivoire'); +SELECT item FROM t1 ORDER BY item; +item +Cote d'Ivoire +Cote d'Ivoire +\ +\ +DROP TABLE t1; +SET NAMES utf8mb4; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1(a VARCHAR(255), KEY(a)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'); +INSERT INTO t1 VALUES('uu'); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t1 VALUES('uU'); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t1 VALUES('uu'); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t1 VALUES('uuABC'); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t1 VALUES('UuABC'); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t1 VALUES('uuABC'); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +alter table t1 add b int; +INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',1); +INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',2); +delete from t1 where b=1; +INSERT INTO t1 VALUES('UUABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',1); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',3); +INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',4); +delete from t1 where b=3; +INSERT INTO t1 VALUES('uUABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',3); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; +set names utf8mb4; +create table t1 (s1 char(5) character set utf8mb4) engine InnoDB; +insert into t1 values +('a'),('b'),(null),('ペテルグル'),('ü'),('Y'); +create index it1 on t1 (s1); +select s1 as before_delete_general_ci from t1 where s1 like 'ペテ%'; +before_delete_general_ci +ペテルグル +delete from t1 where s1 = 'Y'; +select s1 as after_delete_general_ci from t1 where s1 like 'ペテ%'; +after_delete_general_ci +ペテルグル +drop table t1; +set names utf8mb4; +create table t1 (s1 char(5) character set utf8mb4 collate utf8mb4_unicode_ci) engine InnoDB; +insert into t1 values +('a'),('b'),(null),('ペテルグル'),('ü'),('Y'); +create index it1 on t1 (s1); +select s1 as before_delete_unicode_ci from t1 where s1 like 'ペテ%'; +before_delete_unicode_ci +ペテルグル +delete from t1 where s1 = 'Y'; +select s1 as after_delete_unicode_ci from t1 where s1 like 'ペテ%'; +after_delete_unicode_ci +ペテルグル +drop table t1; +set names utf8mb4; +create table t1 (s1 char(5) character set utf8mb4 collate utf8mb4_bin) engine InnoDB; +insert into t1 values +('a'),('b'),(null),('ペテルグル'),('ü'),('Y'); +create index it1 on t1 (s1); +select s1 as before_delete_bin from t1 where s1 like 'ペテ%'; +before_delete_bin +ペテルグル +delete from t1 where s1 = 'Y'; +select s1 as after_delete_bin from t1 where s1 like 'ペテ%'; +after_delete_bin +ペテルグル +drop table t1; +set names utf8mb4; +create table t1 (a varchar(30) not null primary key) +engine=InnoDB default character set utf8mb4 collate utf8mb4_general_ci; +insert into t1 values ('あいうえおかきくけこさしすせそ'); +insert into t1 values ('さしすせそかきくけこあいうえお'); +select a as gci1 from t1 where a like 'さしすせそかきくけこあいうえお%'; +gci1 +さしすせそかきくけこあいうえお +select a as gci2 from t1 where a like 'あいうえおかきくけこさしすせそ'; +gci2 +あいうえおかきくけこさしすせそ +drop table t1; +set names utf8mb4; +create table t1 (a varchar(30) not null primary key) +engine=InnoDB default character set utf8mb4 collate utf8mb4_unicode_ci; +insert into t1 values ('あいうえおかきくけこさしすせそ'); +insert into t1 values ('さしすせそかきくけこあいうえお'); +select a as uci1 from t1 where a like 'さしすせそかきくけこあいうえお%'; +uci1 +さしすせそかきくけこあいうえお +select a as uci2 from t1 where a like 'あいうえおかきくけこさしすせそ'; +uci2 +あいうえおかきくけこさしすせそ +drop table t1; +set names utf8mb4; +create table t1 (a varchar(30) not null primary key) +engine=InnoDB default character set utf8mb4 collate utf8mb4_bin; +insert into t1 values ('あいうえおかきくけこさしすせそ'); +insert into t1 values ('さしすせそかきくけこあいうえお'); +select a as bin1 from t1 where a like 'さしすせそかきくけこあいうえお%'; +bin1 +さしすせそかきくけこあいうえお +select a as bin2 from t1 where a like 'あいうえおかきくけこさしすせそ'; +bin2 +あいうえおかきくけこさしすせそ +drop table t1; +SET NAMES utf8mb4; +CREATE TABLE t1 (id int PRIMARY KEY, +a varchar(16) collate utf8mb4_unicode_ci NOT NULL default '', +b int, +f varchar(128) default 'XXX', +INDEX (a(4)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +INSERT INTO t1(id, a, b) VALUES +(1, 'cccc', 50), (2, 'cccc', 70), (3, 'cccc', 30), +(4, 'cccc', 30), (5, 'cccc', 20), (6, 'bbbbbb', 40), +(7, 'dddd', 30), (8, 'aaaa', 10), (9, 'aaaa', 50), +(10, 'eeeee', 40), (11, 'bbbbbb', 60); +SELECT id, a, b FROM t1; +id a b +1 cccc 50 +10 eeeee 40 +11 bbbbbb 60 +2 cccc 70 +3 cccc 30 +4 cccc 30 +5 cccc 20 +6 bbbbbb 40 +7 dddd 30 +8 aaaa 10 +9 aaaa 50 +SELECT id, a, b FROM t1 WHERE a BETWEEN 'aaaa' AND 'bbbbbb'; +id a b +11 bbbbbb 60 +6 bbbbbb 40 +8 aaaa 10 +9 aaaa 50 +SELECT id, a FROM t1 WHERE a='bbbbbb'; +id a +11 bbbbbb +6 bbbbbb +SELECT id, a FROM t1 WHERE a='bbbbbb' ORDER BY b; +id a +6 bbbbbb +11 bbbbbb +DROP TABLE t1; +SET NAMES utf8mb4; +CREATE TABLE t1 ( +a CHAR(13) DEFAULT '', +INDEX(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +INSERT INTO t1 VALUES +('Käli Käli 2-4'), ('Käli Käli 2-4'), +('Käli Käli 2+4'), ('Käli Käli 2+4'), +('Käli Käli 2-6'), ('Käli Käli 2-6'); +INSERT INTO t1 SELECT * FROM t1; +CREATE TABLE t2 ( +a CHAR(13) DEFAULT '', +INDEX(a) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; +INSERT INTO t2 VALUES +('Kali Kali 2-4'), ('Kali Kali 2-4'), +('Kali Kali 2+4'), ('Kali Kali 2+4'), +('Kali Kali 2-6'), ('Kali Kali 2-6'); +INSERT INTO t2 SELECT * FROM t2; +SELECT a FROM t1 WHERE a LIKE 'Käli Käli 2+4'; +a +Käli Käli 2+4 +Käli Käli 2+4 +Käli Käli 2+4 +Käli Käli 2+4 +SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4'; +a +Kali Kali 2+4 +Kali Kali 2+4 +Kali Kali 2+4 +Kali Kali 2+4 +EXPLAIN SELECT a FROM t1 WHERE a LIKE 'Käli Käli 2+4'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 53 NULL 4 Using where; Using index +EXPLAIN SELECT a FROM t1 WHERE a = 'Käli Käli 2+4'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 53 const 4 Using where; Using index +EXPLAIN SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range a a 14 NULL 4 Using where; Using index +EXPLAIN SELECT a FROM t2 WHERE a = 'Kali Kali 2+4'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref a a 14 const 4 Using where; Using index +DROP TABLE t1,t2; +CREATE TABLE t1 ( +a char(255) DEFAULT '', +KEY(a(10)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +INSERT INTO t1 VALUES ('Käli Käli 2-4'); +SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%'; +a +Käli Käli 2-4 +INSERT INTO t1 VALUES ('Käli Käli 2-4'); +SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%'; +a +Käli Käli 2-4 +Käli Käli 2-4 +DROP TABLE t1; +CREATE TABLE t1 ( +a char(255) DEFAULT '' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +INSERT INTO t1 VALUES ('Käli Käli 2-4'); +INSERT INTO t1 VALUES ('Käli Käli 2-4'); +SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%'; +a +Käli Käli 2-4 +Käli Käli 2-4 +ALTER TABLE t1 ADD KEY (a(10)); +SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%'; +a +Käli Käli 2-4 +Käli Käli 2-4 +DROP TABLE t1; +SET NAMES latin2; +CREATE TABLE t1 ( +id int(11) NOT NULL default '0', +tid int(11) NOT NULL default '0', +val text NOT NULL, +INDEX idx(tid, val(10)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +INSERT INTO t1 VALUES +(40988,72,'VOLN� ADSL'),(41009,72,'VOLN� ADSL'), +(41032,72,'VOLN� ADSL'),(41038,72,'VOLN� ADSL'), +(41063,72,'VOLN� ADSL'),(41537,72,'VOLN� ADSL Office'), +(42141,72,'VOLN� ADSL'),(42565,72,'VOLN� ADSL Combi'), +(42749,72,'VOLN� ADSL'),(44205,72,'VOLN� ADSL'); +SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLNY ADSL'; +id tid val +40988 72 VOLN� ADSL +41009 72 VOLN� ADSL +41032 72 VOLN� ADSL +41038 72 VOLN� ADSL +41063 72 VOLN� ADSL +42141 72 VOLN� ADSL +42749 72 VOLN� ADSL +44205 72 VOLN� ADSL +SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLN� ADSL'; +id tid val +40988 72 VOLN� ADSL +41009 72 VOLN� ADSL +41032 72 VOLN� ADSL +41038 72 VOLN� ADSL +41063 72 VOLN� ADSL +42141 72 VOLN� ADSL +42749 72 VOLN� ADSL +44205 72 VOLN� ADSL +SELECT * FROM t1 WHERE tid=72 and val LIKE '%VOLN� ADSL'; +id tid val +40988 72 VOLN� ADSL +41009 72 VOLN� ADSL +41032 72 VOLN� ADSL +41038 72 VOLN� ADSL +41063 72 VOLN� ADSL +42141 72 VOLN� ADSL +42749 72 VOLN� ADSL +44205 72 VOLN� ADSL +ALTER TABLE t1 DROP KEY idx; +ALTER TABLE t1 ADD KEY idx (tid,val(11)); +SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLN� ADSL'; +id tid val +40988 72 VOLN� ADSL +41009 72 VOLN� ADSL +41032 72 VOLN� ADSL +41038 72 VOLN� ADSL +41063 72 VOLN� ADSL +42141 72 VOLN� ADSL +42749 72 VOLN� ADSL +44205 72 VOLN� ADSL +DROP TABLE t1; +create table t1(a char(200) collate utf8mb4_unicode_ci NOT NULL default '') +default charset=utf8mb4 collate=utf8mb4_unicode_ci engine InnoDB; +insert into t1 values (unhex('65')), (unhex('C3A9')), (unhex('65')); +explain select distinct a from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary +SELECT COUNT(*) FROM (SELECT DISTINCT a FROM t1) AS t2; +COUNT(*) +1 +explain select a 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 3 Using temporary; Using filesort +SELECT COUNT(*) FROM (SELECT a FROM t1 GROUP BY a) AS t2; +COUNT(*) +1 +drop table t1; +create table t1(a char(10)) default charset utf8mb4 engine InnoDB; +insert into t1 values ('123'), ('456'); +explain +select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE Y ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +1 SIMPLE Z ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1; +substr(Z.a,-1) a +3 123 +6 456 +drop table t1; +SET CHARACTER SET utf8mb4; +SHOW VARIABLES LIKE 'character\_set\_%'; +Variable_name Value +character_set_client utf8mb4 +character_set_connection latin1 +character_set_database latin1 +character_set_filesystem binary +character_set_results utf8mb4 +character_set_server latin1 +character_set_system utf8 +CREATE DATABASE crashtest DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; +USE crashtest; +CREATE TABLE crashtest (crash char(10)) DEFAULT CHARSET=utf8mb4 ENGINE InnoDB; +INSERT INTO crashtest VALUES ('35'), ('36'), ('37'); +SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8mb4); +crash +35 +36 +37 +INSERT INTO crashtest VALUES ('-1000'); +EXPLAIN SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8mb4); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE crashtest ALL NULL NULL NULL NULL 4 Using filesort +SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8mb4); +crash +-1000 +35 +36 +37 +Warnings: +Warning 1300 Invalid utf8mb4 character string: 'FFFFFC' +DROP TABLE crashtest; +DROP DATABASE crashtest; +USE test; +SET CHARACTER SET default; +CREATE TABLE t1(id varchar(20) NOT NULL) DEFAULT CHARSET=utf8mb4 ENGINE InnoDB; +INSERT INTO t1 VALUES ('xxx'), ('aa'), ('yyy'), ('aa'); +SELECT id FROM t1; +id +aa +aa +xxx +yyy +SELECT DISTINCT id FROM t1; +id +aa +xxx +yyy +SELECT DISTINCT id FROM t1 ORDER BY id; +id +aa +xxx +yyy +DROP TABLE t1; +create table t1 ( +a varchar(26) not null +) default character set utf8mb4 ENGINE InnoDB; +insert into t1 (a) values ('abcdefghijklmnopqrstuvwxyz'); +select * from t1; +a +abcdefghijklmnopqrstuvwxyz +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +alter table t1 change a a varchar(20) character set utf8mb4 not null; +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +select * from t1; +a +abcdefghijklmnopqrst +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +alter table t1 change a a char(15) character set utf8mb4 not null; +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +select * from t1; +a +abcdefghijklmno +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +alter table t1 change a a char(10) character set utf8mb4 not null; +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +select * from t1; +a +abcdefghij +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +alter table t1 change a a varchar(5) character set utf8mb4 not null; +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +select * from t1; +a +abcde +drop table t1; +create table t1 ( +a varchar(4000) not null +) default character set utf8mb4 engine InnoDB; +insert into t1 values (repeat('a',4000)); +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +alter table t1 change a a varchar(3000) character set utf8mb4 not null; +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +select length(a) from t1; +length(a) +3000 +drop table t1; +set names utf8mb4; +select hex(char(1 using utf8mb4)); +hex(char(1 using utf8mb4)) +01 +select char(0xd1,0x8f using utf8mb4); +char(0xd1,0x8f using utf8mb4) +я +select char(0xd18f using utf8mb4); +char(0xd18f using utf8mb4) +я +select char(53647 using utf8mb4); +char(53647 using utf8mb4) +я +select char(0xff,0x8f using utf8mb4); +char(0xff,0x8f using utf8mb4) +NULL +Warnings: +Warning 1300 Invalid utf8mb4 character string: 'FF8F' +select convert(char(0xff,0x8f) using utf8mb4); +convert(char(0xff,0x8f) using utf8mb4) +?? +Warnings: +Warning 1300 Invalid utf8mb4 character string: '\xFF\x8F' +set sql_mode=traditional; +select char(0xff,0x8f using utf8mb4); +char(0xff,0x8f using utf8mb4) +NULL +Warnings: +Warning 1300 Invalid utf8mb4 character string: 'FF8F' +select char(195 using utf8mb4); +char(195 using utf8mb4) +NULL +Warnings: +Warning 1300 Invalid utf8mb4 character string: 'C3' +select char(196 using utf8mb4); +char(196 using utf8mb4) +NULL +Warnings: +Warning 1300 Invalid utf8mb4 character string: 'C4' +select char(2557 using utf8mb4); +char(2557 using utf8mb4) +NULL +Warnings: +Warning 1300 Invalid utf8mb4 character string: 'FD' +select convert(char(0xff,0x8f) using utf8mb4); +convert(char(0xff,0x8f) using utf8mb4) +?? +Warnings: +Warning 1300 Invalid utf8mb4 character string: '\xFF\x8F' +select hex(convert(char(2557 using latin1) using utf8mb4)); +hex(convert(char(2557 using latin1) using utf8mb4)) +09C3BD +select hex(char(195)); +hex(char(195)) +C3 +select hex(char(196)); +hex(char(196)) +C4 +select hex(char(2557)); +hex(char(2557)) +09FD +set names utf8mb4; +create table t1 (a char(1)) default character set utf8mb4 engine InnoDB; +create table t2 (a char(1)) default character set utf8mb4 engine InnoDB; +insert into t1 values('a'),('a'),(0xE38182),(0xE38182); +insert into t1 values('i'),('i'),(0xE38184),(0xE38184); +select * from t1 union distinct select * from t2; +a +a +i +あ +い +drop table t1,t2; +set names utf8mb4; +create table t1 (a char(10), b varchar(10)) engine InnoDB; +insert into t1 values ('bar','kostja'); +insert into t1 values ('kostja','bar'); +prepare my_stmt from "select * from t1 where a=?"; +set @a:='bar'; +execute my_stmt using @a; +a b +bar kostja +set @a:='kostja'; +execute my_stmt using @a; +a b +kostja bar +set @a:=null; +execute my_stmt using @a; +a b +drop table if exists t1; +drop table if exists t1; +drop view if exists v1, v2; +set names utf8mb4; +create table t1(col1 varchar(12) character set utf8mb4 collate utf8mb4_unicode_ci) engine InnoDB; +insert into t1 values('t1_val'); +create view v1 as select 'v1_val' as col1; +select coercibility(col1), collation(col1) from v1; +coercibility(col1) collation(col1) +4 utf8mb4_general_ci +create view v2 as select col1 from v1 union select col1 from t1; +select coercibility(col1), collation(col1)from v2; +coercibility(col1) collation(col1) +2 utf8mb4_unicode_ci +2 utf8mb4_unicode_ci +drop view v1, v2; +create view v1 as select 'v1_val' collate utf8mb4_swedish_ci as col1; +select coercibility(col1), collation(col1) from v1; +coercibility(col1) collation(col1) +0 utf8mb4_swedish_ci +create view v2 as select col1 from v1 union select col1 from t1; +select coercibility(col1), collation(col1) from v2; +coercibility(col1) collation(col1) +0 utf8mb4_swedish_ci +0 utf8mb4_swedish_ci +drop view v1, v2; +drop table t1; +set names utf8mb4; +create table t1 (a varchar(10) character set latin1, b int) engine InnoDB; +insert into t1 values ('a',1); +select concat(a, if(b>10, N'x', N'y')) from t1; +concat(a, if(b>10, N'x', N'y')) +ay +select concat(a, if(b>10, N'æ', N'ß')) from t1; +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'concat' +drop table t1; +set names utf8mb4; +create table t1 (a varchar(10) character set latin1, b int) engine InnoDB; +insert into t1 values ('a',1); +select concat(a, if(b>10, _utf8mb4'x', _utf8mb4'y')) from t1; +concat(a, if(b>10, _utf8mb4'x', _utf8mb4'y')) +ay +select concat(a, if(b>10, _utf8mb4'æ', _utf8mb4'ß')) from t1; +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation 'concat' +drop table t1; +set names utf8mb4; +create table t1 (a varchar(10) character set latin1, b int) engine InnoDB; +insert into t1 values ('a',1); +select concat(a, if(b>10, _utf8mb4 0x78, _utf8mb4 0x79)) from t1; +concat(a, if(b>10, _utf8mb4 0x78, _utf8mb4 0x79)) +ay +select concat(a, if(b>10, _utf8mb4 0xC3A6, _utf8mb4 0xC3AF)) from t1; +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation 'concat' +drop table t1; +set names utf8mb4; +create table t1 (a varchar(10) character set latin1, b int) engine InnoDB; +insert into t1 values ('a',1); +select concat(a, if(b>10, 'x' 'x', 'y' 'y')) from t1; +concat(a, if(b>10, 'x' 'x', 'y' 'y')) +ayy +select concat(a, if(b>10, 'x' 'æ', 'y' 'ß')) from t1; +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation 'concat' +drop table t1; +CREATE TABLE t1 ( +colA int(11) NOT NULL, +colB varchar(255) character set utf8mb4 NOT NULL, +PRIMARY KEY (colA) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t1 (colA, colB) VALUES (1, 'foo'), (2, 'foo bar'); +CREATE TABLE t2 ( +colA int(11) NOT NULL, +colB varchar(255) character set utf8mb4 NOT NULL, +KEY bad (colA,colB(3)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t2 (colA, colB) VALUES (1, 'foo'),(2, 'foo bar'); +SELECT * FROM t1 JOIN t2 ON t1.colA=t2.colA AND t1.colB=t2.colB +WHERE t1.colA < 3; +colA colB colA colB +1 foo 1 foo +2 foo bar 2 foo bar +DROP TABLE t1, t2; +SELECT 'н1234567890' UNION SELECT _binary '1'; +н1234567890 +н1234567890 +1 +SELECT 'н1234567890' UNION SELECT 1; +н1234567890 +н1234567890 +1 +SELECT '1' UNION SELECT 'н1234567890'; +1 +1 +н1234567890 +SELECT 1 UNION SELECT 'н1234567890'; +1 +1 +н1234567890 +CREATE TABLE t1 (c VARCHAR(11)) CHARACTER SET utf8mb4 ENGINE InnoDB; +CREATE TABLE t2 (b CHAR(1) CHARACTER SET binary, i INT) ENGINE InnoDB; +INSERT INTO t1 (c) VALUES ('н1234567890'); +INSERT INTO t2 (b, i) VALUES ('1', 1); +SELECT c FROM t1 UNION SELECT b FROM t2; +c +н1234567890 +1 +SELECT c FROM t1 UNION SELECT i FROM t2; +c +н1234567890 +1 +SELECT b FROM t2 UNION SELECT c FROM t1; +b +1 +н1234567890 +SELECT i FROM t2 UNION SELECT c FROM t1; +i +1 +н1234567890 +DROP TABLE t1, t2; +set sql_mode=traditional; +select hex(char(0xFF using utf8mb4)); +hex(char(0xFF using utf8mb4)) +NULL +Warnings: +Warning 1300 Invalid utf8mb4 character string: 'FF' +select hex(convert(0xFF using utf8mb4)); +hex(convert(0xFF using utf8mb4)) +3F +Warnings: +Warning 1300 Invalid utf8mb4 character string: '\xFF' +select hex(_utf8mb4 0x616263FF); +ERROR HY000: Invalid utf8mb4 character string: 'FF' +select hex(_utf8mb4 X'616263FF'); +ERROR HY000: Invalid utf8mb4 character string: 'FF' +select hex(_utf8mb4 B'001111111111'); +ERROR HY000: Invalid utf8mb4 character string: 'FF' +select (_utf8mb4 X'616263FF'); +ERROR HY000: Invalid utf8mb4 character string: 'FF' +set sql_mode=default; +select hex(char(0xFF using utf8mb4)); +hex(char(0xFF using utf8mb4)) +NULL +Warnings: +Warning 1300 Invalid utf8mb4 character string: 'FF' +select hex(convert(0xFF using utf8mb4)); +hex(convert(0xFF using utf8mb4)) +3F +Warnings: +Warning 1300 Invalid utf8mb4 character string: '\xFF' +select hex(_utf8mb4 0x616263FF); +ERROR HY000: Invalid utf8mb4 character string: 'FF' +select hex(_utf8mb4 X'616263FF'); +ERROR HY000: Invalid utf8mb4 character string: 'FF' +select hex(_utf8mb4 B'001111111111'); +ERROR HY000: Invalid utf8mb4 character string: 'FF' +select (_utf8mb4 X'616263FF'); +ERROR HY000: Invalid utf8mb4 character string: 'FF' +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL) ENGINE InnoDB; +INSERT INTO t1 VALUES (70000, 1092), (70001, 1085), (70002, 1065); +SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b; +CONVERT(a, CHAR) CONVERT(b, CHAR) +70000 1092 +70001 1085 +70002 1065 +SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1; +CONVERT(a, CHAR) CONVERT(b, CHAR) +70000 1092 +70001 1085 +70002 1065 +ALTER TABLE t1 ADD UNIQUE (b); +SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b; +CONVERT(a, CHAR) CONVERT(b, CHAR) +70000 1092 +70001 1085 +70002 1065 +DROP INDEX b ON t1; +SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b; +CONVERT(a, CHAR) CONVERT(b, CHAR) +70000 1092 +70001 1085 +70002 1065 +ALTER TABLE t1 ADD INDEX (b); +SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) from t1 GROUP BY b; +CONVERT(a, CHAR) CONVERT(b, CHAR) +70000 1092 +70001 1085 +70002 1065 +DROP TABLE t1; +# +# Bug#26474: Add Sinhala script (Sri Lanka) collation to MySQL +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +predicted_order int NOT NULL, +utf8mb4_encoding VARCHAR(10) NOT NULL +) CHARACTER SET utf8mb4 ENGINE InnoDB; +INSERT INTO t1 VALUES (19, x'E0B696'), (30, x'E0B69AE0B798'), (61, x'E0B6AF'), (93, x'E0B799'), (52, x'E0B6A6'), (73, x'E0B6BBE0B78AE2808D'), (3, x'E0B686'), (56, x'E0B6AA'), (55, x'E0B6A9'), (70, x'E0B6B9'), (94, x'E0B79A'), (80, x'E0B785'), (25, x'E0B69AE0B791'), (48, x'E0B6A2'), (13, x'E0B690'), (86, x'E0B793'), (91, x'E0B79F'), (81, x'E0B786'), (79, x'E0B784'), (14, x'E0B691'), (99, x'E0B78A'), (8, x'E0B68B'), (68, x'E0B6B7'), (22, x'E0B69A'), (16, x'E0B693'), (33, x'E0B69AE0B7B3'), (38, x'E0B69AE0B79D'), (21, x'E0B683'), (11, x'E0B68E'), (77, x'E0B782'), (40, x'E0B69AE0B78A'), (101, x'E0B78AE2808DE0B6BB'), (35, x'E0B69AE0B79A'), (1, x'E0B7B4'), (9, x'E0B68C'), (96, x'E0B79C'), (6, x'E0B689'), (95, x'E0B79B'), (88, x'E0B796'), (64, x'E0B6B3'), (26, x'E0B69AE0B792'), (82, x'E0B78F'), (28, x'E0B69AE0B794'), (39, x'E0B69AE0B79E'), (97, x'E0B79D'), (2, x'E0B685'), (75, x'E0B780'), (34, x'E0B69AE0B799'), (69, x'E0B6B8'), (83, x'E0B790'), (18, x'E0B695'), (90, x'E0B7B2'), (17 , x'E0B694'), (72, x'E0B6BB'), (66, x'E0B6B5'), (59, x'E0B6AD'), (44, x'E0B69E'), (15, x'E0B692'), (23, x'E0B69AE0B78F'), (65, x'E0B6B4'), (42, x'E0B69C'), (63, x'E0B6B1'), (85, x'E0B792'), (47, x'E0B6A1'), (49, x'E0B6A3'), (92, x'E0B7B3'), (78, x'E0B783'), (36, x'E0B69AE0B79B'), (4, x'E0B687'), (24, x'E0B69AE0B790'), (87, x'E0B794'), (37, x'E0B69AE0B79C'), (32, x'E0B69AE0B79F'), (29, x'E0B69AE0B796'), (43, x'E0B69D'), (62, x'E0B6B0'), (100, x'E0B78AE2808DE0B6BA'), (60, x'E0B6AE'), (45, x'E0B69F'), (12, x'E0B68F'), (46, x'E0B6A0'), (50, x'E0B6A5'), (51, x'E0B6A4'), (5, x'E0B688'), (76, x'E0B781'), (89, x'E0B798'), (74, x'E0B6BD'), (10, x'E0B68D'), (57, x'E0B6AB'), (71, x'E0B6BA'), (58, x'E0B6AC'), (27, x'E0B69AE0B793'), (54, x'E0B6A8'), (84, x'E0B791'), (31, x'E0B69AE0B7B2'), (98, x'E0B79E'), (53, x'E0B6A7'), (41, x'E0B69B'), (67, x'E0B6B6'), (7, x'E0B68A'), (20, x'E0B682'); +SELECT predicted_order, hex(utf8mb4_encoding) FROM t1 ORDER BY utf8mb4_encoding COLLATE utf8mb4_sinhala_ci; +predicted_order hex(utf8mb4_encoding) +1 E0B7B4 +2 E0B685 +3 E0B686 +4 E0B687 +5 E0B688 +6 E0B689 +7 E0B68A +8 E0B68B +9 E0B68C +10 E0B68D +11 E0B68E +12 E0B68F +13 E0B690 +14 E0B691 +15 E0B692 +16 E0B693 +17 E0B694 +18 E0B695 +19 E0B696 +20 E0B682 +21 E0B683 +22 E0B69A +23 E0B69AE0B78F +24 E0B69AE0B790 +25 E0B69AE0B791 +26 E0B69AE0B792 +27 E0B69AE0B793 +28 E0B69AE0B794 +29 E0B69AE0B796 +30 E0B69AE0B798 +31 E0B69AE0B7B2 +32 E0B69AE0B79F +33 E0B69AE0B7B3 +34 E0B69AE0B799 +35 E0B69AE0B79A +36 E0B69AE0B79B +37 E0B69AE0B79C +38 E0B69AE0B79D +39 E0B69AE0B79E +40 E0B69AE0B78A +41 E0B69B +42 E0B69C +43 E0B69D +44 E0B69E +45 E0B69F +46 E0B6A0 +47 E0B6A1 +48 E0B6A2 +49 E0B6A3 +50 E0B6A5 +51 E0B6A4 +52 E0B6A6 +53 E0B6A7 +54 E0B6A8 +55 E0B6A9 +56 E0B6AA +57 E0B6AB +58 E0B6AC +59 E0B6AD +60 E0B6AE +61 E0B6AF +62 E0B6B0 +63 E0B6B1 +64 E0B6B3 +65 E0B6B4 +66 E0B6B5 +67 E0B6B6 +68 E0B6B7 +69 E0B6B8 +70 E0B6B9 +71 E0B6BA +72 E0B6BB +73 E0B6BBE0B78AE2808D +74 E0B6BD +75 E0B780 +76 E0B781 +77 E0B782 +78 E0B783 +79 E0B784 +80 E0B785 +81 E0B786 +82 E0B78F +83 E0B790 +84 E0B791 +85 E0B792 +86 E0B793 +87 E0B794 +88 E0B796 +89 E0B798 +90 E0B7B2 +91 E0B79F +92 E0B7B3 +93 E0B799 +94 E0B79A +95 E0B79B +96 E0B79C +97 E0B79D +98 E0B79E +99 E0B78A +100 E0B78AE2808DE0B6BA +101 E0B78AE2808DE0B6BB +DROP TABLE t1; +# +# Bug#32914 Character sets: illegal characters in utf8mb4 and utf32 columns +# +create table t1 (utf8mb4 char(1) character set utf8mb4) engine InnoDB; +Testing [F0][90..BF][80..BF][80..BF] +insert into t1 values (0xF0908080); +insert into t1 values (0xF0BFBFBF); +insert ignore into t1 values (0xF08F8080); +Warnings: +Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column `test`.`t1`.`utf8mb4` at row 1 +select hex(utf8mb4) from t1; +hex(utf8mb4) +3F +F0908080 +F0BFBFBF +delete from t1; +Testing [F2..F3][80..BF][80..BF][80..BF] +insert into t1 values (0xF2808080); +insert into t1 values (0xF2BFBFBF); +select hex(utf8mb4) from t1; +hex(utf8mb4) +F2808080 +F2BFBFBF +delete from t1; +Testing [F4][80..8F][80..BF][80..BF] +insert into t1 values (0xF4808080); +insert into t1 values (0xF48F8080); +insert ignore into t1 values (0xF4908080); +Warnings: +Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column `test`.`t1`.`utf8mb4` at row 1 +select hex(utf8mb4) from t1; +hex(utf8mb4) +3F +F4808080 +F48F8080 +drop table t1; +# +# Check strnxfrm() with odd length +# +set max_sort_length=5; +select @@max_sort_length; +@@max_sort_length +5 +create table t1 (a varchar(128) character set utf8mb4 collate utf8mb4_general_ci) engine InnoDB; +insert into t1 values ('a'),('b'),('c'); +select * from t1 order by a; +a +a +b +c +alter table t1 modify a varchar(128) character set utf8mb4 collate utf8mb4_bin; +select * from t1 order by a; +a +a +b +c +drop table t1; +set max_sort_length=default; +# +# Bug#26180: Can't add columns to tables created with utf8mb4 text indexes +# +CREATE TABLE t1 ( +clipid INT NOT NULL, +Tape TINYTEXT, +PRIMARY KEY (clipid), +KEY tape(Tape(255)) +) CHARACTER SET=utf8mb4 ENGINE InnoDB; +ALTER TABLE t1 ADD mos TINYINT DEFAULT 0 AFTER clipid; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `clipid` int(11) NOT NULL, + `mos` tinyint(4) DEFAULT 0, + `Tape` tinytext DEFAULT NULL, + PRIMARY KEY (`clipid`), + KEY `tape` (`Tape`(255)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 +DROP TABLE t1; +# +# Testing 4-byte values. +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +u_decimal int NOT NULL, +utf8mb4_encoding VARCHAR(10) NOT NULL +) CHARACTER SET utf8mb4 ENGINE InnoDB; +INSERT INTO t1 VALUES (119040, x'f09d8480'), +# G CLEF +(119070, x'f09d849e'), +# HALF NOTE +(119134, x'f09d859e'), +# MUSICAL SYMBOL CROIX +(119247, x'f09d878f'), +# MATHEMATICAL BOLD ITALIC CAPITAL DELTA +(120607, x'f09d9c9f'), +# SANS-SERIF BOLD ITALIC CAPITAL PI +(120735, x'f09d9e9f'), +# <Plane 16 Private Use, Last> (last 4 byte character) +(1114111, x'f48fbfbf'), +# VARIATION SELECTOR-256 +(917999, x'f3a087af'); +INSERT INTO t1 VALUES (119070, x'f09d849ef09d859ef09d859ef09d8480f09d859ff09d859ff09d859ff09d85a0f09d85a0f09d8480'); +INSERT INTO t1 VALUES (65131, x'efb9abf09d849ef09d859ef09d859ef09d8480f09d859fefb9abefb9abf09d85a0efb9ab'); +INSERT IGNORE INTO t1 VALUES (119070, x'f09d849ef09d859ef09d859ef09d8480f09d859ff09d859ff09d859ff09d85a0f09d85a0f09d8480f09d85a0'); +Warnings: +Warning 1265 Data truncated for column 'utf8mb4_encoding' at row 1 +SELECT u_decimal, hex(utf8mb4_encoding) FROM t1 ORDER BY utf8mb4_encoding COLLATE utf8mb4_general_ci, BINARY utf8mb4_encoding; +u_decimal hex(utf8mb4_encoding) +1114111 F48FBFBF +119040 F09D8480 +119070 F09D849E +119070 F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480 +119070 F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480 +119134 F09D859E +119247 F09D878F +120607 F09D9C9F +120735 F09D9E9F +65131 EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9AB +917999 F3A087AF +INSERT IGNORE INTO t1 VALUES (1114111, x'f5808080'); +Warnings: +Warning 1366 Incorrect string value: '\xF5\x80\x80\x80' for column `test`.`t1`.`utf8mb4_encoding` at row 1 +SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE +table_name= 't1' AND column_name= 'utf8mb4_encoding'; +character_maximum_length character_octet_length +10 40 +DROP TABLE IF EXISTS t2; +CREATE TABLE t2 ( +u_decimal int NOT NULL, +utf8mb3_encoding VARCHAR(10) NOT NULL +) CHARACTER SET utf8mb3 ENGINE InnoDB; +INSERT INTO t2 VALUES (42856, x'ea9da8'); +INSERT INTO t2 VALUES (65131, x'efb9ab'); +INSERT IGNORE INTO t2 VALUES (1114111, x'f48fbfbf'); +Warnings: +Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column `test`.`t2`.`utf8mb3_encoding` at row 1 +SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE +table_name= 't2' AND column_name= 'utf8mb3_encoding'; +character_maximum_length character_octet_length +10 30 +UPDATE IGNORE t2 SET utf8mb3_encoding= x'f48fbfbd' where u_decimal= 42856; +Warnings: +Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column `test`.`t2`.`utf8mb3_encoding` at row 1 +UPDATE t2 SET utf8mb3_encoding= _utf8mb4 x'ea9da8' where u_decimal= 42856; +SELECT HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8')) FROM t1; +HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8')) +3F3F3F3FEA9DA8 +EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9ABEA9DA8 +F09D8480EA9DA8 +F09D849EEA9DA8 +F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EA9DA8 +F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EA9DA8 +F09D859EEA9DA8 +F09D878FEA9DA8 +F09D9C9FEA9DA8 +F09D9E9FEA9DA8 +F3A087AFEA9DA8 +F48FBFBFEA9DA8 +SELECT HEX(CONCAT(utf8mb4_encoding, utf8mb3_encoding)) FROM t1,t2; +HEX(CONCAT(utf8mb4_encoding, utf8mb3_encoding)) +3F3F3F3F3F3F3F3F +3F3F3F3FEA9DA8 +3F3F3F3FEFB9AB +EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9AB3F3F3F3F +EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9ABEA9DA8 +EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9ABEFB9AB +F09D84803F3F3F3F +F09D8480EA9DA8 +F09D8480EFB9AB +F09D849E3F3F3F3F +F09D849EEA9DA8 +F09D849EEFB9AB +F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D84803F3F3F3F +F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D84803F3F3F3F +F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EA9DA8 +F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EA9DA8 +F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EFB9AB +F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EFB9AB +F09D859E3F3F3F3F +F09D859EEA9DA8 +F09D859EEFB9AB +F09D878F3F3F3F3F +F09D878FEA9DA8 +F09D878FEFB9AB +F09D9C9F3F3F3F3F +F09D9C9FEA9DA8 +F09D9C9FEFB9AB +F09D9E9F3F3F3F3F +F09D9E9FEA9DA8 +F09D9E9FEFB9AB +F3A087AF3F3F3F3F +F3A087AFEA9DA8 +F3A087AFEFB9AB +F48FBFBF3F3F3F3F +F48FBFBFEA9DA8 +F48FBFBFEFB9AB +SELECT count(*) FROM t1, t2 +WHERE t1.utf8mb4_encoding > t2.utf8mb3_encoding; +count(*) +33 +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +ALTER TABLE t1 CONVERT TO CHARACTER SET utf8; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `u_decimal` int(11) NOT NULL, + `utf8mb4_encoding` varchar(10) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 +SELECT u_decimal,hex(utf8mb4_encoding),utf8mb4_encoding FROM t1; +u_decimal hex(utf8mb4_encoding) utf8mb4_encoding +1114111 3F ? +1114111 3F3F3F3F ???? +119040 3F ? +119070 3F ? +119070 3F3F3F3F3F3F3F3F3F3F ?????????? +119070 3F3F3F3F3F3F3F3F3F3F ?????????? +119134 3F ? +119247 3F ? +120607 3F ? +120735 3F ? +65131 EFB9AB3F3F3F3F3FEFB9ABEFB9AB3FEFB9AB ﹫?????﹫﹫?﹫ +917999 3F ? +ALTER TABLE t2 CONVERT TO CHARACTER SET utf8mb4; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `u_decimal` int(11) NOT NULL, + `utf8mb3_encoding` varchar(10) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 +SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; +u_decimal hex(utf8mb3_encoding) +1114111 3F3F3F3F +42856 EA9DA8 +65131 EFB9AB +ALTER TABLE t2 CONVERT TO CHARACTER SET utf8mb3; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `u_decimal` int(11) NOT NULL, + `utf8mb3_encoding` varchar(10) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 +SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; +u_decimal hex(utf8mb3_encoding) +1114111 3F3F3F3F +42856 EA9DA8 +65131 EFB9AB +ALTER TABLE t1 MODIFY utf8mb4_encoding VARCHAR(10) CHARACTER SET utf8mb3; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `u_decimal` int(11) NOT NULL, + `utf8mb4_encoding` varchar(10) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 +SELECT u_decimal,hex(utf8mb4_encoding) FROM t1; +u_decimal hex(utf8mb4_encoding) +1114111 3F +1114111 3F3F3F3F +119040 3F +119070 3F +119070 3F3F3F3F3F3F3F3F3F3F +119070 3F3F3F3F3F3F3F3F3F3F +119134 3F +119247 3F +120607 3F +120735 3F +65131 EFB9AB3F3F3F3F3FEFB9ABEFB9AB3FEFB9AB +917999 3F +ALTER TABLE t1 MODIFY utf8mb4_encoding VARCHAR(10) CHARACTER SET utf8mb4; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `u_decimal` int(11) NOT NULL, + `utf8mb4_encoding` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 +SELECT u_decimal,hex(utf8mb4_encoding) FROM t1; +u_decimal hex(utf8mb4_encoding) +1114111 3F +1114111 3F3F3F3F +119040 3F +119070 3F +119070 3F3F3F3F3F3F3F3F3F3F +119070 3F3F3F3F3F3F3F3F3F3F +119134 3F +119247 3F +120607 3F +120735 3F +65131 EFB9AB3F3F3F3F3FEFB9ABEFB9AB3FEFB9AB +917999 3F +ALTER TABLE t2 MODIFY utf8mb3_encoding VARCHAR(10) CHARACTER SET utf8mb4; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `u_decimal` int(11) NOT NULL, + `utf8mb3_encoding` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 +SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; +u_decimal hex(utf8mb3_encoding) +1114111 3F3F3F3F +42856 EA9DA8 +65131 EFB9AB +DROP TABLE IF EXISTS t3; +CREATE TABLE t3 ( +u_decimal int NOT NULL, +utf8mb3_encoding VARCHAR(10) NOT NULL +) CHARACTER SET utf8 ENGINE InnoDB; +INSERT INTO t3 SELECT * FROM t1; +DROP TABLE IF EXISTS t4; +CREATE TABLE t4 ( +u_decimal int NOT NULL, +utf8mb4_encoding VARCHAR(10) NOT NULL +) CHARACTER SET utf8mb4 ENGINE InnoDB; +INSERT INTO t3 SELECT * FROM t2; +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +DROP TABLE t4; +# +# Testing that mixing utf8 and utf8mb4 collations returns utf8mb4 +# +SELECT CHARSET(CONCAT(_utf8mb4'a',_utf8'b')); +CHARSET(CONCAT(_utf8mb4'a',_utf8'b')) +utf8mb4 +CREATE TABLE t1 (utf8mb4 VARCHAR(10) CHARACTER SET utf8mb4 NOT NULL) ENGINE InnoDB; +INSERT INTO t1 VALUES (x'ea9da8'),(x'f48fbfbf'); +SELECT CONCAT(utf8mb4, _utf8 x'ea9da8') FROM t1 LIMIT 0; +CONCAT(utf8mb4, _utf8 x'ea9da8') +CREATE TABLE t2 (utf8mb3 VARCHAR(10) CHARACTER SET utf8mb3 NOT NULL) ENGINE InnoDB; +INSERT INTO t2 VALUES (x'ea9da8'); +SELECT HEX(CONCAT(utf8mb4, utf8mb3)) FROM t1,t2 ORDER BY 1; +HEX(CONCAT(utf8mb4, utf8mb3)) +EA9DA8EA9DA8 +F48FBFBFEA9DA8 +SELECT CHARSET(CONCAT(utf8mb4, utf8mb3)) FROM t1, t2 LIMIT 1; +CHARSET(CONCAT(utf8mb4, utf8mb3)) +utf8mb4 +CREATE TEMPORARY TABLE t3 ENGINE InnoDB AS SELECT *, concat(utf8mb4,utf8mb3) FROM t1, t2; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TEMPORARY TABLE `t3` ( + `utf8mb4` varchar(10) CHARACTER SET utf8mb4 NOT NULL, + `utf8mb3` varchar(10) CHARACTER SET utf8 NOT NULL, + `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TEMPORARY TABLE t3; +SELECT * FROM t1, t2 WHERE t1.utf8mb4 > t2.utf8mb3; +utf8mb4 utf8mb3 + Ꝩ +SELECT * FROM t1, t2 WHERE t1.utf8mb4 = t2.utf8mb3; +utf8mb4 utf8mb3 +Ꝩ Ꝩ +SELECT * FROM t1, t2 WHERE t1.utf8mb4 < t2.utf8mb3; +utf8mb4 utf8mb3 +DROP TABLE t1; +DROP TABLE t2; +# +# Check that mixing utf8mb4 with an invalid utf8 constant returns error +# +CREATE TABLE t1 (utf8mb4 VARCHAR(10) CHARACTER SET utf8mb4) ENGINE InnoDB; +INSERT INTO t1 VALUES (x'f48fbfbf'); +SELECT CONCAT(utf8mb4, _utf8 '�') FROM t1; +ERROR HY000: Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'concat' +SELECT CONCAT('a', _utf8 '�') FROM t1; +ERROR HY000: Illegal mix of collations (utf8mb4_general_ci,COERCIBLE) and (utf8_general_ci,COERCIBLE) for operation 'concat' +DROP TABLE t1; +# +# End of 5.5 tests +# +# +# ctype_utf8mb4.inc: Start of 10.1 tests +# +# +# MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character" +# +CREATE TABLE t1 ( +id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +a VARCHAR(10) CHARACTER SET utf8mb4, KEY(a,id) +); +INSERT INTO t1 (a) VALUES (0x61); +INSERT INTO t1 (a) VALUES (0xC280),(0xDFBF); +INSERT INTO t1 (a) VALUES (0xE0A080),(0xEFBFBF); +INSERT INTO t1 (a) VALUES (0xF0908080),(0xF48FBFBF); +SELECT id,HEX(a) FROM t1 ORDER BY a,id; +id HEX(a) +1 61 +2 C280 +3 DFBF +4 E0A080 +6 F0908080 +7 F48FBFBF +5 EFBFBF +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +id HEX(a) +5 EFBFBF +7 F48FBFBF +6 F0908080 +4 E0A080 +3 DFBF +2 C280 +1 61 +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +6 +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; +SELECT id,HEX(a) FROM t1 ORDER BY a; +id HEX(a) +1 61 +2 C280 +3 DFBF +4 E0A080 +5 EFBFBF +6 F0908080 +7 F48FBFBF +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +id HEX(a) +7 F48FBFBF +6 F0908080 +5 EFBFBF +4 E0A080 +3 DFBF +2 C280 +1 61 +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +7 +DROP TABLE t1; +# +# ctype_utf8mb4.inc: End of 10.1 tests +# +# +# End of ctype_utf8mb4.inc +# diff --cc mysql-test/main/ctype_utf8mb4_myisam.result index 0bd13ef0282,00000000000..67eef5856ec mode 100644,000000..100644 --- a/mysql-test/main/ctype_utf8mb4_myisam.result +++ b/mysql-test/main/ctype_utf8mb4_myisam.result @@@ -1,2719 -1,0 +1,2731 @@@ +drop table if exists t1,t2; +# +# Start of 5.5 tests +# +set names utf8mb4; +select left(_utf8mb4 0xD0B0D0B1D0B2,1); +left(_utf8mb4 0xD0B0D0B1D0B2,1) +а +select right(_utf8mb4 0xD0B0D0B2D0B2,1); +right(_utf8mb4 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 utf8mb4_bin); +locate('HE','hello' collate utf8mb4_bin) +0 +select locate('HE','hello' collate utf8mb4_bin,2); +locate('HE','hello' collate utf8mb4_bin,2) +0 +select locate('LO','hello' collate utf8mb4_bin,2); +locate('LO','hello' collate utf8mb4_bin,2) +0 +select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D0B1D0B2); +locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D0B1D0B2) +2 +select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2); +locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2) +2 +select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2); +locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2) +2 +select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2 collate utf8mb4_bin); +locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2 collate utf8mb4_bin) +0 +select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2 collate utf8mb4_bin); +locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2 collate utf8mb4_bin) +0 +select length(_utf8mb4 0xD0B1), bit_length(_utf8mb4 0xD0B1), char_length(_utf8mb4 0xD0B1); +length(_utf8mb4 0xD0B1) bit_length(_utf8mb4 0xD0B1) char_length(_utf8mb4 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 utf8mb4_bin; +'A' like 'a' collate utf8mb4_bin +0 +select _utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4 '%'); +_utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4 '%') +1 +select convert(_latin1'G�nter Andr�' using utf8mb4) like CONVERT(_latin1'G�NTER%' USING utf8mb4); +convert(_latin1'G?nter Andr?' using utf8mb4) like CONVERT(_latin1'G?NTER%' USING utf8mb4) +1 +select CONVERT(_koi8r'����' USING utf8mb4) LIKE CONVERT(_koi8r'����' USING utf8mb4); +CONVERT(_koi8r'????' USING utf8mb4) LIKE CONVERT(_koi8r'????' USING utf8mb4) +1 +select CONVERT(_koi8r'����' USING utf8mb4) LIKE CONVERT(_koi8r'����' USING utf8mb4); +CONVERT(_koi8r'????' USING utf8mb4) LIKE CONVERT(_koi8r'????' USING utf8mb4) +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 utf8mb4_bin; +'a' = 'a ' collate utf8mb4_bin +1 +SELECT 'a\0' < 'a' collate utf8mb4_bin; +'a\0' < 'a' collate utf8mb4_bin +1 +SELECT 'a\0' < 'a ' collate utf8mb4_bin; +'a\0' < 'a ' collate utf8mb4_bin +1 +SELECT 'a\t' < 'a' collate utf8mb4_bin; +'a\t' < 'a' collate utf8mb4_bin +1 +SELECT 'a\t' < 'a ' collate utf8mb4_bin; +'a\t' < 'a ' collate utf8mb4_bin +1 +CREATE TABLE t1 (a char(10) character set utf8mb4 not null) ENGINE MyISAM; +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 +61 0 0 +6100 -1 -1 +6109 -1 -1 +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 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 ENGINE MyISAM 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")` varchar(10) CHARACTER SET utf8mb4 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 utf8mb4; +set LC_TIME_NAMES='fr_FR'; +create table t1 (s1 char(20) character set latin1) engine MyISAM; +insert into t1 values (date_format('2004-02-02','%M')); +select hex(s1) from t1; +hex(s1) +66E97672696572 +drop table t1; +create table t1 (s1 char(20) character set koi8r) engine MyISAM; +set LC_TIME_NAMES='ru_RU'; +insert into t1 values (date_format('2004-02-02','%M')); +insert into t1 values (date_format('2004-02-02','%b')); +insert into t1 values (date_format('2004-02-02','%W')); +insert into t1 values (date_format('2004-02-02','%a')); +select hex(s1), s1 from t1; +hex(s1) s1 +E6C5D7 Фев +E6C5D7D2C1CCD1 Февраля +F0CEC4 Пнд +F0CFCEC5C4C5CCD8CEC9CB Понедельник +drop table t1; +set LC_TIME_NAMES='en_US'; +set names koi8r; +create table t1 (s1 char(1) character set utf8mb4) engine MyISAM; +insert ignore 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 utf8mb4) engine MyISAM; +insert ignore into t1 select repeat('a',300); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +insert ignore into t1 select repeat('�',300); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +insert ignore into t1 select repeat('a�',300); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +insert ignore into t1 select repeat('�a',300); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +insert ignore into t1 select repeat('��',300); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +select hex(s1) from t1; +hex(s1) +616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161 +61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F +D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61D18F61 +D18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18F +D18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18FD18F +select length(s1),char_length(s1) from t1; +length(s1) char_length(s1) +254 127 +254 127 +255 170 +255 170 +255 255 +drop table t1; +create table t1 (s1 text character set utf8mb4) engine MyISAM; +insert ignore into t1 select repeat('a',66000); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +insert ignore into t1 select repeat('�',66000); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +insert ignore into t1 select repeat('a�',66000); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +insert ignore into t1 select repeat('�a',66000); +Warnings: +Warning 1265 Data truncated for column 's1' at row 1 +insert ignore 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) +65534 32767 +65534 32767 +65535 43690 +65535 43690 +65535 65535 +drop table t1; +create table t1 (s1 char(10) character set utf8mb4) engine MyISAM; +insert ignore into t1 values (0x41FF); +Warnings: +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1 +select hex(s1) from t1; +hex(s1) +413F +drop table t1; +create table t1 (s1 varchar(10) character set utf8mb4) engine MyISAM; +insert ignore into t1 values (0x41FF); +Warnings: +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1 +select hex(s1) from t1; +hex(s1) +413F +drop table t1; +create table t1 (s1 text character set utf8mb4) engine MyISAM; +insert ignore into t1 values (0x41FF); +Warnings: +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1 +select hex(s1) from t1; +hex(s1) +413F +drop table t1; +create table t1 (a text character set utf8mb4, primary key(a(371))) engine MyISAM; +show warnings; +Level Code Message +Error 1071 Specified key was too long; max key length is 1000 bytes +drop table if exists t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1 ( a varchar(10) ) CHARACTER SET utf8mb4 ENGINE MyISAM; +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 utf8mb4) engine MyISAM; +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 utf8mb4; +drop table if exists t1; +create table t1 as +select repeat(' ', 64) as s1, repeat(' ',64) as s2 +union +select null, null; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `s1` varchar(64) CHARACTER SET utf8mb4 DEFAULT NULL, + `s2` varchar(64) CHARACTER SET utf8mb4 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +delete from t1; +insert into t1 values('aaa','aaa'); +insert into t1 values('aaa|qqq','qqq'); +insert into t1 values('gheis','^[^a-dXYZ]+$'); +insert into t1 values('aab','^aa?b'); +insert into t1 values('Baaan','^Ba*n'); +insert into t1 values('aaa','qqq|aaa'); +insert into t1 values('qqq','qqq|aaa'); +insert into t1 values('bbb','qqq|aaa'); +insert into t1 values('bbb','qqq'); +insert into t1 values('aaa','aba'); +insert into t1 values(null,'abc'); +insert into t1 values('def',null); +insert into t1 values(null,null); +insert into t1 values('ghi','ghi['); +select HIGH_PRIORITY s1 regexp s2 from t1; +s1 regexp s2 +0 +0 +0 +1 +1 +1 +1 +1 +1 +1 +NULL +NULL +NULL +NULL +drop table t1; +SELECT @@character_set_client, @@collation_connection; +@@character_set_client @@collation_connection +utf8mb4 utf8mb4_general_ci +select 'вася' rlike '\\bвася\\b'; +'вася' rlike '\\bвася\\b' +1 +select 'вася ' rlike '\\bвася\\b'; +'вася ' rlike '\\bвася\\b' +1 +select ' вася' rlike '\\bвася\\b'; +' вася' rlike '\\bвася\\b' +1 +select ' вася ' rlike '\\bвася\\b'; +' вася ' rlike '\\bвася\\b' +1 +select 'вася' rlike '[[:<:]]вася[[:>:]]'; +'вася' rlike '[[:<:]]вася[[:>:]]' +1 +select 'вася ' rlike '[[:<:]]вася[[:>:]]'; +'вася ' rlike '[[:<:]]вася[[:>:]]' +1 +select ' вася' rlike '[[:<:]]вася[[:>:]]'; +' вася' rlike '[[:<:]]вася[[:>:]]' +1 +select ' вася ' rlike '[[:<:]]вася[[:>:]]'; +' вася ' rlike '[[:<:]]вася[[:>:]]' +1 +select 'васяz' rlike '\\bвася\\b'; +'васяz' rlike '\\bвася\\b' +0 +select 'zвася' rlike '\\bвася\\b'; +'zвася' rlike '\\bвася\\b' +0 +select 'zвасяz' rlike '\\bвася\\b'; +'zвасяz' rlike '\\bвася\\b' +0 +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 utf8mb4_unicode_ci) ENGINE MyISAM; +ALTER TABLE t1 ADD COLUMN b CHAR(20); +DROP TABLE t1; +set names utf8mb4; +create table t1 (a enum('aaaa','проба') character set utf8mb4) engine MyISAM; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` enum('aaaa','проба') CHARACTER SET utf8mb4 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('проба'); +select * from t1; +a +проба +create table t2 engine MyISAM select ifnull(a,a) from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ifnull(a,a)` varchar(5) CHARACTER SET utf8mb4 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 utf8mb4, unique(c(10))) engine MyISAM; +insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z'); +insert into t1 values ('aaaaaaaaaa'); +insert into t1 values ('aaaaaaaaaaa'); +ERROR 23000: Duplicate entry 'aaaaaaaaaa' for key 'c' +insert into t1 values ('aaaaaaaaaaaa'); +ERROR 23000: Duplicate entry 'aaaaaaaaaa' for key 'c' +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 utf8mb4, unique(c(10))) engine=MyISAM; +insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z'); +insert into t1 values ('aaaaaaaaaa'); +insert into t1 values ('aaaaaaaaaaa'); +ERROR 23000: Duplicate entry 'aaaaaaaaaa' for key 'c' +insert into t1 values ('aaaaaaaaaaaa'); +ERROR 23000: Duplicate entry 'aaaaaaaaaa' for key 'c' +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 utf8mb4, unique (c(2))) engine MyISAM; +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 'aa' for key 'c' +insert into t1 values ('b'); +insert into t1 values ('bb'); +insert into t1 values ('bbb'); +ERROR 23000: Duplicate entry 'bb' for key 'c' +insert into t1 values ('а'); +insert into t1 values ('аа'); +insert into t1 values ('ааа'); +ERROR 23000: Duplicate entry 'аа' for key 'c' +insert into t1 values ('б'); +insert into t1 values ('бб'); +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'бб' for key 'c' +insert into t1 values ('ꪪ'); +insert into t1 values ('ꪪꪪ'); +insert into t1 values ('ꪪꪪꪪ'); +ERROR 23000: Duplicate entry 'ꪪꪪ' for key 'c' +drop table t1; +create table t1 (c char(3) character set utf8mb4, unique (c(2))) engine=MyISAM; +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 'aa' for key 'c' +insert into t1 values ('b'); +insert into t1 values ('bb'); +insert into t1 values ('bbb'); +ERROR 23000: Duplicate entry 'bb' for key 'c' +insert into t1 values ('а'); +insert into t1 values ('аа'); +insert into t1 values ('ааа'); +ERROR 23000: Duplicate entry 'аа' for key 'c' +insert into t1 values ('б'); +insert into t1 values ('бб'); +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'бб' for key 'c' +insert into t1 values ('ꪪ'); +insert into t1 values ('ꪪꪪ'); +insert into t1 values ('ꪪꪪꪪ'); +ERROR 23000: Duplicate entry 'ꪪꪪ' for key 'c' +drop table t1; +create table t1 ( +c char(10) character set utf8mb4, +unique key a using hash (c(1)) +) engine=MyISAM; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(10) CHARACTER SET utf8mb4 DEFAULT NULL, + UNIQUE KEY `a` (`c`(1)) USING HASH +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +insert into t1 values ('aa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('aaa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('б'); +insert into t1 values ('бб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +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 utf8mb4, +unique key a using btree (c(1)) +) engine=MyISAM; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(10) CHARACTER SET utf8mb4 DEFAULT NULL, + UNIQUE KEY `a` (`c`(1)) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +insert into t1 values ('aa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('aaa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('б'); +insert into t1 values ('бб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +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 utf8mb4, +unique key a (c(1)) +) engine=MyISAM; +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +insert into t1 values ('aa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('aaa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('б'); +insert into t1 values ('бб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +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 utf8mb4 collate utf8mb4_bin, unique(c(10))) engine MyISAM; +insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z'); +insert into t1 values ('aaaaaaaaaa'); +insert into t1 values ('aaaaaaaaaaa'); +ERROR 23000: Duplicate entry 'aaaaaaaaaa' for key 'c' +insert into t1 values ('aaaaaaaaaaaa'); +ERROR 23000: Duplicate entry 'aaaaaaaaaa' for key 'c' +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 utf8mb4 collate utf8mb4_bin, unique (c(2))) engine MyISAM; +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 'aa' for key 'c' +insert into t1 values ('b'); +insert into t1 values ('bb'); +insert into t1 values ('bbb'); +ERROR 23000: Duplicate entry 'bb' for key 'c' +insert into t1 values ('а'); +insert into t1 values ('аа'); +insert into t1 values ('ааа'); +ERROR 23000: Duplicate entry 'аа' for key 'c' +insert into t1 values ('б'); +insert into t1 values ('бб'); +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'бб' for key 'c' +insert into t1 values ('ꪪ'); +insert into t1 values ('ꪪꪪ'); +insert into t1 values ('ꪪꪪꪪ'); +ERROR 23000: Duplicate entry 'ꪪꪪ' for key 'c' +drop table t1; +create table t1 ( +c char(10) character set utf8mb4 collate utf8mb4_bin, +unique key a using hash (c(1)) +) engine=MyISAM; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, + UNIQUE KEY `a` (`c`(1)) USING HASH +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +insert into t1 values ('aa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('aaa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('б'); +insert into t1 values ('бб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +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 utf8mb4 collate utf8mb4_bin, +unique key a using btree (c(1)) +) engine=MyISAM; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, + UNIQUE KEY `a` (`c`(1)) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +insert into t1 values ('aa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('aaa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('б'); +insert into t1 values ('бб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +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 utf8mb4 collate utf8mb4_bin, +unique key a (c(1)) +) engine=MyISAM; +insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); +insert into t1 values ('aa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('aaa'); +ERROR 23000: Duplicate entry 'a' for key 'a' +insert into t1 values ('б'); +insert into t1 values ('бб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +insert into t1 values ('ббб'); +ERROR 23000: Duplicate entry 'б' for key 'a' +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 utf8mb4 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 utf8mb4 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 utf8mb4 not null, +key str using btree (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 utf8mb4 not null, +key str using hash (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 utf8mb4 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 (a varchar(32) BINARY) CHARACTER SET utf8mb4 ENGINE MyISAM; +INSERT INTO t1 VALUES ('test'); +SELECT a FROM t1 WHERE a LIKE '%te'; +a +DROP TABLE t1; +SET NAMES utf8mb4; +CREATE TABLE t1 ( +subject varchar(255) character set utf8mb4 collate utf8mb4_unicode_ci, +p varchar(15) character set utf8mb4 +) ENGINE= MyISAM DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES ('谷川俊二と申しますが、インターネット予約の会員登録をしましたところ、メールアドレスを間違えてしまい会員IDが受け取ることが出来ませんでした。間違えアドレスはtani-shun@n.vodafone.ne.jpを書き込みました。どうすればよいですか? その他、住所等は間違えありません。連絡ください。よろしくお願いします。m(__)m','040312-000057'); +INSERT INTO t1 VALUES ('aaa','bbb'); +SELECT length(subject) FROM t1; +length(subject) +3 +432 +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=utf8mb4; +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=utf8mb4; +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 utf8mb4; +create table t1 ( +a int primary key, +b varchar(6), +index b3(b(3)) +) engine=MyISAM character set=utf8mb4; +insert into t1 values(1,'foo'),(2,'foobar'); +select * from t1 where b like 'foob%'; +a b +2 foobar +alter table t1 engine=innodb; +select * from t1 where b like 'foob%'; +a b +2 foobar +drop table t1; +create table t1 ( +a enum('петя','вася','анюта') character set utf8mb4 not null default 'анюта', +b set('петя','вася','анюта') character set utf8mb4 not null default 'анюта' +) engine MyISAM; +create table t2 engine MyISAM select concat(a,_utf8mb4'') as a, concat(b,_utf8mb4'')as b from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` varchar(5) CHARACTER SET utf8mb4 DEFAULT NULL, + `b` varchar(15) CHARACTER SET utf8mb4 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t2; +drop table t1; +select 'c' like '\_' as want0; +want0 +0 +SELECT SUBSTR('вася',-2); +SUBSTR('вася',-2) +ся +create table t1 (id integer, a varchar(100) character set utf8mb4 collate utf8mb4_unicode_ci) engine MyISAM; +insert into t1 values (1, 'Test'); +select * from t1 where soundex(a) = soundex('Test'); +id a +1 Test +select * from t1 where soundex(a) = soundex('TEST'); +id a +1 Test +select * from t1 where soundex(a) = soundex('test'); +id a +1 Test +drop table t1; +select soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB); +soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB) +阅000 +select hex(soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)); +hex(soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)) +E99885303030 +select soundex(_utf8mb4 0xD091D092D093); +soundex(_utf8mb4 0xD091D092D093) +Б000 +select hex(soundex(_utf8mb4 0xD091D092D093)); +hex(soundex(_utf8mb4 0xD091D092D093)) +D091303030 +SET collation_connection='utf8mb4_general_ci'; +create table t1 select repeat('a',4000) a; +delete from t1; +insert into t1 values ('a'), ('a '), ('a\t'); +select collation(a),hex(a) from t1 order by a; +collation(a) hex(a) +utf8mb4_general_ci 6109 +utf8mb4_general_ci 61 +utf8mb4_general_ci 6120 +drop table t1; +# +# MDEV-5453 Assertion `src' fails in my_strnxfrm_unicode on GROUP BY MID(..) WITH ROLLUP +# +SELECT @@collation_connection; +@@collation_connection +utf8mb4_general_ci +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +SELECT * FROM t1 GROUP BY MID(CURRENT_USER,0) WITH ROLLUP; +i +1 +1 +SELECT * FROM t1 GROUP BY MID('test',0) WITH ROLLUP; +i +1 +1 +DROP TABLE t1; +# +# MDEV-6170 Incorrect ordering with utf8_bin and utf8mb4_bin collations +# +SELECT @@collation_connection; +@@collation_connection +utf8mb4_general_ci +CREATE TABLE t1 ENGINE=MEMORY AS SELECT REPEAT('a',5) AS a LIMIT 0; +INSERT INTO t1 (a) VALUES ("a"); +INSERT INTO t1 (a) VALUES ("b"); +INSERT INTO t1 (a) VALUES ("c"); +INSERT INTO t1 (a) VALUES ("d"); +INSERT INTO t1 (a) VALUES ("e"); +INSERT INTO t1 (a) VALUES ("f"); +INSERT INTO t1 (a) VALUES ("g"); +INSERT INTO t1 (a) VALUES ("h"); +INSERT INTO t1 (a) VALUES ("i"); +INSERT INTO t1 (a) VALUES ("j"); +INSERT INTO t1 (a) VALUES ("k"); +INSERT INTO t1 (a) VALUES ("l"); +INSERT INTO t1 (a) VALUES ("m"); +SELECT * FROM t1 ORDER BY LOWER(a); +a +a +b +c +d +e +f +g +h +i +j +k +l +m +SELECT * FROM t1 ORDER BY LOWER(a) DESC; +a +m +l +k +j +i +h +g +f +e +d +c +b +a +DROP TABLE t1; +select @@collation_connection; +@@collation_connection +utf8mb4_general_ci +create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ; +insert into t1 values('abcdef'); +insert into t1 values('_bcdef'); +insert into t1 values('a_cdef'); +insert into t1 values('ab_def'); +insert into t1 values('abc_ef'); +insert into t1 values('abcd_f'); +insert into t1 values('abcde_'); +select c1 as c1u from t1 where c1 like 'ab\_def'; +c1u +ab_def +select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; +c2h +ab_def +drop table t1; ++SELECT @@collation_connection; ++@@collation_connection ++utf8mb4_general_ci ++SELECT '\%b' LIKE '%\%'; ++'\%b' LIKE '%\%' ++0 +"BEGIN ctype_german.inc" +drop table if exists t1; +create table t1 as select repeat(' ', 64) as s1; +select collation(s1) from t1; +collation(s1) +utf8mb4_general_ci +delete from t1; +INSERT INTO t1 VALUES ('ud'),('uf'); +INSERT INTO t1 VALUES ('od'),('of'); +INSERT INTO t1 VALUES ('e'); +INSERT INTO t1 VALUES ('ad'),('af'); +insert into t1 values ('a'),('ae'),(_latin1 0xE4); +insert into t1 values ('o'),('oe'),(_latin1 0xF6); +insert into t1 values ('s'),('ss'),(_latin1 0xDF); +insert into t1 values ('u'),('ue'),(_latin1 0xFC); +INSERT INTO t1 VALUES (_latin1 0xE6), (_latin1 0xC6); +INSERT INTO t1 VALUES (_latin1 0x9C), (_latin1 0x8C); +select s1, hex(s1) from t1 order by s1, binary s1; +s1 hex(s1) +a 61 +ä C3A4 +ad 6164 +ae 6165 +af 6166 +e 65 +o 6F +ö C3B6 +od 6F64 +oe 6F65 +of 6F66 +s 73 +ß C39F +ss 7373 +u 75 +ü C3BC +ud 7564 +ue 7565 +uf 7566 +Æ C386 +æ C3A6 +Œ C592 +œ C593 +select group_concat(s1 order by binary s1) from t1 group by s1; +group_concat(s1 order by binary s1) +a,ä +ad +ae +af +e +o,ö +od +oe +of +s,ß +ss +u,ü +ud +ue +uf +Æ,æ +Œ,œ +SELECT s1, hex(s1), hex(weight_string(s1)) FROM t1 ORDER BY s1, BINARY(s1); +s1 hex(s1) hex(weight_string(s1)) +a 61 0041 +ä C3A4 0041 +ad 6164 00410044 +ae 6165 00410045 +af 6166 00410046 +e 65 0045 +o 6F 004F +ö C3B6 004F +od 6F64 004F0044 +oe 6F65 004F0045 +of 6F66 004F0046 +s 73 0053 +ß C39F 0053 +ss 7373 00530053 +u 75 0055 +ü C3BC 0055 +ud 7564 00550044 +ue 7565 00550045 +uf 7566 00550046 +Æ C386 00C6 +æ C3A6 00C6 +Œ C592 0152 +œ C593 0152 +SELECT s1, hex(s1) FROM t1 WHERE s1='ae' ORDER BY s1, BINARY(s1); +s1 hex(s1) +ae 6165 +drop table t1; +CREATE TABLE t1 AS SELECT REPEAT('a',1) AS a, 1 AS b LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(1) CHARACTER SET utf8mb4 DEFAULT NULL, + `b` int(1) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('s',0),(_latin1 0xDF,1); +SELECT * FROM t1 ORDER BY a, b; +a b +s 0 +ß 1 +SELECT * FROM t1 ORDER BY a DESC, b; +a b +s 0 +ß 1 +SELECT * FROM t1 ORDER BY CONCAT(a), b; +a b +s 0 +ß 1 +SELECT * FROM t1 ORDER BY CONCAT(a) DESC, b; +a b +s 0 +ß 1 +DROP TABLE t1; +"END ctype_german.inc" +SET collation_connection='utf8mb4_bin'; +create table t1 select repeat('a',4000) a; +delete from t1; +insert into t1 values ('a'), ('a '), ('a\t'); +select collation(a),hex(a) from t1 order by a; +collation(a) hex(a) +utf8mb4_bin 6109 +utf8mb4_bin 61 +utf8mb4_bin 6120 +drop table t1; +# +# MDEV-5453 Assertion `src' fails in my_strnxfrm_unicode on GROUP BY MID(..) WITH ROLLUP +# +SELECT @@collation_connection; +@@collation_connection +utf8mb4_bin +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +SELECT * FROM t1 GROUP BY MID(CURRENT_USER,0) WITH ROLLUP; +i +1 +1 +SELECT * FROM t1 GROUP BY MID('test',0) WITH ROLLUP; +i +1 +1 +DROP TABLE t1; +# +# MDEV-6170 Incorrect ordering with utf8_bin and utf8mb4_bin collations +# +SELECT @@collation_connection; +@@collation_connection +utf8mb4_bin +CREATE TABLE t1 ENGINE=MEMORY AS SELECT REPEAT('a',5) AS a LIMIT 0; +INSERT INTO t1 (a) VALUES ("a"); +INSERT INTO t1 (a) VALUES ("b"); +INSERT INTO t1 (a) VALUES ("c"); +INSERT INTO t1 (a) VALUES ("d"); +INSERT INTO t1 (a) VALUES ("e"); +INSERT INTO t1 (a) VALUES ("f"); +INSERT INTO t1 (a) VALUES ("g"); +INSERT INTO t1 (a) VALUES ("h"); +INSERT INTO t1 (a) VALUES ("i"); +INSERT INTO t1 (a) VALUES ("j"); +INSERT INTO t1 (a) VALUES ("k"); +INSERT INTO t1 (a) VALUES ("l"); +INSERT INTO t1 (a) VALUES ("m"); +SELECT * FROM t1 ORDER BY LOWER(a); +a +a +b +c +d +e +f +g +h +i +j +k +l +m +SELECT * FROM t1 ORDER BY LOWER(a) DESC; +a +m +l +k +j +i +h +g +f +e +d +c +b +a +DROP TABLE t1; +select @@collation_connection; +@@collation_connection +utf8mb4_bin +create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ; +insert into t1 values('abcdef'); +insert into t1 values('_bcdef'); +insert into t1 values('a_cdef'); +insert into t1 values('ab_def'); +insert into t1 values('abc_ef'); +insert into t1 values('abcd_f'); +insert into t1 values('abcde_'); +select c1 as c1u from t1 where c1 like 'ab\_def'; +c1u +ab_def +select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; +c2h +ab_def +drop table t1; ++SELECT @@collation_connection; ++@@collation_connection ++utf8mb4_bin ++SELECT '\%b' LIKE '%\%'; ++'\%b' LIKE '%\%' ++0 +CREATE TABLE t1 ( +user varchar(255) NOT NULL default '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES ('one'),('two'); +SELECT CHARSET('a'); +CHARSET('a') +utf8mb4 +SELECT user, CONCAT('<', user, '>') AS c FROM t1; +user c +one <one> +two <two> +DROP TABLE t1; +create table t1 (f1 varchar(1) not null) default charset utf8mb4 engine MyISAM; +insert into t1 values (''), (''); +select concat(concat(_latin1'->',f1),_latin1'<-') from t1; +concat(concat(_latin1'->',f1),_latin1'<-') +-><- +-><- +drop table t1; +select convert(_koi8r'�' using utf8mb4) < convert(_koi8r'�' using utf8mb4); +convert(_koi8r'?' using utf8mb4) < convert(_koi8r'?' using utf8mb4) +1 +set names latin1; +create table t1 (a varchar(10)) character set utf8mb4 engine MyISAM; +insert into t1 values ('test'); +select ifnull(a,'') from t1; +ifnull(a,'') +test +drop table t1; +select repeat(_utf8mb4'+',3) as h union select NULL; +h ++++ +NULL +select ifnull(NULL, _utf8mb4'string'); +ifnull(NULL, _utf8mb4'string') +string +set names utf8mb4; +create table t1 (s1 char(5) character set utf8mb4 collate utf8mb4_lithuanian_ci) engine MyISAM; +insert into t1 values ('I'),('K'),('Y'); +select * from t1 where s1 < 'K' and s1 = 'Y'; +s1 +I +Y +select * from t1 where 'K' > s1 and s1 = 'Y'; +s1 +I +Y +drop table t1; +create table t1 (s1 char(5) character set utf8mb4 collate utf8mb4_czech_ci) engine MyISAM; +insert into t1 values ('c'),('d'),('h'),('ch'),('CH'),('cH'),('Ch'),('i'); +select * from t1 where s1 > 'd' and s1 = 'CH'; +s1 +CH +Ch +ch +select * from t1 where 'd' < s1 and s1 = 'CH'; +s1 +CH +Ch +ch +select * from t1 where s1 = 'cH' and s1 <> 'ch'; +s1 +cH +select * from t1 where 'cH' = s1 and s1 <> 'ch'; +s1 +cH +drop table t1; +create table t1 (a varchar(255)) default character set utf8mb4 engine MyISAM; +insert into t1 values (1.0); +drop table t1; +create table t1 ( +id int not null, +city varchar(20) not null, +key (city(7),id) +) character set=utf8mb4 engine MyISAM; +insert into t1 values (1,'Durban North'); +insert into t1 values (2,'Durban'); +select * from t1 where city = 'Durban'; +id city +2 Durban +select * from t1 where city = 'Durban '; +id city +2 Durban +drop table t1; +create table t1 (x set('A', 'B') default 0) character set utf8mb4 engine MyISAM; +ERROR 42000: Invalid default value for 'x' +create table t1 (x enum('A', 'B') default 0) character set utf8mb4 engine MyISAM; +ERROR 42000: Invalid default value for 'x' +SET NAMES UTF8; +CREATE TABLE t1 ( +`id` int(20) NOT NULL auto_increment, +`country` varchar(100) NOT NULL default '', +`shortcode` varchar(100) NOT NULL default '', +`operator` varchar(100) NOT NULL default '', +`momid` varchar(30) NOT NULL default '', +`keyword` varchar(160) NOT NULL default '', +`content` varchar(160) NOT NULL default '', +`second_token` varchar(160) default NULL, +`gateway_id` int(11) NOT NULL default '0', +`created` datetime NOT NULL default '0000-00-00 00:00:00', +`msisdn` varchar(15) NOT NULL default '', +PRIMARY KEY (`id`), +UNIQUE KEY `MSCCSPK_20030521130957121` (`momid`), +KEY `IX_mobile_originated_message_keyword` (`keyword`), +KEY `IX_mobile_originated_message_created` (`created`), +KEY `IX_mobile_originated_message_support` (`msisdn`,`momid`,`keyword`,`gateway_id`,`created`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; +INSERT INTO t1 VALUES +(1,'blah','464','aaa','fkc1c9ilc20x0hgae7lx6j09','ERR','ERR Имри.Афимим.Аеимимримдмримрмрирор имримримримр имридм ирбднримрфмририримрфмфмим.Ад.Д имдимримрад.Адимримримрмдиримримримр м.Дадимфшьмримд им.Адимимрн имадми','ИМРИ.АФИМИМ.АЕИМИМРИМДМРИМРМРИРОР',3,'2005-06-01 17:30:43','1234567890'), +(2,'blah','464','aaa','haxpl2ilc20x00bj4tt2m5ti','11','11 g','G',3,'2005-06-02 22:43:10','1234567890'); +CREATE TABLE t2 ( +`msisdn` varchar(15) NOT NULL default '', +`operator_id` int(11) NOT NULL default '0', +`created` datetime NOT NULL default '0000-00-00 00:00:00', +UNIQUE KEY `PK_user` (`msisdn`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; +INSERT INTO t2 VALUES ('1234567890',2,'2005-05-24 13:53:25'); +SELECT content, t2.msisdn FROM t1, t2 WHERE t1.msisdn = '1234567890'; +content msisdn +ERR Имри.Афимим.Аеимимримдмримрмрирор имримримримр имридм ирбднримрфмририримрфмфмим.Ад.Д имдимримрад.Адимримримрмдиримримримр м.Дадимфшьмримд им.Адимимрн имадми 1234567890 +11 g 1234567890 +DROP TABLE t1,t2; +create table t1 (a char(20) character set utf8mb4) engine MyISAM; +insert into t1 values ('123456'),('андрей'); +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +alter table t1 modify a char(2) character set utf8mb4; +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +Warning 1265 Data truncated for column 'a' at row 2 +select char_length(a), length(a), a from t1 order by a; +char_length(a) length(a) a +2 2 12 +2 4 ан +drop table t1; +set names utf8mb4; +select 'andre%' like 'andreñ%' escape 'ñ'; +'andre%' like 'andreñ%' escape 'ñ' +1 +set names utf8mb4; +select 'a\\' like 'a\\'; +'a\\' like 'a\\' +1 +select 'aa\\' like 'a%\\'; +'aa\\' like 'a%\\' +1 +create table t1 (a char(10), key(a)) character set utf8mb4 engine MyISAM; +insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); +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; +CREATE TABLE t1 ( +a varchar(255) NOT NULL default '', +KEY a (a) +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci; +Warnings: +Warning 1071 Specified key was too long; max key length is 1000 bytes +insert into t1 values (_utf8mb4 0xe880bd); +insert into t1 values (_utf8mb4 0x5b); +select hex(a) from t1; +hex(a) +5B +E880BD +drop table t1; +set names 'latin1'; +create table t1 (a varchar(255)) default charset=utf8mb4 engine MyISAM; +select * from t1 where find_in_set('-1', a); +a +drop table t1; +create table t1 (a int) engine MyISAM; +insert into t1 values (48),(49),(50); +set names utf8mb4; +select distinct char(a) from t1; +char(a) +0 +1 +2 +drop table t1; +CREATE TABLE t1 (t TINYTEXT CHARACTER SET utf8mb4) ENGINE MyISAM; +INSERT INTO t1 VALUES(REPEAT('a', 100)); +CREATE TEMPORARY TABLE t2 ENGINE MyISAM SELECT COALESCE(t) AS bug FROM t1; +SELECT LENGTH(bug) FROM t2; +LENGTH(bug) +100 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (item varchar(255)) default character set utf8mb4 ENGINE MyISAM; +INSERT INTO t1 VALUES (N'\\'); +INSERT INTO t1 VALUES (_utf8mb4'\\'); +INSERT INTO t1 VALUES (N'Cote d\'Ivoire'); +INSERT INTO t1 VALUES (_utf8mb4'Cote d\'Ivoire'); +SELECT item FROM t1 ORDER BY item; +item +Cote d'Ivoire +Cote d'Ivoire +\ +\ +DROP TABLE t1; +SET NAMES utf8mb4; +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1(a VARCHAR(255), KEY(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; +Warnings: +Warning 1071 Specified key was too long; max key length is 1000 bytes +INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'); +INSERT INTO t1 VALUES('uu'); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t1 VALUES('uU'); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t1 VALUES('uu'); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t1 VALUES('uuABC'); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t1 VALUES('UuABC'); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t1 VALUES('uuABC'); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +alter table t1 add b int; +INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',1); +INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',2); +delete from t1 where b=1; +INSERT INTO t1 VALUES('UUABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',1); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',3); +INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',4); +delete from t1 where b=3; +INSERT INTO t1 VALUES('uUABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',3); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; +set names utf8mb4; +create table t1 (s1 char(5) character set utf8mb4) engine MyISAM; +insert into t1 values +('a'),('b'),(null),('ペテルグル'),('ü'),('Y'); +create index it1 on t1 (s1); +select s1 as before_delete_general_ci from t1 where s1 like 'ペテ%'; +before_delete_general_ci +ペテルグル +delete from t1 where s1 = 'Y'; +select s1 as after_delete_general_ci from t1 where s1 like 'ペテ%'; +after_delete_general_ci +ペテルグル +drop table t1; +set names utf8mb4; +create table t1 (s1 char(5) character set utf8mb4 collate utf8mb4_unicode_ci) engine MyISAM; +insert into t1 values +('a'),('b'),(null),('ペテルグル'),('ü'),('Y'); +create index it1 on t1 (s1); +select s1 as before_delete_unicode_ci from t1 where s1 like 'ペテ%'; +before_delete_unicode_ci +ペテルグル +delete from t1 where s1 = 'Y'; +select s1 as after_delete_unicode_ci from t1 where s1 like 'ペテ%'; +after_delete_unicode_ci +ペテルグル +drop table t1; +set names utf8mb4; +create table t1 (s1 char(5) character set utf8mb4 collate utf8mb4_bin) engine MyISAM; +insert into t1 values +('a'),('b'),(null),('ペテルグル'),('ü'),('Y'); +create index it1 on t1 (s1); +select s1 as before_delete_bin from t1 where s1 like 'ペテ%'; +before_delete_bin +ペテルグル +delete from t1 where s1 = 'Y'; +select s1 as after_delete_bin from t1 where s1 like 'ペテ%'; +after_delete_bin +ペテルグル +drop table t1; +set names utf8mb4; +create table t1 (a varchar(30) not null primary key) +engine=MyISAM default character set utf8mb4 collate utf8mb4_general_ci; +insert into t1 values ('あいうえおかきくけこさしすせそ'); +insert into t1 values ('さしすせそかきくけこあいうえお'); +select a as gci1 from t1 where a like 'さしすせそかきくけこあいうえお%'; +gci1 +さしすせそかきくけこあいうえお +select a as gci2 from t1 where a like 'あいうえおかきくけこさしすせそ'; +gci2 +あいうえおかきくけこさしすせそ +drop table t1; +set names utf8mb4; +create table t1 (a varchar(30) not null primary key) +engine=MyISAM default character set utf8mb4 collate utf8mb4_unicode_ci; +insert into t1 values ('あいうえおかきくけこさしすせそ'); +insert into t1 values ('さしすせそかきくけこあいうえお'); +select a as uci1 from t1 where a like 'さしすせそかきくけこあいうえお%'; +uci1 +さしすせそかきくけこあいうえお +select a as uci2 from t1 where a like 'あいうえおかきくけこさしすせそ'; +uci2 +あいうえおかきくけこさしすせそ +drop table t1; +set names utf8mb4; +create table t1 (a varchar(30) not null primary key) +engine=MyISAM default character set utf8mb4 collate utf8mb4_bin; +insert into t1 values ('あいうえおかきくけこさしすせそ'); +insert into t1 values ('さしすせそかきくけこあいうえお'); +select a as bin1 from t1 where a like 'さしすせそかきくけこあいうえお%'; +bin1 +さしすせそかきくけこあいうえお +select a as bin2 from t1 where a like 'あいうえおかきくけこさしすせそ'; +bin2 +あいうえおかきくけこさしすせそ +drop table t1; +SET NAMES utf8mb4; +CREATE TABLE t1 (id int PRIMARY KEY, +a varchar(16) collate utf8mb4_unicode_ci NOT NULL default '', +b int, +f varchar(128) default 'XXX', +INDEX (a(4)) +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +INSERT INTO t1(id, a, b) VALUES +(1, 'cccc', 50), (2, 'cccc', 70), (3, 'cccc', 30), +(4, 'cccc', 30), (5, 'cccc', 20), (6, 'bbbbbb', 40), +(7, 'dddd', 30), (8, 'aaaa', 10), (9, 'aaaa', 50), +(10, 'eeeee', 40), (11, 'bbbbbb', 60); +SELECT id, a, b FROM t1; +id a b +1 cccc 50 +10 eeeee 40 +11 bbbbbb 60 +2 cccc 70 +3 cccc 30 +4 cccc 30 +5 cccc 20 +6 bbbbbb 40 +7 dddd 30 +8 aaaa 10 +9 aaaa 50 +SELECT id, a, b FROM t1 WHERE a BETWEEN 'aaaa' AND 'bbbbbb'; +id a b +11 bbbbbb 60 +6 bbbbbb 40 +8 aaaa 10 +9 aaaa 50 +SELECT id, a FROM t1 WHERE a='bbbbbb'; +id a +11 bbbbbb +6 bbbbbb +SELECT id, a FROM t1 WHERE a='bbbbbb' ORDER BY b; +id a +6 bbbbbb +11 bbbbbb +DROP TABLE t1; +SET NAMES utf8mb4; +CREATE TABLE t1 ( +a CHAR(13) DEFAULT '', +INDEX(a) +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +INSERT INTO t1 VALUES +('Käli Käli 2-4'), ('Käli Käli 2-4'), +('Käli Käli 2+4'), ('Käli Käli 2+4'), +('Käli Käli 2-6'), ('Käli Käli 2-6'); +INSERT INTO t1 SELECT * FROM t1; +CREATE TABLE t2 ( +a CHAR(13) DEFAULT '', +INDEX(a) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; +INSERT INTO t2 VALUES +('Kali Kali 2-4'), ('Kali Kali 2-4'), +('Kali Kali 2+4'), ('Kali Kali 2+4'), +('Kali Kali 2-6'), ('Kali Kali 2-6'); +INSERT INTO t2 SELECT * FROM t2; +SELECT a FROM t1 WHERE a LIKE 'Käli Käli 2+4'; +a +Käli Käli 2+4 +Käli Käli 2+4 +Käli Käli 2+4 +Käli Käli 2+4 +SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4'; +a +Kali Kali 2+4 +Kali Kali 2+4 +Kali Kali 2+4 +Kali Kali 2+4 +EXPLAIN SELECT a FROM t1 WHERE a LIKE 'Käli Käli 2+4'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 53 NULL 4 Using where; Using index +EXPLAIN SELECT a FROM t1 WHERE a = 'Käli Käli 2+4'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 53 const 4 Using where; Using index +EXPLAIN SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range a a 14 NULL 4 Using where; Using index +EXPLAIN SELECT a FROM t2 WHERE a = 'Kali Kali 2+4'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref a a 14 const 4 Using where; Using index +DROP TABLE t1,t2; +CREATE TABLE t1 ( +a char(255) DEFAULT '', +KEY(a(10)) +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +INSERT INTO t1 VALUES ('Käli Käli 2-4'); +SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%'; +a +Käli Käli 2-4 +INSERT INTO t1 VALUES ('Käli Käli 2-4'); +SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%'; +a +Käli Käli 2-4 +Käli Käli 2-4 +DROP TABLE t1; +CREATE TABLE t1 ( +a char(255) DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +INSERT INTO t1 VALUES ('Käli Käli 2-4'); +INSERT INTO t1 VALUES ('Käli Käli 2-4'); +SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%'; +a +Käli Käli 2-4 +Käli Käli 2-4 +ALTER TABLE t1 ADD KEY (a(10)); +SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%'; +a +Käli Käli 2-4 +Käli Käli 2-4 +DROP TABLE t1; +SET NAMES latin2; +CREATE TABLE t1 ( +id int(11) NOT NULL default '0', +tid int(11) NOT NULL default '0', +val text NOT NULL, +INDEX idx(tid, val(10)) +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; +INSERT INTO t1 VALUES +(40988,72,'VOLN� ADSL'),(41009,72,'VOLN� ADSL'), +(41032,72,'VOLN� ADSL'),(41038,72,'VOLN� ADSL'), +(41063,72,'VOLN� ADSL'),(41537,72,'VOLN� ADSL Office'), +(42141,72,'VOLN� ADSL'),(42565,72,'VOLN� ADSL Combi'), +(42749,72,'VOLN� ADSL'),(44205,72,'VOLN� ADSL'); +SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLNY ADSL'; +id tid val +40988 72 VOLN� ADSL +41009 72 VOLN� ADSL +41032 72 VOLN� ADSL +41038 72 VOLN� ADSL +41063 72 VOLN� ADSL +42141 72 VOLN� ADSL +42749 72 VOLN� ADSL +44205 72 VOLN� ADSL +SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLN� ADSL'; +id tid val +40988 72 VOLN� ADSL +41009 72 VOLN� ADSL +41032 72 VOLN� ADSL +41038 72 VOLN� ADSL +41063 72 VOLN� ADSL +42141 72 VOLN� ADSL +42749 72 VOLN� ADSL +44205 72 VOLN� ADSL +SELECT * FROM t1 WHERE tid=72 and val LIKE '%VOLN� ADSL'; +id tid val +40988 72 VOLN� ADSL +41009 72 VOLN� ADSL +41032 72 VOLN� ADSL +41038 72 VOLN� ADSL +41063 72 VOLN� ADSL +42141 72 VOLN� ADSL +42749 72 VOLN� ADSL +44205 72 VOLN� ADSL +ALTER TABLE t1 DROP KEY idx; +ALTER TABLE t1 ADD KEY idx (tid,val(11)); +SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLN� ADSL'; +id tid val +40988 72 VOLN� ADSL +41009 72 VOLN� ADSL +41032 72 VOLN� ADSL +41038 72 VOLN� ADSL +41063 72 VOLN� ADSL +42141 72 VOLN� ADSL +42749 72 VOLN� ADSL +44205 72 VOLN� ADSL +DROP TABLE t1; +create table t1(a char(200) collate utf8mb4_unicode_ci NOT NULL default '') +default charset=utf8mb4 collate=utf8mb4_unicode_ci engine MyISAM; +insert into t1 values (unhex('65')), (unhex('C3A9')), (unhex('65')); +explain select distinct a from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary +SELECT COUNT(*) FROM (SELECT DISTINCT a FROM t1) AS t2; +COUNT(*) +1 +explain select a 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 3 Using temporary; Using filesort +SELECT COUNT(*) FROM (SELECT a FROM t1 GROUP BY a) AS t2; +COUNT(*) +1 +drop table t1; +create table t1(a char(10)) default charset utf8mb4 engine MyISAM; +insert into t1 values ('123'), ('456'); +explain +select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE Y ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +1 SIMPLE Z ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1; +substr(Z.a,-1) a +3 123 +6 456 +drop table t1; +SET CHARACTER SET utf8mb4; +SHOW VARIABLES LIKE 'character\_set\_%'; +Variable_name Value +character_set_client utf8mb4 +character_set_connection latin1 +character_set_database latin1 +character_set_filesystem binary +character_set_results utf8mb4 +character_set_server latin1 +character_set_system utf8 +CREATE DATABASE crashtest DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; +USE crashtest; +CREATE TABLE crashtest (crash char(10)) DEFAULT CHARSET=utf8mb4 ENGINE MyISAM; +INSERT INTO crashtest VALUES ('35'), ('36'), ('37'); +SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8mb4); +crash +35 +36 +37 +INSERT INTO crashtest VALUES ('-1000'); +EXPLAIN SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8mb4); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE crashtest ALL NULL NULL NULL NULL 4 Using filesort +SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8mb4); +crash +-1000 +35 +36 +37 +Warnings: +Warning 1300 Invalid utf8mb4 character string: 'FFFFFC' +DROP TABLE crashtest; +DROP DATABASE crashtest; +USE test; +SET CHARACTER SET default; +CREATE TABLE t1(id varchar(20) NOT NULL) DEFAULT CHARSET=utf8mb4 ENGINE MyISAM; +INSERT INTO t1 VALUES ('xxx'), ('aa'), ('yyy'), ('aa'); +SELECT id FROM t1; +id +aa +aa +xxx +yyy +SELECT DISTINCT id FROM t1; +id +aa +xxx +yyy +SELECT DISTINCT id FROM t1 ORDER BY id; +id +aa +xxx +yyy +DROP TABLE t1; +create table t1 ( +a varchar(26) not null +) default character set utf8mb4 ENGINE MyISAM; +insert into t1 (a) values ('abcdefghijklmnopqrstuvwxyz'); +select * from t1; +a +abcdefghijklmnopqrstuvwxyz +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +alter table t1 change a a varchar(20) character set utf8mb4 not null; +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +select * from t1; +a +abcdefghijklmnopqrst +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +alter table t1 change a a char(15) character set utf8mb4 not null; +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +select * from t1; +a +abcdefghijklmno +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +alter table t1 change a a char(10) character set utf8mb4 not null; +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +select * from t1; +a +abcdefghij +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +alter table t1 change a a varchar(5) character set utf8mb4 not null; +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +select * from t1; +a +abcde +drop table t1; +create table t1 ( +a varchar(4000) not null +) default character set utf8mb4 engine MyISAM; +insert into t1 values (repeat('a',4000)); +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +alter table t1 change a a varchar(3000) character set utf8mb4 not null; +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +select length(a) from t1; +length(a) +3000 +drop table t1; +set names utf8mb4; +select hex(char(1 using utf8mb4)); +hex(char(1 using utf8mb4)) +01 +select char(0xd1,0x8f using utf8mb4); +char(0xd1,0x8f using utf8mb4) +я +select char(0xd18f using utf8mb4); +char(0xd18f using utf8mb4) +я +select char(53647 using utf8mb4); +char(53647 using utf8mb4) +я +select char(0xff,0x8f using utf8mb4); +char(0xff,0x8f using utf8mb4) +NULL +Warnings: +Warning 1300 Invalid utf8mb4 character string: 'FF8F' +select convert(char(0xff,0x8f) using utf8mb4); +convert(char(0xff,0x8f) using utf8mb4) +?? +Warnings: +Warning 1300 Invalid utf8mb4 character string: '\xFF\x8F' +set sql_mode=traditional; +select char(0xff,0x8f using utf8mb4); +char(0xff,0x8f using utf8mb4) +NULL +Warnings: +Warning 1300 Invalid utf8mb4 character string: 'FF8F' +select char(195 using utf8mb4); +char(195 using utf8mb4) +NULL +Warnings: +Warning 1300 Invalid utf8mb4 character string: 'C3' +select char(196 using utf8mb4); +char(196 using utf8mb4) +NULL +Warnings: +Warning 1300 Invalid utf8mb4 character string: 'C4' +select char(2557 using utf8mb4); +char(2557 using utf8mb4) +NULL +Warnings: +Warning 1300 Invalid utf8mb4 character string: 'FD' +select convert(char(0xff,0x8f) using utf8mb4); +convert(char(0xff,0x8f) using utf8mb4) +?? +Warnings: +Warning 1300 Invalid utf8mb4 character string: '\xFF\x8F' +select hex(convert(char(2557 using latin1) using utf8mb4)); +hex(convert(char(2557 using latin1) using utf8mb4)) +09C3BD +select hex(char(195)); +hex(char(195)) +C3 +select hex(char(196)); +hex(char(196)) +C4 +select hex(char(2557)); +hex(char(2557)) +09FD +set names utf8mb4; +create table t1 (a char(1)) default character set utf8mb4 engine MyISAM; +create table t2 (a char(1)) default character set utf8mb4 engine MyISAM; +insert into t1 values('a'),('a'),(0xE38182),(0xE38182); +insert into t1 values('i'),('i'),(0xE38184),(0xE38184); +select * from t1 union distinct select * from t2; +a +a +i +あ +い +drop table t1,t2; +set names utf8mb4; +create table t1 (a char(10), b varchar(10)) engine MyISAM; +insert into t1 values ('bar','kostja'); +insert into t1 values ('kostja','bar'); +prepare my_stmt from "select * from t1 where a=?"; +set @a:='bar'; +execute my_stmt using @a; +a b +bar kostja +set @a:='kostja'; +execute my_stmt using @a; +a b +kostja bar +set @a:=null; +execute my_stmt using @a; +a b +drop table if exists t1; +drop table if exists t1; +drop view if exists v1, v2; +set names utf8mb4; +create table t1(col1 varchar(12) character set utf8mb4 collate utf8mb4_unicode_ci) engine MyISAM; +insert into t1 values('t1_val'); +create view v1 as select 'v1_val' as col1; +select coercibility(col1), collation(col1) from v1; +coercibility(col1) collation(col1) +4 utf8mb4_general_ci +create view v2 as select col1 from v1 union select col1 from t1; +select coercibility(col1), collation(col1)from v2; +coercibility(col1) collation(col1) +2 utf8mb4_unicode_ci +2 utf8mb4_unicode_ci +drop view v1, v2; +create view v1 as select 'v1_val' collate utf8mb4_swedish_ci as col1; +select coercibility(col1), collation(col1) from v1; +coercibility(col1) collation(col1) +0 utf8mb4_swedish_ci +create view v2 as select col1 from v1 union select col1 from t1; +select coercibility(col1), collation(col1) from v2; +coercibility(col1) collation(col1) +0 utf8mb4_swedish_ci +0 utf8mb4_swedish_ci +drop view v1, v2; +drop table t1; +set names utf8mb4; +create table t1 (a varchar(10) character set latin1, b int) engine MyISAM; +insert into t1 values ('a',1); +select concat(a, if(b>10, N'x', N'y')) from t1; +concat(a, if(b>10, N'x', N'y')) +ay +select concat(a, if(b>10, N'æ', N'ß')) from t1; +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'concat' +drop table t1; +set names utf8mb4; +create table t1 (a varchar(10) character set latin1, b int) engine MyISAM; +insert into t1 values ('a',1); +select concat(a, if(b>10, _utf8mb4'x', _utf8mb4'y')) from t1; +concat(a, if(b>10, _utf8mb4'x', _utf8mb4'y')) +ay +select concat(a, if(b>10, _utf8mb4'æ', _utf8mb4'ß')) from t1; +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation 'concat' +drop table t1; +set names utf8mb4; +create table t1 (a varchar(10) character set latin1, b int) engine MyISAM; +insert into t1 values ('a',1); +select concat(a, if(b>10, _utf8mb4 0x78, _utf8mb4 0x79)) from t1; +concat(a, if(b>10, _utf8mb4 0x78, _utf8mb4 0x79)) +ay +select concat(a, if(b>10, _utf8mb4 0xC3A6, _utf8mb4 0xC3AF)) from t1; +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation 'concat' +drop table t1; +set names utf8mb4; +create table t1 (a varchar(10) character set latin1, b int) engine MyISAM; +insert into t1 values ('a',1); +select concat(a, if(b>10, 'x' 'x', 'y' 'y')) from t1; +concat(a, if(b>10, 'x' 'x', 'y' 'y')) +ayy +select concat(a, if(b>10, 'x' 'æ', 'y' 'ß')) from t1; +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation 'concat' +drop table t1; +CREATE TABLE t1 ( +colA int(11) NOT NULL, +colB varchar(255) character set utf8mb4 NOT NULL, +PRIMARY KEY (colA) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +INSERT INTO t1 (colA, colB) VALUES (1, 'foo'), (2, 'foo bar'); +CREATE TABLE t2 ( +colA int(11) NOT NULL, +colB varchar(255) character set utf8mb4 NOT NULL, +KEY bad (colA,colB(3)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +INSERT INTO t2 (colA, colB) VALUES (1, 'foo'),(2, 'foo bar'); +SELECT * FROM t1 JOIN t2 ON t1.colA=t2.colA AND t1.colB=t2.colB +WHERE t1.colA < 3; +colA colB colA colB +1 foo 1 foo +2 foo bar 2 foo bar +DROP TABLE t1, t2; +SELECT 'н1234567890' UNION SELECT _binary '1'; +н1234567890 +н1234567890 +1 +SELECT 'н1234567890' UNION SELECT 1; +н1234567890 +н1234567890 +1 +SELECT '1' UNION SELECT 'н1234567890'; +1 +1 +н1234567890 +SELECT 1 UNION SELECT 'н1234567890'; +1 +1 +н1234567890 +CREATE TABLE t1 (c VARCHAR(11)) CHARACTER SET utf8mb4 ENGINE MyISAM; +CREATE TABLE t2 (b CHAR(1) CHARACTER SET binary, i INT) ENGINE MyISAM; +INSERT INTO t1 (c) VALUES ('н1234567890'); +INSERT INTO t2 (b, i) VALUES ('1', 1); +SELECT c FROM t1 UNION SELECT b FROM t2; +c +н1234567890 +1 +SELECT c FROM t1 UNION SELECT i FROM t2; +c +н1234567890 +1 +SELECT b FROM t2 UNION SELECT c FROM t1; +b +1 +н1234567890 +SELECT i FROM t2 UNION SELECT c FROM t1; +i +1 +н1234567890 +DROP TABLE t1, t2; +set sql_mode=traditional; +select hex(char(0xFF using utf8mb4)); +hex(char(0xFF using utf8mb4)) +NULL +Warnings: +Warning 1300 Invalid utf8mb4 character string: 'FF' +select hex(convert(0xFF using utf8mb4)); +hex(convert(0xFF using utf8mb4)) +3F +Warnings: +Warning 1300 Invalid utf8mb4 character string: '\xFF' +select hex(_utf8mb4 0x616263FF); +ERROR HY000: Invalid utf8mb4 character string: 'FF' +select hex(_utf8mb4 X'616263FF'); +ERROR HY000: Invalid utf8mb4 character string: 'FF' +select hex(_utf8mb4 B'001111111111'); +ERROR HY000: Invalid utf8mb4 character string: 'FF' +select (_utf8mb4 X'616263FF'); +ERROR HY000: Invalid utf8mb4 character string: 'FF' +set sql_mode=default; +select hex(char(0xFF using utf8mb4)); +hex(char(0xFF using utf8mb4)) +NULL +Warnings: +Warning 1300 Invalid utf8mb4 character string: 'FF' +select hex(convert(0xFF using utf8mb4)); +hex(convert(0xFF using utf8mb4)) +3F +Warnings: +Warning 1300 Invalid utf8mb4 character string: '\xFF' +select hex(_utf8mb4 0x616263FF); +ERROR HY000: Invalid utf8mb4 character string: 'FF' +select hex(_utf8mb4 X'616263FF'); +ERROR HY000: Invalid utf8mb4 character string: 'FF' +select hex(_utf8mb4 B'001111111111'); +ERROR HY000: Invalid utf8mb4 character string: 'FF' +select (_utf8mb4 X'616263FF'); +ERROR HY000: Invalid utf8mb4 character string: 'FF' +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL) ENGINE MyISAM; +INSERT INTO t1 VALUES (70000, 1092), (70001, 1085), (70002, 1065); +SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b; +CONVERT(a, CHAR) CONVERT(b, CHAR) +70000 1092 +70001 1085 +70002 1065 +SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1; +CONVERT(a, CHAR) CONVERT(b, CHAR) +70000 1092 +70001 1085 +70002 1065 +ALTER TABLE t1 ADD UNIQUE (b); +SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b; +CONVERT(a, CHAR) CONVERT(b, CHAR) +70000 1092 +70001 1085 +70002 1065 +DROP INDEX b ON t1; +SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b; +CONVERT(a, CHAR) CONVERT(b, CHAR) +70000 1092 +70001 1085 +70002 1065 +ALTER TABLE t1 ADD INDEX (b); +SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) from t1 GROUP BY b; +CONVERT(a, CHAR) CONVERT(b, CHAR) +70000 1092 +70001 1085 +70002 1065 +DROP TABLE t1; +# +# Bug#26474: Add Sinhala script (Sri Lanka) collation to MySQL +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +predicted_order int NOT NULL, +utf8mb4_encoding VARCHAR(10) NOT NULL +) CHARACTER SET utf8mb4 ENGINE MyISAM; +INSERT INTO t1 VALUES (19, x'E0B696'), (30, x'E0B69AE0B798'), (61, x'E0B6AF'), (93, x'E0B799'), (52, x'E0B6A6'), (73, x'E0B6BBE0B78AE2808D'), (3, x'E0B686'), (56, x'E0B6AA'), (55, x'E0B6A9'), (70, x'E0B6B9'), (94, x'E0B79A'), (80, x'E0B785'), (25, x'E0B69AE0B791'), (48, x'E0B6A2'), (13, x'E0B690'), (86, x'E0B793'), (91, x'E0B79F'), (81, x'E0B786'), (79, x'E0B784'), (14, x'E0B691'), (99, x'E0B78A'), (8, x'E0B68B'), (68, x'E0B6B7'), (22, x'E0B69A'), (16, x'E0B693'), (33, x'E0B69AE0B7B3'), (38, x'E0B69AE0B79D'), (21, x'E0B683'), (11, x'E0B68E'), (77, x'E0B782'), (40, x'E0B69AE0B78A'), (101, x'E0B78AE2808DE0B6BB'), (35, x'E0B69AE0B79A'), (1, x'E0B7B4'), (9, x'E0B68C'), (96, x'E0B79C'), (6, x'E0B689'), (95, x'E0B79B'), (88, x'E0B796'), (64, x'E0B6B3'), (26, x'E0B69AE0B792'), (82, x'E0B78F'), (28, x'E0B69AE0B794'), (39, x'E0B69AE0B79E'), (97, x'E0B79D'), (2, x'E0B685'), (75, x'E0B780'), (34, x'E0B69AE0B799'), (69, x'E0B6B8'), (83, x'E0B790'), (18, x'E0B695'), (90, x'E0B7B2'), (17 , x'E0B694'), (72, x'E0B6BB'), (66, x'E0B6B5'), (59, x'E0B6AD'), (44, x'E0B69E'), (15, x'E0B692'), (23, x'E0B69AE0B78F'), (65, x'E0B6B4'), (42, x'E0B69C'), (63, x'E0B6B1'), (85, x'E0B792'), (47, x'E0B6A1'), (49, x'E0B6A3'), (92, x'E0B7B3'), (78, x'E0B783'), (36, x'E0B69AE0B79B'), (4, x'E0B687'), (24, x'E0B69AE0B790'), (87, x'E0B794'), (37, x'E0B69AE0B79C'), (32, x'E0B69AE0B79F'), (29, x'E0B69AE0B796'), (43, x'E0B69D'), (62, x'E0B6B0'), (100, x'E0B78AE2808DE0B6BA'), (60, x'E0B6AE'), (45, x'E0B69F'), (12, x'E0B68F'), (46, x'E0B6A0'), (50, x'E0B6A5'), (51, x'E0B6A4'), (5, x'E0B688'), (76, x'E0B781'), (89, x'E0B798'), (74, x'E0B6BD'), (10, x'E0B68D'), (57, x'E0B6AB'), (71, x'E0B6BA'), (58, x'E0B6AC'), (27, x'E0B69AE0B793'), (54, x'E0B6A8'), (84, x'E0B791'), (31, x'E0B69AE0B7B2'), (98, x'E0B79E'), (53, x'E0B6A7'), (41, x'E0B69B'), (67, x'E0B6B6'), (7, x'E0B68A'), (20, x'E0B682'); +SELECT predicted_order, hex(utf8mb4_encoding) FROM t1 ORDER BY utf8mb4_encoding COLLATE utf8mb4_sinhala_ci; +predicted_order hex(utf8mb4_encoding) +1 E0B7B4 +2 E0B685 +3 E0B686 +4 E0B687 +5 E0B688 +6 E0B689 +7 E0B68A +8 E0B68B +9 E0B68C +10 E0B68D +11 E0B68E +12 E0B68F +13 E0B690 +14 E0B691 +15 E0B692 +16 E0B693 +17 E0B694 +18 E0B695 +19 E0B696 +20 E0B682 +21 E0B683 +22 E0B69A +23 E0B69AE0B78F +24 E0B69AE0B790 +25 E0B69AE0B791 +26 E0B69AE0B792 +27 E0B69AE0B793 +28 E0B69AE0B794 +29 E0B69AE0B796 +30 E0B69AE0B798 +31 E0B69AE0B7B2 +32 E0B69AE0B79F +33 E0B69AE0B7B3 +34 E0B69AE0B799 +35 E0B69AE0B79A +36 E0B69AE0B79B +37 E0B69AE0B79C +38 E0B69AE0B79D +39 E0B69AE0B79E +40 E0B69AE0B78A +41 E0B69B +42 E0B69C +43 E0B69D +44 E0B69E +45 E0B69F +46 E0B6A0 +47 E0B6A1 +48 E0B6A2 +49 E0B6A3 +50 E0B6A5 +51 E0B6A4 +52 E0B6A6 +53 E0B6A7 +54 E0B6A8 +55 E0B6A9 +56 E0B6AA +57 E0B6AB +58 E0B6AC +59 E0B6AD +60 E0B6AE +61 E0B6AF +62 E0B6B0 +63 E0B6B1 +64 E0B6B3 +65 E0B6B4 +66 E0B6B5 +67 E0B6B6 +68 E0B6B7 +69 E0B6B8 +70 E0B6B9 +71 E0B6BA +72 E0B6BB +73 E0B6BBE0B78AE2808D +74 E0B6BD +75 E0B780 +76 E0B781 +77 E0B782 +78 E0B783 +79 E0B784 +80 E0B785 +81 E0B786 +82 E0B78F +83 E0B790 +84 E0B791 +85 E0B792 +86 E0B793 +87 E0B794 +88 E0B796 +89 E0B798 +90 E0B7B2 +91 E0B79F +92 E0B7B3 +93 E0B799 +94 E0B79A +95 E0B79B +96 E0B79C +97 E0B79D +98 E0B79E +99 E0B78A +100 E0B78AE2808DE0B6BA +101 E0B78AE2808DE0B6BB +DROP TABLE t1; +# +# Bug#32914 Character sets: illegal characters in utf8mb4 and utf32 columns +# +create table t1 (utf8mb4 char(1) character set utf8mb4) engine MyISAM; +Testing [F0][90..BF][80..BF][80..BF] +insert into t1 values (0xF0908080); +insert into t1 values (0xF0BFBFBF); +insert ignore into t1 values (0xF08F8080); +Warnings: +Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column `test`.`t1`.`utf8mb4` at row 1 +select hex(utf8mb4) from t1; +hex(utf8mb4) +3F +F0908080 +F0BFBFBF +delete from t1; +Testing [F2..F3][80..BF][80..BF][80..BF] +insert into t1 values (0xF2808080); +insert into t1 values (0xF2BFBFBF); +select hex(utf8mb4) from t1; +hex(utf8mb4) +F2808080 +F2BFBFBF +delete from t1; +Testing [F4][80..8F][80..BF][80..BF] +insert into t1 values (0xF4808080); +insert into t1 values (0xF48F8080); +insert ignore into t1 values (0xF4908080); +Warnings: +Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column `test`.`t1`.`utf8mb4` at row 1 +select hex(utf8mb4) from t1; +hex(utf8mb4) +3F +F4808080 +F48F8080 +drop table t1; +# +# Check strnxfrm() with odd length +# +set max_sort_length=5; +select @@max_sort_length; +@@max_sort_length +5 +create table t1 (a varchar(128) character set utf8mb4 collate utf8mb4_general_ci) engine MyISAM; +insert into t1 values ('a'),('b'),('c'); +select * from t1 order by a; +a +a +b +c +alter table t1 modify a varchar(128) character set utf8mb4 collate utf8mb4_bin; +select * from t1 order by a; +a +a +b +c +drop table t1; +set max_sort_length=default; +# +# Bug#26180: Can't add columns to tables created with utf8mb4 text indexes +# +CREATE TABLE t1 ( +clipid INT NOT NULL, +Tape TINYTEXT, +PRIMARY KEY (clipid), +KEY tape(Tape(255)) +) CHARACTER SET=utf8mb4 ENGINE MyISAM; +Warnings: +Note 1071 Specified key was too long; max key length is 1000 bytes +ALTER TABLE t1 ADD mos TINYINT DEFAULT 0 AFTER clipid; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `clipid` int(11) NOT NULL, + `mos` tinyint(4) DEFAULT 0, + `Tape` tinytext DEFAULT NULL, + PRIMARY KEY (`clipid`), + KEY `tape` (`Tape`(250)) +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 +DROP TABLE t1; +# +# Testing 4-byte values. +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +u_decimal int NOT NULL, +utf8mb4_encoding VARCHAR(10) NOT NULL +) CHARACTER SET utf8mb4 ENGINE MyISAM; +INSERT INTO t1 VALUES (119040, x'f09d8480'), +# G CLEF +(119070, x'f09d849e'), +# HALF NOTE +(119134, x'f09d859e'), +# MUSICAL SYMBOL CROIX +(119247, x'f09d878f'), +# MATHEMATICAL BOLD ITALIC CAPITAL DELTA +(120607, x'f09d9c9f'), +# SANS-SERIF BOLD ITALIC CAPITAL PI +(120735, x'f09d9e9f'), +# <Plane 16 Private Use, Last> (last 4 byte character) +(1114111, x'f48fbfbf'), +# VARIATION SELECTOR-256 +(917999, x'f3a087af'); +INSERT INTO t1 VALUES (119070, x'f09d849ef09d859ef09d859ef09d8480f09d859ff09d859ff09d859ff09d85a0f09d85a0f09d8480'); +INSERT INTO t1 VALUES (65131, x'efb9abf09d849ef09d859ef09d859ef09d8480f09d859fefb9abefb9abf09d85a0efb9ab'); +INSERT IGNORE INTO t1 VALUES (119070, x'f09d849ef09d859ef09d859ef09d8480f09d859ff09d859ff09d859ff09d85a0f09d85a0f09d8480f09d85a0'); +Warnings: +Warning 1265 Data truncated for column 'utf8mb4_encoding' at row 1 +SELECT u_decimal, hex(utf8mb4_encoding) FROM t1 ORDER BY utf8mb4_encoding COLLATE utf8mb4_general_ci, BINARY utf8mb4_encoding; +u_decimal hex(utf8mb4_encoding) +1114111 F48FBFBF +119040 F09D8480 +119070 F09D849E +119070 F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480 +119070 F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480 +119134 F09D859E +119247 F09D878F +120607 F09D9C9F +120735 F09D9E9F +65131 EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9AB +917999 F3A087AF +INSERT IGNORE INTO t1 VALUES (1114111, x'f5808080'); +Warnings: +Warning 1366 Incorrect string value: '\xF5\x80\x80\x80' for column `test`.`t1`.`utf8mb4_encoding` at row 1 +SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE +table_name= 't1' AND column_name= 'utf8mb4_encoding'; +character_maximum_length character_octet_length +10 40 +DROP TABLE IF EXISTS t2; +CREATE TABLE t2 ( +u_decimal int NOT NULL, +utf8mb3_encoding VARCHAR(10) NOT NULL +) CHARACTER SET utf8mb3 ENGINE MyISAM; +INSERT INTO t2 VALUES (42856, x'ea9da8'); +INSERT INTO t2 VALUES (65131, x'efb9ab'); +INSERT IGNORE INTO t2 VALUES (1114111, x'f48fbfbf'); +Warnings: +Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column `test`.`t2`.`utf8mb3_encoding` at row 1 +SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE +table_name= 't2' AND column_name= 'utf8mb3_encoding'; +character_maximum_length character_octet_length +10 30 +UPDATE IGNORE t2 SET utf8mb3_encoding= x'f48fbfbd' where u_decimal= 42856; +Warnings: +Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column `test`.`t2`.`utf8mb3_encoding` at row 1 +UPDATE t2 SET utf8mb3_encoding= _utf8mb4 x'ea9da8' where u_decimal= 42856; +SELECT HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8')) FROM t1; +HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8')) +3F3F3F3FEA9DA8 +EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9ABEA9DA8 +F09D8480EA9DA8 +F09D849EEA9DA8 +F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EA9DA8 +F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EA9DA8 +F09D859EEA9DA8 +F09D878FEA9DA8 +F09D9C9FEA9DA8 +F09D9E9FEA9DA8 +F3A087AFEA9DA8 +F48FBFBFEA9DA8 +SELECT HEX(CONCAT(utf8mb4_encoding, utf8mb3_encoding)) FROM t1,t2; +HEX(CONCAT(utf8mb4_encoding, utf8mb3_encoding)) +3F3F3F3F3F3F3F3F +3F3F3F3FEA9DA8 +3F3F3F3FEFB9AB +EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9AB3F3F3F3F +EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9ABEA9DA8 +EFB9ABF09D849EF09D859EF09D859EF09D8480F09D859FEFB9ABEFB9ABF09D85A0EFB9ABEFB9AB +F09D84803F3F3F3F +F09D8480EA9DA8 +F09D8480EFB9AB +F09D849E3F3F3F3F +F09D849EEA9DA8 +F09D849EEFB9AB +F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D84803F3F3F3F +F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D84803F3F3F3F +F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EA9DA8 +F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EA9DA8 +F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EFB9AB +F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480EFB9AB +F09D859E3F3F3F3F +F09D859EEA9DA8 +F09D859EEFB9AB +F09D878F3F3F3F3F +F09D878FEA9DA8 +F09D878FEFB9AB +F09D9C9F3F3F3F3F +F09D9C9FEA9DA8 +F09D9C9FEFB9AB +F09D9E9F3F3F3F3F +F09D9E9FEA9DA8 +F09D9E9FEFB9AB +F3A087AF3F3F3F3F +F3A087AFEA9DA8 +F3A087AFEFB9AB +F48FBFBF3F3F3F3F +F48FBFBFEA9DA8 +F48FBFBFEFB9AB +SELECT count(*) FROM t1, t2 +WHERE t1.utf8mb4_encoding > t2.utf8mb3_encoding; +count(*) +33 +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +ALTER TABLE t1 CONVERT TO CHARACTER SET utf8; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `u_decimal` int(11) NOT NULL, + `utf8mb4_encoding` varchar(10) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +SELECT u_decimal,hex(utf8mb4_encoding),utf8mb4_encoding FROM t1; +u_decimal hex(utf8mb4_encoding) utf8mb4_encoding +1114111 3F ? +1114111 3F3F3F3F ???? +119040 3F ? +119070 3F ? +119070 3F3F3F3F3F3F3F3F3F3F ?????????? +119070 3F3F3F3F3F3F3F3F3F3F ?????????? +119134 3F ? +119247 3F ? +120607 3F ? +120735 3F ? +65131 EFB9AB3F3F3F3F3FEFB9ABEFB9AB3FEFB9AB ﹫?????﹫﹫?﹫ +917999 3F ? +ALTER TABLE t2 CONVERT TO CHARACTER SET utf8mb4; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `u_decimal` int(11) NOT NULL, + `utf8mb3_encoding` varchar(10) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 +SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; +u_decimal hex(utf8mb3_encoding) +1114111 3F3F3F3F +42856 EA9DA8 +65131 EFB9AB +ALTER TABLE t2 CONVERT TO CHARACTER SET utf8mb3; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `u_decimal` int(11) NOT NULL, + `utf8mb3_encoding` varchar(10) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; +u_decimal hex(utf8mb3_encoding) +1114111 3F3F3F3F +42856 EA9DA8 +65131 EFB9AB +ALTER TABLE t1 MODIFY utf8mb4_encoding VARCHAR(10) CHARACTER SET utf8mb3; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `u_decimal` int(11) NOT NULL, + `utf8mb4_encoding` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +SELECT u_decimal,hex(utf8mb4_encoding) FROM t1; +u_decimal hex(utf8mb4_encoding) +1114111 3F +1114111 3F3F3F3F +119040 3F +119070 3F +119070 3F3F3F3F3F3F3F3F3F3F +119070 3F3F3F3F3F3F3F3F3F3F +119134 3F +119247 3F +120607 3F +120735 3F +65131 EFB9AB3F3F3F3F3FEFB9ABEFB9AB3FEFB9AB +917999 3F +ALTER TABLE t1 MODIFY utf8mb4_encoding VARCHAR(10) CHARACTER SET utf8mb4; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `u_decimal` int(11) NOT NULL, + `utf8mb4_encoding` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +SELECT u_decimal,hex(utf8mb4_encoding) FROM t1; +u_decimal hex(utf8mb4_encoding) +1114111 3F +1114111 3F3F3F3F +119040 3F +119070 3F +119070 3F3F3F3F3F3F3F3F3F3F +119070 3F3F3F3F3F3F3F3F3F3F +119134 3F +119247 3F +120607 3F +120735 3F +65131 EFB9AB3F3F3F3F3FEFB9ABEFB9AB3FEFB9AB +917999 3F +ALTER TABLE t2 MODIFY utf8mb3_encoding VARCHAR(10) CHARACTER SET utf8mb4; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `u_decimal` int(11) NOT NULL, + `utf8mb3_encoding` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +SELECT u_decimal,hex(utf8mb3_encoding) FROM t2; +u_decimal hex(utf8mb3_encoding) +1114111 3F3F3F3F +42856 EA9DA8 +65131 EFB9AB +DROP TABLE IF EXISTS t3; +CREATE TABLE t3 ( +u_decimal int NOT NULL, +utf8mb3_encoding VARCHAR(10) NOT NULL +) CHARACTER SET utf8 ENGINE MyISAM; +INSERT INTO t3 SELECT * FROM t1; +DROP TABLE IF EXISTS t4; +CREATE TABLE t4 ( +u_decimal int NOT NULL, +utf8mb4_encoding VARCHAR(10) NOT NULL +) CHARACTER SET utf8mb4 ENGINE MyISAM; +INSERT INTO t3 SELECT * FROM t2; +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +DROP TABLE t4; +# +# Testing that mixing utf8 and utf8mb4 collations returns utf8mb4 +# +SELECT CHARSET(CONCAT(_utf8mb4'a',_utf8'b')); +CHARSET(CONCAT(_utf8mb4'a',_utf8'b')) +utf8mb4 +CREATE TABLE t1 (utf8mb4 VARCHAR(10) CHARACTER SET utf8mb4 NOT NULL) ENGINE MyISAM; +INSERT INTO t1 VALUES (x'ea9da8'),(x'f48fbfbf'); +SELECT CONCAT(utf8mb4, _utf8 x'ea9da8') FROM t1 LIMIT 0; +CONCAT(utf8mb4, _utf8 x'ea9da8') +CREATE TABLE t2 (utf8mb3 VARCHAR(10) CHARACTER SET utf8mb3 NOT NULL) ENGINE MyISAM; +INSERT INTO t2 VALUES (x'ea9da8'); +SELECT HEX(CONCAT(utf8mb4, utf8mb3)) FROM t1,t2 ORDER BY 1; +HEX(CONCAT(utf8mb4, utf8mb3)) +EA9DA8EA9DA8 +F48FBFBFEA9DA8 +SELECT CHARSET(CONCAT(utf8mb4, utf8mb3)) FROM t1, t2 LIMIT 1; +CHARSET(CONCAT(utf8mb4, utf8mb3)) +utf8mb4 +CREATE TEMPORARY TABLE t3 ENGINE MyISAM AS SELECT *, concat(utf8mb4,utf8mb3) FROM t1, t2; +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TEMPORARY TABLE `t3` ( + `utf8mb4` varchar(10) CHARACTER SET utf8mb4 NOT NULL, + `utf8mb3` varchar(10) CHARACTER SET utf8 NOT NULL, + `concat(utf8mb4,utf8mb3)` varchar(20) CHARACTER SET utf8mb4 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TEMPORARY TABLE t3; +SELECT * FROM t1, t2 WHERE t1.utf8mb4 > t2.utf8mb3; +utf8mb4 utf8mb3 + Ꝩ +SELECT * FROM t1, t2 WHERE t1.utf8mb4 = t2.utf8mb3; +utf8mb4 utf8mb3 +Ꝩ Ꝩ +SELECT * FROM t1, t2 WHERE t1.utf8mb4 < t2.utf8mb3; +utf8mb4 utf8mb3 +DROP TABLE t1; +DROP TABLE t2; +# +# Check that mixing utf8mb4 with an invalid utf8 constant returns error +# +CREATE TABLE t1 (utf8mb4 VARCHAR(10) CHARACTER SET utf8mb4) ENGINE MyISAM; +INSERT INTO t1 VALUES (x'f48fbfbf'); +SELECT CONCAT(utf8mb4, _utf8 '�') FROM t1; +ERROR HY000: Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'concat' +SELECT CONCAT('a', _utf8 '�') FROM t1; +ERROR HY000: Illegal mix of collations (utf8mb4_general_ci,COERCIBLE) and (utf8_general_ci,COERCIBLE) for operation 'concat' +DROP TABLE t1; +# +# End of 5.5 tests +# +# +# ctype_utf8mb4.inc: Start of 10.1 tests +# +# +# MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character" +# +CREATE TABLE t1 ( +id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +a VARCHAR(10) CHARACTER SET utf8mb4, KEY(a,id) +); +INSERT INTO t1 (a) VALUES (0x61); +INSERT INTO t1 (a) VALUES (0xC280),(0xDFBF); +INSERT INTO t1 (a) VALUES (0xE0A080),(0xEFBFBF); +INSERT INTO t1 (a) VALUES (0xF0908080),(0xF48FBFBF); +SELECT id,HEX(a) FROM t1 ORDER BY a,id; +id HEX(a) +1 61 +2 C280 +3 DFBF +4 E0A080 +6 F0908080 +7 F48FBFBF +5 EFBFBF +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +id HEX(a) +5 EFBFBF +7 F48FBFBF +6 F0908080 +4 E0A080 +3 DFBF +2 C280 +1 61 +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +6 +ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; +SELECT id,HEX(a) FROM t1 ORDER BY a; +id HEX(a) +1 61 +2 C280 +3 DFBF +4 E0A080 +5 EFBFBF +6 F0908080 +7 F48FBFBF +SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC; +id HEX(a) +7 F48FBFBF +6 F0908080 +5 EFBFBF +4 E0A080 +3 DFBF +2 C280 +1 61 +SELECT COUNT(DISTINCT a) FROM t1; +COUNT(DISTINCT a) +7 +DROP TABLE t1; +# +# ctype_utf8mb4.inc: End of 10.1 tests +# +# +# End of ctype_utf8mb4.inc +# diff --cc mysql-test/main/derived_cond_pushdown.result index 8086c4480f6,00000000000..fa1cf8c0373 mode 100644,000000..100644 --- a/mysql-test/main/derived_cond_pushdown.result +++ b/mysql-test/main/derived_cond_pushdown.result @@@ -1,16751 -1,0 +1,16801 @@@ +create table t1 (a int, b int, c int); +create table t2 (a int, b int, c int, d decimal); +insert into t1 values +(1,21,345), (1,33,7), (8,33,114), (1,21,500), (1,19,107), (5,14,787), +(8,33,123), (9,10,211), (5,16,207), (1,33,988), (5,27,132), (1,21,104), +(6,20,309), (6,20,315), (1,21,101), (8,33,404), (9,10,800), (1,21,123), +(7,11,708), (6,20,214); +insert into t2 values +(2,3,207,207.0000), (1,21,909,12.0000), (7,13,312,406.0000), +(8,64,248,107.0000), (6,20,315,279.3333), (1,19,203,107.0000), +(8,80,800,314.0000), (3,12,231,190.0000), (6,23,303,909.0000); +Warnings: +Note 1265 Data truncated for column 'd' at row 5 +create table t1_double(a int, b double, c double); +insert into t1_double values +(1,23.4,14.3333), (1,12.5,18.9), (3,12.5,18.9), +(4,33.4,14.3333), (4,14.3333,13.65), (5,17.89,7.22), +(6,33.4,14.3), (10,33.4,13.65), (11,33.4,13.65); +create table t2_double(a int, b double, c double); +insert into t2_double values +(1,22.4,14.3333), (1,12.5,18.9), (2,22.4,18.9), +(4,33.4,14.3333), (5,22.4,13.65), (7,17.89,18.9), +(6,33.4,14.3333), (10,31.4,13.65), (12,33.4,13.65); +create table t1_char(a char, b char(8), c int); +insert into t1_char values +('a','Ivan',1), ('b','Vika',2), ('b','Inga',6), ('c','Vika',7), +('b','Ivan',7), ('a','Alex',6), ('b','Inga',5), ('d','Ron',9), +('d','Harry',2), ('d','Hermione',3), ('c','Ivan',3), ('c','Harry',4); +create table t2_char(a char, b char(8), c int); +insert into t2_char values +('b','Ivan',1), ('c','Vinny',3), ('c','Inga',9), ('a','Vika',1), +('c','Ivan',2), ('b','Ali',6), ('c','Inga',2), ('a','Ron',9), +('d','Harry',1), ('b','Hermes',3), ('b','Ivan',11), ('b','Harry',4); +create table t1_decimal (a decimal(3,1), b decimal(3,1), c int); +insert into t1_decimal values +(1,1,23),(2,2,11),(3,3,16), +(1,1,12),(1,1,14),(2,3,15), +(2,1,13),(2,3,11),(3,3,16); +create table t2_decimal (a decimal(3,1), b decimal(3,1), c int); +insert into t2_decimal values +(2,1,13),(2,2,11),(3,3,16), +(1,3,22),(1,3,14),(2,2,15), +(2,1,43),(2,3,11),(2,3,16); +create view v1 as select a, b, max(c) as max_c, avg(c) as avg_c from t1 +group by a,b having max_c < 707; +create view v2 as select a, b, max(c) as max_c, avg(c) as avg_c from t1 +where t1.a>5 group by a,b having max_c < 707; +create view v3 as select a, b, min(c) as min_c from t1 +where t1.a<10 group by a,b having min_c > 109; +create view v4 as +select a, b, min(max_c) as min_c from v1 +where (v1.a<15) group by a,b; +create view v_union as +select a, b, min(c) as c from t1 +where t1.a<10 group by a,b having c > 109 +union +select a, b, max(c) as c from t1 +where t1.b>10 group by a,b having c < 300; +create view v2_union as +select a, b, min(c) as c from t1 +where t1.a<10 group by a,b having c > 109 +union +select a, b, max(c) as c from t1 +where t1.b>10 group by a,b having c < 300 +union +select a, b, avg(c) as c from t1 +where t1.c>300 group by a,b having c < 707; +create view v3_union as +select a, b, (a+1) as c from t1 +where t1.a<10 +union +select a, b, c from t1 +where t1.b>10 and t1.c>100; +create view v4_union as +select a, b, max(c)-100 as c from t1 +where t1.a<10 group by a,b having c > 109 +union +select a, b, (c+100) as c from t1 +where t1.b>10; +create view v_double as +select a, avg(a/4) as avg_a, b, c from t1_double +where (b>12.2) group by b,c having (avg_a<22.333); +create view v_char as +select a, b, max(c) as max_c from t1_char +group by a,b having max_c < 9; +create view v_decimal as +select a, b, avg(c) as avg_c from t1_decimal +group by a,b having (avg_c>12); +# conjunctive subformula : pushing into HAVING +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.max_c>214) and (t2.a>v1.a); +a b max_c avg_c a b c d +1 21 500 234.6000 2 3 207 207 +1 21 500 234.6000 7 13 312 406 +1 21 500 234.6000 8 64 248 107 +1 21 500 234.6000 6 20 315 279 +1 21 500 234.6000 8 80 800 314 +1 21 500 234.6000 3 12 231 190 +1 21 500 234.6000 6 23 303 909 +6 20 315 279.3333 7 13 312 406 +6 20 315 279.3333 8 64 248 107 +6 20 315 279.3333 8 80 800 314 +select * from v1,t2 where (v1.max_c>214) and (t2.a>v1.a); +a b max_c avg_c a b c d +1 21 500 234.6000 2 3 207 207 +1 21 500 234.6000 7 13 312 406 +1 21 500 234.6000 8 64 248 107 +1 21 500 234.6000 6 20 315 279 +1 21 500 234.6000 8 80 800 314 +1 21 500 234.6000 3 12 231 190 +1 21 500 234.6000 6 23 303 909 +6 20 315 279.3333 7 13 312 406 +6 20 315 279.3333 8 64 248 107 +6 20 315 279.3333 8 80 800 314 +explain select * from v1,t2 where (v1.max_c>214) and (t2.a>v1.a); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +explain format=json select * from v1,t2 where (v1.max_c>214) and (t2.a>v1.a); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.max_c > 214" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "t2.a > v1.a", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707 and max_c > 214", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + } + } + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +group by a,b having max_c < 707) v1, +t2 where (v1.a=t2.a) and (v1.max_c>300); +a b max_c avg_c a b c d +1 21 500 234.6000 1 21 909 12 +8 33 404 213.6667 8 64 248 107 +6 20 315 279.3333 6 20 315 279 +1 21 500 234.6000 1 19 203 107 +8 33 404 213.6667 8 80 800 314 +6 20 315 279.3333 6 23 303 909 +select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +group by a,b having max_c < 707) v1, +t2 where (v1.a=t2.a) and (v1.max_c>300); +a b max_c avg_c a b c d +1 21 500 234.6000 1 21 909 12 +8 33 404 213.6667 8 64 248 107 +6 20 315 279.3333 6 20 315 279 +1 21 500 234.6000 1 19 203 107 +8 33 404 213.6667 8 80 800 314 +6 20 315 279.3333 6 23 303 909 +explain select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +group by a,b having max_c < 707) v1, +t2 where (v1.a=t2.a) and (v1.max_c>300); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +explain format=json select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +group by a,b having max_c < 707) v1, +t2 where (v1.a=t2.a) and (v1.max_c>300); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v1.max_c > 300", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707 and max_c > 300", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + } + } + } + } + } + } + } +} +# extracted or formula : pushing into HAVING +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where +((v1.max_c>400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a<v1.a)); +a b max_c avg_c a b c d +1 21 500 234.6000 2 3 207 207 +1 21 500 234.6000 7 13 312 406 +1 21 500 234.6000 8 64 248 107 +1 21 500 234.6000 6 20 315 279 +1 21 500 234.6000 8 80 800 314 +1 21 500 234.6000 3 12 231 190 +1 21 500 234.6000 6 23 303 909 +5 27 132 132.0000 2 3 207 207 +5 27 132 132.0000 1 21 909 12 +5 27 132 132.0000 1 19 203 107 +5 27 132 132.0000 3 12 231 190 +select * from v1,t2 where +((v1.max_c>400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a<v1.a)); +a b max_c avg_c a b c d +1 21 500 234.6000 2 3 207 207 +1 21 500 234.6000 7 13 312 406 +1 21 500 234.6000 8 64 248 107 +1 21 500 234.6000 6 20 315 279 +1 21 500 234.6000 8 80 800 314 +1 21 500 234.6000 3 12 231 190 +1 21 500 234.6000 6 23 303 909 +5 27 132 132.0000 2 3 207 207 +5 27 132 132.0000 1 21 909 12 +5 27 132 132.0000 1 19 203 107 +5 27 132 132.0000 3 12 231 190 +explain select * from v1,t2 where +((v1.max_c>400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a<v1.a)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +explain format=json select * from v1,t2 where +((v1.max_c>400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a<v1.a)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.max_c > 400 or v1.max_c < 135" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v1.max_c > 400 and t2.a > v1.a or v1.max_c < 135 and t2.a < v1.a", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707 and (max_c > 400 or max_c < 135)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + } + } + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where +((v1.max_c>300) and (v1.avg_c>t2.d) and (v1.b=t2.b)) or +((v1.max_c<135) and (v1.max_c<t2.c) and (v1.a=t2.a)); +a b max_c avg_c a b c d +1 19 107 107.0000 1 21 909 12 +1 19 107 107.0000 1 19 203 107 +1 21 500 234.6000 1 21 909 12 +6 20 315 279.3333 6 20 315 279 +select * from v1,t2 where +((v1.max_c>300) and (v1.avg_c>t2.d) and (v1.b=t2.b)) or +((v1.max_c<135) and (v1.max_c<t2.c) and (v1.a=t2.a)); +a b max_c avg_c a b c d +1 19 107 107.0000 1 21 909 12 +1 19 107 107.0000 1 19 203 107 +1 21 500 234.6000 1 21 909 12 +6 20 315 279.3333 6 20 315 279 +explain select * from v1,t2 where +((v1.max_c>300) and (v1.avg_c>t2.d) and (v1.b=t2.b)) or +((v1.max_c<135) and (v1.max_c<t2.c) and (v1.a=t2.a)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +explain format=json select * from v1,t2 where +((v1.max_c>300) and (v1.avg_c>t2.d) and (v1.b=t2.b)) or +((v1.max_c<135) and (v1.max_c<t2.c) and (v1.a=t2.a)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.max_c > 300 or v1.max_c < 135" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v1.b = t2.b and v1.max_c > 300 and v1.avg_c > t2.d or v1.a = t2.a and v1.max_c < 135 and v1.max_c < t2.c", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707 and (max_c > 300 or max_c < 135)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + } + } + } + } + } + } + } +} +# conjunctive subformula : pushing into WHERE +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a>6) and (t2.b>v1.b); +a b max_c avg_c a b c d +8 33 404 213.6667 8 64 248 107 +8 33 404 213.6667 8 80 800 314 +select * from v1,t2 where (v1.a>6) and (t2.b>v1.b); +a b max_c avg_c a b c d +8 33 404 213.6667 8 64 248 107 +8 33 404 213.6667 8 80 800 314 +explain select * from v1,t2 where (v1.a>6) and (t2.b>v1.b); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v1,t2 where (v1.a>6) and (t2.b>v1.b); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.a > 6" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "t2.b > v1.b", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 6" + } + } + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v2,t2 where (v2.b>25) and (t2.a<v2.a); +a b max_c avg_c a b c d +8 33 404 213.6667 2 3 207 207 +8 33 404 213.6667 1 21 909 12 +8 33 404 213.6667 7 13 312 406 +8 33 404 213.6667 6 20 315 279 +8 33 404 213.6667 1 19 203 107 +8 33 404 213.6667 3 12 231 190 +8 33 404 213.6667 6 23 303 909 +select * from v2,t2 where (v2.b>25) and (t2.a<v2.a); +a b max_c avg_c a b c d +8 33 404 213.6667 2 3 207 207 +8 33 404 213.6667 1 21 909 12 +8 33 404 213.6667 7 13 312 406 +8 33 404 213.6667 6 20 315 279 +8 33 404 213.6667 1 19 203 107 +8 33 404 213.6667 3 12 231 190 +8 33 404 213.6667 6 23 303 909 +explain select * from v2,t2 where (v2.b>25) and (t2.a<v2.a); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v2,t2 where (v2.b>25) and (t2.a<v2.a); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v2.b > 25" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "t2.a < v2.a", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 5 and t1.b > 25" + } + } + } + } + } + } + } +} +# extracted or formula : pushing into WHERE +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where +((v1.a>7) and (t2.c<v1.max_c)) or ((v1.a<2) and (t2.b<v1.b)); +a b max_c avg_c a b c d +1 19 107 107.0000 2 3 207 207 +1 19 107 107.0000 7 13 312 406 +1 19 107 107.0000 3 12 231 190 +1 21 500 234.6000 2 3 207 207 +1 21 500 234.6000 7 13 312 406 +1 21 500 234.6000 6 20 315 279 +1 21 500 234.6000 1 19 203 107 +1 21 500 234.6000 3 12 231 190 +8 33 404 213.6667 2 3 207 207 +8 33 404 213.6667 7 13 312 406 +8 33 404 213.6667 8 64 248 107 +8 33 404 213.6667 6 20 315 279 +8 33 404 213.6667 1 19 203 107 +8 33 404 213.6667 3 12 231 190 +8 33 404 213.6667 6 23 303 909 +select * from v1,t2 where +((v1.a>7) and (t2.c<v1.max_c)) or ((v1.a<2) and (t2.b<v1.b)); +a b max_c avg_c a b c d +1 19 107 107.0000 2 3 207 207 +1 19 107 107.0000 7 13 312 406 +1 19 107 107.0000 3 12 231 190 +1 21 500 234.6000 2 3 207 207 +1 21 500 234.6000 7 13 312 406 +1 21 500 234.6000 6 20 315 279 +1 21 500 234.6000 1 19 203 107 +1 21 500 234.6000 3 12 231 190 +8 33 404 213.6667 2 3 207 207 +8 33 404 213.6667 7 13 312 406 +8 33 404 213.6667 8 64 248 107 +8 33 404 213.6667 6 20 315 279 +8 33 404 213.6667 1 19 203 107 +8 33 404 213.6667 3 12 231 190 +8 33 404 213.6667 6 23 303 909 +explain select * from v1,t2 where +((v1.a>7) and (t2.c<v1.max_c)) or ((v1.a<2) and (t2.b<v1.b)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v1,t2 where +((v1.a>7) and (t2.c<v1.max_c)) or ((v1.a<2) and (t2.b<v1.b)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.a > 7 or v1.a < 2" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v1.a > 7 and t2.c < v1.max_c or v1.a < 2 and t2.b < v1.b", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 7 or t1.a < 2" + } + } + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v2,t2 where +((v2.a>7) and (t2.c<v2.max_c)) or ((v2.a>5) and (t2.b<v2.b)); +a b max_c avg_c a b c d +6 20 315 279.3333 2 3 207 207 +6 20 315 279.3333 7 13 312 406 +6 20 315 279.3333 1 19 203 107 +6 20 315 279.3333 3 12 231 190 +8 33 404 213.6667 2 3 207 207 +8 33 404 213.6667 1 21 909 12 +8 33 404 213.6667 7 13 312 406 +8 33 404 213.6667 8 64 248 107 +8 33 404 213.6667 6 20 315 279 +8 33 404 213.6667 1 19 203 107 +8 33 404 213.6667 3 12 231 190 +8 33 404 213.6667 6 23 303 909 +select * from v2,t2 where +((v2.a>7) and (t2.c<v2.max_c)) or ((v2.a>5) and (t2.b<v2.b)); +a b max_c avg_c a b c d +6 20 315 279.3333 2 3 207 207 +6 20 315 279.3333 7 13 312 406 +6 20 315 279.3333 1 19 203 107 +6 20 315 279.3333 3 12 231 190 +8 33 404 213.6667 2 3 207 207 +8 33 404 213.6667 1 21 909 12 +8 33 404 213.6667 7 13 312 406 +8 33 404 213.6667 8 64 248 107 +8 33 404 213.6667 6 20 315 279 +8 33 404 213.6667 1 19 203 107 +8 33 404 213.6667 3 12 231 190 +8 33 404 213.6667 6 23 303 909 +explain select * from v2,t2 where +((v2.a>7) and (t2.c<v2.max_c)) or ((v2.a>5) and (t2.b<v2.b)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v2,t2 where +((v2.a>7) and (t2.c<v2.max_c)) or ((v2.a>5) and (t2.b<v2.b)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v2.a > 7 or v2.a > 5" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v2.a > 7 and t2.c < v2.max_c or v2.a > 5 and t2.b < v2.b", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 5 and (t1.a > 7 or t1.a > 5)" + } + } + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where +((v1.a>4) and (v1.b>t2.b) and (v1.max_c=t2.d)) or +((v1.a<2) and (v1.max_c<t2.c) and (v1.max_c=t2.d)); +a b max_c avg_c a b c d +1 19 107 107.0000 8 64 248 107 +1 19 107 107.0000 1 19 203 107 +5 16 207 207.0000 2 3 207 207 +select * from v1,t2 where +((v1.a>4) and (v1.b>t2.b) and (v1.max_c=t2.d)) or +((v1.a<2) and (v1.max_c<t2.c) and (v1.max_c=t2.d)); +a b max_c avg_c a b c d +1 19 107 107.0000 8 64 248 107 +1 19 107 107.0000 1 19 203 107 +5 16 207 207.0000 2 3 207 207 +explain select * from v1,t2 where +((v1.a>4) and (v1.b>t2.b) and (v1.max_c=t2.d)) or +((v1.a<2) and (v1.max_c<t2.c) and (v1.max_c=t2.d)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v1,t2 where +((v1.a>4) and (v1.b>t2.b) and (v1.max_c=t2.d)) or +((v1.a<2) and (v1.max_c<t2.c) and (v1.max_c=t2.d)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.a > 4 or v1.a < 2" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v1.a > 4 and v1.b > t2.b and v1.max_c = t2.d or v1.a < 2 and v1.max_c < t2.c and v1.max_c = t2.d", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 4 or t1.a < 2" + } + } + } + } + } + } + } +} +# conjunctive subformulas : pushing into HAVING and WHERE +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a<2) and (v1.max_c>400) and (t2.b>v1.b); +a b max_c avg_c a b c d +1 21 500 234.6000 8 64 248 107 +1 21 500 234.6000 8 80 800 314 +1 21 500 234.6000 6 23 303 909 +select * from v1,t2 where (v1.a<2) and (v1.max_c>400) and (t2.b>v1.b); +a b max_c avg_c a b c d +1 21 500 234.6000 8 64 248 107 +1 21 500 234.6000 8 80 800 314 +1 21 500 234.6000 6 23 303 909 +explain select * from v1,t2 where (v1.a<2) and (v1.max_c>400) and (t2.b>v1.b); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v1,t2 where (v1.a<2) and (v1.max_c>400) and (t2.b>v1.b); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.a < 2 and v1.max_c > 400" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "t2.b > v1.b", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707 and max_c > 400", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a < 2" + } + } + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_double as v,t2_double as t where +(v.a=t.a) and (v.avg_a>0.45) and (v.b>10); +a avg_a b c a b c +1 0.50000000 12.5 18.9 1 22.4 14.3333 +1 0.50000000 12.5 18.9 1 12.5 18.9 +4 1.00000000 33.4 14.3333 4 33.4 14.3333 +4 1.00000000 14.3333 13.65 4 33.4 14.3333 +5 1.25000000 17.89 7.22 5 22.4 13.65 +6 1.50000000 33.4 14.3 6 33.4 14.3333 +10 2.62500000 33.4 13.65 10 31.4 13.65 +select * from v_double as v,t2_double as t where +(v.a=t.a) and (v.avg_a>0.45) and (v.b>10); +a avg_a b c a b c +1 0.50000000 12.5 18.9 1 22.4 14.3333 +1 0.50000000 12.5 18.9 1 12.5 18.9 +4 1.00000000 33.4 14.3333 4 33.4 14.3333 +4 1.00000000 14.3333 13.65 4 33.4 14.3333 +5 1.25000000 17.89 7.22 5 22.4 13.65 +6 1.50000000 33.4 14.3 6 33.4 14.3333 +10 2.62500000 33.4 13.65 10 31.4 13.65 +explain select * from v_double as v,t2_double as t where +(v.a=t.a) and (v.avg_a>0.45) and (v.b>10); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t.a 2 Using where +2 DERIVED t1_double ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort +explain format=json select * from v_double as v,t2_double as t where +(v.a=t.a) and (v.avg_a>0.45) and (v.b>10); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v.avg_a > 0.45 and v.b > 10", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "avg_a < 22.333 and avg_a > 0.45", + "filesort": { + "sort_key": "t1_double.b, t1_double.c", + "temporary_table": { + "table": { + "table_name": "t1_double", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t1_double.b > 12.2 and t1_double.b > 10" + } + } + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_decimal as v,t2_decimal as t where +(v.a=t.a) and (v.avg_c>15) and (v.b>1); +a b avg_c a b c +3.0 3.0 16.0000 3.0 3.0 16 +select * from v_decimal as v,t2_decimal as t where +(v.a=t.a) and (v.avg_c>15) and (v.b>1); +a b avg_c a b c +3.0 3.0 16.0000 3.0 3.0 16 +explain select * from v_decimal as v,t2_decimal as t where +(v.a=t.a) and (v.avg_c>15) and (v.b>1); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 3 test.t.a 2 Using where +2 DERIVED t1_decimal ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort +explain format=json select * from v_decimal as v,t2_decimal as t where +(v.a=t.a) and (v.avg_c>15) and (v.b>1); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "3", + "used_key_parts": ["a"], + "ref": ["test.t.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v.avg_c > 15 and v.b > 1", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "avg_c > 12 and avg_c > 15", + "filesort": { + "sort_key": "t1_decimal.a, t1_decimal.b", + "temporary_table": { + "table": { + "table_name": "t1_decimal", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t1_decimal.b > 1" + } + } + } + } + } + } + } +} +# extracted or formula : pushing into HAVING and WHERE +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where +((v1.a>7) and (v1.max_c>300) and (t2.c<v1.max_c)) or +((v1.a<4) and (v1.max_c<500) and (t2.b<v1.b)); +a b max_c avg_c a b c d +1 19 107 107.0000 2 3 207 207 +1 19 107 107.0000 7 13 312 406 +1 19 107 107.0000 3 12 231 190 +8 33 404 213.6667 2 3 207 207 +8 33 404 213.6667 7 13 312 406 +8 33 404 213.6667 8 64 248 107 +8 33 404 213.6667 6 20 315 279 +8 33 404 213.6667 1 19 203 107 +8 33 404 213.6667 3 12 231 190 +8 33 404 213.6667 6 23 303 909 +select * from v1,t2 where +((v1.a>7) and (v1.max_c>300) and (t2.c<v1.max_c)) or +((v1.a<4) and (v1.max_c<500) and (t2.b<v1.b)); +a b max_c avg_c a b c d +1 19 107 107.0000 2 3 207 207 +1 19 107 107.0000 7 13 312 406 +1 19 107 107.0000 3 12 231 190 +8 33 404 213.6667 2 3 207 207 +8 33 404 213.6667 7 13 312 406 +8 33 404 213.6667 8 64 248 107 +8 33 404 213.6667 6 20 315 279 +8 33 404 213.6667 1 19 203 107 +8 33 404 213.6667 3 12 231 190 +8 33 404 213.6667 6 23 303 909 +explain select * from v1,t2 where +((v1.a>7) and (v1.max_c>300) and (t2.c<v1.max_c)) or +((v1.a<4) and (v1.max_c<500) and (t2.b<v1.b)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v1,t2 where +((v1.a>7) and (v1.max_c>300) and (t2.c<v1.max_c)) or +((v1.a<4) and (v1.max_c<500) and (t2.b<v1.b)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.a > 7 and v1.max_c > 300 or v1.a < 4 and v1.max_c < 500" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v1.a > 7 and v1.max_c > 300 and t2.c < v1.max_c or v1.a < 4 and v1.max_c < 500 and t2.b < v1.b", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707 and (t1.a > 7 and max_c > 300 or t1.a < 4 and max_c < 500)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 7 or t1.a < 4" + } + } + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where ((v1.a<2) and (v1.max_c>120)) or (v1.a>7); +a b max_c avg_c a b c d +1 21 500 234.6000 2 3 207 207 +1 21 500 234.6000 1 21 909 12 +1 21 500 234.6000 7 13 312 406 +1 21 500 234.6000 8 64 248 107 +1 21 500 234.6000 6 20 315 279 +1 21 500 234.6000 1 19 203 107 +1 21 500 234.6000 8 80 800 314 +1 21 500 234.6000 3 12 231 190 +1 21 500 234.6000 6 23 303 909 +8 33 404 213.6667 2 3 207 207 +8 33 404 213.6667 1 21 909 12 +8 33 404 213.6667 7 13 312 406 +8 33 404 213.6667 8 64 248 107 +8 33 404 213.6667 6 20 315 279 +8 33 404 213.6667 1 19 203 107 +8 33 404 213.6667 8 80 800 314 +8 33 404 213.6667 3 12 231 190 +8 33 404 213.6667 6 23 303 909 +select * from v1,t2 where ((v1.a<2) and (v1.max_c>120)) or (v1.a>7); +a b max_c avg_c a b c d +1 21 500 234.6000 2 3 207 207 +1 21 500 234.6000 1 21 909 12 +1 21 500 234.6000 7 13 312 406 +1 21 500 234.6000 8 64 248 107 +1 21 500 234.6000 6 20 315 279 +1 21 500 234.6000 1 19 203 107 +1 21 500 234.6000 8 80 800 314 +1 21 500 234.6000 3 12 231 190 +1 21 500 234.6000 6 23 303 909 +8 33 404 213.6667 2 3 207 207 +8 33 404 213.6667 1 21 909 12 +8 33 404 213.6667 7 13 312 406 +8 33 404 213.6667 8 64 248 107 +8 33 404 213.6667 6 20 315 279 +8 33 404 213.6667 1 19 203 107 +8 33 404 213.6667 8 80 800 314 +8 33 404 213.6667 3 12 231 190 +8 33 404 213.6667 6 23 303 909 +explain select * from v1,t2 where ((v1.a<2) and (v1.max_c>120)) or (v1.a>7); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v1,t2 where ((v1.a<2) and (v1.max_c>120)) or (v1.a>7); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.a < 2 and v1.max_c > 120 or v1.a > 7" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v1.a < 2 and v1.max_c > 120 or v1.a > 7", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707 and (t1.a < 2 and max_c > 120 or t1.a > 7)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a < 2 or t1.a > 7" + } + } + } + } + } + } + } +} +# extracted or formulas : pushing into WHERE and HAVING +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where +((v1.a<2) and (v1.max_c>120) and (v1.b=t2.b)) or (v1.a>7); +a b max_c avg_c a b c d +1 21 500 234.6000 1 21 909 12 +8 33 404 213.6667 2 3 207 207 +8 33 404 213.6667 1 21 909 12 +8 33 404 213.6667 7 13 312 406 +8 33 404 213.6667 8 64 248 107 +8 33 404 213.6667 6 20 315 279 +8 33 404 213.6667 1 19 203 107 +8 33 404 213.6667 8 80 800 314 +8 33 404 213.6667 3 12 231 190 +8 33 404 213.6667 6 23 303 909 +select * from v1,t2 where +((v1.a<2) and (v1.max_c>120) and (v1.b=t2.b)) or (v1.a>7); +a b max_c avg_c a b c d +1 21 500 234.6000 1 21 909 12 +8 33 404 213.6667 2 3 207 207 +8 33 404 213.6667 1 21 909 12 +8 33 404 213.6667 7 13 312 406 +8 33 404 213.6667 8 64 248 107 +8 33 404 213.6667 6 20 315 279 +8 33 404 213.6667 1 19 203 107 +8 33 404 213.6667 8 80 800 314 +8 33 404 213.6667 3 12 231 190 +8 33 404 213.6667 6 23 303 909 +explain select * from v1,t2 where +((v1.a<2) and (v1.max_c>120) and (v1.b=t2.b)) or (v1.a>7); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v1,t2 where +((v1.a<2) and (v1.max_c>120) and (v1.b=t2.b)) or (v1.a>7); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.a < 2 and v1.max_c > 120 or v1.a > 7" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v1.b = t2.b and v1.a < 2 and v1.max_c > 120 or v1.a > 7", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707 and (t1.a < 2 and max_c > 120 or t1.a > 7)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a < 2 or t1.a > 7" + } + } + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where +((v1.a<2) and (v1.max_c<200) and (t2.c>v1.max_c) and (v1.max_c=t2.d)) or +((v1.a>4) and (v1.max_c<500) and (t2.b<v1.b) and (v1.max_c=t2.c)); +a b max_c avg_c a b c d +1 19 107 107.0000 8 64 248 107 +1 19 107 107.0000 1 19 203 107 +5 16 207 207.0000 2 3 207 207 +select * from v1,t2 where +((v1.a<2) and (v1.max_c<200) and (t2.c>v1.max_c) and (v1.max_c=t2.d)) or +((v1.a>4) and (v1.max_c<500) and (t2.b<v1.b) and (v1.max_c=t2.c)); +a b max_c avg_c a b c d +1 19 107 107.0000 8 64 248 107 +1 19 107 107.0000 1 19 203 107 +5 16 207 207.0000 2 3 207 207 +explain select * from v1,t2 where +((v1.a<2) and (v1.max_c<200) and (t2.c>v1.max_c) and (v1.max_c=t2.d)) or +((v1.a>4) and (v1.max_c<500) and (t2.b<v1.b) and (v1.max_c=t2.c)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v1,t2 where +((v1.a<2) and (v1.max_c<200) and (t2.c>v1.max_c) and (v1.max_c=t2.d)) or +((v1.a>4) and (v1.max_c<500) and (t2.b<v1.b) and (v1.max_c=t2.c)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.a < 2 and v1.max_c < 200 or v1.a > 4" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v1.a < 2 and v1.max_c < 200 and t2.c > v1.max_c and v1.max_c = t2.d or v1.max_c = t2.c and v1.a > 4 and t2.c < 500 and t2.b < v1.b", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707 and (t1.a < 2 and max_c < 200 or t1.a > 4 and max_c < 500)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a < 2 or t1.a > 4" + } + } + } + } + } + } + } +} +# prepare of a query containing extracted or formula +prepare stmt from "select * from v1,t2 where + ((v1.max_c>400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a<v1.a));"; +execute stmt; +a b max_c avg_c a b c d +1 21 500 234.6000 2 3 207 207 +1 21 500 234.6000 7 13 312 406 +1 21 500 234.6000 8 64 248 107 +1 21 500 234.6000 6 20 315 279 +1 21 500 234.6000 8 80 800 314 +1 21 500 234.6000 3 12 231 190 +1 21 500 234.6000 6 23 303 909 +5 27 132 132.0000 2 3 207 207 +5 27 132 132.0000 1 21 909 12 +5 27 132 132.0000 1 19 203 107 +5 27 132 132.0000 3 12 231 190 +execute stmt; +a b max_c avg_c a b c d +1 21 500 234.6000 2 3 207 207 +1 21 500 234.6000 7 13 312 406 +1 21 500 234.6000 8 64 248 107 +1 21 500 234.6000 6 20 315 279 +1 21 500 234.6000 8 80 800 314 +1 21 500 234.6000 3 12 231 190 +1 21 500 234.6000 6 23 303 909 +5 27 132 132.0000 2 3 207 207 +5 27 132 132.0000 1 21 909 12 +5 27 132 132.0000 1 19 203 107 +5 27 132 132.0000 3 12 231 190 +deallocate prepare stmt; +prepare stmt from +"explain format=json select * from v1,t2 where + ((v1.max_c>400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a<v1.a));"; +execute stmt; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.max_c > 400 or v1.max_c < 135" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v1.max_c > 400 and t2.a > v1.a or v1.max_c < 135 and t2.a < v1.a", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707 and (max_c > 400 or max_c < 135)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + } + } + } + } + } + } + } +} +execute stmt; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.max_c > 400 or v1.max_c < 135" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v1.max_c > 400 and t2.a > v1.a or v1.max_c < 135 and t2.a < v1.a", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707 and (max_c > 400 or max_c < 135)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + } + } + } + } + } + } + } +} +deallocate prepare stmt; +# conjunctive subformula : pushing into WHERE +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (t2.a=v1.a) and (v1.b=t2.b) and (v1.a=1); +a b max_c avg_c a b c d +1 21 500 234.6000 1 21 909 12 +1 19 107 107.0000 1 19 203 107 +select * from v1,t2 where (t2.a=v1.a) and (v1.b=t2.b) and (v1.a=1); +a b max_c avg_c a b c d +1 21 500 234.6000 1 21 909 12 +1 19 107 107.0000 1 19 203 107 +explain select * from v1,t2 where (t2.a=v1.a) and (v1.b=t2.b) and (v1.a=1); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.b 2 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v1,t2 where (t2.a=v1.a) and (v1.b=t2.b) and (v1.a=1); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a = 1 and t2.b is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["b"], + "ref": ["test.t2.b"], + "rows": 2, + "filtered": 100, + "attached_condition": "v1.a = 1", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a = 1" + } + } + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=5) and (v1.max_c=t2.d); +a b max_c avg_c a b c d +5 16 207 207.0000 2 3 207 207 +select * from v1,t2 where (v1.a=5) and (v1.max_c=t2.d); +a b max_c avg_c a b c d +5 16 207 207.0000 2 3 207 207 +explain select * from v1,t2 where (v1.a=5) and (v1.max_c=t2.d); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.d 2 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v1,t2 where (v1.a=5) and (v1.max_c=t2.d); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.d is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["max_c"], + "ref": ["test.t2.d"], + "rows": 2, + "filtered": 100, + "attached_condition": "v1.a = 5 and v1.max_c = t2.d", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a = 5" + } + } + } + } + } + } + } +} +# conjunctive subformula : pushing into WHERE using equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (t2.a<5) and (v1.a=t2.a); +a b max_c avg_c a b c d +1 21 500 234.6000 1 21 909 12 +1 19 107 107.0000 1 21 909 12 +1 21 500 234.6000 1 19 203 107 +1 19 107 107.0000 1 19 203 107 +select * from v1,t2 where (t2.a<5) and (v1.a=t2.a); +a b max_c avg_c a b c d +1 21 500 234.6000 1 21 909 12 +1 19 107 107.0000 1 21 909 12 +1 21 500 234.6000 1 19 203 107 +1 19 107 107.0000 1 19 203 107 +explain select * from v1,t2 where (t2.a<5) and (v1.a=t2.a); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v1,t2 where (t2.a<5) and (v1.a=t2.a); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a < 5 and t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a < 5" + } + } + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a); +a b max_c avg_c a b c d +select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a); +a b max_c avg_c a b c d +explain select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 10 test.t2.a,test.t2.a 2 +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a is not null and t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "10", + "used_key_parts": ["a", "b"], + "ref": ["test.t2.a", "test.t2.a"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.b = t1.a" + } + } + } + } + } + } + } +} +# conjunctive subformula : pushing into HAVING using equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (t2.c>150) and (v1.max_c=t2.c); +a b max_c avg_c a b c d +5 16 207 207.0000 2 3 207 207 +6 20 315 279.3333 6 20 315 279 +select * from v1,t2 where (t2.c>150) and (v1.max_c=t2.c); +a b max_c avg_c a b c d +5 16 207 207.0000 2 3 207 207 +6 20 315 279.3333 6 20 315 279 +explain select * from v1,t2 where (t2.c>150) and (v1.max_c=t2.c); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 2 +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +explain format=json select * from v1,t2 where (t2.c>150) and (v1.max_c=t2.c); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.c > 150 and t2.c is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["max_c"], + "ref": ["test.t2.c"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707 and max_c > 150", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + } + } + } + } + } + } + } +} +# extracted and formula : pushing into WHERE +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a) and (v1.a=3); +a b max_c avg_c a b c d +select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a) and (v1.a=3); +a b max_c avg_c a b c d +explain select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a) and (v1.a=3); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where +explain format=json select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a) and (v1.a=3); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a = 3" + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.a = 3 and v1.b = 3" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707", + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a = 3 and t1.b = 3" + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=1) and (v1.b=21) and (t2.a=2); +a b max_c avg_c a b c d +1 21 500 234.6000 2 3 207 207 +select * from v1,t2 where (v1.a=1) and (v1.b=21) and (t2.a=2); +a b max_c avg_c a b c d +1 21 500 234.6000 2 3 207 207 +explain select * from v1,t2 where (v1.a=1) and (v1.b=21) and (t2.a=2); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where +explain format=json select * from v1,t2 where (v1.a=1) and (v1.b=21) and (t2.a=2); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a = 2" + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.a = 1 and v1.b = 21" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707", + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a = 1 and t1.b = 21" + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_char as v,t2_char as t where +(v.a='c') and (v.b<'Hermes') and ((v.b=t.b) or (v.max_c>20)); +a b max_c a b c +c Harry 4 d Harry 1 +c Harry 4 b Harry 4 +select * from v_char as v,t2_char as t where +(v.a='c') and (v.b<'Hermes') and ((v.b=t.b) or (v.max_c>20)); +a b max_c a b c +c Harry 4 d Harry 1 +c Harry 4 b Harry 4 +explain select * from v_char as v,t2_char as t where +(v.a='c') and (v.b<'Hermes') and ((v.b=t.b) or (v.max_c>20)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 12 Using where +1 PRIMARY t ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1_char ALL NULL NULL NULL NULL 12 Using where; Using temporary; Using filesort +explain format=json select * from v_char as v,t2_char as t where +(v.a='c') and (v.b<'Hermes') and ((v.b=t.b) or (v.max_c>20)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 12, + "filtered": 100, + "attached_condition": "v.a = 'c' and v.b < 'Hermes'", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 9", + "filesort": { + "sort_key": "t1_char.b", + "temporary_table": { + "table": { + "table_name": "t1_char", + "access_type": "ALL", + "rows": 12, + "filtered": 100, + "attached_condition": "t1_char.a = 'c' and t1_char.b < 'Hermes'" + } + } + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "t", + "access_type": "ALL", + "rows": 12, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "t.b = v.b or v.max_c > 20" + } + } +} +# extracted and formula : pushing into WHERE using equalities +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_decimal as v,t2_decimal as t where +(v.a=v.b) and (v.b=t.b) and ((t.b>1) or (v.a=1)); +a b avg_c a b c +1.0 1.0 16.3333 2.0 1.0 13 +3.0 3.0 16.0000 3.0 3.0 16 +3.0 3.0 16.0000 1.0 3.0 22 +3.0 3.0 16.0000 1.0 3.0 14 +1.0 1.0 16.3333 2.0 1.0 43 +3.0 3.0 16.0000 2.0 3.0 11 +3.0 3.0 16.0000 2.0 3.0 16 +select * from v_decimal as v,t2_decimal as t where +(v.a=v.b) and (v.b=t.b) and ((t.b>1) or (v.a=1)); +a b avg_c a b c +1.0 1.0 16.3333 2.0 1.0 13 +3.0 3.0 16.0000 3.0 3.0 16 +3.0 3.0 16.0000 1.0 3.0 22 +3.0 3.0 16.0000 1.0 3.0 14 +1.0 1.0 16.3333 2.0 1.0 43 +3.0 3.0 16.0000 2.0 3.0 11 +3.0 3.0 16.0000 2.0 3.0 16 +explain select * from v_decimal as v,t2_decimal as t where +(v.a=v.b) and (v.b=t.b) and ((t.b>1) or (v.a=1)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 6 test.t.b,test.t.b 2 +2 DERIVED t1_decimal ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort +explain format=json select * from v_decimal as v,t2_decimal as t where +(v.a=v.b) and (v.b=t.b) and ((t.b>1) or (v.a=1)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "(t.b > 1 or t.b = 1) and t.b is not null and t.b is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "6", + "used_key_parts": ["a", "b"], + "ref": ["test.t.b", "test.t.b"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "avg_c > 12", + "filesort": { + "sort_key": "t1_decimal.a, t1_decimal.b", + "temporary_table": { + "table": { + "table_name": "t1_decimal", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t1_decimal.b = t1_decimal.a and (t1_decimal.a > 1 or t1_decimal.a = 1)" + } + } + } + } + } + } + } +} +# extracted or formula : pushing into HAVING using equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 +where ((t2.a<4) and (v1.a=t2.a)) or ((t2.c>150) and (v1.max_c=t2.c)); +a b max_c avg_c a b c d +1 19 107 107.0000 1 21 909 12 +1 19 107 107.0000 1 19 203 107 +1 21 500 234.6000 1 21 909 12 +1 21 500 234.6000 1 19 203 107 +5 16 207 207.0000 2 3 207 207 +6 20 315 279.3333 6 20 315 279 +select * from v1,t2 +where ((t2.a<4) and (v1.a=t2.a)) or ((t2.c>150) and (v1.max_c=t2.c)); +a b max_c avg_c a b c d +1 19 107 107.0000 1 21 909 12 +1 19 107 107.0000 1 19 203 107 +1 21 500 234.6000 1 21 909 12 +1 21 500 234.6000 1 19 203 107 +5 16 207 207.0000 2 3 207 207 +6 20 315 279.3333 6 20 315 279 +explain select * from v1,t2 +where ((t2.a<4) and (v1.a=t2.a)) or ((t2.c>150) and (v1.max_c=t2.c)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +explain format=json select * from v1,t2 +where ((t2.a<4) and (v1.a=t2.a)) or ((t2.c>150) and (v1.max_c=t2.c)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a < 4 or t2.c > 150" + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v1.a = t2.a and t2.a < 4 or v1.max_c = t2.c and t2.c > 150", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707 and (t1.a < 4 or max_c > 150)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + } + } + } + } + } + } + } +} +# conjunctive subformulas : pushing into WHERE and HAVING using equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 +where ((t2.a>5) and (v1.a=t2.a)) and ((t2.c>250) and (v1.max_c=t2.c)); +a b max_c avg_c a b c d +6 20 315 279.3333 6 20 315 279 +select * from v1,t2 +where ((t2.a>5) and (v1.a=t2.a)) and ((t2.c>250) and (v1.max_c=t2.c)); +a b max_c avg_c a b c d +6 20 315 279.3333 6 20 315 279 +explain select * from v1,t2 +where ((t2.a>5) and (v1.a=t2.a)) and ((t2.c>250) and (v1.max_c=t2.c)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 10 test.t2.a,test.t2.c 2 +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v1,t2 +where ((t2.a>5) and (v1.a=t2.a)) and ((t2.c>250) and (v1.max_c=t2.c)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a > 5 and t2.c > 250 and t2.a is not null and t2.c is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "10", + "used_key_parts": ["a", "max_c"], + "ref": ["test.t2.a", "test.t2.c"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707 and max_c > 250", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 5" + } + } + } + } + } + } + } +} +# conjunctive subformulas : pushing into WHERE and HAVING +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +group by a,b having max_c < 707) v1, +t2 where (v1.a=8) and (v1.a=t2.a) and (v1.max_c=404); +a b max_c avg_c a b c d +8 33 404 213.6667 8 64 248 107 +8 33 404 213.6667 8 80 800 314 +select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +group by a,b having max_c < 707) v1, +t2 where (v1.a=8) and (v1.a=t2.a) and (v1.max_c=404); +a b max_c avg_c a b c d +8 33 404 213.6667 8 64 248 107 +8 33 404 213.6667 8 80 800 314 +explain select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +group by a,b having max_c < 707) v1, +t2 where (v1.a=8) and (v1.a=t2.a) and (v1.max_c=404); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +group by a,b having max_c < 707) v1, +t2 where (v1.a=8) and (v1.a=t2.a) and (v1.max_c=404); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a = 8" + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.a = 8 and v1.max_c = 404" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c = 404", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a = 8" + } + } + } + } + } + } + } +} +# conjunctive subformulas : pushing into WHERE and HAVING +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where +(v1.a>3) and (v1.max_c>200) and (t2.b<v1.b) and (t2.d=v1.max_c); +a b max_c avg_c a b c d +5 16 207 207.0000 2 3 207 207 +select * from v1,t2 where +(v1.a>3) and (v1.max_c>200) and (t2.b<v1.b) and (t2.d=v1.max_c); +a b max_c avg_c a b c d +5 16 207 207.0000 2 3 207 207 +explain select * from v1,t2 where +(v1.a>3) and (v1.max_c>200) and (t2.b<v1.b) and (t2.d=v1.max_c); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.d 2 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v1,t2 where +(v1.a>3) and (v1.max_c>200) and (t2.b<v1.b) and (t2.d=v1.max_c); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.d is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["max_c"], + "ref": ["test.t2.d"], + "rows": 2, + "filtered": 100, + "attached_condition": "v1.a > 3 and v1.max_c > 200 and t2.b < v1.b and t2.d = v1.max_c", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707 and max_c > 200", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 3" + } + } + } + } + } + } + } +} +# conjunctive subformula : pushing into WHERE +# extracted or formula : pushing into HAVING using equalities +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_double as v,t2_double as t where +(v.b=v.c) and (v.c=t.c) and ((t.c>10) or (v.a=1)); +a avg_a b c a b c +select * from v_double as v,t2_double as t where +(v.b=v.c) and (v.c=t.c) and ((t.c>10) or (v.a=1)); +a avg_a b c a b c +explain select * from v_double as v,t2_double as t where +(v.b=v.c) and (v.c=t.c) and ((t.c>10) or (v.a=1)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 18 test.t.c,test.t.c 2 Using where +2 DERIVED t1_double ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort +explain format=json select * from v_double as v,t2_double as t where +(v.b=v.c) and (v.c=t.c) and ((t.c>10) or (v.a=1)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t.c is not null and t.c is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "18", + "used_key_parts": ["b", "c"], + "ref": ["test.t.c", "test.t.c"], + "rows": 2, + "filtered": 100, + "attached_condition": "t.c > 10 or v.a = 1", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "avg_a < 22.333 and (t1_double.b > 10 or t1_double.a = 1)", + "filesort": { + "sort_key": "t1_double.b, t1_double.c", + "temporary_table": { + "table": { + "table_name": "t1_double", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t1_double.c = t1_double.b and t1_double.b > 12.2" + } + } + } + } + } + } + } +} +# conjunctive subformula : pushing into WHERE +# extracted or formula : pushing into HAVING using equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_double as v,t2_double as t where +(((v.a>0.2) or (v.b<17)) or (t.c>17)) and (t.c=v.c) and (v.c>18); +a avg_a b c a b c +1 0.50000000 12.5 18.9 1 12.5 18.9 +1 0.50000000 12.5 18.9 2 22.4 18.9 +1 0.50000000 12.5 18.9 7 17.89 18.9 +select * from v_double as v,t2_double as t where +(((v.a>0.2) or (v.b<17)) or (t.c>17)) and (t.c=v.c) and (v.c>18); +a avg_a b c a b c +1 0.50000000 12.5 18.9 1 12.5 18.9 +1 0.50000000 12.5 18.9 2 22.4 18.9 +1 0.50000000 12.5 18.9 7 17.89 18.9 +explain select * from v_double as v,t2_double as t where +(((v.a>0.2) or (v.b<17)) or (t.c>17)) and (t.c=v.c) and (v.c>18); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 9 test.t.c 2 Using where +2 DERIVED t1_double ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort +explain format=json select * from v_double as v,t2_double as t where +(((v.a>0.2) or (v.b<17)) or (t.c>17)) and (t.c=v.c) and (v.c>18); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t.c > 18 and t.c is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "9", + "used_key_parts": ["c"], + "ref": ["test.t.c"], + "rows": 2, + "filtered": 100, + "attached_condition": "v.a > 0.2 or v.b < 17 or t.c > 17", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "avg_a < 22.333 and (t1_double.a > 0.2 or t1_double.b < 17 or t1_double.c > 17)", + "filesort": { + "sort_key": "t1_double.b, t1_double.c", + "temporary_table": { + "table": { + "table_name": "t1_double", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t1_double.b > 12.2 and t1_double.c > 18" + } + } + } + } + } + } + } +} +# extracted or formula : pushing into WHERE +# conjunctive subformula : pushing into HAVING +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_decimal as v,t2_decimal as t where +(((v.a>4) or (v.a=2)) or (v.b>3)) and (v.avg_c=13); +a b avg_c a b c +2.0 1.0 13.0000 2.0 1.0 13 +2.0 3.0 13.0000 2.0 1.0 13 +2.0 1.0 13.0000 2.0 2.0 11 +2.0 3.0 13.0000 2.0 2.0 11 +2.0 1.0 13.0000 3.0 3.0 16 +2.0 3.0 13.0000 3.0 3.0 16 +2.0 1.0 13.0000 1.0 3.0 22 +2.0 3.0 13.0000 1.0 3.0 22 +2.0 1.0 13.0000 1.0 3.0 14 +2.0 3.0 13.0000 1.0 3.0 14 +2.0 1.0 13.0000 2.0 2.0 15 +2.0 3.0 13.0000 2.0 2.0 15 +2.0 1.0 13.0000 2.0 1.0 43 +2.0 3.0 13.0000 2.0 1.0 43 +2.0 1.0 13.0000 2.0 3.0 11 +2.0 3.0 13.0000 2.0 3.0 11 +2.0 1.0 13.0000 2.0 3.0 16 +2.0 3.0 13.0000 2.0 3.0 16 +select * from v_decimal as v,t2_decimal as t where +(((v.a>4) or (v.a=2)) or (v.b>3)) and (v.avg_c=13); +a b avg_c a b c +2.0 1.0 13.0000 2.0 1.0 13 +2.0 3.0 13.0000 2.0 1.0 13 +2.0 1.0 13.0000 2.0 2.0 11 +2.0 3.0 13.0000 2.0 2.0 11 +2.0 1.0 13.0000 3.0 3.0 16 +2.0 3.0 13.0000 3.0 3.0 16 +2.0 1.0 13.0000 1.0 3.0 22 +2.0 3.0 13.0000 1.0 3.0 22 +2.0 1.0 13.0000 1.0 3.0 14 +2.0 3.0 13.0000 1.0 3.0 14 +2.0 1.0 13.0000 2.0 2.0 15 +2.0 3.0 13.0000 2.0 2.0 15 +2.0 1.0 13.0000 2.0 1.0 43 +2.0 3.0 13.0000 2.0 1.0 43 +2.0 1.0 13.0000 2.0 3.0 11 +2.0 3.0 13.0000 2.0 3.0 11 +2.0 1.0 13.0000 2.0 3.0 16 +2.0 3.0 13.0000 2.0 3.0 16 +explain select * from v_decimal as v,t2_decimal as t where +(((v.a>4) or (v.a=2)) or (v.b>3)) and (v.avg_c=13); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY t ALL NULL NULL NULL NULL 9 Using join buffer (flat, BNL join) +2 DERIVED t1_decimal ALL NULL NULL NULL NULL 9 Using where; Using temporary; Using filesort +explain format=json select * from v_decimal as v,t2_decimal as t where +(((v.a>4) or (v.a=2)) or (v.b>3)) and (v.avg_c=13); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "(v.a > 4 or v.a = 2 or v.b > 3) and v.avg_c = 13", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "avg_c > 12 and avg_c = 13", + "filesort": { + "sort_key": "t1_decimal.a, t1_decimal.b", + "temporary_table": { + "table": { + "table_name": "t1_decimal", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t1_decimal.a > 4 or t1_decimal.a = 2 or t1_decimal.b > 3" + } + } + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "t", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL" + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +where t1.a>5 group by a,b having max_c < 707) v1, +t2 where (v1.a=t2.a) and (v1.max_c>300) and (v1.a=v1.b); +a b max_c avg_c a b c d +select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +where t1.a>5 group by a,b having max_c < 707) v1, +t2 where (v1.a=t2.a) and (v1.max_c>300) and (v1.a=v1.b); +a b max_c avg_c a b c d +explain select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +where t1.a>5 group by a,b having max_c < 707) v1, +t2 where (v1.a=t2.a) and (v1.max_c>300) and (v1.a=v1.b); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 10 test.t2.a,test.t2.a 2 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +where t1.a>5 group by a,b having max_c < 707) v1, +t2 where (v1.a=t2.a) and (v1.max_c>300) and (v1.a=v1.b); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a is not null and t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "10", + "used_key_parts": ["a", "b"], + "ref": ["test.t2.a", "test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v1.max_c > 300", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707 and max_c > 300", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.b = t1.a and t1.a > 5" + } + } + } + } + } + } + } +} +# nothing to push +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (t2.a<2) and (t2.c>900); +a b max_c avg_c a b c d +1 19 107 107.0000 1 21 909 12 +1 21 500 234.6000 1 21 909 12 +5 16 207 207.0000 1 21 909 12 +5 27 132 132.0000 1 21 909 12 +6 20 315 279.3333 1 21 909 12 +8 33 404 213.6667 1 21 909 12 +select * from v1,t2 where (t2.a<2) and (t2.c>900); +a b max_c avg_c a b c d +1 19 107 107.0000 1 21 909 12 +1 21 500 234.6000 1 21 909 12 +5 16 207 207.0000 1 21 909 12 +5 27 132 132.0000 1 21 909 12 +6 20 315 279.3333 1 21 909 12 +8 33 404 213.6667 1 21 909 12 +explain select * from v1,t2 where (t2.a<2) and (t2.c>900); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +explain format=json select * from v1,t2 where (t2.a<2) and (t2.c>900); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a < 2 and t2.c > 900" + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + } + } + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and (v1.b=t2.b); +a b max_c avg_c a b c d +1 21 500 234.6000 1 21 909 12 +6 20 315 279.3333 6 20 315 279 +1 19 107 107.0000 1 19 203 107 +select * from v1,t2 where (v1.a=t2.a) and (v1.b=t2.b); +a b max_c avg_c a b c d +1 21 500 234.6000 1 21 909 12 +6 20 315 279.3333 6 20 315 279 +1 19 107 107.0000 1 19 203 107 +explain select * from v1,t2 where (v1.a=t2.a) and (v1.b=t2.b); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 10 test.t2.a,test.t2.b 2 +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.b=t2.b); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a is not null and t2.b is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "10", + "used_key_parts": ["a", "b"], + "ref": ["test.t2.a", "test.t2.b"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + } + } + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where +(t2.a=v1.a) or (v1.b=t2.b) and ((v1.a=1) or (v1.a=6)); +a b max_c avg_c a b c d +1 19 107 107.0000 1 21 909 12 +1 19 107 107.0000 1 19 203 107 +1 21 500 234.6000 1 21 909 12 +1 21 500 234.6000 1 19 203 107 +6 20 315 279.3333 6 20 315 279 +6 20 315 279.3333 6 23 303 909 +8 33 404 213.6667 8 64 248 107 +8 33 404 213.6667 8 80 800 314 +select * from v1,t2 where +(t2.a=v1.a) or (v1.b=t2.b) and ((v1.a=1) or (v1.a=6)); +a b max_c avg_c a b c d +1 19 107 107.0000 1 21 909 12 +1 19 107 107.0000 1 19 203 107 +1 21 500 234.6000 1 21 909 12 +1 21 500 234.6000 1 19 203 107 +6 20 315 279.3333 6 20 315 279 +6 20 315 279.3333 6 23 303 909 +8 33 404 213.6667 8 64 248 107 +8 33 404 213.6667 8 80 800 314 +explain select * from v1,t2 where +(t2.a=v1.a) or (v1.b=t2.b) and ((v1.a=1) or (v1.a=6)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +explain format=json select * from v1,t2 where +(t2.a=v1.a) or (v1.b=t2.b) and ((v1.a=1) or (v1.a=6)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v1.a = t2.a or v1.b = t2.b and (v1.a = 1 or v1.a = 6)", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + } + } + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=1) or (v1.b=21) or (t2.a=2); +a b max_c avg_c a b c d +1 19 107 107.0000 2 3 207 207 +1 19 107 107.0000 1 21 909 12 +1 19 107 107.0000 7 13 312 406 +1 19 107 107.0000 8 64 248 107 +1 19 107 107.0000 6 20 315 279 +1 19 107 107.0000 1 19 203 107 +1 19 107 107.0000 8 80 800 314 +1 19 107 107.0000 3 12 231 190 +1 19 107 107.0000 6 23 303 909 +1 21 500 234.6000 2 3 207 207 +1 21 500 234.6000 1 21 909 12 +1 21 500 234.6000 7 13 312 406 +1 21 500 234.6000 8 64 248 107 +1 21 500 234.6000 6 20 315 279 +1 21 500 234.6000 1 19 203 107 +1 21 500 234.6000 8 80 800 314 +1 21 500 234.6000 3 12 231 190 +1 21 500 234.6000 6 23 303 909 +5 16 207 207.0000 2 3 207 207 +5 27 132 132.0000 2 3 207 207 +6 20 315 279.3333 2 3 207 207 +8 33 404 213.6667 2 3 207 207 +select * from v1,t2 where (v1.a=1) or (v1.b=21) or (t2.a=2); +a b max_c avg_c a b c d +1 19 107 107.0000 2 3 207 207 +1 19 107 107.0000 1 21 909 12 +1 19 107 107.0000 7 13 312 406 +1 19 107 107.0000 8 64 248 107 +1 19 107 107.0000 6 20 315 279 +1 19 107 107.0000 1 19 203 107 +1 19 107 107.0000 8 80 800 314 +1 19 107 107.0000 3 12 231 190 +1 19 107 107.0000 6 23 303 909 +1 21 500 234.6000 2 3 207 207 +1 21 500 234.6000 1 21 909 12 +1 21 500 234.6000 7 13 312 406 +1 21 500 234.6000 8 64 248 107 +1 21 500 234.6000 6 20 315 279 +1 21 500 234.6000 1 19 203 107 +1 21 500 234.6000 8 80 800 314 +1 21 500 234.6000 3 12 231 190 +1 21 500 234.6000 6 23 303 909 +5 16 207 207.0000 2 3 207 207 +5 27 132 132.0000 2 3 207 207 +6 20 315 279.3333 2 3 207 207 +8 33 404 213.6667 2 3 207 207 +explain select * from v1,t2 where (v1.a=1) or (v1.b=21) or (t2.a=2); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +explain format=json select * from v1,t2 where (v1.a=1) or (v1.b=21) or (t2.a=2); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v1.a = 1 or v1.b = 21 or t2.a = 2", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + } + } + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where +(t2.a<2) and (t2.c>900) and ((v1.a<t2.a) or (t2.a<11)); +a b max_c avg_c a b c d +1 19 107 107.0000 1 21 909 12 +1 21 500 234.6000 1 21 909 12 +5 16 207 207.0000 1 21 909 12 +5 27 132 132.0000 1 21 909 12 +6 20 315 279.3333 1 21 909 12 +8 33 404 213.6667 1 21 909 12 +select * from v1,t2 where +(t2.a<2) and (t2.c>900) and ((v1.a<t2.a) or (t2.a<11)); +a b max_c avg_c a b c d +1 19 107 107.0000 1 21 909 12 +1 21 500 234.6000 1 21 909 12 +5 16 207 207.0000 1 21 909 12 +5 27 132 132.0000 1 21 909 12 +6 20 315 279.3333 1 21 909 12 +8 33 404 213.6667 1 21 909 12 +explain select * from v1,t2 where +(t2.a<2) and (t2.c>900) and ((v1.a<t2.a) or (t2.a<11)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +explain format=json select * from v1,t2 where +(t2.a<2) and (t2.c>900) and ((v1.a<t2.a) or (t2.a<11)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a < 2 and t2.c > 900" + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v1.a < t2.a or t2.a < 11", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + } + } + } + } + } + } + } +} +# using several derived tables : nothing to push +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,v2,t2 where +(v1.a=v2.a) and (v1.a=t2.a) and (v2.b<50); +a b max_c avg_c a b max_c avg_c a b c d +8 33 404 213.6667 8 33 404 213.6667 8 64 248 107 +6 20 315 279.3333 6 20 315 279.3333 6 20 315 279 +8 33 404 213.6667 8 33 404 213.6667 8 80 800 314 +6 20 315 279.3333 6 20 315 279.3333 6 23 303 909 +select * from v1,v2,t2 where +(v1.a=v2.a) and (v1.a=t2.a) and (v2.b<50); +a b max_c avg_c a b max_c avg_c a b c d +8 33 404 213.6667 8 33 404 213.6667 8 64 248 107 +6 20 315 279.3333 6 20 315 279.3333 6 20 315 279 +8 33 404 213.6667 8 33 404 213.6667 8 80 800 314 +6 20 315 279.3333 6 20 315 279.3333 6 23 303 909 +explain select * from v1,v2,t2 where +(v1.a=v2.a) and (v1.a=t2.a) and (v2.b<50); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key1 key1 5 test.t2.a 2 +1 PRIMARY <derived3> ref key0 key0 5 test.t2.a 2 Using where +3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +explain format=json select * from v1,v2,t2 where +(v1.a=v2.a) and (v1.a=t2.a) and (v2.b<50); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a is not null and t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key1"], + "key": "key1", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + } + } + } + } + } + }, + "table": { + "table_name": "<derived3>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v2.b < 50", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 5 and t1.b < 50" + } + } + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,v2,t2 where +((v1.a=v2.a) or (v1.a=t2.a)) and (t2.b<50) and (v1.b=v2.b); +a b max_c avg_c a b max_c avg_c a b c d +6 20 315 279.3333 6 20 315 279.3333 2 3 207 207 +6 20 315 279.3333 6 20 315 279.3333 1 21 909 12 +6 20 315 279.3333 6 20 315 279.3333 7 13 312 406 +6 20 315 279.3333 6 20 315 279.3333 6 20 315 279 +6 20 315 279.3333 6 20 315 279.3333 1 19 203 107 +6 20 315 279.3333 6 20 315 279.3333 3 12 231 190 +6 20 315 279.3333 6 20 315 279.3333 6 23 303 909 +8 33 404 213.6667 8 33 404 213.6667 2 3 207 207 +8 33 404 213.6667 8 33 404 213.6667 1 21 909 12 +8 33 404 213.6667 8 33 404 213.6667 7 13 312 406 +8 33 404 213.6667 8 33 404 213.6667 6 20 315 279 +8 33 404 213.6667 8 33 404 213.6667 1 19 203 107 +8 33 404 213.6667 8 33 404 213.6667 3 12 231 190 +8 33 404 213.6667 8 33 404 213.6667 6 23 303 909 +select * from v1,v2,t2 where +((v1.a=v2.a) or (v1.a=t2.a)) and (t2.b<50) and (v1.b=v2.b); +a b max_c avg_c a b max_c avg_c a b c d +6 20 315 279.3333 6 20 315 279.3333 2 3 207 207 +6 20 315 279.3333 6 20 315 279.3333 1 21 909 12 +6 20 315 279.3333 6 20 315 279.3333 7 13 312 406 +6 20 315 279.3333 6 20 315 279.3333 6 20 315 279 +6 20 315 279.3333 6 20 315 279.3333 1 19 203 107 +6 20 315 279.3333 6 20 315 279.3333 3 12 231 190 +6 20 315 279.3333 6 20 315 279.3333 6 23 303 909 +8 33 404 213.6667 8 33 404 213.6667 2 3 207 207 +8 33 404 213.6667 8 33 404 213.6667 1 21 909 12 +8 33 404 213.6667 8 33 404 213.6667 7 13 312 406 +8 33 404 213.6667 8 33 404 213.6667 6 20 315 279 +8 33 404 213.6667 8 33 404 213.6667 1 19 203 107 +8 33 404 213.6667 8 33 404 213.6667 3 12 231 190 +8 33 404 213.6667 8 33 404 213.6667 6 23 303 909 +explain select * from v1,v2,t2 where +((v1.a=v2.a) or (v1.a=t2.a)) and (t2.b<50) and (v1.b=v2.b); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <derived3> ref key0 key0 5 v1.b 2 Using where +3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +explain format=json select * from v1,v2,t2 where +((v1.a=v2.a) or (v1.a=t2.a)) and (t2.b<50) and (v1.b=v2.b); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.b < 50" + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v1.b is not null", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + } + } + } + } + } + }, + "table": { + "table_name": "<derived3>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["b"], + "ref": ["v1.b"], + "rows": 2, + "filtered": 100, + "attached_condition": "v2.a = v1.a or v1.a = t2.a", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 5" + } + } + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,v2,t2 where +((v1.a=v2.a) and (v1.a=t2.a)) or ((v2.b>13) and (t2.c<115)); +a b max_c avg_c a b max_c avg_c a b c d +6 20 315 279.3333 6 20 315 279.3333 6 20 315 279 +6 20 315 279.3333 6 20 315 279.3333 6 23 303 909 +8 33 404 213.6667 8 33 404 213.6667 8 64 248 107 +8 33 404 213.6667 8 33 404 213.6667 8 80 800 314 +select * from v1,v2,t2 where +((v1.a=v2.a) and (v1.a=t2.a)) or ((v2.b>13) and (t2.c<115)); +a b max_c avg_c a b max_c avg_c a b c d +6 20 315 279.3333 6 20 315 279.3333 6 20 315 279 +6 20 315 279.3333 6 20 315 279.3333 6 23 303 909 +8 33 404 213.6667 8 33 404 213.6667 8 64 248 107 +8 33 404 213.6667 8 33 404 213.6667 8 80 800 314 +explain select * from v1,v2,t2 where +((v1.a=v2.a) and (v1.a=t2.a)) or ((v2.b>13) and (t2.c<115)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <derived3> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (incremental, BNL join) +3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +explain format=json select * from v1,v2,t2 where +((v1.a=v2.a) and (v1.a=t2.a)) or ((v2.b>13) and (t2.c<115)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v1.a = t2.a or t2.c < 115", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + } + } + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + }, + "buffer_type": "incremental", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v1.a = t2.a and v2.a = t2.a or v2.b > 13 and t2.c < 115", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 5" + } + } + } + } + } + } + } +} +# using several derived tables : pushing in all tables +# conjunctive subformula : pushing into HAVING +# extracted or formula : pushing into WHERE +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,v2,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and +((v2.b<50) or (v2.b=19)) and (v1.max_c<300); +a b max_c avg_c a b max_c avg_c a b c d +1 19 107 107.0000 6 20 315 279.3333 1 21 909 12 +1 19 107 107.0000 6 20 315 279.3333 1 19 203 107 +1 19 107 107.0000 8 33 404 213.6667 1 21 909 12 +1 19 107 107.0000 8 33 404 213.6667 1 19 203 107 +select * from v1,v2,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and +((v2.b<50) or (v2.b=19)) and (v1.max_c<300); +a b max_c avg_c a b max_c avg_c a b c d +1 19 107 107.0000 6 20 315 279.3333 1 21 909 12 +1 19 107 107.0000 6 20 315 279.3333 1 19 203 107 +1 19 107 107.0000 8 33 404 213.6667 1 21 909 12 +1 19 107 107.0000 8 33 404 213.6667 1 19 203 107 +explain select * from v1,v2,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and +((v2.b<50) or (v2.b=19)) and (v1.max_c<300); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <derived3> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (incremental, BNL join) +3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +explain format=json select * from v1,v2,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and +((v2.b<50) or (v2.b=19)) and (v1.max_c<300); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.max_c < 300" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707 and max_c < 300", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + } + } + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v2.b < 50 or v2.b = 19" + }, + "buffer_type": "incremental", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "(v2.a = v1.a or v1.a = t2.a) and (v2.b < 50 or v2.b = 19)", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 5 and (t1.b < 50 or t1.b = 19)" + } + } + } + } + } + } + } +} +# using several derived tables : pushing only in one table +# conjunctive subformula : pushing into WHERE +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,v2,t2 where +(v1.a=t2.a) and (v1.a=v1.b) and (v1.a=v2.a) and (v2.max_c<300); +a b max_c avg_c a b max_c avg_c a b c d +select * from v1,v2,t2 where +(v1.a=t2.a) and (v1.a=v1.b) and (v1.a=v2.a) and (v2.max_c<300); +a b max_c avg_c a b max_c avg_c a b c d +explain select * from v1,v2,t2 where +(v1.a=t2.a) and (v1.a=v1.b) and (v1.a=v2.a) and (v2.max_c<300); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key1 key1 10 test.t2.a,test.t2.a 2 +1 PRIMARY <derived3> ref key0 key0 5 test.t2.a 2 Using where +3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v1,v2,t2 where +(v1.a=t2.a) and (v1.a=v1.b) and (v1.a=v2.a) and (v2.max_c<300); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a is not null and t2.a is not null and t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key1"], + "key": "key1", + "key_length": "10", + "used_key_parts": ["a", "b"], + "ref": ["test.t2.a", "test.t2.a"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.b = t1.a" + } + } + } + } + } + }, + "table": { + "table_name": "<derived3>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v2.max_c < 300", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_c < 707 and max_c < 300", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 5" + } + } + } + } + } + } + } +} +# using several derived tables : pushing only in one table +# extracted and formula : pushing into WHERE +# conjunctive subformula : pushing into WHERE using equalities +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,v2,t2 where (v1.a=1) and (v1.b>10) and (v1.b=v2.b); +a b max_c avg_c a b max_c avg_c a b c d +select * from v1,v2,t2 where (v1.a=1) and (v1.b>10) and (v1.b=v2.b); +a b max_c avg_c a b max_c avg_c a b c d +explain select * from v1,v2,t2 where (v1.a=1) and (v1.b>10) and (v1.b=v2.b); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <derived3> ref key0 key0 5 v1.b 2 +3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v1,v2,t2 where (v1.a=1) and (v1.b>10) and (v1.b=v2.b); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.a = 1 and v1.b > 10" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v1.b is not null", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a = 1 and t1.b > 10" + } + } + } + } + } + }, + "table": { + "table_name": "<derived3>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["b"], + "ref": ["v1.b"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 5 and t1.b > 10" + } + } + } + } + } + } + } +} +# extracted or formula : pushing into WHERE +# conjunctive subformula : pushing into WHERE using equalities +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_char as v,t2_char as t where +(v.a=t.a) and (t.a='b') and ((v.b='Vika') or (v.b='Ali')); +a b max_c a b c +b Vika 2 b Ivan 1 +b Vika 2 b Ali 6 +b Vika 2 b Hermes 3 +b Vika 2 b Ivan 11 +b Vika 2 b Harry 4 +select * from v_char as v,t2_char as t where +(v.a=t.a) and (t.a='b') and ((v.b='Vika') or (v.b='Ali')); +a b max_c a b c +b Vika 2 b Ivan 1 +b Vika 2 b Ali 6 +b Vika 2 b Hermes 3 +b Vika 2 b Ivan 11 +b Vika 2 b Harry 4 +explain select * from v_char as v,t2_char as t where +(v.a=t.a) and (t.a='b') and ((v.b='Vika') or (v.b='Ali')); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 12 Using where +1 PRIMARY t ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1_char ALL NULL NULL NULL NULL 12 Using where; Using temporary; Using filesort +explain format=json select * from v_char as v,t2_char as t where +(v.a=t.a) and (t.a='b') and ((v.b='Vika') or (v.b='Ali')); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 12, + "filtered": 100, + "attached_condition": "v.a = 'b' and (v.b = 'Vika' or v.b = 'Ali')", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 9", + "filesort": { + "sort_key": "t1_char.b", + "temporary_table": { + "table": { + "table_name": "t1_char", + "access_type": "ALL", + "rows": 12, + "filtered": 100, + "attached_condition": "t1_char.a = 'b' and (t1_char.b = 'Vika' or t1_char.b = 'Ali')" + } + } + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "t", + "access_type": "ALL", + "rows": 12, + "filtered": 100, + "attached_condition": "t.a = 'b'" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL" + } + } +} +# using several derived tables : pushing in all tables +# extracted or formula : pushing into WHERE +# conjunctive subformulas : pushing into HAVING +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,v2,v3,t2 where +((v1.a=v2.a) or (v1.a=t2.a)) and ((v3.b<50) or (v3.b=33)) +and (v1.max_c<500) and (v3.a=t2.a) and (v2.max_c>300); +a b max_c avg_c a b max_c avg_c a b min_c a b c d +6 20 315 279.3333 6 20 315 279.3333 7 11 708 7 13 312 406 +6 20 315 279.3333 6 20 315 279.3333 8 33 114 8 64 248 107 +6 20 315 279.3333 6 20 315 279.3333 6 20 214 6 20 315 279 +6 20 315 279.3333 6 20 315 279.3333 8 33 114 8 80 800 314 +6 20 315 279.3333 6 20 315 279.3333 6 20 214 6 23 303 909 +6 20 315 279.3333 8 33 404 213.6667 6 20 214 6 20 315 279 +6 20 315 279.3333 8 33 404 213.6667 6 20 214 6 23 303 909 +8 33 404 213.6667 6 20 315 279.3333 8 33 114 8 64 248 107 +8 33 404 213.6667 6 20 315 279.3333 8 33 114 8 80 800 314 +8 33 404 213.6667 8 33 404 213.6667 7 11 708 7 13 312 406 +8 33 404 213.6667 8 33 404 213.6667 8 33 114 8 64 248 107 +8 33 404 213.6667 8 33 404 213.6667 6 20 214 6 20 315 279 +8 33 404 213.6667 8 33 404 213.6667 8 33 114 8 80 800 314 +8 33 404 213.6667 8 33 404 213.6667 6 20 214 6 23 303 909 +select * from v1,v2,v3,t2 where +((v1.a=v2.a) or (v1.a=t2.a)) and ((v3.b<50) or (v3.b=33)) +and (v1.max_c<500) and (v3.a=t2.a) and (v2.max_c>300); +a b max_c avg_c a b max_c avg_c a b min_c a b c d +6 20 315 279.3333 6 20 315 279.3333 7 11 708 7 13 312 406 +6 20 315 279.3333 6 20 315 279.3333 8 33 114 8 64 248 107 +6 20 315 279.3333 6 20 315 279.3333 6 20 214 6 20 315 279 +6 20 315 279.3333 6 20 315 279.3333 8 33 114 8 80 800 314 +6 20 315 279.3333 6 20 315 279.3333 6 20 214 6 23 303 909 +6 20 315 279.3333 8 33 404 213.6667 6 20 214 6 20 315 279 +6 20 315 279.3333 8 33 404 213.6667 6 20 214 6 23 303 909 +8 33 404 213.6667 6 20 315 279.3333 8 33 114 8 64 248 107 +8 33 404 213.6667 6 20 315 279.3333 8 33 114 8 80 800 314 +8 33 404 213.6667 8 33 404 213.6667 7 11 708 7 13 312 406 +8 33 404 213.6667 8 33 404 213.6667 8 33 114 8 64 248 107 +8 33 404 213.6667 8 33 404 213.6667 6 20 214 6 20 315 279 +8 33 404 213.6667 8 33 404 213.6667 8 33 114 8 80 800 314 +8 33 404 213.6667 8 33 404 213.6667 6 20 214 6 23 303 909 +explain select * from v1,v2,v3,t2 where +((v1.a=v2.a) or (v1.a=t2.a)) and ((v3.b<50) or (v3.b=33)) +and (v1.max_c<500) and (v3.a=t2.a) and (v2.max_c>300); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived4> ref key0 key0 5 test.t2.a 2 Using where +1 PRIMARY <derived3> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (incremental, BNL join) +4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +explain format=json select * from v1,v2,v3,t2 where +((v1.a=v2.a) or (v1.a=t2.a)) and ((v3.b<50) or (v3.b=33)) +and (v1.max_c<500) and (v3.a=t2.a) and (v2.max_c>300); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a is not null" + }, + "table": { + "table_name": "<derived4>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v3.b < 50 or v3.b = 33", + "materialized": { + "query_block": { + "select_id": 4, + "having_condition": "min_c > 109", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a < 10 and (t1.b < 50 or t1.b = 33)" + } + } + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v2.max_c > 300" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_c < 707 and max_c > 300", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 5" + } + } + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.max_c < 500" + }, + "buffer_type": "incremental", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v1.a = v2.a or v1.a = t2.a", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707 and max_c < 500", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + } + } + } + } + } + } + } +} +# using several derived tables : pushing in all tables +# conjunctive subformulas : pushing into HAVING +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +where t1.a>5 group by a,b having max_c < 707) v1, +(select a, b, min(c) as min_c from t1 +where t1.a>5 group by a,b having min_c < 707) v2, +t2 where (v1.a=v2.a) and (v1.b=t2.b) and (v1.max_c>130) and (v2.min_c<130); +a b max_c avg_c a b min_c a b c d +select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +where t1.a>5 group by a,b having max_c < 707) v1, +(select a, b, min(c) as min_c from t1 +where t1.a>5 group by a,b having min_c < 707) v2, +t2 where (v1.a=v2.a) and (v1.b=t2.b) and (v1.max_c>130) and (v2.min_c<130); +a b max_c avg_c a b min_c a b c d +explain select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +where t1.a>5 group by a,b having max_c < 707) v1, +(select a, b, min(c) as min_c from t1 +where t1.a>5 group by a,b having min_c < 707) v2, +t2 where (v1.a=v2.a) and (v1.b=t2.b) and (v1.max_c>130) and (v2.min_c<130); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key1 key1 5 test.t2.b 2 Using where +1 PRIMARY <derived3> ref key0 key0 5 v1.a 2 Using where +3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +where t1.a>5 group by a,b having max_c < 707) v1, +(select a, b, min(c) as min_c from t1 +where t1.a>5 group by a,b having min_c < 707) v2, +t2 where (v1.a=v2.a) and (v1.b=t2.b) and (v1.max_c>130) and (v2.min_c<130); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.b is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key1"], + "key": "key1", + "key_length": "5", + "used_key_parts": ["b"], + "ref": ["test.t2.b"], + "rows": 2, + "filtered": 100, + "attached_condition": "v1.max_c > 130 and v1.a is not null", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707 and max_c > 130", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 5" + } + } + } + } + } + }, + "table": { + "table_name": "<derived3>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["v1.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v2.min_c < 130", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "min_c < 707 and min_c < 130", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 5" + } + } + } + } + } + } + } +} +# using several derived tables : pushing in all tables +# extracted or formulas : pushing into HAVING +# conjunctive subformula : pushing into HAVING +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +where t1.a>5 group by a,b having max_c < 707) v1, +(select a, b, min(c) as min_c from t1 +where t1.a>5 group by a,b having min_c < 707) v2, +(select a, b, avg(c) as avg_c from t1 +where t1.a<8 group by a,b) v3, +t2 where (v1.a=v2.a) and (v1.b=v3.b) and ((v3.avg_c>170) or (v3.a<5)) +and ((v1.avg_c<400) or (v1.a>1)) and (v2.min_c<200); +a b max_c avg_c a b min_c a b avg_c a b c d +8 33 404 213.6667 8 33 114 1 33 497.5000 2 3 207 207 +8 33 404 213.6667 8 33 114 1 33 497.5000 1 21 909 12 +8 33 404 213.6667 8 33 114 1 33 497.5000 7 13 312 406 +8 33 404 213.6667 8 33 114 1 33 497.5000 8 64 248 107 +8 33 404 213.6667 8 33 114 1 33 497.5000 6 20 315 279 +8 33 404 213.6667 8 33 114 1 33 497.5000 1 19 203 107 +8 33 404 213.6667 8 33 114 1 33 497.5000 8 80 800 314 +8 33 404 213.6667 8 33 114 1 33 497.5000 3 12 231 190 +8 33 404 213.6667 8 33 114 1 33 497.5000 6 23 303 909 +select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +where t1.a>5 group by a,b having max_c < 707) v1, +(select a, b, min(c) as min_c from t1 +where t1.a>5 group by a,b having min_c < 707) v2, +(select a, b, avg(c) as avg_c from t1 +where t1.a<8 group by a,b) v3, +t2 where (v1.a=v2.a) and (v1.b=v3.b) and ((v3.avg_c>170) or (v3.a<5)) +and ((v1.avg_c<400) or (v1.a>1)) and (v2.min_c<200); +a b max_c avg_c a b min_c a b avg_c a b c d +8 33 404 213.6667 8 33 114 1 33 497.5000 2 3 207 207 +8 33 404 213.6667 8 33 114 1 33 497.5000 1 21 909 12 +8 33 404 213.6667 8 33 114 1 33 497.5000 7 13 312 406 +8 33 404 213.6667 8 33 114 1 33 497.5000 8 64 248 107 +8 33 404 213.6667 8 33 114 1 33 497.5000 6 20 315 279 +8 33 404 213.6667 8 33 114 1 33 497.5000 1 19 203 107 +8 33 404 213.6667 8 33 114 1 33 497.5000 8 80 800 314 +8 33 404 213.6667 8 33 114 1 33 497.5000 3 12 231 190 +8 33 404 213.6667 8 33 114 1 33 497.5000 6 23 303 909 +explain select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +where t1.a>5 group by a,b having max_c < 707) v1, +(select a, b, min(c) as min_c from t1 +where t1.a>5 group by a,b having min_c < 707) v2, +(select a, b, avg(c) as avg_c from t1 +where t1.a<8 group by a,b) v3, +t2 where (v1.a=v2.a) and (v1.b=v3.b) and ((v3.avg_c>170) or (v3.a<5)) +and ((v1.avg_c<400) or (v1.a>1)) and (v2.min_c<200); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <derived3> ref key0 key0 5 v1.a 2 Using where +1 PRIMARY <derived4> ref key0 key0 5 v1.b 2 Using where +4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +where t1.a>5 group by a,b having max_c < 707) v1, +(select a, b, min(c) as min_c from t1 +where t1.a>5 group by a,b having min_c < 707) v2, +(select a, b, avg(c) as avg_c from t1 +where t1.a<8 group by a,b) v3, +t2 where (v1.a=v2.a) and (v1.b=v3.b) and ((v3.avg_c>170) or (v3.a<5)) +and ((v1.avg_c<400) or (v1.a>1)) and (v2.min_c<200); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.avg_c < 400 or v1.a > 1" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "(v1.avg_c < 400 or v1.a > 1) and v1.a is not null and v1.b is not null", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707 and (avg_c < 400 or t1.a > 1)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 5" + } + } + } + } + } + }, + "table": { + "table_name": "<derived3>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["v1.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v2.min_c < 200", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "min_c < 707 and min_c < 200", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 5" + } + } + } + } + } + }, + "table": { + "table_name": "<derived4>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["b"], + "ref": ["v1.b"], + "rows": 2, + "filtered": 100, + "attached_condition": "v3.avg_c > 170 or v3.a < 5", + "materialized": { + "query_block": { + "select_id": 4, + "having_condition": "avg_c > 170 or t1.a < 5", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a < 8" + } + } + } + } + } + } + } +} +# extracted or formula : pushing into HAVING +# conjunctive subformula : pushing into WHERE +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +group by a,b having max_c < 707) v1, +t2 where ((v1.a=1) or (v1.max_c<300)) and (v1.b>25); +a b max_c avg_c a b c d +5 27 132 132.0000 2 3 207 207 +5 27 132 132.0000 1 21 909 12 +5 27 132 132.0000 7 13 312 406 +5 27 132 132.0000 8 64 248 107 +5 27 132 132.0000 6 20 315 279 +5 27 132 132.0000 1 19 203 107 +5 27 132 132.0000 8 80 800 314 +5 27 132 132.0000 3 12 231 190 +5 27 132 132.0000 6 23 303 909 +select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +group by a,b having max_c < 707) v1, +t2 where ((v1.a=1) or (v1.max_c<300)) and (v1.b>25); +a b max_c avg_c a b c d +5 27 132 132.0000 2 3 207 207 +5 27 132 132.0000 1 21 909 12 +5 27 132 132.0000 7 13 312 406 +5 27 132 132.0000 8 64 248 107 +5 27 132 132.0000 6 20 315 279 +5 27 132 132.0000 1 19 203 107 +5 27 132 132.0000 8 80 800 314 +5 27 132 132.0000 3 12 231 190 +5 27 132 132.0000 6 23 303 909 +explain select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +group by a,b having max_c < 707) v1, +t2 where ((v1.a=1) or (v1.max_c<300)) and (v1.b>25); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +group by a,b having max_c < 707) v1, +t2 where ((v1.a=1) or (v1.max_c<300)) and (v1.b>25); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "(v1.a = 1 or v1.max_c < 300) and v1.b > 25" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v1.a = 1 or v1.max_c < 300", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707 and (t1.a = 1 or max_c < 300)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.b > 25" + } + } + } + } + } + } + } +} +# extracted and formula : pushing into WHERE +# conjunctive subformula : pushing into HAVING +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +where t1.a>5 group by a,b having max_c < 707) v1, +t2 where (v1.a=t2.a) and (v1.max_c>300) and (v1.b<30); +a b max_c avg_c a b c d +6 20 315 279.3333 6 20 315 279 +6 20 315 279.3333 6 23 303 909 +select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +where t1.a>5 group by a,b having max_c < 707) v1, +t2 where (v1.a=t2.a) and (v1.max_c>300) and (v1.b<30); +a b max_c avg_c a b c d +6 20 315 279.3333 6 20 315 279 +6 20 315 279.3333 6 23 303 909 +explain select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +where t1.a>5 group by a,b having max_c < 707) v1, +t2 where (v1.a=t2.a) and (v1.max_c>300) and (v1.b<30); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from +(select a, b, max(c) as max_c, avg(c) as avg_c from t1 +where t1.a>5 group by a,b having max_c < 707) v1, +t2 where (v1.a=t2.a) and (v1.max_c>300) and (v1.b<30); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v1.max_c > 300 and v1.b < 30", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 707 and max_c > 300", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 5 and t1.b < 30" + } + } + } + } + } + } + } +} +# using query with union +# conjunctive subformula : pushing into WHERE +# conjunctive subformulas : pushing into HAVING and WHERE +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a<5) and (v1.b=t2.b) and (t2.c>800) +union +select * from v1,t2 where (v1.max_c>100) and (v1.a>7) and (t2.d>800); +a b max_c avg_c a b c d +1 21 500 234.6000 1 21 909 12 +8 33 404 213.6667 6 23 303 909 +select * from v1,t2 where (v1.a<5) and (v1.b=t2.b) and (t2.c>800) +union +select * from v1,t2 where (v1.max_c>100) and (v1.a>7) and (t2.d>800); +a b max_c avg_c a b c d +1 21 500 234.6000 1 21 909 12 +8 33 404 213.6667 6 23 303 909 +explain select * from v1,t2 where (v1.a<5) and (v1.b=t2.b) and (t2.c>800) +union +select * from v1,t2 where (v1.max_c>100) and (v1.a>7) and (t2.d>800); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived3> ref key0 key0 5 test.t2.b 2 Using where +3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 UNION t2 ALL NULL NULL NULL NULL 9 Using where +2 UNION <derived4> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.a<5) and (v1.b=t2.b) and (t2.c>800) +union +select * from v1,t2 where (v1.max_c>100) and (v1.a>7) and (t2.d>800); +EXPLAIN +{ + "query_block": { + "union_result": { + "table_name": "<union1,2>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.c > 800 and t2.b is not null" + }, + "table": { + "table_name": "<derived3>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["b"], + "ref": ["test.t2.b"], + "rows": 2, + "filtered": 100, + "attached_condition": "v1.a < 5", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a < 5" + } + } + } + } + } + } + } + }, + { + "query_block": { + "select_id": 2, + "operation": "UNION", + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.d > 800" + }, + "block-nl-join": { + "table": { + "table_name": "<derived4>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.max_c > 100 and v1.a > 7" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "select_id": 4, + "having_condition": "max_c < 707 and max_c > 100", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 7" + } + } + } + } + } + } + } + } + ] + } + } +} +# using query with union +# extracted and formula : pushing into WHERE +# extracted or formula : pushing into HAVING +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a<5) and (v1.b=t2.b) and (v1.b=19) +union +select * from v1,t2 where ((v1.max_c>400) or (v1.avg_c>270)) and (v1.a<t2.a); +a b max_c avg_c a b c d +1 19 107 107.0000 1 19 203 107 +1 21 500 234.6000 2 3 207 207 +1 21 500 234.6000 7 13 312 406 +1 21 500 234.6000 8 64 248 107 +1 21 500 234.6000 6 20 315 279 +1 21 500 234.6000 8 80 800 314 +1 21 500 234.6000 3 12 231 190 +1 21 500 234.6000 6 23 303 909 +6 20 315 279.3333 7 13 312 406 +6 20 315 279.3333 8 64 248 107 +6 20 315 279.3333 8 80 800 314 +select * from v1,t2 where (v1.a<5) and (v1.b=t2.b) and (v1.b=19) +union +select * from v1,t2 where ((v1.max_c>400) or (v1.avg_c>270)) and (v1.a<t2.a); +a b max_c avg_c a b c d +1 19 107 107.0000 1 19 203 107 +1 21 500 234.6000 2 3 207 207 +1 21 500 234.6000 7 13 312 406 +1 21 500 234.6000 8 64 248 107 +1 21 500 234.6000 6 20 315 279 +1 21 500 234.6000 8 80 800 314 +1 21 500 234.6000 3 12 231 190 +1 21 500 234.6000 6 23 303 909 +6 20 315 279.3333 7 13 312 406 +6 20 315 279.3333 8 64 248 107 +6 20 315 279.3333 8 80 800 314 +explain select * from v1,t2 where (v1.a<5) and (v1.b=t2.b) and (v1.b=19) +union +select * from v1,t2 where ((v1.max_c>400) or (v1.avg_c>270)) and (v1.a<t2.a); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived3> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 UNION t2 ALL NULL NULL NULL NULL 9 +2 UNION <derived4> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.a<5) and (v1.b=t2.b) and (v1.b=19) +union +select * from v1,t2 where ((v1.max_c>400) or (v1.avg_c>270)) and (v1.a<t2.a); +EXPLAIN +{ + "query_block": { + "union_result": { + "table_name": "<union1,2>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.b = 19" + }, + "block-nl-join": { + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.b = 19 and v1.a < 5" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.b = 19 and t1.a < 5" + } + } + } + } + } + } + } + }, + { + "query_block": { + "select_id": 2, + "operation": "UNION", + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived4>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.max_c > 400 or v1.avg_c > 270" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "(v1.max_c > 400 or v1.avg_c > 270) and v1.a < t2.a", + "materialized": { + "query_block": { + "select_id": 4, + "having_condition": "max_c < 707 and (max_c > 400 or avg_c > 270)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + } + } + } + } + } + } + } + } + ] + } + } +} +# using query with union +# extracted or formula : pushing into HAVING +# extracted or formula : pushing into WHERE +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where +((t2.a=v1.a) or (v1.b=t2.b)) and ((v1.a=1) or (v1.a=6)) +union +select * from v1,t2 where ((v1.a>3) and (v1.b>27)) or (v1.max_c>550); +a b max_c avg_c a b c d +1 19 107 107.0000 1 21 909 12 +1 19 107 107.0000 1 19 203 107 +1 21 500 234.6000 1 21 909 12 +1 21 500 234.6000 1 19 203 107 +6 20 315 279.3333 6 20 315 279 +6 20 315 279.3333 6 23 303 909 +8 33 404 213.6667 2 3 207 207 +8 33 404 213.6667 1 21 909 12 +8 33 404 213.6667 7 13 312 406 +8 33 404 213.6667 8 64 248 107 +8 33 404 213.6667 6 20 315 279 +8 33 404 213.6667 1 19 203 107 +8 33 404 213.6667 8 80 800 314 +8 33 404 213.6667 3 12 231 190 +8 33 404 213.6667 6 23 303 909 +select * from v1,t2 where +((t2.a=v1.a) or (v1.b=t2.b)) and ((v1.a=1) or (v1.a=6)) +union +select * from v1,t2 where ((v1.a>3) and (v1.b>27)) or (v1.max_c>550); +a b max_c avg_c a b c d +1 19 107 107.0000 1 21 909 12 +1 19 107 107.0000 1 19 203 107 +1 21 500 234.6000 1 21 909 12 +1 21 500 234.6000 1 19 203 107 +6 20 315 279.3333 6 20 315 279 +6 20 315 279.3333 6 23 303 909 +8 33 404 213.6667 2 3 207 207 +8 33 404 213.6667 1 21 909 12 +8 33 404 213.6667 7 13 312 406 +8 33 404 213.6667 8 64 248 107 +8 33 404 213.6667 6 20 315 279 +8 33 404 213.6667 1 19 203 107 +8 33 404 213.6667 8 80 800 314 +8 33 404 213.6667 3 12 231 190 +8 33 404 213.6667 6 23 303 909 +explain select * from v1,t2 where +((t2.a=v1.a) or (v1.b=t2.b)) and ((v1.a=1) or (v1.a=6)) +union +select * from v1,t2 where ((v1.a>3) and (v1.b>27)) or (v1.max_c>550); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived3> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 UNION t2 ALL NULL NULL NULL NULL 9 +2 UNION <derived4> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where +((t2.a=v1.a) or (v1.b=t2.b)) and ((v1.a=1) or (v1.a=6)) +union +select * from v1,t2 where ((v1.a>3) and (v1.b>27)) or (v1.max_c>550); +EXPLAIN +{ + "query_block": { + "union_result": { + "table_name": "<union1,2>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.a = 1 or v1.a = 6" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "(v1.a = t2.a or v1.b = t2.b) and (v1.a = 1 or v1.a = 6)", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a = 1 or t1.a = 6" + } + } + } + } + } + } + } + }, + { + "query_block": { + "select_id": 2, + "operation": "UNION", + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived4>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.a > 3 and v1.b > 27 or v1.max_c > 550" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v1.a > 3 and v1.b > 27 or v1.max_c > 550", + "materialized": { + "query_block": { + "select_id": 4, + "having_condition": "max_c < 707 and (t1.a > 3 and t1.b > 27 or max_c > 550)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + } + } + } + } + } + } + } + } + ] + } + } +} +# using query with union +# extracted or formula : pushing into HAVING +# conjunctive subformulas : pushing into WHERE +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where +((v1.a=1) and (v1.a=t2.a)) and ((v1.max_c<500) or (v1.avg_c>500)) +union +select * from v2,t2 where +((v2.a<t2.b) or (v2.max_c>200)) and (v2.b>10) and (t2.a<2) +union +select * from v2,t2 where +(v2.max_c=t2.c) and (v2.b<10); +a b max_c avg_c a b c d +1 19 107 107.0000 1 21 909 12 +1 19 107 107.0000 1 19 203 107 +6 20 315 279.3333 1 21 909 12 +6 20 315 279.3333 1 19 203 107 +8 33 404 213.6667 1 21 909 12 +8 33 404 213.6667 1 19 203 107 +select * from v1,t2 where +((v1.a=1) and (v1.a=t2.a)) and ((v1.max_c<500) or (v1.avg_c>500)) +union +select * from v2,t2 where +((v2.a<t2.b) or (v2.max_c>200)) and (v2.b>10) and (t2.a<2) +union +select * from v2,t2 where +(v2.max_c=t2.c) and (v2.b<10); +a b max_c avg_c a b c d +1 19 107 107.0000 1 21 909 12 +1 19 107 107.0000 1 19 203 107 +6 20 315 279.3333 1 21 909 12 +6 20 315 279.3333 1 19 203 107 +8 33 404 213.6667 1 21 909 12 +8 33 404 213.6667 1 19 203 107 +explain select * from v1,t2 where +((v1.a=1) and (v1.a=t2.a)) and ((v1.max_c<500) or (v1.avg_c>500)) +union +select * from v2,t2 where +((v2.a<t2.b) or (v2.max_c>200)) and (v2.b>10) and (t2.a<2) +union +select * from v2,t2 where +(v2.max_c=t2.c) and (v2.b<10); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived4> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 UNION t2 ALL NULL NULL NULL NULL 9 Using where +2 UNION <derived5> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +5 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 UNION t2 ALL NULL NULL NULL NULL 9 Using where +3 UNION <derived6> ref key0 key0 5 test.t2.c 2 Using where +6 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +NULL UNION RESULT <union1,2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where +((v1.a=1) and (v1.a=t2.a)) and ((v1.max_c<500) or (v1.avg_c>500)) +union +select * from v2,t2 where +((v2.a<t2.b) or (v2.max_c>200)) and (v2.b>10) and (t2.a<2) +union +select * from v2,t2 where +(v2.max_c=t2.c) and (v2.b<10); +EXPLAIN +{ + "query_block": { + "union_result": { + "table_name": "<union1,2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a = 1" + }, + "block-nl-join": { + "table": { + "table_name": "<derived4>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.a = 1 and (v1.max_c < 500 or v1.avg_c > 500)" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v1.max_c < 500 or v1.avg_c > 500", + "materialized": { + "query_block": { + "select_id": 4, + "having_condition": "max_c < 707 and (max_c < 500 or avg_c > 500)", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a = 1" + } + } + } + } + } + } + } + }, + { + "query_block": { + "select_id": 2, + "operation": "UNION", + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a < 2" + }, + "block-nl-join": { + "table": { + "table_name": "<derived5>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v2.b > 10" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v2.a < t2.b or v2.max_c > 200", + "materialized": { + "query_block": { + "select_id": 5, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 5 and t1.b > 10" + } + } + } + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "UNION", + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.c is not null" + }, + "table": { + "table_name": "<derived6>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["max_c"], + "ref": ["test.t2.c"], + "rows": 2, + "filtered": 100, + "attached_condition": "v2.b < 10", + "materialized": { + "query_block": { + "select_id": 6, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 5 and t1.b < 10" + } + } + } + } + } + } + } + } + ] + } + } +} +# using derived table with union +# conjunctive subformulas : pushing into WHERE and HAVING +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_union,t2 where (v_union.a<3) and (v_union.c>100); +a b c a b c d +1 19 107 2 3 207 207 +1 19 107 1 21 909 12 +1 19 107 7 13 312 406 +1 19 107 8 64 248 107 +1 19 107 6 20 315 279 +1 19 107 1 19 203 107 +1 19 107 8 80 800 314 +1 19 107 3 12 231 190 +1 19 107 6 23 303 909 +select * from v_union,t2 where (v_union.a<3) and (v_union.c>100); +a b c a b c d +1 19 107 2 3 207 207 +1 19 107 1 21 909 12 +1 19 107 7 13 312 406 +1 19 107 8 64 248 107 +1 19 107 6 20 315 279 +1 19 107 1 19 203 107 +1 19 107 8 80 800 314 +1 19 107 3 12 231 190 +1 19 107 6 23 303 909 +explain select * from v_union,t2 where (v_union.a<3) and (v_union.c>100); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 40 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 UNION t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v_union,t2 where (v_union.a<3) and (v_union.c>100); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 40, + "filtered": 100, + "attached_condition": "v_union.a < 3 and v_union.c > 100" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<union2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c > 109 and c > 100", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a < 10 and t1.a < 3" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "UNION", + "having_condition": "c < 300 and c > 100", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.b > 10 and t1.a < 3" + } + } + } + } + } + ] + } + } + } + } + } +} +# using derived table with union +# conjunctive subformula : pushing into WHERE +# extracted or formula : pushing into HAVING +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_union,t2 where +((v_union.a<2) or (v_union.c>800)) and (v_union.b>12); +a b c a b c d +1 19 107 2 3 207 207 +1 19 107 1 21 909 12 +1 19 107 7 13 312 406 +1 19 107 8 64 248 107 +1 19 107 6 20 315 279 +1 19 107 1 19 203 107 +1 19 107 8 80 800 314 +1 19 107 3 12 231 190 +1 19 107 6 23 303 909 +select * from v_union,t2 where +((v_union.a<2) or (v_union.c>800)) and (v_union.b>12); +a b c a b c d +1 19 107 2 3 207 207 +1 19 107 1 21 909 12 +1 19 107 7 13 312 406 +1 19 107 8 64 248 107 +1 19 107 6 20 315 279 +1 19 107 1 19 203 107 +1 19 107 8 80 800 314 +1 19 107 3 12 231 190 +1 19 107 6 23 303 909 +explain select * from v_union,t2 where +((v_union.a<2) or (v_union.c>800)) and (v_union.b>12); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 40 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 UNION t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v_union,t2 where +((v_union.a<2) or (v_union.c>800)) and (v_union.b>12); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 40, + "filtered": 100, + "attached_condition": "(v_union.a < 2 or v_union.c > 800) and v_union.b > 12" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v_union.a < 2 or v_union.c > 800", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<union2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c > 109 and (t1.a < 2 or c > 800)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a < 10 and t1.b > 12" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "UNION", + "having_condition": "c < 300 and (t1.a < 2 or c > 800)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.b > 10 and t1.b > 12" + } + } + } + } + } + ] + } + } + } + } + } +} +# using derived table with union +# conjunctive subformula : pushing into HAVING +# conjunctive subformula : pushing into WHERE +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_union,t2 where +(v_union.a=1) and (v_union.a=t2.a) and (v_union.c<200); +a b c a b c d +1 19 107 1 21 909 12 +1 19 107 1 19 203 107 +select * from v_union,t2 where +(v_union.a=1) and (v_union.a=t2.a) and (v_union.c<200); +a b c a b c d +1 19 107 1 21 909 12 +1 19 107 1 19 203 107 +explain select * from v_union,t2 where +(v_union.a=1) and (v_union.a=t2.a) and (v_union.c<200); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 40 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 UNION t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v_union,t2 where +(v_union.a=1) and (v_union.a=t2.a) and (v_union.c<200); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a = 1" + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 40, + "filtered": 100, + "attached_condition": "v_union.a = 1 and v_union.c < 200" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<union2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c > 109 and c < 200", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a = 1" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "UNION", + "having_condition": "c < 300 and c < 200", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a = 1 and t1.b > 10" + } + } + } + } + } + ] + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_char as v,t2_char as t where +(v.a=t.a) and (v.b='Vika') and (v.max_c>2); +a b max_c a b c +c Vika 7 c Vinny 3 +c Vika 7 c Inga 9 +c Vika 7 c Ivan 2 +c Vika 7 c Inga 2 +select * from v_char as v,t2_char as t where +(v.a=t.a) and (v.b='Vika') and (v.max_c>2); +a b max_c a b c +c Vika 7 c Vinny 3 +c Vika 7 c Inga 9 +c Vika 7 c Ivan 2 +c Vika 7 c Inga 2 +explain select * from v_char as v,t2_char as t where +(v.a=t.a) and (v.b='Vika') and (v.max_c>2); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t ALL NULL NULL NULL NULL 12 Using where +1 PRIMARY <derived2> ref key0 key0 2 test.t.a 2 Using where +2 DERIVED t1_char ALL NULL NULL NULL NULL 12 Using where; Using temporary; Using filesort +explain format=json select * from v_char as v,t2_char as t where +(v.a=t.a) and (v.b='Vika') and (v.max_c>2); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t", + "access_type": "ALL", + "rows": 12, + "filtered": 100, + "attached_condition": "t.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "2", + "used_key_parts": ["a"], + "ref": ["test.t.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v.b = 'Vika' and v.max_c > 2", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c < 9 and max_c > 2", + "filesort": { + "sort_key": "t1_char.a", + "temporary_table": { + "table": { + "table_name": "t1_char", + "access_type": "ALL", + "rows": 12, + "filtered": 100, + "attached_condition": "t1_char.b = 'Vika'" + } + } + } + } + } + } + } +} +# using derived table with union +# using several derived tables : pushing in all tables +# conjunctive subformula : pushing into WHERE using equalities +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_union,v1,t2 where +(v_union.a=v1.a) and (v1.a=t2.a) and (t2.a=1) +and ((v_union.c>800) or (v1.max_c>200)); +a b c a b max_c avg_c a b c d +1 19 107 1 21 500 234.6000 1 21 909 12 +1 19 107 1 21 500 234.6000 1 19 203 107 +select * from v_union,v1,t2 where +(v_union.a=v1.a) and (v1.a=t2.a) and (t2.a=1) +and ((v_union.c>800) or (v1.max_c>200)); +a b c a b max_c avg_c a b c d +1 19 107 1 21 500 234.6000 1 21 909 12 +1 19 107 1 21 500 234.6000 1 19 203 107 +explain select * from v_union,v1,t2 where +(v_union.a=v1.a) and (v1.a=t2.a) and (t2.a=1) +and ((v_union.c>800) or (v1.max_c>200)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived4> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 40 Using where; Using join buffer (incremental, BNL join) +4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 UNION t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v_union,v1,t2 where +(v_union.a=v1.a) and (v1.a=t2.a) and (t2.a=1) +and ((v_union.c>800) or (v1.max_c>200)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a = 1" + }, + "block-nl-join": { + "table": { + "table_name": "<derived4>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.a = 1" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "select_id": 4, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a = 1" + } + } + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 40, + "filtered": 100, + "attached_condition": "v_union.a = 1" + }, + "buffer_type": "incremental", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v_union.c > 800 or v1.max_c > 200", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<union2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c > 109", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a = 1" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "UNION", + "having_condition": "c < 300", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a = 1 and t1.b > 10" + } + } + } + } + } + ] + } + } + } + } + } +} +# using derived table with union +# extracted or formula : pushing into WHERE +# conjunctive subformula : pushing into HAVING +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v2_union as v,t2 where +((v.a=6) or (v.a=8)) and (v.c>200) and (v.a=t2.a); +a b c a b c d +8 33 404.0000 8 64 248 107 +6 20 312.0000 6 20 315 279 +6 20 214.0000 6 20 315 279 +8 33 404.0000 8 80 800 314 +6 20 312.0000 6 23 303 909 +6 20 214.0000 6 23 303 909 +select * from v2_union as v,t2 where +((v.a=6) or (v.a=8)) and (v.c>200) and (v.a=t2.a); +a b c a b c d +8 33 404.0000 8 64 248 107 +6 20 312.0000 6 20 315 279 +6 20 214.0000 6 20 315 279 +8 33 404.0000 8 80 800 314 +6 20 312.0000 6 23 303 909 +6 20 214.0000 6 23 303 909 +explain select * from v2_union as v,t2 where +((v.a=6) or (v.a=8)) and (v.c>200) and (v.a=t2.a); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 6 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 UNION t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +4 UNION t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +NULL UNION RESULT <union2,3,4> ALL NULL NULL NULL NULL NULL +explain format=json select * from v2_union as v,t2 where +((v.a=6) or (v.a=8)) and (v.c>200) and (v.a=t2.a); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "(t2.a = 6 or t2.a = 8) and t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 6, + "filtered": 100, + "attached_condition": "v.c > 200", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<union2,3,4>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c > 109 and c > 200", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a < 10 and (t1.a = 6 or t1.a = 8)" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "UNION", + "having_condition": "c < 300 and c > 200", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.b > 10 and (t1.a = 6 or t1.a = 8)" + } + } + } + } + }, + { + "query_block": { + "select_id": 4, + "operation": "UNION", + "having_condition": "c < 707 and c > 200", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.c > 300 and (t1.a = 6 or t1.a = 8)" + } + } + } + } + } + ] + } + } + } + } + } +} +# using derived table with union of selects without aggregation +# extracted conjunctive predicate: pushing in WHERE of both selects +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v3_union as v,t2 where (v.a=t2.a) and (v.c>6); +a b c a b c d +1 21 123 1 21 909 12 +1 21 101 1 21 909 12 +1 21 104 1 21 909 12 +1 33 988 1 21 909 12 +1 19 107 1 21 909 12 +1 21 500 1 21 909 12 +1 21 345 1 21 909 12 +7 11 708 7 13 312 406 +7 11 8 7 13 312 406 +8 33 404 8 64 248 107 +8 33 123 8 64 248 107 +8 33 114 8 64 248 107 +8 33 9 8 64 248 107 +6 20 214 6 20 315 279 +6 20 315 6 20 315 279 +6 20 309 6 20 315 279 +6 20 7 6 20 315 279 +1 21 123 1 19 203 107 +1 21 101 1 19 203 107 +1 21 104 1 19 203 107 +1 33 988 1 19 203 107 +1 19 107 1 19 203 107 +1 21 500 1 19 203 107 +1 21 345 1 19 203 107 +8 33 404 8 80 800 314 +8 33 123 8 80 800 314 +8 33 114 8 80 800 314 +8 33 9 8 80 800 314 +6 20 214 6 23 303 909 +6 20 315 6 23 303 909 +6 20 309 6 23 303 909 +6 20 7 6 23 303 909 +select * from v3_union as v,t2 where (v.a=t2.a) and (v.c>6); +a b c a b c d +1 21 123 1 21 909 12 +1 21 101 1 21 909 12 +1 21 104 1 21 909 12 +1 33 988 1 21 909 12 +1 19 107 1 21 909 12 +1 21 500 1 21 909 12 +1 21 345 1 21 909 12 +7 11 708 7 13 312 406 +7 11 8 7 13 312 406 +8 33 404 8 64 248 107 +8 33 123 8 64 248 107 +8 33 114 8 64 248 107 +8 33 9 8 64 248 107 +6 20 214 6 20 315 279 +6 20 315 6 20 315 279 +6 20 309 6 20 315 279 +6 20 7 6 20 315 279 +1 21 123 1 19 203 107 +1 21 101 1 19 203 107 +1 21 104 1 19 203 107 +1 33 988 1 19 203 107 +1 19 107 1 19 203 107 +1 21 500 1 19 203 107 +1 21 345 1 19 203 107 +8 33 404 8 80 800 314 +8 33 123 8 80 800 314 +8 33 114 8 80 800 314 +8 33 9 8 80 800 314 +6 20 214 6 23 303 909 +6 20 315 6 23 303 909 +6 20 309 6 23 303 909 +6 20 7 6 23 303 909 +explain select * from v3_union as v,t2 where (v.a=t2.a) and (v.c>6); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 4 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where +3 UNION t1 ALL NULL NULL NULL NULL 20 Using where +NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v3_union as v,t2 where (v.a=t2.a) and (v.c>6); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 4, + "filtered": 100, + "attached_condition": "v.c > 6", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<union2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a < 10 and t1.a + 1 > 6" + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "UNION", + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.b > 10 and t1.c > 100 and t1.c > 6" + } + } + } + ] + } + } + } + } + } +} +# using derived table with union of selects without aggregation +# extracted conjunctive OR subformula: pushing in WHERE using equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v3_union as v,t2 where (v.a=t2.a) and ((t2.a>1) or (v.b<20)); +a b c a b c d +1 19 107 1 21 909 12 +1 19 2 1 21 909 12 +7 11 708 7 13 312 406 +7 11 8 7 13 312 406 +8 33 404 8 64 248 107 +8 33 123 8 64 248 107 +8 33 114 8 64 248 107 +8 33 9 8 64 248 107 +6 20 214 6 20 315 279 +6 20 315 6 20 315 279 +6 20 309 6 20 315 279 +6 20 7 6 20 315 279 +1 19 107 1 19 203 107 +1 19 2 1 19 203 107 +8 33 404 8 80 800 314 +8 33 123 8 80 800 314 +8 33 114 8 80 800 314 +8 33 9 8 80 800 314 +6 20 214 6 23 303 909 +6 20 315 6 23 303 909 +6 20 309 6 23 303 909 +6 20 7 6 23 303 909 +select * from v3_union as v,t2 where (v.a=t2.a) and ((t2.a>1) or (v.b<20)); +a b c a b c d +1 19 107 1 21 909 12 +1 19 2 1 21 909 12 +7 11 708 7 13 312 406 +7 11 8 7 13 312 406 +8 33 404 8 64 248 107 +8 33 123 8 64 248 107 +8 33 114 8 64 248 107 +8 33 9 8 64 248 107 +6 20 214 6 20 315 279 +6 20 315 6 20 315 279 +6 20 309 6 20 315 279 +6 20 7 6 20 315 279 +1 19 107 1 19 203 107 +1 19 2 1 19 203 107 +8 33 404 8 80 800 314 +8 33 123 8 80 800 314 +8 33 114 8 80 800 314 +8 33 9 8 80 800 314 +6 20 214 6 23 303 909 +6 20 315 6 23 303 909 +6 20 309 6 23 303 909 +6 20 7 6 23 303 909 +explain select * from v3_union as v,t2 where (v.a=t2.a) and ((t2.a>1) or (v.b<20)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 4 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where +3 UNION t1 ALL NULL NULL NULL NULL 20 Using where +NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v3_union as v,t2 where (v.a=t2.a) and ((t2.a>1) or (v.b<20)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 4, + "filtered": 100, + "attached_condition": "t2.a > 1 or v.b < 20", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<union2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a < 10 and (t1.a > 1 or t1.b < 20)" + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "UNION", + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.b > 10 and t1.c > 100 and (t1.a > 1 or t1.b < 20)" + } + } + } + ] + } + } + } + } + } +} +# using derived table with union of selects without aggregation +# extracted the whole condition: in WHERE of both selects +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v3_union as v,t2 where +(v.a=t2.a) and ((v.b=19) or (v.b=21)) and ((v.c<3) or (v.c>600)); +a b c a b c d +1 19 2 1 21 909 12 +1 21 2 1 21 909 12 +1 19 2 1 19 203 107 +1 21 2 1 19 203 107 +select * from v3_union as v,t2 where +(v.a=t2.a) and ((v.b=19) or (v.b=21)) and ((v.c<3) or (v.c>600)); +a b c a b c d +1 19 2 1 21 909 12 +1 21 2 1 21 909 12 +1 19 2 1 19 203 107 +1 21 2 1 19 203 107 +explain select * from v3_union as v,t2 where +(v.a=t2.a) and ((v.b=19) or (v.b=21)) and ((v.c<3) or (v.c>600)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 4 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where +3 UNION t1 ALL NULL NULL NULL NULL 20 Using where +NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v3_union as v,t2 where +(v.a=t2.a) and ((v.b=19) or (v.b=21)) and ((v.c<3) or (v.c>600)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 4, + "filtered": 100, + "attached_condition": "(v.b = 19 or v.b = 21) and (v.c < 3 or v.c > 600)", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<union2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a < 10 and (t1.b = 19 or t1.b = 21) and (t1.a + 1 < 3 or t1.a + 1 > 600)" + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "UNION", + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.b > 10 and t1.c > 100 and (t1.b = 19 or t1.b = 21) and (t1.c < 3 or t1.c > 600)" + } + } + } + ] + } + } + } + } + } +} +# using derived table with union of +# a select without aggregation and a select with aggregation +# extracted conjunctive predicate: pushing in WHERE of both selects +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v4_union as v,t2 where (v.a=t2.a) and (v.b<20); +a b c a b c d +1 19 207 1 21 909 12 +7 11 808 7 13 312 406 +7 11 608 7 13 312 406 +1 19 207 1 19 203 107 +select * from v4_union as v,t2 where (v.a=t2.a) and (v.b<20); +a b c a b c d +1 19 207 1 21 909 12 +7 11 808 7 13 312 406 +7 11 608 7 13 312 406 +1 19 207 1 19 203 107 +explain select * from v4_union as v,t2 where (v.a=t2.a) and (v.b<20); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 4 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 UNION t1 ALL NULL NULL NULL NULL 20 Using where +NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v4_union as v,t2 where (v.a=t2.a) and (v.b<20); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 4, + "filtered": 100, + "attached_condition": "v.b < 20", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<union2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c > 109", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a < 10 and t1.b < 20" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "UNION", + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.b > 10 and t1.b < 20" + } + } + } + ] + } + } + } + } + } +} +# using derived table with union of +# a select without aggregation and a select with aggregation +# extracted subformula: pushing in WHERE of one select +# extracted subformula: pushing in HAVING of the other select +# extracted sub-subformula: pushing in WHERE of the other select +# using an equality in all pushdowns +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v4_union as v,t2 where +(v.a=t2.a) and ((t2.a<3) or (v.b<40)) and (v.c>500); +a b c a b c d +1 33 1088 1 21 909 12 +1 21 600 1 21 909 12 +1 33 888 1 21 909 12 +7 11 808 7 13 312 406 +7 11 608 7 13 312 406 +8 33 504 8 64 248 107 +1 33 1088 1 19 203 107 +1 21 600 1 19 203 107 +1 33 888 1 19 203 107 +8 33 504 8 80 800 314 +select * from v4_union as v,t2 where +(v.a=t2.a) and ((t2.a<3) or (v.b<40)) and (v.c>500); +a b c a b c d +1 33 1088 1 21 909 12 +1 21 600 1 21 909 12 +1 33 888 1 21 909 12 +7 11 808 7 13 312 406 +7 11 608 7 13 312 406 +8 33 504 8 64 248 107 +1 33 1088 1 19 203 107 +1 21 600 1 19 203 107 +1 33 888 1 19 203 107 +8 33 504 8 80 800 314 +explain select * from v4_union as v,t2 where +(v.a=t2.a) and ((t2.a<3) or (v.b<40)) and (v.c>500); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 4 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 UNION t1 ALL NULL NULL NULL NULL 20 Using where +NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v4_union as v,t2 where +(v.a=t2.a) and ((t2.a<3) or (v.b<40)) and (v.c>500); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 4, + "filtered": 100, + "attached_condition": "(t2.a < 3 or v.b < 40) and v.c > 500", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<union2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c > 109 and c > 500", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a < 10 and (t1.a < 3 or t1.b < 40)" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "UNION", + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.b > 10 and (t1.a < 3 or t1.b < 40) and t1.c + 100 > 500" + } + } + } + ] + } + } + } + } + } +} +# using embedded derived table : pushing the same conditions +# using several derived tables : pushing in all tables +# conjunctive subformula : pushing into WHERE +# extracted and formula : pushing into WHERE +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v4,v1 where +(v4.a<13) and (v1.a>5) and (v1.b>12); +a b min_c a b max_c avg_c +1 19 107 6 20 315 279.3333 +1 21 500 6 20 315 279.3333 +5 16 207 6 20 315 279.3333 +5 27 132 6 20 315 279.3333 +6 20 315 6 20 315 279.3333 +8 33 404 6 20 315 279.3333 +1 19 107 8 33 404 213.6667 +1 21 500 8 33 404 213.6667 +5 16 207 8 33 404 213.6667 +5 27 132 8 33 404 213.6667 +6 20 315 8 33 404 213.6667 +8 33 404 8 33 404 213.6667 +select * from v4,v1 where +(v4.a<13) and (v1.a>5) and (v1.b>12); +a b min_c a b max_c avg_c +1 19 107 6 20 315 279.3333 +1 21 500 6 20 315 279.3333 +5 16 207 6 20 315 279.3333 +5 27 132 6 20 315 279.3333 +6 20 315 6 20 315 279.3333 +8 33 404 6 20 315 279.3333 +1 19 107 8 33 404 213.6667 +1 21 500 8 33 404 213.6667 +5 16 207 8 33 404 213.6667 +5 27 132 8 33 404 213.6667 +6 20 315 8 33 404 213.6667 +8 33 404 8 33 404 213.6667 +explain select * from v4,v1 where +(v4.a<13) and (v1.a>5) and (v1.b>12); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where +1 PRIMARY <derived4> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v4,v1 where +(v4.a<13) and (v1.a>5) and (v1.b>12); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v4.a < 13", + "materialized": { + "query_block": { + "select_id": 2, + "filesort": { + "sort_key": "v1.a, v1.b", + "temporary_table": { + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.a < 15 and v1.a < 13", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a < 15 and t1.a < 13" + } + } + } + } + } + } + } + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "<derived4>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.a > 5 and v1.b > 12" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "select_id": 4, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 5 and t1.b > 12" + } + } + } + } + } + } + } +} +# using embedded view : nothing to push +# using several derived tables : pushing only in one table +# conjunctive subformula : pushing into WHERE +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v4,v1,t2 where +(v4.a=t2.a) and (v4.a=v1.a) and (v1.b>30); +a b min_c a b max_c avg_c a b c d +8 33 404 8 33 404 213.6667 8 64 248 107 +8 33 404 8 33 404 213.6667 8 80 800 314 +select * from v4,v1,t2 where +(v4.a=t2.a) and (v4.a=v1.a) and (v1.b>30); +a b min_c a b max_c avg_c a b c d +8 33 404 8 33 404 213.6667 8 64 248 107 +8 33 404 8 33 404 213.6667 8 80 800 314 +explain select * from v4,v1,t2 where +(v4.a=t2.a) and (v4.a=v1.a) and (v1.b>30); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key1 key1 5 test.t2.a 2 +1 PRIMARY <derived4> ref key0 key0 5 test.t2.a 2 Using where +4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v4,v1,t2 where +(v4.a=t2.a) and (v4.a=v1.a) and (v1.b>30); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a is not null and t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key1"], + "key": "key1", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 2, + "filesort": { + "sort_key": "v1.a, v1.b", + "temporary_table": { + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.a < 15", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a < 15" + } + } + } + } + } + } + } + } + } + } + }, + "table": { + "table_name": "<derived4>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v1.b > 30", + "materialized": { + "query_block": { + "select_id": 4, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.b > 30" + } + } + } + } + } + } + } +} +# using embedded view : pushing different conditions +# using several derived tables : pushing in all tables +# conjunctive subformula : pushing into WHERE using equalities +# extracted and formula : pushing into WHERE using equalities +# conjunctive subformula : pushing into HAVING +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v4,v1,t2 where +(v4.a=t2.a) and (v4.a>1) and (v4.a=v1.a) and (v4.min_c>100) and (v1.b<30); +a b min_c a b max_c avg_c a b c d +6 20 315 6 20 315 279.3333 6 20 315 279 +6 20 315 6 20 315 279.3333 6 23 303 909 +select * from v4,v1,t2 where +(v4.a=t2.a) and (v4.a>1) and (v4.a=v1.a) and (v4.min_c>100) and (v1.b<30); +a b min_c a b max_c avg_c a b c d +6 20 315 6 20 315 279.3333 6 20 315 279 +6 20 315 6 20 315 279.3333 6 23 303 909 +explain select * from v4,v1,t2 where +(v4.a=t2.a) and (v4.a>1) and (v4.a=v1.a) and (v4.min_c>100) and (v1.b<30); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key1 key1 5 test.t2.a 2 Using where +1 PRIMARY <derived4> ref key0 key0 5 test.t2.a 2 Using where +4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v4,v1,t2 where +(v4.a=t2.a) and (v4.a>1) and (v4.a=v1.a) and (v4.min_c>100) and (v1.b<30); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a > 1 and t2.a is not null and t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key1"], + "key": "key1", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v4.min_c > 100", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "min_c > 100", + "filesort": { + "sort_key": "v1.a, v1.b", + "temporary_table": { + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.a < 15 and v1.a > 1", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a < 15 and t1.a > 1" + } + } + } + } + } + } + } + } + } + } + }, + "table": { + "table_name": "<derived4>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v1.b < 30", + "materialized": { + "query_block": { + "select_id": 4, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 1 and t1.b < 30" + } + } + } + } + } + } + } +} +# using embedded view : pushing different conditions +# using several derived tables : pushing in all tables +# extracted or formula : pushing into WHERE +# conjunctive subformula : pushing into HAVING +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v4,v1,t2 where +(((v4.b>10) and (v4.a>1)) or (v4.b<20)) and (v1.max_c>200) and (v1.a=v4.a); +a b min_c a b max_c avg_c a b c d +1 19 107 1 21 500 234.6000 2 3 207 207 +1 19 107 1 21 500 234.6000 1 21 909 12 +1 19 107 1 21 500 234.6000 7 13 312 406 +1 19 107 1 21 500 234.6000 8 64 248 107 +1 19 107 1 21 500 234.6000 6 20 315 279 +1 19 107 1 21 500 234.6000 1 19 203 107 +1 19 107 1 21 500 234.6000 8 80 800 314 +1 19 107 1 21 500 234.6000 3 12 231 190 +1 19 107 1 21 500 234.6000 6 23 303 909 +5 16 207 5 16 207 207.0000 2 3 207 207 +5 16 207 5 16 207 207.0000 1 21 909 12 +5 16 207 5 16 207 207.0000 7 13 312 406 +5 16 207 5 16 207 207.0000 8 64 248 107 +5 16 207 5 16 207 207.0000 6 20 315 279 +5 16 207 5 16 207 207.0000 1 19 203 107 +5 16 207 5 16 207 207.0000 8 80 800 314 +5 16 207 5 16 207 207.0000 3 12 231 190 +5 16 207 5 16 207 207.0000 6 23 303 909 +5 27 132 5 16 207 207.0000 2 3 207 207 +5 27 132 5 16 207 207.0000 1 21 909 12 +5 27 132 5 16 207 207.0000 7 13 312 406 +5 27 132 5 16 207 207.0000 8 64 248 107 +5 27 132 5 16 207 207.0000 6 20 315 279 +5 27 132 5 16 207 207.0000 1 19 203 107 +5 27 132 5 16 207 207.0000 8 80 800 314 +5 27 132 5 16 207 207.0000 3 12 231 190 +5 27 132 5 16 207 207.0000 6 23 303 909 +6 20 315 6 20 315 279.3333 2 3 207 207 +6 20 315 6 20 315 279.3333 1 21 909 12 +6 20 315 6 20 315 279.3333 7 13 312 406 +6 20 315 6 20 315 279.3333 8 64 248 107 +6 20 315 6 20 315 279.3333 6 20 315 279 +6 20 315 6 20 315 279.3333 1 19 203 107 +6 20 315 6 20 315 279.3333 8 80 800 314 +6 20 315 6 20 315 279.3333 3 12 231 190 +6 20 315 6 20 315 279.3333 6 23 303 909 +8 33 404 8 33 404 213.6667 2 3 207 207 +8 33 404 8 33 404 213.6667 1 21 909 12 +8 33 404 8 33 404 213.6667 7 13 312 406 +8 33 404 8 33 404 213.6667 8 64 248 107 +8 33 404 8 33 404 213.6667 6 20 315 279 +8 33 404 8 33 404 213.6667 1 19 203 107 +8 33 404 8 33 404 213.6667 8 80 800 314 +8 33 404 8 33 404 213.6667 3 12 231 190 +8 33 404 8 33 404 213.6667 6 23 303 909 +select * from v4,v1,t2 where +(((v4.b>10) and (v4.a>1)) or (v4.b<20)) and (v1.max_c>200) and (v1.a=v4.a); +a b min_c a b max_c avg_c a b c d +1 19 107 1 21 500 234.6000 2 3 207 207 +1 19 107 1 21 500 234.6000 1 21 909 12 +1 19 107 1 21 500 234.6000 7 13 312 406 +1 19 107 1 21 500 234.6000 8 64 248 107 +1 19 107 1 21 500 234.6000 6 20 315 279 +1 19 107 1 21 500 234.6000 1 19 203 107 +1 19 107 1 21 500 234.6000 8 80 800 314 +1 19 107 1 21 500 234.6000 3 12 231 190 +1 19 107 1 21 500 234.6000 6 23 303 909 +5 16 207 5 16 207 207.0000 2 3 207 207 +5 16 207 5 16 207 207.0000 1 21 909 12 +5 16 207 5 16 207 207.0000 7 13 312 406 +5 16 207 5 16 207 207.0000 8 64 248 107 +5 16 207 5 16 207 207.0000 6 20 315 279 +5 16 207 5 16 207 207.0000 1 19 203 107 +5 16 207 5 16 207 207.0000 8 80 800 314 +5 16 207 5 16 207 207.0000 3 12 231 190 +5 16 207 5 16 207 207.0000 6 23 303 909 +5 27 132 5 16 207 207.0000 2 3 207 207 +5 27 132 5 16 207 207.0000 1 21 909 12 +5 27 132 5 16 207 207.0000 7 13 312 406 +5 27 132 5 16 207 207.0000 8 64 248 107 +5 27 132 5 16 207 207.0000 6 20 315 279 +5 27 132 5 16 207 207.0000 1 19 203 107 +5 27 132 5 16 207 207.0000 8 80 800 314 +5 27 132 5 16 207 207.0000 3 12 231 190 +5 27 132 5 16 207 207.0000 6 23 303 909 +6 20 315 6 20 315 279.3333 2 3 207 207 +6 20 315 6 20 315 279.3333 1 21 909 12 +6 20 315 6 20 315 279.3333 7 13 312 406 +6 20 315 6 20 315 279.3333 8 64 248 107 +6 20 315 6 20 315 279.3333 6 20 315 279 +6 20 315 6 20 315 279.3333 1 19 203 107 +6 20 315 6 20 315 279.3333 8 80 800 314 +6 20 315 6 20 315 279.3333 3 12 231 190 +6 20 315 6 20 315 279.3333 6 23 303 909 +8 33 404 8 33 404 213.6667 2 3 207 207 +8 33 404 8 33 404 213.6667 1 21 909 12 +8 33 404 8 33 404 213.6667 7 13 312 406 +8 33 404 8 33 404 213.6667 8 64 248 107 +8 33 404 8 33 404 213.6667 6 20 315 279 +8 33 404 8 33 404 213.6667 1 19 203 107 +8 33 404 8 33 404 213.6667 8 80 800 314 +8 33 404 8 33 404 213.6667 3 12 231 190 +8 33 404 8 33 404 213.6667 6 23 303 909 +explain select * from v4,v1,t2 where +(((v4.b>10) and (v4.a>1)) or (v4.b<20)) and (v1.max_c>200) and (v1.a=v4.a); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <derived4> ref key0 key0 5 v4.a 2 Using where +4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort +2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v4,v1,t2 where +(((v4.b>10) and (v4.a>1)) or (v4.b<20)) and (v1.max_c>200) and (v1.a=v4.a); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v4.b > 10 and v4.a > 1 or v4.b < 20" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "(v4.b > 10 and v4.a > 1 or v4.b < 20) and v4.a is not null", + "materialized": { + "query_block": { + "select_id": 2, + "filesort": { + "sort_key": "v1.a, v1.b", + "temporary_table": { + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.a < 15 and (v1.b > 10 and v1.a > 1 or v1.b < 20)", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a < 15 and (t1.b > 10 and t1.a > 1 or t1.b < 20)" + } + } + } + } + } + } + } + } + } + } + }, + "table": { + "table_name": "<derived4>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["v4.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v1.max_c > 200", + "materialized": { + "query_block": { + "select_id": 4, + "having_condition": "max_c < 707 and max_c > 200", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + } + } + } + } + } + } + } +} +# using embedded view : pushing different conditions +# using several derived tables : pushing only in one table +# extracted or formula : pushing into WHERE +# extracted or formula : pushing into HAVING +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v4,v2 where +((v4.a>12) and (v4.min_c<300) and (v4.b>13)) or (v4.a<1); +a b min_c a b max_c avg_c +select * from v4,v2 where +((v4.a>12) and (v4.min_c<300) and (v4.b>13)) or (v4.a<1); +a b min_c a b max_c avg_c +explain select * from v4,v2 where +((v4.a>12) and (v4.min_c<300) and (v4.b>13)) or (v4.a<1); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where +1 PRIMARY <derived4> ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) +4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v4,v2 where +((v4.a>12) and (v4.min_c<300) and (v4.b>13)) or (v4.a<1); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v4.a > 12 and v4.min_c < 300 and v4.b > 13 or v4.a < 1", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "v1.a > 12 and min_c < 300 and v1.b > 13 or v1.a < 1", + "filesort": { + "sort_key": "v1.a, v1.b", + "temporary_table": { + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.a < 15 and (v1.a > 12 and v1.b > 13 or v1.a < 1)", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a < 15 and (t1.a > 12 and t1.b > 13 or t1.a < 1)" + } + } + } + } + } + } + } + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "<derived4>", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "select_id": 4, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 5" + } + } + } + } + } + } + } +} +# using embedded view : pushing different conditions +# using several derived tables : pushing only in one table +# conjunctive subformula : pushing into WHERE +# conjunctive subformula : pushing into HAVING +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v4,v2 where +(v4.a=v2.b) and (v4.a=v4.b) and (v4.min_c<100); +a b min_c a b max_c avg_c +select * from v4,v2 where +(v4.a=v2.b) and (v4.a=v4.b) and (v4.min_c<100); +a b min_c a b max_c avg_c +explain select * from v4,v2 where +(v4.a=v2.b) and (v4.a=v4.b) and (v4.min_c<100); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where +1 PRIMARY <derived4> ref key0 key0 5 v4.a 2 +4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v4,v2 where +(v4.a=v2.b) and (v4.a=v4.b) and (v4.min_c<100); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v4.b = v4.a and v4.min_c < 100 and v4.a is not null", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "min_c < 100", + "filesort": { + "sort_key": "v1.a, v1.b", + "temporary_table": { + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.b = v1.a and v1.a < 15", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.b = t1.a and t1.a < 15" + } + } + } + } + } + } + } + } + } + } + }, + "table": { + "table_name": "<derived4>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["b"], + "ref": ["v4.a"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 4, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 5" + } + } + } + } + } + } + } +} +# using embedded view : pushing the same conditions +# using several derived tables : pushing in all tables +# extracted and formula : pushing into WHERE using equalities +# conjunctive subformula : pushing into WHERE +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v4,v2 where +(v4.a=v2.b) and (v4.a=v4.b) and (v2.b<30); +a b min_c a b max_c avg_c +select * from v4,v2 where +(v4.a=v2.b) and (v4.a=v4.b) and (v2.b<30); +a b min_c a b max_c avg_c +explain select * from v4,v2 where +(v4.a=v2.b) and (v4.a=v4.b) and (v2.b<30); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where +1 PRIMARY <derived4> ref key0 key0 5 v4.a 2 +4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v4,v2 where +(v4.a=v2.b) and (v4.a=v4.b) and (v2.b<30); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v4.b = v4.a and v4.a < 30 and v4.a is not null", + "materialized": { + "query_block": { + "select_id": 2, + "filesort": { + "sort_key": "v1.a, v1.b", + "temporary_table": { + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.b = v1.a and v1.a < 15 and v1.a < 30", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.b = t1.a and t1.a < 15 and t1.a < 30" + } + } + } + } + } + } + } + } + } + } + }, + "table": { + "table_name": "<derived4>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["b"], + "ref": ["v4.a"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 4, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 5 and t1.b < 30" + } + } + } + } + } + } + } +} +# using embedded view : pushing the same conditions +# using several derived tables : pushing in all tables +# extracted or formula : pushing into WHERE using equalities +# extracted and formula : pushing into WHERE using equalities +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v4,v2 where +(v4.a=v2.b) and (v4.a=v4.b) and ((v2.b<30) or (v4.a>2)); +a b min_c a b max_c avg_c +select * from v4,v2 where +(v4.a=v2.b) and (v4.a=v4.b) and ((v2.b<30) or (v4.a>2)); +a b min_c a b max_c avg_c +explain select * from v4,v2 where +(v4.a=v2.b) and (v4.a=v4.b) and ((v2.b<30) or (v4.a>2)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where +1 PRIMARY <derived4> ref key0 key0 5 v4.a 2 +4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v4,v2 where +(v4.a=v2.b) and (v4.a=v4.b) and ((v2.b<30) or (v4.a>2)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v4.b = v4.a and (v4.a < 30 or v4.a > 2) and v4.a is not null", + "materialized": { + "query_block": { + "select_id": 2, + "filesort": { + "sort_key": "v1.a, v1.b", + "temporary_table": { + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.b = v1.a and v1.a < 15 and (v1.a < 30 or v1.a > 2)", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.b = t1.a and t1.a < 15 and (t1.a < 30 or t1.a > 2)" + } + } + } + } + } + } + } + } + } + } + }, + "table": { + "table_name": "<derived4>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["b"], + "ref": ["v4.a"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 4, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 5 and (t1.b < 30 or t1.b > 2)" + } + } + } + } + } + } + } +} +# using embedded view : pushing the same conditions +# using several derived tables : pushing in all tables +# extracted or formula : pushing into WHERE +# conjunctive subformula : pushing into WHERE +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v4,v2 where +(((v4.a<12) and (v4.b>13)) or (v4.a>10)) and +(v4.min_c=v2.max_c) and (v4.min_c>100); +a b min_c a b max_c avg_c +6 20 315 6 20 315 279.3333 +8 33 404 8 33 404 213.6667 +select * from v4,v2 where +(((v4.a<12) and (v4.b>13)) or (v4.a>10)) and +(v4.min_c=v2.max_c) and (v4.min_c>100); +a b min_c a b max_c avg_c +6 20 315 6 20 315 279.3333 +8 33 404 8 33 404 213.6667 +explain select * from v4,v2 where +(((v4.a<12) and (v4.b>13)) or (v4.a>10)) and +(v4.min_c=v2.max_c) and (v4.min_c>100); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where +1 PRIMARY <derived4> ref key0 key0 5 v4.min_c 2 +4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v4,v2 where +(((v4.a<12) and (v4.b>13)) or (v4.a>10)) and +(v4.min_c=v2.max_c) and (v4.min_c>100); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "(v4.a < 12 and v4.b > 13 or v4.a > 10) and v4.min_c > 100 and v4.min_c is not null", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "min_c > 100", + "filesort": { + "sort_key": "v1.a, v1.b", + "temporary_table": { + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.a < 15 and (v1.a < 12 and v1.b > 13 or v1.a > 10)", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a < 15 and (t1.a < 12 and t1.b > 13 or t1.a > 10)" + } + } + } + } + } + } + } + } + } + } + }, + "table": { + "table_name": "<derived4>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["max_c"], + "ref": ["v4.min_c"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 4, + "having_condition": "max_c < 707 and max_c > 100", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 5" + } + } + } + } + } + } + } +} +# using embedded view : pushing the same conditions +# using several derived tables : pushing only in one table +# extracted or formula : pushing into WHERE +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v4,v2,t2 where +(((v4.a<12) and (t2.b>13)) or (v4.a>10)) and +(v4.min_c=t2.c) and (t2.c>100); +a b min_c a b max_c avg_c a b c d +6 20 315 6 20 315 279.3333 6 20 315 279 +6 20 315 8 33 404 213.6667 6 20 315 279 +select * from v4,v2,t2 where +(((v4.a<12) and (t2.b>13)) or (v4.a>10)) and +(v4.min_c=t2.c) and (t2.c>100); +a b min_c a b max_c avg_c a b c d +6 20 315 6 20 315 279.3333 6 20 315 279 +6 20 315 8 33 404 213.6667 6 20 315 279 +explain select * from v4,v2,t2 where +(((v4.a<12) and (t2.b>13)) or (v4.a>10)) and +(v4.min_c=t2.c) and (t2.c>100); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 2 Using where +1 PRIMARY <derived4> ALL NULL NULL NULL NULL 20 Using join buffer (flat, BNL join) +4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +2 DERIVED <derived3> ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from v4,v2,t2 where +(((v4.a<12) and (t2.b>13)) or (v4.a>10)) and +(v4.min_c=t2.c) and (t2.c>100); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.c > 100 and t2.c is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["min_c"], + "ref": ["test.t2.c"], + "rows": 2, + "filtered": 100, + "attached_condition": "v4.a < 12 and t2.b > 13 or v4.a > 10", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "min_c > 100", + "filesort": { + "sort_key": "v1.a, v1.b", + "temporary_table": { + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "v1.a < 15 and (v1.a < 12 or v1.a > 10)", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a < 15 and (t1.a < 12 or t1.a > 10)" + } + } + } + } + } + } + } + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "<derived4>", + "access_type": "ALL", + "rows": 20, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "select_id": 4, + "having_condition": "max_c < 707", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t1.a > 5" + } + } + } + } + } + } + } +} +drop view v1,v2,v3,v4; +drop view v_union,v2_union,v3_union,v4_union; +drop view v_double,v_char,v_decimal; +drop table t1,t2,t1_double,t2_double,t1_char,t2_char,t1_decimal,t2_decimal; +# +# MDEV-10782: condition extracted from a multiple equality +# pushed into HAVING +# +CREATE TABLE t1 (i int); +INSERT INTO t1 VALUES (1),(2); +EXPLAIN EXTENDED +SELECT * +FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2 +WHERE f = 8; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> ALL NULL NULL NULL NULL 2 100.00 Using where +3 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 +Warnings: +Note 1003 /* select#1 */ select `sq1`.`f` AS `f` from (/* select#3 */ select min(`test`.`t1`.`i`) AS `f` from `test`.`t1` having `f` = 8) `sq1` where `sq1`.`f` = 8 +SELECT * +FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2 +WHERE f = 8; +f +SELECT * +FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2 +WHERE f = 1; +f +1 +DROP TABLE t1; +# +# MDEV-10783: pushdown into constant view +# +CREATE TABLE t1 (i int) ENGINE=MyISAM; +CREATE VIEW v AS SELECT 5; +SELECT * FROM t1 WHERE 1 IN ( SELECT * FROM v ); +i +DROP VIEW v; +DROP TABLE t1; +# +# MDEV-10785: second execution of a query with condition +# pushed into view +# +CREATE TABLE t1 (i int); +CREATE VIEW v1 AS SELECT i FROM t1 WHERE i < 5; +CREATE FUNCTION f (in1 int) RETURNS int RETURN in1; +CREATE VIEW v2 AS SELECT * FROM v1 GROUP BY i; +PREPARE stmt FROM "SELECT * FROM v2 WHERE f(0) <> 2"; +EXECUTE stmt; +i +EXECUTE stmt; +i +DROP FUNCTION f; +DROP VIEW v2,v1; +DROP TABLE t1; +# +# MDEV-10884: condition pushdown into derived specified by +# 1. unit with SELECT containing ORDER BY ... LIMIT +# 2. unit containing global ORDER BY ... LIMIT +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +select a from t1 order by a limit 5; +a +0 +1 +2 +3 +4 +set statement optimizer_switch='condition_pushdown_for_derived=off' for +select * from (select a from t1 order by a limit 5) t where t.a not in (1,2,3); +a +0 +4 +set statement optimizer_switch='condition_pushdown_for_derived=on' for +select * from (select a from t1 order by a limit 5) t where t.a not in (1,2,3); +a +0 +4 +select a from t1 where a < 4 union select a from t1 where a > 5 +order by a limit 5; +a +0 +1 +2 +3 +6 +set statement optimizer_switch='condition_pushdown_for_derived=off' for +select * from +(select a from t1 where a < 4 union select a from t1 where a > 5 +order by a limit 5) t where t.a not in (2,9); +a +0 +1 +3 +6 +set statement optimizer_switch='condition_pushdown_for_derived=on' for +select * from +(select a from t1 where a < 4 union select a from t1 where a > 5 +order by a limit 5) t where t.a not in (2,9); +a +0 +1 +3 +6 +drop table t1; +# +# MDEV-11072: pushdown of the condition obtained +# after constant row substitution +# +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2; +CREATE TABLE t3 (c INT) ENGINE=MyISAM; +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t3; +SELECT * FROM t1 WHERE a IN ( +SELECT b FROM v2 WHERE b < a OR b IN ( +SELECT c FROM v3 WHERE c = a +) +); +a +INSERT INTO t1 VALUES (2); +INSERT INTO t2 VALUES (3), (2); +INSERT INTO t3 VALUES (4), (1), (2), (7); +SELECT * FROM t1 WHERE a IN ( +SELECT b FROM v2 WHERE b < a OR b IN ( +SELECT c FROM v3 WHERE c = a +) +); +a +2 +EXPLAIN FORMAT=JSON +SELECT * FROM t1 WHERE a IN ( +SELECT b FROM v2 WHERE b < a OR b IN ( +SELECT c FROM v3 WHERE c = a +) +); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "const_condition": "0 or <in_optimizer>(2,<exists>(subquery#3))", + "table": { + "table_name": "t1", + "access_type": "system", + "rows": 1, + "filtered": 100 + }, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t2.b = 2", + "first_match": "t1" + }, + "subqueries": [ + { + "query_block": { + "select_id": 3, + "table": { + "table_name": "<derived5>", + "access_type": "index_subquery", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["c"], + "ref": ["func"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 5, + "table": { + "table_name": "t3", + "access_type": "ALL", + "rows": 4, + "filtered": 100, + "attached_condition": "t3.c = 2" + } + } + } + } + } + } + ] + } +} +CREATE TABLE t4 (d INT, e INT) ENGINE=MyISAM; +INSERT INTO t4 VALUES (1,10),(3,11),(2,10),(2,20),(3,21); +CREATE OR REPLACE VIEW v4 AS +SELECT d, sum(e) AS s FROM t4 GROUP BY d; +set statement optimizer_switch='condition_pushdown_for_derived=off' for SELECT * FROM t1 WHERE a IN ( +SELECT b FROM v2 WHERE b < a OR b IN ( +SELECT d FROM v4 WHERE s > a +) +); +a +2 +SELECT * FROM t1 WHERE a IN ( +SELECT b FROM v2 WHERE b < a OR b IN ( +SELECT d FROM v4 WHERE s > a +) +); +a +2 +explain SELECT * FROM t1 WHERE a IN ( +SELECT b FROM v2 WHERE b < a OR b IN ( +SELECT d FROM v4 WHERE s > a +) +); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 system NULL NULL NULL NULL 1 +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; FirstMatch(t1) +3 DEPENDENT SUBQUERY <derived5> index_subquery key0 key0 5 func 2 Using where +5 DERIVED t4 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +explain format=json SELECT * FROM t1 WHERE a IN ( +SELECT b FROM v2 WHERE b < a OR b IN ( +SELECT d FROM v4 WHERE s > a +) +); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "const_condition": "0 or <in_optimizer>(2,<exists>(subquery#3))", + "table": { + "table_name": "t1", + "access_type": "system", + "rows": 1, + "filtered": 100 + }, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t2.b = 2", + "first_match": "t1" + }, + "subqueries": [ + { + "query_block": { + "select_id": 3, + "table": { + "table_name": "<derived5>", + "access_type": "index_subquery", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["d"], + "ref": ["func"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 5, + "having_condition": "s > 2", + "filesort": { + "sort_key": "t4.d", + "temporary_table": { + "table": { + "table_name": "t4", + "access_type": "ALL", + "rows": 5, + "filtered": 100 + } + } + } + } + } + } + } + } + ] + } +} +DROP VIEW v2,v3,v4; +DROP TABLE t1,t2,t3,t4; +# +# MDEV-10800: pushdown of the condition obtained +# after constant row substitution +# +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3),(4); +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; +SELECT * FROM +( SELECT * FROM t1 +WHERE EXISTS ( SELECT * FROM v2 WHERE b = a ) ) AS sq; +a +EXPLAIN FORMAT=JSON +SELECT * FROM +( SELECT * FROM t1 +WHERE EXISTS ( SELECT * FROM v2 WHERE b = a ) ) AS sq; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "const_condition": "<in_optimizer>(1,exists(subquery#3))", + "table": { + "table_name": "t1", + "access_type": "system", + "rows": 1, + "filtered": 100 + }, + "subqueries": [ + { + "query_block": { + "select_id": 3, + "table": { + "table_name": "<derived4>", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "v2.b = 1", + "materialized": { + "query_block": { + "select_id": 4, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t2.b = 1" + } + } + } + } + } + } + ] + } +} +DROP VIEW v2; +DROP TABLE t1,t2; +# +# MDEV-11102: condition pushdown into materialized inner table +# of outer join is not applied as not being valid +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (0),(2); +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (1),(2); +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; +SELECT * FROM t1 LEFT JOIN t2 ON a = b WHERE b IS NULL; +a b +0 NULL +SELECT * FROM t1 LEFT JOIN v2 ON a = b WHERE b IS NULL; +a b +0 NULL +EXPLAIN FORMAT=JSON +SELECT * FROM t1 LEFT JOIN v2 ON a = b WHERE b IS NULL; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["b"], + "ref": ["test.t1.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "trigcond(v2.b is null) and trigcond(trigcond(t1.a is not null))", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + } + } + } + } + } +} +DROP VIEW v2; +DROP TABLE t1,t2; +# +# MDEV-11103: pushdown condition with ANY subquery +# +CREATE TABLE t1 (i INT); +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (1),(2); +EXPLAIN FORMAT=JSON +SELECT * FROM v1 WHERE i <= ANY ( SELECT 3 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "<nop>(v1.i <= 3)", + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "<nop>(t1.i <= 3)" + } + } + } + } + } +} +Warnings: +Note 1249 Select 2 was reduced during optimization +SELECT * FROM v1 WHERE i <= ANY ( SELECT 3 ); +i +1 +2 +DROP VIEW v1; +DROP TABLE t1; +# +# MDEV-11315: condition with outer reference to mergeable derived +# +CREATE TABLE t1 (pk1 INT PRIMARY KEY, a INT, b INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (10,7,1),(11,0,2); +CREATE TABLE t2 (pk2 INT PRIMARY KEY, c INT, d DATETIME) ENGINE=MyISAM; +INSERT INTO t2 VALUES +(1,4,'2008-09-27 00:34:58'), +(2,5,'2007-05-28 00:00:00'), +(3,6,'2009-07-25 09:21:20'); +CREATE VIEW v1 AS SELECT * FROM t1; +CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; +SELECT * FROM v1 AS sq +WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; +pk1 a b +10 7 1 +11 0 2 +EXPLAIN FORMAT=JSON +SELECT * FROM v1 AS sq +WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "<in_optimizer>(t1.b,<exists>(subquery#2)) or t1.b = 100" + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "<derived4>", + "access_type": "index_subquery", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "4", + "used_key_parts": ["pk2"], + "ref": ["func"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 4, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } + } + } + ] + } +} +SELECT * FROM ( SELECT * FROM t1 ) AS sq +WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; +pk1 a b +10 7 1 +11 0 2 +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT * FROM t1 ) AS sq +WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "<in_optimizer>(t1.b,<exists>(subquery#3)) or t1.b = 100" + }, + "subqueries": [ + { + "query_block": { + "select_id": 3, + "table": { + "table_name": "<derived4>", + "access_type": "index_subquery", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "4", + "used_key_parts": ["pk2"], + "ref": ["func"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 4, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } + } + } + ] + } +} +DROP VIEW v1,v2; +DROP TABLE t1,t2; +# +# MDEV-11313: pushdown of the condition obtained +# after constant row substitution +# +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (50); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +SELECT ( SELECT COUNT(*) FROM v1 WHERE a = t2.b ) AS f FROM t2 GROUP BY f; +f +0 +EXPLAIN FORMAT=JSON +SELECT ( SELECT COUNT(*) FROM v1 WHERE a = t2.b ) AS f FROM t2 GROUP BY f; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "system", + "rows": 1, + "filtered": 100 + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "v1.a = 50", + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.a = 50" + } + } + } + } + } + } + ] + } +} +CREATE TABLE t3 (a INT, b INT) ENGINE=MYISAM; +INSERT INTO t3 VALUES (1,10),(3,11),(2,10),(2,20),(3,21); +CREATE VIEW v2 AS SELECT a, sum(b) AS s FROM t3 GROUP BY a ; +SELECT ( SELECT COUNT(*) FROM v2 WHERE s < t2.b ) AS f FROM t2 GROUP BY f; +f +3 +EXPLAIN FORMAT=JSON +SELECT ( SELECT COUNT(*) FROM v2 WHERE s < t2.b ) AS f FROM t2 GROUP BY f; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "system", + "rows": 1, + "filtered": 100 + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 5, + "filtered": 100, + "attached_condition": "v2.s < 50", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "s < 50", + "filesort": { + "sort_key": "t3.a", + "temporary_table": { + "table": { + "table_name": "t3", + "access_type": "ALL", + "rows": 5, + "filtered": 100 + } + } + } + } + } + } + } + } + ] + } +} +DROP VIEW v1,v2; +DROP TABLE t1,t2,t3; +# +# MDEV-10882: pushdown of the predicate with cached value +# +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL) ENGINE=MyISAM; +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (1,2),(3,4); +CREATE TABLE t2 (c INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t2 VALUES (5),(6); +SELECT a, GROUP_CONCAT(b) FROM v1 +WHERE b IN ( SELECT COUNT(c) FROM t2 ) GROUP BY a; +a GROUP_CONCAT(b) +1 2 +EXPLAIN FORMAT=JSON +SELECT a, GROUP_CONCAT(b) FROM v1 +WHERE b IN ( SELECT COUNT(c) FROM t2 ) GROUP BY a; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<subquery2>", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 2, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "read_sorted_file": { + "filesort": { + "sort_key": "v1.a", + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "v1.b = 2", + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.b = 2" + } + } + } + } + } + } + } +} +DROP VIEW v1; +DROP TABLE t1,t2; +# +# MDEV-10836: pushdown of the predicate with cached value +# +CREATE TABLE t (pk INT PRIMARY KEY, f INT) ENGINE=MyISAM; +CREATE ALGORITHM=TEMPTABLE VIEW v AS SELECT * FROM t; +INSERT INTO t VALUES (1,1),(3,2); +SELECT * FROM v AS v1, v AS v2 +WHERE v2.pk > v1.f AND v1.f IN ( SELECT COUNT(pk) FROM t ); +pk f pk f +3 2 3 2 +EXPLAIN FORMAT=JSON +SELECT * FROM v AS v1, v AS v2 +WHERE v2.pk > v1.f AND v1.f IN ( SELECT COUNT(pk) FROM t ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<subquery2>", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 2, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "v1.f = 2", + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t.f = 2" + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "<derived4>", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "v2.pk > 2" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "select_id": 4, + "table": { + "table_name": "t", + "access_type": "range", + "possible_keys": ["PRIMARY"], + "key": "PRIMARY", + "key_length": "4", + "used_key_parts": ["pk"], + "rows": 2, + "filtered": 100, + "index_condition": "t.pk > 2" + } + } + } + } + } +} +DROP VIEW v; +DROP TABLE t; +# +# MDEV-11488: pushdown of the predicate with cached value +# +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(3),(2); +CREATE TABLE t2 (j INT, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3),(4); +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +i +3 +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<subquery3>", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 3, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "sq.i = 3", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t1.i = 3" + } + } + } + } + } +} +UPDATE t2 SET j = 2 WHERE j = 3; +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +i +2 +DROP TABLE t1,t2; +CREATE TABLE t1 (i FLOAT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1.5),(3.2),(2.71); +CREATE TABLE t2 (j FLOAT, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3.2),(2.71); +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +i +2.71 +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<subquery3>", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 3, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "sq.i = 2.7100000381469727", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t1.i = 2.7100000381469727" + } + } + } + } + } +} +DROP TABLE t1,t2; +CREATE TABLE t1 (i DECIMAL(10,2)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1.5),(3.21),(2.47); +CREATE TABLE t2 (j DECIMAL(10,2), KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3.21),(4.55); +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +i +3.21 +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<subquery3>", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 3, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "sq.i = 3.21", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t1.i = 3.21" + } + } + } + } + } +} +DROP TABLE t1,t2; +CREATE TABLE t1 (i VARCHAR(32)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('cc'),('aa'),('ddd'); +CREATE TABLE t2 (j VARCHAR(16), KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('bbb'),('aa'); +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +i +aa +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<subquery3>", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 3, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "sq.i = 'aa'", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t1.i = 'aa'" + } + } + } + } + } +} +DROP TABLE t1,t2; +CREATE TABLE t1 (i DATETIME) ENGINE=MyISAM; +INSERT INTO t1 VALUES +('2008-09-27 00:34:58'),('2007-05-28 00:00:00'), ('2009-07-25 09:21:20'); +CREATE TABLE t2 (j DATETIME, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES +('2007-05-28 00:00:00'), ('2010-08-25 00:00:00'); +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +i +2007-05-28 00:00:00 +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<subquery3>", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 3, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "sq.i = '2007-05-28 00:00:00'", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t1.i = TIMESTAMP'2007-05-28 00:00:00'" + } + } + } + } + } +} +DROP TABLE t1,t2; +CREATE TABLE t1 (i DATE) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('2008-09-27'),('2007-05-28'), ('2009-07-25'); +CREATE TABLE t2 (j DATE, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('2007-05-28'), ('2010-08-25'); +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +i +2007-05-28 +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<subquery3>", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 3, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "sq.i = '2007-05-28'", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t1.i = DATE'2007-05-28'" + } + } + } + } + } +} +DROP TABLE t1,t2; +CREATE TABLE t1 (i TIME) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('00:34:58'),('10:00:02'), ('09:21:20'); +CREATE TABLE t2 (j TIME, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('10:00:02'), ('11:00:10'); +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +i +10:00:02 +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<subquery3>", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 3, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "sq.i = '10:00:02'", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t1.i = TIME'10:00:02'" + } + } + } + } + } +} +DROP TABLE t1,t2; +# +# MDEV-11593: pushdown of condition with NULLIF +# +CREATE TABLE t1 (i INT); +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (2), (1); +SELECT * FROM v1 WHERE NULLIF(1, i); +i +2 +EXPLAIN FORMAT=JSON +SELECT * FROM v1 WHERE NULLIF(1, i); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "nullif(1,v1.i)", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "nullif(1,t1.i)" + } + } + } + } + } +} +DROP VIEW v1; +DROP TABLE t1; +# +# MDEV-11608: pushdown of the predicate with cached null value +# +CREATE TABLE t1 (c VARCHAR(3)); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES ('foo'),('bar'); +CREATE TABLE t2 (c VARCHAR(3)); +INSERT INTO t2 VALUES ('foo'),('xyz'); +SELECT * FROM v1 WHERE v1.c IN ( SELECT MIN(c) FROM t2 WHERE 0 ); +c +EXPLAIN FORMAT=JSON +SELECT * FROM v1 WHERE v1.c IN ( SELECT MIN(c) FROM t2 WHERE 0 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<subquery2>", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 2, + "table": { + "message": "Impossible WHERE" + } + } + } + }, + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "v1.c = NULL", + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.c = NULL" + } + } + } + } + } +} +DROP VIEW v1; +DROP TABLE t1,t2; +CREATE TABLE t1 (d DECIMAL(10,2)); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (5.37),(1.1); +CREATE TABLE t2 (d DECIMAL(10,2)); +INSERT INTO t2 VALUES ('1.1'),('2.23'); +SELECT * FROM v1 WHERE v1.d IN ( SELECT MIN(d) FROM t2 WHERE 0 ); +d +DROP VIEW v1; +DROP TABLE t1,t2; +# +# MDEV-11820: second execution of PS for query +# with false subquery predicate in WHERE +# +CREATE TABLE t1 (c VARCHAR(3)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('foo'),('bar'); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +CREATE TABLE t2 (a INT); +INSERT INTO t2 VALUES (3), (4); +PREPARE stmt1 FROM +" SELECT * FROM v1 WHERE 1 IN (SELECT a FROM t2) OR c = 'foo'"; +PREPARE stmt2 FROM +"EXPLAIN FORMAT=JSON + SELECT * FROM v1 WHERE 1 IN (SELECT a FROM t2) OR c = 'foo'"; +EXECUTE stmt1; +c +foo +EXECUTE stmt2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "v1.c = 'foo'", + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.c = 'foo'" + } + } + } + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "1 = t2.a" + } + } + } + ] + } +} +INSERT INTO t2 SELECT a+1 FROM t2; +INSERT INTO t2 SELECT a+1 FROM t2; +INSERT INTO t2 SELECT a+1 FROM t2; +INSERT INTO t2 SELECT a+1 FROM t2; +INSERT INTO t2 SELECT a+1 FROM t2; +INSERT INTO t2 SELECT a+1 FROM t2; +EXECUTE stmt1; +c +foo +EXECUTE stmt2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "<cache>(<in_optimizer>(1,<exists>(subquery#2))) or v1.c = 'foo'", + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + } + } + } + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 128, + "filtered": 100, + "attached_condition": "1 = t2.a" + } + } + } + ] + } +} +DEALLOCATE PREPARE stmt1; +DEALLOCATE PREPARE stmt2; +DROP VIEW v1; +DROP TABLE t1,t2; +# +# MDEV-12373: pushdown into derived with side effects is prohibited +# +CREATE TABLE sales_documents ( +id int NOT NULL AUTO_INCREMENT, +sale_id int NULL DEFAULT NULL, +type tinyint unsigned NULL DEFAULT NULL, +data text NULL DEFAULT NULL COLLATE 'utf8_unicode_ci', +date date NULL DEFAULT NULL, +order_number int unsigned NULL DEFAULT NULL, +created_at int NULL DEFAULT NULL, +updated_at int NULL DEFAULT NULL, +generated tinyint NOT NULL DEFAULT '0', +synced_at int NOT NULL DEFAULT '0', +sum decimal(13,2) NOT NULL DEFAULT '0', +PRIMARY KEY (id) +); +INSERT INTO sales_documents +(id, sale_id, type, order_number, data, created_at, +updated_at, date, generated, synced_at, sum) +VALUES +(555, 165, 3, 5, '{}', 1486538300, 1486722835, '2017-02-17', 0, 1486538313, 2320.00), +(556, 165, 2, 3, '{}', 1486538304, 1486563125, '2017-02-08', 1, 1486538302, 2320.00), +(557, 158, 2, 2, '{}', 1486538661, 1486538661, '2017-02-08', 0, 1486538660, 2320.00), +(558, 171, 1, 3, '{}', 1486539104, 1488203405, '2017-02-08', 1, 1486539102, 23230.00), +(559, 171, 2, 5, '{}', 1486549233, 1487146010, '2017-02-08', 1, 1486549225, 37690.00), +(560, 172, 1, 1, '{}', 1486658260, 1488203409, '2017-02-09', 1, 1486658256, 40312.00), +(561, 172, 2, 1, '{}', 1486711997, 1486711997, '2017-02-10', 1, 1486711996, 40312.00), +(562, 172, 3, 1, '{}', 1486712104, 1486721395, '2017-02-10', 1, 1486712101, 40312.00), +(563, 171, 3, 2, '{}', 1486712953, 1486720244, '2017-02-10', 1, 1486712910, 23230.00), +(564, 170, 1, 2, '{}', 1486715948, 1488203410, '2017-02-10', 1, 1486715930, 28873.00), +(565, 170, 3, 3, '{}', 1486716782, 1486717426, '2017-02-10', 1, 1486716779, 61948.00), +(566, 166, 3, 4, '{}', 1486720947, 1486720947, '2017-02-10', 1, 1486720945, 4640.00), +(567, 167, 3, 5, '{}', 1486722741, 1486722783, '2017-02-26', 0, 1486722738, 14755.00), +(568, 165, 1, 4, '{}', 1486722849, 1486722849, '2017-02-10', 0, 1486722846, 2320.00), +(569, 173, 2, 2, '{}', 1486723073, 1487071275, '2017-02-10', 1, 1486723071, 14282.00), +(570, 173, 1, 4, '{}', 1486723100, 1488203412, '2017-02-10', 1, 1486723099, 14282.00), +(571, 167, 2, 4, '{}', 1486730859, 1486730859, '2017-02-10', 1, 1486730856, 18655.00), +(572, 167, 1, 5, '{}', 1486730883, 1488203412, '2017-02-10', 1, 1486730877, 18655.00), +(573, 174, 2, 51, '{}', 1486731622, 1487060259, '2017-02-10', 1, 1486731620, 7140.00), +(574, 174, 3, 5, '{}', 1486993472, 1486993472, '2017-02-13', 1, 1488216147, 28020.00), +(575, 174, 1, 6, '{}', 1486993530, 1488203412, '2017-02-13', 1, 1486993505, 7140.00), +(576, 173, 3, 6, '{}', 1487071425, 1487071425, '2017-02-14', 0, 1487071422, 14282.00), +(577, 178, 2, 6, '{}', 1487327372, 1487327372, '2017-02-17', 1, 1487327370, 12321.00), +(578, 177, 2, 7, '{}', 1487327394, 1487327394, '2017-02-17', 0, 1487327391, 4270.00), +(579, 182, 3, 6, '{}', 1487750589, 1487751693, '2017-02-22', 1, 1487751688, 4270.00), +(580, 182, 2, 7, '{}', 1487750601, 1487750663, '2017-02-22', 1, 1487750598, 4270.00), +(581, 182, 1, 7, '{}', 1487750694, 1488203412, '2017-02-22', 1, 1487750692, 4270.00), +(582, 185, 3, 7, '{}', 1487774051, 1487774051, '2017-02-22', 0, 1487774043, 8913.00), +(583, 184, 3, 7, '{}', 1487774071, 1487774235, '2017-02-22', 0, 1487774093, 3285.00), +(584, 184, 2, 8, '{}', 1487774074, 1487774074, '2017-02-22', 0, 1487774073, 3285.00), +(585, 184, 1, 8, '{}', 1487774081, 1487774081, '2017-02-22', 0, 1487774075, 3285.00), +(586, 193, 2, 8, '{}', 1487955294, 1487955318, '2017-02-24', 0, 1487955311, 4270.00), +(587, 193, 1, 8, '{}', 1487955324, 1487955324, '2017-02-24', 0, 1487955320, 4270.00), +(588, 193, 3, 7, '{}', 1487955341, 1487955341, '2017-02-24', 0, 1487955325, 4270.00), +(589, 186, 1, 8, '{}', 1487957291, 1487957464, '2017-02-24', 0, 1487957459, 6960.00), +(590, 186, 2, 8, '{}', 1487957308, 1487957468, '2017-02-24', 0, 1487957465, 6960.00), +(591, 186, 3, 7, '{}', 1487957312, 1487957473, '2017-02-24', 0, 1487957469, 6960.00), +(592, 194, 1, 8, '{}', 1488193293, 1488203412, '2017-02-27', 1, 1488193280, 2320.00), +(593, 194, 2, 8, '{}', 1488193304, 1488193304, '2017-02-27', 1, 1488193303, 2320.00), +(594, 210, 1, 9, '{}', 1488198896, 1488198896, '2017-02-27', 0, 1488198885, 4270.00), +(595, 210, 2, 12, '{}', 1488198901, 1488198901, '2017-02-27', 1, 1488532585, 4270.00), +(596, 210, 3, 10, '{}', 1488198904, 1488198904, '2017-02-27', 1, 1488532565, 4270.00), +(597, 209, 2, 9, '{}', 1488200016, 1488450772, '2017-02-27', 1, 1488450449, 4270.00), +(598, 209, 1, 9, '{}', 1488200020, 1488200063, '2017-02-27', 1, 1488200017, 4271.00), +(599, 209, 3, 7, '{}', 1488200053, 1488200053, '2017-02-27', 0, 1488200021, 4271.00), +(600, 211, 2, 10, '{}', 1488216265, 1489402027, '2017-02-27', 1, 1488216264, 2320.00), +(601, 211, 3, 7, '{}', 1488216281, 1488216281, '2017-02-27', 1, 1488216276, 2320.00), +(602, 211, 1, 10, '{}', 1488216283, 1488216283, '2017-02-27', 1, 1488216282, 2320.00), +(603, 198, 2, 11, '{}', 1488280125, 1488280125, '2017-02-28', 0, 1488280095, 4270.00), +(604, 198, 1, 11, '{}', 1488280160, 1488280160, '2017-02-28', 0, 1488280126, 4270.00), +(605, 198, 3, 8, '{}', 1488280440, 1488280440, '2017-02-28', 0, 1488280435, 4270.00), +(606, 212, 1, 12, '{}', 1488286301, 1489402168, '2017-02-28', 1, 1488286295, 13825.00), +(607, 212, 3, 8, '{}', 1488289644, 1488289690, '2017-02-28', 1, 1488289642, 25295.00), +(608, 212, 2, 13, '{}', 1488290350, 1488290431, '2017-02-28', 1, 1488290347, 13133.75), +(609, 213, 1, 11, '{}', 1488529470, 1488529470, '2017-03-03', 1, 1488529461, 5660.00), +(610, 213, 2, 11, '{}', 1488529484, 1488529484, '2017-03-03', 1, 1488529479, 5660.00), +(611, 213, 3, 9, '{}', 1488529493, 1488529493, '2017-03-03', 1, 1488529489, 5660.00), +(612, 197, 2, 13, '{}', 1489400715, 1489400715, '2017-03-13', 0, 1489398959, 4270.00), +(613, 219, 3, 11, '{}', 1490084337, 1490181958, '2017-03-21', 1, 1490084334, 73526.00), +(614, 216, 3, 11, '{}', 1490085757, 1490086717, '2017-03-21', 0, 1490085755, 5377.00); +SELECT * FROM +(SELECT @row := @row + 1 as row, a.* from ( +SELECT t.order_number +FROM sales_documents t +WHERE +t.type = 2 AND +t.date >= '2017-01-01' AND +t.date <= '2017-12-31' AND +t.order_number IS NOT NULL AND +t.generated = 1 +GROUP BY t.order_number +) a, (SELECT @row := 0) r) t +WHERE row <> order_number; +row order_number +14 51 +DROP TABLE sales_documents; +# +# MDEV-12845: pushdown from merged derived using equalities +# +create table t1 (a int); +insert into t1 values +(4), (8), (5), (3), (10), (2), (7); +create table t2 (b int, c int); +insert into t2 values +(2,1), (5,2), (2,2), (4,1), (4,3), +(5,3), (2,4), (4,6), (2,1); +create view v1 as +select b, sum(c) as s from t2 group by b; +create view v2 as +select distinct b, c from t2; +create view v3 as +select b, max(c) as m from t2 group by b; +select b +from ( select t1.a, v1.b, v1.s from t1, v1 where t1.a = v1.b ) as t +where b > 2; +b +4 +5 +explain format=json select b +from ( select t1.a, v1.b, v1.s from t1, v1 where t1.a = v1.b ) as t +where b > 2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 7, + "filtered": 100, + "attached_condition": "t1.a > 2 and t1.a is not null" + }, + "table": { + "table_name": "<derived3>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["b"], + "ref": ["test.t1.a"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 3, + "filesort": { + "sort_key": "t2.b", + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.b > 2" + } + } + } + } + } + } + } +} +select a +from ( select t1.a, v1.b, v1.s from t1, v1 where t1.a = v1.b ) as t +where a > 2; +a +4 +5 +explain format=json select a +from ( select t1.a, v1.b, v1.s from t1, v1 where t1.a = v1.b ) as t +where a > 2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 7, + "filtered": 100, + "attached_condition": "t1.a > 2 and t1.a is not null" + }, + "table": { + "table_name": "<derived3>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["b"], + "ref": ["test.t1.a"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 3, + "filesort": { + "sort_key": "t2.b", + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.b > 2" + } + } + } + } + } + } + } +} +select a +from ( select t1.a, v2.b, v2.c from t1, v2 where t1.a = v2.b ) as t +where a > 2; +a +4 +4 +4 +5 +5 +explain format=json select a +from ( select t1.a, v2.b, v2.c from t1, v2 where t1.a = v2.b ) as t +where a > 2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 7, + "filtered": 100, + "attached_condition": "t1.a > 2 and t1.a is not null" + }, + "table": { + "table_name": "<derived3>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["b"], + "ref": ["test.t1.a"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 3, + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.b > 2" + } + } + } + } + } + } +} +select a +from ( select t1.a, v3.b, v3.m from t1, v3 where t1.a = v3.m ) as t +where a > 2; +a +4 +3 +explain format=json select a +from ( select t1.a, v3.b, v3.m from t1, v3 where t1.a = v3.m ) as t +where a > 2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 7, + "filtered": 100, + "attached_condition": "t1.a > 2 and t1.a is not null" + }, + "table": { + "table_name": "<derived3>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["m"], + "ref": ["test.t1.a"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "m > 2", + "filesort": { + "sort_key": "t2.b", + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + } + } + } + } + } + } + } +} +drop view v1,v2,v3; +drop table t1,t2; +# +# MDEV-13166: pushdown from merged derived +# +CREATE TABLE t1 (i int) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +CREATE VIEW v1 AS SELECT MAX(i) AS f FROM t1; +SELECT * FROM ( SELECT * FROM v1 ) AS sq WHERE f > 0; +f +2 +explain format=json SELECT * FROM ( SELECT * FROM v1 ) AS sq WHERE f > 0; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "v1.f > 0", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "f > 0", + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + } + } + } + } + } +} +DROP VIEW v1; +DROP TABLE t1; +# +# MDEV-13193: pushdown of equality extracted from multiple equality +# +CREATE TABLE t1 (i1 int, KEY(i1)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (i2 int) ENGINE=MyISAM; +INSERT INTO t2 VALUES (2),(4); +CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; +SELECT * FROM t1, ( SELECT * FROM v2 ) AS sq +WHERE i1 = 1 AND ( i1 = i2 OR i1 = 2 ); +i1 i2 +explain format=json SELECT * FROM t1, ( SELECT * FROM v2 ) AS sq +WHERE i1 = 1 AND ( i1 = i2 OR i1 = 2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ref", + "possible_keys": ["i1"], + "key": "i1", + "key_length": "5", + "used_key_parts": ["i1"], + "ref": ["const"], + "rows": 1, + "filtered": 100, + "using_index": true + }, + "block-nl-join": { + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "v2.i2 = 1" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t2.i2 = 1" + } + } + } + } + } +} +DROP VIEW v2; +DROP TABLE t1,t2; +# +# MDEV-14237: derived with regexp_substr() in select list +# +create table t1 (a char(8)); +insert into t1 values ('b'), ('a'), ('xx'); +select * +from ( select distinct regexp_substr(t1.a,'^[A-Za-z]+') as f from t1) as t +where t.f = 'a' or t.f = 'b'; +f +b +a +explain format=json select * +from ( select distinct regexp_substr(t1.a,'^[A-Za-z]+') as f from t1) as t +where t.f = 'a' or t.f = 'b'; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t.f = 'a' or t.f = 'b'", + "materialized": { + "query_block": { + "select_id": 2, + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } + } + } +} +drop table t1; +# +# MDEV-13454: consequence of mdev-14368 fixed for 5.5 +# +SET sql_mode = 'ONLY_FULL_GROUP_BY'; +create table t1 (id int, id2 int); +insert into t1 values (1,1),(2,3),(3,4),(7,2); +create table t2(id2 int); +insert t2 values (1),(2),(3); +SELECT * FROM t1 +LEFT OUTER JOIN +(SELECT id2, COUNT(*) as ct FROM t2 GROUP BY id2) vc USING (id2) +WHERE (vc.ct>0); +id2 id ct +1 1 1 +3 2 1 +2 7 1 +EXPLAIN FORMAT=JSON SELECT * FROM t1 +LEFT OUTER JOIN +(SELECT id2, COUNT(*) as ct FROM t2 GROUP BY id2) vc USING (id2) +WHERE (vc.ct>0); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "vc.ct > 0", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "ct > 0", + "filesort": { + "sort_key": "t2.id2", + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 4, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "t1.id2 = vc.id2" + } + } +} +DROP TABLE t1,t2; +SET sql_mode = DEFAULT; +# +# MDEV-15579: incorrect removal of sub-formulas to be pushed +# into WHERE of materialized derived with GROUP BY +# +CREATE TABLE t1 (a INT, b INT, c INT, d INT); +CREATE TABLE t2 (x INT, y INT, z INT); +INSERT INTO t1 VALUES (1,1,66,1), (1,1,56,2), (3,2,42,3); +INSERT INTO t2 VALUES (1,1,66), (1,12,32); +SELECT * +FROM t2, +( +SELECT a, b, max(c) AS max_c +FROM t1 +GROUP BY a +HAVING max_c > 37 +) AS v1 +WHERE (v1.a=1) AND (v1.b=v1.a) AND +(v1.a=t2.x) AND (v1.max_c>30); +x y z a b max_c +1 1 66 1 1 66 +1 12 32 1 1 66 +EXPLAIN SELECT * +FROM t2, +( +SELECT a, b, max(c) AS max_c +FROM t1 +GROUP BY a +HAVING max_c > 37 +) AS v1 +WHERE (v1.a=1) AND (v1.b=v1.a) AND +(v1.a=t2.x) AND (v1.max_c>30); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using where +EXPLAIN FORMAT=JSON SELECT * +FROM t2, +( +SELECT a, b, max(c) AS max_c +FROM t1 +GROUP BY a +HAVING max_c > 37 +) AS v1 +WHERE (v1.a=1) AND (v1.b=v1.a) AND +(v1.a=t2.x) AND (v1.max_c>30); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t2.x = 1" + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "v1.a = 1 and v1.b = 1 and v1.max_c > 30" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c > 37 and max_c > 30 and t1.b = 1", + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t1.a = 1" + } + } + } + } + } +} +SELECT * +FROM t2, +( +SELECT a, b, d, max(c) AS max_c +FROM t1 +GROUP BY a,d +HAVING max_c > 37 +) AS v1 +WHERE (v1.a=1) AND (v1.b=v1.a) AND (v1.b=v1.d) AND +(v1.a=t2.x) AND (v1.max_c>30); +x y z a b d max_c +1 1 66 1 1 1 66 +1 12 32 1 1 1 66 +EXPLAIN SELECT * +FROM t2, +( +SELECT a, b, d, max(c) AS max_c +FROM t1 +GROUP BY a,d +HAVING max_c > 37 +) AS v1 +WHERE (v1.a=1) AND (v1.b=v1.a) AND (v1.b=v1.d) AND +(v1.a=t2.x) AND (v1.max_c>30); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using where +EXPLAIN FORMAT=JSON SELECT * +FROM t2, +( +SELECT a, b, d, max(c) AS max_c +FROM t1 +GROUP BY a,d +HAVING max_c > 37 +) AS v1 +WHERE (v1.a=1) AND (v1.b=v1.a) AND (v1.b=v1.d) AND +(v1.a=t2.x) AND (v1.max_c>30); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t2.x = 1" + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "v1.a = 1 and v1.b = 1 and v1.d = 1 and v1.max_c > 30" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c > 37 and max_c > 30 and t1.b = 1", + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t1.a = 1 and t1.d = 1" + } + } + } + } + } +} +DROP TABLE t1,t2; +# +# MDEV-15765: pushing condition with temporal constants +# into constant tables +# +select * from (select date('2018-01-01') as d +union all +select date('2018-01-01') as d) as t +where t.d between date ('2017-01-01') and date ('2019-01-01'); +d +2018-01-01 +2018-01-01 +select * from (select date('2018-01-01') as d) as t +where t.d between date ('2017-01-01') and date ('2019-01-01'); +d +2018-01-01 +# +# MDEV-16088: pushdown into derived defined in the IN subquery +# +CREATE TABLE t1 (a INT, b INT); +CREATE TABLE t2 (e INT, f INT, g INT); +INSERT INTO t1 VALUES (1,14),(2,13),(1,19),(2,32),(3,24); +INSERT INTO t2 VALUES (1,19,2),(3,24,1),(1,12,2),(3,11,3),(2,32,1); +SELECT * FROM t1 +WHERE (t1.a,t1.b) IN +( +SELECT d_tab.e,d_tab.max_f +FROM ( +SELECT t2.e, MAX(t2.f) AS max_f +FROM t2 +GROUP BY t2.e +HAVING max_f>18 +) as d_tab +WHERE d_tab.e>1 +) +; +a b +2 32 +3 24 +EXPLAIN SELECT * FROM t1 +WHERE (t1.a,t1.b) IN +( +SELECT d_tab.e,d_tab.max_f +FROM ( +SELECT t2.e, MAX(t2.f) AS max_f +FROM t2 +GROUP BY t2.e +HAVING max_f>18 +) as d_tab +WHERE d_tab.e>1 +) +; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 5 +1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 +2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 5 Using where +3 DERIVED t2 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +EXPLAIN FORMAT=JSON SELECT * FROM t1 +WHERE (t1.a,t1.b) IN +( +SELECT d_tab.e,d_tab.max_f +FROM ( +SELECT t2.e, MAX(t2.f) AS max_f +FROM t2 +GROUP BY t2.e +HAVING max_f>18 +) as d_tab +WHERE d_tab.e>1 +) +; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 5, + "filtered": 100 + }, + "table": { + "table_name": "<subquery2>", + "access_type": "eq_ref", + "possible_keys": ["distinct_key"], + "key": "distinct_key", + "key_length": "8", + "used_key_parts": ["e", "max_f"], + "ref": ["func", "func"], + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 2, + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 5, + "filtered": 100, + "attached_condition": "d_tab.e > 1", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_f > 18", + "filesort": { + "sort_key": "t2.e", + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 5, + "filtered": 100, + "attached_condition": "t2.e > 1" + } + } + } + } + } + } + } + } + } + } +} +SELECT * FROM t1 +WHERE (t1.a,t1.b) IN +( +SELECT d_tab.e,d_tab.max_f +FROM ( +SELECT t2.e, MAX(t2.f) AS max_f +FROM t2 +GROUP BY t2.e +HAVING max_f>18 +) as d_tab +WHERE d_tab.max_f<25 +) +; +a b +1 19 +3 24 +EXPLAIN SELECT * FROM t1 +WHERE (t1.a,t1.b) IN +( +SELECT d_tab.e,d_tab.max_f +FROM ( +SELECT t2.e, MAX(t2.f) AS max_f +FROM t2 +GROUP BY t2.e +HAVING max_f>18 +) as d_tab +WHERE d_tab.max_f<25 +) +; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 5 +1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 +2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 5 Using where +3 DERIVED t2 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +EXPLAIN FORMAT=JSON SELECT * FROM t1 +WHERE (t1.a,t1.b) IN +( +SELECT d_tab.e,d_tab.max_f +FROM ( +SELECT t2.e, MAX(t2.f) AS max_f +FROM t2 +GROUP BY t2.e +HAVING max_f>18 +) as d_tab +WHERE d_tab.max_f<25 +) +; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 5, + "filtered": 100 + }, + "table": { + "table_name": "<subquery2>", + "access_type": "eq_ref", + "possible_keys": ["distinct_key"], + "key": "distinct_key", + "key_length": "8", + "used_key_parts": ["e", "max_f"], + "ref": ["func", "func"], + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 2, + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 5, + "filtered": 100, + "attached_condition": "d_tab.max_f < 25", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_f > 18 and max_f < 25", + "filesort": { + "sort_key": "t2.e", + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 5, + "filtered": 100 + } + } + } + } + } + } + } + } + } + } +} +SELECT * FROM t1 +WHERE (t1.a,t1.b) IN +( +SELECT d_tab.e, MAX(d_tab.max_f) AS max_f +FROM ( +SELECT t2.e, MAX(t2.f) as max_f, t2.g +FROM t2 +GROUP BY t2.e +) as d_tab +WHERE d_tab.e>1 +GROUP BY d_tab.g +) +; +a b +2 32 +EXPLAIN SELECT * FROM t1 +WHERE (t1.a,t1.b) IN +( +SELECT d_tab.e, MAX(d_tab.max_f) AS max_f +FROM ( +SELECT t2.e, MAX(t2.f) as max_f, t2.g +FROM t2 +GROUP BY t2.e +) as d_tab +WHERE d_tab.e>1 +GROUP BY d_tab.g +) +; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where +1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1 +2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 5 Using where; Using temporary +3 DERIVED t2 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +EXPLAIN FORMAT=JSON SELECT * FROM t1 +WHERE (t1.a,t1.b) IN +( +SELECT d_tab.e, MAX(d_tab.max_f) AS max_f +FROM ( +SELECT t2.e, MAX(t2.f) as max_f, t2.g +FROM t2 +GROUP BY t2.e +) as d_tab +WHERE d_tab.e>1 +GROUP BY d_tab.g +) +; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 5, + "filtered": 100, + "attached_condition": "t1.a is not null and t1.b is not null" + }, + "table": { + "table_name": "<subquery2>", + "access_type": "eq_ref", + "possible_keys": ["distinct_key"], + "key": "distinct_key", + "key_length": "8", + "used_key_parts": ["e", "max_f"], + "ref": ["test.t1.a", "test.t1.b"], + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 2, + "temporary_table": { + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 5, + "filtered": 100, + "attached_condition": "d_tab.e > 1", + "materialized": { + "query_block": { + "select_id": 3, + "filesort": { + "sort_key": "t2.e", + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 5, + "filtered": 100, + "attached_condition": "t2.e > 1" + } + } + } + } + } + } + } + } + } + } + } +} +SELECT * FROM t1 +WHERE (t1.a,t1.b) IN +( +SELECT d_tab.e, MAX(d_tab.max_f) AS max_f +FROM ( +SELECT t2.e, MAX(t2.f) as max_f, t2.g +FROM t2 +GROUP BY t2.e +) as d_tab +WHERE d_tab.max_f>20 +GROUP BY d_tab.g +) +; +a b +2 32 +EXPLAIN SELECT * FROM t1 +WHERE (t1.a,t1.b) IN +( +SELECT d_tab.e, MAX(d_tab.max_f) AS max_f +FROM ( +SELECT t2.e, MAX(t2.f) as max_f, t2.g +FROM t2 +GROUP BY t2.e +) as d_tab +WHERE d_tab.max_f>20 +GROUP BY d_tab.g +) +; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where +1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1 +2 MATERIALIZED <derived3> ALL NULL NULL NULL NULL 5 Using where; Using temporary +3 DERIVED t2 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +EXPLAIN FORMAT=JSON SELECT * FROM t1 +WHERE (t1.a,t1.b) IN +( +SELECT d_tab.e, MAX(d_tab.max_f) AS max_f +FROM ( +SELECT t2.e, MAX(t2.f) as max_f, t2.g +FROM t2 +GROUP BY t2.e +) as d_tab +WHERE d_tab.max_f>20 +GROUP BY d_tab.g +) +; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 5, + "filtered": 100, + "attached_condition": "t1.a is not null and t1.b is not null" + }, + "table": { + "table_name": "<subquery2>", + "access_type": "eq_ref", + "possible_keys": ["distinct_key"], + "key": "distinct_key", + "key_length": "8", + "used_key_parts": ["e", "max_f"], + "ref": ["test.t1.a", "test.t1.b"], + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 2, + "temporary_table": { + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 5, + "filtered": 100, + "attached_condition": "d_tab.max_f > 20", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_f > 20", + "filesort": { + "sort_key": "t2.e", + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 5, + "filtered": 100 + } + } + } + } + } + } + } + } + } + } + } +} +DROP TABLE t1,t2; +# +# MDEV-15765: pushing condition with IN subquery defined with constants +# using substitution +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +SELECT * FROM +( +SELECT DISTINCT * FROM t1 +) der_tab +WHERE (a>0 AND a<2 OR a IN (2,3)) AND +(a=2 OR 0); +a +2 +DROP TABLE t1; +# +# MDEV-16386: pushing condition into the HAVING clause when ambiguous +# fields warning appears +# +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,2),(2,3),(3,4); +SELECT * FROM +( +SELECT t1.b AS a +FROM t1 +GROUP BY t1.a +) dt +WHERE (dt.a=2); +a +2 +EXPLAIN FORMAT=JSON SELECT * FROM +( +SELECT t1.b AS a +FROM t1 +GROUP BY t1.a +) dt +WHERE (dt.a=2); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "dt.a = 2", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "a = 2", + "filesort": { + "sort_key": "t1.a", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } + } + } + } +} +SELECT * FROM +( +SELECT t1.b AS a +FROM t1 +GROUP BY t1.a +HAVING (t1.a<3) +) dt +WHERE (dt.a>1); +a +2 +3 +EXPLAIN FORMAT=JSON SELECT * FROM +( +SELECT t1.b AS a +FROM t1 +GROUP BY t1.a +HAVING (t1.a<3) +) dt +WHERE (dt.a>1); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "dt.a > 1", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "t1.a < 3 and a > 1", + "filesort": { + "sort_key": "t1.a", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } + } + } + } +} +SELECT * FROM +( +SELECT 'ab' AS a +FROM t1 +GROUP BY t1.a +) dt +WHERE (dt.a='ab'); +a +ab +ab +ab +EXPLAIN FORMAT=JSON SELECT * FROM +( +SELECT 'ab' AS a +FROM t1 +GROUP BY t1.a +) dt +WHERE (dt.a='ab'); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "dt.a = 'ab'", + "materialized": { + "query_block": { + "select_id": 2, + "filesort": { + "sort_key": "t1.a", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } + } + } + } +} +SELECT * FROM +( +SELECT 1 AS a +FROM t1 +GROUP BY t1.a +) dt +WHERE (dt.a=1); +a +1 +1 +1 +EXPLAIN FORMAT=JSON SELECT * FROM +( +SELECT 1 AS a +FROM t1 +GROUP BY t1.a +) dt +WHERE (dt.a=1); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "dt.a = 1", + "materialized": { + "query_block": { + "select_id": 2, + "filesort": { + "sort_key": "t1.a", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } + } + } + } +} +DROP TABLE t1; +# +# MDEV-16517: pushdown condition with the IN predicate defined +# with non-constant values +# +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,2),(1,3); +SELECT * FROM +( +SELECT t1.a +FROM t1 +WHERE 1 IN (0,t1.a) +GROUP BY t1.a +) AS dt1 +JOIN +( +SELECT t1.a +FROM t1 +WHERE 1 IN (0,t1.a) +) AS dt2 +ON dt1.a = dt2.a; +a a +1 1 +1 1 +EXPLAIN FORMAT=JSON SELECT * FROM +( +SELECT t1.a +FROM t1 +WHERE 1 IN (0,t1.a) +GROUP BY t1.a +) AS dt1 +JOIN +( +SELECT t1.a +FROM t1 +WHERE 1 IN (0,t1.a) +) AS dt2 +ON dt1.a = dt2.a; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "1 in (0,dt1.a)", + "materialized": { + "query_block": { + "select_id": 2, + "filesort": { + "sort_key": "t1.a", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "1 in (0,t1.a) and 1 in (0,t1.a)" + } + } + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "t1.a = dt1.a" + } + } +} +SELECT * FROM +( +SELECT t1.a,MAX(t1.b) +FROM t1 +GROUP BY t1.a +) AS dt, t1 +WHERE dt.a=t1.a AND dt.a IN (1,t1.a); +a MAX(t1.b) a b +1 3 1 2 +1 3 1 3 +EXPLAIN FORMAT=JSON SELECT * FROM +( +SELECT t1.a,MAX(t1.b) +FROM t1 +GROUP BY t1.a +) AS dt, t1 +WHERE dt.a=t1.a AND dt.a IN (1,t1.a); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "dt.a in (1,dt.a)", + "materialized": { + "query_block": { + "select_id": 2, + "filesort": { + "sort_key": "t1.a", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.a in (1,t1.a)" + } + } + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "t1.a = dt.a" + } + } +} +DROP TABLE t1; +# +# MDEV-15087: error from inexpensive subquery before check +# for condition pushdown into derived +# +CREATE TABLE t1 (i1 int, v1 varchar(1)); +INSERT INTO t1 VALUES (7,'x'); +CREATE TABLE t2 (i1 int); +INSERT INTO t2 VALUES (8); +CREATE TABLE t3 (i1 int ,v1 varchar(1), v2 varchar(1)); +INSERT INTO t3 VALUES (4, 'v','v'),(62,'v','k'),(7, 'n', NULL); +SELECT 1 +FROM (t1 AS a1 +JOIN (((SELECT DISTINCT t3.* +FROM t3) AS a2 +JOIN t1 ON (t1.v1 = a2.v2))) ON (t1.v1 = a2.v1)) +WHERE (SELECT BIT_COUNT(t2.i1) +FROM (t2 JOIN t3)) IS NULL; +ERROR 21000: Subquery returns more than 1 row +DROP TABLE t1, t2, t3; +# +# MDEV-16614 signal 7 after calling stored procedure, that uses regexp +# +CREATE PROCEDURE p1(m1 varchar(5), m2 varchar(5)) +BEGIN +SELECT a FROM +(SELECT "aa" a) t +JOIN (SELECT "aa" b) t1 on t.a=t1.b +WHERE t.a regexp m1 and t1.b regexp m2 +GROUP BY a; +END$$ +CALL p1('a','a'); +a +aa +DROP PROCEDURE p1; +CREATE PROCEDURE p1(m1 varchar(5)) +BEGIN +SELECT a FROM (SELECT "aa" a) t WHERE t.a regexp m1; +END$$ +CALL p1('a'); +a +aa +DROP PROCEDURE p1; +SELECT a FROM (SELECT "aa" a) t WHERE REGEXP_INSTR(t.a, (SELECT MAX('aa') FROM DUAL LIMIT 1)); +a +aa +CREATE OR REPLACE FUNCTION f1(a VARCHAR(10), b VARCHAR(10)) RETURNS INT +BEGIN +RETURN 1; +END;$$ +CREATE OR REPLACE PROCEDURE p1(m1 varchar(5)) +BEGIN +SELECT a FROM (SELECT "aa" a) t WHERE f1(t.a, m1); +END$$ +CALL p1('a'); +a +aa +DROP PROCEDURE p1; +DROP FUNCTION f1; +CREATE OR REPLACE FUNCTION f1(a VARCHAR(10), b VARCHAR(10)) RETURNS INT +BEGIN +RETURN 1; +END;$$ +SELECT a FROM (SELECT "aa" a) t WHERE f1(t.a, (SELECT MAX('aa') FROM DUAL LIMIT 1)); +a +aa +DROP FUNCTION f1; +# +# MDEV-17011: condition pushdown into materialized derived used +# in INSERT SELECT, multi-table UPDATE and DELETE +# +CREATE TABLE t1 (a int ,b int) ENGINE=MyISAM; +INSERT INTO t1 VALUES +(1, 1), (1, 2), (2, 1), (2, 2), (3,1), (3,3), (4,2); +CREATE TABLE t2 (a int) ENGINE MYISAM; +INSERT INTO t2 VALUES +(3), (7), (1), (4), (1); +CREATE TABLE t3 (a int, b int) ENGINE MYISAM; +EXPLAIN FORMAT=JSON INSERT INTO t3 +SELECT * FROM (SELECT a, count(*) as c FROM t1 GROUP BY a) t WHERE a<=2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 7, + "filtered": 100, + "attached_condition": "t.a <= 2", + "materialized": { + "query_block": { + "select_id": 2, + "filesort": { + "sort_key": "t1.a", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 7, + "filtered": 100, + "attached_condition": "t1.a <= 2" + } + } + } + } + } + } + } +} +INSERT INTO t3 +SELECT * FROM (SELECT a, count(*) as c FROM t1 GROUP BY a) t WHERE a<=2; +SELECT * FROM t3; +a b +1 2 +2 2 +EXPLAIN FORMAT=JSON UPDATE t2, (SELECT a, count(*) as c FROM t1 GROUP BY a) t SET t2.a=t.c+10 +WHERE t2.a= t.c and t.a>=3; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 5, + "filtered": 100, + "attached_condition": "t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "8", + "used_key_parts": ["c"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "t2.a = t.c and t.a >= 3", + "materialized": { + "query_block": { + "select_id": 2, + "filesort": { + "sort_key": "t1.a", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 7, + "filtered": 100, + "attached_condition": "t1.a >= 3" + } + } + } + } + } + } + } +} +UPDATE t2, (SELECT a, count(*) as c FROM t1 GROUP BY a) t SET t2.a=t.c+10 +WHERE t2.a= t.c and t.a>=3; +SELECT * FROM t2; +a +3 +7 +11 +4 +11 +EXPLAIN FORMAT=JSON DELETE t2 FROM t2, (SELECT a, count(*) as c FROM t1 GROUP BY a) t +WHERE t2.a= t.c+9 and t.a=2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 5, + "filtered": 100 + }, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 7, + "filtered": 100, + "attached_condition": "t.a = 2 and t2.a = t.c + 9", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 7, + "filtered": 100, + "attached_condition": "t1.a = 2" + } + } + } + } + } +} +DELETE t2 FROM t2, (SELECT a, count(*) as c FROM t1 GROUP BY a) t +WHERE t2.a= t.c+9 and t.a=2; +SELECT * FROM t2; +a +3 +7 +4 +DROP TABLE t1,t2,t3; +# +# MDEV-16765: pushdown condition with the CASE structure +# defined with Item_cond item +# +CREATE TABLE t1(a INT, b INT); +INSERT INTO t1 VALUES (1,2), (3,4), (2,3); +SELECT * +FROM +( +SELECT CASE WHEN ((tab2.max_a=1) OR (tab2.max_a=2)) +THEN 1 ELSE 0 END AS max_a,b +FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 +) AS tab1 +WHERE (tab1.max_a=1); +max_a b +1 2 +1 3 +EXPLAIN FORMAT=JSON SELECT * +FROM +( +SELECT CASE WHEN ((tab2.max_a=1) OR (tab2.max_a=2)) +THEN 1 ELSE 0 END AS max_a,b +FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 +) AS tab1 +WHERE (tab1.max_a=1); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "case when (tab2.max_a = 1 or tab2.max_a = 2) then 1 else 0 end = 1", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "case when (max_a = 1 or max_a = 2) then 1 else 0 end = 1", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } + } + } + } +} +SELECT * +FROM +( +SELECT CASE WHEN ((tab2.max_a=1) OR ((tab2.max_a>2) AND (tab2.max_a<4))) +THEN 1 ELSE 0 END AS max_a,b +FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 +) AS tab1 +WHERE (tab1.max_a=1); +max_a b +1 2 +1 4 +EXPLAIN FORMAT=JSON SELECT * +FROM +( +SELECT CASE WHEN ((tab2.max_a=1) OR ((tab2.max_a>2) AND (tab2.max_a<4))) +THEN 1 ELSE 0 END AS max_a,b +FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 +) AS tab1 +WHERE (tab1.max_a=1); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "case when (tab2.max_a = 1 or tab2.max_a > 2 and tab2.max_a < 4) then 1 else 0 end = 1", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "case when (max_a = 1 or max_a > 2 and max_a < 4) then 1 else 0 end = 1", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } + } + } + } +} +SELECT * +FROM +( +SELECT CASE WHEN ((tab2.max_a>1) AND ((tab2.max_a=2) OR (tab2.max_a>2))) +THEN 1 ELSE 0 END AS max_a,b +FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 +) AS tab1 +WHERE (tab1.max_a=1); +max_a b +1 3 +1 4 +EXPLAIN FORMAT=JSON SELECT * +FROM +( +SELECT CASE WHEN ((tab2.max_a>1) AND ((tab2.max_a=2) OR (tab2.max_a>2))) +THEN 1 ELSE 0 END AS max_a,b +FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 +) AS tab1 +WHERE (tab1.max_a=1); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "case when (tab2.max_a > 1 and (tab2.max_a = 2 or tab2.max_a > 2)) then 1 else 0 end = 1", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "case when (max_a > 1 and (max_a = 2 or max_a > 2)) then 1 else 0 end = 1", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } + } + } + } +} +SELECT * +FROM +( +SELECT CASE WHEN ((tab2.b=2) OR (tab2.b=4)) +THEN 1 ELSE 0 END AS max_a,b +FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 +) AS tab1 +WHERE (tab1.max_a=1); +max_a b +1 2 +1 4 +EXPLAIN FORMAT=JSON SELECT * +FROM +( +SELECT CASE WHEN ((tab2.b=2) OR (tab2.b=4)) +THEN 1 ELSE 0 END AS max_a,b +FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 +) AS tab1 +WHERE (tab1.max_a=1); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "case when (tab2.b = 2 or tab2.b = 4) then 1 else 0 end = 1", + "materialized": { + "query_block": { + "select_id": 3, + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "case when (t1.b = 2 or t1.b = 4) then 1 else 0 end = 1" + } + } + } + } + } + } + } +} +DROP TABLE t1; +# +# MDEV-16803: pushdown condition with IN predicate in the derived table +# defined with several SELECT statements +# +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,2),(3,2),(1,1); +SELECT * FROM +( +SELECT a,b,1 as c +FROM t1 +UNION ALL +SELECT a,b,2 as c +FROM t1 +) AS tab +WHERE ((a,b) IN ((1,2),(3,2))); +a b c +1 2 1 +3 2 1 +1 2 2 +3 2 2 +DROP TABLE t1; +# +# MDEV-17354: INSERT SELECT with condition pushdown into derived +# +CREATE TABLE t1 (f INT NOT NULL); +INSERT INTO t1 VALUES (3), (7), (3); +CREATE ALGORITHM= TEMPTABLE VIEW v1 AS SELECT * FROM ( SELECT * FROM t1 ) AS sq; +INSERT INTO t1 +SELECT * FROM ( SELECT t1.f FROM v1 JOIN t1 ) AS t WHERE f IS NOT NULL; +EXPLAIN INSERT INTO t1 +SELECT * FROM ( SELECT t1.f FROM v1 JOIN t1 ) AS t WHERE f IS NOT NULL; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 144 Using where +2 DERIVED <derived3> ALL NULL NULL NULL NULL 12 +2 DERIVED t1 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +3 DERIVED t1 ALL NULL NULL NULL NULL 12 +EXPLAIN FORMAT=JSON INSERT INTO t1 +SELECT * FROM ( SELECT t1.f FROM v1 JOIN t1 ) AS t WHERE f IS NOT NULL; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 144, + "filtered": 100, + "attached_condition": "t.f is not null", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 12, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 12, + "filtered": 100 + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 12, + "filtered": 100, + "attached_condition": "t1.f is not null" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL" + } + } + } + } + } +} +SELECT * FROM t1; +f +3 +7 +3 +3 +3 +3 +7 +7 +7 +3 +3 +3 +DELETE FROM t1; +INSERT INTO t1 VALUES (3), (7), (3); +INSERT INTO t1 +SELECT * FROM ( SELECT t1.f FROM v1 JOIN t1 ON v1.f=t1.f) AS t +WHERE f IS NOT NULL; +EXPLAIN FORMAT=JSON INSERT INTO t1 +SELECT * FROM ( SELECT t1.f FROM v1 JOIN t1 ON v1.f=t1.f) AS t +WHERE f IS NOT NULL; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 16, + "filtered": 100, + "attached_condition": "t.f is not null", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 8, + "filtered": 100, + "attached_condition": "t1.f is not null" + }, + "table": { + "table_name": "<derived3>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "4", + "used_key_parts": ["f"], + "ref": ["test.t1.f"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 8, + "filtered": 100, + "attached_condition": "t1.f is not null" + } + } + } + } + } + } + } + } +} +SELECT * FROM t1; +f +3 +7 +3 +3 +3 +7 +3 +3 +DROP VIEW v1; +DROP TABLE t1; +# +# MDEV-17574: pushdown into derived from mergeable view +# used in multi-table UPDATE +# pushdown into materialized derived from mergeable view +# used in SELECT +# +CREATE TABLE t1 (f1 text, f2 int); +INSERT INTO t1 VALUES ('x',1), ('y',2); +CREATE VIEW v1 AS SELECT f2 FROM ( SELECT f2 FROM t1 ) AS t; +UPDATE v1, t1 SET t1.f1 = 'z' WHERE v1.f2 < 2 AND t1.f2 = v1.f2; +EXPLAIN FORMAT=JSON UPDATE v1, t1 SET t1.f1 = 'z' WHERE v1.f2 < 2 AND t1.f2 = v1.f2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t.f2 < 2", + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.f2 < 2" + } + } + } + }, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.f2 = t.f2" + } + } +} +SELECT * FROM t1; +f1 f2 +z 1 +y 2 +CREATE VIEW v2 AS SELECT f2 FROM ( SELECT DISTINCT f2 FROM t1 ) AS t; +SELECT * FROM v2, t1 WHERE v2.f2 < 2 AND t1.f2 = v2.f2; +f2 f1 f2 +1 z 1 +EXPLAIN FORMAT=JSON SELECT * FROM v2, t1 WHERE v2.f2 < 2 AND t1.f2 = v2.f2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t.f2 < 2", + "materialized": { + "query_block": { + "select_id": 3, + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.f2 < 2" + } + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "t1.f2 = t.f2" + } + } +} +DROP VIEW v1,v2; +DROP TABLE t1; +# +# MDEV-18383: pushdown condition with the IF structure +# defined with Item_cond item +# +CREATE TABLE t1(a INT, b INT); +CREATE TABLE t2(c INT, d INT); +INSERT INTO t1 VALUES (1,2),(3,4),(5,6); +INSERT INTO t2 VALUES (1,3),(3,7),(5,1); +SELECT * +FROM t1, +( +SELECT MAX(d) AS max_d,c +FROM t2 +GROUP BY c +) AS tab +WHERE t1.a=tab.c AND +IF(2,t1.a=1 OR t1.b>5,1=1); +a b max_d c +1 2 3 1 +5 6 1 5 +DROP TABLE t1,t2; ++# ++# MDEV-19139: pushdown condition with Item_func_set_user_var ++# ++CREATE TABLE t1 (a INT, b INT); ++CREATE VIEW v1 AS SELECT a, MAX(b) FROM t1 GROUP BY a; ++SELECT * FROM (SELECT 1 FROM v1 UNION (SELECT 1 FROM v1 WHERE @a := uuid())) dt; ++1 ++EXPLAIN FORMAT=JSON ++SELECT * FROM (SELECT 1 FROM v1 UNION (SELECT 1 FROM v1 WHERE @a := uuid())) dt; ++EXPLAIN ++{ ++ "query_block": { ++ "select_id": 1, ++ "table": { ++ "table_name": "<derived2>", ++ "access_type": "ALL", ++ "rows": 2, ++ "filtered": 100, ++ "materialized": { ++ "query_block": { ++ "union_result": { ++ "table_name": "<union2,3>", ++ "access_type": "ALL", ++ "query_specifications": [ ++ { ++ "query_block": { ++ "select_id": 2, ++ "table": { ++ "message": "no matching row in const table" ++ } ++ } ++ }, ++ { ++ "query_block": { ++ "select_id": 3, ++ "operation": "UNION", ++ "table": { ++ "message": "no matching row in const table" ++ } ++ } ++ } ++ ] ++ } ++ } ++ } ++ } ++ } ++} ++DROP TABLE t1; ++DROP VIEW v1; +# End of 10.2 tests +# +# MDEV-14579: pushdown conditions into materialized views/derived tables +# that are defined with EXIST or/and INTERSECT +# +create table t1 (a int, b int, c int); +create table t2 (a int, b int, c int); +insert into t1 values +(1,21,345), (1,33,7), (8,33,114), (1,21,500), (1,19,117), (5,14,787), +(8,33,123), (9,10,211), (5,16,207), (1,33,988), (5,27,132), (1,21,104), +(6,20,309), (6,20,315), (1,21,101), (4,33,404), (9,10,800), (1,21,123); +insert into t2 values +(2,3,207), (1,16,909), (5,14,312), +(5,33,207), (6,20,211), (1,19,132), +(8,33,117), (3,21,231), (6,23,303); +create view v1 as +select a, b, min(c) as c from t1 +where t1.a<9 group by a,b having c < 300 +intersect +select a, b, min(c) as c from t1 +where t1.b>10 group by a,b having c > 100; +# using intersect in view definition +# conjunctive subformulas : pushing into WHERE +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and (v1.a<5); +a b c a b c +1 21 101 1 16 909 +1 19 117 1 16 909 +1 21 101 1 19 132 +1 19 117 1 19 132 +select * from v1,t2 where (v1.a=t2.a) and (v1.a<5); +a b c a b c +1 21 101 1 16 909 +1 19 117 1 16 909 +1 21 101 1 19 132 +1 19 117 1 19 132 +explain select * from v1,t2 where (v1.a=t2.a) and (v1.a<5); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a<5); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a < 5 and t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "union_result": { + "table_name": "<intersect2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c < 300", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 9 and t1.a < 5" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "INTERSECT", + "having_condition": "c > 100", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 10 and t1.a < 5" + } + } + } + } + } + ] + } + } + } + } + } +} +# using intersect in view definition +# conjunctive subformulas : pushing into WHERE +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and (v1.a=8); +a b c a b c +8 33 114 8 33 117 +select * from v1,t2 where (v1.a=t2.a) and (v1.a=8); +a b c a b c +8 33 114 8 33 117 +explain select * from v1,t2 where (v1.a=t2.a) and (v1.a=8); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a=8); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a = 8" + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "v1.a = 8" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<intersect2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c < 300", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a = 8" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "INTERSECT", + "having_condition": "c > 100", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a = 8 and t1.b > 10" + } + } + } + } + } + ] + } + } + } + } + } +} +# using intersect in view definition +# conjunctive subformulas : pushing into WHERE using equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and (t2.a=8); +a b c a b c +8 33 114 8 33 117 +select * from v1,t2 where (v1.a=t2.a) and (t2.a=8); +a b c a b c +8 33 114 8 33 117 +explain select * from v1,t2 where (v1.a=t2.a) and (t2.a=8); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.a=t2.a) and (t2.a=8); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a = 8" + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "v1.a = 8" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<intersect2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c < 300", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a = 8" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "INTERSECT", + "having_condition": "c > 100", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a = 8 and t1.b > 10" + } + } + } + } + } + ] + } + } + } + } + } +} +# using intersect in view definition +# conjunctive subformulas : pushing into HAVING +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and (v1.c>200); +a b c a b c +5 16 207 5 14 312 +5 16 207 5 33 207 +select * from v1,t2 where (v1.a=t2.a) and (v1.c>200); +a b c a b c +5 16 207 5 14 312 +5 16 207 5 33 207 +explain select * from v1,t2 where (v1.a=t2.a) and (v1.c>200); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.c>200); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v1.c > 200", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<intersect2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c < 300 and c > 200", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 9" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "INTERSECT", + "having_condition": "c > 100 and c > 200", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 10" + } + } + } + } + } + ] + } + } + } + } + } +} +# using intersect in view definition +# conjunctive subformulas : pushing into WHERE +# conjunctive subformulas : pushing into HAVING +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and (v1.a<5) and (v1.c>110); +a b c a b c +1 19 117 1 16 909 +1 19 117 1 19 132 +select * from v1,t2 where (v1.a=t2.a) and (v1.a<5) and (v1.c>110); +a b c a b c +1 19 117 1 16 909 +1 19 117 1 19 132 +explain select * from v1,t2 where (v1.a=t2.a) and (v1.a<5) and (v1.c>110); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a<5) and (v1.c>110); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a < 5 and t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v1.c > 110", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<intersect2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c < 300 and c > 110", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 9 and t1.a < 5" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "INTERSECT", + "having_condition": "c > 100 and c > 110", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 10 and t1.a < 5" + } + } + } + } + } + ] + } + } + } + } + } +} +# using intersect in view definition +# extracted or formula : pushing into WHERE +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and ((v1.b>27) or (v1.b<19)); +a b c a b c +5 16 207 5 14 312 +5 16 207 5 33 207 +8 33 114 8 33 117 +select * from v1,t2 where (v1.a=t2.a) and ((v1.b>27) or (v1.b<19)); +a b c a b c +5 16 207 5 14 312 +5 16 207 5 33 207 +8 33 114 8 33 117 +explain select * from v1,t2 where (v1.a=t2.a) and ((v1.b>27) or (v1.b<19)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.a=t2.a) and ((v1.b>27) or (v1.b<19)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v1.b > 27 or v1.b < 19", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<intersect2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c < 300", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 9 and (t1.b > 27 or t1.b < 19)" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "INTERSECT", + "having_condition": "c > 100", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 10 and (t1.b > 27 or t1.b < 19)" + } + } + } + } + } + ] + } + } + } + } + } +} +# using intersect in view definition +# extracted or formula : pushing into HAVING +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where +(v1.a=t2.a) and ((v1.c>200) or (v1.c<105)); +a b c a b c +1 21 101 1 16 909 +5 16 207 5 14 312 +5 16 207 5 33 207 +1 21 101 1 19 132 +select * from v1,t2 where +(v1.a=t2.a) and ((v1.c>200) or (v1.c<105)); +a b c a b c +1 21 101 1 16 909 +5 16 207 5 14 312 +5 16 207 5 33 207 +1 21 101 1 19 132 +explain select * from v1,t2 where +(v1.a=t2.a) and ((v1.c>200) or (v1.c<105)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where +(v1.a=t2.a) and ((v1.c>200) or (v1.c<105)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v1.c > 200 or v1.c < 105", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<intersect2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c < 300 and (c > 200 or c < 105)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 9" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "INTERSECT", + "having_condition": "c > 100 and (c > 200 or c < 105)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 10" + } + } + } + } + } + ] + } + } + } + } + } +} +# using intersect in view definition +# extracted or formula : pushing into WHERE +# extracted or formula : pushing into HAVING using equalities +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where +((v1.a>3) and (t2.c>110) and (v1.c=t2.c)) or +((v1.a=1) and (v1.c<110)); +a b c a b c +1 21 101 2 3 207 +1 21 101 1 16 909 +1 21 101 5 14 312 +1 21 101 5 33 207 +1 21 101 6 20 211 +1 21 101 1 19 132 +1 21 101 8 33 117 +1 21 101 3 21 231 +1 21 101 6 23 303 +5 16 207 2 3 207 +5 16 207 5 33 207 +5 27 132 1 19 132 +select * from v1,t2 where +((v1.a>3) and (t2.c>110) and (v1.c=t2.c)) or +((v1.a=1) and (v1.c<110)); +a b c a b c +1 21 101 2 3 207 +1 21 101 1 16 909 +1 21 101 5 14 312 +1 21 101 5 33 207 +1 21 101 6 20 211 +1 21 101 1 19 132 +1 21 101 8 33 117 +1 21 101 3 21 231 +1 21 101 6 23 303 +5 16 207 2 3 207 +5 16 207 5 33 207 +5 27 132 1 19 132 +explain select * from v1,t2 where +((v1.a>3) and (t2.c>110) and (v1.c=t2.c)) or +((v1.a=1) and (v1.c<110)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where +((v1.a>3) and (t2.c>110) and (v1.c=t2.c)) or +((v1.a=1) and (v1.c<110)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "v1.a > 3 or v1.a = 1 and v1.c < 110" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v1.c = t2.c and v1.a > 3 and t2.c > 110 or v1.a = 1 and v1.c < 110", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<intersect2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c < 300 and (t1.a > 3 and c > 110 or c < 110 and t1.a = 1)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 9 and (t1.a > 3 or t1.a = 1)" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "INTERSECT", + "having_condition": "c > 100 and (t1.a > 3 and c > 110 or c < 110 and t1.a = 1)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 10 and (t1.a > 3 or t1.a = 1)" + } + } + } + } + } + ] + } + } + } + } + } +} +# using intersect in view definition +# prepare of a query +# conjunctive subformulas : pushing into WHERE +# conjunctive subformulas : pushing into HAVING +prepare stmt from "select * from v1,t2 + where (v1.a=t2.a) and (v1.a<5) and (v1.c>110);"; +execute stmt; +a b c a b c +1 19 117 1 16 909 +1 19 117 1 19 132 +execute stmt; +a b c a b c +1 19 117 1 16 909 +1 19 117 1 19 132 +deallocate prepare stmt; +# using intersect in derived table definition +# extracted or formula : pushing into WHERE using equalities +# extracted or formula : pushing into HAVING +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * +from t2, +(select a, b, min(c) as c from t1 +where t1.a<9 group by a,b having c < 300 +intersect +select a, b, min(c) as c from t1 +where t1.b>10 group by a,b having c > 100) as d1 +where +(d1.b=t2.b) and +(((t2.b>13) and (t2.c=909)) or +((d1.a<4) and (d1.c<200))); +a b c a b c +1 16 909 5 16 207 +1 19 132 1 19 117 +3 21 231 1 21 101 +select * +from t2, +(select a, b, min(c) as c from t1 +where t1.a<9 group by a,b having c < 300 +intersect +select a, b, min(c) as c from t1 +where t1.b>10 group by a,b having c > 100) as d1 +where +(d1.b=t2.b) and +(((t2.b>13) and (t2.c=909)) or +((d1.a<4) and (d1.c<200))); +a b c a b c +1 16 909 5 16 207 +1 19 132 1 19 117 +3 21 231 1 21 101 +explain select * +from t2, +(select a, b, min(c) as c from t1 +where t1.a<9 group by a,b having c < 300 +intersect +select a, b, min(c) as c from t1 +where t1.b>10 group by a,b having c > 100) as d1 +where +(d1.b=t2.b) and +(((t2.b>13) and (t2.c=909)) or +((d1.a<4) and (d1.c<200))); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.b 2 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * +from t2, +(select a, b, min(c) as c from t1 +where t1.a<9 group by a,b having c < 300 +intersect +select a, b, min(c) as c from t1 +where t1.b>10 group by a,b having c > 100) as d1 +where +(d1.b=t2.b) and +(((t2.b>13) and (t2.c=909)) or +((d1.a<4) and (d1.c<200))); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.b is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["b"], + "ref": ["test.t2.b"], + "rows": 2, + "filtered": 100, + "attached_condition": "t2.c = 909 and t2.b > 13 or d1.a < 4 and d1.c < 200", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<intersect2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c < 300 and (t1.b > 13 or t1.a < 4 and c < 200)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 9 and (t1.b > 13 or t1.a < 4)" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "INTERSECT", + "having_condition": "c > 100 and (t1.b > 13 or t1.a < 4 and c < 200)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 10 and (t1.b > 13 or t1.a < 4)" + } + } + } + } + } + ] + } + } + } + } + } +} +drop view v1; +create view v1 as +select a, b, max(c) as c from t1 +where t1.a<9 group by a,b having c > 200 +except +select a, b, max(c) as c from t1 +where t1.b>10 group by a,b having c < 300; +# using except in view definition +# conjunctive subformulas : pushing into WHERE +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and (v1.a<5); +a b c a b c +1 33 988 1 16 909 +1 21 500 1 16 909 +1 33 988 1 19 132 +1 21 500 1 19 132 +select * from v1,t2 where (v1.a=t2.a) and (v1.a<5); +a b c a b c +1 33 988 1 16 909 +1 21 500 1 16 909 +1 33 988 1 19 132 +1 21 500 1 19 132 +explain select * from v1,t2 where (v1.a=t2.a) and (v1.a<5); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a<5); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a < 5 and t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "union_result": { + "table_name": "<except2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c > 200", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 9 and t1.a < 5" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "EXCEPT", + "having_condition": "c < 300", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 10 and t1.a < 5" + } + } + } + } + } + ] + } + } + } + } + } +} +# using except in view definition +# conjunctive subformulas : pushing into WHERE +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and (v1.a=6); +a b c a b c +6 20 315 6 20 211 +6 20 315 6 23 303 +select * from v1,t2 where (v1.a=t2.a) and (v1.a=6); +a b c a b c +6 20 315 6 20 211 +6 20 315 6 23 303 +explain select * from v1,t2 where (v1.a=t2.a) and (v1.a=6); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a=6); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a = 6" + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "v1.a = 6" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<except2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c > 200", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a = 6" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "EXCEPT", + "having_condition": "c < 300", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a = 6 and t1.b > 10" + } + } + } + } + } + ] + } + } + } + } + } +} +# using except in view definition +# conjunctive subformulas : pushing into WHERE using equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and (t2.a=6); +a b c a b c +6 20 315 6 20 211 +6 20 315 6 23 303 +select * from v1,t2 where (v1.a=t2.a) and (t2.a=6); +a b c a b c +6 20 315 6 20 211 +6 20 315 6 23 303 +explain select * from v1,t2 where (v1.a=t2.a) and (t2.a=6); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.a=t2.a) and (t2.a=6); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a = 6" + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "v1.a = 6" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<except2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c > 200", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a = 6" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "EXCEPT", + "having_condition": "c < 300", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a = 6 and t1.b > 10" + } + } + } + } + } + ] + } + } + } + } + } +} +# using except in view definition +# conjunctive subformulas : pushing into HAVING +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and (v1.c>500); +a b c a b c +1 33 988 1 16 909 +5 14 787 5 14 312 +5 14 787 5 33 207 +1 33 988 1 19 132 +select * from v1,t2 where (v1.a=t2.a) and (v1.c>500); +a b c a b c +1 33 988 1 16 909 +5 14 787 5 14 312 +5 14 787 5 33 207 +1 33 988 1 19 132 +explain select * from v1,t2 where (v1.a=t2.a) and (v1.c>500); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.c>500); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v1.c > 500", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<except2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c > 200 and c > 500", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 9" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "EXCEPT", + "having_condition": "c < 300 and c > 500", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 10" + } + } + } + } + } + ] + } + } + } + } + } +} +# using except in view definition +# conjunctive subformulas : pushing into WHERE +# conjunctive subformulas : pushing into HAVING +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and (v1.a<5) and (v1.c>500); +a b c a b c +1 33 988 1 16 909 +1 33 988 1 19 132 +select * from v1,t2 where (v1.a=t2.a) and (v1.a<5) and (v1.c>500); +a b c a b c +1 33 988 1 16 909 +1 33 988 1 19 132 +explain select * from v1,t2 where (v1.a=t2.a) and (v1.a<5) and (v1.c>500); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a<5) and (v1.c>500); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a < 5 and t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v1.c > 500", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<except2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c > 200 and c > 500", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 9 and t1.a < 5" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "EXCEPT", + "having_condition": "c < 300 and c > 500", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 10 and t1.a < 5" + } + } + } + } + } + ] + } + } + } + } + } +} +# using except in view definition +# extracted or formula : pushing into WHERE +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and ((v1.b>27) or (v1.b<19)); +a b c a b c +1 33 988 1 16 909 +5 14 787 5 14 312 +5 14 787 5 33 207 +1 33 988 1 19 132 +select * from v1,t2 where (v1.a=t2.a) and ((v1.b>27) or (v1.b<19)); +a b c a b c +1 33 988 1 16 909 +5 14 787 5 14 312 +5 14 787 5 33 207 +1 33 988 1 19 132 +explain select * from v1,t2 where (v1.a=t2.a) and ((v1.b>27) or (v1.b<19)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.a=t2.a) and ((v1.b>27) or (v1.b<19)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v1.b > 27 or v1.b < 19", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<except2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c > 200", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 9 and (t1.b > 27 or t1.b < 19)" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "EXCEPT", + "having_condition": "c < 300", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 10 and (t1.b > 27 or t1.b < 19)" + } + } + } + } + } + ] + } + } + } + } + } +} +# using except in view definition +# extracted or formula : pushing into HAVING +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where +(v1.a=t2.a) and ((v1.c<400) or (v1.c>800)); +a b c a b c +1 33 988 1 16 909 +6 20 315 6 20 211 +1 33 988 1 19 132 +6 20 315 6 23 303 +select * from v1,t2 where +(v1.a=t2.a) and ((v1.c<400) or (v1.c>800)); +a b c a b c +1 33 988 1 16 909 +6 20 315 6 20 211 +1 33 988 1 19 132 +6 20 315 6 23 303 +explain select * from v1,t2 where +(v1.a=t2.a) and ((v1.c<400) or (v1.c>800)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where +(v1.a=t2.a) and ((v1.c<400) or (v1.c>800)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v1.c < 400 or v1.c > 800", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<except2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c > 200 and (c < 400 or c > 800)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 9" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "EXCEPT", + "having_condition": "c < 300 and (c < 400 or c > 800)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 10" + } + } + } + } + } + ] + } + } + } + } + } +} +# using except in view definition +# extracted or formula : pushing into WHERE +# extracted or formula : pushing into HAVING using equalities +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where +(v1.c=t2.c) and +((v1.a>1) and (t2.c<500)) or +((v1.a=1) and (v1.c>500)); +a b c a b c +1 33 988 2 3 207 +1 33 988 1 16 909 +1 33 988 5 14 312 +1 33 988 5 33 207 +1 33 988 6 20 211 +1 33 988 1 19 132 +1 33 988 8 33 117 +1 33 988 3 21 231 +1 33 988 6 23 303 +select * from v1,t2 where +(v1.c=t2.c) and +((v1.a>1) and (t2.c<500)) or +((v1.a=1) and (v1.c>500)); +a b c a b c +1 33 988 2 3 207 +1 33 988 1 16 909 +1 33 988 5 14 312 +1 33 988 5 33 207 +1 33 988 6 20 211 +1 33 988 1 19 132 +1 33 988 8 33 117 +1 33 988 3 21 231 +1 33 988 6 23 303 +explain select * from v1,t2 where +(v1.c=t2.c) and +((v1.a>1) and (t2.c<500)) or +((v1.a=1) and (v1.c>500)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where +(v1.c=t2.c) and +((v1.a>1) and (t2.c<500)) or +((v1.a=1) and (v1.c>500)); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "v1.a > 1 or v1.a = 1 and v1.c > 500" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v1.c = t2.c and v1.a > 1 and t2.c < 500 or v1.a = 1 and v1.c > 500", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<except2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c > 200 and (t1.a > 1 and c < 500 or c > 500 and t1.a = 1)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 9 and (t1.a > 1 or t1.a = 1)" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "EXCEPT", + "having_condition": "c < 300 and (t1.a > 1 and c < 500 or c > 500 and t1.a = 1)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 10 and (t1.a > 1 or t1.a = 1)" + } + } + } + } + } + ] + } + } + } + } + } +} +# using except in view definition +# prepare of a query +# conjunctive subformulas : pushing into WHERE +# conjunctive subformulas : pushing into HAVING +prepare stmt from "select * from v1,t2 + where (v1.a=t2.a) and (v1.a<5) and (v1.c>500);"; +execute stmt; +a b c a b c +1 33 988 1 16 909 +1 33 988 1 19 132 +execute stmt; +a b c a b c +1 33 988 1 16 909 +1 33 988 1 19 132 +deallocate prepare stmt; +# using except in view definition +# extracted or formula : pushing into WHERE using equalities +# extracted or formula : pushing into HAVING +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * +from t2, +(select a, b, max(c) as c from t1 +where t1.a<9 group by a,b having c > 200 +except +select a, b, max(c) as c from t1 +where t1.b>10 group by a,b having c < 300) as d1 +where +(d1.b=t2.b) and +(((t2.b>13) and (t2.c=988)) or +((d1.a>4) and (d1.c>500))); +a b c a b c +5 14 312 5 14 787 +select * +from t2, +(select a, b, max(c) as c from t1 +where t1.a<9 group by a,b having c > 200 +except +select a, b, max(c) as c from t1 +where t1.b>10 group by a,b having c < 300) as d1 +where +(d1.b=t2.b) and +(((t2.b>13) and (t2.c=988)) or +((d1.a>4) and (d1.c>500))); +a b c a b c +5 14 312 5 14 787 +explain select * +from t2, +(select a, b, max(c) as c from t1 +where t1.a<9 group by a,b having c > 200 +except +select a, b, max(c) as c from t1 +where t1.b>10 group by a,b having c < 300) as d1 +where +(d1.b=t2.b) and +(((t2.b>13) and (t2.c=988)) or +((d1.a>4) and (d1.c>500))); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.b 2 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * +from t2, +(select a, b, max(c) as c from t1 +where t1.a<9 group by a,b having c > 200 +except +select a, b, max(c) as c from t1 +where t1.b>10 group by a,b having c < 300) as d1 +where +(d1.b=t2.b) and +(((t2.b>13) and (t2.c=988)) or +((d1.a>4) and (d1.c>500))); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.b is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["b"], + "ref": ["test.t2.b"], + "rows": 2, + "filtered": 100, + "attached_condition": "t2.c = 988 and t2.b > 13 or d1.a > 4 and d1.c > 500", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<except2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c > 200 and (t1.b > 13 or t1.a > 4 and c > 500)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 9 and (t1.b > 13 or t1.a > 4)" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "EXCEPT", + "having_condition": "c < 300 and (t1.b > 13 or t1.a > 4 and c > 500)", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 10 and (t1.b > 13 or t1.a > 4)" + } + } + } + } + } + ] + } + } + } + } + } +} +drop view v1; +# using union and intersect in view definition +# conjunctive subformulas : pushing into WHERE and HAVING +create view v1 as +select a, b, min(c) as c from t1 +where t1.a<9 group by a,b having c > 200 +union +select a, b, max(c) as c from t1 +where t1.b>10 group by a,b having c < 300 +intersect +select a, b, max(c) as c from t1 +where t1.a>3 group by a,b having c < 530; +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and (v1.a>5) and (v1.c>200); +a b c a b c +6 20 309 6 20 211 +6 20 309 6 23 303 +select * from v1,t2 where (v1.a=t2.a) and (v1.a>5) and (v1.c>200); +a b c a b c +6 20 309 6 20 211 +6 20 309 6 23 303 +explain select * from v1,t2 where (v1.a=t2.a) and (v1.a>5) and (v1.c>200); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 3 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 UNION <derived4> ALL NULL NULL NULL NULL 18 Using where +4 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +5 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect4,5> ALL NULL NULL NULL NULL NULL +NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a>5) and (v1.c>200); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a > 5 and t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 3, + "filtered": 100, + "attached_condition": "v1.c > 200", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<union2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c > 200 and c > 200", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 9 and t1.a > 5" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "UNION", + "table": { + "table_name": "<derived4>", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "__3.a > 5 and __3.c > 200", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<intersect4,5>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 4, + "having_condition": "c < 300 and c > 200", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 10 and t1.a > 5" + } + } + } + } + }, + { + "query_block": { + "select_id": 5, + "operation": "INTERSECT", + "having_condition": "c < 530 and c > 200", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a > 3 and t1.a > 5" + } + } + } + } + } + ] + } + } + } + } + } + } + ] + } + } + } + } + } +} +drop view v1; +# using union and intersect in view definition +# conjunctive subformulas : pushing into WHERE and HAVING +create view v1 as +select a, b, min(c) as c from t1 +where t1.a<9 group by a,b having c > 200 +intersect +select a, b, max(c) as c from t1 +where t1.a>3 group by a,b having c < 500 +union +select a, b, max(c) as c from t1 +where t1.b>10 group by a,b having c < 300; +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<200); +a b c a b c +5 27 132 5 14 312 +5 27 132 5 33 207 +8 33 123 8 33 117 +select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<200); +a b c a b c +5 27 132 5 14 312 +5 27 132 5 33 207 +8 33 123 8 33 117 +explain select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<200); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 3 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +4 UNION t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL UNIT RESULT <unit2,3,4> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<200); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a > 4 and t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 3, + "filtered": 100, + "attached_condition": "v1.c < 200", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<unit2,3,4>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c > 200 and c < 200", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 9 and t1.a > 4" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "INTERSECT", + "having_condition": "c < 500 and c < 200", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a > 3 and t1.a > 4" + } + } + } + } + }, + { + "query_block": { + "select_id": 4, + "operation": "UNION", + "having_condition": "c < 300 and c < 200", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 10 and t1.a > 4" + } + } + } + } + } + ] + } + } + } + } + } +} +drop view v1; +# using union and except in view definition +# conjunctive subformulas : pushing into WHERE and HAVING +create view v1 as +select a, b, min(c) as c from t1 +where t1.a<9 group by a,b having c > 200 +union +select a, b, max(c) as c from t1 +where t1.b>10 group by a,b having c < 300 +except +select a, b, max(c) as c from t1 +where t1.a>3 group by a,b having c < 530; +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and (v1.a>5) and (v1.c>200); +a b c a b c +6 20 309 6 20 211 +6 20 309 6 23 303 +select * from v1,t2 where (v1.a=t2.a) and (v1.a>5) and (v1.c>200); +a b c a b c +6 20 309 6 20 211 +6 20 309 6 23 303 +explain select * from v1,t2 where (v1.a=t2.a) and (v1.a>5) and (v1.c>200); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 3 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 UNION t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +4 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL UNIT RESULT <unit2,3,4> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a>5) and (v1.c>200); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a > 5 and t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 3, + "filtered": 100, + "attached_condition": "v1.c > 200", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<unit2,3,4>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c > 200 and c > 200", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 9 and t1.a > 5" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "UNION", + "having_condition": "c < 300 and c > 200", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 10 and t1.a > 5" + } + } + } + } + }, + { + "query_block": { + "select_id": 4, + "operation": "EXCEPT", + "having_condition": "c < 530 and c > 200", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a > 3 and t1.a > 5" + } + } + } + } + } + ] + } + } + } + } + } +} +drop view v1; +# using union and except in view definition +# conjunctive subformulas : pushing into WHERE and HAVING +create view v1 as +select a, b, min(c) as c from t1 +where t1.a<9 group by a,b having c > 200 +except +select a, b, max(c) as c from t1 +where t1.a>3 group by a,b having c < 500 +union +select a, b, max(c) as c from t1 +where t1.b>10 group by a,b having c < 300; +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<200); +a b c a b c +5 27 132 5 14 312 +5 27 132 5 33 207 +8 33 123 8 33 117 +select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<200); +a b c a b c +5 27 132 5 14 312 +5 27 132 5 33 207 +8 33 123 8 33 117 +explain select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<200); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 3 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +4 UNION t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL UNIT RESULT <unit2,3,4> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<200); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a > 4 and t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 3, + "filtered": 100, + "attached_condition": "v1.c < 200", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<unit2,3,4>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c > 200 and c < 200", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 9 and t1.a > 4" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "EXCEPT", + "having_condition": "c < 500 and c < 200", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a > 3 and t1.a > 4" + } + } + } + } + }, + { + "query_block": { + "select_id": 4, + "operation": "UNION", + "having_condition": "c < 300 and c < 200", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 10 and t1.a > 4" + } + } + } + } + } + ] + } + } + } + } + } +} +drop view v1; +# using except and intersect in view definition +# conjunctive subformulas : pushing into WHERE and HAVING +create view v1 as +select a, b, max(c) as c from t1 +where t1.b>10 group by a,b having c < 300 +intersect +select a, b, max(c) as c from t1 +where t1.a<7 group by a,b having c < 500 +except +select a, b, max(c) as c from t1 +where t1.a<9 group by a,b having c > 150; +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<150); +a b c a b c +5 27 132 5 14 312 +5 27 132 5 33 207 +select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<150); +a b c a b c +5 27 132 5 14 312 +5 27 132 5 33 207 +explain select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<150); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +4 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL UNIT RESULT <unit2,3,4> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<150); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a > 4 and t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v1.c < 150", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<unit2,3,4>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c < 300 and c < 150", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 10 and t1.a > 4" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "INTERSECT", + "having_condition": "c < 500 and c < 150", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 7 and t1.a > 4" + } + } + } + } + }, + { + "query_block": { + "select_id": 4, + "operation": "EXCEPT", + "having_condition": "c > 150 and c < 150", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 9 and t1.a > 4" + } + } + } + } + } + ] + } + } + } + } + } +} +drop view v1; +# using except and intersect in view definition +# conjunctive subformulas : pushing into WHERE and HAVING +create view v1 as +select a, b, max(c) as c from t1 +where t1.b>10 group by a,b having c < 300 +except +select a, b, max(c) as c from t1 +where t1.a<9 group by a,b having c > 150 +intersect +select a, b, max(c) as c from t1 +where t1.a<7 group by a,b having c < 500; +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<130); +a b c a b c +8 33 123 8 33 117 +select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<130); +a b c a b c +8 33 123 8 33 117 +explain select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<130); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT <derived4> ALL NULL NULL NULL NULL 18 Using where +4 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +5 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect4,5> ALL NULL NULL NULL NULL NULL +NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<130); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a > 4 and t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v1.c < 130", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<except2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c < 300 and c < 130", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 10 and t1.a > 4" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "EXCEPT", + "table": { + "table_name": "<derived4>", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "__3.a > 4 and __3.c < 130", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<intersect4,5>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 4, + "having_condition": "c > 150 and c < 130", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 9 and t1.a > 4" + } + } + } + } + }, + { + "query_block": { + "select_id": 5, + "operation": "INTERSECT", + "having_condition": "c < 500 and c < 130", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 7 and t1.a > 4" + } + } + } + } + } + ] + } + } + } + } + } + } + ] + } + } + } + } + } +} +drop view v1; +# using except, intersect and union in view definition +# conjunctive subformulas : pushing into WHERE and HAVING +create view v1 as +select a, b, max(c) as c from t1 +where t1.b>10 group by a,b having c < 300 +except +select a, b, max(c) as c from t1 +where t1.a<9 group by a,b having c > 150 +intersect +select a, b, max(c) as c from t1 +where t1.a<7 group by a,b having c < 500 +union +select a, b, max(c) as c from t1 +where t1.a<7 group by a,b having c < 120; +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<130); +a b c a b c +8 33 123 8 33 117 +select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<130); +a b c a b c +8 33 123 8 33 117 +explain select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<130); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 3 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT <derived4> ALL NULL NULL NULL NULL 18 Using where +4 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +5 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect4,5> ALL NULL NULL NULL NULL NULL +6 UNION t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL UNIT RESULT <unit2,3,6> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<130); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a > 4 and t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 3, + "filtered": 100, + "attached_condition": "v1.c < 130", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<unit2,3,6>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c < 300 and c < 130", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 10 and t1.a > 4" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "EXCEPT", + "table": { + "table_name": "<derived4>", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "__3.a > 4 and __3.c < 130", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<intersect4,5>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 4, + "having_condition": "c > 150 and c < 130", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 9 and t1.a > 4" + } + } + } + } + }, + { + "query_block": { + "select_id": 5, + "operation": "INTERSECT", + "having_condition": "c < 500 and c < 130", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 7 and t1.a > 4" + } + } + } + } + } + ] + } + } + } + } + } + }, + { + "query_block": { + "select_id": 6, + "operation": "UNION", + "having_condition": "c < 120 and c < 130", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 7 and t1.a > 4" + } + } + } + } + } + ] + } + } + } + } + } +} +drop view v1; +# using intersect in view definition +# using embedded view +# conjunctive subformulas : pushing into WHERE and HAVING +create view v1 as +select a, b, max(c) as c from t1 +where t1.b>10 group by a,b having c < 300 +intersect +select a, b, max(c) as c from t1 +where t1.a<9 group by a,b having c > 120; +create view v2 as +select a, b, max(c) as c from v1 +where v1.a<7 group by a,b; +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v2,t2 where (v2.a=t2.a) and (v2.a>4) and (v2.c<150); +a b c a b c +5 27 132 5 14 312 +5 27 132 5 33 207 +select * from v2,t2 where (v2.a=t2.a) and (v2.a>4) and (v2.c<150); +a b c a b c +5 27 132 5 14 312 +5 27 132 5 33 207 +explain select * from v2,t2 where (v2.a=t2.a) and (v2.a>4) and (v2.c<150); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED <derived3> ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +4 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect3,4> ALL NULL NULL NULL NULL NULL +explain format=json select * from v2,t2 where (v2.a=t2.a) and (v2.a>4) and (v2.c<150); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a > 4 and t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v2.c < 150", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "c < 150", + "filesort": { + "sort_key": "v1.a, v1.b", + "temporary_table": { + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "v1.a < 7 and v1.a > 4", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<intersect3,4>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 3, + "having_condition": "c < 300", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 10 and t1.a < 7 and t1.a > 4" + } + } + } + } + }, + { + "query_block": { + "select_id": 4, + "operation": "INTERSECT", + "having_condition": "c > 120", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 9 and t1.a < 7 and t1.a > 4" + } + } + } + } + } + ] + } + } + } + } + } + } + } + } + } + } +} +drop view v1,v2; +# using except in view definition +# using embedded view +# conjunctive subformulas : pushing into WHERE and HAVING +create view v1 as +select a, b, max(c) as c from t1 +where t1.b>10 group by a,b having c < 300 +except +select a, b, max(c) as c from t1 +where t1.a<9 group by a,b having c > 150; +create view v2 as +select a, b, max(c) as c from v1 +where v1.a<7 group by a,b; +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v2,t2 where (v2.a=t2.a) and (v2.a>4) and (v2.c<150); +a b c a b c +5 27 132 5 14 312 +5 27 132 5 33 207 +select * from v2,t2 where (v2.a=t2.a) and (v2.a>4) and (v2.c<150); +a b c a b c +5 27 132 5 14 312 +5 27 132 5 33 207 +explain select * from v2,t2 where (v2.a=t2.a) and (v2.a>4) and (v2.c<150); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED <derived3> ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +4 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except3,4> ALL NULL NULL NULL NULL NULL +explain format=json select * from v2,t2 where (v2.a=t2.a) and (v2.a>4) and (v2.c<150); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a > 4 and t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v2.c < 150", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "c < 150", + "filesort": { + "sort_key": "v1.a, v1.b", + "temporary_table": { + "table": { + "table_name": "<derived3>", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "v1.a < 7 and v1.a > 4", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<except3,4>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 3, + "having_condition": "c < 300", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 10 and t1.a < 7 and t1.a > 4" + } + } + } + } + }, + { + "query_block": { + "select_id": 4, + "operation": "EXCEPT", + "having_condition": "c > 150", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 9 and t1.a < 7 and t1.a > 4" + } + } + } + } + } + ] + } + } + } + } + } + } + } + } + } + } +} +drop view v1,v2; +# using intersect in view definition +# conditions are pushed in different parts of selects +# conjunctive subformulas : pushing into WHERE and HAVING +create view v1 as +select a, b, max(c) as c from t1 +where t1.a<9 group by a having c > 300 +intersect +select a, b, max(c) as c from t1 +where t1.b<21 group by b having c > 200; +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.b>12) and (v1.c<450); +a b c a b c +6 20 315 6 20 211 +6 20 315 6 23 303 +select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.b>12) and (v1.c<450); +a b c a b c +6 20 315 6 20 211 +6 20 315 6 23 303 +explain select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.b>12) and (v1.c<450); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.b>12) and (v1.c<450); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a > 4 and t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v1.b > 12 and v1.c < 450", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<intersect2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c > 300 and t1.b > 12 and c < 450", + "filesort": { + "sort_key": "t1.a", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 9 and t1.a > 4" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "INTERSECT", + "having_condition": "c > 200 and t1.a > 4 and c < 450", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b < 21 and t1.b > 12" + } + } + } + } + } + ] + } + } + } + } + } +} +drop view v1; +# using except in view definition +# conditions are pushed in different parts of selects +# conjunctive subformulas : pushing into WHERE and HAVING +create view v1 as +select a, b, max(c) as c from t1 +where t1.b>20 group by a having c > 300 +except +select a, b, max(c) as c from t1 +where t1.a<7 group by b having c > 150; +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and (v1.a<2) and (v1.b<30) and (v1.c>450); +a b c a b c +1 21 988 1 16 909 +1 21 988 1 19 132 +select * from v1,t2 where (v1.a=t2.a) and (v1.a<2) and (v1.b<30) and (v1.c>450); +a b c a b c +1 21 988 1 16 909 +1 21 988 1 19 132 +explain select * from v1,t2 where (v1.a=t2.a) and (v1.a<2) and (v1.b<30) and (v1.c>450); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a<2) and (v1.b<30) and (v1.c>450); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a < 2 and t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v1.b < 30 and v1.c > 450", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<except2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c > 300 and t1.b < 30 and c > 450", + "filesort": { + "sort_key": "t1.a", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 20 and t1.a < 2" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "EXCEPT", + "having_condition": "c > 150 and t1.a < 2 and c > 450", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 7 and t1.b < 30" + } + } + } + } + } + ] + } + } + } + } + } +} +drop view v1; +# using except and union in view definition +# conditions are pushed in different parts of selects +# conjunctive subformulas : pushing into HAVING +# extracted or formula : pushing into WHERE +# extracted or formula : pushing into HAVING +create view v1 as +select a, b, max(c) as c from t1 +where t1.b>20 group by a having c > 300 +except +select a, b, max(c) as c from t1 +where t1.a<7 group by b having c > 150; +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and ((v1.a<2) or (v1.a<5)) and (v1.c>450); +a b c a b c +1 21 988 1 16 909 +1 21 988 1 19 132 +select * from v1,t2 where (v1.a=t2.a) and ((v1.a<2) or (v1.a<5)) and (v1.c>450); +a b c a b c +1 21 988 1 16 909 +1 21 988 1 19 132 +explain select * from v1,t2 where (v1.a=t2.a) and ((v1.a<2) or (v1.a<5)) and (v1.c>450); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 EXCEPT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.a=t2.a) and ((v1.a<2) or (v1.a<5)) and (v1.c>450); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "(t2.a < 2 or t2.a < 5) and t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "v1.c > 450", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<except2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c > 300 and c > 450", + "filesort": { + "sort_key": "t1.a", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 20 and (t1.a < 2 or t1.a < 5)" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "EXCEPT", + "having_condition": "c > 150 and (t1.a < 2 or t1.a < 5) and c > 450", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 7" + } + } + } + } + } + ] + } + } + } + } + } +} +drop view v1; +# using union and intersect in view definition +# conditions are pushed in different parts of selects +# conjunctive subformulas : pushing into WHERE and HAVING +create view v1 as +select a, b, max(c) as c from t1 +where t1.a<9 group by a having c > 100 +intersect +select a, b, max(c) as c from t1 +where t1.a>3 group by b having c < 800 +union +select a, b, max(c) as c from t1 +where t1.b>10 group by a,b having c > 300; +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a=t2.a) and (v1.a>1) and (v1.b > 12) and (v1.c>400); +a b c a b c +5 14 787 5 14 312 +5 14 787 5 33 207 +select * from v1,t2 where (v1.a=t2.a) and (v1.a>1) and (v1.b > 12) and (v1.c>400); +a b c a b c +5 14 787 5 14 312 +5 14 787 5 33 207 +explain select * from v1,t2 where (v1.a=t2.a) and (v1.a>1) and (v1.b > 12) and (v1.c>400); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 3 Using where +2 DERIVED t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +3 INTERSECT t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +4 UNION t1 ALL NULL NULL NULL NULL 18 Using where; Using temporary; Using filesort +NULL UNIT RESULT <unit2,3,4> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.a=t2.a) and (v1.a>1) and (v1.b > 12) and (v1.c>400); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.a > 1 and t2.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 3, + "filtered": 100, + "attached_condition": "v1.b > 12 and v1.c > 400", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<unit2,3,4>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "having_condition": "c > 100 and t1.b > 12 and c > 400", + "filesort": { + "sort_key": "t1.a", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a < 9 and t1.a > 1" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "INTERSECT", + "having_condition": "c < 800 and t1.a > 1 and c > 400", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.a > 3 and t1.b > 12" + } + } + } + } + }, + { + "query_block": { + "select_id": 4, + "operation": "UNION", + "having_condition": "c > 300 and c > 400", + "filesort": { + "sort_key": "t1.a, t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 18, + "filtered": 100, + "attached_condition": "t1.b > 10 and t1.a > 1 and t1.b > 12" + } + } + } + } + } + ] + } + } + } + } + } +} +drop view v1; +create table t3 (a int, b int, c int); +insert into t3 values +(1,21,345), (2,33,7), (8,33,114), (3,21,500), (1,19,107), (5,14,787), +(4,33,123), (9,10,211), (11,16,207), (10,33,988), (5,27,132), (12,21,104), +(6,20,309), (16,20,315), (16,21,101), (18,33,404), (19,10,800), (10,21,123), +(17,11,708), (6,20,214); +create index i1 on t3(a); +# conjunctive subformulas : pushing into WHERE +# pushed condition gives range access +create view v1 as +select a, b, max(c) as max_c from t3 +where a>0 group by a; +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.b=t2.b) and (v1.a<5); +a b max_c a b c +4 33 123 5 33 207 +2 33 7 5 33 207 +4 33 123 8 33 117 +2 33 7 8 33 117 +3 21 500 3 21 231 +1 21 345 3 21 231 +select * from v1,t2 where (v1.b=t2.b) and (v1.a<5); +a b max_c a b c +1 21 345 3 21 231 +2 33 7 5 33 207 +2 33 7 8 33 117 +3 21 500 3 21 231 +4 33 123 5 33 207 +4 33 123 8 33 117 +explain select * from v1,t2 where (v1.b=t2.b) and (v1.a<5); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +2 DERIVED t3 range i1 i1 5 NULL 5 Using index condition +explain format=json select * from v1,t2 where (v1.b=t2.b) and (v1.a<5); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 5, + "filtered": 80, + "attached_condition": "v1.a < 5" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "v1.b = t2.b", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t3", + "access_type": "range", + "possible_keys": ["i1"], + "key": "i1", + "key_length": "5", + "used_key_parts": ["a"], + "rows": 5, + "filtered": 100, + "index_condition": "t3.a > 0 and t3.a < 5" + } + } + } + } + } +} +drop view v1; +# using union in view definition +# conjunctive subformulas : pushing into WHERE +# pushed condition gives range access +create view v1 as +select a, b, max(c) as c from t3 +where t3.a>1 group by a +union +select a, b, max(c) as c from t3 +where t3.a>2 group by a; +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.b=t2.b) and (v1.a<4); +a b c a b c +2 33 7 5 33 207 +2 33 7 8 33 117 +3 21 500 3 21 231 +select * from v1,t2 where (v1.b=t2.b) and (v1.a<4); +a b c a b c +2 33 7 5 33 207 +2 33 7 8 33 117 +3 21 500 3 21 231 +explain select * from v1,t2 where (v1.b=t2.b) and (v1.a<4); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 Using where +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where; Using join buffer (flat, BNL join) +2 DERIVED t3 range i1 i1 5 NULL 2 Using index condition +3 UNION t3 range i1 i1 5 NULL 1 Using index condition +NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.b=t2.b) and (v1.a<4); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "v1.a < 4", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<union2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t3", + "access_type": "range", + "possible_keys": ["i1"], + "key": "i1", + "key_length": "5", + "used_key_parts": ["a"], + "rows": 2, + "filtered": 100, + "index_condition": "t3.a > 1 and t3.a < 4" + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "UNION", + "table": { + "table_name": "t3", + "access_type": "range", + "possible_keys": ["i1"], + "key": "i1", + "key_length": "5", + "used_key_parts": ["a"], + "rows": 1, + "filtered": 100, + "index_condition": "t3.a > 2 and t3.a < 4" + } + } + } + ] + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "t2.b = v1.b" + } + } +} +drop view v1; +# using union in view definition +# conjunctive subformulas : pushing into WHERE +# pushed condition gives range access in one of the selects +create view v1 as +select a, b, max(c) as c from t3 +where t3.a>1 group by a +union +select a, b, max(c) as c from t3 +where t3.b<21 group by b; +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.b=t2.b) and (v1.a<3); +a b c a b c +2 33 7 5 33 207 +1 19 107 1 19 132 +2 33 7 8 33 117 +select * from v1,t2 where (v1.b=t2.b) and (v1.a<3); +a b c a b c +2 33 7 5 33 207 +1 19 107 1 19 132 +2 33 7 8 33 117 +explain select * from v1,t2 where (v1.b=t2.b) and (v1.a<3); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t2.b 2 Using where +2 DERIVED t3 range i1 i1 5 NULL 1 Using index condition +3 UNION t3 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort +NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +explain format=json select * from v1,t2 where (v1.b=t2.b) and (v1.a<3); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.b is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["b"], + "ref": ["test.t2.b"], + "rows": 2, + "filtered": 100, + "attached_condition": "v1.a < 3", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<union2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t3", + "access_type": "range", + "possible_keys": ["i1"], + "key": "i1", + "key_length": "5", + "used_key_parts": ["a"], + "rows": 1, + "filtered": 100, + "index_condition": "t3.a > 1 and t3.a < 3" + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "UNION", + "having_condition": "t3.a < 3", + "filesort": { + "sort_key": "t3.b", + "temporary_table": { + "table": { + "table_name": "t3", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t3.b < 21" + } + } + } + } + } + ] + } + } + } + } + } +} +drop view v1; +alter table t3 drop index i1; +drop table t1,t2,t3; +# +# MDEV-10855: Pushdown into derived with window functions +# +set @save_optimizer_switch= @@optimizer_switch; +set optimizer_switch='split_materialized=off'; +create table t1 (a int, c varchar(16)); +insert into t1 values +(8,'aa'), (5,'cc'), (1,'bb'), (2,'aa'), (9,'cc'), +(7,'aa'), (2,'aa'), (7,'bb'); +create table t2 (a int, b int, c varchar(16), index idx(a,c)); +insert into t2 values +(7,10,'cc'), (1,20,'aa'), (2,23,'bb'), (7,18,'cc'), (1,30,'bb'), +(4,71,'xx'), (3,15,'aa'), (7,82,'bb'), (8,12,'dd'), (4,15,'aa'), +(11,33,'yy'), (10,42,'zz'), (4,53,'xx'), (10,17,'yy'), (7,12,'bb'), +(8,20,'dd'), (7,32,'bb'), (1,50,'aa'), (3,40,'bb'), (3,77,'aa'); +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from (select a, c, sum(b) over (partition by a,c) from t2) as t +where t.a > 2 and t.c in ('aa','bb','cc'); +a c sum(b) over (partition by a,c) +3 aa 92 +3 aa 92 +3 bb 40 +4 aa 15 +7 bb 126 +7 bb 126 +7 bb 126 +7 cc 28 +7 cc 28 +select * from (select a, c, sum(b) over (partition by a,c) from t2) as t +where t.a > 2 and t.c in ('aa','bb','cc'); +a c sum(b) over (partition by a,c) +3 aa 92 +3 aa 92 +3 bb 40 +4 aa 15 +7 bb 126 +7 bb 126 +7 bb 126 +7 cc 28 +7 cc 28 +explain select * from (select a, c, sum(b) over (partition by a,c) from t2) as t +where t.a > 2 and t.c in ('aa','bb','cc'); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 16 Using where +2 DERIVED t2 ALL idx NULL NULL NULL 20 Using where; Using temporary +explain format=json select * from (select a, c, sum(b) over (partition by a,c) from t2) as t +where t.a > 2 and t.c in ('aa','bb','cc'); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 16, + "filtered": 100, + "attached_condition": "t.a > 2 and t.c in ('aa','bb','cc')", + "materialized": { + "query_block": { + "select_id": 2, + "window_functions_computation": { + "sorts": { + "filesort": { + "sort_key": "t2.a, t2.c" + } + }, + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "possible_keys": ["idx"], + "rows": 20, + "filtered": 80, + "attached_condition": "t2.a > 2 and t2.c in ('aa','bb','cc')" + } + } + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from +( +select 1 as n, a, c, sum(b) over (partition by a,c) as s from t2 +union all +select 2 as n, a, c, sum(b) over (partition by a) as s from t2 +) as t +where t.a > 2 and t.c in ('aa','bb','cc'); +n a c s +1 3 aa 92 +1 3 aa 92 +1 3 bb 40 +1 4 aa 15 +1 7 bb 126 +1 7 bb 126 +1 7 bb 126 +1 7 cc 28 +1 7 cc 28 +2 3 aa 132 +2 3 aa 132 +2 3 bb 132 +2 4 aa 139 +2 7 bb 154 +2 7 bb 154 +2 7 bb 154 +2 7 cc 154 +2 7 cc 154 +select * from +( +select 1 as n, a, c, sum(b) over (partition by a,c) as s from t2 +union all +select 2 as n, a, c, sum(b) over (partition by a) as s from t2 +) as t +where t.a > 2 and t.c in ('aa','bb','cc'); +n a c s +1 3 aa 92 +1 3 aa 92 +1 3 bb 40 +1 4 aa 15 +1 7 bb 126 +1 7 bb 126 +1 7 bb 126 +1 7 cc 28 +1 7 cc 28 +2 3 aa 132 +2 3 aa 132 +2 3 bb 132 +2 4 aa 139 +2 7 bb 154 +2 7 bb 154 +2 7 bb 154 +2 7 cc 154 +2 7 cc 154 +explain select * from +( +select 1 as n, a, c, sum(b) over (partition by a,c) as s from t2 +union all +select 2 as n, a, c, sum(b) over (partition by a) as s from t2 +) as t +where t.a > 2 and t.c in ('aa','bb','cc'); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 32 Using where +2 DERIVED t2 ALL idx NULL NULL NULL 20 Using where; Using temporary +3 UNION t2 ALL idx NULL NULL NULL 20 Using where; Using temporary +explain format=json select * from +( +select 1 as n, a, c, sum(b) over (partition by a,c) as s from t2 +union all +select 2 as n, a, c, sum(b) over (partition by a) as s from t2 +) as t +where t.a > 2 and t.c in ('aa','bb','cc'); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 32, + "filtered": 100, + "attached_condition": "t.a > 2 and t.c in ('aa','bb','cc')", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<union2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "window_functions_computation": { + "sorts": { + "filesort": { + "sort_key": "t2.a, t2.c" + } + }, + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "possible_keys": ["idx"], + "rows": 20, + "filtered": 80, + "attached_condition": "t2.a > 2 and t2.c in ('aa','bb','cc')" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "UNION", + "window_functions_computation": { + "sorts": { + "filesort": { + "sort_key": "t2.a" + } + }, + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "possible_keys": ["idx"], + "rows": 20, + "filtered": 80, + "attached_condition": "t2.a > 2" + } + } + } + } + } + ] + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * +from (select a, c, sum(b) over (partition by a,c) as s from t2) as t, t1 +where t1.a=t.a and t1.c=t.c and t1.c in ('aa','bb','cc'); +a c s a c +1 bb 30 1 bb +7 bb 126 7 bb +7 bb 126 7 bb +7 bb 126 7 bb +select * +from (select a, c, sum(b) over (partition by a,c) as s from t2) as t, t1 +where t1.a=t.a and t1.c=t.c and t1.c in ('aa','bb','cc'); +a c s a c +1 bb 30 1 bb +7 bb 126 7 bb +7 bb 126 7 bb +7 bb 126 7 bb +explain select * +from (select a, c, sum(b) over (partition by a,c) as s from t2) as t, t1 +where t1.a=t.a and t1.c=t.c and t1.c in ('aa','bb','cc'); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where +1 PRIMARY <derived2> ref key0 key0 24 test.t1.a,test.t1.c 2 +2 DERIVED t2 ALL NULL NULL NULL NULL 20 Using where; Using temporary +explain format=json select * +from (select a, c, sum(b) over (partition by a,c) as s from t2) as t, t1 +where t1.a=t.a and t1.c=t.c and t1.c in ('aa','bb','cc'); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 8, + "filtered": 100, + "attached_condition": "t1.c in ('aa','bb','cc') and t1.a is not null and t1.c is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "24", + "used_key_parts": ["a", "c"], + "ref": ["test.t1.a", "test.t1.c"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 2, + "window_functions_computation": { + "sorts": { + "filesort": { + "sort_key": "t2.a, t2.c" + } + }, + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t2.c in ('aa','bb','cc')" + } + } + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from +( +select 1 as n, a, c, sum(b) over (partition by a,c) as s from t2 +union all +select 2 as n, a, c, sum(b) over (partition by a) as s from t2 +union all +select 3 as n, a, c, sum(b) as s from t2 group by a +) as t +where t.a > 2 and t.c in ('aa','bb','cc'); +n a c s +1 3 aa 92 +1 3 aa 92 +1 3 bb 40 +1 4 aa 15 +1 7 bb 126 +1 7 bb 126 +1 7 bb 126 +1 7 cc 28 +1 7 cc 28 +2 3 aa 132 +2 3 aa 132 +2 3 bb 132 +2 4 aa 139 +2 7 bb 154 +2 7 bb 154 +2 7 bb 154 +2 7 cc 154 +2 7 cc 154 +3 3 aa 132 +3 7 cc 154 +select * from +( +select 1 as n, a, c, sum(b) over (partition by a,c) as s from t2 +union all +select 2 as n, a, c, sum(b) over (partition by a) as s from t2 +union all +select 3 as n, a, c, sum(b) as s from t2 group by a +) as t +where t.a > 2 and t.c in ('aa','bb','cc'); +n a c s +1 3 aa 92 +1 3 aa 92 +1 3 bb 40 +1 4 aa 15 +1 7 bb 126 +1 7 bb 126 +1 7 bb 126 +1 7 cc 28 +1 7 cc 28 +2 3 aa 132 +2 3 aa 132 +2 3 bb 132 +2 4 aa 139 +2 7 bb 154 +2 7 bb 154 +2 7 bb 154 +2 7 cc 154 +2 7 cc 154 +3 3 aa 132 +3 7 cc 154 +explain select * from +( +select 1 as n, a, c, sum(b) over (partition by a,c) as s from t2 +union all +select 2 as n, a, c, sum(b) over (partition by a) as s from t2 +union all +select 3 as n, a, c, sum(b) as s from t2 group by a +) as t +where t.a > 2 and t.c in ('aa','bb','cc'); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 48 Using where +2 DERIVED t2 ALL idx NULL NULL NULL 20 Using where; Using temporary +3 UNION t2 ALL idx NULL NULL NULL 20 Using where; Using temporary +4 UNION t2 ALL idx NULL NULL NULL 20 Using where; Using temporary; Using filesort +explain format=json select * from +( +select 1 as n, a, c, sum(b) over (partition by a,c) as s from t2 +union all +select 2 as n, a, c, sum(b) over (partition by a) as s from t2 +union all +select 3 as n, a, c, sum(b) as s from t2 group by a +) as t +where t.a > 2 and t.c in ('aa','bb','cc'); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 48, + "filtered": 100, + "attached_condition": "t.a > 2 and t.c in ('aa','bb','cc')", + "materialized": { + "query_block": { + "union_result": { + "table_name": "<union2,3,4>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "window_functions_computation": { + "sorts": { + "filesort": { + "sort_key": "t2.a, t2.c" + } + }, + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "possible_keys": ["idx"], + "rows": 20, + "filtered": 80, + "attached_condition": "t2.a > 2 and t2.c in ('aa','bb','cc')" + } + } + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "UNION", + "window_functions_computation": { + "sorts": { + "filesort": { + "sort_key": "t2.a" + } + }, + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "possible_keys": ["idx"], + "rows": 20, + "filtered": 80, + "attached_condition": "t2.a > 2" + } + } + } + } + }, + { + "query_block": { + "select_id": 4, + "operation": "UNION", + "having_condition": "t2.c in ('aa','bb','cc')", + "filesort": { + "sort_key": "t2.a", + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "possible_keys": ["idx"], + "rows": 20, + "filtered": 80, + "attached_condition": "t2.a > 2" + } + } + } + } + } + ] + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from (select a, c, +sum(b) over (partition by a,c) as sum_b, +avg(b) over (partition by a,c) as avg_b +from t2 ) as t +where t.a > 2 and t.c in ('aa','bb','cc'); +a c sum_b avg_b +3 aa 92 46.0000 +3 aa 92 46.0000 +3 bb 40 40.0000 +4 aa 15 15.0000 +7 bb 126 42.0000 +7 bb 126 42.0000 +7 bb 126 42.0000 +7 cc 28 14.0000 +7 cc 28 14.0000 +select * from (select a, c, +sum(b) over (partition by a,c) as sum_b, +avg(b) over (partition by a,c) as avg_b +from t2 ) as t +where t.a > 2 and t.c in ('aa','bb','cc'); +a c sum_b avg_b +3 aa 92 46.0000 +3 aa 92 46.0000 +3 bb 40 40.0000 +4 aa 15 15.0000 +7 bb 126 42.0000 +7 bb 126 42.0000 +7 bb 126 42.0000 +7 cc 28 14.0000 +7 cc 28 14.0000 +explain select * from (select a, c, +sum(b) over (partition by a,c) as sum_b, +avg(b) over (partition by a,c) as avg_b +from t2 ) as t +where t.a > 2 and t.c in ('aa','bb','cc'); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 16 Using where +2 DERIVED t2 ALL idx NULL NULL NULL 20 Using where; Using temporary +explain format=json select * from (select a, c, +sum(b) over (partition by a,c) as sum_b, +avg(b) over (partition by a,c) as avg_b +from t2 ) as t +where t.a > 2 and t.c in ('aa','bb','cc'); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 16, + "filtered": 100, + "attached_condition": "t.a > 2 and t.c in ('aa','bb','cc')", + "materialized": { + "query_block": { + "select_id": 2, + "window_functions_computation": { + "sorts": { + "filesort": { + "sort_key": "t2.a, t2.c" + } + }, + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "possible_keys": ["idx"], + "rows": 20, + "filtered": 80, + "attached_condition": "t2.a > 2 and t2.c in ('aa','bb','cc')" + } + } + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from (select a, c, +sum(b) over (partition by a,c) as sum_b, +avg(b) over (partition by a) as avg_b +from t2 ) as t +where t.a > 2 and t.c in ('aa','bb','cc'); +a c sum_b avg_b +3 aa 92 44.0000 +3 aa 92 44.0000 +3 bb 40 44.0000 +4 aa 15 46.3333 +7 bb 126 30.8000 +7 bb 126 30.8000 +7 bb 126 30.8000 +7 cc 28 30.8000 +7 cc 28 30.8000 +select * from (select a, c, +sum(b) over (partition by a,c) as sum_b, +avg(b) over (partition by a) as avg_b +from t2 ) as t +where t.a > 2 and t.c in ('aa','bb','cc'); +a c sum_b avg_b +3 aa 92 44.0000 +3 aa 92 44.0000 +3 bb 40 44.0000 +4 aa 15 46.3333 +7 bb 126 30.8000 +7 bb 126 30.8000 +7 bb 126 30.8000 +7 cc 28 30.8000 +7 cc 28 30.8000 +explain select * from (select a, c, +sum(b) over (partition by a,c) as sum_b, +avg(b) over (partition by a) as avg_b +from t2 ) as t +where t.a > 2 and t.c in ('aa','bb','cc'); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 16 Using where +2 DERIVED t2 ALL idx NULL NULL NULL 20 Using where; Using temporary +explain format=json select * from (select a, c, +sum(b) over (partition by a,c) as sum_b, +avg(b) over (partition by a) as avg_b +from t2 ) as t +where t.a > 2 and t.c in ('aa','bb','cc'); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 16, + "filtered": 100, + "attached_condition": "t.a > 2 and t.c in ('aa','bb','cc')", + "materialized": { + "query_block": { + "select_id": 2, + "window_functions_computation": { + "sorts": { + "filesort": { + "sort_key": "t2.a, t2.c" + } + }, + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "possible_keys": ["idx"], + "rows": 20, + "filtered": 80, + "attached_condition": "t2.a > 2" + } + } + } + } + } + } + } +} +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from (select a, c, +sum(b) over (partition by a,c) as sum_b, +avg(b) over (partition by c) as avg_b +from t2 ) as t +where t.a > 2 and t.c in ('aa','bb','cc'); +a c sum_b avg_b +3 aa 92 35.4000 +3 aa 92 35.4000 +3 bb 40 36.5000 +4 aa 15 35.4000 +7 bb 126 36.5000 +7 bb 126 36.5000 +7 bb 126 36.5000 +7 cc 28 14.0000 +7 cc 28 14.0000 +select * from (select a, c, +sum(b) over (partition by a,c) as sum_b, +avg(b) over (partition by c) as avg_b +from t2 ) as t +where t.a > 2 and t.c in ('aa','bb','cc'); +a c sum_b avg_b +3 aa 92 35.4000 +3 aa 92 35.4000 +3 bb 40 36.5000 +4 aa 15 35.4000 +7 bb 126 36.5000 +7 bb 126 36.5000 +7 bb 126 36.5000 +7 cc 28 14.0000 +7 cc 28 14.0000 +explain select * from (select a, c, +sum(b) over (partition by a,c) as sum_b, +avg(b) over (partition by c) as avg_b +from t2 ) as t +where t.a > 2 and t.c in ('aa','bb','cc'); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 20 Using where +2 DERIVED t2 ALL NULL NULL NULL NULL 20 Using where; Using temporary +explain format=json select * from (select a, c, +sum(b) over (partition by a,c) as sum_b, +avg(b) over (partition by c) as avg_b +from t2 ) as t +where t.a > 2 and t.c in ('aa','bb','cc'); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t.a > 2 and t.c in ('aa','bb','cc')", + "materialized": { + "query_block": { + "select_id": 2, + "window_functions_computation": { + "sorts": { + "filesort": { + "sort_key": "t2.a, t2.c" + }, + "filesort": { + "sort_key": "t2.c" + } + }, + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 20, + "filtered": 100, + "attached_condition": "t2.c in ('aa','bb','cc')" + } + } + } + } + } + } + } +} +drop table t1,t2; +set optimizer_switch= @save_optimizer_switch; +# +# MDEV-13369: Optimization for equi-joins of grouping derived tables +# (Splitting derived tables / views with GROUP BY) +# MDEV-13389: Optimization for equi-joins of derived tables with WF +# (Splitting derived tables / views with window functions) +# +create table t1 (a int, b int, index idx_b(b)) engine=myisam; +insert into t1 values +(8,3), (5,7), (1,2), (2,1), (9,7), (7,5), (2,2), (7,3), +(9,3), (8,1), (4,5), (2,3); +create table t2 (a int, b int, c char(127), index idx_a(a)) engine=myisam; +insert into t2 values +(7,10,'x'), (1,20,'a'), (2,23,'b'), (7,18,'z'), (1,30,'c'), +(4,71,'d'), (3,15,'x'), (7,82,'y'), (8,12,'t'), (4,15,'b'), +(11,33,'a'), (10,42,'u'), (4,53,'p'), (10,17,'r'), (2,90,'x'), +(17,10,'s'), (11,20,'v'), (12,23,'y'), (17,18,'a'), (11,30,'d'), +(24,71,'h'), (23,15,'i'), (27,82,'k'), (28,12,'p'), (24,15,'q'), +(31,33,'f'), (30,42,'h'), (40,53,'m'), (30,17,'o'), (21,90,'b'), +(37,10,'e'), (31,20,'g'), (32,23,'f'), (37,18,'n'), (41,30,'l'), +(54,71,'j'), (53,15,'w'), (57,82,'z'), (58,12,'k'), (54,15,'p'), +(61,33,'c'), (60,42,'a'), (62,53,'x'), (67,17,'g'), (64,90,'v'); +insert into t2 select a+10, b+10, concat(c,'f') from t2; +analyze table t1,t2; +Table Op Msg_type Msg_text +test.t1 analyze status OK +test.t2 analyze status OK +set statement optimizer_switch='split_materialized=off' for select t1.a,t.s,t.m +from t1 join +(select a, sum(t2.b) as s, min(t2.c) as m from t2 group by t2.a) t +on t1.a=t.a +where t1.b < 3; +a s m +2 113 b +8 12 t +1 50 a +2 113 b +select t1.a,t.s,t.m +from t1 join +(select a, sum(t2.b) as s, min(t2.c) as m from t2 group by t2.a) t +on t1.a=t.a +where t1.b < 3; +a s m +2 113 b +8 12 t +1 50 a +2 113 b +explain extended select t1.a,t.s,t.m +from t1 join +(select a, sum(t2.b) as s, min(t2.c) as m from t2 group by t2.a) t +on t1.a=t.a +where t1.b < 3; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 range idx_b idx_b 5 NULL 4 100.00 Using index condition; Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 2 100.00 +2 LATERAL DERIVED t2 ref idx_a idx_a 5 test.t1.a 2 100.00 +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`t`.`s` AS `s`,`t`.`m` AS `m` from `test`.`t1` join (/* select#2 */ select `test`.`t2`.`a` AS `a`,sum(`test`.`t2`.`b`) AS `s`,min(`test`.`t2`.`c`) AS `m` from `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` group by `test`.`t2`.`a`) `t` where `t`.`a` = `test`.`t1`.`a` and `test`.`t1`.`b` < 3 +explain format=json select t1.a,t.s,t.m +from t1 join +(select a, sum(t2.b) as s, min(t2.c) as m from t2 group by t2.a) t +on t1.a=t.a +where t1.b < 3; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "range", + "possible_keys": ["idx_b"], + "key": "idx_b", + "key_length": "5", + "used_key_parts": ["b"], + "rows": 4, + "filtered": 100, + "index_condition": "t1.b < 3", + "attached_condition": "t1.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t1.a"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 2, + "outer_ref_condition": "t1.a is not null", + "table": { + "table_name": "t2", + "access_type": "ref", + "possible_keys": ["idx_a"], + "key": "idx_a", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t1.a"], + "rows": 2, + "filtered": 100 + } + } + } + } + } +} +prepare stmt from "select t1.a,t.s,t.m +from t1 join +(select a, sum(t2.b) as s, min(t2.c) as m from t2 group by t2.a) t +on t1.a=t.a +where t1.b < 3"; +execute stmt; +a s m +2 113 b +8 12 t +1 50 a +2 113 b +execute stmt; +a s m +2 113 b +8 12 t +1 50 a +2 113 b +deallocate prepare stmt; +set statement optimizer_switch='split_materialized=off' for select t1.a,t.s,t.m +from t1 join +(select a, sum(t2.b) as s, min(t2.b) as m from t2 group by t2.a) t +on t1.a=t.a +where t1.b <= 5; +a s m +8 12 12 +1 50 20 +2 113 23 +7 110 10 +2 113 23 +7 110 10 +8 12 12 +4 139 15 +2 113 23 +select t1.a,t.s,t.m +from t1 join +(select a, sum(t2.b) as s, min(t2.b) as m from t2 group by t2.a) t +on t1.a=t.a +where t1.b <= 5; +a s m +8 12 12 +1 50 20 +2 113 23 +7 110 10 +2 113 23 +7 110 10 +8 12 12 +4 139 15 +2 113 23 +explain extended select t1.a,t.s,t.m +from t1 join +(select a, sum(t2.b) as s, min(t2.b) as m from t2 group by t2.a) t +on t1.a=t.a +where t1.b <= 5; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ALL idx_b NULL NULL NULL 12 75.00 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 9 100.00 +2 DERIVED t2 ALL idx_a NULL NULL NULL 90 100.00 Using temporary; Using filesort +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`t`.`s` AS `s`,`t`.`m` AS `m` from `test`.`t1` join (/* select#2 */ select `test`.`t2`.`a` AS `a`,sum(`test`.`t2`.`b`) AS `s`,min(`test`.`t2`.`b`) AS `m` from `test`.`t2` group by `test`.`t2`.`a`) `t` where `t`.`a` = `test`.`t1`.`a` and `test`.`t1`.`b` <= 5 +explain format=json select t1.a,t.s,t.m +from t1 join +(select a, sum(t2.b) as s, min(t2.b) as m from t2 group by t2.a) t +on t1.a=t.a +where t1.b <= 5; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "possible_keys": ["idx_b"], + "rows": 12, + "filtered": 75, + "attached_condition": "t1.b <= 5 and t1.a is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t1.a"], + "rows": 9, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 2, + "filesort": { + "sort_key": "t2.a", + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "possible_keys": ["idx_a"], + "rows": 90, + "filtered": 100 + } + } + } + } + } + } + } +} +prepare stmt from "select t1.a,t.s,t.m +from t1 join +(select a, sum(t2.b) as s, min(t2.b) as m from t2 group by t2.a) t +on t1.a=t.a +where t1.b <= 5"; +execute stmt; +a s m +8 12 12 +1 50 20 +2 113 23 +7 110 10 +2 113 23 +7 110 10 +8 12 12 +4 139 15 +2 113 23 +execute stmt; +a s m +8 12 12 +1 50 20 +2 113 23 +7 110 10 +2 113 23 +7 110 10 +8 12 12 +4 139 15 +2 113 23 +deallocate prepare stmt; +delete from t1 where t1.b between 2 and 5; +set statement optimizer_switch='split_materialized=off' for select t1.a,t.max,t.min +from t1 left join +(select a, max(t2.b) max, min(t2.b) min from t2 group by t2.a) t +on t1.a=t.a; +a max min +5 NULL NULL +2 90 23 +9 NULL NULL +8 12 12 +select t1.a,t.max,t.min +from t1 left join +(select a, max(t2.b) max, min(t2.b) min from t2 group by t2.a) t +on t1.a=t.a; +a max min +5 NULL NULL +2 90 23 +9 NULL NULL +8 12 12 +explain extended select t1.a,t.max,t.min +from t1 left join +(select a, max(t2.b) max, min(t2.b) min from t2 group by t2.a) t +on t1.a=t.a; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 4 100.00 +1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 2 100.00 Using where +2 LATERAL DERIVED t2 ref idx_a idx_a 5 test.t1.a 2 100.00 +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`t`.`max` AS `max`,`t`.`min` AS `min` from `test`.`t1` left join (/* select#2 */ select `test`.`t2`.`a` AS `a`,max(`test`.`t2`.`b`) AS `max`,min(`test`.`t2`.`b`) AS `min` from `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` group by `test`.`t2`.`a`) `t` on(`t`.`a` = `test`.`t1`.`a` and `test`.`t1`.`a` is not null) where 1 +explain format=json select t1.a,t.max,t.min +from t1 left join +(select a, max(t2.b) max, min(t2.b) min from t2 group by t2.a) t +on t1.a=t.a; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "const_condition": "1", + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 4, + "filtered": 100 + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t1.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "trigcond(trigcond(t1.a is not null))", + "materialized": { + "query_block": { + "select_id": 2, + "outer_ref_condition": "t1.a is not null", + "table": { + "table_name": "t2", + "access_type": "ref", + "possible_keys": ["idx_a"], + "key": "idx_a", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t1.a"], + "rows": 2, + "filtered": 100 + } + } + } + } + } +} +create table t3 (a int, b int, c char(127), index idx_b(b)) engine=myisam; +insert into t3 values +(8,11,'aa'), (5,15,'cc'), (1,14,'bb'), (2,12,'aa'), (7,17,'cc'), +(7,18,'aa'), (2,11,'aa'), (7,10,'bb'), (3,11,'dd'), (4,12,'ee'), +(5,14,'dd'), (9,12,'ee'); +create table t4 (a int, b int, c char(127), index idx(a,c)) engine=myisam; +insert into t4 values +(7,10,'cc'), (1,20,'aa'), (2,23,'bb'), (7,18,'cc'), (1,30,'bb'), +(4,71,'xx'), (3,15,'aa'), (7,82,'aa'), (8,12,'dd'), (4,15,'aa'), +(11,33,'yy'), (10,42,'zz'), (4,53,'xx'), (10,17,'yy'), (7,12,'cc'), +(8,20,'dd'), (7,32,'bb'), (1,50,'aa'), (3,40,'bb'), (3,77,'aa'); +insert into t4 select a+10, b+10, concat(c,'f') from t4; +analyze table t3,t4; +Table Op Msg_type Msg_text +test.t3 analyze status OK +test.t4 analyze status OK +set statement optimizer_switch='split_materialized=off' for select t3.a,t3.c,t.max,t.min +from t3 join +(select a, c, max(b) max, min(b) min from t4 group by a,c) t +on t3.a=t.a and t3.c=t.c +where t3.b > 15; +a c max min +7 cc 18 10 +7 aa 82 82 +select t3.a,t3.c,t.max,t.min +from t3 join +(select a, c, max(b) max, min(b) min from t4 group by a,c) t +on t3.a=t.a and t3.c=t.c +where t3.b > 15; +a c max min +7 cc 18 10 +7 aa 82 82 +explain extended select t3.a,t3.c,t.max,t.min +from t3 join +(select a, c, max(b) max, min(b) min from t4 group by a,c) t +on t3.a=t.a and t3.c=t.c +where t3.b > 15; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 range idx_b idx_b 5 NULL 3 100.00 Using index condition; Using where +1 PRIMARY <derived2> ref key0 key0 133 test.t3.a,test.t3.c 2 100.00 +2 LATERAL DERIVED t4 ref idx idx 133 test.t3.a,test.t3.c 1 100.00 +Warnings: +Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c`,`t`.`max` AS `max`,`t`.`min` AS `min` from `test`.`t3` join (/* select#2 */ select `test`.`t4`.`a` AS `a`,`test`.`t4`.`c` AS `c`,max(`test`.`t4`.`b`) AS `max`,min(`test`.`t4`.`b`) AS `min` from `test`.`t4` where `test`.`t4`.`a` = `test`.`t3`.`a` and `test`.`t4`.`c` = `test`.`t3`.`c` group by `test`.`t4`.`a`,`test`.`t4`.`c`) `t` where `t`.`a` = `test`.`t3`.`a` and `t`.`c` = `test`.`t3`.`c` and `test`.`t3`.`b` > 15 +explain format=json select t3.a,t3.c,t.max,t.min +from t3 join +(select a, c, max(b) max, min(b) min from t4 group by a,c) t +on t3.a=t.a and t3.c=t.c +where t3.b > 15; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t3", + "access_type": "range", + "possible_keys": ["idx_b"], + "key": "idx_b", + "key_length": "5", + "used_key_parts": ["b"], + "rows": 3, + "filtered": 100, + "index_condition": "t3.b > 15", + "attached_condition": "t3.a is not null and t3.c is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "133", + "used_key_parts": ["a", "c"], + "ref": ["test.t3.a", "test.t3.c"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 2, + "outer_ref_condition": "t3.a is not null and t3.c is not null", + "table": { + "table_name": "t4", + "access_type": "ref", + "possible_keys": ["idx"], + "key": "idx", + "key_length": "133", + "used_key_parts": ["a", "c"], + "ref": ["test.t3.a", "test.t3.c"], + "rows": 1, + "filtered": 100 + } + } + } + } + } +} +set statement optimizer_switch='split_materialized=off' for select t3.a,t3.c,t.max,t.min +from t3 join +(select a, c, max(b) max, min(b) min from t4 group by a,c) t +on t3.a=t.a and t3.c=t.c +where t3.b <= 15; +a c max min +1 bb 30 30 +7 bb 32 32 +select t3.a,t3.c,t.max,t.min +from t3 join +(select a, c, max(b) max, min(b) min from t4 group by a,c) t +on t3.a=t.a and t3.c=t.c +where t3.b <= 15; +a c max min +1 bb 30 30 +7 bb 32 32 +explain extended select t3.a,t3.c,t.max,t.min +from t3 join +(select a, c, max(b) max, min(b) min from t4 group by a,c) t +on t3.a=t.a and t3.c=t.c +where t3.b <= 15; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 ALL idx_b NULL NULL NULL 12 75.00 Using where +1 PRIMARY <derived2> ref key0 key0 133 test.t3.a,test.t3.c 4 100.00 +2 DERIVED t4 ALL idx NULL NULL NULL 40 100.00 Using temporary; Using filesort +Warnings: +Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c`,`t`.`max` AS `max`,`t`.`min` AS `min` from `test`.`t3` join (/* select#2 */ select `test`.`t4`.`a` AS `a`,`test`.`t4`.`c` AS `c`,max(`test`.`t4`.`b`) AS `max`,min(`test`.`t4`.`b`) AS `min` from `test`.`t4` group by `test`.`t4`.`a`,`test`.`t4`.`c`) `t` where `t`.`a` = `test`.`t3`.`a` and `t`.`c` = `test`.`t3`.`c` and `test`.`t3`.`b` <= 15 +explain format=json select t3.a,t3.c,t.max,t.min +from t3 join +(select a, c, max(b) max, min(b) min from t4 group by a,c) t +on t3.a=t.a and t3.c=t.c +where t3.b <= 15; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t3", + "access_type": "ALL", + "possible_keys": ["idx_b"], + "rows": 12, + "filtered": 75, + "attached_condition": "t3.b <= 15 and t3.a is not null and t3.c is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "133", + "used_key_parts": ["a", "c"], + "ref": ["test.t3.a", "test.t3.c"], + "rows": 4, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 2, + "filesort": { + "sort_key": "t4.a, t4.c", + "temporary_table": { + "table": { + "table_name": "t4", + "access_type": "ALL", + "possible_keys": ["idx"], + "rows": 40, + "filtered": 100 + } + } + } + } + } + } + } +} +set statement optimizer_switch='split_materialized=off' for select t3.a,t3.c,t.max,t.min +from t3 join +(select a, c, max(b) max, min(b) min from t4 group by c,a) t +on t3.a=t.a and t3.c=t.c +where t3.b > 15; +a c max min +7 cc 18 10 +7 aa 82 82 +select t3.a,t3.c,t.max,t.min +from t3 join +(select a, c, max(b) max, min(b) min from t4 group by c,a) t +on t3.a=t.a and t3.c=t.c +where t3.b > 15; +a c max min +7 cc 18 10 +7 aa 82 82 +explain extended select t3.a,t3.c,t.max,t.min +from t3 join +(select a, c, max(b) max, min(b) min from t4 group by c,a) t +on t3.a=t.a and t3.c=t.c +where t3.b > 15; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 range idx_b idx_b 5 NULL 3 100.00 Using index condition; Using where +1 PRIMARY <derived2> ref key0 key0 133 test.t3.a,test.t3.c 2 100.00 +2 LATERAL DERIVED t4 ref idx idx 133 test.t3.a,test.t3.c 1 100.00 +Warnings: +Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c`,`t`.`max` AS `max`,`t`.`min` AS `min` from `test`.`t3` join (/* select#2 */ select `test`.`t4`.`a` AS `a`,`test`.`t4`.`c` AS `c`,max(`test`.`t4`.`b`) AS `max`,min(`test`.`t4`.`b`) AS `min` from `test`.`t4` where `test`.`t4`.`a` = `test`.`t3`.`a` and `test`.`t4`.`c` = `test`.`t3`.`c` group by `test`.`t4`.`c`,`test`.`t4`.`a`) `t` where `t`.`a` = `test`.`t3`.`a` and `t`.`c` = `test`.`t3`.`c` and `test`.`t3`.`b` > 15 +explain format=json select t3.a,t3.c,t.max,t.min +from t3 join +(select a, c, max(b) max, min(b) min from t4 group by c,a) t +on t3.a=t.a and t3.c=t.c +where t3.b > 15; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t3", + "access_type": "range", + "possible_keys": ["idx_b"], + "key": "idx_b", + "key_length": "5", + "used_key_parts": ["b"], + "rows": 3, + "filtered": 100, + "index_condition": "t3.b > 15", + "attached_condition": "t3.a is not null and t3.c is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "133", + "used_key_parts": ["a", "c"], + "ref": ["test.t3.a", "test.t3.c"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 2, + "outer_ref_condition": "t3.a is not null and t3.c is not null", + "table": { + "table_name": "t4", + "access_type": "ref", + "possible_keys": ["idx"], + "key": "idx", + "key_length": "133", + "used_key_parts": ["a", "c"], + "ref": ["test.t3.a", "test.t3.c"], + "rows": 1, + "filtered": 100 + } + } + } + } + } +} +set statement optimizer_switch='split_materialized=off' for select t3.a,t3.c,t.max,t.min +from t3 join +(select a, c, max(b) max, min(b) min from t4 group by c,a) t +on t3.a=t.a and t3.c=t.c +where t3.b <= 15; +a c max min +1 bb 30 30 +7 bb 32 32 +select t3.a,t3.c,t.max,t.min +from t3 join +(select a, c, max(b) max, min(b) min from t4 group by c,a) t +on t3.a=t.a and t3.c=t.c +where t3.b <= 15; +a c max min +1 bb 30 30 +7 bb 32 32 +explain extended select t3.a,t3.c,t.max,t.min +from t3 join +(select a, c, max(b) max, min(b) min from t4 group by c,a) t +on t3.a=t.a and t3.c=t.c +where t3.b <= 15; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 ALL idx_b NULL NULL NULL 12 75.00 Using where +1 PRIMARY <derived2> ref key0 key0 133 test.t3.a,test.t3.c 4 100.00 +2 DERIVED t4 ALL idx NULL NULL NULL 40 100.00 Using temporary; Using filesort +Warnings: +Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`c` AS `c`,`t`.`max` AS `max`,`t`.`min` AS `min` from `test`.`t3` join (/* select#2 */ select `test`.`t4`.`a` AS `a`,`test`.`t4`.`c` AS `c`,max(`test`.`t4`.`b`) AS `max`,min(`test`.`t4`.`b`) AS `min` from `test`.`t4` group by `test`.`t4`.`c`,`test`.`t4`.`a`) `t` where `t`.`a` = `test`.`t3`.`a` and `t`.`c` = `test`.`t3`.`c` and `test`.`t3`.`b` <= 15 +explain format=json select t3.a,t3.c,t.max,t.min +from t3 join +(select a, c, max(b) max, min(b) min from t4 group by c,a) t +on t3.a=t.a and t3.c=t.c +where t3.b <= 15; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t3", + "access_type": "ALL", + "possible_keys": ["idx_b"], + "rows": 12, + "filtered": 75, + "attached_condition": "t3.b <= 15 and t3.a is not null and t3.c is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "133", + "used_key_parts": ["a", "c"], + "ref": ["test.t3.a", "test.t3.c"], + "rows": 4, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 2, + "filesort": { + "sort_key": "t4.c, t4.a", + "temporary_table": { + "table": { + "table_name": "t4", + "access_type": "ALL", + "possible_keys": ["idx"], + "rows": 40, + "filtered": 100 + } + } + } + } + } + } + } +} +drop index idx_a on t2; +create index idx on t2(c,b); +create index idx_a on t3(a); +create index idx_c on t4(c); +insert into t3 select a+10, b+10, concat(c,'f') from t3; +insert into t3 select a+100, b+100, concat(c,'g') from t3; +insert into t4 select a+100, b+100, concat(c,'g') from t4; +insert into t4 select a+1000, b+1000, concat(c,'h') from t4; +analyze table t2,t3,t4; +Table Op Msg_type Msg_text +test.t2 analyze status OK +test.t3 analyze status OK +test.t4 analyze status OK +set statement optimizer_switch='split_materialized=off' for select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min +from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t +where t2.b between 80 and 85 and t2.c in ('y','z') and t2.a=t3.a and t3.c=t.c; +a b c t_c max min +7 82 y aa 82 15 +7 82 y bb 40 23 +7 82 y cc 18 10 +select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min +from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t +where t2.b between 80 and 85 and t2.c in ('y','z') and t2.a=t3.a and t3.c=t.c; +a b c t_c max min +7 82 y aa 82 15 +7 82 y bb 40 23 +7 82 y cc 18 10 +explain extended select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min +from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t +where t2.b between 80 and 85 and t2.c in ('y','z') and t2.a=t3.a and t3.c=t.c; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 range idx idx 133 NULL 2 100.00 Using index condition; Using where +1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 2 100.00 Using where +1 PRIMARY <derived2> ref key0 key0 128 test.t3.c 2 100.00 +2 LATERAL DERIVED t4 ref idx_c idx_c 128 test.t3.c 3 100.00 +Warnings: +Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`t`.`c` AS `t_c`,`t`.`max` AS `max`,`t`.`min` AS `min` from `test`.`t2` join `test`.`t3` join (/* select#2 */ select `test`.`t4`.`c` AS `c`,max(`test`.`t4`.`b`) AS `max`,min(`test`.`t4`.`b`) AS `min` from `test`.`t4` where `test`.`t4`.`c` = `test`.`t3`.`c` group by `test`.`t4`.`c`) `t` where `test`.`t3`.`a` = `test`.`t2`.`a` and `t`.`c` = `test`.`t3`.`c` and `test`.`t2`.`b` between 80 and 85 and `test`.`t2`.`c` in ('y','z') +explain format=json select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min +from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t +where t2.b between 80 and 85 and t2.c in ('y','z') and t2.a=t3.a and t3.c=t.c; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "range", + "possible_keys": ["idx"], + "key": "idx", + "key_length": "133", + "used_key_parts": ["c", "b"], + "rows": 2, + "filtered": 100, + "index_condition": "t2.b between 80 and 85 and t2.c in ('y','z')", + "attached_condition": "t2.a is not null" + }, + "table": { + "table_name": "t3", + "access_type": "ref", + "possible_keys": ["idx_a"], + "key": "idx_a", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "t3.c is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "128", + "used_key_parts": ["c"], + "ref": ["test.t3.c"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 2, + "outer_ref_condition": "t3.c is not null", + "table": { + "table_name": "t4", + "access_type": "ref", + "possible_keys": ["idx_c"], + "key": "idx_c", + "key_length": "128", + "used_key_parts": ["c"], + "ref": ["test.t3.c"], + "rows": 3, + "filtered": 100 + } + } + } + } + } +} +set statement optimizer_switch='split_materialized=off' for select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min +from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t +where t2.b < 40 and t2.a=t3.a and t3.c=t.c; +a b c t_c max min +7 10 x cc 18 10 +7 10 x aa 82 15 +7 10 x bb 40 23 +1 20 a bb 40 23 +2 23 b aa 82 15 +2 23 b aa 82 15 +7 18 z cc 18 10 +7 18 z aa 82 15 +7 18 z bb 40 23 +1 30 c bb 40 23 +3 15 x dd 20 12 +8 12 t aa 82 15 +11 33 a bbf 50 33 +17 10 s ccf 28 20 +17 10 s aaf 92 25 +17 10 s bbf 50 33 +11 20 v bbf 50 33 +12 23 y aaf 92 25 +12 23 y aaf 92 25 +17 18 a ccf 28 20 +17 18 a aaf 92 25 +17 18 a bbf 50 33 +11 30 d bbf 50 33 +17 20 xf ccf 28 20 +17 20 xf aaf 92 25 +17 20 xf bbf 50 33 +11 30 af bbf 50 33 +12 33 bf aaf 92 25 +12 33 bf aaf 92 25 +17 28 zf ccf 28 20 +17 28 zf aaf 92 25 +17 28 zf bbf 50 33 +13 25 xf ddf 30 22 +18 22 tf aaf 92 25 +select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min +from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t +where t2.b < 40 and t2.a=t3.a and t3.c=t.c; +a b c t_c max min +7 10 x cc 18 10 +7 10 x aa 82 15 +7 10 x bb 40 23 +1 20 a bb 40 23 +2 23 b aa 82 15 +2 23 b aa 82 15 +7 18 z cc 18 10 +7 18 z aa 82 15 +7 18 z bb 40 23 +1 30 c bb 40 23 +3 15 x dd 20 12 +8 12 t aa 82 15 +11 33 a bbf 50 33 +17 10 s ccf 28 20 +17 10 s aaf 92 25 +17 10 s bbf 50 33 +11 20 v bbf 50 33 +12 23 y aaf 92 25 +12 23 y aaf 92 25 +17 18 a ccf 28 20 +17 18 a aaf 92 25 +17 18 a bbf 50 33 +11 30 d bbf 50 33 +17 20 xf ccf 28 20 +17 20 xf aaf 92 25 +17 20 xf bbf 50 33 +11 30 af bbf 50 33 +12 33 bf aaf 92 25 +12 33 bf aaf 92 25 +17 28 zf ccf 28 20 +17 28 zf aaf 92 25 +17 28 zf bbf 50 33 +13 25 xf ddf 30 22 +18 22 tf aaf 92 25 +explain extended select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min +from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t +where t2.b < 40 and t2.a=t3.a and t3.c=t.c; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 90 100.00 Using where +1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 2 100.00 Using where +1 PRIMARY <derived2> ref key0 key0 128 test.t3.c 10 100.00 +2 DERIVED t4 ALL idx_c NULL NULL NULL 160 100.00 Using temporary; Using filesort +Warnings: +Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`t`.`c` AS `t_c`,`t`.`max` AS `max`,`t`.`min` AS `min` from `test`.`t2` join `test`.`t3` join (/* select#2 */ select `test`.`t4`.`c` AS `c`,max(`test`.`t4`.`b`) AS `max`,min(`test`.`t4`.`b`) AS `min` from `test`.`t4` group by `test`.`t4`.`c`) `t` where `test`.`t3`.`a` = `test`.`t2`.`a` and `t`.`c` = `test`.`t3`.`c` and `test`.`t2`.`b` < 40 +explain format=json select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min +from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t +where t2.b < 40 and t2.a=t3.a and t3.c=t.c; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 90, + "filtered": 100, + "attached_condition": "t2.b < 40 and t2.a is not null" + }, + "table": { + "table_name": "t3", + "access_type": "ref", + "possible_keys": ["idx_a"], + "key": "idx_a", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "t3.c is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "128", + "used_key_parts": ["c"], + "ref": ["test.t3.c"], + "rows": 10, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 2, + "filesort": { + "sort_key": "t4.c", + "temporary_table": { + "table": { + "table_name": "t4", + "access_type": "ALL", + "possible_keys": ["idx_c"], + "rows": 160, + "filtered": 100 + } + } + } + } + } + } + } +} +set statement optimizer_switch='split_materialized=off' for select * +from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t +where t2.b between 80 and 85 and t2.c in ('y','z') and t2.a=t3.a and t3.c=t.c; +a b c a b c c b sum(b) over (partition by c) +7 82 y 7 10 bb bb 23 125 +7 82 y 7 10 bb bb 30 125 +7 82 y 7 10 bb bb 32 125 +7 82 y 7 10 bb bb 40 125 +7 82 y 7 17 cc cc 10 40 +7 82 y 7 17 cc cc 12 40 +7 82 y 7 17 cc cc 18 40 +7 82 y 7 18 aa aa 15 259 +7 82 y 7 18 aa aa 15 259 +7 82 y 7 18 aa aa 20 259 +7 82 y 7 18 aa aa 50 259 +7 82 y 7 18 aa aa 77 259 +7 82 y 7 18 aa aa 82 259 +select * +from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t +where t2.b between 80 and 85 and t2.c in ('y','z') and t2.a=t3.a and t3.c=t.c; +a b c a b c c b sum(b) over (partition by c) +7 82 y 7 10 bb bb 23 125 +7 82 y 7 10 bb bb 30 125 +7 82 y 7 10 bb bb 32 125 +7 82 y 7 10 bb bb 40 125 +7 82 y 7 17 cc cc 10 40 +7 82 y 7 17 cc cc 12 40 +7 82 y 7 17 cc cc 18 40 +7 82 y 7 18 aa aa 15 259 +7 82 y 7 18 aa aa 15 259 +7 82 y 7 18 aa aa 20 259 +7 82 y 7 18 aa aa 50 259 +7 82 y 7 18 aa aa 77 259 +7 82 y 7 18 aa aa 82 259 +explain extended select * +from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t +where t2.b between 80 and 85 and t2.c in ('y','z') and t2.a=t3.a and t3.c=t.c; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 range idx idx 133 NULL 2 100.00 Using index condition; Using where +1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 2 100.00 Using where +1 PRIMARY <derived2> ref key0 key0 128 test.t3.c 2 100.00 +2 LATERAL DERIVED t4 ref idx_c idx_c 128 test.t3.c 3 100.00 Using temporary +Warnings: +Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`t`.`c` AS `c`,`t`.`b` AS `b`,`t`.`sum(b) over (partition by c)` AS `sum(b) over (partition by c)` from `test`.`t2` join `test`.`t3` join (/* select#2 */ select `test`.`t4`.`c` AS `c`,`test`.`t4`.`b` AS `b`,sum(`test`.`t4`.`b`) over ( partition by `test`.`t4`.`c`) AS `sum(b) over (partition by c)` from `test`.`t4` where `test`.`t4`.`c` = `test`.`t3`.`c`) `t` where `test`.`t3`.`a` = `test`.`t2`.`a` and `t`.`c` = `test`.`t3`.`c` and `test`.`t2`.`b` between 80 and 85 and `test`.`t2`.`c` in ('y','z') +explain format=json select * +from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t +where t2.b between 80 and 85 and t2.c in ('y','z') and t2.a=t3.a and t3.c=t.c; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "range", + "possible_keys": ["idx"], + "key": "idx", + "key_length": "133", + "used_key_parts": ["c", "b"], + "rows": 2, + "filtered": 100, + "index_condition": "t2.b between 80 and 85 and t2.c in ('y','z')", + "attached_condition": "t2.a is not null" + }, + "table": { + "table_name": "t3", + "access_type": "ref", + "possible_keys": ["idx_a"], + "key": "idx_a", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "t3.c is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "128", + "used_key_parts": ["c"], + "ref": ["test.t3.c"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 2, + "outer_ref_condition": "t3.c is not null", + "window_functions_computation": { + "sorts": { + "filesort": { + "sort_key": "t4.c" + } + }, + "temporary_table": { + "table": { + "table_name": "t4", + "access_type": "ref", + "possible_keys": ["idx_c"], + "key": "idx_c", + "key_length": "128", + "used_key_parts": ["c"], + "ref": ["test.t3.c"], + "rows": 3, + "filtered": 100 + } + } + } + } + } + } + } +} +set statement optimizer_switch='split_materialized=off' for select * +from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t +where t2.b < 40 and t2.a=t3.a and t3.c=t.c; +a b c a b c c b sum(b) over (partition by c) +1 20 a 1 14 bb bb 23 125 +1 20 a 1 14 bb bb 30 125 +1 20 a 1 14 bb bb 32 125 +1 20 a 1 14 bb bb 40 125 +1 30 c 1 14 bb bb 23 125 +1 30 c 1 14 bb bb 30 125 +1 30 c 1 14 bb bb 32 125 +1 30 c 1 14 bb bb 40 125 +11 20 v 11 24 bbf bbf 33 165 +11 20 v 11 24 bbf bbf 40 165 +11 20 v 11 24 bbf bbf 42 165 +11 20 v 11 24 bbf bbf 50 165 +11 30 af 11 24 bbf bbf 33 165 +11 30 af 11 24 bbf bbf 40 165 +11 30 af 11 24 bbf bbf 42 165 +11 30 af 11 24 bbf bbf 50 165 +11 30 d 11 24 bbf bbf 33 165 +11 30 d 11 24 bbf bbf 40 165 +11 30 d 11 24 bbf bbf 42 165 +11 30 d 11 24 bbf bbf 50 165 +11 33 a 11 24 bbf bbf 33 165 +11 33 a 11 24 bbf bbf 40 165 +11 33 a 11 24 bbf bbf 42 165 +11 33 a 11 24 bbf bbf 50 165 +12 23 y 12 21 aaf aaf 25 319 +12 23 y 12 21 aaf aaf 25 319 +12 23 y 12 21 aaf aaf 30 319 +12 23 y 12 21 aaf aaf 60 319 +12 23 y 12 21 aaf aaf 87 319 +12 23 y 12 21 aaf aaf 92 319 +12 23 y 12 22 aaf aaf 25 319 +12 23 y 12 22 aaf aaf 25 319 +12 23 y 12 22 aaf aaf 30 319 +12 23 y 12 22 aaf aaf 60 319 +12 23 y 12 22 aaf aaf 87 319 +12 23 y 12 22 aaf aaf 92 319 +12 33 bf 12 21 aaf aaf 25 319 +12 33 bf 12 21 aaf aaf 25 319 +12 33 bf 12 21 aaf aaf 30 319 +12 33 bf 12 21 aaf aaf 60 319 +12 33 bf 12 21 aaf aaf 87 319 +12 33 bf 12 21 aaf aaf 92 319 +12 33 bf 12 22 aaf aaf 25 319 +12 33 bf 12 22 aaf aaf 25 319 +12 33 bf 12 22 aaf aaf 30 319 +12 33 bf 12 22 aaf aaf 60 319 +12 33 bf 12 22 aaf aaf 87 319 +12 33 bf 12 22 aaf aaf 92 319 +13 25 xf 13 21 ddf ddf 22 52 +13 25 xf 13 21 ddf ddf 30 52 +17 10 s 17 20 bbf bbf 33 165 +17 10 s 17 20 bbf bbf 40 165 +17 10 s 17 20 bbf bbf 42 165 +17 10 s 17 20 bbf bbf 50 165 +17 10 s 17 27 ccf ccf 20 70 +17 10 s 17 27 ccf ccf 22 70 +17 10 s 17 27 ccf ccf 28 70 +17 10 s 17 28 aaf aaf 25 319 +17 10 s 17 28 aaf aaf 25 319 +17 10 s 17 28 aaf aaf 30 319 +17 10 s 17 28 aaf aaf 60 319 +17 10 s 17 28 aaf aaf 87 319 +17 10 s 17 28 aaf aaf 92 319 +17 18 a 17 20 bbf bbf 33 165 +17 18 a 17 20 bbf bbf 40 165 +17 18 a 17 20 bbf bbf 42 165 +17 18 a 17 20 bbf bbf 50 165 +17 18 a 17 27 ccf ccf 20 70 +17 18 a 17 27 ccf ccf 22 70 +17 18 a 17 27 ccf ccf 28 70 +17 18 a 17 28 aaf aaf 25 319 +17 18 a 17 28 aaf aaf 25 319 +17 18 a 17 28 aaf aaf 30 319 +17 18 a 17 28 aaf aaf 60 319 +17 18 a 17 28 aaf aaf 87 319 +17 18 a 17 28 aaf aaf 92 319 +17 20 xf 17 20 bbf bbf 33 165 +17 20 xf 17 20 bbf bbf 40 165 +17 20 xf 17 20 bbf bbf 42 165 +17 20 xf 17 20 bbf bbf 50 165 +17 20 xf 17 27 ccf ccf 20 70 +17 20 xf 17 27 ccf ccf 22 70 +17 20 xf 17 27 ccf ccf 28 70 +17 20 xf 17 28 aaf aaf 25 319 +17 20 xf 17 28 aaf aaf 25 319 +17 20 xf 17 28 aaf aaf 30 319 +17 20 xf 17 28 aaf aaf 60 319 +17 20 xf 17 28 aaf aaf 87 319 +17 20 xf 17 28 aaf aaf 92 319 +17 28 zf 17 20 bbf bbf 33 165 +17 28 zf 17 20 bbf bbf 40 165 +17 28 zf 17 20 bbf bbf 42 165 +17 28 zf 17 20 bbf bbf 50 165 +17 28 zf 17 27 ccf ccf 20 70 +17 28 zf 17 27 ccf ccf 22 70 +17 28 zf 17 27 ccf ccf 28 70 +17 28 zf 17 28 aaf aaf 25 319 +17 28 zf 17 28 aaf aaf 25 319 +17 28 zf 17 28 aaf aaf 30 319 +17 28 zf 17 28 aaf aaf 60 319 +17 28 zf 17 28 aaf aaf 87 319 +17 28 zf 17 28 aaf aaf 92 319 +18 22 tf 18 21 aaf aaf 25 319 +18 22 tf 18 21 aaf aaf 25 319 +18 22 tf 18 21 aaf aaf 30 319 +18 22 tf 18 21 aaf aaf 60 319 +18 22 tf 18 21 aaf aaf 87 319 +18 22 tf 18 21 aaf aaf 92 319 +2 23 b 2 11 aa aa 15 259 +2 23 b 2 11 aa aa 15 259 +2 23 b 2 11 aa aa 20 259 +2 23 b 2 11 aa aa 50 259 +2 23 b 2 11 aa aa 77 259 +2 23 b 2 11 aa aa 82 259 +2 23 b 2 12 aa aa 15 259 +2 23 b 2 12 aa aa 15 259 +2 23 b 2 12 aa aa 20 259 +2 23 b 2 12 aa aa 50 259 +2 23 b 2 12 aa aa 77 259 +2 23 b 2 12 aa aa 82 259 +3 15 x 3 11 dd dd 12 32 +3 15 x 3 11 dd dd 20 32 +7 10 x 7 10 bb bb 23 125 +7 10 x 7 10 bb bb 30 125 +7 10 x 7 10 bb bb 32 125 +7 10 x 7 10 bb bb 40 125 +7 10 x 7 17 cc cc 10 40 +7 10 x 7 17 cc cc 12 40 +7 10 x 7 17 cc cc 18 40 +7 10 x 7 18 aa aa 15 259 +7 10 x 7 18 aa aa 15 259 +7 10 x 7 18 aa aa 20 259 +7 10 x 7 18 aa aa 50 259 +7 10 x 7 18 aa aa 77 259 +7 10 x 7 18 aa aa 82 259 +7 18 z 7 10 bb bb 23 125 +7 18 z 7 10 bb bb 30 125 +7 18 z 7 10 bb bb 32 125 +7 18 z 7 10 bb bb 40 125 +7 18 z 7 17 cc cc 10 40 +7 18 z 7 17 cc cc 12 40 +7 18 z 7 17 cc cc 18 40 +7 18 z 7 18 aa aa 15 259 +7 18 z 7 18 aa aa 15 259 +7 18 z 7 18 aa aa 20 259 +7 18 z 7 18 aa aa 50 259 +7 18 z 7 18 aa aa 77 259 +7 18 z 7 18 aa aa 82 259 +8 12 t 8 11 aa aa 15 259 +8 12 t 8 11 aa aa 15 259 +8 12 t 8 11 aa aa 20 259 +8 12 t 8 11 aa aa 50 259 +8 12 t 8 11 aa aa 77 259 +8 12 t 8 11 aa aa 82 259 +select * +from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t +where t2.b < 40 and t2.a=t3.a and t3.c=t.c; +a b c a b c c b sum(b) over (partition by c) +1 20 a 1 14 bb bb 23 125 +1 20 a 1 14 bb bb 30 125 +1 20 a 1 14 bb bb 32 125 +1 20 a 1 14 bb bb 40 125 +1 30 c 1 14 bb bb 23 125 +1 30 c 1 14 bb bb 30 125 +1 30 c 1 14 bb bb 32 125 +1 30 c 1 14 bb bb 40 125 +11 20 v 11 24 bbf bbf 33 165 +11 20 v 11 24 bbf bbf 40 165 +11 20 v 11 24 bbf bbf 42 165 +11 20 v 11 24 bbf bbf 50 165 +11 30 af 11 24 bbf bbf 33 165 +11 30 af 11 24 bbf bbf 40 165 +11 30 af 11 24 bbf bbf 42 165 +11 30 af 11 24 bbf bbf 50 165 +11 30 d 11 24 bbf bbf 33 165 +11 30 d 11 24 bbf bbf 40 165 +11 30 d 11 24 bbf bbf 42 165 +11 30 d 11 24 bbf bbf 50 165 +11 33 a 11 24 bbf bbf 33 165 +11 33 a 11 24 bbf bbf 40 165 +11 33 a 11 24 bbf bbf 42 165 +11 33 a 11 24 bbf bbf 50 165 +12 23 y 12 21 aaf aaf 25 319 +12 23 y 12 21 aaf aaf 25 319 +12 23 y 12 21 aaf aaf 30 319 +12 23 y 12 21 aaf aaf 60 319 +12 23 y 12 21 aaf aaf 87 319 +12 23 y 12 21 aaf aaf 92 319 +12 23 y 12 22 aaf aaf 25 319 +12 23 y 12 22 aaf aaf 25 319 +12 23 y 12 22 aaf aaf 30 319 +12 23 y 12 22 aaf aaf 60 319 +12 23 y 12 22 aaf aaf 87 319 +12 23 y 12 22 aaf aaf 92 319 +12 33 bf 12 21 aaf aaf 25 319 +12 33 bf 12 21 aaf aaf 25 319 +12 33 bf 12 21 aaf aaf 30 319 +12 33 bf 12 21 aaf aaf 60 319 +12 33 bf 12 21 aaf aaf 87 319 +12 33 bf 12 21 aaf aaf 92 319 +12 33 bf 12 22 aaf aaf 25 319 +12 33 bf 12 22 aaf aaf 25 319 +12 33 bf 12 22 aaf aaf 30 319 +12 33 bf 12 22 aaf aaf 60 319 +12 33 bf 12 22 aaf aaf 87 319 +12 33 bf 12 22 aaf aaf 92 319 +13 25 xf 13 21 ddf ddf 22 52 +13 25 xf 13 21 ddf ddf 30 52 +17 10 s 17 20 bbf bbf 33 165 +17 10 s 17 20 bbf bbf 40 165 +17 10 s 17 20 bbf bbf 42 165 +17 10 s 17 20 bbf bbf 50 165 +17 10 s 17 27 ccf ccf 20 70 +17 10 s 17 27 ccf ccf 22 70 +17 10 s 17 27 ccf ccf 28 70 +17 10 s 17 28 aaf aaf 25 319 +17 10 s 17 28 aaf aaf 25 319 +17 10 s 17 28 aaf aaf 30 319 +17 10 s 17 28 aaf aaf 60 319 +17 10 s 17 28 aaf aaf 87 319 +17 10 s 17 28 aaf aaf 92 319 +17 18 a 17 20 bbf bbf 33 165 +17 18 a 17 20 bbf bbf 40 165 +17 18 a 17 20 bbf bbf 42 165 +17 18 a 17 20 bbf bbf 50 165 +17 18 a 17 27 ccf ccf 20 70 +17 18 a 17 27 ccf ccf 22 70 +17 18 a 17 27 ccf ccf 28 70 +17 18 a 17 28 aaf aaf 25 319 +17 18 a 17 28 aaf aaf 25 319 +17 18 a 17 28 aaf aaf 30 319 +17 18 a 17 28 aaf aaf 60 319 +17 18 a 17 28 aaf aaf 87 319 +17 18 a 17 28 aaf aaf 92 319 +17 20 xf 17 20 bbf bbf 33 165 +17 20 xf 17 20 bbf bbf 40 165 +17 20 xf 17 20 bbf bbf 42 165 +17 20 xf 17 20 bbf bbf 50 165 +17 20 xf 17 27 ccf ccf 20 70 +17 20 xf 17 27 ccf ccf 22 70 +17 20 xf 17 27 ccf ccf 28 70 +17 20 xf 17 28 aaf aaf 25 319 +17 20 xf 17 28 aaf aaf 25 319 +17 20 xf 17 28 aaf aaf 30 319 +17 20 xf 17 28 aaf aaf 60 319 +17 20 xf 17 28 aaf aaf 87 319 +17 20 xf 17 28 aaf aaf 92 319 +17 28 zf 17 20 bbf bbf 33 165 +17 28 zf 17 20 bbf bbf 40 165 +17 28 zf 17 20 bbf bbf 42 165 +17 28 zf 17 20 bbf bbf 50 165 +17 28 zf 17 27 ccf ccf 20 70 +17 28 zf 17 27 ccf ccf 22 70 +17 28 zf 17 27 ccf ccf 28 70 +17 28 zf 17 28 aaf aaf 25 319 +17 28 zf 17 28 aaf aaf 25 319 +17 28 zf 17 28 aaf aaf 30 319 +17 28 zf 17 28 aaf aaf 60 319 +17 28 zf 17 28 aaf aaf 87 319 +17 28 zf 17 28 aaf aaf 92 319 +18 22 tf 18 21 aaf aaf 25 319 +18 22 tf 18 21 aaf aaf 25 319 +18 22 tf 18 21 aaf aaf 30 319 +18 22 tf 18 21 aaf aaf 60 319 +18 22 tf 18 21 aaf aaf 87 319 +18 22 tf 18 21 aaf aaf 92 319 +2 23 b 2 11 aa aa 15 259 +2 23 b 2 11 aa aa 15 259 +2 23 b 2 11 aa aa 20 259 +2 23 b 2 11 aa aa 50 259 +2 23 b 2 11 aa aa 77 259 +2 23 b 2 11 aa aa 82 259 +2 23 b 2 12 aa aa 15 259 +2 23 b 2 12 aa aa 15 259 +2 23 b 2 12 aa aa 20 259 +2 23 b 2 12 aa aa 50 259 +2 23 b 2 12 aa aa 77 259 +2 23 b 2 12 aa aa 82 259 +3 15 x 3 11 dd dd 12 32 +3 15 x 3 11 dd dd 20 32 +7 10 x 7 10 bb bb 23 125 +7 10 x 7 10 bb bb 30 125 +7 10 x 7 10 bb bb 32 125 +7 10 x 7 10 bb bb 40 125 +7 10 x 7 17 cc cc 10 40 +7 10 x 7 17 cc cc 12 40 +7 10 x 7 17 cc cc 18 40 +7 10 x 7 18 aa aa 15 259 +7 10 x 7 18 aa aa 15 259 +7 10 x 7 18 aa aa 20 259 +7 10 x 7 18 aa aa 50 259 +7 10 x 7 18 aa aa 77 259 +7 10 x 7 18 aa aa 82 259 +7 18 z 7 10 bb bb 23 125 +7 18 z 7 10 bb bb 30 125 +7 18 z 7 10 bb bb 32 125 +7 18 z 7 10 bb bb 40 125 +7 18 z 7 17 cc cc 10 40 +7 18 z 7 17 cc cc 12 40 +7 18 z 7 17 cc cc 18 40 +7 18 z 7 18 aa aa 15 259 +7 18 z 7 18 aa aa 15 259 +7 18 z 7 18 aa aa 20 259 +7 18 z 7 18 aa aa 50 259 +7 18 z 7 18 aa aa 77 259 +7 18 z 7 18 aa aa 82 259 +8 12 t 8 11 aa aa 15 259 +8 12 t 8 11 aa aa 15 259 +8 12 t 8 11 aa aa 20 259 +8 12 t 8 11 aa aa 50 259 +8 12 t 8 11 aa aa 77 259 +8 12 t 8 11 aa aa 82 259 +explain extended select * +from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t +where t2.b < 40 and t2.a=t3.a and t3.c=t.c; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 90 100.00 Using where +1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 2 100.00 Using where +1 PRIMARY <derived2> ref key0 key0 128 test.t3.c 10 100.00 +2 DERIVED t4 ALL idx_c NULL NULL NULL 160 100.00 Using temporary +Warnings: +Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`t`.`c` AS `c`,`t`.`b` AS `b`,`t`.`sum(b) over (partition by c)` AS `sum(b) over (partition by c)` from `test`.`t2` join `test`.`t3` join (/* select#2 */ select `test`.`t4`.`c` AS `c`,`test`.`t4`.`b` AS `b`,sum(`test`.`t4`.`b`) over ( partition by `test`.`t4`.`c`) AS `sum(b) over (partition by c)` from `test`.`t4`) `t` where `test`.`t3`.`a` = `test`.`t2`.`a` and `t`.`c` = `test`.`t3`.`c` and `test`.`t2`.`b` < 40 +explain format=json select * +from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t +where t2.b < 40 and t2.a=t3.a and t3.c=t.c; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 90, + "filtered": 100, + "attached_condition": "t2.b < 40 and t2.a is not null" + }, + "table": { + "table_name": "t3", + "access_type": "ref", + "possible_keys": ["idx_a"], + "key": "idx_a", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "t3.c is not null" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "128", + "used_key_parts": ["c"], + "ref": ["test.t3.c"], + "rows": 10, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 2, + "window_functions_computation": { + "sorts": { + "filesort": { + "sort_key": "t4.c" + } + }, + "temporary_table": { + "table": { + "table_name": "t4", + "access_type": "ALL", + "possible_keys": ["idx_c"], + "rows": 160, + "filtered": 100 + } + } + } + } + } + } + } +} +drop table t1,t2,t3,t4; +# +# MDEV-13709: Optimization for semi-joins of grouping derived tables +# (Splitting derived tables / views with GROUP BY) +# +CREATE TABLE t1 (i int); +INSERT INTO t1 VALUES (1),(9),(3); +CREATE TABLE t2 (a int, i int); +INSERT INTO t2 VALUES (1,9),(2,3),(3,7),(4,1); +CREATE TABLE t3 (a int, c char(127), index(c)); +INSERT INTO t3 VALUES (1,'foo'),(3,'bar'),(4,'foo'),(2,'bar'); +INSERT INTO t3 SELECT a, concat(c,'a') FROM t3; +CREATE TABLE t4 (a int, c char(127), index(a)); +INSERT INTO t4 VALUES +(3,'abc'),(1,'foo'),(4,'def'),(8,'xxx'),(3,'yyy'), +(5,'zzz'),(9,'xyz'),(2,'yxz'),(5,'zxy'),(7,'zyx') ; +ANALYZE TABLE t1,t2,t3,t4; +Table Op Msg_type Msg_text +test.t1 analyze status OK +test.t2 analyze status OK +test.t3 analyze status OK +test.t4 analyze status OK +CREATE VIEW v1 AS +SELECT c FROM t3 +WHERE a IN ( SELECT t2.a FROM t1 JOIN t2 WHERE t1.i = t2.i ) GROUP BY c ; +set statement optimizer_switch='split_materialized=off' for SELECT * FROM t4 WHERE c IN ( SELECT c FROM v1 ) and a < 2; +a c +1 foo +SELECT * FROM t4 WHERE c IN ( SELECT c FROM v1 ) and a < 2; +a c +1 foo +explain extended SELECT * FROM t4 WHERE c IN ( SELECT c FROM v1 ) and a < 2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t4 range a a 5 NULL 1 100.00 Using index condition; Using where +1 PRIMARY <derived3> ref key0 key0 128 test.t4.c 2 100.00 FirstMatch(t4) +3 LATERAL DERIVED t3 ref c c 128 test.t4.c 2 100.00 +3 LATERAL DERIVED <subquery4> eq_ref distinct_key distinct_key 4 func 1 100.00 +4 MATERIALIZED t1 ALL NULL NULL NULL NULL 3 100.00 +4 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) +Warnings: +Note 1003 /* select#1 */ select `test`.`t4`.`a` AS `a`,`test`.`t4`.`c` AS `c` from `test`.`t4` semi join (`test`.`v1`) where `v1`.`c` = `test`.`t4`.`c` and `test`.`t4`.`a` < 2 +explain format=json SELECT * FROM t4 WHERE c IN ( SELECT c FROM v1 ) and a < 2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t4", + "access_type": "range", + "possible_keys": ["a"], + "key": "a", + "key_length": "5", + "used_key_parts": ["a"], + "rows": 1, + "filtered": 100, + "index_condition": "t4.a < 2", + "attached_condition": "t4.c is not null" + }, + "table": { + "table_name": "<derived3>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "128", + "used_key_parts": ["c"], + "ref": ["test.t4.c"], + "rows": 2, + "filtered": 100, + "first_match": "t4", + "materialized": { + "query_block": { + "select_id": 3, + "const_condition": "1", + "outer_ref_condition": "t4.c is not null", + "table": { + "table_name": "t3", + "access_type": "ref", + "possible_keys": ["c"], + "key": "c", + "key_length": "128", + "used_key_parts": ["c"], + "ref": ["test.t4.c"], + "rows": 2, + "filtered": 100 + }, + "table": { + "table_name": "<subquery4>", + "access_type": "eq_ref", + "possible_keys": ["distinct_key"], + "key": "distinct_key", + "key_length": "4", + "used_key_parts": ["a"], + "ref": ["func"], + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 4, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + }, + "block-nl-join": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 4, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "t2.i = t1.i and t2.i = t1.i" + } + } + } + } + } + } + } + } +} +DROP VIEW v1; +DROP TABLE t1,t2,t3,t4; +# +# MDEV-13710: Optimization for equi-joins of grouping derived tables +# (Splitting derived tables / views with GROUP BY) : +# FROM list of the derived table contains constant tables +# +CREATE TABLE t1 (a int, INDEX(a)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (9),(5),(1); +CREATE TABLE t2 (b int) ENGINE=MyISAM; +CREATE TABLE t3 (c varchar(8), d int) ENGINE=MyISAM; +INSERT INTO t3 VALUES ('foo',2),('bar',6); +CREATE VIEW v1 AS SELECT a FROM t1, t2 GROUP BY a; +SELECT * FROM t3 +WHERE d IN ( SELECT * FROM v1 ) AND c LIKE 'z%' OR c IS NULL; +c d +DROP VIEW v1; +DROP TABLE t1,t2,t3; +# +# MDEV-13734: Optimization for equi-joins of grouping derived tables +# (Splitting derived tables / views with GROUP BY) : +# derived table / view is empty +# +CREATE TABLE t1 (a int, b int, INDEX(a)) ENGINE=MyISAM; +CREATE TABLE t2 (c int) ENGINE=MyISAM; +CREATE VIEW v1 AS SELECT a, b FROM t1 STRAIGHT_JOIN t2; +CREATE VIEW v2 AS SELECT a, max(b) as bmax FROM v1 GROUP BY a; +CREATE VIEW v3 AS SELECT v2.* FROM t1 JOIN v2 ON t1.b = v2.bmax ; +SELECT * FROM v3 JOIN t1 ON (bmax = b); +a bmax a b +DROP VIEW v1,v2,v3; +DROP TABLE t1,t2; +# +# MDEV-14845: Impossible where for derived with GROUP BY +# +CREATE TABLE t1 (pk INT PRIMARY KEY); +INSERT INTO t1 VALUES (1),(2); +WITH cte AS ( SELECT pk FROM t1 WHERE pk IS NULL GROUP BY pk ) +SELECT * FROM cte; +pk +EXPLAIN EXTENDED WITH cte AS ( SELECT pk FROM t1 WHERE pk IS NULL GROUP BY pk ) +SELECT * FROM cte; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> system NULL NULL NULL NULL 0 0.00 Const row not found +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +Warnings: +Note 1003 with cte as (/* select#2 */ select `test`.`t1`.`pk` AS `pk` from `test`.`t1` where 0 group by `test`.`t1`.`pk`)/* select#1 */ select NULL AS `pk` from `cte` +DROP TABLE t1; +# +# MDEV-14880: assertion failure in optimizer when splitting is applied +# +CREATE TABLE t1 (pk1 INT PRIMARY KEY, f INT) ENGINE=Aria; +INSERT INTO t1 VALUES (1,0),(2,0); +CREATE TABLE t2 (pk2 INT PRIMARY KEY) ENGINE=Aria; +INSERT INTO t2 VALUES (1),(2),(3); +CREATE VIEW v2 AS SELECT pk2, COUNT(*) AS cnt FROM t2 GROUP BY pk2; +SELECT * FROM t1 INNER JOIN v2 ON pk1 = pk2 WHERE f <> 5; +pk1 f pk2 cnt +1 0 1 1 +2 0 2 1 +EXPLAIN EXTENDED SELECT * FROM t1 INNER JOIN v2 ON pk1 = pk2 WHERE f <> 5; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 2 100.00 Using where +1 PRIMARY <derived2> ref key0 key0 4 test.t1.pk1 2 100.00 +2 LATERAL DERIVED t2 eq_ref PRIMARY PRIMARY 4 test.t1.pk1 1 100.00 Using index +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`f` AS `f`,`v2`.`pk2` AS `pk2`,`v2`.`cnt` AS `cnt` from `test`.`t1` join `test`.`v2` where `v2`.`pk2` = `test`.`t1`.`pk1` and `test`.`t1`.`f` <> 5 +EXPLAIN FORMAT=JSON SELECT * FROM t1 INNER JOIN v2 ON pk1 = pk2 WHERE f <> 5; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "possible_keys": ["PRIMARY"], + "rows": 2, + "filtered": 100, + "attached_condition": "t1.f <> 5" + }, + "table": { + "table_name": "<derived2>", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "4", + "used_key_parts": ["pk2"], + "ref": ["test.t1.pk1"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t2", + "access_type": "eq_ref", + "possible_keys": ["PRIMARY"], + "key": "PRIMARY", + "key_length": "4", + "used_key_parts": ["pk2"], + "ref": ["test.t1.pk1"], + "rows": 1, + "filtered": 100, + "using_index": true + } + } + } + } + } +} +DROP VIEW v2; +DROP TABLE t1,t2; +# +# MDEV-15017: splittable table is constant table +# +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +CREATE TABLE t2 (pk INT, b INT, PRIMARY KEY (pk)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,2),(3,4); +CREATE VIEW v2 AS SELECT pk, MIN(b) FROM t2 GROUP BY pk; +SELECT * FROM t1 LEFT JOIN v2 ON (a = pk); +a pk MIN(b) +DROP VIEW v2; +DROP TABLE t1,t2; +# +# MDEV-14994: splittable table with no rows +# +CREATE TABLE t1 (f INT PRIMARY KEY) ENGINE=MyISAM; +CREATE VIEW v1 AS SELECT a.* FROM t1 AS a STRAIGHT_JOIN t1 AS b; +CREATE VIEW v2 AS SELECT f FROM v1 GROUP BY f; +SELECT * FROM v1 JOIN v2 ON v1.f = v2.f; +f f +EXPLAIN EXTENDED +SELECT * FROM v1 JOIN v2 ON v1.f = v2.f; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +3 LATERAL DERIVED NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +Warnings: +Note 1003 /* select#1 */ select NULL AS `f`,`v2`.`f` AS `f` from `test`.`t1` `a` straight_join `test`.`t1` `b` join `test`.`v2` where 0 +DROP VIEW v1,v2; +DROP TABLE t1; +# +# MDEV-15899: derived with WF without any key access +# +create table t1 (f1 int, f2 int, f4 int); +insert into t1 values +(3,1,1), (3,0,9), (0,1,8), (9,0,0), (3,0,9); +with +cte as (select median(f2) over (partition by f1) as k1 from t1 order by f1), +cte1 as (select median(f4) over (partition by f1) as k2 from t1) +select k1,k2 from cte1, cte; +k1 k2 +0.0000000000 0.0000000000 +0.0000000000 0.0000000000 +0.0000000000 0.0000000000 +0.0000000000 0.0000000000 +0.0000000000 8.0000000000 +0.0000000000 8.0000000000 +0.0000000000 8.0000000000 +0.0000000000 8.0000000000 +0.0000000000 9.0000000000 +0.0000000000 9.0000000000 +0.0000000000 9.0000000000 +0.0000000000 9.0000000000 +0.0000000000 9.0000000000 +0.0000000000 9.0000000000 +0.0000000000 9.0000000000 +0.0000000000 9.0000000000 +0.0000000000 9.0000000000 +0.0000000000 9.0000000000 +0.0000000000 9.0000000000 +0.0000000000 9.0000000000 +1.0000000000 0.0000000000 +1.0000000000 8.0000000000 +1.0000000000 9.0000000000 +1.0000000000 9.0000000000 +1.0000000000 9.0000000000 +explain with +cte as (select median(f2) over (partition by f1) as k1 from t1 order by f1), +cte1 as (select median(f4) over (partition by f1) as k2 from t1) +select k1,k2 from cte1, cte; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived3> ALL NULL NULL NULL NULL 5 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) +3 DERIVED t1 ALL NULL NULL NULL NULL 5 Using temporary +2 DERIVED t1 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +drop table t1; +# +# MDEV-16104: embedded splittable materialized derived/views +# +CREATE TABLE t1 (f int PRIMARY KEY) ENGINE=MyISAM; +INSERT INTO t1 +VALUES (3), (7), (1), (4), (8), (5), (9); +CREATE ALGORITHM=MERGE VIEW v1 AS +SELECT a2.* +FROM +( SELECT f, COUNT(*) as c FROM t1 GROUP BY f ) AS a1 +JOIN +t1 AS a2 +USING (f); +EXPLAIN EXTENDED +SELECT * FROM ( SELECT STRAIGHT_JOIN f, COUNT(*) as c FROM v1 GROUP BY f ) AS s; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 7 100.00 +2 DERIVED <derived4> ALL NULL NULL NULL NULL 7 100.00 Using temporary; Using filesort +2 DERIVED a2 eq_ref PRIMARY PRIMARY 4 a1.f 1 100.00 Using index +4 DERIVED t1 index PRIMARY PRIMARY 4 NULL 7 100.00 Using index; Using temporary; Using filesort +Warnings: +Note 1003 /* select#1 */ select `s`.`f` AS `f`,`s`.`c` AS `c` from (/* select#2 */ select straight_join `a2`.`f` AS `f`,count(0) AS `c` from ((/* select#4 */ select `test`.`t1`.`f` AS `f`,count(0) AS `c` from `test`.`t1` group by `test`.`t1`.`f`)) `a1` join `test`.`t1` `a2` where `a2`.`f` = `a1`.`f` group by `a2`.`f`) `s` +SELECT * FROM ( SELECT STRAIGHT_JOIN f, COUNT(*) as c FROM v1 GROUP BY f ) AS s; +f c +1 1 +3 1 +4 1 +5 1 +7 1 +8 1 +9 1 +DROP VIEW v1; +DROP TABLE t1; +# +# MDEV-16801: splittable materialized derived/views with +# one grouping field from table without keys +# +CREATE TABLE t1 (a int, b int, INDEX idx_a(a), INDEX idx_b(b)) ENGINE=MYISAM; +CREATE TABLE t2 (c int) ENGINE=MYISAM; +CREATE TABLE t3 (d int) ENGINE=MYISAM; +INSERT INTO t1 VALUES +(77,7), (11,1), (33,3), (44,4), (8,88), +(78,7), (98,9), (38,3), (28,2), (79,7), +(58,5), (42,4), (71,7), (27,2), (91,9); +INSERT INTO t1 SELECT a+100, b+10 FROM t1; +INSERT INTO t2 VALUES +(100), (700), (200), (100), (200); +INSERT INTO t3 VALUES +(3), (4), (1), (8), (3); +ANALYZE tables t1,t2,t3; +Table Op Msg_type Msg_text +test.t1 analyze status OK +test.t2 analyze status OK +test.t3 analyze status OK +SELECT * +FROM t3, +(SELECT t1.b, t2.c +FROM t1, t2 +GROUP BY t1.b,t2.c) dt +WHERE t3.d = dt.b; +d b c +3 3 700 +3 3 200 +3 3 100 +4 4 700 +4 4 200 +4 4 100 +1 1 700 +1 1 200 +1 1 100 +3 3 700 +3 3 200 +3 3 100 +EXPLAIN EXTENDED SELECT * +FROM t3, +(SELECT t1.b, t2.c +FROM t1, t2 +GROUP BY t1.b,t2.c) dt +WHERE t3.d = dt.b; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 ALL NULL NULL NULL NULL 5 100.00 Using where +1 PRIMARY <derived2> ref key0 key0 5 test.t3.d 2 100.00 +2 LATERAL DERIVED t1 ref idx_b idx_b 5 test.t3.d 2 100.00 Using index; Using temporary; Using filesort +2 LATERAL DERIVED t2 ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) +Warnings: +Note 1003 /* select#1 */ select `test`.`t3`.`d` AS `d`,`dt`.`b` AS `b`,`dt`.`c` AS `c` from `test`.`t3` join (/* select#2 */ select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`b` = `test`.`t3`.`d` group by `test`.`t1`.`b`,`test`.`t2`.`c`) `dt` where `dt`.`b` = `test`.`t3`.`d` +DROP TABLE t1,t2,t3; +# +# MDEV-17419: splittable materialized derived/view +# when join_cache_level = 4 +# +set join_cache_level = 4; +CREATE TABLE t1 ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT, +username VARCHAR(50) NULL DEFAULT '0', +PRIMARY KEY (id) +) COLLATE='utf8_general_ci'; +CREATE TABLE t2 ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT, +userid INT UNSIGNED NOT NULL, +logindate DATETIME NOT NULL, +PRIMARY KEY (id) +) COLLATE='utf8_general_ci'; +INSERT INTO t1 (id, username) VALUES +(1,"user1"), (2, "user2"); +INSERT INTO t2 (id, userid, logindate) VALUES +(1,1,"2015-06-19 12:17:02.828"), +(2,1,"2016-06-19 12:17:02.828"), +(3,2,"2017-06-19 12:17:02.828"), +(4,2,"2018-06-19 12:17:02.828"); +EXPLAIN select * from t1 as u +left join +(select * from t2 as au group by au.userid) as auditlastlogin +on u.id=auditlastlogin.userid; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY u ALL NULL NULL NULL NULL 2 +1 PRIMARY <derived2> ref key0 key0 5 test.u.id 2 +2 DERIVED au ALL NULL NULL NULL NULL 4 Using temporary; Using filesort +select * from t1 as u +left join +(select * from t2 as au group by au.userid) as auditlastlogin +on u.id=auditlastlogin.userid; +id username id userid logindate +1 user1 1 1 2015-06-19 12:17:02 +2 user2 3 2 2017-06-19 12:17:02 +set join_cache_level=default; +DROP TABLE t1,t2; +# End of 10.3 tests diff --cc mysql-test/main/derived_cond_pushdown.test index c6c8c26271f,00000000000..2d683f06023 mode 100644,000000..100644 --- a/mysql-test/main/derived_cond_pushdown.test +++ b/mysql-test/main/derived_cond_pushdown.test @@@ -1,3287 -1,0 +1,3301 @@@ +let $no_pushdown= set statement optimizer_switch='condition_pushdown_for_derived=off' for; + +create table t1 (a int, b int, c int); +create table t2 (a int, b int, c int, d decimal); +insert into t1 values + (1,21,345), (1,33,7), (8,33,114), (1,21,500), (1,19,107), (5,14,787), + (8,33,123), (9,10,211), (5,16,207), (1,33,988), (5,27,132), (1,21,104), + (6,20,309), (6,20,315), (1,21,101), (8,33,404), (9,10,800), (1,21,123), + (7,11,708), (6,20,214); +insert into t2 values + (2,3,207,207.0000), (1,21,909,12.0000), (7,13,312,406.0000), + (8,64,248,107.0000), (6,20,315,279.3333), (1,19,203,107.0000), + (8,80,800,314.0000), (3,12,231,190.0000), (6,23,303,909.0000); + +create table t1_double(a int, b double, c double); +insert into t1_double values + (1,23.4,14.3333), (1,12.5,18.9), (3,12.5,18.9), + (4,33.4,14.3333), (4,14.3333,13.65), (5,17.89,7.22), + (6,33.4,14.3), (10,33.4,13.65), (11,33.4,13.65); + +create table t2_double(a int, b double, c double); +insert into t2_double values + (1,22.4,14.3333), (1,12.5,18.9), (2,22.4,18.9), + (4,33.4,14.3333), (5,22.4,13.65), (7,17.89,18.9), + (6,33.4,14.3333), (10,31.4,13.65), (12,33.4,13.65); + +create table t1_char(a char, b char(8), c int); +insert into t1_char values + ('a','Ivan',1), ('b','Vika',2), ('b','Inga',6), ('c','Vika',7), + ('b','Ivan',7), ('a','Alex',6), ('b','Inga',5), ('d','Ron',9), + ('d','Harry',2), ('d','Hermione',3), ('c','Ivan',3), ('c','Harry',4); + +create table t2_char(a char, b char(8), c int); +insert into t2_char values + ('b','Ivan',1), ('c','Vinny',3), ('c','Inga',9), ('a','Vika',1), + ('c','Ivan',2), ('b','Ali',6), ('c','Inga',2), ('a','Ron',9), + ('d','Harry',1), ('b','Hermes',3), ('b','Ivan',11), ('b','Harry',4); + +create table t1_decimal (a decimal(3,1), b decimal(3,1), c int); +insert into t1_decimal values + (1,1,23),(2,2,11),(3,3,16), + (1,1,12),(1,1,14),(2,3,15), + (2,1,13),(2,3,11),(3,3,16); + +create table t2_decimal (a decimal(3,1), b decimal(3,1), c int); +insert into t2_decimal values + (2,1,13),(2,2,11),(3,3,16), + (1,3,22),(1,3,14),(2,2,15), + (2,1,43),(2,3,11),(2,3,16); + +create view v1 as select a, b, max(c) as max_c, avg(c) as avg_c from t1 + group by a,b having max_c < 707; + +create view v2 as select a, b, max(c) as max_c, avg(c) as avg_c from t1 + where t1.a>5 group by a,b having max_c < 707; + +create view v3 as select a, b, min(c) as min_c from t1 + where t1.a<10 group by a,b having min_c > 109; + +create view v4 as + select a, b, min(max_c) as min_c from v1 + where (v1.a<15) group by a,b; + +create view v_union as + select a, b, min(c) as c from t1 + where t1.a<10 group by a,b having c > 109 + union + select a, b, max(c) as c from t1 + where t1.b>10 group by a,b having c < 300; + +create view v2_union as + select a, b, min(c) as c from t1 + where t1.a<10 group by a,b having c > 109 + union + select a, b, max(c) as c from t1 + where t1.b>10 group by a,b having c < 300 + union + select a, b, avg(c) as c from t1 + where t1.c>300 group by a,b having c < 707; + +create view v3_union as + select a, b, (a+1) as c from t1 + where t1.a<10 + union + select a, b, c from t1 + where t1.b>10 and t1.c>100; + +create view v4_union as + select a, b, max(c)-100 as c from t1 + where t1.a<10 group by a,b having c > 109 + union + select a, b, (c+100) as c from t1 + where t1.b>10; + +create view v_double as + select a, avg(a/4) as avg_a, b, c from t1_double + where (b>12.2) group by b,c having (avg_a<22.333); + +create view v_char as + select a, b, max(c) as max_c from t1_char + group by a,b having max_c < 9; + +create view v_decimal as + select a, b, avg(c) as avg_c from t1_decimal + group by a,b having (avg_c>12); + +--echo # conjunctive subformula : pushing into HAVING +let $query= select * from v1,t2 where (v1.max_c>214) and (t2.a>v1.a); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +let $query= + select * from + (select a, b, max(c) as max_c, avg(c) as avg_c from t1 + group by a,b having max_c < 707) v1, + t2 where (v1.a=t2.a) and (v1.max_c>300); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # extracted or formula : pushing into HAVING +let $query= + select * from v1,t2 where + ((v1.max_c>400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a<v1.a)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +let $query= + select * from v1,t2 where + ((v1.max_c>300) and (v1.avg_c>t2.d) and (v1.b=t2.b)) or + ((v1.max_c<135) and (v1.max_c<t2.c) and (v1.a=t2.a)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # conjunctive subformula : pushing into WHERE +let $query= select * from v1,t2 where (v1.a>6) and (t2.b>v1.b); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +let $query= select * from v2,t2 where (v2.b>25) and (t2.a<v2.a); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # extracted or formula : pushing into WHERE +let $query= + select * from v1,t2 where + ((v1.a>7) and (t2.c<v1.max_c)) or ((v1.a<2) and (t2.b<v1.b)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +let $query= + select * from v2,t2 where + ((v2.a>7) and (t2.c<v2.max_c)) or ((v2.a>5) and (t2.b<v2.b)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +let $query= + select * from v1,t2 where + ((v1.a>4) and (v1.b>t2.b) and (v1.max_c=t2.d)) or + ((v1.a<2) and (v1.max_c<t2.c) and (v1.max_c=t2.d)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # conjunctive subformulas : pushing into HAVING and WHERE +let $query= + select * from v1,t2 where (v1.a<2) and (v1.max_c>400) and (t2.b>v1.b); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +let $query= + select * from v_double as v,t2_double as t where + (v.a=t.a) and (v.avg_a>0.45) and (v.b>10); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +let $query= + select * from v_decimal as v,t2_decimal as t where + (v.a=t.a) and (v.avg_c>15) and (v.b>1); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # extracted or formula : pushing into HAVING and WHERE +let $query= + select * from v1,t2 where + ((v1.a>7) and (v1.max_c>300) and (t2.c<v1.max_c)) or + ((v1.a<4) and (v1.max_c<500) and (t2.b<v1.b)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +let $query= + select * from v1,t2 where ((v1.a<2) and (v1.max_c>120)) or (v1.a>7); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # extracted or formulas : pushing into WHERE and HAVING +let $query= + select * from v1,t2 where + ((v1.a<2) and (v1.max_c>120) and (v1.b=t2.b)) or (v1.a>7); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +let $query= + select * from v1,t2 where + ((v1.a<2) and (v1.max_c<200) and (t2.c>v1.max_c) and (v1.max_c=t2.d)) or + ((v1.a>4) and (v1.max_c<500) and (t2.b<v1.b) and (v1.max_c=t2.c)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # prepare of a query containing extracted or formula +prepare stmt from "select * from v1,t2 where + ((v1.max_c>400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a<v1.a));"; +execute stmt; +execute stmt; +deallocate prepare stmt; +prepare stmt from + "explain format=json select * from v1,t2 where + ((v1.max_c>400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a<v1.a));"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +--echo # conjunctive subformula : pushing into WHERE +--echo # pushing equalities +let $query= + select * from v1,t2 where (t2.a=v1.a) and (v1.b=t2.b) and (v1.a=1); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +let $query= select * from v1,t2 where (v1.a=5) and (v1.max_c=t2.d); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # conjunctive subformula : pushing into WHERE using equalities +let $query= select * from v1,t2 where (t2.a<5) and (v1.a=t2.a); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +let $query= + select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # conjunctive subformula : pushing into HAVING using equalities +let $query= select * from v1,t2 where (t2.c>150) and (v1.max_c=t2.c); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # extracted and formula : pushing into WHERE +--echo # pushing equalities +let $query= + select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a) and (v1.a=3); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +let $query= + select * from v1,t2 where (v1.a=1) and (v1.b=21) and (t2.a=2); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +let $query= + select * from v_char as v,t2_char as t where + (v.a='c') and (v.b<'Hermes') and ((v.b=t.b) or (v.max_c>20)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # extracted and formula : pushing into WHERE using equalities +--echo # pushing equalities +let $query= +select * from v_decimal as v,t2_decimal as t where + (v.a=v.b) and (v.b=t.b) and ((t.b>1) or (v.a=1)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # extracted or formula : pushing into HAVING using equalities +let $query= + select * from v1,t2 + where ((t2.a<4) and (v1.a=t2.a)) or ((t2.c>150) and (v1.max_c=t2.c)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # conjunctive subformulas : pushing into WHERE and HAVING using equalities +let $query= + select * from v1,t2 + where ((t2.a>5) and (v1.a=t2.a)) and ((t2.c>250) and (v1.max_c=t2.c)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # conjunctive subformulas : pushing into WHERE and HAVING +--echo # pushing equalities +let $query= + select * from + (select a, b, max(c) as max_c, avg(c) as avg_c from t1 + group by a,b having max_c < 707) v1, + t2 where (v1.a=8) and (v1.a=t2.a) and (v1.max_c=404); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # conjunctive subformulas : pushing into WHERE and HAVING +let $query= + select * from v1,t2 where + (v1.a>3) and (v1.max_c>200) and (t2.b<v1.b) and (t2.d=v1.max_c); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # conjunctive subformula : pushing into WHERE +--echo # extracted or formula : pushing into HAVING using equalities +--echo # pushing equalities +let $query= + select * from v_double as v,t2_double as t where + (v.b=v.c) and (v.c=t.c) and ((t.c>10) or (v.a=1)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # conjunctive subformula : pushing into WHERE +--echo # extracted or formula : pushing into HAVING using equalities +let $query= + select * from v_double as v,t2_double as t where + (((v.a>0.2) or (v.b<17)) or (t.c>17)) and (t.c=v.c) and (v.c>18); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # extracted or formula : pushing into WHERE +--echo # conjunctive subformula : pushing into HAVING +--echo # pushing equalities +let $query= + select * from v_decimal as v,t2_decimal as t where + (((v.a>4) or (v.a=2)) or (v.b>3)) and (v.avg_c=13); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +let $query= + select * from + (select a, b, max(c) as max_c, avg(c) as avg_c from t1 + where t1.a>5 group by a,b having max_c < 707) v1, + t2 where (v1.a=t2.a) and (v1.max_c>300) and (v1.a=v1.b); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # nothing to push +let $query= + select * from v1,t2 where (t2.a<2) and (t2.c>900); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.b=t2.b); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +let $query= + select * from v1,t2 where + (t2.a=v1.a) or (v1.b=t2.b) and ((v1.a=1) or (v1.a=6)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +let $query= + select * from v1,t2 where (v1.a=1) or (v1.b=21) or (t2.a=2); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +let $query= + select * from v1,t2 where + (t2.a<2) and (t2.c>900) and ((v1.a<t2.a) or (t2.a<11)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using several derived tables : nothing to push +let $query= select * from v1,v2,t2 where + (v1.a=v2.a) and (v1.a=t2.a) and (v2.b<50); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +let $query= + select * from v1,v2,t2 where + ((v1.a=v2.a) or (v1.a=t2.a)) and (t2.b<50) and (v1.b=v2.b); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +let $query= + select * from v1,v2,t2 where + ((v1.a=v2.a) and (v1.a=t2.a)) or ((v2.b>13) and (t2.c<115)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using several derived tables : pushing in all tables +--echo # conjunctive subformula : pushing into HAVING +--echo # extracted or formula : pushing into WHERE +--echo # pushing equalities +let $query= + select * from v1,v2,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and + ((v2.b<50) or (v2.b=19)) and (v1.max_c<300); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using several derived tables : pushing only in one table +--echo # conjunctive subformula : pushing into WHERE +--echo # pushing equalities +let $query= + select * from v1,v2,t2 where + (v1.a=t2.a) and (v1.a=v1.b) and (v1.a=v2.a) and (v2.max_c<300); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using several derived tables : pushing only in one table +--echo # extracted and formula : pushing into WHERE +--echo # conjunctive subformula : pushing into WHERE using equalities +--echo # pushing equalities +let $query= + select * from v1,v2,t2 where (v1.a=1) and (v1.b>10) and (v1.b=v2.b); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # extracted or formula : pushing into WHERE +--echo # conjunctive subformula : pushing into WHERE using equalities +--echo # pushing equalities +let $query= + select * from v_char as v,t2_char as t where + (v.a=t.a) and (t.a='b') and ((v.b='Vika') or (v.b='Ali')); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using several derived tables : pushing in all tables +--echo # extracted or formula : pushing into WHERE +--echo # conjunctive subformulas : pushing into HAVING +--echo # pushing equalities +let $query= + select * from v1,v2,v3,t2 where + ((v1.a=v2.a) or (v1.a=t2.a)) and ((v3.b<50) or (v3.b=33)) + and (v1.max_c<500) and (v3.a=t2.a) and (v2.max_c>300); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using several derived tables : pushing in all tables +--echo # conjunctive subformulas : pushing into HAVING +let $query= + select * from + (select a, b, max(c) as max_c, avg(c) as avg_c from t1 + where t1.a>5 group by a,b having max_c < 707) v1, + (select a, b, min(c) as min_c from t1 + where t1.a>5 group by a,b having min_c < 707) v2, + t2 where (v1.a=v2.a) and (v1.b=t2.b) and (v1.max_c>130) and (v2.min_c<130); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using several derived tables : pushing in all tables +--echo # extracted or formulas : pushing into HAVING +--echo # conjunctive subformula : pushing into HAVING +let $query= + select * from + (select a, b, max(c) as max_c, avg(c) as avg_c from t1 + where t1.a>5 group by a,b having max_c < 707) v1, + (select a, b, min(c) as min_c from t1 + where t1.a>5 group by a,b having min_c < 707) v2, + (select a, b, avg(c) as avg_c from t1 + where t1.a<8 group by a,b) v3, + t2 where (v1.a=v2.a) and (v1.b=v3.b) and ((v3.avg_c>170) or (v3.a<5)) + and ((v1.avg_c<400) or (v1.a>1)) and (v2.min_c<200); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # extracted or formula : pushing into HAVING +--echo # conjunctive subformula : pushing into WHERE +let $query= + select * from + (select a, b, max(c) as max_c, avg(c) as avg_c from t1 + group by a,b having max_c < 707) v1, + t2 where ((v1.a=1) or (v1.max_c<300)) and (v1.b>25); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # extracted and formula : pushing into WHERE +--echo # conjunctive subformula : pushing into HAVING +let $query= + select * from + (select a, b, max(c) as max_c, avg(c) as avg_c from t1 + where t1.a>5 group by a,b having max_c < 707) v1, + t2 where (v1.a=t2.a) and (v1.max_c>300) and (v1.b<30); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using query with union +--echo # conjunctive subformula : pushing into WHERE +--echo # conjunctive subformulas : pushing into HAVING and WHERE +let $query= + select * from v1,t2 where (v1.a<5) and (v1.b=t2.b) and (t2.c>800) + union + select * from v1,t2 where (v1.max_c>100) and (v1.a>7) and (t2.d>800); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using query with union +--echo # extracted and formula : pushing into WHERE +--echo # extracted or formula : pushing into HAVING +--echo # pushing equalities +let $query= + select * from v1,t2 where (v1.a<5) and (v1.b=t2.b) and (v1.b=19) + union + select * from v1,t2 where ((v1.max_c>400) or (v1.avg_c>270)) and (v1.a<t2.a); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using query with union +--echo # extracted or formula : pushing into HAVING +--echo # extracted or formula : pushing into WHERE +--echo # pushing equalities +let $query= + select * from v1,t2 where + ((t2.a=v1.a) or (v1.b=t2.b)) and ((v1.a=1) or (v1.a=6)) + union + select * from v1,t2 where ((v1.a>3) and (v1.b>27)) or (v1.max_c>550); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using query with union +--echo # extracted or formula : pushing into HAVING +--echo # conjunctive subformulas : pushing into WHERE +--echo # pushing equalities +let $query= + select * from v1,t2 where + ((v1.a=1) and (v1.a=t2.a)) and ((v1.max_c<500) or (v1.avg_c>500)) + union + select * from v2,t2 where + ((v2.a<t2.b) or (v2.max_c>200)) and (v2.b>10) and (t2.a<2) + union + select * from v2,t2 where + (v2.max_c=t2.c) and (v2.b<10); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using derived table with union +--echo # conjunctive subformulas : pushing into WHERE and HAVING +let $query= select * from v_union,t2 where (v_union.a<3) and (v_union.c>100); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using derived table with union +--echo # conjunctive subformula : pushing into WHERE +--echo # extracted or formula : pushing into HAVING +let $query= + select * from v_union,t2 where + ((v_union.a<2) or (v_union.c>800)) and (v_union.b>12); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using derived table with union +--echo # conjunctive subformula : pushing into HAVING +--echo # conjunctive subformula : pushing into WHERE +--echo # pushing equalities +let $query= + select * from v_union,t2 where + (v_union.a=1) and (v_union.a=t2.a) and (v_union.c<200); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +let $query= + select * from v_char as v,t2_char as t where + (v.a=t.a) and (v.b='Vika') and (v.max_c>2); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using derived table with union +--echo # using several derived tables : pushing in all tables +--echo # conjunctive subformula : pushing into WHERE using equalities +--echo # pushing equalities +let $query= + select * from v_union,v1,t2 where + (v_union.a=v1.a) and (v1.a=t2.a) and (t2.a=1) + and ((v_union.c>800) or (v1.max_c>200)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using derived table with union +--echo # extracted or formula : pushing into WHERE +--echo # conjunctive subformula : pushing into HAVING +--echo # pushing equalities +let $query= + select * from v2_union as v,t2 where + ((v.a=6) or (v.a=8)) and (v.c>200) and (v.a=t2.a); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using derived table with union of selects without aggregation +--echo # extracted conjunctive predicate: pushing in WHERE of both selects +let $query= + select * from v3_union as v,t2 where (v.a=t2.a) and (v.c>6); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using derived table with union of selects without aggregation +--echo # extracted conjunctive OR subformula: pushing in WHERE using equalities +let $query= + select * from v3_union as v,t2 where (v.a=t2.a) and ((t2.a>1) or (v.b<20)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using derived table with union of selects without aggregation +--echo # extracted the whole condition: in WHERE of both selects +let $query= + select * from v3_union as v,t2 where + (v.a=t2.a) and ((v.b=19) or (v.b=21)) and ((v.c<3) or (v.c>600)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using derived table with union of +--echo # a select without aggregation and a select with aggregation +--echo # extracted conjunctive predicate: pushing in WHERE of both selects +let $query= + select * from v4_union as v,t2 where (v.a=t2.a) and (v.b<20); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using derived table with union of +--echo # a select without aggregation and a select with aggregation +--echo # extracted subformula: pushing in WHERE of one select +--echo # extracted subformula: pushing in HAVING of the other select +--echo # extracted sub-subformula: pushing in WHERE of the other select +--echo # using an equality in all pushdowns +let $query= + select * from v4_union as v,t2 where + (v.a=t2.a) and ((t2.a<3) or (v.b<40)) and (v.c>500); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using embedded derived table : pushing the same conditions +--echo # using several derived tables : pushing in all tables +--echo # conjunctive subformula : pushing into WHERE +--echo # extracted and formula : pushing into WHERE +let $query= +select * from v4,v1 where + (v4.a<13) and (v1.a>5) and (v1.b>12); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using embedded view : nothing to push +--echo # using several derived tables : pushing only in one table +--echo # conjunctive subformula : pushing into WHERE +let $query= + select * from v4,v1,t2 where + (v4.a=t2.a) and (v4.a=v1.a) and (v1.b>30); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using embedded view : pushing different conditions +--echo # using several derived tables : pushing in all tables +--echo # conjunctive subformula : pushing into WHERE using equalities +--echo # extracted and formula : pushing into WHERE using equalities +--echo # conjunctive subformula : pushing into HAVING +let $query= + select * from v4,v1,t2 where + (v4.a=t2.a) and (v4.a>1) and (v4.a=v1.a) and (v4.min_c>100) and (v1.b<30); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using embedded view : pushing different conditions +--echo # using several derived tables : pushing in all tables +--echo # extracted or formula : pushing into WHERE +--echo # conjunctive subformula : pushing into HAVING +let $query= + select * from v4,v1,t2 where + (((v4.b>10) and (v4.a>1)) or (v4.b<20)) and (v1.max_c>200) and (v1.a=v4.a); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using embedded view : pushing different conditions +--echo # using several derived tables : pushing only in one table +--echo # extracted or formula : pushing into WHERE +--echo # extracted or formula : pushing into HAVING +let $query= + select * from v4,v2 where + ((v4.a>12) and (v4.min_c<300) and (v4.b>13)) or (v4.a<1); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using embedded view : pushing different conditions +--echo # using several derived tables : pushing only in one table +--echo # conjunctive subformula : pushing into WHERE +--echo # conjunctive subformula : pushing into HAVING +--echo # pushing equalities +let $query= + select * from v4,v2 where + (v4.a=v2.b) and (v4.a=v4.b) and (v4.min_c<100); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using embedded view : pushing the same conditions +--echo # using several derived tables : pushing in all tables +--echo # extracted and formula : pushing into WHERE using equalities +--echo # conjunctive subformula : pushing into WHERE +--echo # pushing equalities +let $query= + select * from v4,v2 where + (v4.a=v2.b) and (v4.a=v4.b) and (v2.b<30); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using embedded view : pushing the same conditions +--echo # using several derived tables : pushing in all tables +--echo # extracted or formula : pushing into WHERE using equalities +--echo # extracted and formula : pushing into WHERE using equalities +--echo # pushing equalities +let $query= + select * from v4,v2 where + (v4.a=v2.b) and (v4.a=v4.b) and ((v2.b<30) or (v4.a>2)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using embedded view : pushing the same conditions +--echo # using several derived tables : pushing in all tables +--echo # extracted or formula : pushing into WHERE +--echo # conjunctive subformula : pushing into WHERE +--echo # pushing equalities +let $query= + select * from v4,v2 where + (((v4.a<12) and (v4.b>13)) or (v4.a>10)) and + (v4.min_c=v2.max_c) and (v4.min_c>100); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using embedded view : pushing the same conditions +--echo # using several derived tables : pushing only in one table +--echo # extracted or formula : pushing into WHERE +let $query= + select * from v4,v2,t2 where + (((v4.a<12) and (t2.b>13)) or (v4.a>10)) and + (v4.min_c=t2.c) and (t2.c>100); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +drop view v1,v2,v3,v4; +drop view v_union,v2_union,v3_union,v4_union; +drop view v_double,v_char,v_decimal; +drop table t1,t2,t1_double,t2_double,t1_char,t2_char,t1_decimal,t2_decimal; + +--echo # +--echo # MDEV-10782: condition extracted from a multiple equality +--echo # pushed into HAVING +--echo # + +CREATE TABLE t1 (i int); +INSERT INTO t1 VALUES (1),(2); +EXPLAIN EXTENDED +SELECT * + FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2 + WHERE f = 8; +SELECT * + FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2 + WHERE f = 8; +SELECT * + FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2 + WHERE f = 1; +DROP TABLE t1; + +--echo # +--echo # MDEV-10783: pushdown into constant view +--echo # + +CREATE TABLE t1 (i int) ENGINE=MyISAM; +CREATE VIEW v AS SELECT 5; +SELECT * FROM t1 WHERE 1 IN ( SELECT * FROM v ); +DROP VIEW v; +DROP TABLE t1; + +--echo # +--echo # MDEV-10785: second execution of a query with condition +--echo # pushed into view +--echo # + +CREATE TABLE t1 (i int); +CREATE VIEW v1 AS SELECT i FROM t1 WHERE i < 5; +CREATE FUNCTION f (in1 int) RETURNS int RETURN in1; +CREATE VIEW v2 AS SELECT * FROM v1 GROUP BY i; +PREPARE stmt FROM "SELECT * FROM v2 WHERE f(0) <> 2"; +EXECUTE stmt; +EXECUTE stmt; +DROP FUNCTION f; +DROP VIEW v2,v1; +DROP TABLE t1; + +--echo # +--echo # MDEV-10884: condition pushdown into derived specified by +--echo # 1. unit with SELECT containing ORDER BY ... LIMIT +--echo # 2. unit containing global ORDER BY ... LIMIT +--echo # + +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +select a from t1 order by a limit 5; + +set statement optimizer_switch='condition_pushdown_for_derived=off' for +select * from (select a from t1 order by a limit 5) t where t.a not in (1,2,3); +set statement optimizer_switch='condition_pushdown_for_derived=on' for +select * from (select a from t1 order by a limit 5) t where t.a not in (1,2,3); + +select a from t1 where a < 4 union select a from t1 where a > 5 + order by a limit 5; +set statement optimizer_switch='condition_pushdown_for_derived=off' for +select * from +(select a from t1 where a < 4 union select a from t1 where a > 5 + order by a limit 5) t where t.a not in (2,9); +set statement optimizer_switch='condition_pushdown_for_derived=on' for +select * from +(select a from t1 where a < 4 union select a from t1 where a > 5 + order by a limit 5) t where t.a not in (2,9); + +drop table t1; + +--echo # +--echo # MDEV-11072: pushdown of the condition obtained +--echo # after constant row substitution +--echo # + +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2; +CREATE TABLE t3 (c INT) ENGINE=MyISAM; +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t3; + +SELECT * FROM t1 WHERE a IN ( + SELECT b FROM v2 WHERE b < a OR b IN ( + SELECT c FROM v3 WHERE c = a + ) +); + +INSERT INTO t1 VALUES (2); +INSERT INTO t2 VALUES (3), (2); +INSERT INTO t3 VALUES (4), (1), (2), (7); + +SELECT * FROM t1 WHERE a IN ( + SELECT b FROM v2 WHERE b < a OR b IN ( + SELECT c FROM v3 WHERE c = a + ) +); + +EXPLAIN FORMAT=JSON +SELECT * FROM t1 WHERE a IN ( + SELECT b FROM v2 WHERE b < a OR b IN ( + SELECT c FROM v3 WHERE c = a + ) +); + +CREATE TABLE t4 (d INT, e INT) ENGINE=MyISAM; +INSERT INTO t4 VALUES (1,10),(3,11),(2,10),(2,20),(3,21); +CREATE OR REPLACE VIEW v4 AS +SELECT d, sum(e) AS s FROM t4 GROUP BY d; + +let $query = +SELECT * FROM t1 WHERE a IN ( + SELECT b FROM v2 WHERE b < a OR b IN ( + SELECT d FROM v4 WHERE s > a + ) +); + +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +DROP VIEW v2,v3,v4; +DROP TABLE t1,t2,t3,t4; + +--echo # +--echo # MDEV-10800: pushdown of the condition obtained +--echo # after constant row substitution +--echo # + + +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1); + +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3),(4); +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; + +SELECT * FROM +( SELECT * FROM t1 + WHERE EXISTS ( SELECT * FROM v2 WHERE b = a ) ) AS sq; + +EXPLAIN FORMAT=JSON +SELECT * FROM +( SELECT * FROM t1 + WHERE EXISTS ( SELECT * FROM v2 WHERE b = a ) ) AS sq; + +DROP VIEW v2; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-11102: condition pushdown into materialized inner table +--echo # of outer join is not applied as not being valid +--echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (0),(2); + +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (1),(2); + +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; + +SELECT * FROM t1 LEFT JOIN t2 ON a = b WHERE b IS NULL; + +SELECT * FROM t1 LEFT JOIN v2 ON a = b WHERE b IS NULL; + +EXPLAIN FORMAT=JSON +SELECT * FROM t1 LEFT JOIN v2 ON a = b WHERE b IS NULL; + +DROP VIEW v2; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-11103: pushdown condition with ANY subquery +--echo # + +CREATE TABLE t1 (i INT); +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (1),(2); + +EXPLAIN FORMAT=JSON +SELECT * FROM v1 WHERE i <= ANY ( SELECT 3 ); + +SELECT * FROM v1 WHERE i <= ANY ( SELECT 3 ); + +DROP VIEW v1; +DROP TABLE t1; + +--echo # +--echo # MDEV-11315: condition with outer reference to mergeable derived +--echo # + +CREATE TABLE t1 (pk1 INT PRIMARY KEY, a INT, b INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (10,7,1),(11,0,2); + +CREATE TABLE t2 (pk2 INT PRIMARY KEY, c INT, d DATETIME) ENGINE=MyISAM; +INSERT INTO t2 VALUES + (1,4,'2008-09-27 00:34:58'), + (2,5,'2007-05-28 00:00:00'), + (3,6,'2009-07-25 09:21:20'); + +CREATE VIEW v1 AS SELECT * FROM t1; +CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; + +SELECT * FROM v1 AS sq + WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; +EXPLAIN FORMAT=JSON +SELECT * FROM v1 AS sq + WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; + +SELECT * FROM ( SELECT * FROM t1 ) AS sq + WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT * FROM t1 ) AS sq + WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; + +DROP VIEW v1,v2; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-11313: pushdown of the condition obtained +--echo # after constant row substitution +--echo # + +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (50); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; + +SELECT ( SELECT COUNT(*) FROM v1 WHERE a = t2.b ) AS f FROM t2 GROUP BY f; +EXPLAIN FORMAT=JSON +SELECT ( SELECT COUNT(*) FROM v1 WHERE a = t2.b ) AS f FROM t2 GROUP BY f; + +CREATE TABLE t3 (a INT, b INT) ENGINE=MYISAM; +INSERT INTO t3 VALUES (1,10),(3,11),(2,10),(2,20),(3,21); +CREATE VIEW v2 AS SELECT a, sum(b) AS s FROM t3 GROUP BY a ; +SELECT ( SELECT COUNT(*) FROM v2 WHERE s < t2.b ) AS f FROM t2 GROUP BY f; +EXPLAIN FORMAT=JSON +SELECT ( SELECT COUNT(*) FROM v2 WHERE s < t2.b ) AS f FROM t2 GROUP BY f; + + +DROP VIEW v1,v2; +DROP TABLE t1,t2,t3; + +--echo # +--echo # MDEV-10882: pushdown of the predicate with cached value +--echo # + +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL) ENGINE=MyISAM; +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (1,2),(3,4); + +CREATE TABLE t2 (c INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t2 VALUES (5),(6); + +SELECT a, GROUP_CONCAT(b) FROM v1 + WHERE b IN ( SELECT COUNT(c) FROM t2 ) GROUP BY a; + +EXPLAIN FORMAT=JSON +SELECT a, GROUP_CONCAT(b) FROM v1 + WHERE b IN ( SELECT COUNT(c) FROM t2 ) GROUP BY a; + +DROP VIEW v1; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-10836: pushdown of the predicate with cached value +--echo # + +CREATE TABLE t (pk INT PRIMARY KEY, f INT) ENGINE=MyISAM; +CREATE ALGORITHM=TEMPTABLE VIEW v AS SELECT * FROM t; +INSERT INTO t VALUES (1,1),(3,2); + +SELECT * FROM v AS v1, v AS v2 + WHERE v2.pk > v1.f AND v1.f IN ( SELECT COUNT(pk) FROM t ); + +EXPLAIN FORMAT=JSON +SELECT * FROM v AS v1, v AS v2 + WHERE v2.pk > v1.f AND v1.f IN ( SELECT COUNT(pk) FROM t ); + +DROP VIEW v; +DROP TABLE t; + +--echo # +--echo # MDEV-11488: pushdown of the predicate with cached value +--echo # + +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(3),(2); + +CREATE TABLE t2 (j INT, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3),(4); + +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); + +UPDATE t2 SET j = 2 WHERE j = 3; +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); + +DROP TABLE t1,t2; + +CREATE TABLE t1 (i FLOAT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1.5),(3.2),(2.71); + +CREATE TABLE t2 (j FLOAT, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3.2),(2.71); + +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); + +DROP TABLE t1,t2; + +CREATE TABLE t1 (i DECIMAL(10,2)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1.5),(3.21),(2.47); + +CREATE TABLE t2 (j DECIMAL(10,2), KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3.21),(4.55); + +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); + +DROP TABLE t1,t2; + +CREATE TABLE t1 (i VARCHAR(32)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('cc'),('aa'),('ddd'); + +CREATE TABLE t2 (j VARCHAR(16), KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('bbb'),('aa'); + +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); + +DROP TABLE t1,t2; + +CREATE TABLE t1 (i DATETIME) ENGINE=MyISAM; +INSERT INTO t1 VALUES + ('2008-09-27 00:34:58'),('2007-05-28 00:00:00'), ('2009-07-25 09:21:20'); + +CREATE TABLE t2 (j DATETIME, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES + ('2007-05-28 00:00:00'), ('2010-08-25 00:00:00'); + +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); + +DROP TABLE t1,t2; + +CREATE TABLE t1 (i DATE) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('2008-09-27'),('2007-05-28'), ('2009-07-25'); + +CREATE TABLE t2 (j DATE, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('2007-05-28'), ('2010-08-25'); + +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); + +DROP TABLE t1,t2; + +CREATE TABLE t1 (i TIME) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('00:34:58'),('10:00:02'), ('09:21:20'); + +CREATE TABLE t2 (j TIME, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('10:00:02'), ('11:00:10'); + +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); + +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-11593: pushdown of condition with NULLIF +--echo # + +CREATE TABLE t1 (i INT); +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; + +INSERT INTO t1 VALUES (2), (1); + +SELECT * FROM v1 WHERE NULLIF(1, i); +EXPLAIN FORMAT=JSON +SELECT * FROM v1 WHERE NULLIF(1, i); + +DROP VIEW v1; +DROP TABLE t1; + +--echo # +--echo # MDEV-11608: pushdown of the predicate with cached null value +--echo # + +CREATE TABLE t1 (c VARCHAR(3)); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES ('foo'),('bar'); + +CREATE TABLE t2 (c VARCHAR(3)); +INSERT INTO t2 VALUES ('foo'),('xyz'); + +SELECT * FROM v1 WHERE v1.c IN ( SELECT MIN(c) FROM t2 WHERE 0 ); +EXPLAIN FORMAT=JSON +SELECT * FROM v1 WHERE v1.c IN ( SELECT MIN(c) FROM t2 WHERE 0 ); + +DROP VIEW v1; +DROP TABLE t1,t2; + +CREATE TABLE t1 (d DECIMAL(10,2)); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (5.37),(1.1); + +CREATE TABLE t2 (d DECIMAL(10,2)); +INSERT INTO t2 VALUES ('1.1'),('2.23'); + +SELECT * FROM v1 WHERE v1.d IN ( SELECT MIN(d) FROM t2 WHERE 0 ); + +DROP VIEW v1; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-11820: second execution of PS for query +--echo # with false subquery predicate in WHERE +--echo # + +CREATE TABLE t1 (c VARCHAR(3)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('foo'),('bar'); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +CREATE TABLE t2 (a INT); +INSERT INTO t2 VALUES (3), (4); + +PREPARE stmt1 FROM +" SELECT * FROM v1 WHERE 1 IN (SELECT a FROM t2) OR c = 'foo'"; +PREPARE stmt2 FROM +"EXPLAIN FORMAT=JSON + SELECT * FROM v1 WHERE 1 IN (SELECT a FROM t2) OR c = 'foo'"; +EXECUTE stmt1; +EXECUTE stmt2; +INSERT INTO t2 SELECT a+1 FROM t2; +INSERT INTO t2 SELECT a+1 FROM t2; +INSERT INTO t2 SELECT a+1 FROM t2; +INSERT INTO t2 SELECT a+1 FROM t2; +INSERT INTO t2 SELECT a+1 FROM t2; +INSERT INTO t2 SELECT a+1 FROM t2; +EXECUTE stmt1; +EXECUTE stmt2; +DEALLOCATE PREPARE stmt1; +# the result here will change after the merge with the fix for mdev-11859 +DEALLOCATE PREPARE stmt2; + +DROP VIEW v1; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-12373: pushdown into derived with side effects is prohibited +--echo # + +CREATE TABLE sales_documents ( + id int NOT NULL AUTO_INCREMENT, + sale_id int NULL DEFAULT NULL, + type tinyint unsigned NULL DEFAULT NULL, + data text NULL DEFAULT NULL COLLATE 'utf8_unicode_ci', + date date NULL DEFAULT NULL, + order_number int unsigned NULL DEFAULT NULL, + created_at int NULL DEFAULT NULL, + updated_at int NULL DEFAULT NULL, + generated tinyint NOT NULL DEFAULT '0', + synced_at int NOT NULL DEFAULT '0', + sum decimal(13,2) NOT NULL DEFAULT '0', + PRIMARY KEY (id) +); + +INSERT INTO sales_documents +(id, sale_id, type, order_number, data, created_at, + updated_at, date, generated, synced_at, sum) +VALUES +(555, 165, 3, 5, '{}', 1486538300, 1486722835, '2017-02-17', 0, 1486538313, 2320.00), +(556, 165, 2, 3, '{}', 1486538304, 1486563125, '2017-02-08', 1, 1486538302, 2320.00), +(557, 158, 2, 2, '{}', 1486538661, 1486538661, '2017-02-08', 0, 1486538660, 2320.00), +(558, 171, 1, 3, '{}', 1486539104, 1488203405, '2017-02-08', 1, 1486539102, 23230.00), +(559, 171, 2, 5, '{}', 1486549233, 1487146010, '2017-02-08', 1, 1486549225, 37690.00), +(560, 172, 1, 1, '{}', 1486658260, 1488203409, '2017-02-09', 1, 1486658256, 40312.00), +(561, 172, 2, 1, '{}', 1486711997, 1486711997, '2017-02-10', 1, 1486711996, 40312.00), +(562, 172, 3, 1, '{}', 1486712104, 1486721395, '2017-02-10', 1, 1486712101, 40312.00), +(563, 171, 3, 2, '{}', 1486712953, 1486720244, '2017-02-10', 1, 1486712910, 23230.00), +(564, 170, 1, 2, '{}', 1486715948, 1488203410, '2017-02-10', 1, 1486715930, 28873.00), +(565, 170, 3, 3, '{}', 1486716782, 1486717426, '2017-02-10', 1, 1486716779, 61948.00), +(566, 166, 3, 4, '{}', 1486720947, 1486720947, '2017-02-10', 1, 1486720945, 4640.00), +(567, 167, 3, 5, '{}', 1486722741, 1486722783, '2017-02-26', 0, 1486722738, 14755.00), +(568, 165, 1, 4, '{}', 1486722849, 1486722849, '2017-02-10', 0, 1486722846, 2320.00), +(569, 173, 2, 2, '{}', 1486723073, 1487071275, '2017-02-10', 1, 1486723071, 14282.00), +(570, 173, 1, 4, '{}', 1486723100, 1488203412, '2017-02-10', 1, 1486723099, 14282.00), +(571, 167, 2, 4, '{}', 1486730859, 1486730859, '2017-02-10', 1, 1486730856, 18655.00), +(572, 167, 1, 5, '{}', 1486730883, 1488203412, '2017-02-10', 1, 1486730877, 18655.00), +(573, 174, 2, 51, '{}', 1486731622, 1487060259, '2017-02-10', 1, 1486731620, 7140.00), +(574, 174, 3, 5, '{}', 1486993472, 1486993472, '2017-02-13', 1, 1488216147, 28020.00), +(575, 174, 1, 6, '{}', 1486993530, 1488203412, '2017-02-13', 1, 1486993505, 7140.00), +(576, 173, 3, 6, '{}', 1487071425, 1487071425, '2017-02-14', 0, 1487071422, 14282.00), +(577, 178, 2, 6, '{}', 1487327372, 1487327372, '2017-02-17', 1, 1487327370, 12321.00), +(578, 177, 2, 7, '{}', 1487327394, 1487327394, '2017-02-17', 0, 1487327391, 4270.00), +(579, 182, 3, 6, '{}', 1487750589, 1487751693, '2017-02-22', 1, 1487751688, 4270.00), +(580, 182, 2, 7, '{}', 1487750601, 1487750663, '2017-02-22', 1, 1487750598, 4270.00), +(581, 182, 1, 7, '{}', 1487750694, 1488203412, '2017-02-22', 1, 1487750692, 4270.00), +(582, 185, 3, 7, '{}', 1487774051, 1487774051, '2017-02-22', 0, 1487774043, 8913.00), +(583, 184, 3, 7, '{}', 1487774071, 1487774235, '2017-02-22', 0, 1487774093, 3285.00), +(584, 184, 2, 8, '{}', 1487774074, 1487774074, '2017-02-22', 0, 1487774073, 3285.00), +(585, 184, 1, 8, '{}', 1487774081, 1487774081, '2017-02-22', 0, 1487774075, 3285.00), +(586, 193, 2, 8, '{}', 1487955294, 1487955318, '2017-02-24', 0, 1487955311, 4270.00), +(587, 193, 1, 8, '{}', 1487955324, 1487955324, '2017-02-24', 0, 1487955320, 4270.00), +(588, 193, 3, 7, '{}', 1487955341, 1487955341, '2017-02-24', 0, 1487955325, 4270.00), +(589, 186, 1, 8, '{}', 1487957291, 1487957464, '2017-02-24', 0, 1487957459, 6960.00), +(590, 186, 2, 8, '{}', 1487957308, 1487957468, '2017-02-24', 0, 1487957465, 6960.00), +(591, 186, 3, 7, '{}', 1487957312, 1487957473, '2017-02-24', 0, 1487957469, 6960.00), +(592, 194, 1, 8, '{}', 1488193293, 1488203412, '2017-02-27', 1, 1488193280, 2320.00), +(593, 194, 2, 8, '{}', 1488193304, 1488193304, '2017-02-27', 1, 1488193303, 2320.00), +(594, 210, 1, 9, '{}', 1488198896, 1488198896, '2017-02-27', 0, 1488198885, 4270.00), +(595, 210, 2, 12, '{}', 1488198901, 1488198901, '2017-02-27', 1, 1488532585, 4270.00), +(596, 210, 3, 10, '{}', 1488198904, 1488198904, '2017-02-27', 1, 1488532565, 4270.00), +(597, 209, 2, 9, '{}', 1488200016, 1488450772, '2017-02-27', 1, 1488450449, 4270.00), +(598, 209, 1, 9, '{}', 1488200020, 1488200063, '2017-02-27', 1, 1488200017, 4271.00), +(599, 209, 3, 7, '{}', 1488200053, 1488200053, '2017-02-27', 0, 1488200021, 4271.00), +(600, 211, 2, 10, '{}', 1488216265, 1489402027, '2017-02-27', 1, 1488216264, 2320.00), +(601, 211, 3, 7, '{}', 1488216281, 1488216281, '2017-02-27', 1, 1488216276, 2320.00), +(602, 211, 1, 10, '{}', 1488216283, 1488216283, '2017-02-27', 1, 1488216282, 2320.00), +(603, 198, 2, 11, '{}', 1488280125, 1488280125, '2017-02-28', 0, 1488280095, 4270.00), +(604, 198, 1, 11, '{}', 1488280160, 1488280160, '2017-02-28', 0, 1488280126, 4270.00), +(605, 198, 3, 8, '{}', 1488280440, 1488280440, '2017-02-28', 0, 1488280435, 4270.00), +(606, 212, 1, 12, '{}', 1488286301, 1489402168, '2017-02-28', 1, 1488286295, 13825.00), +(607, 212, 3, 8, '{}', 1488289644, 1488289690, '2017-02-28', 1, 1488289642, 25295.00), +(608, 212, 2, 13, '{}', 1488290350, 1488290431, '2017-02-28', 1, 1488290347, 13133.75), +(609, 213, 1, 11, '{}', 1488529470, 1488529470, '2017-03-03', 1, 1488529461, 5660.00), +(610, 213, 2, 11, '{}', 1488529484, 1488529484, '2017-03-03', 1, 1488529479, 5660.00), +(611, 213, 3, 9, '{}', 1488529493, 1488529493, '2017-03-03', 1, 1488529489, 5660.00), +(612, 197, 2, 13, '{}', 1489400715, 1489400715, '2017-03-13', 0, 1489398959, 4270.00), +(613, 219, 3, 11, '{}', 1490084337, 1490181958, '2017-03-21', 1, 1490084334, 73526.00), +(614, 216, 3, 11, '{}', 1490085757, 1490086717, '2017-03-21', 0, 1490085755, 5377.00); + +SELECT * FROM +(SELECT @row := @row + 1 as row, a.* from ( + SELECT t.order_number + FROM sales_documents t + WHERE + t.type = 2 AND + t.date >= '2017-01-01' AND + t.date <= '2017-12-31' AND + t.order_number IS NOT NULL AND + t.generated = 1 + GROUP BY t.order_number +) a, (SELECT @row := 0) r) t +WHERE row <> order_number; + +DROP TABLE sales_documents; + +--echo # +--echo # MDEV-12845: pushdown from merged derived using equalities +--echo # + +create table t1 (a int); +insert into t1 values + (4), (8), (5), (3), (10), (2), (7); + +create table t2 (b int, c int); +insert into t2 values + (2,1), (5,2), (2,2), (4,1), (4,3), + (5,3), (2,4), (4,6), (2,1); + +create view v1 as +select b, sum(c) as s from t2 group by b; + +create view v2 as +select distinct b, c from t2; + +create view v3 as +select b, max(c) as m from t2 group by b; + +let $q1= +select b +from ( select t1.a, v1.b, v1.s from t1, v1 where t1.a = v1.b ) as t +where b > 2; + +eval $q1; +eval explain format=json $q1; + +let $q2= +select a +from ( select t1.a, v1.b, v1.s from t1, v1 where t1.a = v1.b ) as t +where a > 2; + +eval $q2; +eval explain format=json $q2; + +let $q3= +select a +from ( select t1.a, v2.b, v2.c from t1, v2 where t1.a = v2.b ) as t +where a > 2; + +eval $q3; +eval explain format=json $q3; + +let $q4= +select a +from ( select t1.a, v3.b, v3.m from t1, v3 where t1.a = v3.m ) as t +where a > 2; + +eval $q4; +eval explain format=json $q4; + +drop view v1,v2,v3; +drop table t1,t2; + +--echo # +--echo # MDEV-13166: pushdown from merged derived +--echo # + +CREATE TABLE t1 (i int) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +CREATE VIEW v1 AS SELECT MAX(i) AS f FROM t1; + +let $q= +SELECT * FROM ( SELECT * FROM v1 ) AS sq WHERE f > 0; + +eval $q; +eval explain format=json $q; + +DROP VIEW v1; +DROP TABLE t1; + +--echo # +--echo # MDEV-13193: pushdown of equality extracted from multiple equality +--echo # + +CREATE TABLE t1 (i1 int, KEY(i1)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); + +CREATE TABLE t2 (i2 int) ENGINE=MyISAM; +INSERT INTO t2 VALUES (2),(4); + +CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; + +let $q= +SELECT * FROM t1, ( SELECT * FROM v2 ) AS sq + WHERE i1 = 1 AND ( i1 = i2 OR i1 = 2 ); + +eval $q; +eval explain format=json $q; + +DROP VIEW v2; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-14237: derived with regexp_substr() in select list +--echo # + +create table t1 (a char(8)); +insert into t1 values ('b'), ('a'), ('xx'); + +let $q= +select * +from ( select distinct regexp_substr(t1.a,'^[A-Za-z]+') as f from t1) as t +where t.f = 'a' or t.f = 'b'; + +eval $q; +eval explain format=json $q; + +drop table t1; + +--echo # +--echo # MDEV-13454: consequence of mdev-14368 fixed for 5.5 +--echo # + +SET sql_mode = 'ONLY_FULL_GROUP_BY'; + +create table t1 (id int, id2 int); +insert into t1 values (1,1),(2,3),(3,4),(7,2); + +create table t2(id2 int); +insert t2 values (1),(2),(3); + +let $q= +SELECT * FROM t1 + LEFT OUTER JOIN + (SELECT id2, COUNT(*) as ct FROM t2 GROUP BY id2) vc USING (id2) +WHERE (vc.ct>0); + +eval $q; +eval EXPLAIN FORMAT=JSON $q; + +DROP TABLE t1,t2; + +SET sql_mode = DEFAULT; + +--echo # +--echo # MDEV-15579: incorrect removal of sub-formulas to be pushed +--echo # into WHERE of materialized derived with GROUP BY +--echo # + +CREATE TABLE t1 (a INT, b INT, c INT, d INT); +CREATE TABLE t2 (x INT, y INT, z INT); + +INSERT INTO t1 VALUES (1,1,66,1), (1,1,56,2), (3,2,42,3); +INSERT INTO t2 VALUES (1,1,66), (1,12,32); + +let $query= +SELECT * +FROM t2, +( + SELECT a, b, max(c) AS max_c + FROM t1 + GROUP BY a + HAVING max_c > 37 +) AS v1 +WHERE (v1.a=1) AND (v1.b=v1.a) AND + (v1.a=t2.x) AND (v1.max_c>30); +eval $query; +eval EXPLAIN $query; +eval EXPLAIN FORMAT=JSON $query; + +let $query= +SELECT * +FROM t2, +( + SELECT a, b, d, max(c) AS max_c + FROM t1 + GROUP BY a,d + HAVING max_c > 37 +) AS v1 +WHERE (v1.a=1) AND (v1.b=v1.a) AND (v1.b=v1.d) AND + (v1.a=t2.x) AND (v1.max_c>30); +eval $query; +eval EXPLAIN $query; +eval EXPLAIN FORMAT=JSON $query; + +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-15765: pushing condition with temporal constants +--echo # into constant tables +--echo # + +select * from (select date('2018-01-01') as d + union all + select date('2018-01-01') as d) as t + where t.d between date ('2017-01-01') and date ('2019-01-01'); + +select * from (select date('2018-01-01') as d) as t + where t.d between date ('2017-01-01') and date ('2019-01-01'); + +--echo # +--echo # MDEV-16088: pushdown into derived defined in the IN subquery +--echo # + +CREATE TABLE t1 (a INT, b INT); +CREATE TABLE t2 (e INT, f INT, g INT); +INSERT INTO t1 VALUES (1,14),(2,13),(1,19),(2,32),(3,24); +INSERT INTO t2 VALUES (1,19,2),(3,24,1),(1,12,2),(3,11,3),(2,32,1); + +let $query= +SELECT * FROM t1 +WHERE (t1.a,t1.b) IN + ( + SELECT d_tab.e,d_tab.max_f + FROM ( + SELECT t2.e, MAX(t2.f) AS max_f + FROM t2 + GROUP BY t2.e + HAVING max_f>18 + ) as d_tab + WHERE d_tab.e>1 + ) +; +eval $query; +eval EXPLAIN $query; +eval EXPLAIN FORMAT=JSON $query; + +let $query= +SELECT * FROM t1 +WHERE (t1.a,t1.b) IN + ( + SELECT d_tab.e,d_tab.max_f + FROM ( + SELECT t2.e, MAX(t2.f) AS max_f + FROM t2 + GROUP BY t2.e + HAVING max_f>18 + ) as d_tab + WHERE d_tab.max_f<25 + ) +; +eval $query; +eval EXPLAIN $query; +eval EXPLAIN FORMAT=JSON $query; + +let $query= +SELECT * FROM t1 +WHERE (t1.a,t1.b) IN + ( + SELECT d_tab.e, MAX(d_tab.max_f) AS max_f + FROM ( + SELECT t2.e, MAX(t2.f) as max_f, t2.g + FROM t2 + GROUP BY t2.e + ) as d_tab + WHERE d_tab.e>1 + GROUP BY d_tab.g + ) +; +eval $query; +eval EXPLAIN $query; +eval EXPLAIN FORMAT=JSON $query; + +let $query= +SELECT * FROM t1 +WHERE (t1.a,t1.b) IN + ( + SELECT d_tab.e, MAX(d_tab.max_f) AS max_f + FROM ( + SELECT t2.e, MAX(t2.f) as max_f, t2.g + FROM t2 + GROUP BY t2.e + ) as d_tab + WHERE d_tab.max_f>20 + GROUP BY d_tab.g + ) +; +eval $query; +eval EXPLAIN $query; +eval EXPLAIN FORMAT=JSON $query; + +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-15765: pushing condition with IN subquery defined with constants +--echo # using substitution +--echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +SELECT * FROM +( + SELECT DISTINCT * FROM t1 +) der_tab +WHERE (a>0 AND a<2 OR a IN (2,3)) AND + (a=2 OR 0); + +DROP TABLE t1; + +--echo # +--echo # MDEV-16386: pushing condition into the HAVING clause when ambiguous +--echo # fields warning appears +--echo # + +CREATE TABLE t1 (a INT, b INT); + +INSERT INTO t1 VALUES (1,2),(2,3),(3,4); + +let $query= +SELECT * FROM +( + SELECT t1.b AS a + FROM t1 + GROUP BY t1.a +) dt +WHERE (dt.a=2); +eval $query; +eval EXPLAIN FORMAT=JSON $query; + +let $query= +SELECT * FROM +( + SELECT t1.b AS a + FROM t1 + GROUP BY t1.a + HAVING (t1.a<3) +) dt +WHERE (dt.a>1); +eval $query; +eval EXPLAIN FORMAT=JSON $query; + +let $query= +SELECT * FROM +( + SELECT 'ab' AS a + FROM t1 + GROUP BY t1.a +) dt +WHERE (dt.a='ab'); +eval $query; +eval EXPLAIN FORMAT=JSON $query; + +let $query= +SELECT * FROM +( + SELECT 1 AS a + FROM t1 + GROUP BY t1.a +) dt +WHERE (dt.a=1); +eval $query; +eval EXPLAIN FORMAT=JSON $query; + +DROP TABLE t1; + +--echo # +--echo # MDEV-16517: pushdown condition with the IN predicate defined +--echo # with non-constant values +--echo # + +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,2),(1,3); + +let $query= +SELECT * FROM +( + SELECT t1.a + FROM t1 + WHERE 1 IN (0,t1.a) + GROUP BY t1.a +) AS dt1 +JOIN +( + SELECT t1.a + FROM t1 + WHERE 1 IN (0,t1.a) +) AS dt2 +ON dt1.a = dt2.a; +eval $query; +eval EXPLAIN FORMAT=JSON $query; + +let $query= +SELECT * FROM +( + SELECT t1.a,MAX(t1.b) + FROM t1 + GROUP BY t1.a +) AS dt, t1 +WHERE dt.a=t1.a AND dt.a IN (1,t1.a); +eval $query; +eval EXPLAIN FORMAT=JSON $query; +DROP TABLE t1; + +--echo # +--echo # MDEV-15087: error from inexpensive subquery before check +--echo # for condition pushdown into derived +--echo # + +CREATE TABLE t1 (i1 int, v1 varchar(1)); +INSERT INTO t1 VALUES (7,'x'); + +CREATE TABLE t2 (i1 int); +INSERT INTO t2 VALUES (8); + +CREATE TABLE t3 (i1 int ,v1 varchar(1), v2 varchar(1)); +INSERT INTO t3 VALUES (4, 'v','v'),(62,'v','k'),(7, 'n', NULL); + +--error ER_SUBQUERY_NO_1_ROW +SELECT 1 +FROM (t1 AS a1 + JOIN (((SELECT DISTINCT t3.* + FROM t3) AS a2 + JOIN t1 ON (t1.v1 = a2.v2))) ON (t1.v1 = a2.v1)) +WHERE (SELECT BIT_COUNT(t2.i1) + FROM (t2 JOIN t3)) IS NULL; + +DROP TABLE t1, t2, t3; + +--echo # +--echo # MDEV-16614 signal 7 after calling stored procedure, that uses regexp +--echo # + +DELIMITER $$; +CREATE PROCEDURE p1(m1 varchar(5), m2 varchar(5)) +BEGIN +SELECT a FROM + (SELECT "aa" a) t + JOIN (SELECT "aa" b) t1 on t.a=t1.b +WHERE t.a regexp m1 and t1.b regexp m2 +GROUP BY a; +END$$ +DELIMITER ;$$ +CALL p1('a','a'); +DROP PROCEDURE p1; + + +DELIMITER $$; +CREATE PROCEDURE p1(m1 varchar(5)) +BEGIN + SELECT a FROM (SELECT "aa" a) t WHERE t.a regexp m1; +END$$ +DELIMITER ;$$ +CALL p1('a'); +DROP PROCEDURE p1; + + +SELECT a FROM (SELECT "aa" a) t WHERE REGEXP_INSTR(t.a, (SELECT MAX('aa') FROM DUAL LIMIT 1)); + + +DELIMITER $$; +CREATE OR REPLACE FUNCTION f1(a VARCHAR(10), b VARCHAR(10)) RETURNS INT +BEGIN + RETURN 1; +END;$$ +CREATE OR REPLACE PROCEDURE p1(m1 varchar(5)) +BEGIN + SELECT a FROM (SELECT "aa" a) t WHERE f1(t.a, m1); +END$$ +DELIMITER ;$$ +CALL p1('a'); +DROP PROCEDURE p1; +DROP FUNCTION f1; + + +DELIMITER $$; +CREATE OR REPLACE FUNCTION f1(a VARCHAR(10), b VARCHAR(10)) RETURNS INT +BEGIN + RETURN 1; +END;$$ +DELIMITER ;$$ +SELECT a FROM (SELECT "aa" a) t WHERE f1(t.a, (SELECT MAX('aa') FROM DUAL LIMIT 1)); +DROP FUNCTION f1; + +--echo # +--echo # MDEV-17011: condition pushdown into materialized derived used +--echo # in INSERT SELECT, multi-table UPDATE and DELETE +--echo # + +CREATE TABLE t1 (a int ,b int) ENGINE=MyISAM; +INSERT INTO t1 VALUES + (1, 1), (1, 2), (2, 1), (2, 2), (3,1), (3,3), (4,2); + +CREATE TABLE t2 (a int) ENGINE MYISAM; +INSERT INTO t2 VALUES + (3), (7), (1), (4), (1); + +CREATE TABLE t3 (a int, b int) ENGINE MYISAM; + +let $q1= +INSERT INTO t3 +SELECT * FROM (SELECT a, count(*) as c FROM t1 GROUP BY a) t WHERE a<=2; + +eval EXPLAIN FORMAT=JSON $q1; +eval $q1; + +SELECT * FROM t3; + +let $q2= +UPDATE t2, (SELECT a, count(*) as c FROM t1 GROUP BY a) t SET t2.a=t.c+10 + WHERE t2.a= t.c and t.a>=3; + +eval EXPLAIN FORMAT=JSON $q2; +eval $q2; + +SELECT * FROM t2; + +let $q3= +DELETE t2 FROM t2, (SELECT a, count(*) as c FROM t1 GROUP BY a) t + WHERE t2.a= t.c+9 and t.a=2; + +eval EXPLAIN FORMAT=JSON $q3; +eval $q3; + +SELECT * FROM t2; + +DROP TABLE t1,t2,t3; + +--echo # +--echo # MDEV-16765: pushdown condition with the CASE structure +--echo # defined with Item_cond item +--echo # + +CREATE TABLE t1(a INT, b INT); +INSERT INTO t1 VALUES (1,2), (3,4), (2,3); + +LET $query= +SELECT * +FROM +( + SELECT CASE WHEN ((tab2.max_a=1) OR (tab2.max_a=2)) + THEN 1 ELSE 0 END AS max_a,b + FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 +) AS tab1 +WHERE (tab1.max_a=1); +EVAL $query; +EVAL EXPLAIN FORMAT=JSON $query; + +LET $query= +SELECT * +FROM +( + SELECT CASE WHEN ((tab2.max_a=1) OR ((tab2.max_a>2) AND (tab2.max_a<4))) + THEN 1 ELSE 0 END AS max_a,b + FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 +) AS tab1 +WHERE (tab1.max_a=1); +EVAL $query; +EVAL EXPLAIN FORMAT=JSON $query; + +LET $query= +SELECT * +FROM +( + SELECT CASE WHEN ((tab2.max_a>1) AND ((tab2.max_a=2) OR (tab2.max_a>2))) + THEN 1 ELSE 0 END AS max_a,b + FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 +) AS tab1 +WHERE (tab1.max_a=1); +EVAL $query; +EVAL EXPLAIN FORMAT=JSON $query; + +LET $query= +SELECT * +FROM +( + SELECT CASE WHEN ((tab2.b=2) OR (tab2.b=4)) + THEN 1 ELSE 0 END AS max_a,b + FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 +) AS tab1 +WHERE (tab1.max_a=1); +EVAL $query; +EVAL EXPLAIN FORMAT=JSON $query; + +DROP TABLE t1; + +--echo # +--echo # MDEV-16803: pushdown condition with IN predicate in the derived table +--echo # defined with several SELECT statements +--echo # + +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,2),(3,2),(1,1); + +SELECT * FROM +( + SELECT a,b,1 as c + FROM t1 + UNION ALL + SELECT a,b,2 as c + FROM t1 +) AS tab +WHERE ((a,b) IN ((1,2),(3,2))); + +DROP TABLE t1; + +--echo # +--echo # MDEV-17354: INSERT SELECT with condition pushdown into derived +--echo # + +CREATE TABLE t1 (f INT NOT NULL); +INSERT INTO t1 VALUES (3), (7), (3); + +CREATE ALGORITHM= TEMPTABLE VIEW v1 AS SELECT * FROM ( SELECT * FROM t1 ) AS sq; + +let $q1= +INSERT INTO t1 +SELECT * FROM ( SELECT t1.f FROM v1 JOIN t1 ) AS t WHERE f IS NOT NULL; + +eval $q1; +eval EXPLAIN $q1; +eval EXPLAIN FORMAT=JSON $q1; +SELECT * FROM t1; + +DELETE FROM t1; +INSERT INTO t1 VALUES (3), (7), (3); + +let $q2= +INSERT INTO t1 +SELECT * FROM ( SELECT t1.f FROM v1 JOIN t1 ON v1.f=t1.f) AS t + WHERE f IS NOT NULL; + +eval $q2; +eval EXPLAIN FORMAT=JSON $q2; +SELECT * FROM t1; + +DROP VIEW v1; +DROP TABLE t1; + +--echo # +--echo # MDEV-17574: pushdown into derived from mergeable view +--echo # used in multi-table UPDATE +--echo # pushdown into materialized derived from mergeable view +--echo # used in SELECT +--echo # + +CREATE TABLE t1 (f1 text, f2 int); +INSERT INTO t1 VALUES ('x',1), ('y',2); + +CREATE VIEW v1 AS SELECT f2 FROM ( SELECT f2 FROM t1 ) AS t; +let $q1 = +UPDATE v1, t1 SET t1.f1 = 'z' WHERE v1.f2 < 2 AND t1.f2 = v1.f2; +eval $q1; +eval EXPLAIN FORMAT=JSON $q1; + +SELECT * FROM t1; + +CREATE VIEW v2 AS SELECT f2 FROM ( SELECT DISTINCT f2 FROM t1 ) AS t; +let $q2 = +SELECT * FROM v2, t1 WHERE v2.f2 < 2 AND t1.f2 = v2.f2; +eval $q2; +eval EXPLAIN FORMAT=JSON $q2; + +DROP VIEW v1,v2; +DROP TABLE t1; + +--echo # +--echo # MDEV-18383: pushdown condition with the IF structure +--echo # defined with Item_cond item +--echo # + +CREATE TABLE t1(a INT, b INT); +CREATE TABLE t2(c INT, d INT); +INSERT INTO t1 VALUES (1,2),(3,4),(5,6); +INSERT INTO t2 VALUES (1,3),(3,7),(5,1); + +SELECT * +FROM t1, +( + SELECT MAX(d) AS max_d,c + FROM t2 + GROUP BY c +) AS tab +WHERE t1.a=tab.c AND + IF(2,t1.a=1 OR t1.b>5,1=1); + +DROP TABLE t1,t2; + ++--echo # ++--echo # MDEV-19139: pushdown condition with Item_func_set_user_var ++--echo # ++ ++CREATE TABLE t1 (a INT, b INT); ++CREATE VIEW v1 AS SELECT a, MAX(b) FROM t1 GROUP BY a; ++ ++SELECT * FROM (SELECT 1 FROM v1 UNION (SELECT 1 FROM v1 WHERE @a := uuid())) dt; ++EXPLAIN FORMAT=JSON ++SELECT * FROM (SELECT 1 FROM v1 UNION (SELECT 1 FROM v1 WHERE @a := uuid())) dt; ++ ++DROP TABLE t1; ++DROP VIEW v1; ++ +--echo # End of 10.2 tests + +--echo # +--echo # MDEV-14579: pushdown conditions into materialized views/derived tables +--echo # that are defined with EXIST or/and INTERSECT +--echo # + +create table t1 (a int, b int, c int); +create table t2 (a int, b int, c int); + +insert into t1 values + (1,21,345), (1,33,7), (8,33,114), (1,21,500), (1,19,117), (5,14,787), + (8,33,123), (9,10,211), (5,16,207), (1,33,988), (5,27,132), (1,21,104), + (6,20,309), (6,20,315), (1,21,101), (4,33,404), (9,10,800), (1,21,123); + +insert into t2 values + (2,3,207), (1,16,909), (5,14,312), + (5,33,207), (6,20,211), (1,19,132), + (8,33,117), (3,21,231), (6,23,303); + +create view v1 as + select a, b, min(c) as c from t1 + where t1.a<9 group by a,b having c < 300 + intersect + select a, b, min(c) as c from t1 + where t1.b>10 group by a,b having c > 100; + +--echo # using intersect in view definition +--echo # conjunctive subformulas : pushing into WHERE +let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a<5); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using intersect in view definition +--echo # conjunctive subformulas : pushing into WHERE +--echo # pushing equalities +let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a=8); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using intersect in view definition +--echo # conjunctive subformulas : pushing into WHERE using equalities +let $query= select * from v1,t2 where (v1.a=t2.a) and (t2.a=8); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using intersect in view definition +--echo # conjunctive subformulas : pushing into HAVING +let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.c>200); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using intersect in view definition +--echo # conjunctive subformulas : pushing into WHERE +--echo # conjunctive subformulas : pushing into HAVING +let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a<5) and (v1.c>110); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using intersect in view definition +--echo # extracted or formula : pushing into WHERE +let $query= + select * from v1,t2 where (v1.a=t2.a) and ((v1.b>27) or (v1.b<19)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using intersect in view definition +--echo # extracted or formula : pushing into HAVING +let $query= + select * from v1,t2 where + (v1.a=t2.a) and ((v1.c>200) or (v1.c<105)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using intersect in view definition +--echo # extracted or formula : pushing into WHERE +--echo # extracted or formula : pushing into HAVING using equalities +--echo # pushing equalities +let $query= + select * from v1,t2 where + ((v1.a>3) and (t2.c>110) and (v1.c=t2.c)) or + ((v1.a=1) and (v1.c<110)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using intersect in view definition +--echo # prepare of a query +--echo # conjunctive subformulas : pushing into WHERE +--echo # conjunctive subformulas : pushing into HAVING +prepare stmt from "select * from v1,t2 + where (v1.a=t2.a) and (v1.a<5) and (v1.c>110);"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +--echo # using intersect in derived table definition +--echo # extracted or formula : pushing into WHERE using equalities +--echo # extracted or formula : pushing into HAVING +--echo # pushing equalities +let $query= + select * + from t2, + (select a, b, min(c) as c from t1 + where t1.a<9 group by a,b having c < 300 + intersect + select a, b, min(c) as c from t1 + where t1.b>10 group by a,b having c > 100) as d1 + where + (d1.b=t2.b) and + (((t2.b>13) and (t2.c=909)) or + ((d1.a<4) and (d1.c<200))); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +drop view v1; + +create view v1 as + select a, b, max(c) as c from t1 + where t1.a<9 group by a,b having c > 200 + except + select a, b, max(c) as c from t1 + where t1.b>10 group by a,b having c < 300; + +--echo # using except in view definition +--echo # conjunctive subformulas : pushing into WHERE +let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a<5); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using except in view definition +--echo # conjunctive subformulas : pushing into WHERE +--echo # pushing equalities +let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a=6); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using except in view definition +--echo # conjunctive subformulas : pushing into WHERE using equalities +let $query= select * from v1,t2 where (v1.a=t2.a) and (t2.a=6); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using except in view definition +--echo # conjunctive subformulas : pushing into HAVING +let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.c>500); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using except in view definition +--echo # conjunctive subformulas : pushing into WHERE +--echo # conjunctive subformulas : pushing into HAVING +let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a<5) and (v1.c>500); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using except in view definition +--echo # extracted or formula : pushing into WHERE +let $query= + select * from v1,t2 where (v1.a=t2.a) and ((v1.b>27) or (v1.b<19)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using except in view definition +--echo # extracted or formula : pushing into HAVING +let $query= + select * from v1,t2 where + (v1.a=t2.a) and ((v1.c<400) or (v1.c>800)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using except in view definition +--echo # extracted or formula : pushing into WHERE +--echo # extracted or formula : pushing into HAVING using equalities +--echo # pushing equalities +let $query= + select * from v1,t2 where + (v1.c=t2.c) and + ((v1.a>1) and (t2.c<500)) or + ((v1.a=1) and (v1.c>500)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using except in view definition +--echo # prepare of a query +--echo # conjunctive subformulas : pushing into WHERE +--echo # conjunctive subformulas : pushing into HAVING +prepare stmt from "select * from v1,t2 + where (v1.a=t2.a) and (v1.a<5) and (v1.c>500);"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +--echo # using except in view definition +--echo # extracted or formula : pushing into WHERE using equalities +--echo # extracted or formula : pushing into HAVING +--echo # pushing equalities +let $query= + select * + from t2, + (select a, b, max(c) as c from t1 + where t1.a<9 group by a,b having c > 200 + except + select a, b, max(c) as c from t1 + where t1.b>10 group by a,b having c < 300) as d1 + where + (d1.b=t2.b) and + (((t2.b>13) and (t2.c=988)) or + ((d1.a>4) and (d1.c>500))); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +drop view v1; + +--echo # using union and intersect in view definition +--echo # conjunctive subformulas : pushing into WHERE and HAVING +create view v1 as + select a, b, min(c) as c from t1 + where t1.a<9 group by a,b having c > 200 + union + select a, b, max(c) as c from t1 + where t1.b>10 group by a,b having c < 300 + intersect + select a, b, max(c) as c from t1 + where t1.a>3 group by a,b having c < 530; + +let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a>5) and (v1.c>200); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +drop view v1; + +--echo # using union and intersect in view definition +--echo # conjunctive subformulas : pushing into WHERE and HAVING +create view v1 as + select a, b, min(c) as c from t1 + where t1.a<9 group by a,b having c > 200 + intersect + select a, b, max(c) as c from t1 + where t1.a>3 group by a,b having c < 500 + union + select a, b, max(c) as c from t1 + where t1.b>10 group by a,b having c < 300; + +let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<200); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +drop view v1; + +--echo # using union and except in view definition +--echo # conjunctive subformulas : pushing into WHERE and HAVING +create view v1 as + select a, b, min(c) as c from t1 + where t1.a<9 group by a,b having c > 200 + union + select a, b, max(c) as c from t1 + where t1.b>10 group by a,b having c < 300 + except + select a, b, max(c) as c from t1 + where t1.a>3 group by a,b having c < 530; + +let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a>5) and (v1.c>200); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +drop view v1; + +--echo # using union and except in view definition +--echo # conjunctive subformulas : pushing into WHERE and HAVING +create view v1 as + select a, b, min(c) as c from t1 + where t1.a<9 group by a,b having c > 200 + except + select a, b, max(c) as c from t1 + where t1.a>3 group by a,b having c < 500 + union + select a, b, max(c) as c from t1 + where t1.b>10 group by a,b having c < 300; + +let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<200); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +drop view v1; + +--echo # using except and intersect in view definition +--echo # conjunctive subformulas : pushing into WHERE and HAVING +create view v1 as + select a, b, max(c) as c from t1 + where t1.b>10 group by a,b having c < 300 + intersect + select a, b, max(c) as c from t1 + where t1.a<7 group by a,b having c < 500 + except + select a, b, max(c) as c from t1 + where t1.a<9 group by a,b having c > 150; + +let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<150); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +drop view v1; + +--echo # using except and intersect in view definition +--echo # conjunctive subformulas : pushing into WHERE and HAVING +create view v1 as + select a, b, max(c) as c from t1 + where t1.b>10 group by a,b having c < 300 + except + select a, b, max(c) as c from t1 + where t1.a<9 group by a,b having c > 150 + intersect + select a, b, max(c) as c from t1 + where t1.a<7 group by a,b having c < 500; + +let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<130); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +drop view v1; + +--echo # using except, intersect and union in view definition +--echo # conjunctive subformulas : pushing into WHERE and HAVING +create view v1 as + select a, b, max(c) as c from t1 + where t1.b>10 group by a,b having c < 300 + except + select a, b, max(c) as c from t1 + where t1.a<9 group by a,b having c > 150 + intersect + select a, b, max(c) as c from t1 + where t1.a<7 group by a,b having c < 500 + union + select a, b, max(c) as c from t1 + where t1.a<7 group by a,b having c < 120; + +let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<130); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +drop view v1; + +--echo # using intersect in view definition +--echo # using embedded view +--echo # conjunctive subformulas : pushing into WHERE and HAVING +create view v1 as + select a, b, max(c) as c from t1 + where t1.b>10 group by a,b having c < 300 + intersect + select a, b, max(c) as c from t1 + where t1.a<9 group by a,b having c > 120; + +create view v2 as + select a, b, max(c) as c from v1 + where v1.a<7 group by a,b; + +let $query= select * from v2,t2 where (v2.a=t2.a) and (v2.a>4) and (v2.c<150); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +drop view v1,v2; + +--echo # using except in view definition +--echo # using embedded view +--echo # conjunctive subformulas : pushing into WHERE and HAVING +create view v1 as + select a, b, max(c) as c from t1 + where t1.b>10 group by a,b having c < 300 + except + select a, b, max(c) as c from t1 + where t1.a<9 group by a,b having c > 150; + +create view v2 as + select a, b, max(c) as c from v1 + where v1.a<7 group by a,b; + +let $query= select * from v2,t2 where (v2.a=t2.a) and (v2.a>4) and (v2.c<150); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +drop view v1,v2; + +--echo # using intersect in view definition +--echo # conditions are pushed in different parts of selects +--echo # conjunctive subformulas : pushing into WHERE and HAVING +create view v1 as + select a, b, max(c) as c from t1 + where t1.a<9 group by a having c > 300 + intersect + select a, b, max(c) as c from t1 + where t1.b<21 group by b having c > 200; + +let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.b>12) and (v1.c<450); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +drop view v1; + +--echo # using except in view definition +--echo # conditions are pushed in different parts of selects +--echo # conjunctive subformulas : pushing into WHERE and HAVING +create view v1 as + select a, b, max(c) as c from t1 + where t1.b>20 group by a having c > 300 + except + select a, b, max(c) as c from t1 + where t1.a<7 group by b having c > 150; + +let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a<2) and (v1.b<30) and (v1.c>450); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +drop view v1; + +--echo # using except and union in view definition +--echo # conditions are pushed in different parts of selects +--echo # conjunctive subformulas : pushing into HAVING +--echo # extracted or formula : pushing into WHERE +--echo # extracted or formula : pushing into HAVING +create view v1 as + select a, b, max(c) as c from t1 + where t1.b>20 group by a having c > 300 + except + select a, b, max(c) as c from t1 + where t1.a<7 group by b having c > 150; + +let $query= select * from v1,t2 where (v1.a=t2.a) and ((v1.a<2) or (v1.a<5)) and (v1.c>450); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +drop view v1; + +--echo # using union and intersect in view definition +--echo # conditions are pushed in different parts of selects +--echo # conjunctive subformulas : pushing into WHERE and HAVING +create view v1 as + select a, b, max(c) as c from t1 + where t1.a<9 group by a having c > 100 + intersect + select a, b, max(c) as c from t1 + where t1.a>3 group by b having c < 800 + union + select a, b, max(c) as c from t1 + where t1.b>10 group by a,b having c > 300; + +let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a>1) and (v1.b > 12) and (v1.c>400); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +drop view v1; + +create table t3 (a int, b int, c int); +insert into t3 values + (1,21,345), (2,33,7), (8,33,114), (3,21,500), (1,19,107), (5,14,787), + (4,33,123), (9,10,211), (11,16,207), (10,33,988), (5,27,132), (12,21,104), + (6,20,309), (16,20,315), (16,21,101), (18,33,404), (19,10,800), (10,21,123), + (17,11,708), (6,20,214); + +create index i1 on t3(a); + +--echo # conjunctive subformulas : pushing into WHERE +--echo # pushed condition gives range access +create view v1 as + select a, b, max(c) as max_c from t3 + where a>0 group by a; + +let $query= select * from v1,t2 where (v1.b=t2.b) and (v1.a<5); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +drop view v1; + +--echo # using union in view definition +--echo # conjunctive subformulas : pushing into WHERE +--echo # pushed condition gives range access +create view v1 as + select a, b, max(c) as c from t3 + where t3.a>1 group by a + union + select a, b, max(c) as c from t3 + where t3.a>2 group by a; + +let $query= select * from v1,t2 where (v1.b=t2.b) and (v1.a<4); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +drop view v1; + +--echo # using union in view definition +--echo # conjunctive subformulas : pushing into WHERE +--echo # pushed condition gives range access in one of the selects +create view v1 as + select a, b, max(c) as c from t3 + where t3.a>1 group by a + union + select a, b, max(c) as c from t3 + where t3.b<21 group by b; + +let $query= select * from v1,t2 where (v1.b=t2.b) and (v1.a<3); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +drop view v1; + +alter table t3 drop index i1; + +drop table t1,t2,t3; + +--echo # +--echo # MDEV-10855: Pushdown into derived with window functions +--echo # + +set @save_optimizer_switch= @@optimizer_switch; +set optimizer_switch='split_materialized=off'; + +create table t1 (a int, c varchar(16)); +insert into t1 values +(8,'aa'), (5,'cc'), (1,'bb'), (2,'aa'), (9,'cc'), +(7,'aa'), (2,'aa'), (7,'bb'); + +create table t2 (a int, b int, c varchar(16), index idx(a,c)); +insert into t2 values + (7,10,'cc'), (1,20,'aa'), (2,23,'bb'), (7,18,'cc'), (1,30,'bb'), + (4,71,'xx'), (3,15,'aa'), (7,82,'bb'), (8,12,'dd'), (4,15,'aa'), + (11,33,'yy'), (10,42,'zz'), (4,53,'xx'), (10,17,'yy'), (7,12,'bb'), + (8,20,'dd'), (7,32,'bb'), (1,50,'aa'), (3,40,'bb'), (3,77,'aa'); + +let $q1= +select * from (select a, c, sum(b) over (partition by a,c) from t2) as t + where t.a > 2 and t.c in ('aa','bb','cc'); + +--sorted_result +eval $no_pushdown $q1; +--sorted_result +eval $q1; +eval explain $q1; +eval explain format=json $q1; + +let $q2= +select * from +( + select 1 as n, a, c, sum(b) over (partition by a,c) as s from t2 + union all + select 2 as n, a, c, sum(b) over (partition by a) as s from t2 +) as t +where t.a > 2 and t.c in ('aa','bb','cc'); + +--sorted_result +eval $no_pushdown $q2; +--sorted_result +eval $q2; +eval explain $q2; +eval explain format=json $q2; + +let $q3= +select * +from (select a, c, sum(b) over (partition by a,c) as s from t2) as t, t1 + where t1.a=t.a and t1.c=t.c and t1.c in ('aa','bb','cc'); + +eval $no_pushdown $q3; +eval $q3; +eval explain $q3; +eval explain format=json $q3; + +let $q4= +select * from +( + select 1 as n, a, c, sum(b) over (partition by a,c) as s from t2 + union all + select 2 as n, a, c, sum(b) over (partition by a) as s from t2 + union all + select 3 as n, a, c, sum(b) as s from t2 group by a +) as t +where t.a > 2 and t.c in ('aa','bb','cc'); + +--sorted_result +eval $no_pushdown $q4; +--sorted_result +eval $q4; +eval explain $q4; +eval explain format=json $q4; + +let $q5= +select * from (select a, c, + sum(b) over (partition by a,c) as sum_b, + avg(b) over (partition by a,c) as avg_b + from t2 ) as t + where t.a > 2 and t.c in ('aa','bb','cc'); + +--sorted_result +eval $no_pushdown $q5; +--sorted_result +eval $q5; +eval explain $q5; +eval explain format=json $q5; + +let $q6= +select * from (select a, c, + sum(b) over (partition by a,c) as sum_b, + avg(b) over (partition by a) as avg_b + from t2 ) as t + where t.a > 2 and t.c in ('aa','bb','cc'); + +--sorted_result +eval $no_pushdown $q6; +--sorted_result +eval $q6; +eval explain $q6; +eval explain format=json $q6; + +let $q7= +select * from (select a, c, + sum(b) over (partition by a,c) as sum_b, + avg(b) over (partition by c) as avg_b + from t2 ) as t + where t.a > 2 and t.c in ('aa','bb','cc'); + +--sorted_result +eval $no_pushdown $q7; +--sorted_result +eval $q7; +eval explain $q7; +eval explain format=json $q7; + +drop table t1,t2; + +set optimizer_switch= @save_optimizer_switch; + +--echo # +--echo # MDEV-13369: Optimization for equi-joins of grouping derived tables +--echo # (Splitting derived tables / views with GROUP BY) +--echo # MDEV-13389: Optimization for equi-joins of derived tables with WF +--echo # (Splitting derived tables / views with window functions) +--echo # + +let +$no_splitting= set statement optimizer_switch='split_materialized=off' for; + +create table t1 (a int, b int, index idx_b(b)) engine=myisam; +insert into t1 values +(8,3), (5,7), (1,2), (2,1), (9,7), (7,5), (2,2), (7,3), +(9,3), (8,1), (4,5), (2,3); + +create table t2 (a int, b int, c char(127), index idx_a(a)) engine=myisam; +insert into t2 values + (7,10,'x'), (1,20,'a'), (2,23,'b'), (7,18,'z'), (1,30,'c'), + (4,71,'d'), (3,15,'x'), (7,82,'y'), (8,12,'t'), (4,15,'b'), + (11,33,'a'), (10,42,'u'), (4,53,'p'), (10,17,'r'), (2,90,'x'), + (17,10,'s'), (11,20,'v'), (12,23,'y'), (17,18,'a'), (11,30,'d'), + (24,71,'h'), (23,15,'i'), (27,82,'k'), (28,12,'p'), (24,15,'q'), + (31,33,'f'), (30,42,'h'), (40,53,'m'), (30,17,'o'), (21,90,'b'), + (37,10,'e'), (31,20,'g'), (32,23,'f'), (37,18,'n'), (41,30,'l'), + (54,71,'j'), (53,15,'w'), (57,82,'z'), (58,12,'k'), (54,15,'p'), + (61,33,'c'), (60,42,'a'), (62,53,'x'), (67,17,'g'), (64,90,'v'); + +insert into t2 select a+10, b+10, concat(c,'f') from t2; + +analyze table t1,t2; + +let $q1= +select t1.a,t.s,t.m +from t1 join + (select a, sum(t2.b) as s, min(t2.c) as m from t2 group by t2.a) t + on t1.a=t.a +where t1.b < 3; + +eval $no_splitting $q1; +eval $q1; +eval explain extended $q1; +eval explain format=json $q1; +eval prepare stmt from "$q1"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +let $q10= +select t1.a,t.s,t.m +from t1 join + (select a, sum(t2.b) as s, min(t2.b) as m from t2 group by t2.a) t + on t1.a=t.a +where t1.b <= 5; + +eval $no_splitting $q10; +eval $q10; +eval explain extended $q10; +eval explain format=json $q10; +eval prepare stmt from "$q10"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +delete from t1 where t1.b between 2 and 5; + +let $q2= +select t1.a,t.max,t.min +from t1 left join + (select a, max(t2.b) max, min(t2.b) min from t2 group by t2.a) t + on t1.a=t.a; + +eval $no_splitting $q2; +eval $q2; +eval explain extended $q2; +eval explain format=json $q2; + +create table t3 (a int, b int, c char(127), index idx_b(b)) engine=myisam; +insert into t3 values +(8,11,'aa'), (5,15,'cc'), (1,14,'bb'), (2,12,'aa'), (7,17,'cc'), +(7,18,'aa'), (2,11,'aa'), (7,10,'bb'), (3,11,'dd'), (4,12,'ee'), +(5,14,'dd'), (9,12,'ee'); + +create table t4 (a int, b int, c char(127), index idx(a,c)) engine=myisam; +insert into t4 values + (7,10,'cc'), (1,20,'aa'), (2,23,'bb'), (7,18,'cc'), (1,30,'bb'), + (4,71,'xx'), (3,15,'aa'), (7,82,'aa'), (8,12,'dd'), (4,15,'aa'), + (11,33,'yy'), (10,42,'zz'), (4,53,'xx'), (10,17,'yy'), (7,12,'cc'), + (8,20,'dd'), (7,32,'bb'), (1,50,'aa'), (3,40,'bb'), (3,77,'aa'); + +insert into t4 select a+10, b+10, concat(c,'f') from t4; + +analyze table t3,t4; + +let $q3= +select t3.a,t3.c,t.max,t.min +from t3 join + (select a, c, max(b) max, min(b) min from t4 group by a,c) t + on t3.a=t.a and t3.c=t.c +where t3.b > 15; + +eval $no_splitting $q3; +eval $q3; +eval explain extended $q3; +eval explain format=json $q3; + +let $q30= +select t3.a,t3.c,t.max,t.min +from t3 join + (select a, c, max(b) max, min(b) min from t4 group by a,c) t + on t3.a=t.a and t3.c=t.c +where t3.b <= 15; + +eval $no_splitting $q30; +eval $q30; +eval explain extended $q30; +eval explain format=json $q30; + +let $q4= +select t3.a,t3.c,t.max,t.min +from t3 join + (select a, c, max(b) max, min(b) min from t4 group by c,a) t + on t3.a=t.a and t3.c=t.c +where t3.b > 15; + +eval $no_splitting $q4; +eval $q4; +eval explain extended $q4; +eval explain format=json $q4; + +let $q40= +select t3.a,t3.c,t.max,t.min +from t3 join + (select a, c, max(b) max, min(b) min from t4 group by c,a) t + on t3.a=t.a and t3.c=t.c +where t3.b <= 15; + +eval $no_splitting $q40; +eval $q40; +eval explain extended $q40; +eval explain format=json $q40; + +drop index idx_a on t2; +create index idx on t2(c,b); +create index idx_a on t3(a); +create index idx_c on t4(c); +insert into t3 select a+10, b+10, concat(c,'f') from t3; +insert into t3 select a+100, b+100, concat(c,'g') from t3; +insert into t4 select a+100, b+100, concat(c,'g') from t4; +insert into t4 select a+1000, b+1000, concat(c,'h') from t4; + +analyze table t2,t3,t4; + +let $q5= +select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min +from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t +where t2.b between 80 and 85 and t2.c in ('y','z') and t2.a=t3.a and t3.c=t.c; + +--sorted_result +eval $no_splitting $q5; +--sorted_result +eval $q5; +eval explain extended $q5; +eval explain format=json $q5; + +let $q50= +select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min +from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t +where t2.b < 40 and t2.a=t3.a and t3.c=t.c; + +eval $no_splitting $q50; +eval $q50; +eval explain extended $q50; +eval explain format=json $q50; + +let $q6= +select * +from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t +where t2.b between 80 and 85 and t2.c in ('y','z') and t2.a=t3.a and t3.c=t.c; + +--sorted_result +eval $no_splitting $q6; +--sorted_result +eval $q6; +eval explain extended $q6; +eval explain format=json $q6; + +let $q60= +select * +from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t +where t2.b < 40 and t2.a=t3.a and t3.c=t.c; + +--sorted_result +eval $no_splitting $q60; +--sorted_result +eval $q60; +eval explain extended $q60; +eval explain format=json $q60; + +drop table t1,t2,t3,t4; + +--echo # +--echo # MDEV-13709: Optimization for semi-joins of grouping derived tables +--echo # (Splitting derived tables / views with GROUP BY) +--echo # + +CREATE TABLE t1 (i int); +INSERT INTO t1 VALUES (1),(9),(3); + +CREATE TABLE t2 (a int, i int); +INSERT INTO t2 VALUES (1,9),(2,3),(3,7),(4,1); + +CREATE TABLE t3 (a int, c char(127), index(c)); +INSERT INTO t3 VALUES (1,'foo'),(3,'bar'),(4,'foo'),(2,'bar'); +INSERT INTO t3 SELECT a, concat(c,'a') FROM t3; + +CREATE TABLE t4 (a int, c char(127), index(a)); +INSERT INTO t4 VALUES + (3,'abc'),(1,'foo'),(4,'def'),(8,'xxx'),(3,'yyy'), + (5,'zzz'),(9,'xyz'),(2,'yxz'),(5,'zxy'),(7,'zyx') ; + +ANALYZE TABLE t1,t2,t3,t4; + +CREATE VIEW v1 AS +SELECT c FROM t3 + WHERE a IN ( SELECT t2.a FROM t1 JOIN t2 WHERE t1.i = t2.i ) GROUP BY c ; + +let $q1= +SELECT * FROM t4 WHERE c IN ( SELECT c FROM v1 ) and a < 2; + +eval $no_splitting $q1; +eval $q1; +eval explain extended $q1; +eval explain format=json $q1; + +DROP VIEW v1; +DROP TABLE t1,t2,t3,t4; + +--echo # +--echo # MDEV-13710: Optimization for equi-joins of grouping derived tables +--echo # (Splitting derived tables / views with GROUP BY) : +--echo # FROM list of the derived table contains constant tables +--echo # + +CREATE TABLE t1 (a int, INDEX(a)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (9),(5),(1); + +CREATE TABLE t2 (b int) ENGINE=MyISAM; + +CREATE TABLE t3 (c varchar(8), d int) ENGINE=MyISAM; +INSERT INTO t3 VALUES ('foo',2),('bar',6); + +CREATE VIEW v1 AS SELECT a FROM t1, t2 GROUP BY a; + +SELECT * FROM t3 + WHERE d IN ( SELECT * FROM v1 ) AND c LIKE 'z%' OR c IS NULL; + +DROP VIEW v1; +DROP TABLE t1,t2,t3; + +--echo # +--echo # MDEV-13734: Optimization for equi-joins of grouping derived tables +--echo # (Splitting derived tables / views with GROUP BY) : +--echo # derived table / view is empty +--echo # + +CREATE TABLE t1 (a int, b int, INDEX(a)) ENGINE=MyISAM; +CREATE TABLE t2 (c int) ENGINE=MyISAM; + +CREATE VIEW v1 AS SELECT a, b FROM t1 STRAIGHT_JOIN t2; +CREATE VIEW v2 AS SELECT a, max(b) as bmax FROM v1 GROUP BY a; +CREATE VIEW v3 AS SELECT v2.* FROM t1 JOIN v2 ON t1.b = v2.bmax ; + +SELECT * FROM v3 JOIN t1 ON (bmax = b); + +DROP VIEW v1,v2,v3; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-14845: Impossible where for derived with GROUP BY +--echo # + +CREATE TABLE t1 (pk INT PRIMARY KEY); + +INSERT INTO t1 VALUES (1),(2); + +let $q= +WITH cte AS ( SELECT pk FROM t1 WHERE pk IS NULL GROUP BY pk ) +SELECT * FROM cte; + +eval $q; +eval EXPLAIN EXTENDED $q; + +DROP TABLE t1; + +--echo # +--echo # MDEV-14880: assertion failure in optimizer when splitting is applied +--echo # + +CREATE TABLE t1 (pk1 INT PRIMARY KEY, f INT) ENGINE=Aria; +INSERT INTO t1 VALUES (1,0),(2,0); + +CREATE TABLE t2 (pk2 INT PRIMARY KEY) ENGINE=Aria; +INSERT INTO t2 VALUES (1),(2),(3); + +CREATE VIEW v2 AS SELECT pk2, COUNT(*) AS cnt FROM t2 GROUP BY pk2; + +let $q= +SELECT * FROM t1 INNER JOIN v2 ON pk1 = pk2 WHERE f <> 5; + +eval $q; +eval EXPLAIN EXTENDED $q; +eval EXPLAIN FORMAT=JSON $q; + +DROP VIEW v2; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-15017: splittable table is constant table +--echo # + +CREATE TABLE t1 (a INT) ENGINE=MyISAM; + +CREATE TABLE t2 (pk INT, b INT, PRIMARY KEY (pk)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,2),(3,4); + +CREATE VIEW v2 AS SELECT pk, MIN(b) FROM t2 GROUP BY pk; + +SELECT * FROM t1 LEFT JOIN v2 ON (a = pk); + +DROP VIEW v2; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-14994: splittable table with no rows +--echo # + +CREATE TABLE t1 (f INT PRIMARY KEY) ENGINE=MyISAM; +CREATE VIEW v1 AS SELECT a.* FROM t1 AS a STRAIGHT_JOIN t1 AS b; +CREATE VIEW v2 AS SELECT f FROM v1 GROUP BY f; + +SELECT * FROM v1 JOIN v2 ON v1.f = v2.f; +EXPLAIN EXTENDED +SELECT * FROM v1 JOIN v2 ON v1.f = v2.f; + +DROP VIEW v1,v2; +DROP TABLE t1; + +--echo # +--echo # MDEV-15899: derived with WF without any key access +--echo # + +create table t1 (f1 int, f2 int, f4 int); +insert into t1 values + (3,1,1), (3,0,9), (0,1,8), (9,0,0), (3,0,9); + +let $q= +with +cte as (select median(f2) over (partition by f1) as k1 from t1 order by f1), +cte1 as (select median(f4) over (partition by f1) as k2 from t1) +select k1,k2 from cte1, cte; + +--sorted_result +eval $q; +eval explain $q; + +drop table t1; + +--echo # +--echo # MDEV-16104: embedded splittable materialized derived/views +--echo # + +CREATE TABLE t1 (f int PRIMARY KEY) ENGINE=MyISAM; +INSERT INTO t1 + VALUES (3), (7), (1), (4), (8), (5), (9); + +CREATE ALGORITHM=MERGE VIEW v1 AS +SELECT a2.* +FROM + ( SELECT f, COUNT(*) as c FROM t1 GROUP BY f ) AS a1 + JOIN + t1 AS a2 + USING (f); + +EXPLAIN EXTENDED +SELECT * FROM ( SELECT STRAIGHT_JOIN f, COUNT(*) as c FROM v1 GROUP BY f ) AS s; +SELECT * FROM ( SELECT STRAIGHT_JOIN f, COUNT(*) as c FROM v1 GROUP BY f ) AS s; + +DROP VIEW v1; +DROP TABLE t1; + +--echo # +--echo # MDEV-16801: splittable materialized derived/views with +--echo # one grouping field from table without keys +--echo # + +CREATE TABLE t1 (a int, b int, INDEX idx_a(a), INDEX idx_b(b)) ENGINE=MYISAM; +CREATE TABLE t2 (c int) ENGINE=MYISAM; +CREATE TABLE t3 (d int) ENGINE=MYISAM; +INSERT INTO t1 VALUES + (77,7), (11,1), (33,3), (44,4), (8,88), + (78,7), (98,9), (38,3), (28,2), (79,7), + (58,5), (42,4), (71,7), (27,2), (91,9); +INSERT INTO t1 SELECT a+100, b+10 FROM t1; +INSERT INTO t2 VALUES + (100), (700), (200), (100), (200); +INSERT INTO t3 VALUES + (3), (4), (1), (8), (3); + +ANALYZE tables t1,t2,t3; + +let $q= +SELECT * + FROM t3, + (SELECT t1.b, t2.c + FROM t1, t2 + GROUP BY t1.b,t2.c) dt +WHERE t3.d = dt.b; + +eval $q; +eval EXPLAIN EXTENDED $q; + +DROP TABLE t1,t2,t3; + +--echo # +--echo # MDEV-17419: splittable materialized derived/view +--echo # when join_cache_level = 4 +--echo # + +set join_cache_level = 4; + +CREATE TABLE t1 ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT, + username VARCHAR(50) NULL DEFAULT '0', + PRIMARY KEY (id) +) COLLATE='utf8_general_ci'; + +CREATE TABLE t2 ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT, + userid INT UNSIGNED NOT NULL, + logindate DATETIME NOT NULL, + PRIMARY KEY (id) +) COLLATE='utf8_general_ci'; + +INSERT INTO t1 (id, username) VALUES + (1,"user1"), (2, "user2"); +INSERT INTO t2 (id, userid, logindate) VALUES + (1,1,"2015-06-19 12:17:02.828"), + (2,1,"2016-06-19 12:17:02.828"), + (3,2,"2017-06-19 12:17:02.828"), + (4,2,"2018-06-19 12:17:02.828"); + +let $q= +select * from t1 as u + left join + (select * from t2 as au group by au.userid) as auditlastlogin + on u.id=auditlastlogin.userid; + +eval EXPLAIN $q; +eval $q; + +set join_cache_level=default; + +DROP TABLE t1,t2; + +--echo # End of 10.3 tests diff --cc mysql-test/main/events_grant.result index cc7796975a6,00000000000..c4f459dbe5b mode 100644,000000..100644 --- a/mysql-test/main/events_grant.result +++ b/mysql-test/main/events_grant.result @@@ -1,137 -1,0 +1,147 @@@ +CREATE DATABASE IF NOT EXISTS events_test; +use events_test; +CREATE EVENT one_event ON SCHEDULE EVERY 10 SECOND DO SELECT 123; ++Warnings: ++Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. +SHOW EVENTS; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME; +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT +def events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE +CREATE DATABASE events_test2; +CREATE USER ev_test@localhost; +GRANT ALL ON events_test.* to ev_test@localhost; +GRANT ALL ON events_test2.* to ev_test@localhost; +REVOKE EVENT ON events_test2.* FROM ev_test@localhost; +connect ev_con1,localhost,ev_test,,events_test2; +select "NEW CONNECTION"; +NEW CONNECTION +NEW CONNECTION +SELECT USER(), DATABASE(); +USER() DATABASE() +ev_test@localhost events_test2 +SHOW GRANTS; +Grants for ev_test@localhost +GRANT USAGE ON *.* TO 'ev_test'@'localhost' +GRANT ALL PRIVILEGES ON `events_test`.* TO 'ev_test'@'localhost' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, TRIGGER, DELETE HISTORY ON `events_test2`.* TO 'ev_test'@'localhost' +"Here comes an error:"; +SHOW EVENTS; +ERROR 42000: Access denied for user 'ev_test'@'localhost' to database 'events_test2' +USE events_test; +"We should see one event"; +SHOW EVENTS; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +SELECT CONCAT("Let's create some new events from the name of ", USER()); +CONCAT("Let's create some new events from the name of ", USER()) +Let's create some new events from the name of ev_test@localhost +CREATE EVENT one_event ON SCHEDULE EVERY 20 SECOND DO SELECT 123; +ERROR HY000: Event 'one_event' already exists +CREATE EVENT two_event ON SCHEDULE EVERY 20 SECOND ON COMPLETION NOT PRESERVE COMMENT "two event" DO SELECT 123; ++Warnings: ++Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. +CREATE EVENT three_event ON SCHEDULE EVERY 20 SECOND ON COMPLETION PRESERVE COMMENT "three event" DO SELECT 123; ++Warnings: ++Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. +"Now we should see 3 events:"; +SHOW EVENTS; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +events_test three_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +events_test two_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +"This should show us only 2 events:"; +SHOW EVENTS LIKE 't%event'; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +events_test three_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +events_test two_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +"This should show us no events:"; +SHOW EVENTS FROM test LIKE '%'; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +connection default; +GRANT EVENT ON events_test2.* TO ev_test@localhost; +connection ev_con1; +USE events_test2; +CREATE EVENT four_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42; ++Warnings: ++Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. +connection default; +USE events_test; +"We should see 4 events : one_event, two_event, three_event & four_event" +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME; +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT +def events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE +def events_test three_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event +def events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event +def events_test2 four_event ev_test@localhost SQL SELECT 42 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE +DROP DATABASE events_test2; +"We should see 3 events : one_event, two_event, three_event" +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME; +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT +def events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE +def events_test three_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event +def events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event +connection default; +CREATE DATABASE events_test2; +USE events_test2; +CREATE EVENT five_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42; ++Warnings: ++Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. +connection ev_con1; +"Should see 4 events - one, two, three & five" +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME; +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT +def events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE +def events_test three_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event +def events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event +def events_test2 five_event root@localhost SQL SELECT 42 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE +connection default; +REVOKE EVENT ON events_test2.* FROM ev_test@localhost; +connection ev_con1; +USE test; +"Should see 3 events - one, two & three" +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME; +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT +def events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE +def events_test three_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event +def events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event +"Let's test ALTER EVENT which changes the definer" +USE events_test; +ALTER EVENT one_event ON SCHEDULE EVERY 10 SECOND; +"The definer should be ev_test@localhost" +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event'; +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT +def events_test one_event ev_test@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE +connection default; +USE events_test; +ALTER EVENT one_event COMMENT "comment"; +connection ev_con1; +"The definer should be root@localhost" +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event'; +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT +def events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE comment +ALTER EVENT one_event DO SELECT 12; +"The definer should be ev_test@localhost" +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event'; +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT +def events_test one_event ev_test@localhost SQL SELECT 12 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE comment +connection default; +"make the definer again root@localhost" +ALTER EVENT one_event COMMENT "new comment"; +connection ev_con1; +"test DROP by another user" +DROP EVENT one_event; +connection default; +"One event should not be there" +SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME; +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT +def events_test three_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event +def events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event +def events_test2 five_event root@localhost SQL SELECT 42 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE +connection ev_con1; +disconnect ev_con1; +connection default; +DROP USER ev_test@localhost; +DROP DATABASE events_test2; +DROP DATABASE events_test; diff --cc mysql-test/main/func_gconcat.result index 1701bb364e8,00000000000..79011b4fc5e mode 100644,000000..100644 --- a/mysql-test/main/func_gconcat.result +++ b/mysql-test/main/func_gconcat.result @@@ -1,1396 -1,0 +1,1424 @@@ - 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 filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 9 100.00 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(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 filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 9 100.00 Using filesort +Warnings: +Note 1003 select `test`.`t1`.`grp` AS `grp`,group_concat(distinct `test`.`t1`.`c` order by `test`.`t1`.`c` DESC 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 filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 9 100.00 Using filesort +Warnings: +Note 1003 select `test`.`t1`.`grp` AS `grp`,group_concat(distinct `test`.`t1`.`c` order by `test`.`t1`.`c` ASC 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 Row 4 was cut by GROUP_CONCAT() +show warnings; +Level Code Message +Warning 1260 Row 4 was cut by GROUP_CONCAT() +set group_concat_max_len = 1024; +select group_concat(sum(c)) 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 'order clause' +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 +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 group_concat(c order by (select concat(5-t1.c,group_concat(c order by a)) from t2 where t2.a=t1.a)) as grp from t1; +grp +5,4,3,2 +select group_concat(c order by (select concat(t1.c,group_concat(c)) from t2 where a=t1.a)) as grp from t1; +grp +2,3,4,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 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 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 4 was 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 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 4 was 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 Row 3 was cut by GROUP_CONCAT() +Warning 1260 Row 6 was 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 Row 3 was cut by GROUP_CONCAT() +Warning 1260 Row 6 was 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 Row 7 was cut by GROUP_CONCAT() +Warning 1260 Row 14 was 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 Row 5 was cut by GROUP_CONCAT() +Warning 1260 Row 10 was 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 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 4 was 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 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 4 was cut by GROUP_CONCAT() +drop table t1; +create table t1 (a varchar(255) character set cp1250 collate cp1250_general_ci, +b varchar(255) character set koi8r); +insert into t1 values ('xxx','yyy'); +select collation(a) from t1; +collation(a) +cp1250_general_ci +select collation(group_concat(a)) from t1; +collation(group_concat(a)) +cp1250_general_ci +create table t2 select group_concat(a) as a from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` varchar(400) CHARACTER SET cp1250 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select collation(group_concat(a,_koi8r'test')) from t1; +collation(group_concat(a,_koi8r'test')) +cp1250_general_ci +select collation(group_concat(a,_koi8r 0xC1C2)) from t1; +ERROR HY000: Illegal mix of collations (cp1250_general_ci,IMPLICIT) and (koi8r_general_ci,COERCIBLE) for operation 'group_concat(' +select collation(group_concat(a,b)) from t1; +ERROR HY000: Illegal mix of collations (cp1250_general_ci,IMPLICIT) and (koi8r_general_ci,IMPLICIT) for operation 'group_concat(' +drop table t1; +drop table t2; +CREATE TABLE t1 (a CHAR(10) CHARACTER SET cp850); +INSERT INTO t1 VALUES ('�'); +SELECT a FROM t1; +a +� +SELECT GROUP_CONCAT(a) FROM t1; +GROUP_CONCAT(a) +� +DROP TABLE t1; +CREATE TABLE t1 (id int); +SELECT GROUP_CONCAT(id) AS gc FROM t1 HAVING gc IS NULL; +gc +NULL +DROP TABLE t1; +create table t2 (a int, b int); +insert into t2 values (1,1), (2,2); +select b x, (select group_concat(x) from t2) from t2; +x (select group_concat(x) from t2) +1 1,1 +2 2,2 +drop table t2; +create table t1 (d int not null auto_increment,primary key(d), a int, b int, c int); +insert into t1(a,b) values (1,3), (1,4), (1,2), (2,7), (1,1), (1,2), (2,3), (2,3); +select d,a,b from t1 order by a; +d a b +1 1 3 +2 1 4 +3 1 2 +5 1 1 +6 1 2 +4 2 7 +7 2 3 +8 2 3 +explain select a, group_concat(b) from t1 group by a with rollup; +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 a, group_concat(b) from t1 group by a with rollup; +a group_concat(b) +1 3,4,2,1,2 +2 7,3,3 +NULL 3,4,2,1,2,7,3,3 +select a, group_concat(distinct b) from t1 group by a with rollup; +a group_concat(distinct b) +1 3,4,2,1 +2 7,3 +NULL 3,4,2,1,7 +select a, group_concat(b order by b) from t1 group by a with rollup; +a group_concat(b order by b) +1 1,2,2,3,4 +2 3,3,7 +NULL 1,2,2,3,3,3,4,7 +select a, group_concat(distinct b order by b) from t1 group by a with rollup; +a group_concat(distinct b order by b) +1 1,2,3,4 +2 3,7 +NULL 1,2,3,4,7 +drop table t1; +create table t1 (a char(3), b char(20), primary key (a, b)); +insert into t1 values ('ABW', 'Dutch'), ('ABW', 'English'); +select group_concat(a) from t1 group by b; +group_concat(a) +ABW +ABW +drop table t1; +CREATE TABLE t1 ( +aID smallint(5) unsigned NOT NULL auto_increment, +sometitle varchar(255) NOT NULL default '', +bID smallint(5) unsigned NOT NULL, +PRIMARY KEY (aID), +UNIQUE KEY sometitle (sometitle) +); +INSERT INTO t1 SET sometitle = 'title1', bID = 1; +INSERT INTO t1 SET sometitle = 'title2', bID = 1; +CREATE TABLE t2 ( +bID smallint(5) unsigned NOT NULL auto_increment, +somename varchar(255) NOT NULL default '', +PRIMARY KEY (bID), +UNIQUE KEY somename (somename) +); +INSERT INTO t2 SET somename = 'test'; +SELECT COUNT(*), GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |') +FROM t1 JOIN t2 ON t1.bID = t2.bID; +COUNT(*) GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |') +2 test +INSERT INTO t2 SET somename = 'test2'; +SELECT COUNT(*), GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |') +FROM t1 JOIN t2 ON t1.bID = t2.bID; +COUNT(*) GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |') +2 test +DELETE FROM t2 WHERE somename = 'test2'; +SELECT COUNT(*), GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |') +FROM t1 JOIN t2 ON t1.bID = t2.bID; +COUNT(*) GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |') +2 test +DROP TABLE t1,t2; +select * from (select group_concat('c') from DUAL) t; +group_concat('c') +c +create table t1 ( a int not null default 0); +select * from (select group_concat(a) from t1) t2; +group_concat(a) +NULL +select group_concat('x') UNION ALL select 1; +group_concat('x') +x +1 +drop table t1; +CREATE TABLE t1 (id int, a varchar(9)); +INSERT INTO t1 VALUES +(2, ''), (1, ''), (2, 'x'), (1, 'y'), (3, 'z'), (3, ''); +SELECT GROUP_CONCAT(a) FROM t1; +GROUP_CONCAT(a) +,,x,y,z, +SELECT GROUP_CONCAT(a ORDER BY a) FROM t1; +GROUP_CONCAT(a ORDER BY a) +,,,x,y,z +SELECT GROUP_CONCAT(a) FROM t1 GROUP BY id; +GROUP_CONCAT(a) +,y +,x +z, +SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY id; +GROUP_CONCAT(a ORDER BY a) +,y +,x +,z +DROP TABLE t1; +create table t1(f1 int); +insert into t1 values(1),(2),(3); +select f1, group_concat(f1+1) from t1 group by f1 with rollup; +f1 group_concat(f1+1) +1 2 +2 3 +3 4 +NULL 2,3,4 +select count(distinct (f1+1)) from t1 group by f1 with rollup; +count(distinct (f1+1)) +1 +1 +1 +3 +drop table t1; +create table t1 (f1 int unsigned, f2 varchar(255)); +insert into t1 values (1,repeat('a',255)),(2,repeat('b',255)); +select f2,group_concat(f1) from t1 group by f2; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 f2 f2 253 255 255 Y 0 0 8 +def group_concat(f1) 253 400 1 Y 0 0 8 +f2 group_concat(f1) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 1 +bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 2 +drop table t1; +set names latin1; +create table t1 (a char, b char); +insert into t1 values ('a', 'a'), ('a', 'b'), ('b', 'a'), ('b', 'b'); +create table t2 select group_concat(b) as a from t1 where a = 'a'; +create table t3 (select group_concat(a) as a from t1 where a = 'a') union +(select group_concat(b) as a from t1 where a = 'b'); +select charset(a) from t2; +charset(a) +latin1 +select charset(a) from t3; +charset(a) +latin1 +latin1 +drop table t1, t2, t3; +set names default; +create table t1 (c1 varchar(10), c2 int); +select charset(group_concat(c1 order by c2)) from t1; +charset(group_concat(c1 order by c2)) +latin1 +drop table t1; +CREATE TABLE t1 (a INT(10), b LONGTEXT, PRIMARY KEY (a)); +SET GROUP_CONCAT_MAX_LEN = 20000000; +INSERT INTO t1 VALUES (1,REPEAT(CONCAT('A',CAST(CHAR(0) AS BINARY),'B'), 40000)); +INSERT INTO t1 SELECT a + 1, b FROM t1; +SELECT a, CHAR_LENGTH(b) FROM t1; +a CHAR_LENGTH(b) +1 120000 +2 120000 +SELECT CHAR_LENGTH( GROUP_CONCAT(b) ) FROM t1; +CHAR_LENGTH( GROUP_CONCAT(b) ) +240001 +SET GROUP_CONCAT_MAX_LEN = 1024; +DROP TABLE t1; +CREATE TABLE t1 (a int, b int); +INSERT INTO t1 VALUES (2,1), (1,2), (2,2), (1,3); +SELECT GROUP_CONCAT(a), x +FROM (SELECT a, GROUP_CONCAT(b) x FROM t1 GROUP BY a) AS s +GROUP BY x; +GROUP_CONCAT(a) x +2 1,2 +1 2,3 +DROP TABLE t1; +set names utf8; +create table t1 +( +x text character set utf8 not null, +y integer not null +); +insert into t1 values (repeat('a', 1022), 0), (repeat(_utf8 0xc3b7, 4), 0); +set group_concat_max_len= 1022 + 10; +select @x:=group_concat(x) from t1 group by y; +select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12); +@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12) +1032 1031 1027 aaaaaaa,÷÷÷÷ C3B7C3B7C3B7 +set group_concat_max_len= 1022 + 9; +select @x:=group_concat(x) from t1 group by y; +select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12); +@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12) +1031 1031 1027 aaaaaaa,÷÷÷÷ C3B7C3B7C3B7 +set group_concat_max_len= 1022 + 8; +select @x:=group_concat(x) from t1 group by y; +select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12); +@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12) +1030 1029 1026 aaaaaaaa,÷÷÷ C3B7C3B7C3B7 +set group_concat_max_len= 1022 + 7; +select @x:=group_concat(x) from t1 group by y; +select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12); +@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12) +1029 1029 1026 aaaaaaaa,÷÷÷ C3B7C3B7C3B7 +set group_concat_max_len= 1022 + 6; +select @x:=group_concat(x) from t1 group by y; +select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12); +@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12) +1028 1027 1025 aaaaaaaaa,÷÷ 612CC3B7C3B7 +set group_concat_max_len= 1022 + 5; +select @x:=group_concat(x) from t1 group by y; +select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12); +@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12) +1027 1027 1025 aaaaaaaaa,÷÷ 612CC3B7C3B7 +set group_concat_max_len= 1022 + 4; +select @x:=group_concat(x) from t1 group by y; +select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12); +@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12) +1026 1025 1024 aaaaaaaaaa,÷ 6161612CC3B7 +set group_concat_max_len= 1022 + 3; +select @x:=group_concat(x) from t1 group by y; +select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12); +@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12) +1025 1025 1024 aaaaaaaaaa,÷ 6161612CC3B7 +set group_concat_max_len= 1022 + 2; +select @x:=group_concat(x) from t1 group by y; +select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12); +@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12) +1024 1023 1023 aaaaaaaaaaa, 61616161612C +set group_concat_max_len= 1022 + 1; +select @x:=group_concat(x) from t1 group by y; +select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12); +@@group_concat_max_len length(@x) char_length(@x) right(@x,12) right(HEX(@x),12) +1023 1023 1023 aaaaaaaaaaa, 61616161612C +drop table t1; +set group_concat_max_len=1024; +set names latin1; +create table t1 (f1 int unsigned, f2 varchar(255)); +insert into t1 values (1,repeat('a',255)),(2,repeat('b',255)); +select f2,group_concat(f1) from t1 group by f2; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 f2 f2 253 255 255 Y 0 0 8 +def group_concat(f1) 252 1024 1 Y 0 0 8 +f2 group_concat(f1) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 1 +bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 2 +drop table t1; +CREATE TABLE t1(a TEXT, b CHAR(20)); +INSERT INTO t1 VALUES ("one.1","one.1"),("two.2","two.2"),("one.3","one.3"); +SELECT GROUP_CONCAT(DISTINCT UCASE(a)) FROM t1; +GROUP_CONCAT(DISTINCT UCASE(a)) +ONE.1,TWO.2,ONE.3 +SELECT GROUP_CONCAT(DISTINCT UCASE(b)) FROM t1; +GROUP_CONCAT(DISTINCT UCASE(b)) +ONE.1,TWO.2,ONE.3 +DROP TABLE t1; +CREATE TABLE t1( a VARCHAR( 10 ), b INT ); +INSERT INTO t1 VALUES ( repeat( 'a', 10 ), 1), +( repeat( 'b', 10 ), 2); +SET group_concat_max_len = 20; +SELECT GROUP_CONCAT( a ) FROM t1; +GROUP_CONCAT( a ) +aaaaaaaaaa,bbbbbbbbb +Warnings: +Warning 1260 Row 2 was cut by GROUP_CONCAT() +SELECT GROUP_CONCAT( DISTINCT a ) FROM t1; +GROUP_CONCAT( DISTINCT a ) +aaaaaaaaaa,bbbbbbbbb +Warnings: +Warning 1260 Row 2 was cut by GROUP_CONCAT() +SELECT GROUP_CONCAT( a ORDER BY b ) FROM t1; +GROUP_CONCAT( a ORDER BY b ) +aaaaaaaaaa,bbbbbbbbb +Warnings: +Warning 1260 Row 2 was cut by GROUP_CONCAT() +SELECT GROUP_CONCAT( DISTINCT a ORDER BY b ) FROM t1; +GROUP_CONCAT( DISTINCT a ORDER BY b ) +aaaaaaaaaa,bbbbbbbbb +Warnings: +Warning 1260 Row 2 was cut by GROUP_CONCAT() +SET group_concat_max_len = DEFAULT; +DROP TABLE t1; +SET group_concat_max_len= 65535; +CREATE TABLE t1( a TEXT, b INTEGER ); +INSERT INTO t1 VALUES ( 'a', 0 ), ( 'b', 1 ); +SELECT GROUP_CONCAT( a ORDER BY b ) FROM t1; +GROUP_CONCAT( a ORDER BY b ) +a,b +SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1; +GROUP_CONCAT(DISTINCT a ORDER BY b) +a,b +SELECT GROUP_CONCAT(DISTINCT a) FROM t1; +GROUP_CONCAT(DISTINCT a) +a,b +SET group_concat_max_len= 10; +SELECT GROUP_CONCAT(a ORDER BY b) FROM t1; +GROUP_CONCAT(a ORDER BY b) +a,b +SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1; +GROUP_CONCAT(DISTINCT a ORDER BY b) +a,b +SELECT GROUP_CONCAT(DISTINCT a) FROM t1; +GROUP_CONCAT(DISTINCT a) +a,b +SET group_concat_max_len= 65535; +CREATE TABLE t2( a TEXT ); +INSERT INTO t2 VALUES( REPEAT( 'a', 5000 ) ); +INSERT INTO t2 VALUES( REPEAT( 'b', 5000 ) ); +INSERT INTO t2 VALUES( REPEAT( 'a', 5000 ) ); +SELECT LENGTH( GROUP_CONCAT( DISTINCT a ) ) FROM t2; +LENGTH( GROUP_CONCAT( DISTINCT a ) ) +10001 +CREATE TABLE t3( a TEXT, b INT ); +INSERT INTO t3 VALUES( REPEAT( 'a', 65534 ), 1 ); +INSERT INTO t3 VALUES( REPEAT( 'a', 65535 ), 2 ); +INSERT IGNORE INTO t3 VALUES( REPEAT( 'a', 65536 ), 3 ); +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 1; +LENGTH( GROUP_CONCAT( a ) ) +65534 +SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 2; +LENGTH( GROUP_CONCAT( a ) ) +65535 +SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 3; +LENGTH( GROUP_CONCAT( a ) ) +65535 +SET group_concat_max_len= DEFAULT; +DROP TABLE t1, t2, t3; +set names latin1; +create table t1 (id int, name varchar(20)) DEFAULT CHARSET=utf8; +insert into t1 (id, name) values (1, "�ra"); +insert into t1 (id, name) values (2, "�ra"); +select b.id, group_concat(b.name) from t1 a, t1 b group by b.id; +id group_concat(b.name) +1 �ra,�ra +2 �ra,�ra +drop table t1; +create table t1(a bit not null); +insert ignore into t1 values (), (), (); +Warnings: +Warning 1364 Field 'a' doesn't have a default value +select group_concat(distinct a) from t1; +group_concat(distinct a) +0 +select group_concat(distinct a order by a) from t1; +group_concat(distinct a order by a) +0 +drop table t1; +create table t1(a bit(2) not null); +insert into t1 values (1), (0), (0), (3), (1); +select group_concat(distinct a) from t1; +group_concat(distinct a) +1,0,3 +select group_concat(distinct a order by a) from t1; +group_concat(distinct a order by a) +0,1,3 +select group_concat(distinct a order by a desc) from t1; +group_concat(distinct a order by a desc) +3,1,0 +drop table t1; +create table t1(a bit(2), b varchar(10), c bit); +insert into t1 values (1, 'a', 0), (0, 'b', 1), (0, 'c', 0), (3, 'd', 1), +(1, 'e', 1), (3, 'f', 1), (0, 'g', 1); +select group_concat(distinct a, c) from t1; +group_concat(distinct a, c) +10,01,00,31,11 +select group_concat(distinct a, c order by a) from t1; +group_concat(distinct a, c order by a) +00,01,11,10,31 +select group_concat(distinct a, c) from t1; +group_concat(distinct a, c) +10,01,00,31,11 +select group_concat(distinct a, c order by a, c) from t1; +group_concat(distinct a, c order by a, c) +00,01,10,11,31 +select group_concat(distinct a, c order by a desc, c desc) from t1; +group_concat(distinct a, c order by a desc, c desc) +31,11,10,01,00 +drop table t1; +create table t1 (f1 char(20)); +insert into t1 values (''),(''); +select group_concat(distinct f1) from t1; +group_concat(distinct f1) + +select group_concat(f1) from t1; +group_concat(f1) +, +drop table t1; +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1, 1), (2, 2), (2, 3); +SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1; +GROUP_CONCAT(DISTINCT a ORDER BY b) +1,2 +SELECT GROUP_CONCAT(DISTINCT a ORDER BY b DESC) FROM t1; +GROUP_CONCAT(DISTINCT a ORDER BY b DESC) +2,1 +SELECT GROUP_CONCAT(DISTINCT a) FROM t1; +GROUP_CONCAT(DISTINCT a) +1,2 +SELECT GROUP_CONCAT(DISTINCT a + 1 ORDER BY 3 - b) FROM t1; +GROUP_CONCAT(DISTINCT a + 1 ORDER BY 3 - b) +3,2 +SELECT GROUP_CONCAT(DISTINCT a + 1 ORDER BY b) FROM t1; +GROUP_CONCAT(DISTINCT a + 1 ORDER BY b) +2,3 +SELECT GROUP_CONCAT(a ORDER BY 3 - b) FROM t1; +GROUP_CONCAT(a ORDER BY 3 - b) +2,2,1 +CREATE TABLE t2 (a INT, b INT, c INT, d INT); +INSERT INTO t2 VALUES (1,1, 1,1), (1,1, 2,2), (1,2, 2,1), (2,1, 1,2); +SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY c, d) FROM t2; +GROUP_CONCAT(DISTINCT a, b ORDER BY c, d) +11,21,12 +SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY d, c) FROM t2; +GROUP_CONCAT(DISTINCT a, b ORDER BY d, c) +11,12,21 +CREATE TABLE t3 (a INT, b INT, c INT); +INSERT INTO t3 VALUES (1, 1, 1), (2, 1, 2), (3, 2, 1); +SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY b, c) FROM t3; +GROUP_CONCAT(DISTINCT a, b ORDER BY b, c) +11,21,32 +SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY c, b) FROM t3; +GROUP_CONCAT(DISTINCT a, b ORDER BY c, b) +11,32,21 +SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY a, b) FROM t1; +GROUP_CONCAT(DISTINCT a, b ORDER BY a, b) +11,22,23 +SELECT GROUP_CONCAT(DISTINCT b, a ORDER BY a, b) FROM t1; +GROUP_CONCAT(DISTINCT b, a ORDER BY a, b) +11,22,32 +SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY b, a) FROM t1; +GROUP_CONCAT(DISTINCT a, b ORDER BY b, a) +11,22,23 +SELECT GROUP_CONCAT(DISTINCT b, a ORDER BY a, b) FROM t1; +GROUP_CONCAT(DISTINCT b, a ORDER BY a, b) +11,22,32 +SELECT GROUP_CONCAT(DISTINCT a ORDER BY a, b) FROM t1; +GROUP_CONCAT(DISTINCT a ORDER BY a, b) +1,2 +SELECT GROUP_CONCAT(DISTINCT b ORDER BY b, a) FROM t1; +GROUP_CONCAT(DISTINCT b ORDER BY b, a) +1,2,3 +SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY a) FROM t1; +GROUP_CONCAT(DISTINCT a, b ORDER BY a) +11,23,22 +SELECT GROUP_CONCAT(DISTINCT b, a ORDER BY b) FROM t1; +GROUP_CONCAT(DISTINCT b, a ORDER BY b) +11,22,32 +DROP TABLE t1, t2, t3; +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES (),(); +SELECT s1.d1 FROM +( +SELECT +t1.a as d1, +GROUP_CONCAT(DISTINCT t1.a) AS d2 +FROM +t1 AS t1, +t1 AS t2 +GROUP BY 1 +) AS s1; +d1 +NULL +DROP TABLE t1; +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a INT); +INSERT INTO t1 VALUES(1); +SELECT GROUP_CONCAT(DISTINCT t2.a) FROM t1 LEFT JOIN t2 ON t2.a = t1.a GROUP BY t1.a; +GROUP_CONCAT(DISTINCT t2.a) +NULL +DROP TABLE t1, t2; +CREATE TABLE t1 (a INT, KEY(a)); +CREATE TABLE t2 (b INT); +INSERT INTO t1 VALUES (NULL), (8), (2); +INSERT INTO t2 VALUES (4), (10); +SELECT 1 FROM t1 WHERE t1.a NOT IN +( +SELECT GROUP_CONCAT(DISTINCT t1.a) +FROM t1 WHERE t1.a IN +( +SELECT b FROM t2 +) +AND NOT t1.a >= (SELECT t1.a FROM t1 LIMIT 1) +GROUP BY t1.a +); +1 +1 +1 +1 +DROP TABLE t1, t2; +CREATE TABLE t1 (f1 INT); +INSERT INTO t1 VALUES (),(); +EXPLAIN EXTENDED SELECT 1 FROM +(SELECT DISTINCT GROUP_CONCAT(td.f1) FROM t1,t1 AS td GROUP BY td.f1) AS d,t1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +2 DERIVED td ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +Warnings: +Note 1003 /* select#1 */ select 1 AS `1` from (/* select#2 */ select distinct group_concat(`test`.`td`.`f1` separator ',') AS `GROUP_CONCAT(td.f1)` from `test`.`t1` join `test`.`t1` `td` group by `test`.`td`.`f1`) `d` join `test`.`t1` +SELECT 1 FROM +(SELECT DISTINCT GROUP_CONCAT(td.f1) FROM t1,t1 AS td GROUP BY td.f1) AS d,t1; +1 +1 +1 +DROP TABLE t1; +End of 5.0 tests +# +# Bug #52397: another crash with explain extended and group_concat +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (0), (0); +EXPLAIN EXTENDED SELECT 1 FROM +(SELECT GROUP_CONCAT(t1.a ORDER BY t1.a ASC) FROM +t1 t2, t1 GROUP BY t1.a) AS d; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 100.00 +2 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +Warnings: +Note 1003 /* select#1 */ select 1 AS `1` from (/* select#2 */ select group_concat(`test`.`t1`.`a` order by `test`.`t1`.`a` ASC separator ',') AS `GROUP_CONCAT(t1.a ORDER BY t1.a ASC)` from `test`.`t1` `t2` join `test`.`t1` group by `test`.`t1`.`a`) `d` +DROP TABLE t1; +End of 5.0 tests +# +# Bug #54476: crash when group_concat and 'with rollup' in prepared statements +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1), (2); +PREPARE stmt FROM "SELECT GROUP_CONCAT(t1.a ORDER BY t1.a) FROM t1 JOIN t1 t2 GROUP BY t1.a WITH ROLLUP"; +EXECUTE stmt; +GROUP_CONCAT(t1.a ORDER BY t1.a) +1,1 +2,2 +1,1,2,2 +EXECUTE stmt; +GROUP_CONCAT(t1.a ORDER BY t1.a) +1,1 +2,2 +1,1,2,2 +DEALLOCATE PREPARE stmt; +DROP TABLE t1; +# +# Bug#57194 group_concat cause crash and/or invalid memory reads with type errors +# +CREATE TABLE t1(f1 int); +INSERT INTO t1 values (0),(0); +SELECT POLYGON((SELECT 1 FROM (SELECT 1 IN (GROUP_CONCAT(t1.f1)) FROM t1, t1 t GROUP BY t.f1 ) d)); +ERROR HY000: Illegal parameter data type int for operation 'geometrycollection' +DROP TABLE t1; +# +# Bug#58396 group_concat and explain extended are still crashy +# +CREATE TABLE t1(a INT); +EXPLAIN EXTENDED SELECT UPDATEXML('1', a, '1') +FROM t1 ORDER BY (SELECT GROUP_CONCAT(1) FROM t1); +ERROR HY000: Only constant XPATH queries are supported +SHOW WARNINGS; +Level Code Message +Error 1105 Only constant XPATH queries are supported +DROP TABLE t1; +End of 5.1 tests +DROP TABLE IF EXISTS t1, t2; +CREATE TABLE t1 (a VARCHAR(6), b INT); +CREATE TABLE t2 (a VARCHAR(6), b INT); +INSERT INTO t1 VALUES ('111111', 1); +INSERT INTO t1 VALUES ('222222', 2); +INSERT INTO t1 VALUES ('333333', 3); +INSERT INTO t1 VALUES ('444444', 4); +INSERT INTO t1 VALUES ('555555', 5); +SET group_concat_max_len = 5; +SET @old_sql_mode = @@sql_mode, @@sql_mode = 'traditional'; +SELECT GROUP_CONCAT(a), b FROM t1 GROUP BY b LIMIT 3; +GROUP_CONCAT(a) b +11111 1 +22222 2 +33333 3 +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() +INSERT INTO t2 SELECT GROUP_CONCAT(a), b FROM t1 GROUP BY b; +ERROR HY000: Row 1 was cut by GROUP_CONCAT() +UPDATE t1 SET a = '11111' WHERE b = 1; +UPDATE t1 SET a = '22222' WHERE b = 2; +INSERT INTO t2 SELECT GROUP_CONCAT(a), b FROM t1 GROUP BY b; +ERROR HY000: Row 3 was cut by GROUP_CONCAT() +SET group_concat_max_len = DEFAULT; +SET @@sql_mode = @old_sql_mode; +DROP TABLE t1, t2; +create table t1 (a char(1) character set utf8); +insert into t1 values ('a'),('b'); +select 1 from t1 where a in (select group_concat(a) from t1); +1 +drop table t1; +CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('a'),('b'); +CREATE TABLE t2 (f2 VARCHAR(10)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('c'); +CREATE TABLE t3 (f3 VARCHAR(10)) ENGINE=MyISAM; +INSERT INTO t3 VALUES ('d'),('e'); +SELECT GROUP_CONCAT( f2 ORDER BY ( f2 IN ( SELECT f1 FROM t1 WHERE f1 <= f2 ) ) ) AS field +FROM ( SELECT * FROM t2 ) AS sq2, t3 +ORDER BY field; +field +c,c +drop table t3, t2, t1; +# +# MDEV-7821 - Server crashes in Item_func_group_concat::fix_fields on 2nd +# execution of PS +# +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES(1),(2); +PREPARE stmt FROM "SELECT GROUP_CONCAT(t1a.a ORDER BY 1, t1a.a=0) FROM t1 AS t1a, t1 AS t1b GROUP BY t1a.a"; +EXECUTE stmt; +GROUP_CONCAT(t1a.a ORDER BY 1, t1a.a=0) +1,1 +2,2 +EXECUTE stmt; +GROUP_CONCAT(t1a.a ORDER BY 1, t1a.a=0) +1,1 +2,2 +DROP TABLE t1; +# +# WL#6098 Eliminate GROUP_CONCAT intermediate result limitation. +# Bug#13387020 GROUP_CONCAT WITH ORDER BY RESULTS ARE TRUNCATED. +# +SET group_concat_max_len= 9999999; +CREATE TABLE t1 (f1 LONGTEXT , f2 INTEGER); +INSERT INTO t1 VALUES (REPEAT('a', 500000), 0), (REPEAT('b', 500000), 1), (REPEAT('c', 500000), 2); +SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1; +LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) +1500002 +SELECT LENGTH(GROUP_CONCAT(DISTINCT f1 ORDER BY f1 DESC)) FROM t1; +LENGTH(GROUP_CONCAT(DISTINCT f1 ORDER BY f1 DESC)) +1500002 +SELECT SUBSTRING(GROUP_CONCAT(DISTINCT f1 ORDER BY f1 DESC), 1, 5) FROM t1; +SUBSTRING(GROUP_CONCAT(DISTINCT f1 ORDER BY f1 DESC), 1, 5) +ccccc +SELECT LENGTH(GROUP_CONCAT(DISTINCT f1)) FROM t1; +LENGTH(GROUP_CONCAT(DISTINCT f1)) +1500002 +SELECT LENGTH(GROUP_CONCAT(UPPER(f1) ORDER BY f2)) FROM t1; +LENGTH(GROUP_CONCAT(UPPER(f1) ORDER BY f2)) +1500002 +SELECT LENGTH(GROUP_CONCAT(DISTINCT UPPER(f1) ORDER BY f1)) FROM t1; +LENGTH(GROUP_CONCAT(DISTINCT UPPER(f1) ORDER BY f1)) +1500002 +SELECT SUBSTRING(GROUP_CONCAT(DISTINCT UPPER(f1) ORDER BY f1), 1, 5) FROM t1; +SUBSTRING(GROUP_CONCAT(DISTINCT UPPER(f1) ORDER BY f1), 1, 5) +AAAAA +SELECT LENGTH(GROUP_CONCAT(DISTINCT UPPER(f1))) FROM t1; +LENGTH(GROUP_CONCAT(DISTINCT UPPER(f1))) +1500002 +CREATE TABLE t2 SELECT GROUP_CONCAT(f1 order by f2) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `GROUP_CONCAT(f1 order by f2)` mediumtext DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 SELECT GROUP_CONCAT(UPPER(f1) ORDER BY f2) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `GROUP_CONCAT(UPPER(f1) ORDER BY f2)` mediumtext DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +SET group_concat_max_len= 1024; +SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1; +LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) +1024 +Warnings: +Warning 1260 Row 2 was cut by GROUP_CONCAT() +SET group_concat_max_len= 499999; +SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1 WHERE f2 = 0; +LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) +499999 +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1 GROUP BY f2; +LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) +499999 +499999 +499999 +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() +INSERT INTO t1 VALUES (REPEAT('a', 499999), 3), (REPEAT('b', 500000), 4); +SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1 GROUP BY f2; +LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) +499999 +499999 +499999 +499999 +499999 +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() +Warning 1260 Row 5 was cut by GROUP_CONCAT() +DROP TABLE t1; +SET group_concat_max_len= DEFAULT; ++set session group_concat_max_len=1024; ++set max_session_mem_used=16*1024*1024; ++SELECT GROUP_CONCAT(concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1) ORDER BY 2,1,3,4,6,5,8,7) AS c ++FROM seq_1_to_200000; ++c ++0.90910.90910.90910.90910.90910.90910.90910.9091,1.81821.81821.81821.81821.81821.81821.81821.8182,10.000010.000010.000010.000010.000010.000010.000010.0000,10.909110.909110.909110.909110.909110.909110.909110.9091,100.0000100.0000100.0000100.0000100.0000100.0000100.0000100.0000,100.9091100.9091100.9091100.9091100.9091100.9091100.9091100.9091,1000.00001000.00001000.00001000.00001000.00001000.00001000.00001000.0000,1000.90911000.90911000.90911000.90911000.90911000.90911000.90911000.9091,10000.000010000.000010000.000010000.000010000.000010000.000010000.000010000.0000,10000.909110000.909110000.909110000.909110000.909110000.909110000.909110000.9091,100000.0000100000.0000100000.0000100000.0000100000.0000100000.0000100000.0000100000.0000,100000.9091100000.9091100000.9091100000.9091100000.9091100000.9091100000.9091100000.9091,100001.8182100001.8182100001.8182100001.8182100001.8182100001.8182100001.8182100001.8182,100002.7273100002.7273100002.7273100002.7273100002.7273100002.727310000 2.7273100002.7273,100003.6364100003. ++Warnings: ++Warning 1260 Row 15 was cut by GROUP_CONCAT() ++set max_session_mem_used=default; ++set session group_concat_max_len=default; ++SET group_concat_max_len= 8; ++CREATE TABLE t1 (a INT); ++INSERT t1 VALUES (1),(2); ++CREATE TABLE t2 (b DATE, c INT); ++INSERT t2 VALUES ('2019-12-04',1),('2020-03-28',2); ++CREATE TABLE t3 (d INT); ++INSERT t3 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14); ++CREATE TABLE t4 (e INT); ++INSERT t4 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15); ++SELECT (SELECT MAX(a) FROM t1 WHERE t2_sq.c > 0) AS f, ++GROUP_CONCAT(t2_sq.b ORDER BY 1) AS gc ++FROM (SELECT t2_a.* FROM t2 AS t2_a, t2 AS t2_b) AS t2_sq, t3, t4 ++GROUP BY f; ++f gc ++2 2019-12- ++Warnings: ++Warning 1260 Row 1 was cut by GROUP_CONCAT() ++DROP TABLE t1, t2, t3, t4; ++SET group_concat_max_len= default; +# +# Start of 10.2 tests +# +# +# MDEV-10124 Incorrect usage of CUBE/ROLLUP and ORDER BY with GROUP_CONCAT(a ORDER BY a) +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (10),(20),(30); +SELECT a,GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP; +a GROUP_CONCAT(a ORDER BY a) +10 10 +20 20 +30 30 +NULL 10,20,30 +CREATE VIEW v1 AS +SELECT a,GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP; +SELECT * FROM v1; +a GROUP_CONCAT(a ORDER BY a) +10 10 +20 20 +30 30 +NULL 10,20,30 +DROP VIEW v1; +SELECT a,GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30'; +a GROUP_CONCAT(a ORDER BY a) +NULL 10,20,30 +CREATE VIEW v1 AS +SELECT a,GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30'; +SELECT * FROM v1; +a GROUP_CONCAT(a ORDER BY a) +NULL 10,20,30 +DROP VIEW v1; +SELECT * FROM (SELECT a,GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30') t1; +a GROUP_CONCAT(a ORDER BY a) +NULL 10,20,30 +CREATE VIEW v1 AS +SELECT * FROM (SELECT a,GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30') t1; +SELECT * FROM v1; +a GROUP_CONCAT(a ORDER BY a) +NULL 10,20,30 +DROP VIEW v1; +SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30'); +(SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30') +10,20,30 +CREATE VIEW v1 AS +SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30'); +SELECT * FROM v1; +Name_exp_1 +10,20,30 +DROP VIEW v1; +DROP TABLE t1; +# +# End of 10.2 tests +# +# +# Start of 10.3 tests +# +drop table if exists t1, t2; +create table t1 (grp int, a bigint unsigned, c char(10) , d char(10) not null); +insert into t1 values (1,1,NULL,"a"); +insert into t1 values (1,10,"b","a"); +insert into t1 values (1,11,"c","a"); +insert into t1 values (2,2,"c","a"); +insert into t1 values (2,3,"b","b"); +insert into t1 values (3,4,"E","a"); +insert into t1 values (3,5,"C","b"); +insert into t1 values (3,6,"D","c"); +insert into t1 values (3,7,"E","c"); +select grp,group_concat(c) from t1 group by grp; +grp group_concat(c) +1 b,c +2 c,b +3 E,C,D,E +select grp,group_concat(c limit 1 ) from t1 group by grp; +grp group_concat(c limit 1 ) +1 b +2 c +3 E +select grp,group_concat(c limit 1,1 ) from t1 group by grp; +grp group_concat(c limit 1,1 ) +1 c +2 b +3 C +select grp,group_concat(c limit 1,10 ) from t1 group by grp; +grp group_concat(c limit 1,10 ) +1 c +2 b +3 C,D,E +select grp,group_concat(c limit 1000) from t1 group by grp; +grp group_concat(c limit 1000) +1 b,c +2 c,b +3 E,C,D,E +select group_concat(grp limit 0) from t1; +group_concat(grp limit 0) + +select group_concat(grp limit "sdjadjs") from t1 +--error ER_PARSE_ERROR +select grp,group_concat(c limit 5.5) from t1 group by grp ; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"sdjadjs") from t1 +--error ER_PARSE_ERROR +select grp,group_concat(c limit 5.5) f' at line 1 +select grp,group_concat(distinct c limit 1,10 ) from t1 group by grp; +grp group_concat(distinct c limit 1,10 ) +1 c +2 b +3 C,D +select grp,group_concat(c order by a) from t1 group by grp; +grp group_concat(c order by a) +1 b,c +2 c,b +3 E,C,D,E +select grp,group_concat(c order by a limit 2 ) from t1 group by grp; +grp group_concat(c order by a limit 2 ) +1 b,c +2 c,b +3 E,C +select grp,group_concat(c order by a limit 1,1 ) from t1 group by grp; +grp group_concat(c order by a limit 1,1 ) +1 c +2 b +3 C +select grp,group_concat(c order by c) from t1 group by grp; +grp group_concat(c order by c) +1 b,c +2 b,c +3 C,D,E,E +select grp,group_concat(c order by c limit 2) from t1 group by grp; +grp group_concat(c order by c limit 2) +1 b,c +2 b,c +3 C,D +select grp,group_concat(c order by c desc) from t1 group by grp; +grp group_concat(c order by c desc) +1 c,b +2 c,b +3 E,E,D,C +select grp,group_concat(c order by c desc limit 2) from t1 group by grp; +grp group_concat(c order by c desc limit 2) +1 c,b +2 c,b +3 E,E +drop table t1; +create table t2 (a int, b varchar(10)); +insert into t2 values(1,'a'),(1,'b'),(NULL,'c'),(2,'x'),(2,'y'); +select group_concat(a,b limit 2) from t2; +group_concat(a,b limit 2) +1a,1b +set @x=4; +prepare STMT from 'select group_concat(b limit ?) from t2'; +execute STMT using @x; +group_concat(b limit ?) +a,b,c,x +set @x=2; +execute STMT using @x; +group_concat(b limit ?) +a,b +set @x=1000; +execute STMT using @x; +group_concat(b limit ?) +a,b,c,x,y +set @x=0; +execute STMT using @x; +group_concat(b limit ?) + +set @x="adasfa"; +execute STMT using @x; +ERROR HY000: Limit only accepts integer values +set @x=-1; +execute STMT using @x; +ERROR HY000: Incorrect arguments to EXECUTE +set @x=4; +prepare STMT from 'select group_concat(a,b limit ?) from t2'; +execute STMT using @x; +group_concat(a,b limit ?) +1a,1b,2x,2y +drop table t2; +# +# MDEV-18943: Group Concat with limit not working with views +# +create table t1 (a int, b varchar(10)); +insert into t1 values(1,'a'),(1,'b'),(NULL,'c'),(2,'x'),(2,'y'); +select group_concat(a,b limit 2) from t1; +group_concat(a,b limit 2) +1a,1b +create view v1 as select group_concat(a,b limit 2) from t1; +select * from v1; +group_concat(a,b limit 2) +1a,1b +drop view v1; +drop table t1; +# +# End of 10.3 tests +# diff --cc mysql-test/main/func_gconcat.test index b8ab96bdea4,00000000000..a76568bdae3 mode 100644,000000..100644 --- a/mysql-test/main/func_gconcat.test +++ b/mysql-test/main/func_gconcat.test @@@ -1,1002 -1,0 +1,1029 @@@ +# +# simple test of group_concat function +# - --disable_warnings - drop table if exists t1, t2; - --enable_warnings ++source include/have_sequence.inc; + +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; +--disable_warnings +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; +--enable_warnings +select grp,group_concat(c order by 1) 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(c)) 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 (bug#836) +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 concat(5-t1.c,group_concat(c order by a)) from t2 where t2.a=t1.a)) as grp from t1; +select group_concat(c order by (select concat(t1.c,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 #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; + +# +# Bug#10201 +# +create table t1 (a varchar(255) character set cp1250 collate cp1250_general_ci, + b varchar(255) character set koi8r); +insert into t1 values ('xxx','yyy'); +select collation(a) from t1; +select collation(group_concat(a)) from t1; +create table t2 select group_concat(a) as a from t1; +show create table t2; +select collation(group_concat(a,_koi8r'test')) from t1; +--error 1267 +select collation(group_concat(a,_koi8r 0xC1C2)) from t1; +--error 1267 +select collation(group_concat(a,b)) from t1; +drop table t1; +drop table t2; + +# +# Bug #12829 +# Cannot convert the charset of a GROUP_CONCAT result +# +CREATE TABLE t1 (a CHAR(10) CHARACTER SET cp850); +INSERT INTO t1 VALUES ('�'); +SELECT a FROM t1; +SELECT GROUP_CONCAT(a) FROM t1; +DROP TABLE t1; + +# +# bug #7769: group_concat returning null is checked in having +# +CREATE TABLE t1 (id int); +SELECT GROUP_CONCAT(id) AS gc FROM t1 HAVING gc IS NULL; +DROP TABLE t1; + +# +# Bug #8656: Crash with group_concat on alias in outer table +# +create table t2 (a int, b int); +insert into t2 values (1,1), (2,2); +select b x, (select group_concat(x) from t2) from t2; +drop table t2; + +# +# Bug #7405: problems with rollup +# + +create table t1 (d int not null auto_increment,primary key(d), a int, b int, c int); +insert into t1(a,b) values (1,3), (1,4), (1,2), (2,7), (1,1), (1,2), (2,3), (2,3); +select d,a,b from t1 order by a; +explain select a, group_concat(b) from t1 group by a with rollup; +select a, group_concat(b) from t1 group by a with rollup; +select a, group_concat(distinct b) from t1 group by a with rollup; +select a, group_concat(b order by b) from t1 group by a with rollup; +select a, group_concat(distinct b order by b) from t1 group by a with rollup; +drop table t1; + +# +# Bug #6475 +# +create table t1 (a char(3), b char(20), primary key (a, b)); +insert into t1 values ('ABW', 'Dutch'), ('ABW', 'English'); +select group_concat(a) from t1 group by b; +drop table t1; +# +# Bug #12095: GROUP_CONCAT for one row table +# + +CREATE TABLE t1 ( + aID smallint(5) unsigned NOT NULL auto_increment, + sometitle varchar(255) NOT NULL default '', + bID smallint(5) unsigned NOT NULL, + PRIMARY KEY (aID), + UNIQUE KEY sometitle (sometitle) +); +INSERT INTO t1 SET sometitle = 'title1', bID = 1; +INSERT INTO t1 SET sometitle = 'title2', bID = 1; + +CREATE TABLE t2 ( + bID smallint(5) unsigned NOT NULL auto_increment, + somename varchar(255) NOT NULL default '', + PRIMARY KEY (bID), + UNIQUE KEY somename (somename) +); +INSERT INTO t2 SET somename = 'test'; + +SELECT COUNT(*), GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |') + FROM t1 JOIN t2 ON t1.bID = t2.bID; +INSERT INTO t2 SET somename = 'test2'; +SELECT COUNT(*), GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |') + FROM t1 JOIN t2 ON t1.bID = t2.bID; +DELETE FROM t2 WHERE somename = 'test2'; +SELECT COUNT(*), GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |') + FROM t1 JOIN t2 ON t1.bID = t2.bID; + +DROP TABLE t1,t2; + +# +# Bug #12861 hang with group_concat insubquery FROM DUAL +# +select * from (select group_concat('c') from DUAL) t; + +# +# Bug #12859 group_concat in subquery cause incorrect not null +# +create table t1 ( a int not null default 0); +select * from (select group_concat(a) from t1) t2; +select group_concat('x') UNION ALL select 1; +drop table t1; + +# +# Bug #12863 : missing separators after first empty concatenated elements +# + +CREATE TABLE t1 (id int, a varchar(9)); +INSERT INTO t1 VALUES + (2, ''), (1, ''), (2, 'x'), (1, 'y'), (3, 'z'), (3, ''); + +SELECT GROUP_CONCAT(a) FROM t1; +SELECT GROUP_CONCAT(a ORDER BY a) FROM t1; + +SELECT GROUP_CONCAT(a) FROM t1 GROUP BY id; +SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY id; + +DROP TABLE t1; + +# +# Bug #15560: GROUP_CONCAT wasn't ready for WITH ROLLUP queries +# +create table t1(f1 int); +insert into t1 values(1),(2),(3); +select f1, group_concat(f1+1) from t1 group by f1 with rollup; +select count(distinct (f1+1)) from t1 group by f1 with rollup; +drop table t1; + +# +# Bug#14169 type of group_concat() result changed to blob if tmp_table was used +# +create table t1 (f1 int unsigned, f2 varchar(255)); +insert into t1 values (1,repeat('a',255)),(2,repeat('b',255)); +--enable_metadata +select f2,group_concat(f1) from t1 group by f2; +--disable_metadata +drop table t1; + +# End of 4.1 tests + +# +# Bug#8568 "GROUP_CONCAT returns string, unless in a UNION in which case +# returns BLOB": add a test case, the bug can not be repeated any more. +# + +set names latin1; +create table t1 (a char, b char); +insert into t1 values ('a', 'a'), ('a', 'b'), ('b', 'a'), ('b', 'b'); +create table t2 select group_concat(b) as a from t1 where a = 'a'; +create table t3 (select group_concat(a) as a from t1 where a = 'a') union + (select group_concat(b) as a from t1 where a = 'b'); +select charset(a) from t2; +select charset(a) from t3; +drop table t1, t2, t3; +set names default; + +# +# Bug#18281 group_concat changes charset to binary +# +create table t1 (c1 varchar(10), c2 int); +select charset(group_concat(c1 order by c2)) from t1; +drop table t1; + +# +# Bug #16712: group_concat returns odd string instead of intended result +# +CREATE TABLE t1 (a INT(10), b LONGTEXT, PRIMARY KEY (a)); + +SET GROUP_CONCAT_MAX_LEN = 20000000; + +INSERT INTO t1 VALUES (1,REPEAT(CONCAT('A',CAST(CHAR(0) AS BINARY),'B'), 40000)); +INSERT INTO t1 SELECT a + 1, b FROM t1; + +SELECT a, CHAR_LENGTH(b) FROM t1; +SELECT CHAR_LENGTH( GROUP_CONCAT(b) ) FROM t1; +SET GROUP_CONCAT_MAX_LEN = 1024; +DROP TABLE t1; + +# +# Bug #22015: crash with GROUP_CONCAT over a derived table that +# returns the results of aggregation by GROUP_CONCAT +# + +CREATE TABLE t1 (a int, b int); + +INSERT INTO t1 VALUES (2,1), (1,2), (2,2), (1,3); + +SELECT GROUP_CONCAT(a), x + FROM (SELECT a, GROUP_CONCAT(b) x FROM t1 GROUP BY a) AS s + GROUP BY x; + +DROP TABLE t1; +# +# Bug#23451 GROUP_CONCAT truncates a multibyte utf8 character +# +set names utf8; +create table t1 +( + x text character set utf8 not null, + y integer not null +); +insert into t1 values (repeat('a', 1022), 0), (repeat(_utf8 0xc3b7, 4), 0); +let $1= 10; +while ($1) +{ + eval set group_concat_max_len= 1022 + $1; + --disable_result_log + select @x:=group_concat(x) from t1 group by y; + --enable_result_log + select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12); + dec $1; +} +drop table t1; +set group_concat_max_len=1024; +set names latin1; + +# +# Bug#14169 type of group_concat() result changed to blob if tmp_table was used +# +create table t1 (f1 int unsigned, f2 varchar(255)); +insert into t1 values (1,repeat('a',255)),(2,repeat('b',255)); +--enable_metadata +select f2,group_concat(f1) from t1 group by f2; +--disable_metadata +drop table t1; + +# +# Bug #26815: Unexpected built-in function behavior: group_concat(distinct +# substring_index()) +# +CREATE TABLE t1(a TEXT, b CHAR(20)); +INSERT INTO t1 VALUES ("one.1","one.1"),("two.2","two.2"),("one.3","one.3"); +SELECT GROUP_CONCAT(DISTINCT UCASE(a)) FROM t1; +SELECT GROUP_CONCAT(DISTINCT UCASE(b)) FROM t1; +DROP TABLE t1; + +# +# Bug #28273: GROUP_CONCAT and ORDER BY: No warning when result gets truncated. +# +CREATE TABLE t1( a VARCHAR( 10 ), b INT ); +INSERT INTO t1 VALUES ( repeat( 'a', 10 ), 1), + ( repeat( 'b', 10 ), 2); +SET group_concat_max_len = 20; +SELECT GROUP_CONCAT( a ) FROM t1; +SELECT GROUP_CONCAT( DISTINCT a ) FROM t1; +SELECT GROUP_CONCAT( a ORDER BY b ) FROM t1; +SELECT GROUP_CONCAT( DISTINCT a ORDER BY b ) FROM t1; +SET group_concat_max_len = DEFAULT; +DROP TABLE t1; +# Bug #23856:GROUP_CONCAT and ORDER BY: junk from previous rows for query on I_S +# +SET group_concat_max_len= 65535; +CREATE TABLE t1( a TEXT, b INTEGER ); +INSERT INTO t1 VALUES ( 'a', 0 ), ( 'b', 1 ); +SELECT GROUP_CONCAT( a ORDER BY b ) FROM t1; +SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1; +SELECT GROUP_CONCAT(DISTINCT a) FROM t1; +SET group_concat_max_len= 10; +SELECT GROUP_CONCAT(a ORDER BY b) FROM t1; +SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1; +SELECT GROUP_CONCAT(DISTINCT a) FROM t1; + +SET group_concat_max_len= 65535; +CREATE TABLE t2( a TEXT ); +INSERT INTO t2 VALUES( REPEAT( 'a', 5000 ) ); +INSERT INTO t2 VALUES( REPEAT( 'b', 5000 ) ); +INSERT INTO t2 VALUES( REPEAT( 'a', 5000 ) ); +SELECT LENGTH( GROUP_CONCAT( DISTINCT a ) ) FROM t2; + +CREATE TABLE t3( a TEXT, b INT ); +INSERT INTO t3 VALUES( REPEAT( 'a', 65534 ), 1 ); +INSERT INTO t3 VALUES( REPEAT( 'a', 65535 ), 2 ); +INSERT IGNORE INTO t3 VALUES( REPEAT( 'a', 65536 ), 3 ); +SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 1; +SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 2; +SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 3; + +SET group_concat_max_len= DEFAULT; +DROP TABLE t1, t2, t3; + +# +# Bug#29850: Wrong charset of the GROUP_CONCAT result when the select employs +# a temporary table. +# +set names latin1; +create table t1 (id int, name varchar(20)) DEFAULT CHARSET=utf8; +insert into t1 (id, name) values (1, "�ra"); +insert into t1 (id, name) values (2, "�ra"); +select b.id, group_concat(b.name) from t1 a, t1 b group by b.id; +drop table t1; + +# +# Bug #31154: group_concat() and bit fields; +# +create table t1(a bit not null); +insert ignore into t1 values (), (), (); +select group_concat(distinct a) from t1; +select group_concat(distinct a order by a) from t1; +drop table t1; + +create table t1(a bit(2) not null); +insert into t1 values (1), (0), (0), (3), (1); +select group_concat(distinct a) from t1; +select group_concat(distinct a order by a) from t1; +select group_concat(distinct a order by a desc) from t1; +drop table t1; + +create table t1(a bit(2), b varchar(10), c bit); +insert into t1 values (1, 'a', 0), (0, 'b', 1), (0, 'c', 0), (3, 'd', 1), +(1, 'e', 1), (3, 'f', 1), (0, 'g', 1); +select group_concat(distinct a, c) from t1; +select group_concat(distinct a, c order by a) from t1; +select group_concat(distinct a, c) from t1; +select group_concat(distinct a, c order by a, c) from t1; +select group_concat(distinct a, c order by a desc, c desc) from t1; + +drop table t1; + + +# +# Bug#30897 GROUP_CONCAT returns extra comma on empty fields +# +create table t1 (f1 char(20)); +insert into t1 values (''),(''); +select group_concat(distinct f1) from t1; +select group_concat(f1) from t1; +drop table t1; +# Bug#32798: DISTINCT in GROUP_CONCAT clause fails when ordering by a column +# with null values +#' +CREATE TABLE t1 (a INT, b INT); + +INSERT INTO t1 VALUES (1, 1), (2, 2), (2, 3); + +SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1; +SELECT GROUP_CONCAT(DISTINCT a ORDER BY b DESC) FROM t1; +SELECT GROUP_CONCAT(DISTINCT a) FROM t1; + +SELECT GROUP_CONCAT(DISTINCT a + 1 ORDER BY 3 - b) FROM t1; +SELECT GROUP_CONCAT(DISTINCT a + 1 ORDER BY b) FROM t1; +SELECT GROUP_CONCAT(a ORDER BY 3 - b) FROM t1; + +CREATE TABLE t2 (a INT, b INT, c INT, d INT); + +# There is one duplicate in the expression list: 1,10 +# There is one duplicate in ORDER BY list, but that shouldnt matter: 1,10 +INSERT INTO t2 VALUES (1,1, 1,1), (1,1, 2,2), (1,2, 2,1), (2,1, 1,2); + +SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY c, d) FROM t2; +SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY d, c) FROM t2; + +CREATE TABLE t3 (a INT, b INT, c INT); + +INSERT INTO t3 VALUES (1, 1, 1), (2, 1, 2), (3, 2, 1); + +SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY b, c) FROM t3; +SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY c, b) FROM t3; + +SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY a, b) FROM t1; +SELECT GROUP_CONCAT(DISTINCT b, a ORDER BY a, b) FROM t1; +SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY b, a) FROM t1; +SELECT GROUP_CONCAT(DISTINCT b, a ORDER BY a, b) FROM t1; +SELECT GROUP_CONCAT(DISTINCT a ORDER BY a, b) FROM t1; +SELECT GROUP_CONCAT(DISTINCT b ORDER BY b, a) FROM t1; +SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY a) FROM t1; +SELECT GROUP_CONCAT(DISTINCT b, a ORDER BY b) FROM t1; + +DROP TABLE t1, t2, t3; + +# +# Bug #34747: crash in debug assertion check after derived table +# +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES (),(); +SELECT s1.d1 FROM +( + SELECT + t1.a as d1, + GROUP_CONCAT(DISTINCT t1.a) AS d2 + FROM + t1 AS t1, + t1 AS t2 + GROUP BY 1 +) AS s1; +DROP TABLE t1; + +# +# Bug #35298: GROUP_CONCAT with DISTINCT can crash the server +# + +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a INT); + +INSERT INTO t1 VALUES(1); + +SELECT GROUP_CONCAT(DISTINCT t2.a) FROM t1 LEFT JOIN t2 ON t2.a = t1.a GROUP BY t1.a; + +DROP TABLE t1, t2; + +# +# Bug #36024: group_concat distinct in subquery crash +# + +CREATE TABLE t1 (a INT, KEY(a)); +CREATE TABLE t2 (b INT); + +INSERT INTO t1 VALUES (NULL), (8), (2); +INSERT INTO t2 VALUES (4), (10); + +SELECT 1 FROM t1 WHERE t1.a NOT IN +( + SELECT GROUP_CONCAT(DISTINCT t1.a) + FROM t1 WHERE t1.a IN + ( + SELECT b FROM t2 + ) + AND NOT t1.a >= (SELECT t1.a FROM t1 LIMIT 1) + GROUP BY t1.a +); + +DROP TABLE t1, t2; + +# +# Bug #49487: crash with explain extended and group_concat in a derived table +# + +CREATE TABLE t1 (f1 INT); +INSERT INTO t1 VALUES (),(); + +EXPLAIN EXTENDED SELECT 1 FROM + (SELECT DISTINCT GROUP_CONCAT(td.f1) FROM t1,t1 AS td GROUP BY td.f1) AS d,t1; + +SELECT 1 FROM + (SELECT DISTINCT GROUP_CONCAT(td.f1) FROM t1,t1 AS td GROUP BY td.f1) AS d,t1; + +DROP TABLE t1; + +--echo End of 5.0 tests + +--echo # +--echo # Bug #52397: another crash with explain extended and group_concat +--echo # +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (0), (0); +EXPLAIN EXTENDED SELECT 1 FROM + (SELECT GROUP_CONCAT(t1.a ORDER BY t1.a ASC) FROM + t1 t2, t1 GROUP BY t1.a) AS d; +DROP TABLE t1; + + +--echo End of 5.0 tests + + +--echo # +--echo # Bug #54476: crash when group_concat and 'with rollup' in prepared statements +--echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1), (2); + +PREPARE stmt FROM "SELECT GROUP_CONCAT(t1.a ORDER BY t1.a) FROM t1 JOIN t1 t2 GROUP BY t1.a WITH ROLLUP"; +EXECUTE stmt; +EXECUTE stmt; + +DEALLOCATE PREPARE stmt; +DROP TABLE t1; + +--echo # +--echo # Bug#57194 group_concat cause crash and/or invalid memory reads with type errors +--echo # + +CREATE TABLE t1(f1 int); +INSERT INTO t1 values (0),(0); +--disable_ps_protocol +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT POLYGON((SELECT 1 FROM (SELECT 1 IN (GROUP_CONCAT(t1.f1)) FROM t1, t1 t GROUP BY t.f1 ) d)); +--enable_ps_protocol +DROP TABLE t1; + +--echo # +--echo # Bug#58396 group_concat and explain extended are still crashy +--echo # + +CREATE TABLE t1(a INT); +--error ER_UNKNOWN_ERROR +EXPLAIN EXTENDED SELECT UPDATEXML('1', a, '1') +FROM t1 ORDER BY (SELECT GROUP_CONCAT(1) FROM t1); +SHOW WARNINGS; +DROP TABLE t1; + +--echo End of 5.1 tests + + +# +# Bug#36785: Wrong error message when group_concat() exceeds max length +# + +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings + +CREATE TABLE t1 (a VARCHAR(6), b INT); +CREATE TABLE t2 (a VARCHAR(6), b INT); + +INSERT INTO t1 VALUES ('111111', 1); +INSERT INTO t1 VALUES ('222222', 2); +INSERT INTO t1 VALUES ('333333', 3); +INSERT INTO t1 VALUES ('444444', 4); +INSERT INTO t1 VALUES ('555555', 5); + +SET group_concat_max_len = 5; +SET @old_sql_mode = @@sql_mode, @@sql_mode = 'traditional'; + +SELECT GROUP_CONCAT(a), b FROM t1 GROUP BY b LIMIT 3; +--error ER_CUT_VALUE_GROUP_CONCAT +INSERT INTO t2 SELECT GROUP_CONCAT(a), b FROM t1 GROUP BY b; +UPDATE t1 SET a = '11111' WHERE b = 1; +UPDATE t1 SET a = '22222' WHERE b = 2; +--error ER_CUT_VALUE_GROUP_CONCAT +INSERT INTO t2 SELECT GROUP_CONCAT(a), b FROM t1 GROUP BY b; + +SET group_concat_max_len = DEFAULT; +SET @@sql_mode = @old_sql_mode; +DROP TABLE t1, t2; + +# +# MDEV-3987 uninitialized read in Item_cond::fix_fields leads to crash: select .. where .. in ( select ... ) +# +create table t1 (a char(1) character set utf8); +insert into t1 values ('a'),('b'); +select 1 from t1 where a in (select group_concat(a) from t1); +drop table t1; + +# +# MDEV-7820 Server crashes in in my_strcasecmp_utf8 on subquery in ORDER BY clause of GROUP_CONCAT +# +CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('a'),('b'); + +CREATE TABLE t2 (f2 VARCHAR(10)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('c'); + +CREATE TABLE t3 (f3 VARCHAR(10)) ENGINE=MyISAM; +INSERT INTO t3 VALUES ('d'),('e'); + +SELECT GROUP_CONCAT( f2 ORDER BY ( f2 IN ( SELECT f1 FROM t1 WHERE f1 <= f2 ) ) ) AS field +FROM ( SELECT * FROM t2 ) AS sq2, t3 +ORDER BY field; + +drop table t3, t2, t1; + +--echo # +--echo # MDEV-7821 - Server crashes in Item_func_group_concat::fix_fields on 2nd +--echo # execution of PS +--echo # +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES(1),(2); +PREPARE stmt FROM "SELECT GROUP_CONCAT(t1a.a ORDER BY 1, t1a.a=0) FROM t1 AS t1a, t1 AS t1b GROUP BY t1a.a"; +EXECUTE stmt; +EXECUTE stmt; +DROP TABLE t1; + +--echo # +--echo # WL#6098 Eliminate GROUP_CONCAT intermediate result limitation. +--echo # Bug#13387020 GROUP_CONCAT WITH ORDER BY RESULTS ARE TRUNCATED. +--echo # + + +SET group_concat_max_len= 9999999; +CREATE TABLE t1 (f1 LONGTEXT , f2 INTEGER); +INSERT INTO t1 VALUES (REPEAT('a', 500000), 0), (REPEAT('b', 500000), 1), (REPEAT('c', 500000), 2); + +SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1; +SELECT LENGTH(GROUP_CONCAT(DISTINCT f1 ORDER BY f1 DESC)) FROM t1; +SELECT SUBSTRING(GROUP_CONCAT(DISTINCT f1 ORDER BY f1 DESC), 1, 5) FROM t1; +SELECT LENGTH(GROUP_CONCAT(DISTINCT f1)) FROM t1; + +SELECT LENGTH(GROUP_CONCAT(UPPER(f1) ORDER BY f2)) FROM t1; +SELECT LENGTH(GROUP_CONCAT(DISTINCT UPPER(f1) ORDER BY f1)) FROM t1; +SELECT SUBSTRING(GROUP_CONCAT(DISTINCT UPPER(f1) ORDER BY f1), 1, 5) FROM t1; +SELECT LENGTH(GROUP_CONCAT(DISTINCT UPPER(f1))) FROM t1; + +CREATE TABLE t2 SELECT GROUP_CONCAT(f1 order by f2) FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; + +CREATE TABLE t2 SELECT GROUP_CONCAT(UPPER(f1) ORDER BY f2) FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; + +SET group_concat_max_len= 1024; +SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1; + +SET group_concat_max_len= 499999; +SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1 WHERE f2 = 0; +SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1 GROUP BY f2; + +INSERT INTO t1 VALUES (REPEAT('a', 499999), 3), (REPEAT('b', 500000), 4); +SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1 GROUP BY f2; + +DROP TABLE t1; +SET group_concat_max_len= DEFAULT; + ++# ++# MDEV-9531 GROUP_CONCAT with ORDER BY inside takes a lot of memory while it's executed ++# ++set session group_concat_max_len=1024; ++set max_session_mem_used=16*1024*1024; # 8M..32M ++SELECT GROUP_CONCAT(concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1) ORDER BY 2,1,3,4,6,5,8,7) AS c ++FROM seq_1_to_200000; ++set max_session_mem_used=default; ++set session group_concat_max_len=default; ++ ++# ++# MDEV-19350 Server crashes in delete_tree_element / ... / Item_func_group_concat::repack_tree ++# ++SET group_concat_max_len= 8; ++CREATE TABLE t1 (a INT); ++INSERT t1 VALUES (1),(2); ++CREATE TABLE t2 (b DATE, c INT); ++INSERT t2 VALUES ('2019-12-04',1),('2020-03-28',2); ++CREATE TABLE t3 (d INT); ++INSERT t3 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14); ++CREATE TABLE t4 (e INT); ++INSERT t4 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15); ++SELECT (SELECT MAX(a) FROM t1 WHERE t2_sq.c > 0) AS f, ++ GROUP_CONCAT(t2_sq.b ORDER BY 1) AS gc ++FROM (SELECT t2_a.* FROM t2 AS t2_a, t2 AS t2_b) AS t2_sq, t3, t4 ++GROUP BY f; ++DROP TABLE t1, t2, t3, t4; ++SET group_concat_max_len= default; ++ + +--echo # +--echo # Start of 10.2 tests +--echo # + +--echo # +--echo # MDEV-10124 Incorrect usage of CUBE/ROLLUP and ORDER BY with GROUP_CONCAT(a ORDER BY a) +--echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (10),(20),(30); + +SELECT a,GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP; +CREATE VIEW v1 AS +SELECT a,GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP; +SELECT * FROM v1; +DROP VIEW v1; + +SELECT a,GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30'; +CREATE VIEW v1 AS +SELECT a,GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30'; +SELECT * FROM v1; +DROP VIEW v1; + +SELECT * FROM (SELECT a,GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30') t1; +CREATE VIEW v1 AS +SELECT * FROM (SELECT a,GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30') t1; +SELECT * FROM v1; +DROP VIEW v1; + +SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30'); +CREATE VIEW v1 AS +SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30'); +SELECT * FROM v1; +DROP VIEW v1; + +DROP TABLE t1; + +--echo # +--echo # End of 10.2 tests +--echo # + + +--echo # +--echo # Start of 10.3 tests +--echo # + +# +# MDEV-11297: Add support for LIMIT clause in GROUP_CONCAT() +# +--disable_warnings +drop table if exists t1, t2; +--enable_warnings + +create table t1 (grp int, a bigint unsigned, c char(10) , d char(10) not null); +insert into t1 values (1,1,NULL,"a"); +insert into t1 values (1,10,"b","a"); +insert into t1 values (1,11,"c","a"); +insert into t1 values (2,2,"c","a"); +insert into t1 values (2,3,"b","b"); +insert into t1 values (3,4,"E","a"); +insert into t1 values (3,5,"C","b"); +insert into t1 values (3,6,"D","c"); +insert into t1 values (3,7,"E","c"); + + +select grp,group_concat(c) from t1 group by grp; +select grp,group_concat(c limit 1 ) from t1 group by grp; +select grp,group_concat(c limit 1,1 ) from t1 group by grp; +select grp,group_concat(c limit 1,10 ) from t1 group by grp; +select grp,group_concat(c limit 1000) from t1 group by grp; +select group_concat(grp limit 0) from t1; +--error ER_PARSE_ERROR +select group_concat(grp limit "sdjadjs") from t1 +--error ER_PARSE_ERROR +select grp,group_concat(c limit 5.5) from t1 group by grp ; +select grp,group_concat(distinct c limit 1,10 ) from t1 group by grp; +select grp,group_concat(c order by a) from t1 group by grp; +select grp,group_concat(c order by a limit 2 ) from t1 group by grp; +select grp,group_concat(c order by a limit 1,1 ) 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 limit 2) from t1 group by grp; +select grp,group_concat(c order by c desc) from t1 group by grp; +select grp,group_concat(c order by c desc limit 2) from t1 group by grp; + +drop table t1; + +create table t2 (a int, b varchar(10)); +insert into t2 values(1,'a'),(1,'b'),(NULL,'c'),(2,'x'),(2,'y'); +select group_concat(a,b limit 2) from t2; + +set @x=4; +prepare STMT from 'select group_concat(b limit ?) from t2'; +execute STMT using @x; +set @x=2; +execute STMT using @x; +set @x=1000; +execute STMT using @x; +set @x=0; +execute STMT using @x; +set @x="adasfa"; +--error ER_INVALID_VALUE_TO_LIMIT +execute STMT using @x; +set @x=-1; +--error ER_WRONG_ARGUMENTS +execute STMT using @x; +set @x=4; +prepare STMT from 'select group_concat(a,b limit ?) from t2'; +execute STMT using @x; +drop table t2; + +--echo # +--echo # MDEV-18943: Group Concat with limit not working with views +--echo # + +create table t1 (a int, b varchar(10)); +insert into t1 values(1,'a'),(1,'b'),(NULL,'c'),(2,'x'),(2,'y'); +select group_concat(a,b limit 2) from t1; +create view v1 as select group_concat(a,b limit 2) from t1; +select * from v1; +drop view v1; +drop table t1; + +--echo # +--echo # End of 10.3 tests +--echo # diff --cc mysql-test/main/func_hybrid_type.result index 109f7a35038,00000000000..c7ec29f1a49 mode 100644,000000..100644 --- a/mysql-test/main/func_hybrid_type.result +++ b/mysql-test/main/func_hybrid_type.result @@@ -1,3889 -1,0 +1,3919 @@@ +# +# Start of 10.1 tests +# +# +# MDEV-8865 Wrong field type or metadata for COALESCE(signed_int_column, unsigned_int_column) +# +# +CREATE TABLE t1 (a INT, b INT UNSIGNED); +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (-1,1); +INSERT INTO t1 VALUES (-2147483648,4294967295); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 3 11 11 Y 32768 0 63 +def case_______a 3 11 11 Y 32896 0 63 +def case_____a_a 3 11 11 Y 32896 0 63 +def coalesce___a 3 11 11 Y 32896 0 63 +def coalesce_a_a 3 11 11 Y 32896 0 63 +def if_______a_a 3 11 11 Y 32896 0 63 +def ifnull___a_a 3 11 11 Y 32896 0 63 +def least____a_a 3 11 11 Y 32896 0 63 +def greatest_a_a 3 11 11 Y 32896 0 63 +def test t1 t1 b ___________b 3 10 10 Y 32800 0 63 +def case_______b 3 10 10 Y 32928 0 63 +def case_____b_b 3 10 10 Y 32928 0 63 +def coalesce___b 3 10 10 Y 32928 0 63 +def coalesce_b_b 3 10 10 Y 32928 0 63 +def if_______b_b 3 10 10 Y 32928 0 63 +def ifnull___b_b 3 10 10 Y 32928 0 63 +def least____b_b 3 10 10 Y 32928 0 63 +def greatest_b_b 3 10 10 Y 32928 0 63 +___________a 1 +case_______a 1 +case_____a_a 1 +coalesce___a 1 +coalesce_a_a 1 +if_______a_a 1 +ifnull___a_a 1 +least____a_a 1 +greatest_a_a 1 +___________b 1 +case_______b 1 +case_____b_b 1 +coalesce___b 1 +coalesce_b_b 1 +if_______b_b 1 +ifnull___b_b 1 +least____b_b 1 +greatest_b_b 1 +___________a -1 +case_______a -1 +case_____a_a -1 +coalesce___a -1 +coalesce_a_a -1 +if_______a_a -1 +ifnull___a_a -1 +least____a_a -1 +greatest_a_a -1 +___________b 1 +case_______b 1 +case_____b_b 1 +coalesce___b 1 +coalesce_b_b 1 +if_______b_b 1 +ifnull___b_b 1 +least____b_b 1 +greatest_b_b 1 +___________a -2147483648 +case_______a -2147483648 +case_____a_a -2147483648 +coalesce___a -2147483648 +coalesce_a_a -2147483648 +if_______a_a -2147483648 +ifnull___a_a -2147483648 +least____a_a -2147483648 +greatest_a_a -2147483648 +___________b 4294967295 +case_______b 4294967295 +case_____b_b 4294967295 +coalesce___b 4294967295 +coalesce_b_b 4294967295 +if_______b_b 4294967295 +ifnull___b_b 4294967295 +least____b_b 4294967295 +greatest_b_b 4294967295 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 246 11 11 Y 32896 0 63 +def case_____b_a 246 11 10 Y 32896 0 63 +def coalesce_a_b 246 11 11 Y 32896 0 63 +def coalesce_b_a 246 11 10 Y 32896 0 63 +def if_______a_b 246 11 10 Y 32896 0 63 +def if_______b_a 246 11 11 Y 32896 0 63 +def ifnull___a_b 246 11 11 Y 32896 0 63 +def ifnull___b_a 246 11 10 Y 32896 0 63 +def least____a_b 246 11 11 Y 32896 0 63 +def least____b_a 246 11 11 Y 32896 0 63 +def greatest_a_b 246 11 10 Y 32896 0 63 +def greatest_b_a 246 11 10 Y 32896 0 63 +case_____a_b 1 +case_____b_a 1 +coalesce_a_b 1 +coalesce_b_a 1 +if_______a_b 1 +if_______b_a 1 +ifnull___a_b 1 +ifnull___b_a 1 +least____a_b 1 +least____b_a 1 +greatest_a_b 1 +greatest_b_a 1 +case_____a_b -1 +case_____b_a 1 +coalesce_a_b -1 +coalesce_b_a 1 +if_______a_b 1 +if_______b_a -1 +ifnull___a_b -1 +ifnull___b_a 1 +least____a_b -1 +least____b_a -1 +greatest_a_b 1 +greatest_b_a 1 +case_____a_b -2147483648 +case_____b_a 4294967295 +coalesce_a_b -2147483648 +coalesce_b_a 4294967295 +if_______a_b 4294967295 +if_______b_a -2147483648 +ifnull___a_b -2147483648 +ifnull___b_a 4294967295 +least____a_b -2147483648 +least____b_a -2147483648 +greatest_a_b 4294967295 +greatest_b_a 4294967295 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` int(11) DEFAULT NULL, + `case_______a` int(11) DEFAULT NULL, + `case_____a_a` int(11) DEFAULT NULL, + `coalesce___a` int(11) DEFAULT NULL, + `coalesce_a_a` int(11) DEFAULT NULL, + `if_______a_a` int(11) DEFAULT NULL, + `ifnull___a_a` int(11) DEFAULT NULL, + `least____a_a` int(11) DEFAULT NULL, + `greatest_a_a` int(11) DEFAULT NULL, + `___________b` int(10) unsigned DEFAULT NULL, + `case_______b` int(10) unsigned DEFAULT NULL, + `case_____b_b` int(10) unsigned DEFAULT NULL, + `coalesce___b` int(10) unsigned DEFAULT NULL, + `coalesce_b_b` int(10) unsigned DEFAULT NULL, + `if_______b_b` int(10) unsigned DEFAULT NULL, + `ifnull___b_b` int(10) unsigned DEFAULT NULL, + `least____b_b` int(10) unsigned DEFAULT NULL, + `greatest_b_b` int(10) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` decimal(10,0) DEFAULT NULL, + `case_____b_a` decimal(10,0) DEFAULT NULL, + `coalesce_a_b` decimal(10,0) DEFAULT NULL, + `coalesce_b_a` decimal(10,0) DEFAULT NULL, + `if_______a_b` decimal(10,0) DEFAULT NULL, + `if_______b_a` decimal(10,0) DEFAULT NULL, + `ifnull___a_b` decimal(10,0) DEFAULT NULL, + `ifnull___b_a` decimal(10,0) DEFAULT NULL, + `least____a_b` decimal(10,0) DEFAULT NULL, + `least____b_a` decimal(10,0) DEFAULT NULL, + `greatest_a_b` decimal(10,0) DEFAULT NULL, + `greatest_b_a` decimal(10,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (-2147483648,2147483647); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 3 11 11 Y 32768 0 63 +def case_______a 3 11 11 Y 32896 0 63 +def case_____a_a 3 11 11 Y 32896 0 63 +def coalesce___a 3 11 11 Y 32896 0 63 +def coalesce_a_a 3 11 11 Y 32896 0 63 +def if_______a_a 3 11 11 Y 32896 0 63 +def ifnull___a_a 3 11 11 Y 32896 0 63 +def least____a_a 3 11 11 Y 32896 0 63 +def greatest_a_a 3 11 11 Y 32896 0 63 +def test t1 t1 b ___________b 3 11 10 Y 32768 0 63 +def case_______b 3 11 10 Y 32896 0 63 +def case_____b_b 3 11 10 Y 32896 0 63 +def coalesce___b 3 11 10 Y 32896 0 63 +def coalesce_b_b 3 11 10 Y 32896 0 63 +def if_______b_b 3 11 10 Y 32896 0 63 +def ifnull___b_b 3 11 10 Y 32896 0 63 +def least____b_b 3 11 10 Y 32896 0 63 +def greatest_b_b 3 11 10 Y 32896 0 63 +___________a 1 +case_______a 1 +case_____a_a 1 +coalesce___a 1 +coalesce_a_a 1 +if_______a_a 1 +ifnull___a_a 1 +least____a_a 1 +greatest_a_a 1 +___________b 1 +case_______b 1 +case_____b_b 1 +coalesce___b 1 +coalesce_b_b 1 +if_______b_b 1 +ifnull___b_b 1 +least____b_b 1 +greatest_b_b 1 +___________a -2147483648 +case_______a -2147483648 +case_____a_a -2147483648 +coalesce___a -2147483648 +coalesce_a_a -2147483648 +if_______a_a -2147483648 +ifnull___a_a -2147483648 +least____a_a -2147483648 +greatest_a_a -2147483648 +___________b 2147483647 +case_______b 2147483647 +case_____b_b 2147483647 +coalesce___b 2147483647 +coalesce_b_b 2147483647 +if_______b_b 2147483647 +ifnull___b_b 2147483647 +least____b_b 2147483647 +greatest_b_b 2147483647 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 3 11 11 Y 32896 0 63 +def case_____b_a 3 11 10 Y 32896 0 63 +def coalesce_a_b 3 11 11 Y 32896 0 63 +def coalesce_b_a 3 11 10 Y 32896 0 63 +def if_______a_b 3 11 10 Y 32896 0 63 +def if_______b_a 3 11 11 Y 32896 0 63 +def ifnull___a_b 3 11 11 Y 32896 0 63 +def ifnull___b_a 3 11 10 Y 32896 0 63 +def least____a_b 3 11 11 Y 32896 0 63 +def least____b_a 3 11 11 Y 32896 0 63 +def greatest_a_b 3 11 10 Y 32896 0 63 +def greatest_b_a 3 11 10 Y 32896 0 63 +case_____a_b 1 +case_____b_a 1 +coalesce_a_b 1 +coalesce_b_a 1 +if_______a_b 1 +if_______b_a 1 +ifnull___a_b 1 +ifnull___b_a 1 +least____a_b 1 +least____b_a 1 +greatest_a_b 1 +greatest_b_a 1 +case_____a_b -2147483648 +case_____b_a 2147483647 +coalesce_a_b -2147483648 +coalesce_b_a 2147483647 +if_______a_b 2147483647 +if_______b_a -2147483648 +ifnull___a_b -2147483648 +ifnull___b_a 2147483647 +least____a_b -2147483648 +least____b_a -2147483648 +greatest_a_b 2147483647 +greatest_b_a 2147483647 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` int(11) DEFAULT NULL, + `case_______a` int(11) DEFAULT NULL, + `case_____a_a` int(11) DEFAULT NULL, + `coalesce___a` int(11) DEFAULT NULL, + `coalesce_a_a` int(11) DEFAULT NULL, + `if_______a_a` int(11) DEFAULT NULL, + `ifnull___a_a` int(11) DEFAULT NULL, + `least____a_a` int(11) DEFAULT NULL, + `greatest_a_a` int(11) DEFAULT NULL, + `___________b` int(11) DEFAULT NULL, + `case_______b` int(11) DEFAULT NULL, + `case_____b_b` int(11) DEFAULT NULL, + `coalesce___b` int(11) DEFAULT NULL, + `coalesce_b_b` int(11) DEFAULT NULL, + `if_______b_b` int(11) DEFAULT NULL, + `ifnull___b_b` int(11) DEFAULT NULL, + `least____b_b` int(11) DEFAULT NULL, + `greatest_b_b` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` int(11) DEFAULT NULL, + `case_____b_a` int(11) DEFAULT NULL, + `coalesce_a_b` int(11) DEFAULT NULL, + `coalesce_b_a` int(11) DEFAULT NULL, + `if_______a_b` int(11) DEFAULT NULL, + `if_______b_a` int(11) DEFAULT NULL, + `ifnull___a_b` int(11) DEFAULT NULL, + `ifnull___b_a` int(11) DEFAULT NULL, + `least____a_b` int(11) DEFAULT NULL, + `least____b_a` int(11) DEFAULT NULL, + `greatest_a_b` int(11) DEFAULT NULL, + `greatest_b_a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +CREATE TABLE t1 (a BIGINT, b BIGINT UNSIGNED); +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (-9223372036854775808,0xFFFFFFFFFFFFFFFF); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 8 20 20 Y 32768 0 63 +def case_______a 8 20 20 Y 32896 0 63 +def case_____a_a 8 20 20 Y 32896 0 63 +def coalesce___a 8 20 20 Y 32896 0 63 +def coalesce_a_a 8 20 20 Y 32896 0 63 +def if_______a_a 8 20 20 Y 32896 0 63 +def ifnull___a_a 8 20 20 Y 32896 0 63 +def least____a_a 8 20 20 Y 32896 0 63 +def greatest_a_a 8 20 20 Y 32896 0 63 +def test t1 t1 b ___________b 8 20 20 Y 32800 0 63 +def case_______b 8 20 20 Y 32928 0 63 +def case_____b_b 8 20 20 Y 32928 0 63 +def coalesce___b 8 20 20 Y 32928 0 63 +def coalesce_b_b 8 20 20 Y 32928 0 63 +def if_______b_b 8 20 20 Y 32928 0 63 +def ifnull___b_b 8 20 20 Y 32928 0 63 +def least____b_b 8 20 20 Y 32928 0 63 +def greatest_b_b 8 20 20 Y 32928 0 63 +___________a 1 +case_______a 1 +case_____a_a 1 +coalesce___a 1 +coalesce_a_a 1 +if_______a_a 1 +ifnull___a_a 1 +least____a_a 1 +greatest_a_a 1 +___________b 1 +case_______b 1 +case_____b_b 1 +coalesce___b 1 +coalesce_b_b 1 +if_______b_b 1 +ifnull___b_b 1 +least____b_b 1 +greatest_b_b 1 +___________a -9223372036854775808 +case_______a -9223372036854775808 +case_____a_a -9223372036854775808 +coalesce___a -9223372036854775808 +coalesce_a_a -9223372036854775808 +if_______a_a -9223372036854775808 +ifnull___a_a -9223372036854775808 +least____a_a -9223372036854775808 +greatest_a_a -9223372036854775808 +___________b 18446744073709551615 +case_______b 18446744073709551615 +case_____b_b 18446744073709551615 +coalesce___b 18446744073709551615 +coalesce_b_b 18446744073709551615 +if_______b_b 18446744073709551615 +ifnull___b_b 18446744073709551615 +least____b_b 18446744073709551615 +greatest_b_b 18446744073709551615 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 246 21 20 Y 32896 0 63 +def case_____b_a 246 21 20 Y 32896 0 63 +def coalesce_a_b 246 21 20 Y 32896 0 63 +def coalesce_b_a 246 21 20 Y 32896 0 63 +def if_______a_b 246 21 20 Y 32896 0 63 +def if_______b_a 246 21 20 Y 32896 0 63 +def ifnull___a_b 246 21 20 Y 32896 0 63 +def ifnull___b_a 246 21 20 Y 32896 0 63 +def least____a_b 246 21 20 Y 32896 0 63 +def least____b_a 246 21 20 Y 32896 0 63 +def greatest_a_b 246 21 20 Y 32896 0 63 +def greatest_b_a 246 21 20 Y 32896 0 63 +case_____a_b 1 +case_____b_a 1 +coalesce_a_b 1 +coalesce_b_a 1 +if_______a_b 1 +if_______b_a 1 +ifnull___a_b 1 +ifnull___b_a 1 +least____a_b 1 +least____b_a 1 +greatest_a_b 1 +greatest_b_a 1 +case_____a_b -9223372036854775808 +case_____b_a 18446744073709551615 +coalesce_a_b -9223372036854775808 +coalesce_b_a 18446744073709551615 +if_______a_b 18446744073709551615 +if_______b_a -9223372036854775808 +ifnull___a_b -9223372036854775808 +ifnull___b_a 18446744073709551615 +least____a_b -9223372036854775808 +least____b_a -9223372036854775808 +greatest_a_b 18446744073709551615 +greatest_b_a 18446744073709551615 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` bigint(20) DEFAULT NULL, + `case_______a` bigint(20) DEFAULT NULL, + `case_____a_a` bigint(20) DEFAULT NULL, + `coalesce___a` bigint(20) DEFAULT NULL, + `coalesce_a_a` bigint(20) DEFAULT NULL, + `if_______a_a` bigint(20) DEFAULT NULL, + `ifnull___a_a` bigint(20) DEFAULT NULL, + `least____a_a` bigint(20) DEFAULT NULL, + `greatest_a_a` bigint(20) DEFAULT NULL, + `___________b` bigint(20) unsigned DEFAULT NULL, + `case_______b` bigint(20) unsigned DEFAULT NULL, + `case_____b_b` bigint(20) unsigned DEFAULT NULL, + `coalesce___b` bigint(20) unsigned DEFAULT NULL, + `coalesce_b_b` bigint(20) unsigned DEFAULT NULL, + `if_______b_b` bigint(20) unsigned DEFAULT NULL, + `ifnull___b_b` bigint(20) unsigned DEFAULT NULL, + `least____b_b` bigint(20) unsigned DEFAULT NULL, + `greatest_b_b` bigint(20) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` decimal(20,0) DEFAULT NULL, + `case_____b_a` decimal(20,0) DEFAULT NULL, + `coalesce_a_b` decimal(20,0) DEFAULT NULL, + `coalesce_b_a` decimal(20,0) DEFAULT NULL, + `if_______a_b` decimal(20,0) DEFAULT NULL, + `if_______b_a` decimal(20,0) DEFAULT NULL, + `ifnull___a_b` decimal(20,0) DEFAULT NULL, + `ifnull___b_a` decimal(20,0) DEFAULT NULL, + `least____a_b` decimal(20,0) DEFAULT NULL, + `least____b_a` decimal(20,0) DEFAULT NULL, + `greatest_a_b` decimal(20,0) DEFAULT NULL, + `greatest_b_a` decimal(20,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +CREATE TABLE t1 (a BIGINT, b BIGINT); +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (-9223372036854775808,9223372036854775807); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 8 20 20 Y 32768 0 63 +def case_______a 8 20 20 Y 32896 0 63 +def case_____a_a 8 20 20 Y 32896 0 63 +def coalesce___a 8 20 20 Y 32896 0 63 +def coalesce_a_a 8 20 20 Y 32896 0 63 +def if_______a_a 8 20 20 Y 32896 0 63 +def ifnull___a_a 8 20 20 Y 32896 0 63 +def least____a_a 8 20 20 Y 32896 0 63 +def greatest_a_a 8 20 20 Y 32896 0 63 +def test t1 t1 b ___________b 8 20 19 Y 32768 0 63 +def case_______b 8 20 19 Y 32896 0 63 +def case_____b_b 8 20 19 Y 32896 0 63 +def coalesce___b 8 20 19 Y 32896 0 63 +def coalesce_b_b 8 20 19 Y 32896 0 63 +def if_______b_b 8 20 19 Y 32896 0 63 +def ifnull___b_b 8 20 19 Y 32896 0 63 +def least____b_b 8 20 19 Y 32896 0 63 +def greatest_b_b 8 20 19 Y 32896 0 63 +___________a 1 +case_______a 1 +case_____a_a 1 +coalesce___a 1 +coalesce_a_a 1 +if_______a_a 1 +ifnull___a_a 1 +least____a_a 1 +greatest_a_a 1 +___________b 1 +case_______b 1 +case_____b_b 1 +coalesce___b 1 +coalesce_b_b 1 +if_______b_b 1 +ifnull___b_b 1 +least____b_b 1 +greatest_b_b 1 +___________a -9223372036854775808 +case_______a -9223372036854775808 +case_____a_a -9223372036854775808 +coalesce___a -9223372036854775808 +coalesce_a_a -9223372036854775808 +if_______a_a -9223372036854775808 +ifnull___a_a -9223372036854775808 +least____a_a -9223372036854775808 +greatest_a_a -9223372036854775808 +___________b 9223372036854775807 +case_______b 9223372036854775807 +case_____b_b 9223372036854775807 +coalesce___b 9223372036854775807 +coalesce_b_b 9223372036854775807 +if_______b_b 9223372036854775807 +ifnull___b_b 9223372036854775807 +least____b_b 9223372036854775807 +greatest_b_b 9223372036854775807 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 8 20 20 Y 32896 0 63 +def case_____b_a 8 20 19 Y 32896 0 63 +def coalesce_a_b 8 20 20 Y 32896 0 63 +def coalesce_b_a 8 20 19 Y 32896 0 63 +def if_______a_b 8 20 19 Y 32896 0 63 +def if_______b_a 8 20 20 Y 32896 0 63 +def ifnull___a_b 8 20 20 Y 32896 0 63 +def ifnull___b_a 8 20 19 Y 32896 0 63 +def least____a_b 8 20 20 Y 32896 0 63 +def least____b_a 8 20 20 Y 32896 0 63 +def greatest_a_b 8 20 19 Y 32896 0 63 +def greatest_b_a 8 20 19 Y 32896 0 63 +case_____a_b 1 +case_____b_a 1 +coalesce_a_b 1 +coalesce_b_a 1 +if_______a_b 1 +if_______b_a 1 +ifnull___a_b 1 +ifnull___b_a 1 +least____a_b 1 +least____b_a 1 +greatest_a_b 1 +greatest_b_a 1 +case_____a_b -9223372036854775808 +case_____b_a 9223372036854775807 +coalesce_a_b -9223372036854775808 +coalesce_b_a 9223372036854775807 +if_______a_b 9223372036854775807 +if_______b_a -9223372036854775808 +ifnull___a_b -9223372036854775808 +ifnull___b_a 9223372036854775807 +least____a_b -9223372036854775808 +least____b_a -9223372036854775808 +greatest_a_b 9223372036854775807 +greatest_b_a 9223372036854775807 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` bigint(20) DEFAULT NULL, + `case_______a` bigint(20) DEFAULT NULL, + `case_____a_a` bigint(20) DEFAULT NULL, + `coalesce___a` bigint(20) DEFAULT NULL, + `coalesce_a_a` bigint(20) DEFAULT NULL, + `if_______a_a` bigint(20) DEFAULT NULL, + `ifnull___a_a` bigint(20) DEFAULT NULL, + `least____a_a` bigint(20) DEFAULT NULL, + `greatest_a_a` bigint(20) DEFAULT NULL, + `___________b` bigint(20) DEFAULT NULL, + `case_______b` bigint(20) DEFAULT NULL, + `case_____b_b` bigint(20) DEFAULT NULL, + `coalesce___b` bigint(20) DEFAULT NULL, + `coalesce_b_b` bigint(20) DEFAULT NULL, + `if_______b_b` bigint(20) DEFAULT NULL, + `ifnull___b_b` bigint(20) DEFAULT NULL, + `least____b_b` bigint(20) DEFAULT NULL, + `greatest_b_b` bigint(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` bigint(20) DEFAULT NULL, + `case_____b_a` bigint(20) DEFAULT NULL, + `coalesce_a_b` bigint(20) DEFAULT NULL, + `coalesce_b_a` bigint(20) DEFAULT NULL, + `if_______a_b` bigint(20) DEFAULT NULL, + `if_______b_a` bigint(20) DEFAULT NULL, + `ifnull___a_b` bigint(20) DEFAULT NULL, + `ifnull___b_a` bigint(20) DEFAULT NULL, + `least____a_b` bigint(20) DEFAULT NULL, + `least____b_a` bigint(20) DEFAULT NULL, + `greatest_a_b` bigint(20) DEFAULT NULL, + `greatest_b_a` bigint(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +CREATE TABLE t1 (a INT, b BIT(8)); +INSERT INTO t1 VALUES (-2147483648,0x32); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 3 11 11 Y 32768 0 63 +def case_______a 3 11 11 Y 32896 0 63 +def case_____a_a 3 11 11 Y 32896 0 63 +def coalesce___a 3 11 11 Y 32896 0 63 +def coalesce_a_a 3 11 11 Y 32896 0 63 +def if_______a_a 3 11 11 Y 32896 0 63 +def ifnull___a_a 3 11 11 Y 32896 0 63 +def least____a_a 3 11 11 Y 32896 0 63 +def greatest_a_a 3 11 11 Y 32896 0 63 +def test t1 t1 b ___________b 16 8 1 Y 32 0 63 +def case_______b 16 8 2 Y 160 0 63 +def case_____b_b 16 8 2 Y 160 0 63 +def coalesce___b 16 8 2 Y 160 0 63 +def coalesce_b_b 16 8 2 Y 160 0 63 +def if_______b_b 16 8 2 Y 160 0 63 +def ifnull___b_b 16 8 2 Y 160 0 63 +def least____b_b 16 8 2 Y 160 0 63 +def greatest_b_b 16 8 2 Y 160 0 63 +___________a -2147483648 +case_______a -2147483648 +case_____a_a -2147483648 +coalesce___a -2147483648 +coalesce_a_a -2147483648 +if_______a_a -2147483648 +ifnull___a_a -2147483648 +least____a_a -2147483648 +greatest_a_a -2147483648 +___________b 2 +case_______b 50 +case_____b_b 50 +coalesce___b 50 +coalesce_b_b 50 +if_______b_b 50 +ifnull___b_b 50 +least____b_b 50 +greatest_b_b 50 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 246 11 11 Y 32896 0 63 +def case_____b_a 246 11 2 Y 32896 0 63 +def coalesce_a_b 246 11 11 Y 32896 0 63 +def coalesce_b_a 246 11 2 Y 32896 0 63 +def if_______a_b 246 11 2 Y 32896 0 63 +def if_______b_a 246 11 11 Y 32896 0 63 +def ifnull___a_b 246 11 11 Y 32896 0 63 +def ifnull___b_a 246 11 2 Y 32896 0 63 +def least____a_b 246 11 11 Y 32896 0 63 +def least____b_a 246 11 11 Y 32896 0 63 +def greatest_a_b 246 11 2 Y 32896 0 63 +def greatest_b_a 246 11 2 Y 32896 0 63 +case_____a_b -2147483648 +case_____b_a 50 +coalesce_a_b -2147483648 +coalesce_b_a 50 +if_______a_b 50 +if_______b_a -2147483648 +ifnull___a_b -2147483648 +ifnull___b_a 50 +least____a_b -2147483648 +least____b_a -2147483648 +greatest_a_b 50 +greatest_b_a 50 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` int(11) DEFAULT NULL, + `case_______a` int(11) DEFAULT NULL, + `case_____a_a` int(11) DEFAULT NULL, + `coalesce___a` int(11) DEFAULT NULL, + `coalesce_a_a` int(11) DEFAULT NULL, + `if_______a_a` int(11) DEFAULT NULL, + `ifnull___a_a` int(11) DEFAULT NULL, + `least____a_a` int(11) DEFAULT NULL, + `greatest_a_a` int(11) DEFAULT NULL, + `___________b` bit(8) DEFAULT NULL, + `case_______b` bit(8) DEFAULT NULL, + `case_____b_b` bit(8) DEFAULT NULL, + `coalesce___b` bit(8) DEFAULT NULL, + `coalesce_b_b` bit(8) DEFAULT NULL, + `if_______b_b` bit(8) DEFAULT NULL, + `ifnull___b_b` bit(8) DEFAULT NULL, + `least____b_b` bit(8) DEFAULT NULL, + `greatest_b_b` bit(8) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` decimal(10,0) DEFAULT NULL, + `case_____b_a` decimal(10,0) DEFAULT NULL, + `coalesce_a_b` decimal(10,0) DEFAULT NULL, + `coalesce_b_a` decimal(10,0) DEFAULT NULL, + `if_______a_b` decimal(10,0) DEFAULT NULL, + `if_______b_a` decimal(10,0) DEFAULT NULL, + `ifnull___a_b` decimal(10,0) DEFAULT NULL, + `ifnull___b_a` decimal(10,0) DEFAULT NULL, + `least____a_b` decimal(10,0) DEFAULT NULL, + `least____b_a` decimal(10,0) DEFAULT NULL, + `greatest_a_b` decimal(10,0) DEFAULT NULL, + `greatest_b_a` decimal(10,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +CREATE TABLE t1 (a INT UNSIGNED, b BIT(8)); +INSERT INTO t1 VALUES (4294967295,0x32); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 3 10 10 Y 32800 0 63 +def case_______a 3 10 10 Y 32928 0 63 +def case_____a_a 3 10 10 Y 32928 0 63 +def coalesce___a 3 10 10 Y 32928 0 63 +def coalesce_a_a 3 10 10 Y 32928 0 63 +def if_______a_a 3 10 10 Y 32928 0 63 +def ifnull___a_a 3 10 10 Y 32928 0 63 +def least____a_a 3 10 10 Y 32928 0 63 +def greatest_a_a 3 10 10 Y 32928 0 63 +def test t1 t1 b ___________b 16 8 1 Y 32 0 63 +def case_______b 16 8 2 Y 160 0 63 +def case_____b_b 16 8 2 Y 160 0 63 +def coalesce___b 16 8 2 Y 160 0 63 +def coalesce_b_b 16 8 2 Y 160 0 63 +def if_______b_b 16 8 2 Y 160 0 63 +def ifnull___b_b 16 8 2 Y 160 0 63 +def least____b_b 16 8 2 Y 160 0 63 +def greatest_b_b 16 8 2 Y 160 0 63 +___________a 4294967295 +case_______a 4294967295 +case_____a_a 4294967295 +coalesce___a 4294967295 +coalesce_a_a 4294967295 +if_______a_a 4294967295 +ifnull___a_a 4294967295 +least____a_a 4294967295 +greatest_a_a 4294967295 +___________b 2 +case_______b 50 +case_____b_b 50 +coalesce___b 50 +coalesce_b_b 50 +if_______b_b 50 +ifnull___b_b 50 +least____b_b 50 +greatest_b_b 50 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 3 10 10 Y 32928 0 63 +def case_____b_a 3 10 2 Y 32928 0 63 +def coalesce_a_b 3 10 10 Y 32928 0 63 +def coalesce_b_a 3 10 2 Y 32928 0 63 +def if_______a_b 3 10 2 Y 32928 0 63 +def if_______b_a 3 10 10 Y 32928 0 63 +def ifnull___a_b 3 10 10 Y 32928 0 63 +def ifnull___b_a 3 10 2 Y 32928 0 63 +def least____a_b 3 10 2 Y 32928 0 63 +def least____b_a 3 10 2 Y 32928 0 63 +def greatest_a_b 3 10 10 Y 32928 0 63 +def greatest_b_a 3 10 10 Y 32928 0 63 +case_____a_b 4294967295 +case_____b_a 50 +coalesce_a_b 4294967295 +coalesce_b_a 50 +if_______a_b 50 +if_______b_a 4294967295 +ifnull___a_b 4294967295 +ifnull___b_a 50 +least____a_b 50 +least____b_a 50 +greatest_a_b 4294967295 +greatest_b_a 4294967295 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` int(10) unsigned DEFAULT NULL, + `case_______a` int(10) unsigned DEFAULT NULL, + `case_____a_a` int(10) unsigned DEFAULT NULL, + `coalesce___a` int(10) unsigned DEFAULT NULL, + `coalesce_a_a` int(10) unsigned DEFAULT NULL, + `if_______a_a` int(10) unsigned DEFAULT NULL, + `ifnull___a_a` int(10) unsigned DEFAULT NULL, + `least____a_a` int(10) unsigned DEFAULT NULL, + `greatest_a_a` int(10) unsigned DEFAULT NULL, + `___________b` bit(8) DEFAULT NULL, + `case_______b` bit(8) DEFAULT NULL, + `case_____b_b` bit(8) DEFAULT NULL, + `coalesce___b` bit(8) DEFAULT NULL, + `coalesce_b_b` bit(8) DEFAULT NULL, + `if_______b_b` bit(8) DEFAULT NULL, + `ifnull___b_b` bit(8) DEFAULT NULL, + `least____b_b` bit(8) DEFAULT NULL, + `greatest_b_b` bit(8) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` int(10) unsigned DEFAULT NULL, + `case_____b_a` int(10) unsigned DEFAULT NULL, + `coalesce_a_b` int(10) unsigned DEFAULT NULL, + `coalesce_b_a` int(10) unsigned DEFAULT NULL, + `if_______a_b` int(10) unsigned DEFAULT NULL, + `if_______b_a` int(10) unsigned DEFAULT NULL, + `ifnull___a_b` int(10) unsigned DEFAULT NULL, + `ifnull___b_a` int(10) unsigned DEFAULT NULL, + `least____a_b` int(10) unsigned DEFAULT NULL, + `least____b_a` int(10) unsigned DEFAULT NULL, + `greatest_a_b` int(10) unsigned DEFAULT NULL, + `greatest_b_a` int(10) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +CREATE TABLE t1 (a BIT(7), b BIT(8)); +INSERT INTO t1 VALUES (0x32,0x32); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 16 7 1 Y 32 0 63 +def case_______a 16 7 2 Y 160 0 63 +def case_____a_a 16 7 2 Y 160 0 63 +def coalesce___a 16 7 2 Y 160 0 63 +def coalesce_a_a 16 7 2 Y 160 0 63 +def if_______a_a 16 7 2 Y 160 0 63 +def ifnull___a_a 16 7 2 Y 160 0 63 +def least____a_a 16 7 2 Y 160 0 63 +def greatest_a_a 16 7 2 Y 160 0 63 +def test t1 t1 b ___________b 16 8 1 Y 32 0 63 +def case_______b 16 8 2 Y 160 0 63 +def case_____b_b 16 8 2 Y 160 0 63 +def coalesce___b 16 8 2 Y 160 0 63 +def coalesce_b_b 16 8 2 Y 160 0 63 +def if_______b_b 16 8 2 Y 160 0 63 +def ifnull___b_b 16 8 2 Y 160 0 63 +def least____b_b 16 8 2 Y 160 0 63 +def greatest_b_b 16 8 2 Y 160 0 63 +___________a 2 +case_______a 50 +case_____a_a 50 +coalesce___a 50 +coalesce_a_a 50 +if_______a_a 50 +ifnull___a_a 50 +least____a_a 50 +greatest_a_a 50 +___________b 2 +case_______b 50 +case_____b_b 50 +coalesce___b 50 +coalesce_b_b 50 +if_______b_b 50 +ifnull___b_b 50 +least____b_b 50 +greatest_b_b 50 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 16 8 2 Y 160 0 63 +def case_____b_a 16 8 2 Y 160 0 63 +def coalesce_a_b 16 8 2 Y 160 0 63 +def coalesce_b_a 16 8 2 Y 160 0 63 +def if_______a_b 16 8 2 Y 160 0 63 +def if_______b_a 16 8 2 Y 160 0 63 +def ifnull___a_b 16 8 2 Y 160 0 63 +def ifnull___b_a 16 8 2 Y 160 0 63 +def least____a_b 16 8 2 Y 160 0 63 +def least____b_a 16 8 2 Y 160 0 63 +def greatest_a_b 16 8 2 Y 160 0 63 +def greatest_b_a 16 8 2 Y 160 0 63 +case_____a_b 50 +case_____b_a 50 +coalesce_a_b 50 +coalesce_b_a 50 +if_______a_b 50 +if_______b_a 50 +ifnull___a_b 50 +ifnull___b_a 50 +least____a_b 50 +least____b_a 50 +greatest_a_b 50 +greatest_b_a 50 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` bit(7) DEFAULT NULL, + `case_______a` bit(7) DEFAULT NULL, + `case_____a_a` bit(7) DEFAULT NULL, + `coalesce___a` bit(7) DEFAULT NULL, + `coalesce_a_a` bit(7) DEFAULT NULL, + `if_______a_a` bit(7) DEFAULT NULL, + `ifnull___a_a` bit(7) DEFAULT NULL, + `least____a_a` bit(7) DEFAULT NULL, + `greatest_a_a` bit(7) DEFAULT NULL, + `___________b` bit(8) DEFAULT NULL, + `case_______b` bit(8) DEFAULT NULL, + `case_____b_b` bit(8) DEFAULT NULL, + `coalesce___b` bit(8) DEFAULT NULL, + `coalesce_b_b` bit(8) DEFAULT NULL, + `if_______b_b` bit(8) DEFAULT NULL, + `ifnull___b_b` bit(8) DEFAULT NULL, + `least____b_b` bit(8) DEFAULT NULL, + `greatest_b_b` bit(8) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` bit(8) DEFAULT NULL, + `case_____b_a` bit(8) DEFAULT NULL, + `coalesce_a_b` bit(8) DEFAULT NULL, + `coalesce_b_a` bit(8) DEFAULT NULL, + `if_______a_b` bit(8) DEFAULT NULL, + `if_______b_a` bit(8) DEFAULT NULL, + `ifnull___a_b` bit(8) DEFAULT NULL, + `ifnull___b_a` bit(8) DEFAULT NULL, + `least____a_b` bit(8) DEFAULT NULL, + `least____b_a` bit(8) DEFAULT NULL, + `greatest_a_b` bit(8) DEFAULT NULL, + `greatest_b_a` bit(8) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +CREATE TABLE t1 (a FLOAT, b SMALLINT); +INSERT INTO t1 VALUES (1,-32678); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 4 12 1 Y 32768 31 63 +def case_______a 4 12 1 Y 32896 31 63 +def case_____a_a 4 12 1 Y 32896 31 63 +def coalesce___a 4 12 1 Y 32896 31 63 +def coalesce_a_a 4 12 1 Y 32896 31 63 +def if_______a_a 4 12 1 Y 32896 31 63 +def ifnull___a_a 4 12 1 Y 32896 31 63 +def least____a_a 4 23 1 Y 32896 31 63 +def greatest_a_a 4 23 1 Y 32896 31 63 +def test t1 t1 b ___________b 2 6 6 Y 32768 0 63 +def case_______b 2 6 6 Y 32896 0 63 +def case_____b_b 2 6 6 Y 32896 0 63 +def coalesce___b 2 6 6 Y 32896 0 63 +def coalesce_b_b 2 6 6 Y 32896 0 63 +def if_______b_b 2 6 6 Y 32896 0 63 +def ifnull___b_b 2 6 6 Y 32896 0 63 +def least____b_b 2 6 6 Y 32896 0 63 +def greatest_b_b 2 6 6 Y 32896 0 63 +___________a 1 +case_______a 1 +case_____a_a 1 +coalesce___a 1 +coalesce_a_a 1 +if_______a_a 1 +ifnull___a_a 1 +least____a_a 1 +greatest_a_a 1 +___________b -32678 +case_______b -32678 +case_____b_b -32678 +coalesce___b -32678 +coalesce_b_b -32678 +if_______b_b -32678 +ifnull___b_b -32678 +least____b_b -32678 +greatest_b_b -32678 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 4 12 1 Y 32896 31 63 +def case_____b_a 4 12 6 Y 32896 31 63 +def coalesce_a_b 4 12 1 Y 32896 31 63 +def coalesce_b_a 4 12 6 Y 32896 31 63 +def if_______a_b 4 12 6 Y 32896 31 63 +def if_______b_a 4 12 1 Y 32896 31 63 +def ifnull___a_b 4 12 1 Y 32896 31 63 +def ifnull___b_a 4 12 6 Y 32896 31 63 +def least____a_b 5 23 6 Y 32896 31 63 +def least____b_a 5 23 6 Y 32896 31 63 +def greatest_a_b 5 23 1 Y 32896 31 63 +def greatest_b_a 5 23 1 Y 32896 31 63 +case_____a_b 1 +case_____b_a -32678 +coalesce_a_b 1 +coalesce_b_a -32678 +if_______a_b -32678 +if_______b_a 1 +ifnull___a_b 1 +ifnull___b_a -32678 +least____a_b -32678 +least____b_a -32678 +greatest_a_b 1 +greatest_b_a 1 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` float DEFAULT NULL, + `case_______a` float DEFAULT NULL, + `case_____a_a` float DEFAULT NULL, + `coalesce___a` float DEFAULT NULL, + `coalesce_a_a` float DEFAULT NULL, + `if_______a_a` float DEFAULT NULL, + `ifnull___a_a` float DEFAULT NULL, + `least____a_a` float DEFAULT NULL, + `greatest_a_a` float DEFAULT NULL, + `___________b` smallint(6) DEFAULT NULL, + `case_______b` smallint(6) DEFAULT NULL, + `case_____b_b` smallint(6) DEFAULT NULL, + `coalesce___b` smallint(6) DEFAULT NULL, + `coalesce_b_b` smallint(6) DEFAULT NULL, + `if_______b_b` smallint(6) DEFAULT NULL, + `ifnull___b_b` smallint(6) DEFAULT NULL, + `least____b_b` smallint(6) DEFAULT NULL, + `greatest_b_b` smallint(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` float DEFAULT NULL, + `case_____b_a` float DEFAULT NULL, + `coalesce_a_b` float DEFAULT NULL, + `coalesce_b_a` float DEFAULT NULL, + `if_______a_b` float DEFAULT NULL, + `if_______b_a` float DEFAULT NULL, + `ifnull___a_b` float DEFAULT NULL, + `ifnull___b_a` float DEFAULT NULL, + `least____a_b` double DEFAULT NULL, + `least____b_a` double DEFAULT NULL, + `greatest_a_b` double DEFAULT NULL, + `greatest_b_a` double DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +CREATE TABLE t1 (a VARCHAR(10), b ENUM('b')); +INSERT INTO t1 VALUES ('a','b'); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 253 10 1 Y 0 0 8 +def case_______a 253 10 1 Y 0 39 8 +def case_____a_a 253 10 1 Y 0 39 8 +def coalesce___a 253 10 1 Y 0 39 8 +def coalesce_a_a 253 10 1 Y 0 39 8 +def if_______a_a 253 10 1 Y 0 39 8 +def ifnull___a_a 253 10 1 Y 0 39 8 +def least____a_a 253 10 1 Y 0 39 8 +def greatest_a_a 253 10 1 Y 0 39 8 +def test t1 t1 b ___________b 254 1 1 Y 256 0 8 +def case_______b 254 1 1 Y 0 39 8 +def case_____b_b 254 1 1 Y 0 39 8 +def coalesce___b 254 1 1 Y 0 39 8 +def coalesce_b_b 254 1 1 Y 0 39 8 +def if_______b_b 254 1 1 Y 0 39 8 +def ifnull___b_b 254 1 1 Y 0 39 8 +def least____b_b 254 1 1 Y 0 39 8 +def greatest_b_b 254 1 1 Y 0 39 8 +___________a a +case_______a a +case_____a_a a +coalesce___a a +coalesce_a_a a +if_______a_a a +ifnull___a_a a +least____a_a a +greatest_a_a a +___________b b +case_______b b +case_____b_b b +coalesce___b b +coalesce_b_b b +if_______b_b b +ifnull___b_b b +least____b_b b +greatest_b_b b +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 253 10 1 Y 0 39 8 +def case_____b_a 253 10 1 Y 0 39 8 +def coalesce_a_b 253 10 1 Y 0 39 8 +def coalesce_b_a 253 10 1 Y 0 39 8 +def if_______a_b 253 10 1 Y 0 39 8 +def if_______b_a 253 10 1 Y 0 39 8 +def ifnull___a_b 253 10 1 Y 0 39 8 +def ifnull___b_a 253 10 1 Y 0 39 8 +def least____a_b 253 10 1 Y 0 39 8 +def least____b_a 253 10 1 Y 0 39 8 +def greatest_a_b 253 10 1 Y 0 39 8 +def greatest_b_a 253 10 1 Y 0 39 8 +case_____a_b a +case_____b_a b +coalesce_a_b a +coalesce_b_a b +if_______a_b b +if_______b_a a +ifnull___a_b a +ifnull___b_a b +least____a_b a +least____b_a a +greatest_a_b b +greatest_b_a b +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` varchar(10) DEFAULT NULL, + `case_______a` varchar(10) DEFAULT NULL, + `case_____a_a` varchar(10) DEFAULT NULL, + `coalesce___a` varchar(10) DEFAULT NULL, + `coalesce_a_a` varchar(10) DEFAULT NULL, + `if_______a_a` varchar(10) DEFAULT NULL, + `ifnull___a_a` varchar(10) DEFAULT NULL, + `least____a_a` varchar(10) DEFAULT NULL, + `greatest_a_a` varchar(10) DEFAULT NULL, + `___________b` enum('b') DEFAULT NULL, + `case_______b` varchar(1) DEFAULT NULL, + `case_____b_b` varchar(1) DEFAULT NULL, + `coalesce___b` varchar(1) DEFAULT NULL, + `coalesce_b_b` varchar(1) DEFAULT NULL, + `if_______b_b` varchar(1) DEFAULT NULL, + `ifnull___b_b` varchar(1) DEFAULT NULL, + `least____b_b` varchar(1) DEFAULT NULL, + `greatest_b_b` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` varchar(10) DEFAULT NULL, + `case_____b_a` varchar(10) DEFAULT NULL, + `coalesce_a_b` varchar(10) DEFAULT NULL, + `coalesce_b_a` varchar(10) DEFAULT NULL, + `if_______a_b` varchar(10) DEFAULT NULL, + `if_______b_a` varchar(10) DEFAULT NULL, + `ifnull___a_b` varchar(10) DEFAULT NULL, + `ifnull___b_a` varchar(10) DEFAULT NULL, + `least____a_b` varchar(10) DEFAULT NULL, + `least____b_a` varchar(10) DEFAULT NULL, + `greatest_a_b` varchar(10) DEFAULT NULL, + `greatest_b_a` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +CREATE TABLE t1 (a INT, b YEAR); +INSERT INTO t1 VALUES (-2147483648,2015); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 3 11 11 Y 32768 0 63 +def case_______a 3 11 11 Y 32896 0 63 +def case_____a_a 3 11 11 Y 32896 0 63 +def coalesce___a 3 11 11 Y 32896 0 63 +def coalesce_a_a 3 11 11 Y 32896 0 63 +def if_______a_a 3 11 11 Y 32896 0 63 +def ifnull___a_a 3 11 11 Y 32896 0 63 +def least____a_a 3 11 11 Y 32896 0 63 +def greatest_a_a 3 11 11 Y 32896 0 63 +def test t1 t1 b ___________b 13 4 4 Y 32864 0 63 +def case_______b 13 4 4 Y 32928 0 63 +def case_____b_b 13 4 4 Y 32928 0 63 +def coalesce___b 13 4 4 Y 32928 0 63 +def coalesce_b_b 13 4 4 Y 32928 0 63 +def if_______b_b 13 4 4 Y 32928 0 63 +def ifnull___b_b 13 4 4 Y 32928 0 63 +def least____b_b 13 4 4 Y 32928 0 63 +def greatest_b_b 13 4 4 Y 32928 0 63 +___________a -2147483648 +case_______a -2147483648 +case_____a_a -2147483648 +coalesce___a -2147483648 +coalesce_a_a -2147483648 +if_______a_a -2147483648 +ifnull___a_a -2147483648 +least____a_a -2147483648 +greatest_a_a -2147483648 +___________b 2015 +case_______b 2015 +case_____b_b 2015 +coalesce___b 2015 +coalesce_b_b 2015 +if_______b_b 2015 +ifnull___b_b 2015 +least____b_b 2015 +greatest_b_b 2015 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 246 11 11 Y 32896 0 63 +def case_____b_a 246 11 4 Y 32896 0 63 +def coalesce_a_b 246 11 11 Y 32896 0 63 +def coalesce_b_a 246 11 4 Y 32896 0 63 +def if_______a_b 246 11 4 Y 32896 0 63 +def if_______b_a 246 11 11 Y 32896 0 63 +def ifnull___a_b 246 11 11 Y 32896 0 63 +def ifnull___b_a 246 11 4 Y 32896 0 63 +def least____a_b 246 11 11 Y 32896 0 63 +def least____b_a 246 11 11 Y 32896 0 63 +def greatest_a_b 246 11 4 Y 32896 0 63 +def greatest_b_a 246 11 4 Y 32896 0 63 +case_____a_b -2147483648 +case_____b_a 2015 +coalesce_a_b -2147483648 +coalesce_b_a 2015 +if_______a_b 2015 +if_______b_a -2147483648 +ifnull___a_b -2147483648 +ifnull___b_a 2015 +least____a_b -2147483648 +least____b_a -2147483648 +greatest_a_b 2015 +greatest_b_a 2015 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` int(11) DEFAULT NULL, + `case_______a` int(11) DEFAULT NULL, + `case_____a_a` int(11) DEFAULT NULL, + `coalesce___a` int(11) DEFAULT NULL, + `coalesce_a_a` int(11) DEFAULT NULL, + `if_______a_a` int(11) DEFAULT NULL, + `ifnull___a_a` int(11) DEFAULT NULL, + `least____a_a` int(11) DEFAULT NULL, + `greatest_a_a` int(11) DEFAULT NULL, + `___________b` year(4) DEFAULT NULL, + `case_______b` year(4) DEFAULT NULL, + `case_____b_b` year(4) DEFAULT NULL, + `coalesce___b` year(4) DEFAULT NULL, + `coalesce_b_b` year(4) DEFAULT NULL, + `if_______b_b` year(4) DEFAULT NULL, + `ifnull___b_b` year(4) DEFAULT NULL, + `least____b_b` year(4) DEFAULT NULL, + `greatest_b_b` year(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` decimal(10,0) DEFAULT NULL, + `case_____b_a` decimal(10,0) DEFAULT NULL, + `coalesce_a_b` decimal(10,0) DEFAULT NULL, + `coalesce_b_a` decimal(10,0) DEFAULT NULL, + `if_______a_b` decimal(10,0) DEFAULT NULL, + `if_______b_a` decimal(10,0) DEFAULT NULL, + `ifnull___a_b` decimal(10,0) DEFAULT NULL, + `ifnull___b_a` decimal(10,0) DEFAULT NULL, + `least____a_b` decimal(10,0) DEFAULT NULL, + `least____b_a` decimal(10,0) DEFAULT NULL, + `greatest_a_b` decimal(10,0) DEFAULT NULL, + `greatest_b_a` decimal(10,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +CREATE TABLE t1 (a INT UNSIGNED, b YEAR); +INSERT INTO t1 VALUES (4294967295,2015); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 3 10 10 Y 32800 0 63 +def case_______a 3 10 10 Y 32928 0 63 +def case_____a_a 3 10 10 Y 32928 0 63 +def coalesce___a 3 10 10 Y 32928 0 63 +def coalesce_a_a 3 10 10 Y 32928 0 63 +def if_______a_a 3 10 10 Y 32928 0 63 +def ifnull___a_a 3 10 10 Y 32928 0 63 +def least____a_a 3 10 10 Y 32928 0 63 +def greatest_a_a 3 10 10 Y 32928 0 63 +def test t1 t1 b ___________b 13 4 4 Y 32864 0 63 +def case_______b 13 4 4 Y 32928 0 63 +def case_____b_b 13 4 4 Y 32928 0 63 +def coalesce___b 13 4 4 Y 32928 0 63 +def coalesce_b_b 13 4 4 Y 32928 0 63 +def if_______b_b 13 4 4 Y 32928 0 63 +def ifnull___b_b 13 4 4 Y 32928 0 63 +def least____b_b 13 4 4 Y 32928 0 63 +def greatest_b_b 13 4 4 Y 32928 0 63 +___________a 4294967295 +case_______a 4294967295 +case_____a_a 4294967295 +coalesce___a 4294967295 +coalesce_a_a 4294967295 +if_______a_a 4294967295 +ifnull___a_a 4294967295 +least____a_a 4294967295 +greatest_a_a 4294967295 +___________b 2015 +case_______b 2015 +case_____b_b 2015 +coalesce___b 2015 +coalesce_b_b 2015 +if_______b_b 2015 +ifnull___b_b 2015 +least____b_b 2015 +greatest_b_b 2015 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 3 10 10 Y 32928 0 63 +def case_____b_a 3 10 4 Y 32928 0 63 +def coalesce_a_b 3 10 10 Y 32928 0 63 +def coalesce_b_a 3 10 4 Y 32928 0 63 +def if_______a_b 3 10 4 Y 32928 0 63 +def if_______b_a 3 10 10 Y 32928 0 63 +def ifnull___a_b 3 10 10 Y 32928 0 63 +def ifnull___b_a 3 10 4 Y 32928 0 63 +def least____a_b 3 10 4 Y 32928 0 63 +def least____b_a 3 10 4 Y 32928 0 63 +def greatest_a_b 3 10 10 Y 32928 0 63 +def greatest_b_a 3 10 10 Y 32928 0 63 +case_____a_b 4294967295 +case_____b_a 2015 +coalesce_a_b 4294967295 +coalesce_b_a 2015 +if_______a_b 2015 +if_______b_a 4294967295 +ifnull___a_b 4294967295 +ifnull___b_a 2015 +least____a_b 2015 +least____b_a 2015 +greatest_a_b 4294967295 +greatest_b_a 4294967295 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` int(10) unsigned DEFAULT NULL, + `case_______a` int(10) unsigned DEFAULT NULL, + `case_____a_a` int(10) unsigned DEFAULT NULL, + `coalesce___a` int(10) unsigned DEFAULT NULL, + `coalesce_a_a` int(10) unsigned DEFAULT NULL, + `if_______a_a` int(10) unsigned DEFAULT NULL, + `ifnull___a_a` int(10) unsigned DEFAULT NULL, + `least____a_a` int(10) unsigned DEFAULT NULL, + `greatest_a_a` int(10) unsigned DEFAULT NULL, + `___________b` year(4) DEFAULT NULL, + `case_______b` year(4) DEFAULT NULL, + `case_____b_b` year(4) DEFAULT NULL, + `coalesce___b` year(4) DEFAULT NULL, + `coalesce_b_b` year(4) DEFAULT NULL, + `if_______b_b` year(4) DEFAULT NULL, + `ifnull___b_b` year(4) DEFAULT NULL, + `least____b_b` year(4) DEFAULT NULL, + `greatest_b_b` year(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` int(10) unsigned DEFAULT NULL, + `case_____b_a` int(10) unsigned DEFAULT NULL, + `coalesce_a_b` int(10) unsigned DEFAULT NULL, + `coalesce_b_a` int(10) unsigned DEFAULT NULL, + `if_______a_b` int(10) unsigned DEFAULT NULL, + `if_______b_a` int(10) unsigned DEFAULT NULL, + `ifnull___a_b` int(10) unsigned DEFAULT NULL, + `ifnull___b_a` int(10) unsigned DEFAULT NULL, + `least____a_b` int(10) unsigned DEFAULT NULL, + `least____b_a` int(10) unsigned DEFAULT NULL, + `greatest_a_b` int(10) unsigned DEFAULT NULL, + `greatest_b_a` int(10) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +SET timestamp=UNIX_TIMESTAMP('2001-01-01 01:02:03'); +CREATE TABLE t1 (a DATE, b TIME); +INSERT INTO t1 VALUES ('2010-01-01','10:20:30'); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 10 10 10 Y 128 0 63 +def case_______a 10 10 10 Y 128 0 63 +def case_____a_a 10 10 10 Y 128 0 63 +def coalesce___a 10 10 10 Y 128 0 63 +def coalesce_a_a 10 10 10 Y 128 0 63 +def if_______a_a 10 10 10 Y 128 0 63 +def ifnull___a_a 10 10 10 Y 128 0 63 +def least____a_a 10 10 10 Y 128 0 63 +def greatest_a_a 10 10 10 Y 128 0 63 +def test t1 t1 b ___________b 11 10 8 Y 128 0 63 +def case_______b 11 10 8 Y 128 0 63 +def case_____b_b 11 10 8 Y 128 0 63 +def coalesce___b 11 10 8 Y 128 0 63 +def coalesce_b_b 11 10 8 Y 128 0 63 +def if_______b_b 11 10 8 Y 128 0 63 +def ifnull___b_b 11 10 8 Y 128 0 63 +def least____b_b 11 10 8 Y 128 0 63 +def greatest_b_b 11 10 8 Y 128 0 63 +___________a 2010-01-01 +case_______a 2010-01-01 +case_____a_a 2010-01-01 +coalesce___a 2010-01-01 +coalesce_a_a 2010-01-01 +if_______a_a 2010-01-01 +ifnull___a_a 2010-01-01 +least____a_a 2010-01-01 +greatest_a_a 2010-01-01 +___________b 10:20:30 +case_______b 10:20:30 +case_____b_b 10:20:30 +coalesce___b 10:20:30 +coalesce_b_b 10:20:30 +if_______b_b 10:20:30 +ifnull___b_b 10:20:30 +least____b_b 10:20:30 +greatest_b_b 10:20:30 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 12 19 19 Y 128 0 63 +def case_____b_a 12 19 19 Y 128 0 63 +def coalesce_a_b 12 19 19 Y 128 0 63 +def coalesce_b_a 12 19 19 Y 128 0 63 +def if_______a_b 12 19 19 Y 128 0 63 +def if_______b_a 12 19 19 Y 128 0 63 +def ifnull___a_b 12 19 19 Y 128 0 63 +def ifnull___b_a 12 19 19 Y 128 0 63 +def least____a_b 12 19 19 Y 128 0 63 +def least____b_a 12 19 19 Y 128 0 63 +def greatest_a_b 12 19 19 Y 128 0 63 +def greatest_b_a 12 19 19 Y 128 0 63 +case_____a_b 2010-01-01 00:00:00 +case_____b_a 2001-01-01 10:20:30 +coalesce_a_b 2010-01-01 00:00:00 +coalesce_b_a 2001-01-01 10:20:30 +if_______a_b 2001-01-01 10:20:30 +if_______b_a 2010-01-01 00:00:00 +ifnull___a_b 2010-01-01 00:00:00 +ifnull___b_a 2001-01-01 10:20:30 +least____a_b 2001-01-01 10:20:30 +least____b_a 2001-01-01 10:20:30 +greatest_a_b 2010-01-01 00:00:00 +greatest_b_a 2010-01-01 00:00:00 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` date DEFAULT NULL, + `case_______a` date DEFAULT NULL, + `case_____a_a` date DEFAULT NULL, + `coalesce___a` date DEFAULT NULL, + `coalesce_a_a` date DEFAULT NULL, + `if_______a_a` date DEFAULT NULL, + `ifnull___a_a` date DEFAULT NULL, + `least____a_a` date DEFAULT NULL, + `greatest_a_a` date DEFAULT NULL, + `___________b` time DEFAULT NULL, + `case_______b` time DEFAULT NULL, + `case_____b_b` time DEFAULT NULL, + `coalesce___b` time DEFAULT NULL, + `coalesce_b_b` time DEFAULT NULL, + `if_______b_b` time DEFAULT NULL, + `ifnull___b_b` time DEFAULT NULL, + `least____b_b` time DEFAULT NULL, + `greatest_b_b` time DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` datetime DEFAULT NULL, + `case_____b_a` datetime DEFAULT NULL, + `coalesce_a_b` datetime DEFAULT NULL, + `coalesce_b_a` datetime DEFAULT NULL, + `if_______a_b` datetime DEFAULT NULL, + `if_______b_a` datetime DEFAULT NULL, + `ifnull___a_b` datetime DEFAULT NULL, + `ifnull___b_a` datetime DEFAULT NULL, + `least____a_b` datetime DEFAULT NULL, + `least____b_a` datetime DEFAULT NULL, + `greatest_a_b` datetime DEFAULT NULL, + `greatest_b_a` datetime DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +SET timestamp=DEFAULT; +# +SET timestamp=UNIX_TIMESTAMP('2001-01-01 01:02:03'); +CREATE TABLE t1 (a TIMESTAMP, b TIME); +INSERT INTO t1 VALUES ('2010-01-01 00:00:00','10:20:30'); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 7 19 19 N 9377 0 63 +def case_______a 7 19 19 Y 128 0 63 +def case_____a_a 7 19 19 N 129 0 63 +def coalesce___a 7 19 19 N 129 0 63 +def coalesce_a_a 7 19 19 N 129 0 63 +def if_______a_a 7 19 19 N 129 0 63 +def ifnull___a_a 7 19 19 N 129 0 63 +def least____a_a 7 19 19 N 129 0 63 +def greatest_a_a 7 19 19 N 129 0 63 +def test t1 t1 b ___________b 11 10 8 Y 128 0 63 +def case_______b 11 10 8 Y 128 0 63 +def case_____b_b 11 10 8 Y 128 0 63 +def coalesce___b 11 10 8 Y 128 0 63 +def coalesce_b_b 11 10 8 Y 128 0 63 +def if_______b_b 11 10 8 Y 128 0 63 +def ifnull___b_b 11 10 8 Y 128 0 63 +def least____b_b 11 10 8 Y 128 0 63 +def greatest_b_b 11 10 8 Y 128 0 63 +___________a 2010-01-01 00:00:00 +case_______a 2010-01-01 00:00:00 +case_____a_a 2010-01-01 00:00:00 +coalesce___a 2010-01-01 00:00:00 +coalesce_a_a 2010-01-01 00:00:00 +if_______a_a 2010-01-01 00:00:00 +ifnull___a_a 2010-01-01 00:00:00 +least____a_a 2010-01-01 00:00:00 +greatest_a_a 2010-01-01 00:00:00 +___________b 10:20:30 +case_______b 10:20:30 +case_____b_b 10:20:30 +coalesce___b 10:20:30 +coalesce_b_b 10:20:30 +if_______b_b 10:20:30 +ifnull___b_b 10:20:30 +least____b_b 10:20:30 +greatest_b_b 10:20:30 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 12 19 19 Y 128 0 63 +def case_____b_a 12 19 19 Y 128 0 63 +def coalesce_a_b 12 19 19 Y 128 0 63 +def coalesce_b_a 12 19 19 Y 128 0 63 +def if_______a_b 12 19 19 Y 128 0 63 +def if_______b_a 12 19 19 Y 128 0 63 +def ifnull___a_b 12 19 19 Y 128 0 63 +def ifnull___b_a 12 19 19 N 129 0 63 +def least____a_b 12 19 19 Y 128 0 63 +def least____b_a 12 19 19 Y 128 0 63 +def greatest_a_b 12 19 19 Y 128 0 63 +def greatest_b_a 12 19 19 Y 128 0 63 +case_____a_b 2010-01-01 00:00:00 +case_____b_a 2001-01-01 10:20:30 +coalesce_a_b 2010-01-01 00:00:00 +coalesce_b_a 2001-01-01 10:20:30 +if_______a_b 2001-01-01 10:20:30 +if_______b_a 2010-01-01 00:00:00 +ifnull___a_b 2010-01-01 00:00:00 +ifnull___b_a 2001-01-01 10:20:30 +least____a_b 2001-01-01 10:20:30 +least____b_a 2001-01-01 10:20:30 +greatest_a_b 2010-01-01 00:00:00 +greatest_b_a 2010-01-01 00:00:00 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `case_______a` timestamp NULL DEFAULT NULL, + `case_____a_a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `coalesce___a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `coalesce_a_a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `if_______a_a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `ifnull___a_a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `least____a_a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `greatest_a_a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `___________b` time DEFAULT NULL, + `case_______b` time DEFAULT NULL, + `case_____b_b` time DEFAULT NULL, + `coalesce___b` time DEFAULT NULL, + `coalesce_b_b` time DEFAULT NULL, + `if_______b_b` time DEFAULT NULL, + `ifnull___b_b` time DEFAULT NULL, + `least____b_b` time DEFAULT NULL, + `greatest_b_b` time DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` datetime DEFAULT NULL, + `case_____b_a` datetime DEFAULT NULL, + `coalesce_a_b` datetime DEFAULT NULL, + `coalesce_b_a` datetime DEFAULT NULL, + `if_______a_b` datetime DEFAULT NULL, + `if_______b_a` datetime DEFAULT NULL, + `ifnull___a_b` datetime DEFAULT NULL, + `ifnull___b_a` datetime NOT NULL, + `least____a_b` datetime DEFAULT NULL, + `least____b_a` datetime DEFAULT NULL, + `greatest_a_b` datetime DEFAULT NULL, + `greatest_b_a` datetime DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +SET timestamp=DEFAULT; +# +SET timestamp=UNIX_TIMESTAMP('2001-01-01 01:02:03'); +CREATE TABLE t1 (a DATETIME, b TIME); +INSERT INTO t1 VALUES ('2010-01-01 00:00:00','10:20:30'); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 12 19 19 Y 128 0 63 +def case_______a 12 19 19 Y 128 0 63 +def case_____a_a 12 19 19 Y 128 0 63 +def coalesce___a 12 19 19 Y 128 0 63 +def coalesce_a_a 12 19 19 Y 128 0 63 +def if_______a_a 12 19 19 Y 128 0 63 +def ifnull___a_a 12 19 19 Y 128 0 63 +def least____a_a 12 19 19 Y 128 0 63 +def greatest_a_a 12 19 19 Y 128 0 63 +def test t1 t1 b ___________b 11 10 8 Y 128 0 63 +def case_______b 11 10 8 Y 128 0 63 +def case_____b_b 11 10 8 Y 128 0 63 +def coalesce___b 11 10 8 Y 128 0 63 +def coalesce_b_b 11 10 8 Y 128 0 63 +def if_______b_b 11 10 8 Y 128 0 63 +def ifnull___b_b 11 10 8 Y 128 0 63 +def least____b_b 11 10 8 Y 128 0 63 +def greatest_b_b 11 10 8 Y 128 0 63 +___________a 2010-01-01 00:00:00 +case_______a 2010-01-01 00:00:00 +case_____a_a 2010-01-01 00:00:00 +coalesce___a 2010-01-01 00:00:00 +coalesce_a_a 2010-01-01 00:00:00 +if_______a_a 2010-01-01 00:00:00 +ifnull___a_a 2010-01-01 00:00:00 +least____a_a 2010-01-01 00:00:00 +greatest_a_a 2010-01-01 00:00:00 +___________b 10:20:30 +case_______b 10:20:30 +case_____b_b 10:20:30 +coalesce___b 10:20:30 +coalesce_b_b 10:20:30 +if_______b_b 10:20:30 +ifnull___b_b 10:20:30 +least____b_b 10:20:30 +greatest_b_b 10:20:30 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 12 19 19 Y 128 0 63 +def case_____b_a 12 19 19 Y 128 0 63 +def coalesce_a_b 12 19 19 Y 128 0 63 +def coalesce_b_a 12 19 19 Y 128 0 63 +def if_______a_b 12 19 19 Y 128 0 63 +def if_______b_a 12 19 19 Y 128 0 63 +def ifnull___a_b 12 19 19 Y 128 0 63 +def ifnull___b_a 12 19 19 Y 128 0 63 +def least____a_b 12 19 19 Y 128 0 63 +def least____b_a 12 19 19 Y 128 0 63 +def greatest_a_b 12 19 19 Y 128 0 63 +def greatest_b_a 12 19 19 Y 128 0 63 +case_____a_b 2010-01-01 00:00:00 +case_____b_a 2001-01-01 10:20:30 +coalesce_a_b 2010-01-01 00:00:00 +coalesce_b_a 2001-01-01 10:20:30 +if_______a_b 2001-01-01 10:20:30 +if_______b_a 2010-01-01 00:00:00 +ifnull___a_b 2010-01-01 00:00:00 +ifnull___b_a 2001-01-01 10:20:30 +least____a_b 2001-01-01 10:20:30 +least____b_a 2001-01-01 10:20:30 +greatest_a_b 2010-01-01 00:00:00 +greatest_b_a 2010-01-01 00:00:00 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` datetime DEFAULT NULL, + `case_______a` datetime DEFAULT NULL, + `case_____a_a` datetime DEFAULT NULL, + `coalesce___a` datetime DEFAULT NULL, + `coalesce_a_a` datetime DEFAULT NULL, + `if_______a_a` datetime DEFAULT NULL, + `ifnull___a_a` datetime DEFAULT NULL, + `least____a_a` datetime DEFAULT NULL, + `greatest_a_a` datetime DEFAULT NULL, + `___________b` time DEFAULT NULL, + `case_______b` time DEFAULT NULL, + `case_____b_b` time DEFAULT NULL, + `coalesce___b` time DEFAULT NULL, + `coalesce_b_b` time DEFAULT NULL, + `if_______b_b` time DEFAULT NULL, + `ifnull___b_b` time DEFAULT NULL, + `least____b_b` time DEFAULT NULL, + `greatest_b_b` time DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` datetime DEFAULT NULL, + `case_____b_a` datetime DEFAULT NULL, + `coalesce_a_b` datetime DEFAULT NULL, + `coalesce_b_a` datetime DEFAULT NULL, + `if_______a_b` datetime DEFAULT NULL, + `if_______b_a` datetime DEFAULT NULL, + `ifnull___a_b` datetime DEFAULT NULL, + `ifnull___b_a` datetime DEFAULT NULL, + `least____a_b` datetime DEFAULT NULL, + `least____b_a` datetime DEFAULT NULL, + `greatest_a_b` datetime DEFAULT NULL, + `greatest_b_a` datetime DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +SET timestamp=DEFAULT; +# +SET timestamp=UNIX_TIMESTAMP('2001-01-01 01:02:03'); +CREATE TABLE t1 (a DATETIME, b DATE); +INSERT INTO t1 VALUES ('2010-01-01 10:20:30','2001-01-02'); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 12 19 19 Y 128 0 63 +def case_______a 12 19 19 Y 128 0 63 +def case_____a_a 12 19 19 Y 128 0 63 +def coalesce___a 12 19 19 Y 128 0 63 +def coalesce_a_a 12 19 19 Y 128 0 63 +def if_______a_a 12 19 19 Y 128 0 63 +def ifnull___a_a 12 19 19 Y 128 0 63 +def least____a_a 12 19 19 Y 128 0 63 +def greatest_a_a 12 19 19 Y 128 0 63 +def test t1 t1 b ___________b 10 10 10 Y 128 0 63 +def case_______b 10 10 10 Y 128 0 63 +def case_____b_b 10 10 10 Y 128 0 63 +def coalesce___b 10 10 10 Y 128 0 63 +def coalesce_b_b 10 10 10 Y 128 0 63 +def if_______b_b 10 10 10 Y 128 0 63 +def ifnull___b_b 10 10 10 Y 128 0 63 +def least____b_b 10 10 10 Y 128 0 63 +def greatest_b_b 10 10 10 Y 128 0 63 +___________a 2010-01-01 10:20:30 +case_______a 2010-01-01 10:20:30 +case_____a_a 2010-01-01 10:20:30 +coalesce___a 2010-01-01 10:20:30 +coalesce_a_a 2010-01-01 10:20:30 +if_______a_a 2010-01-01 10:20:30 +ifnull___a_a 2010-01-01 10:20:30 +least____a_a 2010-01-01 10:20:30 +greatest_a_a 2010-01-01 10:20:30 +___________b 2001-01-02 +case_______b 2001-01-02 +case_____b_b 2001-01-02 +coalesce___b 2001-01-02 +coalesce_b_b 2001-01-02 +if_______b_b 2001-01-02 +ifnull___b_b 2001-01-02 +least____b_b 2001-01-02 +greatest_b_b 2001-01-02 +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 12 19 19 Y 128 0 63 +def case_____b_a 12 19 19 Y 128 0 63 +def coalesce_a_b 12 19 19 Y 128 0 63 +def coalesce_b_a 12 19 19 Y 128 0 63 +def if_______a_b 12 19 19 Y 128 0 63 +def if_______b_a 12 19 19 Y 128 0 63 +def ifnull___a_b 12 19 19 Y 128 0 63 +def ifnull___b_a 12 19 19 Y 128 0 63 +def least____a_b 12 19 19 Y 128 0 63 +def least____b_a 12 19 19 Y 128 0 63 +def greatest_a_b 12 19 19 Y 128 0 63 +def greatest_b_a 12 19 19 Y 128 0 63 +case_____a_b 2010-01-01 10:20:30 +case_____b_a 2001-01-02 00:00:00 +coalesce_a_b 2010-01-01 10:20:30 +coalesce_b_a 2001-01-02 00:00:00 +if_______a_b 2001-01-02 00:00:00 +if_______b_a 2010-01-01 10:20:30 +ifnull___a_b 2010-01-01 10:20:30 +ifnull___b_a 2001-01-02 00:00:00 +least____a_b 2001-01-02 00:00:00 +least____b_a 2001-01-02 00:00:00 +greatest_a_b 2010-01-01 10:20:30 +greatest_b_a 2010-01-01 10:20:30 +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` datetime DEFAULT NULL, + `case_______a` datetime DEFAULT NULL, + `case_____a_a` datetime DEFAULT NULL, + `coalesce___a` datetime DEFAULT NULL, + `coalesce_a_a` datetime DEFAULT NULL, + `if_______a_a` datetime DEFAULT NULL, + `ifnull___a_a` datetime DEFAULT NULL, + `least____a_a` datetime DEFAULT NULL, + `greatest_a_a` datetime DEFAULT NULL, + `___________b` date DEFAULT NULL, + `case_______b` date DEFAULT NULL, + `case_____b_b` date DEFAULT NULL, + `coalesce___b` date DEFAULT NULL, + `coalesce_b_b` date DEFAULT NULL, + `if_______b_b` date DEFAULT NULL, + `ifnull___b_b` date DEFAULT NULL, + `least____b_b` date DEFAULT NULL, + `greatest_b_b` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` datetime DEFAULT NULL, + `case_____b_a` datetime DEFAULT NULL, + `coalesce_a_b` datetime DEFAULT NULL, + `coalesce_b_a` datetime DEFAULT NULL, + `if_______a_b` datetime DEFAULT NULL, + `if_______b_a` datetime DEFAULT NULL, + `ifnull___a_b` datetime DEFAULT NULL, + `ifnull___b_a` datetime DEFAULT NULL, + `least____a_b` datetime DEFAULT NULL, + `least____b_a` datetime DEFAULT NULL, + `greatest_a_b` datetime DEFAULT NULL, + `greatest_b_a` datetime DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +SET timestamp=DEFAULT; +# +# MDEV-8873 Wrong field type or metadata for LEAST(int_column,string_column) +# +CREATE TABLE t1 (a INT, b VARCHAR(10)); +INSERT INTO t1 VALUES (-2147483648,'100x'); +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a ___________a 3 11 11 Y 32768 0 63 +def case_______a 3 11 11 Y 32896 0 63 +def case_____a_a 3 11 11 Y 32896 0 63 +def coalesce___a 3 11 11 Y 32896 0 63 +def coalesce_a_a 3 11 11 Y 32896 0 63 +def if_______a_a 3 11 11 Y 32896 0 63 +def ifnull___a_a 3 11 11 Y 32896 0 63 +def least____a_a 3 11 11 Y 32896 0 63 +def greatest_a_a 3 11 11 Y 32896 0 63 +def test t1 t1 b ___________b 253 10 4 Y 0 0 8 +def case_______b 253 10 4 Y 0 39 8 +def case_____b_b 253 10 4 Y 0 39 8 +def coalesce___b 253 10 4 Y 0 39 8 +def coalesce_b_b 253 10 4 Y 0 39 8 +def if_______b_b 253 10 4 Y 0 39 8 +def ifnull___b_b 253 10 4 Y 0 39 8 +def least____b_b 253 10 4 Y 0 39 8 +def greatest_b_b 253 10 4 Y 0 39 8 +___________a -2147483648 +case_______a -2147483648 +case_____a_a -2147483648 +coalesce___a -2147483648 +coalesce_a_a -2147483648 +if_______a_a -2147483648 +ifnull___a_a -2147483648 +least____a_a -2147483648 +greatest_a_a -2147483648 +___________b 100x +case_______b 100x +case_____b_b 100x +coalesce___b 100x +coalesce_b_b 100x +if_______b_b 100x +ifnull___b_b 100x +least____b_b 100x +greatest_b_b 100x +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def case_____a_b 253 11 11 Y 0 39 8 +def case_____b_a 253 11 4 Y 0 39 8 +def coalesce_a_b 253 11 11 Y 0 39 8 +def coalesce_b_a 253 11 4 Y 0 39 8 +def if_______a_b 253 11 4 Y 0 39 8 +def if_______b_a 253 11 11 Y 0 39 8 +def ifnull___a_b 253 11 11 Y 0 39 8 +def ifnull___b_a 253 11 4 Y 0 39 8 +def least____a_b 5 23 11 Y 32896 31 63 +def least____b_a 5 23 11 Y 32896 31 63 +def greatest_a_b 5 23 3 Y 32896 31 63 +def greatest_b_a 5 23 3 Y 32896 31 63 +case_____a_b -2147483648 +case_____b_a 100x +coalesce_a_b -2147483648 +coalesce_b_a 100x +if_______a_b 100x +if_______b_a -2147483648 +ifnull___a_b -2147483648 +ifnull___b_a 100x +least____a_b -2147483648 +least____b_a -2147483648 +greatest_a_b 100 +greatest_b_a 100 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect DOUBLE value: '100x' +Level Warning +Code 1292 +Message Truncated incorrect DOUBLE value: '100x' +Level Warning +Code 1292 +Message Truncated incorrect DOUBLE value: '100x' +Level Warning +Code 1292 +Message Truncated incorrect DOUBLE value: '100x' +CREATE TABLE t2 AS +SELECT +a AS ___________a, +CASE WHEN a IS NOT NULL THEN a END AS case_______a, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS case_____a_a, +COALESCE(a) AS coalesce___a, +COALESCE(a, a) AS coalesce_a_a, +IF(a IS NULL, a, a) AS if_______a_a, +IFNULL(a, a) AS ifnull___a_a, +LEAST(a, a) AS least____a_a, +GREATEST(a, a) AS greatest_a_a, +b AS ___________b, +CASE WHEN a IS NOT NULL THEN b END AS case_______b, +CASE WHEN a IS NOT NULL THEN b ELSE b END AS case_____b_b, +COALESCE(b) AS coalesce___b, +COALESCE(b, b) AS coalesce_b_b, +IF(a IS NULL, b, b) AS if_______b_b, +IFNULL(b, b) AS ifnull___b_b, +LEAST(b, b) AS least____b_b, +GREATEST(b, b) AS greatest_b_b +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `___________a` int(11) DEFAULT NULL, + `case_______a` int(11) DEFAULT NULL, + `case_____a_a` int(11) DEFAULT NULL, + `coalesce___a` int(11) DEFAULT NULL, + `coalesce_a_a` int(11) DEFAULT NULL, + `if_______a_a` int(11) DEFAULT NULL, + `ifnull___a_a` int(11) DEFAULT NULL, + `least____a_a` int(11) DEFAULT NULL, + `greatest_a_a` int(11) DEFAULT NULL, + `___________b` varchar(10) DEFAULT NULL, + `case_______b` varchar(10) DEFAULT NULL, + `case_____b_b` varchar(10) DEFAULT NULL, + `coalesce___b` varchar(10) DEFAULT NULL, + `coalesce_b_b` varchar(10) DEFAULT NULL, + `if_______b_b` varchar(10) DEFAULT NULL, + `ifnull___b_b` varchar(10) DEFAULT NULL, + `least____b_b` varchar(10) DEFAULT NULL, + `greatest_b_b` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR +CREATE TABLE t2 AS +SELECT +CASE WHEN a IS NOT NULL THEN a ELSE b END AS case_____a_b, +CASE WHEN a IS NOT NULL THEN b ELSE a END AS case_____b_a, +COALESCE(a, b) AS coalesce_a_b, +COALESCE(b, a) AS coalesce_b_a, +IF(a IS NULL, a, b) AS if_______a_b, +IF(a IS NULL, b, a) AS if_______b_a, +IFNULL(a, b) AS ifnull___a_b, +IFNULL(b, a) AS ifnull___b_a, +LEAST(a, b) AS least____a_b, +LEAST(b, a) AS least____b_a, +GREATEST(a, b) AS greatest_a_b, +GREATEST(b, a) AS greatest_b_a +FROM t1; +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '100x' +Warning 1292 Truncated incorrect DOUBLE value: '100x' +Warning 1292 Truncated incorrect DOUBLE value: '100x' +Warning 1292 Truncated incorrect DOUBLE value: '100x' +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `case_____a_b` varchar(11) DEFAULT NULL, + `case_____b_a` varchar(11) DEFAULT NULL, + `coalesce_a_b` varchar(11) DEFAULT NULL, + `coalesce_b_a` varchar(11) DEFAULT NULL, + `if_______a_b` varchar(11) DEFAULT NULL, + `if_______b_a` varchar(11) DEFAULT NULL, + `ifnull___a_b` varchar(11) DEFAULT NULL, + `ifnull___b_a` varchar(11) DEFAULT NULL, + `least____a_b` double DEFAULT NULL, + `least____b_a` double DEFAULT NULL, + `greatest_a_b` double DEFAULT NULL, + `greatest_b_a` double DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +# MDEV-4848 Wrong metadata or column type for LEAST(1.0,'10') +# +SELECT LEAST(1.0,'10'); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def LEAST(1.0,'10') 5 23 1 N 32897 31 63 +LEAST(1.0,'10') +1 +CREATE TABLE t1 AS SELECT LEAST(1.0,'10'); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `LEAST(1.0,'10')` double NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# MDEV-657 LP:873142 - GREATEST() does not always return same signness of argument types +# +CREATE TABLE t1 (a BIGINT(20) UNSIGNED NOT NULL PRIMARY KEY); +INSERT INTO t1 (a) VALUES (13836376518955650385) ON DUPLICATE KEY UPDATE a=GREATEST(a,VALUES(a)); +INSERT INTO t1 (a) VALUES (13836376518955650385) ON DUPLICATE KEY UPDATE a=GREATEST(a,VALUES(a)); +SELECT * FROM t1; +a +13836376518955650385 +DROP TABLE t1; +# +# MDEV-5694 GREATEST(date, time) returns a wrong data type +# +SET timestamp=UNIX_TIMESTAMP('2010-01-01 01:02:03'); +SELECT GREATEST(CURRENT_TIME, CURRENT_DATE), COALESCE(CURRENT_TIME, CURRENT_DATE); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def GREATEST(CURRENT_TIME, CURRENT_DATE) 12 19 19 N 129 0 63 +def COALESCE(CURRENT_TIME, CURRENT_DATE) 12 19 19 N 129 0 63 +GREATEST(CURRENT_TIME, CURRENT_DATE) COALESCE(CURRENT_TIME, CURRENT_DATE) +2010-01-01 01:02:03 2010-01-01 01:02:03 +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 VALUES ('2010-01-01 10:20:30'); +SELECT GREATEST(a,a) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def GREATEST(a,a) 7 19 19 N 129 0 63 +GREATEST(a,a) +2010-01-01 10:20:30 +SELECT COALESCE(a,a) FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COALESCE(a,a) 7 19 19 N 129 0 63 +COALESCE(a,a) +2010-01-01 10:20:30 +DROP TABLE t1; +CREATE TABLE t1 (a TIMESTAMP, b DATETIME); +CREATE TABLE t2 AS SELECT LEAST(a,a),LEAST(b,b),LEAST(a,b) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `LEAST(a,a)` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `LEAST(b,b)` datetime DEFAULT NULL, + `LEAST(a,b)` datetime DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +SET timestamp=DEFAULT; +# +# MDEV-8910 Wrong metadata or field type for MAX(COALESCE(string_field)) +# +CREATE TABLE t1 (c1 TINYBLOB, c2 MEDIUMBLOB, c3 BLOB, c4 LONGBLOB); +CREATE TABLE t2 AS +SELECT +MAX(COALESCE(c1)) AS c1, +MAX(COALESCE(c2)) AS c2, +MAX(COALESCE(c3)) AS c3, +MAX(COALESCE(c4)) AS c4 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varbinary(255) DEFAULT NULL, + `c2` mediumblob DEFAULT NULL, + `c3` blob DEFAULT NULL, + `c4` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +MAX(COALESCE(c1)) AS c1, +MAX(COALESCE(c2)) AS c2, +MAX(COALESCE(c3)) AS c3, +MAX(COALESCE(c4)) AS c4 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 255 0 Y 128 39 63 +def c2 250 16777215 0 Y 128 39 63 +def c3 252 65535 0 Y 128 39 63 +def c4 251 4294967295 0 Y 128 39 63 +c1 c2 c3 c4 +NULL NULL NULL NULL +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (c1 CHAR(1), c2 CHAR(255)) CHARACTER SET latin1; +CREATE TABLE t2 AS +SELECT +MAX(COALESCE(c1)) AS c1, +MAX(COALESCE(c2)) AS c2 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(1) DEFAULT NULL, + `c2` varchar(255) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +MAX(COALESCE(c1)) AS c1, +MAX(COALESCE(c2)) AS c2 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 1 0 Y 0 39 8 +def c2 253 255 0 Y 0 39 8 +c1 c2 +NULL NULL +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (c1 CHAR(1), c2 CHAR(255)) CHARACTER SET utf8; +CREATE TABLE t2 AS +SELECT +MAX(COALESCE(c1)) AS c1, +MAX(COALESCE(c2)) AS c2 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL, + `c2` varchar(255) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +MAX(COALESCE(c1)) AS c1, +MAX(COALESCE(c2)) AS c2 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 1 0 Y 0 39 8 +def c2 253 255 0 Y 0 39 8 +c1 c2 +NULL NULL +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (c1 VARCHAR(1), c2 VARCHAR(255), c3 VARCHAR(20000)) CHARACTER SET latin1; +CREATE TABLE t2 AS +SELECT +MAX(COALESCE(c1)) AS c1, +MAX(COALESCE(c2)) AS c2, +MAX(COALESCE(c3)) AS c3 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(1) DEFAULT NULL, + `c2` varchar(255) DEFAULT NULL, + `c3` text DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +MAX(COALESCE(c1)) AS c1, +MAX(COALESCE(c2)) AS c2, +MAX(COALESCE(c3)) AS c3 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 1 0 Y 0 39 8 +def c2 253 255 0 Y 0 39 8 +def c3 252 20000 0 Y 0 39 8 +c1 c2 c3 +NULL NULL NULL +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (c1 VARCHAR(1), c2 VARCHAR(255), c3 VARCHAR(20000)) CHARACTER SET utf8; +CREATE TABLE t2 AS +SELECT +MAX(COALESCE(c1)) AS c1, +MAX(COALESCE(c2)) AS c2, +MAX(COALESCE(c3)) AS c3 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL, + `c2` varchar(255) CHARACTER SET utf8 DEFAULT NULL, + `c3` text CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +MAX(COALESCE(c1)) AS c1, +MAX(COALESCE(c2)) AS c2, +MAX(COALESCE(c3)) AS c3 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 1 0 Y 0 39 8 +def c2 253 255 0 Y 0 39 8 +def c3 252 60000 0 Y 0 39 8 +c1 c2 c3 +NULL NULL NULL +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (c1 ENUM('a')) CHARACTER SET latin1; +CREATE TABLE t2 AS +SELECT +MAX(COALESCE(c1)) AS c1 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +MAX(COALESCE(c1)) AS c1 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 1 0 Y 0 39 8 +c1 +NULL +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (c1 ENUM('a')) CHARACTER SET utf8; +CREATE TABLE t2 AS +SELECT +MAX(COALESCE(c1)) AS c1 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +MAX(COALESCE(c1)) AS c1 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 1 0 Y 0 39 8 +c1 +NULL +DROP TABLE t2; +DROP TABLE t1; +# +# MDEV-8912 Wrong metadata or type for @c:=string_or_blob_field +# +CREATE TABLE t1 (c1 TINYBLOB, c2 BLOB, c3 MEDIUMBLOB, c4 LONGBLOB); +CREATE TABLE t2 AS +SELECT +@c1:=c1 AS c1, +@c2:=c2 AS c2, +@c3:=c3 AS c3, +@c4:=c4 AS c4 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varbinary(255) DEFAULT NULL, + `c2` blob DEFAULT NULL, + `c3` mediumblob DEFAULT NULL, + `c4` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +@c1:=c1 AS c1, +@c2:=c2 AS c2, +@c3:=c3 AS c3, +@c4:=c4 AS c4 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 255 0 Y 128 39 63 +def c2 252 65535 0 Y 128 39 63 +def c3 250 16777215 0 Y 128 39 63 +def c4 251 4294967295 0 Y 128 39 63 +c1 c2 c3 c4 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (c1 CHAR(1), c2 CHAR(255)) CHARACTER SET latin1; +CREATE TABLE t2 AS +SELECT +@c1:=c1 AS c1, +@c2:=c2 AS c2 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(1) DEFAULT NULL, + `c2` varchar(255) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +@c1:=c1 AS c1, +@c2:=c2 AS c2 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 1 0 Y 0 39 8 +def c2 253 255 0 Y 0 39 8 +c1 c2 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (c1 CHAR(1), c2 CHAR(255)) CHARACTER SET utf8; +CREATE TABLE t2 AS +SELECT +@c1:=c1 AS c1, +@c2:=c2 AS c2 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL, + `c2` varchar(255) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +@c1:=c1 AS c1, +@c2:=c2 AS c2 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 1 0 Y 0 39 8 +def c2 253 255 0 Y 0 39 8 +c1 c2 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (c1 VARCHAR(1), c2 VARCHAR(255), c3 VARCHAR(20000)) CHARACTER SET latin1; +CREATE TABLE t2 AS +SELECT +@c:=c1 AS c1, +@c:=c2 AS c2, +@c:=c3 AS c3 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(1) DEFAULT NULL, + `c2` varchar(255) DEFAULT NULL, + `c3` text DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +@c:=c1 AS c1, +@c:=c2 AS c2, +@c:=c3 AS c3 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 1 0 Y 0 39 8 +def c2 253 255 0 Y 0 39 8 +def c3 252 20000 0 Y 0 39 8 +c1 c2 c3 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (c1 VARCHAR(1), c2 VARCHAR(255), c3 VARCHAR(20000)) CHARACTER SET utf8; +CREATE TABLE t2 AS +SELECT +@c:=c1 AS c1, +@c:=c2 AS c2, +@c:=c3 AS c3 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL, + `c2` varchar(255) CHARACTER SET utf8 DEFAULT NULL, + `c3` text CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +@c:=c1 AS c1, +@c:=c2 AS c2, +@c:=c3 AS c3 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 1 0 Y 0 39 8 +def c2 253 255 0 Y 0 39 8 +def c3 252 60000 0 Y 0 39 8 +c1 c2 c3 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (c1 ENUM('a')) CHARACTER SET latin1; +CREATE TABLE t2 AS +SELECT +@c:=c1 AS c1 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +@c:=c1 AS c1 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 1 0 Y 0 0 8 +c1 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (c1 ENUM('a')) CHARACTER SET utf8; +CREATE TABLE t2 AS +SELECT +@c:=c1 AS c1 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT +@c:=c1 AS c1 +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c1 253 1 0 Y 0 0 8 +c1 +DROP TABLE t2; +DROP TABLE t1; +# +# MDEV-9653 Assertion `length || !scale' failed in uint my_decimal_length_to_precision(uint, uint, bool) +# +SELECT CASE 0 WHEN 1 THEN (CASE 2 WHEN 3 THEN NULL END) WHEN 4 THEN 5 END; +CASE 0 WHEN 1 THEN (CASE 2 WHEN 3 THEN NULL END) WHEN 4 THEN 5 END +NULL +SELECT CASE 0 WHEN 1 THEN (COALESCE(NULL)) WHEN 4 THEN 5 END; +CASE 0 WHEN 1 THEN (COALESCE(NULL)) WHEN 4 THEN 5 END +NULL +SELECT CASE WHEN TRUE THEN COALESCE(NULL) ELSE 4 END; +CASE WHEN TRUE THEN COALESCE(NULL) ELSE 4 END +NULL +SELECT COALESCE(COALESCE(NULL), 1.1) AS c0, IF(0, COALESCE(NULL), 1.1) AS c1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c0 246 4 3 Y 32896 1 63 +def c1 246 4 3 Y 32896 1 63 +c0 c1 +1.1 1.1 +# +# MDEV-9752 Wrong data type for COALEASCE(?,1) in prepared statements +# +PREPARE stmt FROM "CREATE TABLE t1 AS SELECT CONCAT(COALESCE(?,1)) AS a, CONCAT(CASE WHEN TRUE THEN ? ELSE 1 END) AS b"; +SET @a=1; +EXECUTE stmt USING @a,@a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(20) DEFAULT NULL, + `b` varchar(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# ++# MDEV-11015 Assertion failed: precision > 0 in decimal_bin_size upon SELECT with DISTINCT, CAST and other functions ++# ++CREATE TABLE t1 (b LONGBLOB); ++INSERT IGNORE INTO t1 VALUES ('foo'),('bar'); ++SELECT DISTINCT - GREATEST( b, CAST( NULL AS DATETIME ) ) AS f FROM t1; ++f ++NULL ++Warnings: ++Warning 1292 Incorrect datetime value: 'foo' ++Warning 1292 Incorrect datetime value: 'bar' ++DROP TABLE t1; ++CREATE TABLE t1 (b LONGBLOB); ++INSERT IGNORE INTO t1 VALUES ('foo'),('bar'); ++SELECT DISTINCT - GREATEST( b, CAST( NULL AS TIME) ) AS f FROM t1; ++f ++NULL ++Warnings: ++Warning 1292 Truncated incorrect time value: 'foo' ++Warning 1292 Truncated incorrect time value: 'bar' ++DROP TABLE t1; ++CREATE TABLE t1 (b LONGBLOB); ++INSERT IGNORE INTO t1 VALUES ('foo'),('bar'); ++SELECT DISTINCT - GREATEST( b, CAST( NULL AS DATE) ) AS f FROM t1; ++f ++NULL ++Warnings: ++Warning 1292 Incorrect datetime value: 'foo' ++Warning 1292 Incorrect datetime value: 'bar' ++DROP TABLE t1; ++# +# End of 10.1 tests +# +# +# Start of 10.3 tests +# +# +# MDEV-12497 Wrong data type for LEAST(latin1_expr, utf8_expr) +# +CREATE TABLE t1 AS SELECT +LEAST(_latin1'aaa',_utf8 0xC39F) AS c1, +COALESCE(_latin1'aaa',_utf8 0xC39F) AS c2; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` varchar(3) CHARACTER SET utf8 NOT NULL, + `c2` varchar(3) CHARACTER SET utf8 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT * FROM t1; +c1 c2 +aaa aaa +DROP TABLE t1; +# +# MDEV-12504 Wrong data type for LEAST(date_expr,time_expr) +# +CREATE TABLE t1 AS SELECT +LEAST(DATE'2001-01-01', TIME'10:20:30') AS c1, +CONCAT(LEAST(DATE'2001-01-01', TIME'10:20:30')) AS c2; +SELECT * FROM t1; +c1 c2 +2001-01-01 00:00:00 2001-01-01 00:00:00 +DROP TABLE t1; +# +# MDEV-12505 Wrong data type for GREATEST(bit_column, int_column) +# +CREATE TABLE t1 (a BIT(64),b INT); +INSERT INTO t1 VALUES (0xFFFFFFFFFFFFFFFF,-1); +SELECT a>b, COALESCE(a,b), GREATEST(a,b) FROM t1; +a>b COALESCE(a,b) GREATEST(a,b) +1 18446744073709551615 18446744073709551615 +CREATE TABLE t2 AS SELECT COALESCE(a,b),GREATEST(a,b) FROM t1; +SELECT * FROM t2; +COALESCE(a,b) GREATEST(a,b) +18446744073709551615 18446744073709551615 +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `COALESCE(a,b)` decimal(64,0) DEFAULT NULL, + `GREATEST(a,b)` decimal(64,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +# MDEV-12601 Hybrid functions create a column of an impossible type DOUBLE(256,4) +# +CREATE TABLE t1 (a DOUBLE(255,4),b DOUBLE(255,3)); +CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `COALESCE(a,b)` double(255,4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +# MDEV-12617 CASE and CASE-alike hybrid functions do not preserve exact data types +# +CREATE TABLE t1 (a FLOAT(10,2)); +CREATE TABLE t2 AS SELECT COALESCE(a) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `COALESCE(a)` float(10,2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2, t1; +CREATE TABLE t1 (a FLOAT(10,2)); +CREATE TABLE t2 AS SELECT LEAST(a,a) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `LEAST(a,a)` float(19,2) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2, t1; +CREATE TABLE t1 (a TINYINT(1)); +CREATE TABLE t2 AS SELECT COALESCE(a) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `COALESCE(a)` tinyint(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2, t1; +CREATE TABLE t1 (a TINYINT(1)); +CREATE TABLE t2 AS SELECT LEAST(a,a) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `LEAST(a,a)` tinyint(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2, t1; +# +# MDEV-12875 Wrong VIEW column data type for COALESCE(int_column) +# +CREATE TABLE t1 (a INT); +CREATE OR REPLACE VIEW v1 AS SELECT COALESCE(a) FROM t1; +DESCRIBE v1; +Field Type Null Key Default Extra +COALESCE(a) int(11) YES NULL +DROP VIEW v1; +DROP TABLE t1; +# +# MDEV-10309 COALESCE(12345678900) makes a column of a wrong type and truncates the data +# +CREATE TABLE t1 AS SELECT 12345678900 AS c1, COALESCE(12345678900) AS c2; +SELECT * FROM t1; +c1 c2 +12345678900 12345678900 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` bigint(11) NOT NULL, + `c2` bigint(11) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 AS SELECT +9 AS i1, COALESCE(9) AS c1, +99 AS i2, COALESCE(99) AS c2, +999 AS i3, COALESCE(999) AS c3, +9999 AS i4, COALESCE(9999) AS c4, +99999 AS i5, COALESCE(99999) AS c5, +999999 AS i6, COALESCE(999999) AS c6, +9999999 AS i7, COALESCE(9999999) AS c7, +99999999 AS i8, COALESCE(99999999) AS c8, +999999999 AS i9, COALESCE(999999999) AS c9, +2147483647, COALESCE(2147483647), +2147483648, COALESCE(2147483648), +9999999999 AS i10, COALESCE(9999999999) AS c10, +99999999999 AS i11, COALESCE(99999999999) AS c11, +999999999999 AS i12, COALESCE(999999999999) AS c12, +9999999999999 AS i13, COALESCE(9999999999999) AS c13, +99999999999999 AS i14, COALESCE(99999999999999) AS c14, +999999999999999 AS i15, COALESCE(999999999999999) AS c15, +9999999999999999 AS i16, COALESCE(9999999999999999) AS c16, +99999999999999999 AS i17, COALESCE(99999999999999999) AS c17, +999999999999999999 AS i18, COALESCE(999999999999999999) AS c18, +9223372036854775807, COALESCE(9223372036854775807), +9223372036854775808, COALESCE(9223372036854775808), +9999999999999999999 AS i19, COALESCE(9999999999999999999) AS c19, +18446744073709551615, COALESCE(18446744073709551615), +18446744073709551616, COALESCE(18446744073709551616), +99999999999999999999 AS i20, COALESCE(99999999999999999999) AS c20, +999999999999999999999 AS i21, COALESCE(999999999999999999999) AS c21, +9999999999999999999999 AS i22, COALESCE(9999999999999999999999) AS c22; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i1` int(1) NOT NULL, + `c1` int(1) NOT NULL, + `i2` int(2) NOT NULL, + `c2` int(2) NOT NULL, + `i3` int(3) NOT NULL, + `c3` int(3) NOT NULL, + `i4` int(4) NOT NULL, + `c4` int(4) NOT NULL, + `i5` int(5) NOT NULL, + `c5` int(5) NOT NULL, + `i6` int(6) NOT NULL, + `c6` int(6) NOT NULL, + `i7` int(7) NOT NULL, + `c7` int(7) NOT NULL, + `i8` int(8) NOT NULL, + `c8` int(8) NOT NULL, + `i9` int(9) NOT NULL, + `c9` int(9) NOT NULL, + `2147483647` bigint(10) NOT NULL, + `COALESCE(2147483647)` bigint(10) NOT NULL, + `2147483648` bigint(10) NOT NULL, + `COALESCE(2147483648)` bigint(10) NOT NULL, + `i10` bigint(10) NOT NULL, + `c10` bigint(10) NOT NULL, + `i11` bigint(11) NOT NULL, + `c11` bigint(11) NOT NULL, + `i12` bigint(12) NOT NULL, + `c12` bigint(12) NOT NULL, + `i13` bigint(13) NOT NULL, + `c13` bigint(13) NOT NULL, + `i14` bigint(14) NOT NULL, + `c14` bigint(14) NOT NULL, + `i15` bigint(15) NOT NULL, + `c15` bigint(15) NOT NULL, + `i16` bigint(16) NOT NULL, + `c16` bigint(16) NOT NULL, + `i17` bigint(17) NOT NULL, + `c17` bigint(17) NOT NULL, + `i18` bigint(18) NOT NULL, + `c18` bigint(18) NOT NULL, + `9223372036854775807` bigint(19) NOT NULL, + `COALESCE(9223372036854775807)` bigint(19) NOT NULL, + `9223372036854775808` bigint(19) unsigned NOT NULL, + `COALESCE(9223372036854775808)` bigint(19) unsigned NOT NULL, + `i19` bigint(19) unsigned NOT NULL, + `c19` bigint(19) unsigned NOT NULL, + `18446744073709551615` bigint(20) unsigned NOT NULL, + `COALESCE(18446744073709551615)` bigint(20) unsigned NOT NULL, + `18446744073709551616` decimal(20,0) NOT NULL, + `COALESCE(18446744073709551616)` decimal(20,0) NOT NULL, + `i20` decimal(20,0) NOT NULL, + `c20` decimal(20,0) NOT NULL, + `i21` decimal(21,0) NOT NULL, + `c21` decimal(21,0) NOT NULL, + `i22` decimal(22,0) NOT NULL, + `c22` decimal(22,0) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT * FROM t1; +i1 9 +c1 9 +i2 99 +c2 99 +i3 999 +c3 999 +i4 9999 +c4 9999 +i5 99999 +c5 99999 +i6 999999 +c6 999999 +i7 9999999 +c7 9999999 +i8 99999999 +c8 99999999 +i9 999999999 +c9 999999999 +2147483647 2147483647 +COALESCE(2147483647) 2147483647 +2147483648 2147483648 +COALESCE(2147483648) 2147483648 +i10 9999999999 +c10 9999999999 +i11 99999999999 +c11 99999999999 +i12 999999999999 +c12 999999999999 +i13 9999999999999 +c13 9999999999999 +i14 99999999999999 +c14 99999999999999 +i15 999999999999999 +c15 999999999999999 +i16 9999999999999999 +c16 9999999999999999 +i17 99999999999999999 +c17 99999999999999999 +i18 999999999999999999 +c18 999999999999999999 +9223372036854775807 9223372036854775807 +COALESCE(9223372036854775807) 9223372036854775807 +9223372036854775808 9223372036854775808 +COALESCE(9223372036854775808) 9223372036854775808 +i19 9999999999999999999 +c19 9999999999999999999 +18446744073709551615 18446744073709551615 +COALESCE(18446744073709551615) 18446744073709551615 +18446744073709551616 18446744073709551616 +COALESCE(18446744073709551616) 18446744073709551616 +i20 99999999999999999999 +c20 99999999999999999999 +i21 999999999999999999999 +c21 999999999999999999999 +i22 9999999999999999999999 +c22 9999999999999999999999 +DROP TABLE t1; +# +# MDEV-9406 CREATE TABLE..SELECT creates different columns for IFNULL() and equivalent COALESCE,CASE,IF +# +CREATE TABLE t1 (a SMALLINT); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 AS SELECT +IFNULL(a,a) AS c1, +COALESCE(a,a) AS c2, +CASE WHEN a IS NOT NULL THEN a ELSE a END AS c3, +IF(a IS NULL,a,a) AS c4 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` smallint(6) DEFAULT NULL, + `c2` smallint(6) DEFAULT NULL, + `c3` smallint(6) DEFAULT NULL, + `c4` smallint(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2,t1; +CREATE TABLE t1 AS SELECT +connection_id() AS c0, +IFNULL(connection_id(),connection_id()) AS c1, +COALESCE(connection_id(), connection_id()) AS c2, +CASE WHEN 0 THEN connection_id() ELSE connection_id() END AS c3, +IF(0,connection_id(),connection_id()) AS c4; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c0` int(10) unsigned NOT NULL, + `c1` int(10) unsigned NOT NULL, + `c2` int(10) unsigned NOT NULL, + `c3` int(10) unsigned NOT NULL, + `c4` int(10) unsigned NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT +# +SET sql_mode=''; +CREATE TABLE t1 (d DECIMAL(43,0) UNSIGNED); +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 AS SELECT +IFNULL(SLEEP(0.01), NULL DIV d) AS f0, +IFNULL(SLEEP(0.01), '' DIV d) AS f1 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f0` decimal(1,0) DEFAULT NULL, + `f1` decimal(1,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +SET sql_mode=DEFAULT; +# +# MDEV-17325 NULL-ability problems with LEAST() in combination with NO_ZERO_DATE and NO_ZERO_IN_DATE +# +SET sql_mode='NO_ZERO_DATE,NO_ZERO_IN_DATE'; +SELECT +LEAST('0000-00-00',DATE'2001-01-01') AS s1, +LEAST('0001-00-01',DATE'2001-01-01') AS s2, +LEAST('0000-00-00',TIMESTAMP'2001-01-01 00:00:00') AS s3, +LEAST('0001-00-01',TIMESTAMP'2001-01-01 00:00:00') AS s4, +LEAST(0,DATE'2001-01-01') AS i1, +LEAST(20010001,DATE'2001-01-01') AS i2, +LEAST(0,TIMESTAMP'2001-01-01 00:00:00') AS i3, +LEAST(20010001,TIMESTAMP'2001-01-01 00:00:00') AS i4; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def s1 10 10 0 Y 128 0 63 +def s2 10 10 0 Y 128 0 63 +def s3 12 26 0 Y 128 6 63 +def s4 12 26 0 Y 128 6 63 +def i1 10 10 0 Y 128 0 63 +def i2 10 10 0 Y 128 0 63 +def i3 12 19 0 Y 128 0 63 +def i4 12 19 0 Y 128 0 63 +s1 s2 s3 s4 i1 i2 i3 i4 +NULL NULL NULL NULL NULL NULL NULL NULL +Warnings: +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0001-00-01' +Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00' +Warning 1292 Incorrect datetime value: '0001-00-01 00:00:00' +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '2001-00-01' +Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00' +Warning 1292 Incorrect datetime value: '2001-00-01 00:00:00' +SET sql_mode='NO_ZERO_DATE,NO_ZERO_IN_DATE'; +CREATE TABLE t1 AS SELECT +LEAST('0000-00-00',DATE'2001-01-01') AS s1, +LEAST('0001-00-01',DATE'2001-01-01') AS s2, +LEAST('0000-00-00',TIMESTAMP'2001-01-01 00:00:00') AS s3, +LEAST('0001-00-01',TIMESTAMP'2001-01-01 00:00:00') AS s4, +LEAST(0,DATE'2001-01-01') AS i1, +LEAST(20010001,DATE'2001-01-01') AS i2, +LEAST(0,TIMESTAMP'2001-01-01 00:00:00') AS i3, +LEAST(20010001,TIMESTAMP'2001-01-01 00:00:00') AS i4; +Warnings: +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0001-00-01' +Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00' +Warning 1292 Incorrect datetime value: '0001-00-01 00:00:00' +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '2001-00-01' +Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00' +Warning 1292 Incorrect datetime value: '2001-00-01 00:00:00' +SELECT * FROM t1; +s1 s2 s3 s4 i1 i2 i3 i4 +NULL NULL NULL NULL NULL NULL NULL NULL +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `s1` date DEFAULT NULL, + `s2` date DEFAULT NULL, + `s3` datetime(6) DEFAULT NULL, + `s4` datetime(6) DEFAULT NULL, + `i1` date DEFAULT NULL, + `i2` date DEFAULT NULL, + `i3` datetime DEFAULT NULL, + `i4` datetime DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30'); +CREATE TABLE t1 AS SELECT LEAST(CURRENT_DATE,CURRENT_TIME) AS c1; +SELECT * FROM t1; +c1 +2001-01-01 00:00:00 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` datetime NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +SET old_mode=ZERO_DATE_TIME_CAST; +CREATE TABLE t1 AS SELECT LEAST(CURRENT_DATE,CURRENT_TIME) AS c1; +Warnings: +Warning 1292 Incorrect datetime value: '0000-00-00 10:20:30' +SELECT * FROM t1; +c1 +NULL +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` datetime DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +SET old_mode=DEFAULT; +SET timestamp=DEFAULT; +SET sql_mode=DEFAULT; +SET sql_mode=''; +SELECT LEAST(999,TIME'10:20:30') AS c1; +c1 +NULL +Warnings: +Warning 1292 Incorrect datetime value: '999' +CREATE TABLE t1 AS SELECT LEAST(999,TIME'10:20:30') AS c1; +Warnings: +Warning 1292 Incorrect datetime value: '999' +SELECT * FROM t1; +c1 +NULL +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` time DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +SET sql_mode=DEFAULT; +# +# End of 10.3 tests +# diff --cc mysql-test/main/func_hybrid_type.test index 223ae4b2166,00000000000..9736485bb9f mode 100644,000000..100644 --- a/mysql-test/main/func_hybrid_type.test +++ b/mysql-test/main/func_hybrid_type.test @@@ -1,695 -1,0 +1,715 @@@ +--echo # +--echo # Start of 10.1 tests +--echo # + +--echo # +--echo # MDEV-8865 Wrong field type or metadata for COALESCE(signed_int_column, unsigned_int_column) +--echo # + +--echo # +CREATE TABLE t1 (a INT, b INT UNSIGNED); +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (-1,1); +INSERT INTO t1 VALUES (-2147483648,4294967295); +--source include/func_hybrid_type.inc +DROP TABLE t1; + +--echo # +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (-2147483648,2147483647); +--source include/func_hybrid_type.inc +DROP TABLE t1; + +--echo # +CREATE TABLE t1 (a BIGINT, b BIGINT UNSIGNED); +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (-9223372036854775808,0xFFFFFFFFFFFFFFFF); +--source include/func_hybrid_type.inc +DROP TABLE t1; + +--echo # +CREATE TABLE t1 (a BIGINT, b BIGINT); +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (-9223372036854775808,9223372036854775807); +--source include/func_hybrid_type.inc +DROP TABLE t1; + +# Testing BIT(N) types. +# Using safe BIT(N) type and value to make sure +# that "file func_hybrid_type.test" tells "ASCII text". + +--echo # +CREATE TABLE t1 (a INT, b BIT(8)); +INSERT INTO t1 VALUES (-2147483648,0x32); +--source include/func_hybrid_type.inc +DROP TABLE t1; + +--echo # +CREATE TABLE t1 (a INT UNSIGNED, b BIT(8)); +INSERT INTO t1 VALUES (4294967295,0x32); +--source include/func_hybrid_type.inc +DROP TABLE t1; + +--echo # +CREATE TABLE t1 (a BIT(7), b BIT(8)); +INSERT INTO t1 VALUES (0x32,0x32); +--source include/func_hybrid_type.inc +DROP TABLE t1; + +--echo # +CREATE TABLE t1 (a FLOAT, b SMALLINT); +INSERT INTO t1 VALUES (1,-32678); +--source include/func_hybrid_type.inc +DROP TABLE t1; + +--echo # +CREATE TABLE t1 (a VARCHAR(10), b ENUM('b')); +INSERT INTO t1 VALUES ('a','b'); +--source include/func_hybrid_type.inc +DROP TABLE t1; + +--echo # +CREATE TABLE t1 (a INT, b YEAR); +INSERT INTO t1 VALUES (-2147483648,2015); +--source include/func_hybrid_type.inc +DROP TABLE t1; + +--echo # +CREATE TABLE t1 (a INT UNSIGNED, b YEAR); +INSERT INTO t1 VALUES (4294967295,2015); +--source include/func_hybrid_type.inc +DROP TABLE t1; + +--echo # +SET timestamp=UNIX_TIMESTAMP('2001-01-01 01:02:03'); +CREATE TABLE t1 (a DATE, b TIME); +INSERT INTO t1 VALUES ('2010-01-01','10:20:30'); +--source include/func_hybrid_type.inc +DROP TABLE t1; +SET timestamp=DEFAULT; + +--echo # +SET timestamp=UNIX_TIMESTAMP('2001-01-01 01:02:03'); +CREATE TABLE t1 (a TIMESTAMP, b TIME); +INSERT INTO t1 VALUES ('2010-01-01 00:00:00','10:20:30'); +--source include/func_hybrid_type.inc +DROP TABLE t1; +SET timestamp=DEFAULT; + +--echo # +SET timestamp=UNIX_TIMESTAMP('2001-01-01 01:02:03'); +CREATE TABLE t1 (a DATETIME, b TIME); +INSERT INTO t1 VALUES ('2010-01-01 00:00:00','10:20:30'); +--source include/func_hybrid_type.inc +DROP TABLE t1; +SET timestamp=DEFAULT; + +--echo # +SET timestamp=UNIX_TIMESTAMP('2001-01-01 01:02:03'); +CREATE TABLE t1 (a DATETIME, b DATE); +INSERT INTO t1 VALUES ('2010-01-01 10:20:30','2001-01-02'); +--source include/func_hybrid_type.inc +DROP TABLE t1; +SET timestamp=DEFAULT; + + +--echo # +--echo # MDEV-8873 Wrong field type or metadata for LEAST(int_column,string_column) +--echo # +CREATE TABLE t1 (a INT, b VARCHAR(10)); +INSERT INTO t1 VALUES (-2147483648,'100x'); +--source include/func_hybrid_type.inc +DROP TABLE t1; + +--echo # +--echo # MDEV-4848 Wrong metadata or column type for LEAST(1.0,'10') +--echo # +--disable_ps_protocol +--enable_metadata +SELECT LEAST(1.0,'10'); +--disable_metadata +--enable_ps_protocol +CREATE TABLE t1 AS SELECT LEAST(1.0,'10'); +SHOW CREATE TABLE t1; +DROP TABLE t1; + +--echo # +--echo # MDEV-657 LP:873142 - GREATEST() does not always return same signness of argument types +--echo # +CREATE TABLE t1 (a BIGINT(20) UNSIGNED NOT NULL PRIMARY KEY); +INSERT INTO t1 (a) VALUES (13836376518955650385) ON DUPLICATE KEY UPDATE a=GREATEST(a,VALUES(a)); +INSERT INTO t1 (a) VALUES (13836376518955650385) ON DUPLICATE KEY UPDATE a=GREATEST(a,VALUES(a)); +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # MDEV-5694 GREATEST(date, time) returns a wrong data type +--echo # +SET timestamp=UNIX_TIMESTAMP('2010-01-01 01:02:03'); +--disable_ps_protocol +--enable_metadata +# Expect DATETIME type (12) in metadata +SELECT GREATEST(CURRENT_TIME, CURRENT_DATE), COALESCE(CURRENT_TIME, CURRENT_DATE); +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 VALUES ('2010-01-01 10:20:30'); +# Expect TIMESTAMP type (7) in metadata +SELECT GREATEST(a,a) FROM t1; +# Similar to this one +SELECT COALESCE(a,a) FROM t1; +DROP TABLE t1; +--disable_metadata +--enable_ps_protocol +CREATE TABLE t1 (a TIMESTAMP, b DATETIME); +CREATE TABLE t2 AS SELECT LEAST(a,a),LEAST(b,b),LEAST(a,b) FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; +DROP TABLE t1; +SET timestamp=DEFAULT; + +--echo # +--echo # MDEV-8910 Wrong metadata or field type for MAX(COALESCE(string_field)) +--echo # +CREATE TABLE t1 (c1 TINYBLOB, c2 MEDIUMBLOB, c3 BLOB, c4 LONGBLOB); +CREATE TABLE t2 AS +SELECT + MAX(COALESCE(c1)) AS c1, + MAX(COALESCE(c2)) AS c2, + MAX(COALESCE(c3)) AS c3, + MAX(COALESCE(c4)) AS c4 +FROM t1; +SHOW CREATE TABLE t2; +--disable_ps_protocol +--enable_metadata +SELECT + MAX(COALESCE(c1)) AS c1, + MAX(COALESCE(c2)) AS c2, + MAX(COALESCE(c3)) AS c3, + MAX(COALESCE(c4)) AS c4 +FROM t1; +--disable_metadata +--enable_ps_protocol +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 (c1 CHAR(1), c2 CHAR(255)) CHARACTER SET latin1; +CREATE TABLE t2 AS +SELECT + MAX(COALESCE(c1)) AS c1, + MAX(COALESCE(c2)) AS c2 +FROM t1; +SHOW CREATE TABLE t2; +--disable_ps_protocol +--enable_metadata +SELECT + MAX(COALESCE(c1)) AS c1, + MAX(COALESCE(c2)) AS c2 +FROM t1; +--disable_metadata +--enable_ps_protocol +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 (c1 CHAR(1), c2 CHAR(255)) CHARACTER SET utf8; +CREATE TABLE t2 AS +SELECT + MAX(COALESCE(c1)) AS c1, + MAX(COALESCE(c2)) AS c2 +FROM t1; +SHOW CREATE TABLE t2; +--disable_ps_protocol +--enable_metadata +SELECT + MAX(COALESCE(c1)) AS c1, + MAX(COALESCE(c2)) AS c2 +FROM t1; +--disable_metadata +--enable_ps_protocol +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARCHAR(1), c2 VARCHAR(255), c3 VARCHAR(20000)) CHARACTER SET latin1; +CREATE TABLE t2 AS +SELECT + MAX(COALESCE(c1)) AS c1, + MAX(COALESCE(c2)) AS c2, + MAX(COALESCE(c3)) AS c3 +FROM t1; +SHOW CREATE TABLE t2; +--disable_ps_protocol +--enable_metadata +SELECT + MAX(COALESCE(c1)) AS c1, + MAX(COALESCE(c2)) AS c2, + MAX(COALESCE(c3)) AS c3 +FROM t1; +--disable_metadata +--enable_ps_protocol +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARCHAR(1), c2 VARCHAR(255), c3 VARCHAR(20000)) CHARACTER SET utf8; +CREATE TABLE t2 AS +SELECT + MAX(COALESCE(c1)) AS c1, + MAX(COALESCE(c2)) AS c2, + MAX(COALESCE(c3)) AS c3 +FROM t1; +SHOW CREATE TABLE t2; +--disable_ps_protocol +--enable_metadata +SELECT + MAX(COALESCE(c1)) AS c1, + MAX(COALESCE(c2)) AS c2, + MAX(COALESCE(c3)) AS c3 +FROM t1; +--disable_metadata +--enable_ps_protocol +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 (c1 ENUM('a')) CHARACTER SET latin1; +CREATE TABLE t2 AS +SELECT + MAX(COALESCE(c1)) AS c1 +FROM t1; +SHOW CREATE TABLE t2; +--disable_ps_protocol +--enable_metadata +SELECT + MAX(COALESCE(c1)) AS c1 +FROM t1; +--disable_metadata +--enable_ps_protocol +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 (c1 ENUM('a')) CHARACTER SET utf8; +CREATE TABLE t2 AS +SELECT + MAX(COALESCE(c1)) AS c1 +FROM t1; +SHOW CREATE TABLE t2; +--disable_ps_protocol +--enable_metadata +SELECT + MAX(COALESCE(c1)) AS c1 +FROM t1; +--disable_metadata +--enable_ps_protocol +DROP TABLE t2; +DROP TABLE t1; + + +--echo # +--echo # MDEV-8912 Wrong metadata or type for @c:=string_or_blob_field +--echo # +CREATE TABLE t1 (c1 TINYBLOB, c2 BLOB, c3 MEDIUMBLOB, c4 LONGBLOB); +CREATE TABLE t2 AS +SELECT + @c1:=c1 AS c1, + @c2:=c2 AS c2, + @c3:=c3 AS c3, + @c4:=c4 AS c4 +FROM t1; +SHOW CREATE TABLE t2; +--disable_ps_protocol +--enable_metadata +SELECT + @c1:=c1 AS c1, + @c2:=c2 AS c2, + @c3:=c3 AS c3, + @c4:=c4 AS c4 +FROM t1; +--disable_metadata +--enable_ps_protocol +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 (c1 CHAR(1), c2 CHAR(255)) CHARACTER SET latin1; +CREATE TABLE t2 AS +SELECT + @c1:=c1 AS c1, + @c2:=c2 AS c2 +FROM t1; +SHOW CREATE TABLE t2; +--disable_ps_protocol +--enable_metadata +SELECT + @c1:=c1 AS c1, + @c2:=c2 AS c2 +FROM t1; +--disable_metadata +--enable_ps_protocol +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 (c1 CHAR(1), c2 CHAR(255)) CHARACTER SET utf8; +CREATE TABLE t2 AS +SELECT + @c1:=c1 AS c1, + @c2:=c2 AS c2 +FROM t1; +SHOW CREATE TABLE t2; +--disable_ps_protocol +--enable_metadata +SELECT + @c1:=c1 AS c1, + @c2:=c2 AS c2 +FROM t1; +--disable_metadata +--enable_ps_protocol +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARCHAR(1), c2 VARCHAR(255), c3 VARCHAR(20000)) CHARACTER SET latin1; +CREATE TABLE t2 AS +SELECT + @c:=c1 AS c1, + @c:=c2 AS c2, + @c:=c3 AS c3 +FROM t1; +SHOW CREATE TABLE t2; +--disable_ps_protocol +--enable_metadata +SELECT + @c:=c1 AS c1, + @c:=c2 AS c2, + @c:=c3 AS c3 +FROM t1; +--disable_metadata +--enable_ps_protocol +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 (c1 VARCHAR(1), c2 VARCHAR(255), c3 VARCHAR(20000)) CHARACTER SET utf8; +CREATE TABLE t2 AS +SELECT + @c:=c1 AS c1, + @c:=c2 AS c2, + @c:=c3 AS c3 +FROM t1; +SHOW CREATE TABLE t2; +--disable_ps_protocol +--enable_metadata +SELECT + @c:=c1 AS c1, + @c:=c2 AS c2, + @c:=c3 AS c3 +FROM t1; +--disable_metadata +--enable_ps_protocol +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 (c1 ENUM('a')) CHARACTER SET latin1; +CREATE TABLE t2 AS +SELECT + @c:=c1 AS c1 +FROM t1; +SHOW CREATE TABLE t2; +--disable_ps_protocol +--enable_metadata +SELECT + @c:=c1 AS c1 +FROM t1; +--disable_metadata +--enable_ps_protocol +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 (c1 ENUM('a')) CHARACTER SET utf8; +CREATE TABLE t2 AS +SELECT + @c:=c1 AS c1 +FROM t1; +SHOW CREATE TABLE t2; +--disable_ps_protocol +--enable_metadata +SELECT + @c:=c1 AS c1 +FROM t1; +--disable_metadata +--enable_ps_protocol +DROP TABLE t2; +DROP TABLE t1; + + +--echo # +--echo # MDEV-9653 Assertion `length || !scale' failed in uint my_decimal_length_to_precision(uint, uint, bool) +--echo # +SELECT CASE 0 WHEN 1 THEN (CASE 2 WHEN 3 THEN NULL END) WHEN 4 THEN 5 END; +SELECT CASE 0 WHEN 1 THEN (COALESCE(NULL)) WHEN 4 THEN 5 END; +SELECT CASE WHEN TRUE THEN COALESCE(NULL) ELSE 4 END; + +--disable_ps_protocol +--enable_metadata +SELECT COALESCE(COALESCE(NULL), 1.1) AS c0, IF(0, COALESCE(NULL), 1.1) AS c1; +--disable_metadata +--enable_ps_protocol + + +--echo # +--echo # MDEV-9752 Wrong data type for COALEASCE(?,1) in prepared statements +--echo # +PREPARE stmt FROM "CREATE TABLE t1 AS SELECT CONCAT(COALESCE(?,1)) AS a, CONCAT(CASE WHEN TRUE THEN ? ELSE 1 END) AS b"; +SET @a=1; +EXECUTE stmt USING @a,@a; +SHOW CREATE TABLE t1; +DROP TABLE t1; + ++ ++--echo # ++--echo # MDEV-11015 Assertion failed: precision > 0 in decimal_bin_size upon SELECT with DISTINCT, CAST and other functions ++--echo # ++ ++CREATE TABLE t1 (b LONGBLOB); ++INSERT IGNORE INTO t1 VALUES ('foo'),('bar'); ++SELECT DISTINCT - GREATEST( b, CAST( NULL AS DATETIME ) ) AS f FROM t1; ++DROP TABLE t1; ++ ++CREATE TABLE t1 (b LONGBLOB); ++INSERT IGNORE INTO t1 VALUES ('foo'),('bar'); ++SELECT DISTINCT - GREATEST( b, CAST( NULL AS TIME) ) AS f FROM t1; ++DROP TABLE t1; ++ ++CREATE TABLE t1 (b LONGBLOB); ++INSERT IGNORE INTO t1 VALUES ('foo'),('bar'); ++SELECT DISTINCT - GREATEST( b, CAST( NULL AS DATE) ) AS f FROM t1; ++DROP TABLE t1; ++ +--echo # +--echo # End of 10.1 tests +--echo # + +--echo # +--echo # Start of 10.3 tests +--echo # + +--echo # +--echo # MDEV-12497 Wrong data type for LEAST(latin1_expr, utf8_expr) +--echo # + +CREATE TABLE t1 AS SELECT + LEAST(_latin1'aaa',_utf8 0xC39F) AS c1, + COALESCE(_latin1'aaa',_utf8 0xC39F) AS c2; +SHOW CREATE TABLE t1; +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # MDEV-12504 Wrong data type for LEAST(date_expr,time_expr) +--echo # + +CREATE TABLE t1 AS SELECT + LEAST(DATE'2001-01-01', TIME'10:20:30') AS c1, + CONCAT(LEAST(DATE'2001-01-01', TIME'10:20:30')) AS c2; +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # MDEV-12505 Wrong data type for GREATEST(bit_column, int_column) +--echo # + +CREATE TABLE t1 (a BIT(64),b INT); +INSERT INTO t1 VALUES (0xFFFFFFFFFFFFFFFF,-1); +SELECT a>b, COALESCE(a,b), GREATEST(a,b) FROM t1; +CREATE TABLE t2 AS SELECT COALESCE(a,b),GREATEST(a,b) FROM t1; +SELECT * FROM t2; +SHOW CREATE TABLE t2; +DROP TABLE t2; +DROP TABLE t1; + +--echo # +--echo # MDEV-12601 Hybrid functions create a column of an impossible type DOUBLE(256,4) +--echo # + +CREATE TABLE t1 (a DOUBLE(255,4),b DOUBLE(255,3)); +CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; +DROP TABLE t1; + +--echo # +--echo # MDEV-12617 CASE and CASE-alike hybrid functions do not preserve exact data types +--echo # + +CREATE TABLE t1 (a FLOAT(10,2)); +CREATE TABLE t2 AS SELECT COALESCE(a) FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2, t1; + +CREATE TABLE t1 (a FLOAT(10,2)); +CREATE TABLE t2 AS SELECT LEAST(a,a) FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2, t1; + +CREATE TABLE t1 (a TINYINT(1)); +CREATE TABLE t2 AS SELECT COALESCE(a) FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2, t1; + +CREATE TABLE t1 (a TINYINT(1)); +CREATE TABLE t2 AS SELECT LEAST(a,a) FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2, t1; + +--echo # +--echo # MDEV-12875 Wrong VIEW column data type for COALESCE(int_column) +--echo # + +CREATE TABLE t1 (a INT); +CREATE OR REPLACE VIEW v1 AS SELECT COALESCE(a) FROM t1; +DESCRIBE v1; +DROP VIEW v1; +DROP TABLE t1; + +--echo # +--echo # MDEV-10309 COALESCE(12345678900) makes a column of a wrong type and truncates the data +--echo # + +CREATE TABLE t1 AS SELECT 12345678900 AS c1, COALESCE(12345678900) AS c2; +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT + 9 AS i1, COALESCE(9) AS c1, + 99 AS i2, COALESCE(99) AS c2, + 999 AS i3, COALESCE(999) AS c3, + 9999 AS i4, COALESCE(9999) AS c4, + 99999 AS i5, COALESCE(99999) AS c5, + 999999 AS i6, COALESCE(999999) AS c6, + 9999999 AS i7, COALESCE(9999999) AS c7, + 99999999 AS i8, COALESCE(99999999) AS c8, + 999999999 AS i9, COALESCE(999999999) AS c9, + 2147483647, COALESCE(2147483647), + 2147483648, COALESCE(2147483648), + 9999999999 AS i10, COALESCE(9999999999) AS c10, + 99999999999 AS i11, COALESCE(99999999999) AS c11, + 999999999999 AS i12, COALESCE(999999999999) AS c12, + 9999999999999 AS i13, COALESCE(9999999999999) AS c13, + 99999999999999 AS i14, COALESCE(99999999999999) AS c14, + 999999999999999 AS i15, COALESCE(999999999999999) AS c15, + 9999999999999999 AS i16, COALESCE(9999999999999999) AS c16, + 99999999999999999 AS i17, COALESCE(99999999999999999) AS c17, + 999999999999999999 AS i18, COALESCE(999999999999999999) AS c18, + 9223372036854775807, COALESCE(9223372036854775807), + 9223372036854775808, COALESCE(9223372036854775808), + 9999999999999999999 AS i19, COALESCE(9999999999999999999) AS c19, + 18446744073709551615, COALESCE(18446744073709551615), + 18446744073709551616, COALESCE(18446744073709551616), + 99999999999999999999 AS i20, COALESCE(99999999999999999999) AS c20, + 999999999999999999999 AS i21, COALESCE(999999999999999999999) AS c21, + 9999999999999999999999 AS i22, COALESCE(9999999999999999999999) AS c22; +SHOW CREATE TABLE t1; +--vertical_results +SELECT * FROM t1; +--horizontal_results +DROP TABLE t1; + + +--echo # +--echo # MDEV-9406 CREATE TABLE..SELECT creates different columns for IFNULL() and equivalent COALESCE,CASE,IF +--echo # +CREATE TABLE t1 (a SMALLINT); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 AS SELECT + IFNULL(a,a) AS c1, + COALESCE(a,a) AS c2, + CASE WHEN a IS NOT NULL THEN a ELSE a END AS c3, + IF(a IS NULL,a,a) AS c4 FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2,t1; + +CREATE TABLE t1 AS SELECT + connection_id() AS c0, + IFNULL(connection_id(),connection_id()) AS c1, + COALESCE(connection_id(), connection_id()) AS c2, + CASE WHEN 0 THEN connection_id() ELSE connection_id() END AS c3, + IF(0,connection_id(),connection_id()) AS c4; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +--echo # +--echo # MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT +--echo # + +SET sql_mode=''; +CREATE TABLE t1 (d DECIMAL(43,0) UNSIGNED); +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 AS SELECT + IFNULL(SLEEP(0.01), NULL DIV d) AS f0, + IFNULL(SLEEP(0.01), '' DIV d) AS f1 +FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t1, t2; +SET sql_mode=DEFAULT; + + +--echo # +--echo # MDEV-17325 NULL-ability problems with LEAST() in combination with NO_ZERO_DATE and NO_ZERO_IN_DATE +--echo # + +SET sql_mode='NO_ZERO_DATE,NO_ZERO_IN_DATE'; + +--disable_ps_protocol +--enable_metadata +SELECT + LEAST('0000-00-00',DATE'2001-01-01') AS s1, + LEAST('0001-00-01',DATE'2001-01-01') AS s2, + LEAST('0000-00-00',TIMESTAMP'2001-01-01 00:00:00') AS s3, + LEAST('0001-00-01',TIMESTAMP'2001-01-01 00:00:00') AS s4, + LEAST(0,DATE'2001-01-01') AS i1, + LEAST(20010001,DATE'2001-01-01') AS i2, + LEAST(0,TIMESTAMP'2001-01-01 00:00:00') AS i3, + LEAST(20010001,TIMESTAMP'2001-01-01 00:00:00') AS i4; +--disable_metadata +--enable_ps_protocol + +SET sql_mode='NO_ZERO_DATE,NO_ZERO_IN_DATE'; +CREATE TABLE t1 AS SELECT + LEAST('0000-00-00',DATE'2001-01-01') AS s1, + LEAST('0001-00-01',DATE'2001-01-01') AS s2, + LEAST('0000-00-00',TIMESTAMP'2001-01-01 00:00:00') AS s3, + LEAST('0001-00-01',TIMESTAMP'2001-01-01 00:00:00') AS s4, + LEAST(0,DATE'2001-01-01') AS i1, + LEAST(20010001,DATE'2001-01-01') AS i2, + LEAST(0,TIMESTAMP'2001-01-01 00:00:00') AS i3, + LEAST(20010001,TIMESTAMP'2001-01-01 00:00:00') AS i4; +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30'); + +# A TIME always converts to a non-NULL DATETIME with the new CAST style +# Expect a NOT NULL column +CREATE TABLE t1 AS SELECT LEAST(CURRENT_DATE,CURRENT_TIME) AS c1; +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +# A TIME can convert to a NULL DATETIME with old CAST style +# Expect a NULL-able column +SET old_mode=ZERO_DATE_TIME_CAST; +CREATE TABLE t1 AS SELECT LEAST(CURRENT_DATE,CURRENT_TIME) AS c1; +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; +SET old_mode=DEFAULT; +SET timestamp=DEFAULT; + +SET sql_mode=DEFAULT; + +SET sql_mode=''; +SELECT LEAST(999,TIME'10:20:30') AS c1; +CREATE TABLE t1 AS SELECT LEAST(999,TIME'10:20:30') AS c1; +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; +SET sql_mode=DEFAULT; + +--echo # +--echo # End of 10.3 tests +--echo # diff --cc mysql-test/main/func_str.result index f1da28d10be,00000000000..22cf0a5cc56 mode 100644,000000..100644 --- a/mysql-test/main/func_str.result +++ b/mysql-test/main/func_str.result @@@ -1,5034 -1,0 +1,5072 @@@ +drop table if exists t1,t2; +set global max_allowed_packet=1048576; +connect conn1,localhost,root,,; +connection conn1; +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 +select 'hello' 'monty'; +hello +hellomonty +select length('\n\t\r\b\0\_\%\\'); +length('\n\t\r\b\0\_\%\\') +10 +select bit_length('\n\t\r\b\0\_\%\\'); +bit_length('\n\t\r\b\0\_\%\\') +80 +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 hex(char(256)); +hex(char(256)) +0100 +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 +select instr('hello','HE'), instr('hello',binary 'HE'), instr(binary 'hello','HE'); +instr('hello','HE') instr('hello',binary 'HE') instr(binary 'hello','HE') +1 0 0 +select position(binary 'll' in 'hello'),position('a' in binary 'hello'); +position(binary 'll' in 'hello') position('a' in binary 'hello') +3 0 +select left('hello',null), right('hello',null); +left('hello',null) right('hello',null) +NULL NULL +select left('hello',2),right('hello',2),substring('hello',2,2),mid('hello',1,5) ; +left('hello',2) right('hello',2) substring('hello',2,2) mid('hello',1,5) +he lo el hello +select concat('',left(right(concat('what ',concat('is ','happening')),9),4),'',substring('monty',5,1)) ; +concat('',left(right(concat('what ',concat('is ','happening')),9),4),'',substring('monty',5,1)) +happy +select substring_index('www.tcx.se','.',-2),substring_index('www.tcx.se','.',1); +substring_index('www.tcx.se','.',-2) substring_index('www.tcx.se','.',1) +tcx.se www +select substring_index('www.tcx.se','tcx',1),substring_index('www.tcx.se','tcx',-1); +substring_index('www.tcx.se','tcx',1) substring_index('www.tcx.se','tcx',-1) +www. .se +select substring_index('.tcx.se','.',-2),substring_index('.tcx.se','.tcx',-1); +substring_index('.tcx.se','.',-2) substring_index('.tcx.se','.tcx',-1) +tcx.se .se +select substring_index('aaaaaaaaa1','a',1); +substring_index('aaaaaaaaa1','a',1) + +select substring_index('aaaaaaaaa1','aa',1); +substring_index('aaaaaaaaa1','aa',1) + +select substring_index('aaaaaaaaa1','aa',2); +substring_index('aaaaaaaaa1','aa',2) +aa +select substring_index('aaaaaaaaa1','aa',3); +substring_index('aaaaaaaaa1','aa',3) +aaaa +select substring_index('aaaaaaaaa1','aa',4); +substring_index('aaaaaaaaa1','aa',4) +aaaaaa +select substring_index('aaaaaaaaa1','aa',5); +substring_index('aaaaaaaaa1','aa',5) +aaaaaaaaa1 +select substring_index('aaaaaaaaa1','aaa',1); +substring_index('aaaaaaaaa1','aaa',1) + +select substring_index('aaaaaaaaa1','aaa',2); +substring_index('aaaaaaaaa1','aaa',2) +aaa +select substring_index('aaaaaaaaa1','aaa',3); +substring_index('aaaaaaaaa1','aaa',3) +aaaaaa +select substring_index('aaaaaaaaa1','aaa',4); +substring_index('aaaaaaaaa1','aaa',4) +aaaaaaaaa1 +select substring_index('aaaaaaaaa1','aaaa',1); +substring_index('aaaaaaaaa1','aaaa',1) + +select substring_index('aaaaaaaaa1','aaaa',2); +substring_index('aaaaaaaaa1','aaaa',2) +aaaa +select substring_index('aaaaaaaaa1','1',1); +substring_index('aaaaaaaaa1','1',1) +aaaaaaaaa +select substring_index('aaaaaaaaa1','a',-1); +substring_index('aaaaaaaaa1','a',-1) +1 +select substring_index('aaaaaaaaa1','aa',-1); +substring_index('aaaaaaaaa1','aa',-1) +1 +select substring_index('aaaaaaaaa1','aa',-2); +substring_index('aaaaaaaaa1','aa',-2) +aa1 +select substring_index('aaaaaaaaa1','aa',-3); +substring_index('aaaaaaaaa1','aa',-3) +aaaa1 +select substring_index('aaaaaaaaa1','aa',-4); +substring_index('aaaaaaaaa1','aa',-4) +aaaaaa1 +select substring_index('aaaaaaaaa1','aa',-5); +substring_index('aaaaaaaaa1','aa',-5) +aaaaaaaaa1 +select substring_index('aaaaaaaaa1','aaa',-1); +substring_index('aaaaaaaaa1','aaa',-1) +1 +select substring_index('aaaaaaaaa1','aaa',-2); +substring_index('aaaaaaaaa1','aaa',-2) +aaa1 +select substring_index('aaaaaaaaa1','aaa',-3); +substring_index('aaaaaaaaa1','aaa',-3) +aaaaaa1 +select substring_index('aaaaaaaaa1','aaa',-4); +substring_index('aaaaaaaaa1','aaa',-4) +aaaaaaaaa1 +select substring_index('the king of thethe hill','the',-2); +substring_index('the king of thethe hill','the',-2) +the hill +select substring_index('the king of the the hill','the',-2); +substring_index('the king of the the hill','the',-2) + the hill +select substring_index('the king of the the hill','the',-2); +substring_index('the king of the the hill','the',-2) + the hill +select substring_index('the king of the the hill',' the ',-1); +substring_index('the king of the the hill',' the ',-1) +hill +select substring_index('the king of the the hill',' the ',-2); +substring_index('the king of the the hill',' the ',-2) + the hill +select substring_index('the king of the the hill',' ',-1); +substring_index('the king of the the hill',' ',-1) +hill +select substring_index('the king of the the hill',' ',-2); +substring_index('the king of the the hill',' ',-2) +the hill +select substring_index('the king of the the hill',' ',-3); +substring_index('the king of the the hill',' ',-3) + the hill +select substring_index('the king of the the hill',' ',-4); +substring_index('the king of the the hill',' ',-4) +the the hill +select substring_index('the king of the the hill',' ',-5); +substring_index('the king of the the hill',' ',-5) +of the the hill +select substring_index('the king of the.the hill','the',-2); +substring_index('the king of the.the hill','the',-2) +.the hill +select substring_index('the king of thethethe.the hill','the',-3); +substring_index('the king of thethethe.the hill','the',-3) +the.the hill +select substring_index('the king of thethethe.the hill','the',-1); +substring_index('the king of thethethe.the hill','the',-1) + hill +select substring_index('the king of the the hill','the',1); +substring_index('the king of the the hill','the',1) + +select substring_index('the king of the the hill','the',2); +substring_index('the king of the the hill','the',2) +the king of +select substring_index('the king of the the hill','the',3); +substring_index('the king of the the hill','the',3) +the king of the +select concat(':',ltrim(' left '),':',rtrim(' right '),':'); +concat(':',ltrim(' left '),':',rtrim(' right '),':') +:left : right: +select concat(':',trim(leading from ' left '),':',trim(trailing from ' right '),':'); +concat(':',trim(leading from ' left '),':',trim(trailing from ' right '),':') +:left : right: +select concat(':',trim(LEADING FROM ' left'),':',trim(TRAILING FROM ' right '),':'); +concat(':',trim(LEADING FROM ' left'),':',trim(TRAILING FROM ' right '),':') +:left: right: +select concat(':',trim(' m '),':',trim(BOTH FROM ' y '),':',trim('*' FROM '*s*'),':'); +concat(':',trim(' m '),':',trim(BOTH FROM ' y '),':',trim('*' FROM '*s*'),':') +:m:y:s: +select concat(':',trim(BOTH 'ab' FROM 'ababmyabab'),':',trim(BOTH '*' FROM '***sql'),':'); +concat(':',trim(BOTH 'ab' FROM 'ababmyabab'),':',trim(BOTH '*' FROM '***sql'),':') +:my:sql: +select concat(':',trim(LEADING '.*' FROM '.*my'),':',trim(TRAILING '.*' FROM 'sql.*.*'),':'); +concat(':',trim(LEADING '.*' FROM '.*my'),':',trim(TRAILING '.*' FROM 'sql.*.*'),':') +:my:sql: +select TRIM("foo" FROM "foo"), TRIM("foo" FROM "foook"), TRIM("foo" FROM "okfoo"); +TRIM("foo" FROM "foo") TRIM("foo" FROM "foook") TRIM("foo" FROM "okfoo") + ok ok +select concat_ws(', ','monty','was here','again'); +concat_ws(', ','monty','was here','again') +monty, was here, again +select concat_ws(NULL,'a'),concat_ws(',',NULL,''); +concat_ws(NULL,'a') concat_ws(',',NULL,'') +NULL +select concat_ws(',','',NULL,'a'); +concat_ws(',','',NULL,'a') +,a +SELECT CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),repeat('d',100)), '"'); +CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),repeat('d',100)), '"') +"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc";"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd" +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 test +select replace('aaaa','a','b'),replace('aaaa','aa','b'),replace('aaaa','a','bb'),replace('aaaa','','b'),replace('bbbb','a','c'); +replace('aaaa','a','b') replace('aaaa','aa','b') replace('aaaa','a','bb') replace('aaaa','','b') replace('bbbb','a','c') +bbbb bb bbbbbbbb aaaa bbbb +select replace(concat(lcase(concat('THIS',' ','IS',' ','A',' ')),ucase('false'),' ','test'),'FALSE','REAL') ; +replace(concat(lcase(concat('THIS',' ','IS',' ','A',' ')),ucase('false'),' ','test'),'FALSE','REAL') +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 +select sha1('abc'); +sha1('abc') +a9993e364706816aba3e25717850c26c9cd0d89d +select aes_decrypt(aes_encrypt('abc','1'),'1'); +aes_decrypt(aes_encrypt('abc','1'),'1') +abc +select aes_decrypt(aes_encrypt('abc','1'),1); +aes_decrypt(aes_encrypt('abc','1'),1) +abc +select aes_encrypt(NULL,"a"); +aes_encrypt(NULL,"a") +NULL +select aes_encrypt("a",NULL); +aes_encrypt("a",NULL) +NULL +select aes_decrypt(NULL,"a"); +aes_decrypt(NULL,"a") +NULL +select aes_decrypt("a",NULL); +aes_decrypt("a",NULL) +NULL +select aes_decrypt("a","a"); +aes_decrypt("a","a") +NULL +select aes_decrypt(aes_encrypt("","a"),"a"); +aes_decrypt(aes_encrypt("","a"),"a") + +select aes_decrypt("", "a"); +aes_decrypt("", "a") +NULL +select repeat('monty',5),concat('*',space(5),'*'); +repeat('monty',5) concat('*',space(5),'*') +montymontymontymontymonty * * +select reverse('abc'),reverse('abcd'); +reverse('abc') reverse('abcd') +cba dcba +select rpad('a',4,'1'),rpad('a',4,'12'),rpad('abcd',3,'12'), rpad(11, 10 , 22), rpad("ab", 10, 22); +rpad('a',4,'1') rpad('a',4,'12') rpad('abcd',3,'12') rpad(11, 10 , 22) rpad("ab", 10, 22) +a111 a121 abc 1122222222 ab22222222 +select lpad('a',4,'1'),lpad('a',4,'12'),lpad('abcd',3,'12'), lpad(11, 10 , 22); +lpad('a',4,'1') lpad('a',4,'12') lpad('abcd',3,'12') lpad(11, 10 , 22) +111a 121a abc 2222222211 +select rpad(741653838,17,'0'),lpad(741653838,17,'0'); +rpad(741653838,17,'0') lpad(741653838,17,'0') +74165383800000000 00000000741653838 +select rpad('abcd',7,'ab'),lpad('abcd',7,'ab'); +rpad('abcd',7,'ab') lpad('abcd',7,'ab') +abcdaba abaabcd +select rpad('abcd',1,'ab'),lpad('abcd',1,'ab'); +rpad('abcd',1,'ab') lpad('abcd',1,'ab') +a a +select rpad('STRING', 20, CONCAT('p','a','d') ); +rpad('STRING', 20, CONCAT('p','a','d') ) +STRINGpadpadpadpadpa +select lpad('STRING', 20, CONCAT('p','a','d') ); +lpad('STRING', 20, CONCAT('p','a','d') ) +padpadpadpadpaSTRING +select rpad('abcd',7),lpad('abcd',7); +rpad('abcd',7) lpad('abcd',7) +abcd abcd +select LEAST(NULL,'HARRY','HARRIOT',NULL,'HAROLD'),GREATEST(NULL,'HARRY','HARRIOT',NULL,'HAROLD'); +LEAST(NULL,'HARRY','HARRIOT',NULL,'HAROLD') GREATEST(NULL,'HARRY','HARRIOT',NULL,'HAROLD') +NULL NULL +select least(1,2,3) | greatest(16,32,8), least(5,4)*1,greatest(-1.0,1.0)*1,least(3,2,1)*1.0,greatest(1,1.1,1.0),least("10",9),greatest("A","B","0"); +least(1,2,3) | greatest(16,32,8) least(5,4)*1 greatest(-1.0,1.0)*1 least(3,2,1)*1.0 greatest(1,1.1,1.0) least("10",9) greatest("A","B","0") +33 4 1.0 1.0 1.1 9 B +select decode(encode(repeat("a",100000),"monty"),"monty")=repeat("a",100000); +decode(encode(repeat("a",100000),"monty"),"monty")=repeat("a",100000) +1 +select decode(encode("abcdef","monty"),"monty")="abcdef"; +decode(encode("abcdef","monty"),"monty")="abcdef" +1 +select quote('\'\"\\test'); +quote('\'\"\\test') +'\'"\\test' +select quote(concat('abc\'', '\\cba')); +quote(concat('abc\'', '\\cba')) +'abc\'\\cba' +select quote(1/0), quote('\0\Z'); +quote(1/0) quote('\0\Z') +NULL '\0\Z' +Warnings: +Warning 1365 Division by 0 +select length(quote(concat(char(0),"test"))); +length(quote(concat(char(0),"test"))) +8 +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 +select reverse(""); +reverse("") + +select insert("aa",100,1,"b"),insert("aa",1,3,"b"),left("aa",-1),substring("a",1,2); +insert("aa",100,1,"b") insert("aa",1,3,"b") left("aa",-1) substring("a",1,2) +aa b a +select elt(2,1),field(NULL,"a","b","c"),reverse(""); +elt(2,1) field(NULL,"a","b","c") reverse("") +NULL 0 +select locate("a","b",2),locate("","a",1); +locate("a","b",2) locate("","a",1) +0 1 +select ltrim("a"),rtrim("a"),trim(BOTH "" from "a"),trim(BOTH " " from "a"); +ltrim("a") rtrim("a") trim(BOTH "" from "a") trim(BOTH " " from "a") +a a a a +select concat("1","2")|0,concat("1",".5")+0.0; +concat("1","2")|0 concat("1",".5")+0.0 +12 1.5 +select substring_index("www.tcx.se","",3); +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 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'baaa' +select position(("1" in (1,2,3)) in "01"); +position(("1" in (1,2,3)) in "01") +2 +select length(repeat("a",65500)),length(concat(repeat("a",32000),repeat("a",32000))),length(replace("aaaaa","a",concat(repeat("a",10000)))),length(insert(repeat("a",40000),1,30000,repeat("b",50000))); +length(repeat("a",65500)) length(concat(repeat("a",32000),repeat("a",32000))) length(replace("aaaaa","a",concat(repeat("a",10000)))) length(insert(repeat("a",40000),1,30000,repeat("b",50000))) +65500 64000 50000 60000 +select length(repeat("a",1000000)),length(concat(repeat("a",32000),repeat("a",32000),repeat("a",32000))),length(replace("aaaaa","a",concat(repeat("a",32000)))),length(insert(repeat("a",48000),1,1000,repeat("a",48000))); +length(repeat("a",1000000)) length(concat(repeat("a",32000),repeat("a",32000),repeat("a",32000))) length(replace("aaaaa","a",concat(repeat("a",32000)))) length(insert(repeat("a",48000),1,1000,repeat("a",48000))) +1000000 96000 160000 95000 +create table t1 ( domain char(50) ); +insert into t1 VALUES ("hello.de" ), ("test.de" ); +select domain from t1 where concat('@', trim(leading '.' from concat('.', domain))) = '@hello.de'; +domain +hello.de +select domain from t1 where concat('@', trim(leading '.' from concat('.', domain))) = '@test.de'; +domain +test.de +drop table t1; +CREATE TABLE t1 ( +id int(10) unsigned NOT NULL, +title varchar(255) default NULL, +prio int(10) unsigned default NULL, +category int(10) unsigned default NULL, +program int(10) unsigned default NULL, +bugdesc text, +created datetime default NULL, +modified timestamp NOT NULL, +bugstatus int(10) unsigned default NULL, +submitter int(10) unsigned default NULL +) 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+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+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)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1, 'a545f661efdd1fb66fdee3aab79945bf'); +SELECT 1 FROM t1 WHERE tmp=AES_DECRYPT(tmp,"password"); +1 +DROP TABLE t1; +CREATE TABLE t1 ( +wid int(10) unsigned NOT NULL auto_increment, +data_podp date default NULL, +status_wnio enum('nowy','podp','real','arch') NOT NULL default 'nowy', +PRIMARY KEY(wid) +); +INSERT INTO t1 VALUES (8,NULL,'real'); +INSERT INTO t1 VALUES (9,NULL,'nowy'); +SELECT elt(status_wnio,data_podp) FROM t1 GROUP BY wid; +elt(status_wnio,data_podp) +NULL +NULL +DROP TABLE t1; +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; +CONCAT("</a>",RPAD("",(55 - LENGTH(title)),".")) +NULL +</a>.......................... +DROP TABLE t1; +CREATE TABLE t1 (i int, j int); +INSERT INTO t1 VALUES (1,1),(2,2); +SELECT DISTINCT i, ELT(j, '345', '34') FROM t1; +i ELT(j, '345', '34') +1 345 +2 34 +DROP TABLE t1; +create table t1(a char(4)); +insert into t1 values ('one'),(NULL),('two'),('four'); +select a, quote(a), isnull(quote(a)), quote(a) is null, ifnull(quote(a), 'n') from t1; +a quote(a) isnull(quote(a)) quote(a) is null ifnull(quote(a), 'n') +one 'one' 0 0 'one' +NULL NULL 0 0 NULL +two 'two' 0 0 'two' +four 'four' 0 0 'four' +drop table t1; +select trim(trailing 'foo' from 'foo'); +trim(trailing 'foo' from 'foo') + +select trim(leading 'foo' from 'foo'); +trim(leading 'foo' from 'foo') + +select quote(ltrim(concat(' ', 'a'))); +quote(ltrim(concat(' ', 'a'))) +'a' +select quote(trim(concat(' ', 'a'))); +quote(trim(concat(' ', 'a'))) +'a' +CREATE TABLE t1 SELECT 1 UNION SELECT 2 UNION SELECT 3; +SELECT QUOTE('A') FROM t1; +QUOTE('A') +'A' +'A' +'A' +DROP TABLE t1; +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('1',_latin2'3','2',1); +FIELD('1',_latin2'3','2',1) +3 +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 'substring_index' +select SUBSTRING_INDEX(_latin1'abcdabcdabcd' COLLATE latin1_general_ci,_latin1'd' COLLATE latin1_bin,2); +ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'substring_index' +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 4 +select collation(oct(130)), coercibility(oct(130)); +collation(oct(130)) coercibility(oct(130)) +latin1_swedish_ci 4 +select collation(conv(130,16,10)), coercibility(conv(130,16,10)); +collation(conv(130,16,10)) coercibility(conv(130,16,10)) +latin1_swedish_ci 4 +select collation(hex(130)), coercibility(hex(130)); +collation(hex(130)) coercibility(hex(130)) +latin1_swedish_ci 4 +select collation(char(130)), coercibility(hex(130)); +collation(char(130)) coercibility(hex(130)) +binary 4 +select collation(format(130,10)), coercibility(format(130,10)); +collation(format(130,10)) coercibility(format(130,10)) +latin1_swedish_ci 4 +select collation(lcase(_latin2'a')), coercibility(lcase(_latin2'a')); +collation(lcase(_latin2'a')) coercibility(lcase(_latin2'a')) +latin2_general_ci 4 +select collation(ucase(_latin2'a')), coercibility(ucase(_latin2'a')); +collation(ucase(_latin2'a')) coercibility(ucase(_latin2'a')) +latin2_general_ci 4 +select collation(left(_latin2'a',1)), coercibility(left(_latin2'a',1)); +collation(left(_latin2'a',1)) coercibility(left(_latin2'a',1)) +latin2_general_ci 4 +select collation(right(_latin2'a',1)), coercibility(right(_latin2'a',1)); +collation(right(_latin2'a',1)) coercibility(right(_latin2'a',1)) +latin2_general_ci 4 +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 4 +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 4 +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 4 +select collation(lpad(_latin2'a',4)), coercibility(lpad(_latin2'a',4)); +collation(lpad(_latin2'a',4)) coercibility(lpad(_latin2'a',4)) +latin2_general_ci 4 +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 4 +select collation(rpad(_latin2'a',4)), coercibility(rpad(_latin2'a',4)); +collation(rpad(_latin2'a',4)) coercibility(rpad(_latin2'a',4)) +latin2_general_ci 4 +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 4 +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 4 +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' ')) +latin2_general_ci 4 +select collation(trim(_latin2' a ')), coercibility(trim(_latin2' a ')); +collation(trim(_latin2' a ')) coercibility(trim(_latin2' a ')) +latin2_general_ci 4 +select collation(ltrim(_latin2' a ')), coercibility(ltrim(_latin2' a ')); +collation(ltrim(_latin2' a ')) coercibility(ltrim(_latin2' a ')) +latin2_general_ci 4 +select collation(rtrim(_latin2' a ')), coercibility(rtrim(_latin2' a ')); +collation(rtrim(_latin2' a ')) coercibility(rtrim(_latin2' a ')) +latin2_general_ci 4 +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 4 +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 4 +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 4 +select collation(repeat(_latin2'a',10)), coercibility(repeat(_latin2'a',10)); +collation(repeat(_latin2'a',10)) coercibility(repeat(_latin2'a',10)) +latin2_general_ci 4 +select collation(reverse(_latin2'ab')), coercibility(reverse(_latin2'ab')); +collation(reverse(_latin2'ab')) coercibility(reverse(_latin2'ab')) +latin2_general_ci 4 +select collation(quote(_latin2'ab')), coercibility(quote(_latin2'ab')); +collation(quote(_latin2'ab')) coercibility(quote(_latin2'ab')) +latin2_general_ci 4 +select collation(soundex(_latin2'ab')), coercibility(soundex(_latin2'ab')); +collation(soundex(_latin2'ab')) coercibility(soundex(_latin2'ab')) +latin2_general_ci 4 +select collation(substring(_latin2'ab',1)), coercibility(substring(_latin2'ab',1)); +collation(substring(_latin2'ab',1)) coercibility(substring(_latin2'ab',1)) +latin2_general_ci 4 +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 4 +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 4 +select collation(encode('abcd','ab')), coercibility(encode('abcd','ab')); +collation(encode('abcd','ab')) coercibility(encode('abcd','ab')) +binary 4 +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'), +lpad(_latin2'a',4), +rpad(_latin2'a',4), +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; +Table Create Table +t1 CREATE TABLE `t1` ( + `bin(130)` varchar(64) DEFAULT NULL, + `oct(130)` varchar(64) DEFAULT NULL, + `conv(130,16,10)` varchar(64) DEFAULT NULL, + `hex(130)` varchar(6) DEFAULT NULL, + `char(130)` varbinary(4) DEFAULT NULL, + `format(130,10)` varchar(45) DEFAULT NULL, + `left(_latin2'a',1)` varchar(1) CHARACTER SET latin2 DEFAULT NULL, + `right(_latin2'a',1)` varchar(1) CHARACTER SET latin2 DEFAULT NULL, + `lcase(_latin2'a')` varchar(1) CHARACTER SET latin2 DEFAULT NULL, + `ucase(_latin2'a')` varchar(1) CHARACTER SET latin2 DEFAULT NULL, + `substring(_latin2'a',1,1)` varchar(1) CHARACTER SET latin2 DEFAULT NULL, + `concat(_latin2'a',_latin2'b')` varchar(2) CHARACTER SET latin2 DEFAULT NULL, + `lpad(_latin2'a',4,_latin2'b')` varchar(4) CHARACTER SET latin2 DEFAULT NULL, + `rpad(_latin2'a',4,_latin2'b')` varchar(4) CHARACTER SET latin2 DEFAULT NULL, + `lpad(_latin2'a',4)` varchar(4) CHARACTER SET latin2 DEFAULT NULL, + `rpad(_latin2'a',4)` varchar(4) CHARACTER SET latin2 DEFAULT NULL, + `concat_ws(_latin2'a',_latin2'b')` varchar(1) CHARACTER SET latin2 DEFAULT NULL, + `make_set(255,_latin2'a',_latin2'b',_latin2'c')` varchar(5) CHARACTER SET latin2 DEFAULT NULL, + `export_set(255,_latin2'y',_latin2'n',_latin2' ')` varchar(127) CHARACTER SET latin2 DEFAULT NULL, + `trim(_latin2' a ')` varchar(3) CHARACTER SET latin2 DEFAULT NULL, + `ltrim(_latin2' a ')` varchar(3) CHARACTER SET latin2 DEFAULT NULL, + `rtrim(_latin2' a ')` varchar(3) CHARACTER SET latin2 DEFAULT NULL, + `trim(LEADING _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 DEFAULT NULL, + `trim(TRAILING _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 DEFAULT NULL, + `trim(BOTH _latin2' ' FROM _latin2' a ')` varchar(3) CHARACTER SET latin2 DEFAULT NULL, + `repeat(_latin2'a',10)` varchar(10) CHARACTER SET latin2 DEFAULT NULL, + `reverse(_latin2'ab')` varchar(2) CHARACTER SET latin2 DEFAULT NULL, + `quote(_latin2'ab')` varchar(6) CHARACTER SET latin2 DEFAULT NULL, + `soundex(_latin2'ab')` varchar(4) CHARACTER SET latin2 DEFAULT NULL, + `substring(_latin2'ab',1)` varchar(2) CHARACTER SET latin2 DEFAULT NULL, + `insert(_latin2'abcd',2,3,_latin2'ef')` varchar(6) CHARACTER SET latin2 DEFAULT NULL, + `replace(_latin2'abcd',_latin2'b',_latin2'B')` varchar(4) CHARACTER SET latin2 DEFAULT NULL, + `encode('abcd','ab')` varbinary(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 (a char character set latin2); +insert into t1 values (null); +select charset(a), collation(a), coercibility(a) from t1; +charset(a) collation(a) coercibility(a) +latin2 latin2_general_ci 2 +drop table t1; +select charset(null), collation(null), coercibility(null); +charset(null) collation(null) coercibility(null) +binary binary 6 +CREATE TABLE t1 (a int, b int); +CREATE TABLE t2 (a int, b int); +INSERT INTO t1 VALUES (1,1),(2,2); +INSERT INTO t2 VALUES (2,2),(3,3); +select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b) +where collation(t2.a) = _utf8'binary' order by t1.a,t2.a; +a b a b +1 1 NULL NULL +2 2 2 2 +select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b) +where charset(t2.a) = _utf8'binary' order by t1.a,t2.a; +a b a b +1 1 NULL NULL +2 2 2 2 +select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b) +where coercibility(t2.a) = 5 order by t1.a,t2.a; +a b a b +1 1 NULL NULL +2 2 2 2 +DROP TABLE t1, t2; +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'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select md5('hello') AS `md5('hello')` +explain extended select sha('abc'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select sha('abc') AS `sha('abc')` +explain extended select sha1('abc'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select sha('abc') AS `sha1('abc')` +explain extended select soundex(''); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select soundex('') AS `soundex('')` +explain extended select 'mood' sounds like 'mud'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select soundex('mood') = soundex('mud') AS `'mood' sounds like 'mud'` +explain extended select aes_decrypt(aes_encrypt('abc','1'),'1'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select aes_decrypt(aes_encrypt('abc','1'),'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')` +explain extended select concat('*',space(5),'*'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select concat('*',space(5),'*') AS `concat('*',space(5),'*')` +explain extended select reverse('abc'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select reverse('abc') AS `reverse('abc')` +explain extended select rpad('a',4,'1'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select rpad('a',4,'1') AS `rpad('a',4,'1')` +explain extended select lpad('a',4,'1'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select lpad('a',4,'1') AS `lpad('a',4,'1')` +explain extended select rpad('a',4); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select rpad('a',4) AS `rpad('a',4)` +explain extended select lpad('a',4); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select lpad('a',4) AS `lpad('a',4)` +explain extended select concat_ws(',','',NULL,'a'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select concat_ws(',','',NULL,'a') AS `concat_ws(',','',NULL,'a')` +explain extended select make_set(255,_latin2'a', _latin2'b', _latin2'c'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a', _latin2'b', _latin2'c')` +explain extended select elt(2,1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select elt(2,1) AS `elt(2,1)` +explain extended select locate("a","b",2); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select locate('a','b',2) AS `locate("a","b",2)` +explain extended select format(130,10); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select format(130,10) AS `format(130,10)` +explain extended select char(0); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select char(0) AS `char(0)` +explain extended select conv(130,16,10); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select conv(130,16,10) AS `conv(130,16,10)` +explain extended select hex(130); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select hex(130) AS `hex(130)` +explain extended select binary 'HE'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select cast('HE' as char charset binary) AS `binary 'HE'` +explain extended select export_set(255,_latin2'y', _latin2'n', _latin2' '); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y', _latin2'n', _latin2' ')` +explain extended select FIELD('b' COLLATE latin1_bin,'A','B'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select field('b' collate latin1_bin,'A','B') AS `FIELD('b' COLLATE latin1_bin,'A','B')` +explain extended select FIND_IN_SET(_latin1'B', _latin1'a,b,c,d'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B', _latin1'a,b,c,d')` +explain extended select collation(conv(130,16,10)); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select collation(conv(130,16,10)) AS `collation(conv(130,16,10))` +explain extended select coercibility(conv(130,16,10)); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))` +explain extended select length('\n\t\r\b\0\_\%\\'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select octet_length('\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')` +explain extended select bit_length('\n\t\r\b\0\_\%\\'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select bit_length('\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')` +explain extended select bit_length('\n\t\r\b\0\_\%\\'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select bit_length('\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')` +explain extended select concat('monty',' was here ','again'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select concat('monty',' was here ','again') AS `concat('monty',' was here ','again')` +explain extended select length('hello'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select octet_length('hello') AS `length('hello')` +explain extended select char(ascii('h')); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select char(ascii('h')) AS `char(ascii('h'))` +explain extended select ord('h'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select ord('h') AS `ord('h')` +explain extended select quote(1/0); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select quote(1 / 0) AS `quote(1/0)` +explain extended select crc32("123"); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select crc32('123') AS `crc32("123")` +explain extended select replace('aaaa','a','b'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select replace('aaaa','a','b') AS `replace('aaaa','a','b')` +explain extended select insert('txs',2,1,'hi'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select insert('txs',2,1,'hi') AS `insert('txs',2,1,'hi')` +explain extended select left(_latin2'a',1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select left(_latin2'a',1) AS `left(_latin2'a',1)` +explain extended select right(_latin2'a',1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select right(_latin2'a',1) AS `right(_latin2'a',1)` +explain extended select lcase(_latin2'a'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select lcase(_latin2'a') AS `lcase(_latin2'a')` +explain extended select ucase(_latin2'a'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select ucase(_latin2'a') AS `ucase(_latin2'a')` +explain extended select SUBSTR('abcdefg',3,2); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select substr('abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)` +explain extended select substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select substring_index('1abcd;2abcd;3abcd;4abcd',';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)` +explain extended select trim(_latin2' a '); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select trim(_latin2' a ') AS `trim(_latin2' a ')` +explain extended select ltrim(_latin2' a '); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select ltrim(_latin2' a ') AS `ltrim(_latin2' a ')` +explain extended select rtrim(_latin2' a '); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select rtrim(_latin2' a ') AS `rtrim(_latin2' a ')` +explain extended select decode(encode(repeat("a",100000),"monty"),"monty"); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select decode(encode(repeat('a',100000),'monty'),'monty') 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 +SELECT conv(71, 10, 37), conv('1Z', 37, 10), conv(0,1,10),conv(0,0,10), conv(0,-1,10); +conv(71, 10, 37) conv('1Z', 37, 10) conv(0,1,10) conv(0,0,10) conv(0,-1,10) +NULL NULL NULL NULL NULL +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 ignore into t1 values ('21474836461','21474836461'); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +insert ignore into t1 values ('-21474836461','-21474836461'); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +show warnings; +Level Code Message +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value 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; +select trim(null from 'kate') as "must_be_null"; +must_be_null +NULL +select trim('xyz' from null) as "must_be_null"; +must_be_null +NULL +select trim(leading NULL from 'kate') as "must_be_null"; +must_be_null +NULL +select trim(trailing NULL from 'xyz') as "must_be_null"; +must_be_null +NULL +CREATE TABLE t1 ( +id int(11) NOT NULL auto_increment, +a bigint(20) unsigned default NULL, +PRIMARY KEY (id) +) ENGINE=MyISAM; +INSERT INTO t1 VALUES +('0','16307858876001849059'); +SELECT CONV('e251273eb74a8ee3', 16, 10); +CONV('e251273eb74a8ee3', 16, 10) +16307858876001849059 +EXPLAIN +SELECT id +FROM t1 +WHERE a = 16307858876001849059; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 +EXPLAIN +SELECT id +FROM t1 +WHERE a = CONV('e251273eb74a8ee3', 16, 10); +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; +SELECT CHAR(NULL,121,83,81,'76') as my_column; +my_column +ySQL +SELECT CHAR_LENGTH(CHAR(NULL,121,83,81,'76')) as my_column; +my_column +4 +CREATE TABLE t1 (id int PRIMARY KEY, str char(255) NOT NULL); +CREATE TABLE t2 (id int NOT NULL UNIQUE); +INSERT INTO t2 VALUES (1),(2); +INSERT INTO t1 VALUES (1, aes_encrypt('foo', 'bar')); +INSERT INTO t1 VALUES (2, 'not valid'); +SELECT t1.id, aes_decrypt(str, 'bar') FROM t1, t2 WHERE t1.id = t2.id; +id aes_decrypt(str, 'bar') +1 foo +2 NULL +SELECT t1.id, aes_decrypt(str, 'bar') FROM t1, t2 WHERE t1.id = t2.id +ORDER BY t1.id; +id aes_decrypt(str, 'bar') +1 foo +2 NULL +DROP TABLE t1, t2; +select field(0,NULL,1,0), field("",NULL,"bar",""), field(0.0,NULL,1.0,0.0); +field(0,NULL,1,0) field("",NULL,"bar","") field(0.0,NULL,1.0,0.0) +3 3 3 +select field(NULL,1,2,NULL), field(NULL,1,2,0); +field(NULL,1,2,NULL) field(NULL,1,2,0) +0 0 +CREATE TABLE t1 (str varchar(20) PRIMARY KEY); +CREATE TABLE t2 (num int primary key); +INSERT INTO t1 VALUES ('notnumber'); +INSERT INTO t2 VALUES (0), (1); +SELECT * FROM t1, t2 WHERE num=str; +str num +notnumber 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'notnumber' +SELECT * FROM t1, t2 WHERE num=substring(str from 1 for 6); +str num +notnumber 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'notnum' +DROP TABLE t1,t2; +CREATE TABLE t1( +id int(11) NOT NULL auto_increment, +pc int(11) NOT NULL default '0', +title varchar(20) default NULL, +PRIMARY KEY (id) +); +INSERT INTO t1 VALUES +(1, 0, 'Main'), +(2, 1, 'Toys'), +(3, 1, 'Games'); +SELECT t1.id, CONCAT_WS('->', t3.title, t2.title, t1.title) as col1 +FROM t1 LEFT JOIN t1 AS t2 ON t1.pc=t2.id +LEFT JOIN t1 AS t3 ON t2.pc=t3.id; +id col1 +1 Main +2 Main->Toys +3 Main->Games +SELECT t1.id, CONCAT_WS('->', t3.title, t2.title, t1.title) as col1 +FROM t1 LEFT JOIN t1 AS t2 ON t1.pc=t2.id +LEFT JOIN t1 AS t3 ON t2.pc=t3.id +WHERE CONCAT_WS('->', t3.title, t2.title, t1.title) LIKE '%Toys%'; +id col1 +2 Main->Toys +DROP TABLE t1; +CREATE TABLE t1( +trackid int(10) unsigned NOT NULL auto_increment, +trackname varchar(100) NOT NULL default '', +PRIMARY KEY (trackid) +); +CREATE TABLE t2( +artistid int(10) unsigned NOT NULL auto_increment, +artistname varchar(100) NOT NULL default '', +PRIMARY KEY (artistid) +); +CREATE TABLE t3( +trackid int(10) unsigned NOT NULL, +artistid int(10) unsigned NOT NULL, +PRIMARY KEY (trackid,artistid) +); +INSERT INTO t1 VALUES (1, 'April In Paris'), (2, 'Autumn In New York'); +INSERT INTO t2 VALUES (1, 'Vernon Duke'); +INSERT INTO t3 VALUES (1,1); +SELECT CONCAT_WS(' ', trackname, artistname) trackname, artistname +FROM t1 LEFT JOIN t3 ON t1.trackid=t3.trackid +LEFT JOIN t2 ON t2.artistid=t3.artistid +WHERE CONCAT_WS(' ', trackname, artistname) LIKE '%In%'; +trackname artistname +April In Paris Vernon Duke Vernon Duke +Autumn In New York NULL +DROP TABLE t1,t2,t3; +create table t1 (b varchar(5)); +insert t1 values ('ab'), ('abc'), ('abcd'), ('abcde'); +select *,substring(b,1),substring(b,-1),substring(b,-2),substring(b,-3),substring(b,-4),substring(b,-5) from t1; +b substring(b,1) substring(b,-1) substring(b,-2) substring(b,-3) substring(b,-4) substring(b,-5) +ab ab b ab +abc abc c bc abc +abcd abcd d cd bcd abcd +abcde abcde e de cde bcde abcde +select * from (select *,substring(b,1),substring(b,-1),substring(b,-2),substring(b,-3),substring(b,-4),substring(b,-5) from t1) t; +b substring(b,1) substring(b,-1) substring(b,-2) substring(b,-3) substring(b,-4) substring(b,-5) +ab ab b ab +abc abc c bc abc +abcd abcd d cd bcd abcd +abcde abcde e de cde bcde abcde +drop table t1; +select hex(29223372036854775809), hex(-29223372036854775809); +hex(29223372036854775809) hex(-29223372036854775809) +FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF +create table t1 (i int); +insert into t1 values (1000000000),(1); +select lpad(i, 7, ' ') as t from t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t 253 7 7 Y 0 39 8 +t +1000000 + 1 +select rpad(i, 7, ' ') as t from t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def t 253 7 7 Y 0 39 8 +t +1000000 +1 +drop table t1; +select load_file("lkjlkj"); +load_file("lkjlkj") +NULL +select ifnull(load_file("lkjlkj"),"it's null"); +ifnull(load_file("lkjlkj"),"it's null") +it's null +create table t1 (f1 varchar(4), f2 varchar(64), unique key k1 (f1,f2)); +insert into t1 values ( 'test',md5('test')), ('test', sha('test')); +select * from t1 where f1='test' and (f2= md5("test") or f2= md5("TEST")); +f1 f2 +test 098f6bcd4621d373cade4e832627b4f6 +select * from t1 where f1='test' and (f2= md5("TEST") or f2= md5("test")); +f1 f2 +test 098f6bcd4621d373cade4e832627b4f6 +select * from t1 where f1='test' and (f2= sha("test") or f2= sha("TEST")); +f1 f2 +test a94a8fe5ccb19ba61c4c0873d391e987982fbbd3 +select * from t1 where f1='test' and (f2= sha("TEST") or f2= sha("test")); +f1 f2 +test a94a8fe5ccb19ba61c4c0873d391e987982fbbd3 +drop table t1; +CREATE TABLE t1 (a varchar(10)); +INSERT INTO t1 VALUES ('abc'), ('xyz'); +SELECT a, CONCAT(a,' ',a) AS c FROM t1 +HAVING LEFT(c,LENGTH(c)-INSTR(REVERSE(c)," ")) = a; +a c +abc abc abc +xyz xyz xyz +SELECT a, CONCAT(a,' ',a) AS c FROM t1 +HAVING LEFT(CONCAT(a,' ',a), +LENGTH(CONCAT(a,' ',a))- +INSTR(REVERSE(CONCAT(a,' ',a))," ")) = a; +a c +abc abc abc +xyz xyz xyz +DROP TABLE t1; +CREATE TABLE t1 (s varchar(10)); +INSERT INTO t1 VALUES ('yadda'), ('yaddy'); +EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(s) > 'ab'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where trim(`test`.`t1`.`s`) > 'ab' +EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM('y' FROM s) > 'ab'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where trim(both 'y' from `test`.`t1`.`s`) > 'ab' +EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(LEADING 'y' FROM s) > 'ab'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where trim(leading 'y' from `test`.`t1`.`s`) > 'ab' +EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(TRAILING 'y' FROM s) > 'ab'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where trim(trailing 'y' from `test`.`t1`.`s`) > 'ab' +EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(BOTH 'y' FROM s) > 'ab'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where trim(both 'y' from `test`.`t1`.`s`) > 'ab' +DROP TABLE t1; +create table t1(f1 varchar(4)); +explain extended select encode(f1,'zxcv') as 'enc' from t1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found +Warnings: +Note 1003 select encode(NULL,'zxcv') AS `enc` from `test`.`t1` +explain extended select decode(f1,'zxcv') as 'enc' from t1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found +Warnings: +Note 1003 select decode(NULL,'zxcv') AS `enc` from `test`.`t1` +drop table t1; +create table t1 (a bigint not null)engine=myisam; +insert into t1 set a = 1024*1024*1024*4; +delete from t1 order by (inet_ntoa(a)) desc limit 10; +drop table t1; +create table t1 (a char(36) not null)engine=myisam; +insert ignore into t1 set a = ' '; +insert ignore into t1 set a = ' '; +select * from t1 order by (oct(a)); +a + + +drop table t1; +End of 4.1 tests +create table t1 (d decimal default null); +insert into t1 values (null); +select format(d, 2) from t1; +format(d, 2) +NULL +drop table t1; +create table t1 (c varchar(40)); +insert into t1 values ('y,abc'),('y,abc'); +select c, substring_index(lcase(c), @q:=',', -1) as res from t1; +c res +y,abc abc +y,abc abc +drop table t1; +select cast(rtrim(' 20.06 ') as decimal(19,2)); +cast(rtrim(' 20.06 ') as decimal(19,2)) +20.06 +select cast(ltrim(' 20.06 ') as decimal(19,2)); +cast(ltrim(' 20.06 ') as decimal(19,2)) +20.06 +Warnings: +Note 1292 Truncated incorrect DECIMAL value: '20.06 ' +select cast(rtrim(ltrim(' 20.06 ')) as decimal(19,2)); +cast(rtrim(ltrim(' 20.06 ')) as decimal(19,2)) +20.06 +select conv("18383815659218730760",10,10) + 0; +conv("18383815659218730760",10,10) + 0 +1.838381565921873e19 +select "18383815659218730760" + 0; +"18383815659218730760" + 0 +1.838381565921873e19 +CREATE TABLE t1 (code varchar(10)); +INSERT INTO t1 VALUES ('a12'), ('A12'), ('a13'); +SELECT ASCII(code), code FROM t1 WHERE code='A12'; +ASCII(code) code +97 a12 +65 A12 +SELECT ASCII(code), code FROM t1 WHERE code='A12' AND ASCII(code)=65; +ASCII(code) code +65 A12 +INSERT INTO t1 VALUES ('a12 '), ('A12 '); +SELECT LENGTH(code), code FROM t1 WHERE code='A12'; +LENGTH(code) code +3 a12 +3 A12 +4 a12 +5 A12 +SELECT LENGTH(code), code FROM t1 WHERE code='A12' AND LENGTH(code)=5; +LENGTH(code) code +5 A12 +ALTER TABLE t1 ADD INDEX (code); +CREATE TABLE t2 (id varchar(10) PRIMARY KEY); +INSERT INTO t2 VALUES ('a11'), ('a12'), ('a13'), ('a14'); +SELECT * FROM t1 INNER JOIN t2 ON t1.code=t2.id +WHERE t2.id='a12' AND (LENGTH(code)=5 OR code < 'a00'); +code id +A12 a12 +EXPLAIN EXTENDED +SELECT * FROM t1 INNER JOIN t2 ON code=id +WHERE id='a12' AND (LENGTH(code)=5 OR code < 'a00'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 const PRIMARY PRIMARY 12 const 1 100.00 Using index +1 SIMPLE t1 ref code code 13 const 3 100.00 Using where; Using index +Warnings: +Note 1003 select `test`.`t1`.`code` AS `code`,'a12' AS `id` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`code` = 'a12' and octet_length(`test`.`t1`.`code`) = 5 +DROP TABLE t1,t2; +select encode(NULL, NULL); +encode(NULL, NULL) +NULL +select encode("data", NULL); +encode("data", NULL) +NULL +select encode(NULL, "password"); +encode(NULL, "password") +NULL +select decode(NULL, NULL); +decode(NULL, NULL) +NULL +select decode("data", NULL); +decode("data", NULL) +NULL +select decode(NULL, "password"); +decode(NULL, "password") +NULL +select format(NULL, NULL); +format(NULL, NULL) +NULL +select format(pi(), NULL); +format(pi(), NULL) +NULL +select format(NULL, 2); +format(NULL, 2) +NULL +select benchmark(NULL, NULL); +benchmark(NULL, NULL) +NULL +select benchmark(0, NULL); +benchmark(0, NULL) +0 +select benchmark(100, NULL); +benchmark(100, NULL) +0 +select benchmark(NULL, 1+1); +benchmark(NULL, 1+1) +NULL +select benchmark(-1, 1); +benchmark(-1, 1) +NULL +Warnings: +Warning 1411 Incorrect count value: '-1' for function benchmark +set @password="password"; +set @my_data="clear text to encode"; +select md5(encode(@my_data, "password")); +md5(encode(@my_data, "password")) +44320fd2b4a0ec92faa2da2122def917 +select md5(encode(@my_data, _utf8 "password")); +md5(encode(@my_data, _utf8 "password")) +44320fd2b4a0ec92faa2da2122def917 +select md5(encode(@my_data, binary "password")); +md5(encode(@my_data, binary "password")) +44320fd2b4a0ec92faa2da2122def917 +select md5(encode(@my_data, _latin1 "password")); +md5(encode(@my_data, _latin1 "password")) +44320fd2b4a0ec92faa2da2122def917 +select md5(encode(@my_data, _koi8r "password")); +md5(encode(@my_data, _koi8r "password")) +44320fd2b4a0ec92faa2da2122def917 +select md5(encode(@my_data, (select "password" from dual))); +md5(encode(@my_data, (select "password" from dual))) +44320fd2b4a0ec92faa2da2122def917 +select md5(encode(@my_data, concat("pass", "word"))); +md5(encode(@my_data, concat("pass", "word"))) +44320fd2b4a0ec92faa2da2122def917 +select md5(encode(@my_data, @password)); +md5(encode(@my_data, @password)) +44320fd2b4a0ec92faa2da2122def917 +set @my_data="binary encoded data"; +select md5(decode(@my_data, "password")); +md5(decode(@my_data, "password")) +5bea8c394368dbc03b76684483b7756b +select md5(decode(@my_data, _utf8 "password")); +md5(decode(@my_data, _utf8 "password")) +5bea8c394368dbc03b76684483b7756b +select md5(decode(@my_data, binary "password")); +md5(decode(@my_data, binary "password")) +5bea8c394368dbc03b76684483b7756b +select md5(decode(@my_data, _latin1 "password")); +md5(decode(@my_data, _latin1 "password")) +5bea8c394368dbc03b76684483b7756b +select md5(decode(@my_data, _koi8r "password")); +md5(decode(@my_data, _koi8r "password")) +5bea8c394368dbc03b76684483b7756b +select md5(decode(@my_data, (select "password" from dual))); +md5(decode(@my_data, (select "password" from dual))) +5bea8c394368dbc03b76684483b7756b +select md5(decode(@my_data, concat("pass", "word"))); +md5(decode(@my_data, concat("pass", "word"))) +5bea8c394368dbc03b76684483b7756b +select md5(decode(@my_data, @password)); +md5(decode(@my_data, @password)) +5bea8c394368dbc03b76684483b7756b +set @dec=5; +select format(pi(), (1+1)); +format(pi(), (1+1)) +3.14 +select format(pi(), (select 3 from dual)); +format(pi(), (select 3 from dual)) +3.142 +select format(pi(), @dec); +format(pi(), @dec) +3.14159 +set @bench_count=10; +select benchmark(10, pi()); +benchmark(10, pi()) +0 +select benchmark(5+5, pi()); +benchmark(5+5, pi()) +0 +select benchmark((select 10 from dual), pi()); +benchmark((select 10 from dual), pi()) +0 +select benchmark(@bench_count, pi()); +benchmark(@bench_count, pi()) +0 +select locate('he','hello',-2); +locate('he','hello',-2) +0 +select locate('lo','hello',-4294967295); +locate('lo','hello',-4294967295) +0 +select locate('lo','hello',4294967295); +locate('lo','hello',4294967295) +0 +select locate('lo','hello',-4294967296); +locate('lo','hello',-4294967296) +0 +select locate('lo','hello',4294967296); +locate('lo','hello',4294967296) +0 +select locate('lo','hello',-4294967297); +locate('lo','hello',-4294967297) +0 +select locate('lo','hello',4294967297); +locate('lo','hello',4294967297) +0 +select locate('lo','hello',-18446744073709551615); +locate('lo','hello',-18446744073709551615) +0 +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +select locate('lo','hello',18446744073709551615); +locate('lo','hello',18446744073709551615) +0 +select locate('lo','hello',-18446744073709551616); +locate('lo','hello',-18446744073709551616) +0 +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +select locate('lo','hello',18446744073709551616); +locate('lo','hello',18446744073709551616) +0 +Warnings: +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +select locate('lo','hello',-18446744073709551617); +locate('lo','hello',-18446744073709551617) +0 +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +select locate('lo','hello',18446744073709551617); +locate('lo','hello',18446744073709551617) +0 +Warnings: +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +select left('hello', 10); +left('hello', 10) +hello +select left('hello', 0); +left('hello', 0) + +select left('hello', -1); +left('hello', -1) + +select left('hello', -4294967295); +left('hello', -4294967295) + +select left('hello', 4294967295); +left('hello', 4294967295) +hello +select left('hello', -4294967296); +left('hello', -4294967296) + +select left('hello', 4294967296); +left('hello', 4294967296) +hello +select left('hello', -4294967297); +left('hello', -4294967297) + +select left('hello', 4294967297); +left('hello', 4294967297) +hello +select left('hello', -18446744073709551615); +left('hello', -18446744073709551615) + +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +select left('hello', 18446744073709551615); +left('hello', 18446744073709551615) +hello +select left('hello', -18446744073709551616); +left('hello', -18446744073709551616) + +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +select left('hello', 18446744073709551616); +left('hello', 18446744073709551616) +hello +Warnings: +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +select left('hello', -18446744073709551617); +left('hello', -18446744073709551617) + +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +select left('hello', 18446744073709551617); +left('hello', 18446744073709551617) +hello +Warnings: +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +select right('hello', 10); +right('hello', 10) +hello +select right('hello', 0); +right('hello', 0) + +select right('hello', -1); +right('hello', -1) + +select right('hello', -4294967295); +right('hello', -4294967295) + +select right('hello', 4294967295); +right('hello', 4294967295) +hello +select right('hello', -4294967296); +right('hello', -4294967296) + +select right('hello', 4294967296); +right('hello', 4294967296) +hello +select right('hello', -4294967297); +right('hello', -4294967297) + +select right('hello', 4294967297); +right('hello', 4294967297) +hello +select right('hello', -18446744073709551615); +right('hello', -18446744073709551615) + +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +select right('hello', 18446744073709551615); +right('hello', 18446744073709551615) +hello +select right('hello', -18446744073709551616); +right('hello', -18446744073709551616) + +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +select right('hello', 18446744073709551616); +right('hello', 18446744073709551616) +hello +Warnings: +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +select right('hello', -18446744073709551617); +right('hello', -18446744073709551617) + +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +select right('hello', 18446744073709551617); +right('hello', 18446744073709551617) +hello +Warnings: +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +select substring('hello', 2, -1); +substring('hello', 2, -1) + +select substring('hello', -1, 1); +substring('hello', -1, 1) +o +select substring('hello', -2, 1); +substring('hello', -2, 1) +l +select substring('hello', -4294967295, 1); +substring('hello', -4294967295, 1) + +select substring('hello', 4294967295, 1); +substring('hello', 4294967295, 1) + +select substring('hello', -4294967296, 1); +substring('hello', -4294967296, 1) + +select substring('hello', 4294967296, 1); +substring('hello', 4294967296, 1) + +select substring('hello', -4294967297, 1); +substring('hello', -4294967297, 1) + +select substring('hello', 4294967297, 1); +substring('hello', 4294967297, 1) + +select substring('hello', -18446744073709551615, 1); +substring('hello', -18446744073709551615, 1) + +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +select substring('hello', 18446744073709551615, 1); +substring('hello', 18446744073709551615, 1) + +select substring('hello', -18446744073709551616, 1); +substring('hello', -18446744073709551616, 1) + +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +select substring('hello', 18446744073709551616, 1); +substring('hello', 18446744073709551616, 1) + +Warnings: +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +select substring('hello', -18446744073709551617, 1); +substring('hello', -18446744073709551617, 1) + +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +select substring('hello', 18446744073709551617, 1); +substring('hello', 18446744073709551617, 1) + +Warnings: +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +select substring('hello', 1, -1); +substring('hello', 1, -1) + +select substring('hello', 1, -4294967295); +substring('hello', 1, -4294967295) + +select substring('hello', 1, 4294967295); +substring('hello', 1, 4294967295) +hello +select substring('hello', 1, -4294967296); +substring('hello', 1, -4294967296) + +select substring('hello', 1, 4294967296); +substring('hello', 1, 4294967296) +hello +select substring('hello', 1, -4294967297); +substring('hello', 1, -4294967297) + +select substring('hello', 1, 4294967297); +substring('hello', 1, 4294967297) +hello +select substring('hello', 1, -18446744073709551615); +substring('hello', 1, -18446744073709551615) + +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +select substring('hello', 1, 18446744073709551615); +substring('hello', 1, 18446744073709551615) +hello +select substring('hello', 1, -18446744073709551616); +substring('hello', 1, -18446744073709551616) + +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +select substring('hello', 1, 18446744073709551616); +substring('hello', 1, 18446744073709551616) +hello +Warnings: +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +select substring('hello', 1, -18446744073709551617); +substring('hello', 1, -18446744073709551617) + +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +select substring('hello', 1, 18446744073709551617); +substring('hello', 1, 18446744073709551617) +hello +Warnings: +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +select substring('hello', -1, -1); +substring('hello', -1, -1) + +select substring('hello', -4294967295, -4294967295); +substring('hello', -4294967295, -4294967295) + +select substring('hello', 4294967295, 4294967295); +substring('hello', 4294967295, 4294967295) + +select substring('hello', -4294967296, -4294967296); +substring('hello', -4294967296, -4294967296) + +select substring('hello', 4294967296, 4294967296); +substring('hello', 4294967296, 4294967296) + +select substring('hello', -4294967297, -4294967297); +substring('hello', -4294967297, -4294967297) + +select substring('hello', 4294967297, 4294967297); +substring('hello', 4294967297, 4294967297) + +select substring('hello', -18446744073709551615, -18446744073709551615); +substring('hello', -18446744073709551615, -18446744073709551615) + +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +select substring('hello', 18446744073709551615, 18446744073709551615); +substring('hello', 18446744073709551615, 18446744073709551615) + +select substring('hello', -18446744073709551616, -18446744073709551616); +substring('hello', -18446744073709551616, -18446744073709551616) + +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +select substring('hello', 18446744073709551616, 18446744073709551616); +substring('hello', 18446744073709551616, 18446744073709551616) + +Warnings: +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +select substring('hello', -18446744073709551617, -18446744073709551617); +substring('hello', -18446744073709551617, -18446744073709551617) + +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +select substring('hello', 18446744073709551617, 18446744073709551617); +substring('hello', 18446744073709551617, 18446744073709551617) + +Warnings: +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +select insert('hello', -1, 1, 'hi'); +insert('hello', -1, 1, 'hi') +hello +select insert('hello', -4294967295, 1, 'hi'); +insert('hello', -4294967295, 1, 'hi') +hello +select insert('hello', 4294967295, 1, 'hi'); +insert('hello', 4294967295, 1, 'hi') +hello +select insert('hello', -4294967296, 1, 'hi'); +insert('hello', -4294967296, 1, 'hi') +hello +select insert('hello', 4294967296, 1, 'hi'); +insert('hello', 4294967296, 1, 'hi') +hello +select insert('hello', -4294967297, 1, 'hi'); +insert('hello', -4294967297, 1, 'hi') +hello +select insert('hello', 4294967297, 1, 'hi'); +insert('hello', 4294967297, 1, 'hi') +hello +select insert('hello', -18446744073709551615, 1, 'hi'); +insert('hello', -18446744073709551615, 1, 'hi') +hello +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +select insert('hello', 18446744073709551615, 1, 'hi'); +insert('hello', 18446744073709551615, 1, 'hi') +hello +select insert('hello', -18446744073709551616, 1, 'hi'); +insert('hello', -18446744073709551616, 1, 'hi') +hello +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +select insert('hello', 18446744073709551616, 1, 'hi'); +insert('hello', 18446744073709551616, 1, 'hi') +hello +Warnings: +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +select insert('hello', -18446744073709551617, 1, 'hi'); +insert('hello', -18446744073709551617, 1, 'hi') +hello +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +select insert('hello', 18446744073709551617, 1, 'hi'); +insert('hello', 18446744073709551617, 1, 'hi') +hello +Warnings: +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +select insert('hello', 1, -1, 'hi'); +insert('hello', 1, -1, 'hi') +hi +select insert('hello', 1, -4294967295, 'hi'); +insert('hello', 1, -4294967295, 'hi') +hi +select insert('hello', 1, 4294967295, 'hi'); +insert('hello', 1, 4294967295, 'hi') +hi +select insert('hello', 1, -4294967296, 'hi'); +insert('hello', 1, -4294967296, 'hi') +hi +select insert('hello', 1, 4294967296, 'hi'); +insert('hello', 1, 4294967296, 'hi') +hi +select insert('hello', 1, -4294967297, 'hi'); +insert('hello', 1, -4294967297, 'hi') +hi +select insert('hello', 1, 4294967297, 'hi'); +insert('hello', 1, 4294967297, 'hi') +hi +select insert('hello', 1, -18446744073709551615, 'hi'); +insert('hello', 1, -18446744073709551615, 'hi') +hi +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +select insert('hello', 1, 18446744073709551615, 'hi'); +insert('hello', 1, 18446744073709551615, 'hi') +hi +select insert('hello', 1, -18446744073709551616, 'hi'); +insert('hello', 1, -18446744073709551616, 'hi') +hi +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +select insert('hello', 1, 18446744073709551616, 'hi'); +insert('hello', 1, 18446744073709551616, 'hi') +hi +Warnings: +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +select insert('hello', 1, -18446744073709551617, 'hi'); +insert('hello', 1, -18446744073709551617, 'hi') +hi +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +select insert('hello', 1, 18446744073709551617, 'hi'); +insert('hello', 1, 18446744073709551617, 'hi') +hi +Warnings: +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +select insert('hello', -1, -1, 'hi'); +insert('hello', -1, -1, 'hi') +hello +select insert('hello', -4294967295, -4294967295, 'hi'); +insert('hello', -4294967295, -4294967295, 'hi') +hello +select insert('hello', 4294967295, 4294967295, 'hi'); +insert('hello', 4294967295, 4294967295, 'hi') +hello +select insert('hello', -4294967296, -4294967296, 'hi'); +insert('hello', -4294967296, -4294967296, 'hi') +hello +select insert('hello', 4294967296, 4294967296, 'hi'); +insert('hello', 4294967296, 4294967296, 'hi') +hello +select insert('hello', -4294967297, -4294967297, 'hi'); +insert('hello', -4294967297, -4294967297, 'hi') +hello +select insert('hello', 4294967297, 4294967297, 'hi'); +insert('hello', 4294967297, 4294967297, 'hi') +hello +select insert('hello', -18446744073709551615, -18446744073709551615, 'hi'); +insert('hello', -18446744073709551615, -18446744073709551615, 'hi') +hello +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +select insert('hello', 18446744073709551615, 18446744073709551615, 'hi'); +insert('hello', 18446744073709551615, 18446744073709551615, 'hi') +hello +select insert('hello', -18446744073709551616, -18446744073709551616, 'hi'); +insert('hello', -18446744073709551616, -18446744073709551616, 'hi') +hello +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +select insert('hello', 18446744073709551616, 18446744073709551616, 'hi'); +insert('hello', 18446744073709551616, 18446744073709551616, 'hi') +hello +Warnings: +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +select insert('hello', -18446744073709551617, -18446744073709551617, 'hi'); +insert('hello', -18446744073709551617, -18446744073709551617, 'hi') +hello +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +select insert('hello', 18446744073709551617, 18446744073709551617, 'hi'); +insert('hello', 18446744073709551617, 18446744073709551617, 'hi') +hello +Warnings: +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +select repeat('hello', -1); +repeat('hello', -1) + +select repeat('hello', -4294967295); +repeat('hello', -4294967295) + +select repeat('hello', 4294967295); +repeat('hello', 4294967295) +NULL +Warnings: +Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated +select repeat('hello', -4294967296); +repeat('hello', -4294967296) + +select repeat('hello', 4294967296); +repeat('hello', 4294967296) +NULL +Warnings: +Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated +select repeat('hello', -4294967297); +repeat('hello', -4294967297) + +select repeat('hello', 4294967297); +repeat('hello', 4294967297) +NULL +Warnings: +Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated +select repeat('hello', -18446744073709551615); +repeat('hello', -18446744073709551615) + +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +select repeat('hello', 18446744073709551615); +repeat('hello', 18446744073709551615) +NULL +Warnings: +Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated +select repeat('hello', -18446744073709551616); +repeat('hello', -18446744073709551616) + +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +select repeat('hello', 18446744073709551616); +repeat('hello', 18446744073709551616) +NULL +Warnings: +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated +select repeat('hello', -18446744073709551617); +repeat('hello', -18446744073709551617) + +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +select repeat('hello', 18446744073709551617); +repeat('hello', 18446744073709551617) +NULL +Warnings: +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated +select space(-1); +space(-1) + +select space(-4294967295); +space(-4294967295) + +select space(4294967295); +space(4294967295) +NULL +Warnings: +Warning 1301 Result of space() was larger than max_allowed_packet (1048576) - truncated +select space(-4294967296); +space(-4294967296) + +select space(4294967296); +space(4294967296) +NULL +Warnings: +Warning 1301 Result of space() was larger than max_allowed_packet (1048576) - truncated +select space(-4294967297); +space(-4294967297) + +select space(4294967297); +space(4294967297) +NULL +Warnings: +Warning 1301 Result of space() was larger than max_allowed_packet (1048576) - truncated +select space(-18446744073709551615); +space(-18446744073709551615) + +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +select space(18446744073709551615); +space(18446744073709551615) +NULL +Warnings: +Warning 1301 Result of space() was larger than max_allowed_packet (1048576) - truncated +select space(-18446744073709551616); +space(-18446744073709551616) + +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +select space(18446744073709551616); +space(18446744073709551616) +NULL +Warnings: +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +Warning 1301 Result of space() was larger than max_allowed_packet (1048576) - truncated +select space(-18446744073709551617); +space(-18446744073709551617) + +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +select space(18446744073709551617); +space(18446744073709551617) +NULL +Warnings: +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +Warning 1301 Result of space() was larger than max_allowed_packet (1048576) - truncated +select rpad('hello', -1, '1'); +rpad('hello', -1, '1') +NULL +select rpad('hello', -4294967295, '1'); +rpad('hello', -4294967295, '1') +NULL +select rpad('hello', 4294967295, '1'); +rpad('hello', 4294967295, '1') +NULL +Warnings: +Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated +select rpad('hello', -4294967296, '1'); +rpad('hello', -4294967296, '1') +NULL +select rpad('hello', 4294967296, '1'); +rpad('hello', 4294967296, '1') +NULL +Warnings: +Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated +select rpad('hello', -4294967297, '1'); +rpad('hello', -4294967297, '1') +NULL +select rpad('hello', 4294967297, '1'); +rpad('hello', 4294967297, '1') +NULL +Warnings: +Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated +select rpad('hello', -18446744073709551615, '1'); +rpad('hello', -18446744073709551615, '1') +NULL +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +select rpad('hello', 18446744073709551615, '1'); +rpad('hello', 18446744073709551615, '1') +NULL +Warnings: +Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated +select rpad('hello', -18446744073709551616, '1'); +rpad('hello', -18446744073709551616, '1') +NULL +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +select rpad('hello', 18446744073709551616, '1'); +rpad('hello', 18446744073709551616, '1') +NULL +Warnings: +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated +select rpad('hello', -18446744073709551617, '1'); +rpad('hello', -18446744073709551617, '1') +NULL +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +select rpad('hello', 18446744073709551617, '1'); +rpad('hello', 18446744073709551617, '1') +NULL +Warnings: +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated +select rpad('hello', -1); +rpad('hello', -1) +NULL +select rpad('hello', -4294967295); +rpad('hello', -4294967295) +NULL +select rpad('hello', 4294967295); +rpad('hello', 4294967295) +NULL +Warnings: +Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated +select rpad('hello', -4294967296); +rpad('hello', -4294967296) +NULL +select rpad('hello', 4294967296); +rpad('hello', 4294967296) +NULL +Warnings: +Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated +select rpad('hello', -4294967297); +rpad('hello', -4294967297) +NULL +select rpad('hello', 4294967297); +rpad('hello', 4294967297) +NULL +Warnings: +Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated +select rpad('hello', -18446744073709551615); +rpad('hello', -18446744073709551615) +NULL +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +select rpad('hello', 18446744073709551615); +rpad('hello', 18446744073709551615) +NULL +Warnings: +Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated +select rpad('hello', -18446744073709551616); +rpad('hello', -18446744073709551616) +NULL +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +select rpad('hello', 18446744073709551616); +rpad('hello', 18446744073709551616) +NULL +Warnings: +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated +select rpad('hello', -18446744073709551617); +rpad('hello', -18446744073709551617) +NULL +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +select rpad('hello', 18446744073709551617); +rpad('hello', 18446744073709551617) +NULL +Warnings: +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated +select rpad('hello', 0, 'x'); +rpad('hello', 0, 'x') + +select rpad('hello', 0); +rpad('hello', 0) + +select lpad('hello', -1, '1'); +lpad('hello', -1, '1') +NULL +select lpad('hello', -4294967295, '1'); +lpad('hello', -4294967295, '1') +NULL +select lpad('hello', 4294967295, '1'); +lpad('hello', 4294967295, '1') +NULL +Warnings: +Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated +select lpad('hello', -4294967296, '1'); +lpad('hello', -4294967296, '1') +NULL +select lpad('hello', 4294967296, '1'); +lpad('hello', 4294967296, '1') +NULL +Warnings: +Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated +select lpad('hello', -4294967297, '1'); +lpad('hello', -4294967297, '1') +NULL +select lpad('hello', 4294967297, '1'); +lpad('hello', 4294967297, '1') +NULL +Warnings: +Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated +select lpad('hello', -18446744073709551615, '1'); +lpad('hello', -18446744073709551615, '1') +NULL +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +select lpad('hello', 18446744073709551615, '1'); +lpad('hello', 18446744073709551615, '1') +NULL +Warnings: +Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated +select lpad('hello', -18446744073709551616, '1'); +lpad('hello', -18446744073709551616, '1') +NULL +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +select lpad('hello', 18446744073709551616, '1'); +lpad('hello', 18446744073709551616, '1') +NULL +Warnings: +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated +select lpad('hello', -18446744073709551617, '1'); +lpad('hello', -18446744073709551617, '1') +NULL +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +select lpad('hello', 18446744073709551617, '1'); +lpad('hello', 18446744073709551617, '1') +NULL +Warnings: +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated +select lpad('hello', -1); +lpad('hello', -1) +NULL +select lpad('hello', -4294967295); +lpad('hello', -4294967295) +NULL +select lpad('hello', 4294967295); +lpad('hello', 4294967295) +NULL +Warnings: +Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated +select lpad('hello', -4294967296); +lpad('hello', -4294967296) +NULL +select lpad('hello', 4294967296); +lpad('hello', 4294967296) +NULL +Warnings: +Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated +select lpad('hello', -4294967297); +lpad('hello', -4294967297) +NULL +select lpad('hello', 4294967297); +lpad('hello', 4294967297) +NULL +Warnings: +Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated +select lpad('hello', -18446744073709551615); +lpad('hello', -18446744073709551615) +NULL +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551615' to INT. Value truncated +select lpad('hello', 18446744073709551615); +lpad('hello', 18446744073709551615) +NULL +Warnings: +Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated +select lpad('hello', -18446744073709551616); +lpad('hello', -18446744073709551616) +NULL +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551616' to INT. Value truncated +select lpad('hello', 18446744073709551616); +lpad('hello', 18446744073709551616) +NULL +Warnings: +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated +Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated +select lpad('hello', -18446744073709551617); +lpad('hello', -18446744073709551617) +NULL +Warnings: +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '-18446744073709551617' to INT. Value truncated +select lpad('hello', 18446744073709551617); +lpad('hello', 18446744073709551617) +NULL +Warnings: +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +Warning 1916 Got overflow when converting '18446744073709551617' to INT. Value truncated +Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated +select lpad('hello', 0, 'x'); +lpad('hello', 0, 'x') + +select lpad('hello', 0); +lpad('hello', 0) + +Check parameters count rpad / lpad +select rpad('x'); +ERROR 42000: Incorrect parameter count in the call to native function 'rpad' +select rpad('x',2,'.','z'); +ERROR 42000: Incorrect parameter count in the call to native function 'rpad' +select lpad('x'); +ERROR 42000: Incorrect parameter count in the call to native function 'lpad' +select lpad('x',2,'.','z'); +ERROR 42000: Incorrect parameter count in the call to native function 'lpad' +SET @orig_sql_mode = @@SQL_MODE; +SET SQL_MODE=traditional; +SELECT CHAR(0xff,0x8f USING utf8); +CHAR(0xff,0x8f USING utf8) +NULL +Warnings: +Warning 1300 Invalid utf8 character string: 'FF8F' +SELECT CHAR(0xff,0x8f USING utf8) IS NULL; +CHAR(0xff,0x8f USING utf8) IS NULL +1 +Warnings: +Warning 1300 Invalid utf8 character string: 'FF8F' +SET SQL_MODE=@orig_sql_mode; +select substring('abc', cast(2 as unsigned int)); +substring('abc', cast(2 as unsigned int)) +bc +select repeat('a', cast(2 as unsigned int)); +repeat('a', cast(2 as unsigned int)) +aa +select rpad('abc', cast(5 as unsigned integer), 'x'); +rpad('abc', cast(5 as unsigned integer), 'x') +abcxx +select lpad('abc', cast(5 as unsigned integer), 'x'); +lpad('abc', cast(5 as unsigned integer), 'x') +xxabc +select rpad('abc', cast(5 as unsigned integer)); +rpad('abc', cast(5 as unsigned integer)) +abc +select lpad('abc', cast(5 as unsigned integer)); +lpad('abc', cast(5 as unsigned integer)) + abc +create table t1(f1 longtext); +insert into t1 values ("123"),("456"); +select substring(f1,1,1) from t1 group by 1; +substring(f1,1,1) +1 +4 +create table t2(f1 varchar(3)); +insert into t1 values ("123"),("456"); +select substring(f1,4,1), substring(f1,-4,1) from t2; +substring(f1,4,1) substring(f1,-4,1) +drop table t1,t2; +DROP TABLE IF EXISTS t1; +CREATE TABLE `t1` ( +`id` varchar(20) NOT NULL, +`tire` tinyint(3) unsigned NOT NULL, +PRIMARY KEY (`id`) +); +INSERT INTO `t1` (`id`, `tire`) VALUES ('A', 0), ('B', 1),('C', 2); +SELECT REPEAT( '#', tire ) AS A, +REPEAT( '#', tire % 999 ) AS B, tire FROM `t1`; +A B tire + 0 +# # 1 +## ## 2 +SELECT REPEAT('0', CAST(0 AS UNSIGNED)); +REPEAT('0', CAST(0 AS UNSIGNED)) + +SELECT REPEAT('0', -2); +REPEAT('0', -2) + +SELECT REPEAT('0', 2); +REPEAT('0', 2) +00 +DROP TABLE t1; +SELECT UNHEX('G'); +UNHEX('G') +NULL +SELECT UNHEX('G') IS NULL; +UNHEX('G') IS NULL +1 +SELECT INSERT('abc', 3, 3, '1234'); +INSERT('abc', 3, 3, '1234') +ab1234 +SELECT INSERT('abc', 4, 3, '1234'); +INSERT('abc', 4, 3, '1234') +abc +SELECT INSERT('abc', 5, 3, '1234'); +INSERT('abc', 5, 3, '1234') +abc +SELECT INSERT('abc', 6, 3, '1234'); +INSERT('abc', 6, 3, '1234') +abc +CREATE TABLE t1 (a INT); +CREATE VIEW v1 AS SELECT CRC32(a) AS C FROM t1; +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +SELECT CRC32(a), COUNT(*) FROM t1 GROUP BY 1; +CRC32(a) COUNT(*) +450215437 1 +498629140 1 +1790921346 1 +1842515611 1 +2212294583 1 +2226203566 1 +2366072709 1 +2707236321 1 +4088798008 1 +4194326291 1 +SELECT CRC32(a), COUNT(*) FROM t1 GROUP BY 1 ORDER BY 1; +CRC32(a) COUNT(*) +450215437 1 +498629140 1 +1790921346 1 +1842515611 1 +2212294583 1 +2226203566 1 +2366072709 1 +2707236321 1 +4088798008 1 +4194326291 1 +SELECT * FROM (SELECT CRC32(a) FROM t1) t2; +CRC32(a) +2212294583 +450215437 +1842515611 +4088798008 +2226203566 +498629140 +1790921346 +4194326291 +2366072709 +2707236321 +CREATE TABLE t2 SELECT CRC32(a) FROM t1; +desc t2; +Field Type Null Key Default Extra +CRC32(a) int(10) unsigned YES NULL +SELECT * FROM v1; +C +2212294583 +450215437 +1842515611 +4088798008 +2226203566 +498629140 +1790921346 +4194326291 +2366072709 +2707236321 +SELECT * FROM (SELECT * FROM v1) x; +C +2212294583 +450215437 +1842515611 +4088798008 +2226203566 +498629140 +1790921346 +4194326291 +2366072709 +2707236321 +DROP TABLE t1, t2; +DROP VIEW v1; +SELECT LOCATE('foo', NULL) FROM DUAL; +LOCATE('foo', NULL) +NULL +SELECT LOCATE(NULL, 'o') FROM DUAL; +LOCATE(NULL, 'o') +NULL +SELECT LOCATE(NULL, NULL) FROM DUAL; +LOCATE(NULL, NULL) +NULL +SELECT LOCATE('foo', NULL) IS NULL FROM DUAL; +LOCATE('foo', NULL) IS NULL +1 +SELECT LOCATE(NULL, 'o') IS NULL FROM DUAL; +LOCATE(NULL, 'o') IS NULL +1 +SELECT LOCATE(NULL, NULL) IS NULL FROM DUAL; +LOCATE(NULL, NULL) IS NULL +1 +SELECT ISNULL(LOCATE('foo', NULL)) FROM DUAL; +ISNULL(LOCATE('foo', NULL)) +1 +SELECT ISNULL(LOCATE(NULL, 'o')) FROM DUAL; +ISNULL(LOCATE(NULL, 'o')) +1 +SELECT ISNULL(LOCATE(NULL, NULL)) FROM DUAL; +ISNULL(LOCATE(NULL, NULL)) +1 +SELECT LOCATE('foo', NULL) <=> NULL FROM DUAL; +LOCATE('foo', NULL) <=> NULL +1 +SELECT LOCATE(NULL, 'o') <=> NULL FROM DUAL; +LOCATE(NULL, 'o') <=> NULL +1 +SELECT LOCATE(NULL, NULL) <=> NULL FROM DUAL; +LOCATE(NULL, NULL) <=> NULL +1 +CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a varchar(10), p varchar(10)); +INSERT INTO t1 VALUES (1, 'foo', 'o'); +INSERT INTO t1 VALUES (2, 'foo', NULL); +INSERT INTO t1 VALUES (3, NULL, 'o'); +INSERT INTO t1 VALUES (4, NULL, NULL); +SELECT id, LOCATE(a,p) FROM t1; +id LOCATE(a,p) +1 0 +2 NULL +3 NULL +4 NULL +SELECT id, LOCATE(a,p) IS NULL FROM t1; +id LOCATE(a,p) IS NULL +1 0 +2 1 +3 1 +4 1 +SELECT id, ISNULL(LOCATE(a,p)) FROM t1; +id ISNULL(LOCATE(a,p)) +1 0 +2 1 +3 1 +4 1 +SELECT id, LOCATE(a,p) <=> NULL FROM t1; +id LOCATE(a,p) <=> NULL +1 0 +2 1 +3 1 +4 1 +SELECT id FROM t1 WHERE LOCATE(a,p) IS NULL; +id +2 +3 +4 +SELECT id FROM t1 WHERE LOCATE(a,p) <=> NULL; +id +2 +3 +4 +DROP TABLE t1; +SELECT SUBSTR('foo',1,0) FROM DUAL; +SUBSTR('foo',1,0) + +SELECT SUBSTR('foo',1,CAST(0 AS SIGNED)) FROM DUAL; +SUBSTR('foo',1,CAST(0 AS SIGNED)) + +SELECT SUBSTR('foo',1,CAST(0 AS UNSIGNED)) FROM DUAL; +SUBSTR('foo',1,CAST(0 AS UNSIGNED)) + +CREATE TABLE t1 (a varchar(10), len int unsigned); +INSERT INTO t1 VALUES ('bar', 2), ('foo', 0); +SELECT SUBSTR(a,1,len) FROM t1; +SUBSTR(a,1,len) +ba + +DROP TABLE t1; +CREATE TABLE t1 AS SELECT CHAR(0x414243) as c1; +SELECT HEX(c1) from t1; +HEX(c1) +414243 +DROP TABLE t1; +CREATE VIEW v1 AS SELECT CHAR(0x414243) as c1; +SELECT HEX(c1) from v1; +HEX(c1) +414243 +DROP VIEW v1; +create table t1(a float); +insert into t1 values (1.33); +select format(a, 2) from t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def format(a, 2) 253 57 4 Y 0 39 8 +format(a, 2) +1.33 +drop table t1; +CREATE TABLE t1 (c DATE, aa VARCHAR(30)); +INSERT INTO t1 VALUES ('2008-12-31','aaaaaa'); +SELECT DATE_FORMAT(c, GET_FORMAT(DATE, 'eur')) h, CONCAT(UPPER(aa),', ', aa) i FROM t1; +h i +31.12.2008 AAAAAA, aaaaaa +DROP TABLE t1; +# +# BUG#44774: load_file function produces valgrind warnings +# +CREATE TABLE t1 (a TINYBLOB); +INSERT INTO t1 VALUES ('aaaaaaaa'); +SELECT LOAD_FILE(a) FROM t1; +LOAD_FILE(a) +NULL +DROP TABLE t1; +CREATE TABLE t1 (f2 VARCHAR(20)); +CREATE TABLE t2 (f2 VARCHAR(20)); +INSERT INTO t1 VALUES ('MIN'),('MAX'); +INSERT INTO t2 VALUES ('LOAD'); +SELECT CONCAT_WS('_', (SELECT t2.f2 FROM t2), t1.f2) AS concat_name FROM t1; +concat_name +LOAD_MIN +LOAD_MAX +DROP TABLE t1, t2; +End of 5.0 tests +drop table if exists t1; +create table t1(f1 tinyint default null)engine=myisam; +insert into t1 values (-1),(null); +set @tmp_optimizer_switch=@@optimizer_switch; +set optimizer_switch='derived_merge=off,derived_with_keys=off'; +explain select 1 as a from t1,(select decode(f1,f1) as b from t1) a; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 2 +explain select 1 as a from t1,(select encode(f1,f1) as b from t1) a; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 2 +set optimizer_switch=@tmp_optimizer_switch; +drop table t1; +# +# Bug#49141: Encode function is significantly slower in 5.1 compared to 5.0 +# +DROP TABLE IF EXISTS t1, t2; +CREATE TABLE t1 (a VARCHAR(20), b INT); +CREATE TABLE t2 (a VARCHAR(20), b INT); +INSERT INTO t1 VALUES ('ABC', 1); +INSERT INTO t2 VALUES ('ABC', 1); +SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a) +FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b; +DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a) +secret +SELECT DECODE((SELECT ENCODE('secret', 'ABC') FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a) +FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b; +DECODE((SELECT ENCODE('secret', 'ABC') FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a) +secret +SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), 'ABC') +FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b; +DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), 'ABC') +secret +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; +INSERT INTO t1 VALUES ('EDF', 3), ('BCD', 2), ('ABC', 1); +INSERT INTO t2 VALUES ('EDF', 3), ('BCD', 2), ('ABC', 1); +SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b LIMIT 1), t2.a) +FROM t2 WHERE t2.b = 1 GROUP BY t2.b; +DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b LIMIT 1), t2.a) +secret +DROP TABLE t1, t2; +# +# Bug#52164 Assertion failed: param.sort_length, file .\filesort.cc, line 149 +# +CREATE TABLE t1 (a LONGBLOB NOT NULL); +INSERT INTO t1 VALUES (''),(''); +SELECT 1 FROM t1, t1 t2 +ORDER BY QUOTE(t1.a); +1 +1 +1 +1 +1 +DROP TABLE t1; +# +# Bug#57913 large negative number to string conversion functions crash +# Bug#57810 case/when/then : Assertion failed: length || !scale +# +SELECT '1' IN ('1', SUBSTRING(-9223372036854775809, 1)); +'1' IN ('1', SUBSTRING(-9223372036854775809, 1)) +1 +SELECT CONVERT(('' IN (REVERSE(CAST(('') AS DECIMAL)), '')), CHAR(3)); +CONVERT(('' IN (REVERSE(CAST(('') AS DECIMAL)), '')), CHAR(3)) +1 +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: '' +# +# Bug#58165: "my_empty_string" gets modified and causes LOAD DATA to fail +# and other crashes +# +CREATE TABLE t1 ( a TEXT ); +SELECT 'aaaaaaaaaaaaaa' INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug58165.txt';; +SELECT insert( substring_index( 'a', 'a', 'b' ), 1, 0, 'x' ); +insert( substring_index( 'a', 'a', 'b' ), 1, 0, 'x' ) + +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'b' +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug58165.txt' INTO TABLE t1;; +SELECT * FROM t1; +a +aaaaaaaaaaaaaa +DROP TABLE t1; +SELECT SUBSTRING('1', DAY(FROM_UNIXTIME(-1))); +SUBSTRING('1', DAY(FROM_UNIXTIME(-1))) +NULL +SELECT LEFT('1', DAY(FROM_UNIXTIME(-1))); +LEFT('1', DAY(FROM_UNIXTIME(-1))) +NULL +SELECT RIGHT('1', DAY(FROM_UNIXTIME(-1))); +RIGHT('1', DAY(FROM_UNIXTIME(-1))) +NULL +SELECT REPEAT('1', DAY(FROM_UNIXTIME(-1))); +REPEAT('1', DAY(FROM_UNIXTIME(-1))) +NULL +SELECT RPAD('hi', DAY(FROM_UNIXTIME(-1)),'?'); +RPAD('hi', DAY(FROM_UNIXTIME(-1)),'?') +NULL +SELECT LPAD('hi', DAY(FROM_UNIXTIME(-1)),'?'); +LPAD('hi', DAY(FROM_UNIXTIME(-1)),'?') +NULL +SELECT RPAD('hi', DAY(FROM_UNIXTIME(-1))); +RPAD('hi', DAY(FROM_UNIXTIME(-1))) +NULL +SELECT LPAD('hi', DAY(FROM_UNIXTIME(-1))); +LPAD('hi', DAY(FROM_UNIXTIME(-1))) +NULL +create table t1 (i int); +insert into t1 values (null),(8); +select group_concat( i ), make_set( i, 'a', 'b' ) field from t1 group by field; +group_concat( i ) field +NULL NULL +8 +drop table t1; +# +# Bug#11766684 59851: UNINITIALISED VALUE IN ITEM_FUNC_LIKE::SELECT_OPTIMIZE WITH SUBQUERY AND +# +CREATE TABLE t2(a INT, KEY(a)); +INSERT INTO t2 VALUES (1),(2); +CREATE TABLE t1(b INT, PRIMARY KEY(b)); +INSERT INTO t1 VALUES (0),(254); +SELECT 1 FROM t2 WHERE a LIKE +(SELECT EXPORT_SET(1, b, b, b, b) FROM t1 LIMIT 1); +1 +DROP TABLE t1, t2; +End of 5.1 tests +# +# Start of 5.3 tests +# +# +# Bug#11829861: SUBSTRING_INDEX() RESULTS IN MISSING CHARACTERS WHEN USED +# INSIDE LOWER() +# +SET @user_at_host = 'root@mytinyhost-PC.local'; +SELECT LOWER(SUBSTRING_INDEX(@user_at_host, '@', -1)); +LOWER(SUBSTRING_INDEX(@user_at_host, '@', -1)) +mytinyhost-pc.local +# End of test BUG#11829861 +# +# Bug#42404: SUBSTRING_INDEX() RESULTS ARE INCONSISTENT +# +CREATE TABLE t (i INT NOT NULL, c CHAR(255) NOT NULL); +INSERT INTO t VALUES (0,'.www.mysql.com'),(1,'.wwwmysqlcom'); +SELECT i, SUBSTRING_INDEX(c, '.', -2) FROM t WHERE i = 1; +i SUBSTRING_INDEX(c, '.', -2) +1 .wwwmysqlcom +SELECT i, SUBSTRING_INDEX(c, '.', -2) FROM t; +i SUBSTRING_INDEX(c, '.', -2) +0 mysql.com +1 .wwwmysqlcom +DROP TABLE t; +# End of test BUG#42404 +# +# End of 5.3 tests +# +Start of 5.4 tests +SELECT format(12345678901234567890.123, 3); +format(12345678901234567890.123, 3) +12,345,678,901,234,567,890.123 +SELECT format(12345678901234567890.123, 3, NULL); +format(12345678901234567890.123, 3, NULL) +12,345,678,901,234,567,890.123 +Warnings: +Warning 1649 Unknown locale: 'NULL' +SELECT format(12345678901234567890.123, 3, 'ar_AE'); +format(12345678901234567890.123, 3, 'ar_AE') +12,345,678,901,234,567,890.123 +SELECT format(12345678901234567890.123, 3, 'ar_SA'); +format(12345678901234567890.123, 3, 'ar_SA') +12345678901234567890.123 +SELECT format(12345678901234567890.123, 3, 'be_BY'); +format(12345678901234567890.123, 3, 'be_BY') +12.345.678.901.234.567.890,123 +SELECT format(12345678901234567890.123, 3, 'de_DE'); +format(12345678901234567890.123, 3, 'de_DE') +12.345.678.901.234.567.890,123 +SELECT format(12345678901234567890.123, 3, 'en_IN'); +format(12345678901234567890.123, 3, 'en_IN') +1,23,45,67,89,01,23,45,67,890.123 +SELECT format(12345678901234567890.123, 3, 'en_US'); +format(12345678901234567890.123, 3, 'en_US') +12,345,678,901,234,567,890.123 +SELECT format(12345678901234567890.123, 3, 'it_CH'); +format(12345678901234567890.123, 3, 'it_CH') +12'345'678'901'234'567'890,123 +SELECT format(12345678901234567890.123, 3, 'ru_RU'); +format(12345678901234567890.123, 3, 'ru_RU') +12 345 678 901 234 567 890,123 +SELECT format(12345678901234567890.123, 3, 'ta_IN'); +format(12345678901234567890.123, 3, 'ta_IN') +1,23,45,67,89,01,23,45,67,890.123 +CREATE TABLE t1 (fmt CHAR(5) NOT NULL); +INSERT INTO t1 VALUES ('ar_AE'); +INSERT INTO t1 VALUES ('ar_SA'); +INSERT INTO t1 VALUES ('be_BY'); +INSERT INTO t1 VALUES ('de_DE'); +INSERT INTO t1 VALUES ('en_IN'); +INSERT INTO t1 VALUES ('en_US'); +INSERT INTO t1 VALUES ('it_CH'); +INSERT INTO t1 VALUES ('ru_RU'); +INSERT INTO t1 VALUES ('ta_IN'); +SELECT fmt, format(12345678901234567890.123, 3, fmt) FROM t1 ORDER BY fmt; +fmt format(12345678901234567890.123, 3, fmt) +ar_AE 12,345,678,901,234,567,890.123 +ar_SA 12345678901234567890.123 +be_BY 12.345.678.901.234.567.890,123 +de_DE 12.345.678.901.234.567.890,123 +en_IN 1,23,45,67,89,01,23,45,67,890.123 +en_US 12,345,678,901,234,567,890.123 +it_CH 12'345'678'901'234'567'890,123 +ru_RU 12 345 678 901 234 567 890,123 +ta_IN 1,23,45,67,89,01,23,45,67,890.123 +SELECT fmt, format(12345678901234567890.123, 0, fmt) FROM t1 ORDER BY fmt; +fmt format(12345678901234567890.123, 0, fmt) +ar_AE 12,345,678,901,234,567,890 +ar_SA 12345678901234567890 +be_BY 12.345.678.901.234.567.890 +de_DE 12.345.678.901.234.567.890 +en_IN 1,23,45,67,89,01,23,45,67,890 +en_US 12,345,678,901,234,567,890 +it_CH 12'345'678'901'234'567'890 +ru_RU 12 345 678 901 234 567 890 +ta_IN 1,23,45,67,89,01,23,45,67,890 +SELECT fmt, format(12345678901234567890, 3, fmt) FROM t1 ORDER BY fmt; +fmt format(12345678901234567890, 3, fmt) +ar_AE 12,345,678,901,234,567,890.000 +ar_SA 12345678901234567890.000 +be_BY 12.345.678.901.234.567.890,000 +de_DE 12.345.678.901.234.567.890,000 +en_IN 1,23,45,67,89,01,23,45,67,890.000 +en_US 12,345,678,901,234,567,890.000 +it_CH 12'345'678'901'234'567'890,000 +ru_RU 12 345 678 901 234 567 890,000 +ta_IN 1,23,45,67,89,01,23,45,67,890.000 +SELECT fmt, format(-12345678901234567890, 3, fmt) FROM t1 ORDER BY fmt; +fmt format(-12345678901234567890, 3, fmt) +ar_AE -12,345,678,901,234,567,890.000 +ar_SA -12345678901234567890.000 +be_BY -12.345.678.901.234.567.890,000 +de_DE -12.345.678.901.234.567.890,000 +en_IN -1,23,45,67,89,01,23,45,67,890.000 +en_US -12,345,678,901,234,567,890.000 +it_CH -12'345'678'901'234'567'890,000 +ru_RU -12 345 678 901 234 567 890,000 +ta_IN -1,23,45,67,89,01,23,45,67,890.000 +SELECT fmt, format(-02345678901234567890, 3, fmt) FROM t1 ORDER BY fmt; +fmt format(-02345678901234567890, 3, fmt) +ar_AE -2,345,678,901,234,567,890.000 +ar_SA -2345678901234567890.000 +be_BY -2.345.678.901.234.567.890,000 +de_DE -2.345.678.901.234.567.890,000 +en_IN -23,45,67,89,01,23,45,67,890.000 +en_US -2,345,678,901,234,567,890.000 +it_CH -2'345'678'901'234'567'890,000 +ru_RU -2 345 678 901 234 567 890,000 +ta_IN -23,45,67,89,01,23,45,67,890.000 +SELECT fmt, format(-00345678901234567890, 3, fmt) FROM t1 ORDER BY fmt; +fmt format(-00345678901234567890, 3, fmt) +ar_AE -345,678,901,234,567,890.000 +ar_SA -345678901234567890.000 +be_BY -345.678.901.234.567.890,000 +de_DE -345.678.901.234.567.890,000 +en_IN -3,45,67,89,01,23,45,67,890.000 +en_US -345,678,901,234,567,890.000 +it_CH -345'678'901'234'567'890,000 +ru_RU -345 678 901 234 567 890,000 +ta_IN -3,45,67,89,01,23,45,67,890.000 +SELECT fmt, format(-00045678901234567890, 3, fmt) FROM t1 ORDER BY fmt; +fmt format(-00045678901234567890, 3, fmt) +ar_AE -45,678,901,234,567,890.000 +ar_SA -45678901234567890.000 +be_BY -45.678.901.234.567.890,000 +de_DE -45.678.901.234.567.890,000 +en_IN -45,67,89,01,23,45,67,890.000 +en_US -45,678,901,234,567,890.000 +it_CH -45'678'901'234'567'890,000 +ru_RU -45 678 901 234 567 890,000 +ta_IN -45,67,89,01,23,45,67,890.000 +DROP TABLE t1; +SELECT format(123, 1, 'Non-existent-locale'); +format(123, 1, 'Non-existent-locale') +123.0 +Warnings: +Warning 1649 Unknown locale: 'Non-existent-locale' +End of 5.4 tests +# +# Start of 5.5 tests +# +# +# Bug#55912 FORMAT with locale set fails for numbers < 1000 +# +SELECT FORMAT(123.33, 2, 'no_NO'), FORMAT(1123.33, 2, 'no_NO'); +FORMAT(123.33, 2, 'no_NO') FORMAT(1123.33, 2, 'no_NO') +123,33 1.123,33 +SELECT FORMAT(12333e-2, 2, 'no_NO'), FORMAT(112333e-2, 2, 'no_NO'); +FORMAT(12333e-2, 2, 'no_NO') FORMAT(112333e-2, 2, 'no_NO') +123,33 1.123,33 +CREATE TABLE t1 AS SELECT format(123,2,'no_NO'); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `format(123,2,'no_NO')` varchar(45) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT * FROM t1; +format(123,2,'no_NO') +123,00 +DROP TABLE t1; +# +# Bug#11764310 conv function crashes, negative argument to memcpy +# +SELECT CONV(1,-2147483648,-2147483648); +CONV(1,-2147483648,-2147483648) +NULL +# +# Bug#12985030 SIMPLE QUERY WITH DECIMAL NUMBERS LEAKS MEMORY +# +SELECT (rpad(1.0,2048,1)) IS NOT FALSE; +(rpad(1.0,2048,1)) IS NOT FALSE +1 +SELECT ((+0) IN +((0b111111111111111111111111111111111111111111111111111),(rpad(1.0,2048,1)), +(32767.1))); +((+0) IN +((0b111111111111111111111111111111111111111111111111111),(rpad(1.0,2048,1)), +(32767.1))) +0 +SELECT ((rpad(1.0,2048,1)) = ('4(') ^ (0.1)); +((rpad(1.0,2048,1)) = ('4(') ^ (0.1)) +0 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '4(' +SELECT +pow((rpad(10.0,2048,1)),(b'1111111111111111111111111111111111111111111')); +ERROR 22003: DOUBLE value is out of range in 'pow(rpad(10.0,2048,1),0x07ffffffffff)' +SELECT ((rpad(1.0,2048,1)) + (0) ^ ('../')); +((rpad(1.0,2048,1)) + (0) ^ ('../')) +1.011111111111111 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '../' +SELECT stddev_samp(rpad(1.0,2048,1)); +stddev_samp(rpad(1.0,2048,1)) +NULL +SELECT ((127.1) not in ((rpad(1.0,2048,1)),(''),(-1.1))); +((127.1) not in ((rpad(1.0,2048,1)),(''),(-1.1))) +1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '' +SELECT ((0xf3) * (rpad(1.0,2048,1)) << (0xcc)); +((0xf3) * (rpad(1.0,2048,1)) << (0xcc)) +0 +# +# Bug#13359121 LARGE NUMBERS, /STRINGS/DTOA.C:662: +# BALLOC: ASSERTION `K <= 15' FAILED. +# Bug#12985021 SIMPLE QUERY WITH DECIMAL NUMBERS TAKE AN +# EXTRAORDINARY LONG TIME TO EXECUTE +SELECT @tmp_max:= @@global.max_allowed_packet; +@tmp_max:= @@global.max_allowed_packet +1048576 +SET @@global.max_allowed_packet=1024*1024*1024; +connect newconn, localhost, root,,; +SELECT @@global.max_allowed_packet; +@@global.max_allowed_packet +1073741824 +do +format(rpad('111111111.1', +1111111, +'999999999999999999999999999999999999999999'),0,'be_BY') +; +SELECT +round( +concat( ( +coalesce( ( +linefromwkb('2147483648', +-b'1111111111111111111111111111111111111111111')), +( convert('[.DC2.]',decimal(30,30)) ), +bit_count('') +) ), +( lpad( ( elt('01','}:K5')), +sha1('P'), +( ( select '-9223372036854775808.1' > all (select ''))) +) +) +) +) AS r; +ERROR HY000: Illegal parameter data type varchar for operation 'st_geometryfromwkb' +connection conn1; +SET @@global.max_allowed_packet:= @tmp_max; +disconnect newconn; +SELECT @tmp_max:= @@global.max_allowed_packet; +@tmp_max:= @@global.max_allowed_packet +1048576 +SET @@global.max_allowed_packet=1024*1024*1024; +SELECT @@global.max_allowed_packet; +@@global.max_allowed_packet +1073741824 +SELECT CHAR_LENGTH(EXPORT_SET(1,1,1,REPEAT(1,100000000))); +CHAR_LENGTH(EXPORT_SET(1,1,1,REPEAT(1,100000000))) +NULL +Warnings: +Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated +SET @@global.max_allowed_packet:= @tmp_max; +# +# MDEV-4272: DIV operator crashes in Item_func_int_div::val_int +# (incorrect NULL value handling by convert) +# +create table t1(a int) select null; +select 1 div convert(a using utf8) from t1; +1 div convert(a using utf8) +NULL +drop table t1; +create table t1 (a int); +create table t2 (a int); +create procedure foo (var char(100)) +select replace(var, '00000000', table_name) +from information_schema.tables where table_schema='test'; +call foo('(( 00000000 ++ 00000000 ))'); +replace(var, '00000000', table_name) +(( t1 ++ t1 )) +(( t2 ++ t2 )) +drop procedure foo; +drop table t1,t2; +select md5(_filename "a"), sha(_filename "a"); +md5(_filename "a") sha(_filename "a") +0cc175b9c0f1b6a831c399e269772661 86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 +# +# MDEV-18881 Assertion `0' failed in make_sortkey upon SELECT with GROUP BY after LOAD DATA +# +CREATE TABLE t1 (a BIT(22), b CHAR(8) NOT NULL, c CHAR(8)); +INSERT INTO t1 VALUES (0xA4B,'foo','qux'); +INSERT INTO t1 VALUES (0x8F5,'bar','foobar'); +INSERT INTO t1 VALUES (0x0, '', NULL); +INSERT INTO t1 VALUES (0x4B, 'foo','qux'); +INSERT INTO t1 VALUES (0x8F5, 'bar', 'foobar'); +SET SESSION SQL_MODE= ''; +SELECT GROUP_CONCAT(c) AS f FROM t1 GROUP BY LPAD('foo', 20, b); +f +NULL +foobar,foobar +qux,qux +DROP TABLE t1; +SET SESSION SQL_MODE=DEFAULT; +CREATE TABLE t1 AS SELECT +LPAD('a',10,' '), +RPAD('a',10,' '), +LPAD('a',10,' '), +RPAD('a',10,' '), +LPAD('a',10,NULL), +RPAD('a',10,NULL), +LPAD('a',10,''), +RPAD('a',10,''), +LPAD('a',10,RAND()), +RPAD('a',10,RAND()); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `LPAD('a',10,' ')` varchar(10) DEFAULT NULL, + `RPAD('a',10,' ')` varchar(10) DEFAULT NULL, + `LPAD('a',10,' ')` varchar(10) DEFAULT NULL, + `RPAD('a',10,' ')` varchar(10) DEFAULT NULL, + `LPAD('a',10,NULL)` varchar(10) DEFAULT NULL, + `RPAD('a',10,NULL)` varchar(10) DEFAULT NULL, + `LPAD('a',10,'')` varchar(10) DEFAULT NULL, + `RPAD('a',10,'')` varchar(10) DEFAULT NULL, + `LPAD('a',10,RAND())` varchar(10) DEFAULT NULL, + `RPAD('a',10,RAND())` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +SET SESSION SQL_MODE= ''; +CREATE TABLE t1 AS SELECT +LPAD('a',10,' '), +RPAD('a',10,' '), +LPAD('a',10,' '), +RPAD('a',10,' '), +LPAD('a',10,NULL), +RPAD('a',10,NULL), +LPAD('a',10,''), +RPAD('a',10,''), +LPAD('a',10,RAND()), +RPAD('a',10,RAND()); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `LPAD('a',10,' ')` varchar(10) NOT NULL, + `RPAD('a',10,' ')` varchar(10) NOT NULL, + `LPAD('a',10,' ')` varchar(10) NOT NULL, + `RPAD('a',10,' ')` varchar(10) NOT NULL, + `LPAD('a',10,NULL)` varchar(10) DEFAULT NULL, + `RPAD('a',10,NULL)` varchar(10) DEFAULT NULL, + `LPAD('a',10,'')` varchar(10) DEFAULT NULL, + `RPAD('a',10,'')` varchar(10) DEFAULT NULL, + `LPAD('a',10,RAND())` varchar(10) DEFAULT NULL, + `RPAD('a',10,RAND())` varchar(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +SET SESSION SQL_MODE=DEFAULT; +# +# End of 5.5 tests +# +# +# Start of 5.6 tests +# +# +# WL#5510 Functions to_base64 and from_base64 +# +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',63)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(85) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh +YWFhYWFh 85 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(66) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 63 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',62)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(85) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh +YWFhYWE= 85 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(66) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 62 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',61)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(85) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh +YWFhYQ== 85 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(66) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 61 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',60)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(81) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh +YWFh 81 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(63) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 60 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',59)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(81) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh +YWE= 81 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(63) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 59 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',58)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(81) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh +YQ== 81 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(63) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 58 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',57)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(76) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh 76 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(57) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 57 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',56)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(76) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE= 76 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(57) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 56 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',55)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(76) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ== 76 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(57) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 55 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',54)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(72) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh 72 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(54) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 54 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',53)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(72) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE= 72 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(54) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 53 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',52)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(72) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ== 72 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(54) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 52 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',51)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(68) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh 68 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(51) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 51 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',50)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(68) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE= 68 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(51) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 50 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',49)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(68) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ== 68 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(51) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 49 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',48)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh 64 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(48) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 48 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',47)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE= 64 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(48) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 47 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',46)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ== 64 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(48) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 46 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',45)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(60) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh 60 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(45) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 45 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',44)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(60) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE= 60 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(45) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 44 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',43)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(60) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ== 60 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(45) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 43 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',42)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(56) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh 56 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(42) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 42 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',41)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(56) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE= 56 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(42) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 41 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',40)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(56) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ== 56 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(42) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 40 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',39)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(52) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh 52 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(39) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 39 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',38)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(52) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE= 52 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(39) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 38 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',37)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(52) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ== 52 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(39) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 37 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',36)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(48) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh 48 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(36) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 36 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',35)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(48) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE= 48 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(36) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 35 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',34)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(48) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ== 48 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(36) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 34 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',33)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(44) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh 44 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(33) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 33 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',32)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(44) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE= 44 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(33) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 32 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',31)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(44) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ== 44 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(33) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 31 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',30)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(40) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh 40 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(30) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 30 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',29)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(40) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE= 40 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(30) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaaa 29 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',28)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(40) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ== 40 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(30) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaaa 28 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',27)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(36) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh 36 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(27) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaaa 27 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',26)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(36) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE= 36 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(27) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaaa 26 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',25)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(36) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ== 36 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(27) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaaa 25 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',24)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(32) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh 32 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(24) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaaa 24 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',23)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(32) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWE= 32 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(24) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaaa 23 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',22)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(32) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ== 32 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(24) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaaa 22 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',21)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(28) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWFh 28 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(21) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaaa 21 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',20)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(28) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYWE= 28 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(21) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaaa 20 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',19)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(28) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFhYQ== 28 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(21) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaaa 19 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',18)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(24) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWFh 24 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(18) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaaa 18 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',17)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(24) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYWE= 24 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(18) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaaa 17 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',16)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(24) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFhYQ== 24 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(18) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaaa 16 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',15)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWFh 20 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(15) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaaa 15 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',14)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYWE= 20 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(15) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaaa 14 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',13)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFhYQ== 20 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(15) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaaa 13 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',12)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(16) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWFh 16 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(12) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaaa 12 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',11)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(16) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYWE= 16 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(12) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaaa 11 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',10)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(16) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFhYQ== 16 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(12) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaaa 10 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',9)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(12) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWFh 12 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(9) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaaa 9 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',8)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(12) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYWE= 12 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(9) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaaa 8 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',7)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(12) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFhYQ== 12 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(9) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaaa 7 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',6)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(8) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWFh 8 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaaa 6 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',5)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(8) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYWE= 8 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaaa 5 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',4)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(8) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFhYQ== 8 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaaa 4 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',3)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWFh 4 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aaa 3 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',2)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YWE= 4 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +aa 2 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',1)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` varchar(4) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) +YQ== 4 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` varbinary(3) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) +a 1 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',0)) AS to_base64; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `to_base64` char(0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT to_base64, LENGTH(to_base64) FROM t1; +to_base64 LENGTH(to_base64) + 0 +CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `from_base64` binary(0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT from_base64, LENGTH(from_base64) FROM t2; +from_base64 LENGTH(from_base64) + 0 +DROP TABLE t2; +DROP TABLE t1; + +CREATE TABLE t1 (a VARBINARY(64)); +INSERT INTO t1 VALUES (0x00), (0x0000), (0x000000), (0x00000000); +INSERT INTO t1 VALUES (0x00010203040506070809); +SELECT TO_BASE64(a), hex(a) FROM t1 ORDER BY a; +TO_BASE64(a) hex(a) +AA== 00 +AAA= 0000 +AAAA 000000 +AAAAAA== 00000000 +AAECAwQFBgcICQ== 00010203040506070809 +DROP TABLE t1; +# +# Test NULL output for NULL input +# +SELECT TO_BASE64(NULL); +TO_BASE64(NULL) +NULL +SELECT FROM_BASE64(NULL); +FROM_BASE64(NULL) +NULL +# +# RFC4648 test vectors +# +SELECT @b:= TO_BASE64(''), FROM_BASE64(@b); +@b:= TO_BASE64('') FROM_BASE64(@b) + +SELECT @b:= TO_BASE64('f'), FROM_BASE64(@b); +@b:= TO_BASE64('f') FROM_BASE64(@b) +Zg== f +SELECT @b:= TO_BASE64('fo'), FROM_BASE64(@b); +@b:= TO_BASE64('fo') FROM_BASE64(@b) +Zm8= fo +SELECT @b:= TO_BASE64('foo'), FROM_BASE64(@b); +@b:= TO_BASE64('foo') FROM_BASE64(@b) +Zm9v foo +SELECT @b:= TO_BASE64('foob'), FROM_BASE64(@b); +@b:= TO_BASE64('foob') FROM_BASE64(@b) +Zm9vYg== foob +SELECT @b:= TO_BASE64('fooba'), FROM_BASE64(@b); +@b:= TO_BASE64('fooba') FROM_BASE64(@b) +Zm9vYmE= fooba +SELECT @b:= TO_BASE64('foobar'), FROM_BASE64(@b); +@b:= TO_BASE64('foobar') FROM_BASE64(@b) +Zm9vYmFy foobar +# +# Invalid characters - return NULL +# +SELECT hex(FROM_BASE64('#')); +hex(FROM_BASE64('#')) +NULL +Warnings: +Warning 1958 Bad base64 data as position 0 +SELECT hex(FROM_BASE64('A#')); +hex(FROM_BASE64('A#')) +NULL +Warnings: +Warning 1958 Bad base64 data as position 1 +SELECT hex(FROM_BASE64('AB#')); +hex(FROM_BASE64('AB#')) +NULL +Warnings: +Warning 1958 Bad base64 data as position 2 +SELECT hex(FROM_BASE64('ABC#')); +hex(FROM_BASE64('ABC#')) +NULL +Warnings: +Warning 1958 Bad base64 data as position 3 +SELECT hex(FROM_BASE64('ABCD#')); +hex(FROM_BASE64('ABCD#')) +NULL +Warnings: +Warning 1958 Bad base64 data as position 4 +# +# "=" is not valid on the first and second positions of a quadruple +# +SELECT hex(FROM_BASE64('=')); +hex(FROM_BASE64('=')) +NULL +Warnings: +Warning 1958 Bad base64 data as position 0 +SELECT hex(FROM_BASE64('A=')); +hex(FROM_BASE64('A=')) +NULL +Warnings: +Warning 1958 Bad base64 data as position 1 +SELECT hex(FROM_BASE64('ABCD=')); +hex(FROM_BASE64('ABCD=')) +NULL +Warnings: +Warning 1958 Bad base64 data as position 4 +SELECT hex(FROM_BASE64('ABCDE=')); +hex(FROM_BASE64('ABCDE=')) +NULL +Warnings: +Warning 1958 Bad base64 data as position 5 +# +# Incomplete sequences - return NULL +# +SELECT hex(FROM_BASE64('A')); +hex(FROM_BASE64('A')) +NULL +Warnings: +Warning 1958 Bad base64 data as position 1 +SELECT hex(FROM_BASE64('AB')); +hex(FROM_BASE64('AB')) +NULL +Warnings: +Warning 1958 Bad base64 data as position 2 +SELECT hex(FROM_BASE64('ABC')); +hex(FROM_BASE64('ABC')) +NULL +Warnings: +Warning 1958 Bad base64 data as position 3 +# +# Unexpected input after pad characters - return NULL +# +SELECT hex(FROM_BASE64('AAA=x')); +hex(FROM_BASE64('AAA=x')) +NULL +Warnings: +Warning 1958 Bad base64 data as position 4 +SELECT hex(FROM_BASE64('AA==x')); +hex(FROM_BASE64('AA==x')) +NULL +Warnings: +Warning 1958 Bad base64 data as position 4 +# +# Delimiters are allowed at any position +# +SELECT hex(FROM_BASE64(' A B C D ')); +hex(FROM_BASE64(' A B C D ')) +001083 +SELECT hex(FROM_BASE64(' A A = = ')); +hex(FROM_BASE64(' A A = = ')) +00 +SELECT hex(FROM_BASE64(' A A A = ')); +hex(FROM_BASE64(' A A A = ')) +0000 +SELECT hex(FROM_BASE64(' A \n B \r C \t D ')); +hex(FROM_BASE64(' A \n B \r C \t D ')) +001083 +# +# Testing that to_base64 respects max_allowed_packet +# +SELECT LENGTH(TO_BASE64(REPEAT('a', @@max_allowed_packet-10))); +LENGTH(TO_BASE64(REPEAT('a', @@max_allowed_packet-10))) +NULL +Warnings: +Warning 1301 Result of to_base64() was larger than max_allowed_packet (1048576) - truncated +# +# Testing base64 with various data types +# +CREATE TABLE t1 ( +i1 INT, +f1 FLOAT, +dc1 DECIMAL(10,5), +e1 ENUM('enum11','enum12','enum13'), +s1 SET('set1','set2','set3'), +t1 TIME, +d1 DATE, +dt1 DATETIME +); +INSERT INTO t1 VALUES +(-12345, -456.789, 123.45, 'enum13', 'set1,set3', +'01:02:03', '2010-01-01', '2011-01-01 02:03:04'); +SELECT FROM_BASE64(TO_BASE64(i1)) FROM t1; +FROM_BASE64(TO_BASE64(i1)) +-12345 +SELECT FROM_BASE64(TO_BASE64(f1)) FROM t1; +FROM_BASE64(TO_BASE64(f1)) +-456.789 +SELECT FROM_BASE64(TO_BASE64(dc1)) FROM t1; +FROM_BASE64(TO_BASE64(dc1)) +123.45000 +SELECT FROM_BASE64(TO_BASE64(e1)) FROM t1; +FROM_BASE64(TO_BASE64(e1)) +enum13 +SELECT FROM_BASE64(TO_BASE64(s1)) FROM t1; +FROM_BASE64(TO_BASE64(s1)) +set1,set3 +SELECT FROM_BASE64(TO_BASE64(t1)) FROM t1; +FROM_BASE64(TO_BASE64(t1)) +01:02:03 +SELECT FROM_BASE64(TO_BASE64(d1)) FROM t1; +FROM_BASE64(TO_BASE64(d1)) +2010-01-01 +SELECT FROM_BASE64(TO_BASE64(dt1)) FROM t1; +FROM_BASE64(TO_BASE64(dt1)) +2011-01-01 02:03:04 +DROP TABLE t1; +SELECT SPACE(@@global.max_allowed_packet*2); +SPACE(@@global.max_allowed_packet*2) +NULL +Warnings: +Warning 1301 Result of space() was larger than max_allowed_packet (1048576) - truncated +SET NAMES latin1; +PREPARE stmt FROM "SELECT COLLATION(space(2))"; +EXECUTE stmt; +COLLATION(space(2)) +latin1_swedish_ci +SET NAMES latin2; +EXECUTE stmt; +COLLATION(space(2)) +latin2_general_ci +disconnect conn1; +connection default; +set global max_allowed_packet=default; +# +# End of 5.6 tests +# +# +# Start of 10.0 tests +# +# +# MDEV-12681 Wrong VIEW results for CHAR(0xDF USING latin1) +# +EXPLAIN EXTENDED SELECT CHAR(0xDF USING latin1); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select char(0xdf using latin1) AS `CHAR(0xDF USING latin1)` +EXPLAIN EXTENDED SELECT CHAR(0xDF USING `binary`); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select char(0xdf) AS `CHAR(0xDF USING ``binary``)` +EXPLAIN EXTENDED SELECT CHAR(0xDF); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select char(0xdf) AS `CHAR(0xDF)` +# +# MDEV-15619 using CONVERT() inside AES_ENCRYPT() in an UPDATE corrupts data +# +CREATE TABLE t1 ( +id int(11) NOT NULL, +session_id varchar(255) DEFAULT NULL, +directory mediumtext, +checksum int(10) DEFAULT NULL, +last_update datetime DEFAULT NULL, +PRIMARY KEY (id), +KEY lastupdate (last_update) +) DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES (1,'',NULL,38391,'2017-06-24 07:35:28'); +UPDATE t1 SET directory = AES_ENCRYPT(CONVERT('test stringrererejrjerjehrjekhrjkehrjkehrkjehrjkerhkjehrjekrhkjehrkjerhjkehrkjehrkjehrjkehrjkehrjkehrjkerjkehrjkehrjkehrjke rekjhrejrejhrjehgrehjgrhjerjhegrjherejhgrjhegrjehgrjhegrejhrgjehgrjhegrjhegrjhergjhegrjhegrhjegrjerhthkjjkdhjkgdfjkgjkdgdjkfjkhgjkfdhjgjkfdghkjdfghkjfdghfjkdghkdjfghdkjfghfjkdghfkjdghkjfdghfkjdghfkdjghfkjdghfdjkghjkdfhgdfjkghfjkdghfjkdghfjdkghfjkdghkfjdghfkjdghfkjdghkjdfghfjdkghjkfdghkjdfhgjkdfhgjkfdhgkjfdghkfjdhgkjfdgdjkejktjherjthkjrethkjrethjkerthjkerhtjkerhtkjerhtjkerhtjkerhtjkrehtkjerhtkjrehtjkrehtkjrehtkjerhtkjerhtjkrehtkjrehtjkrehtkjrethjkrethkjrehtkjethjkerhtjkrehtjkretkjerhtkjrehtjkerhtjkrehtjrehtkjrekjtrfgdsfgdhjsghjgfdhjsfhjdfgdhjshjdshjfghjdsfgjhsfgjhsdfgjhdsfgjdhsfgsjhfgjhsdfgsdjhfgjdhsfdjshfgdsjhfgjsdhfdjshfgdjhsfgdjshfgjdhsfgjhsdfgjhsdgfjhsdgfjhdsgfjhsgfjhsdgfjhdsgfhjsdehkjthrkjethjkre' USING latin1), '95F5A1F52A554'), last_update= NOW(); +SELECT directory IS NULL FROM t1; +directory IS NULL +0 +DROP TABLE t1; +CREATE TABLE t1 ( +id int(11) NOT NULL PRIMARY KEY, +directory mediumtext +) DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES (1,AES_ENCRYPT(CONVERT(REPEAT('a',800) USING latin1),'95F5A1F52A554')); +SELECT AES_DECRYPT(directory,'95F5A1F52A554') FROM t1; +AES_DECRYPT(directory,'95F5A1F52A554') +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +DROP TABLE t1; +SET @enc=AES_ENCRYPT(REPEAT(_latin1'a',800),'95F5A1F52A554'); +CREATE TABLE t1 ( +id int(11) NOT NULL PRIMARY KEY, +directory mediumtext +) DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES (1,AES_DECRYPT(CONVERT(@enc USING binary),'95F5A1F52A554')); +SELECT * FROM t1; +id directory +1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +DROP TABLE t1; +# +# Start of 10.1 tests +# +# +# MDEV-8369 Unexpected impossible WHERE for a condition on a ZEROFILL field +# +CREATE TABLE t1 (a BIGINT(20) ZEROFILL); +INSERT INTO t1 VALUES (18446744073709551615),(0); +SELECT * FROM t1 WHERE a=18446744073709551615; +a +18446744073709551615 +SELECT * FROM t1 WHERE FORMAT(a,0)='18,446,744,073,709,551,615'; +a +18446744073709551615 +SELECT * FROM t1 WHERE a=18446744073709551615 AND FORMAT(a,0)='18,446,744,073,709,551,615'; +a +18446744073709551615 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a=18446744073709551615 AND FORMAT(a,0)='18,446,744,073,709,551,615'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 18446744073709551615 and format(`test`.`t1`.`a`,0) = '18,446,744,073,709,551,615' +DROP TABLE t1; +# +# Bug#58081 Duplicate entry error when doing GROUP BY +# MDEV-9332 Bug after upgrade to 10.1.10 +# +SET NAMES latin1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (0),(0),(1),(0),(0); +SELECT COUNT(*) FROM t1, t1 t2 GROUP BY INSERT('', t2.a, t1.a, @@global.max_binlog_size); +COUNT(*) +25 +DROP TABLE t1; +# Start of func_str_ascii_checksum.inc +# +# MDEV-10850 Wrong result for WHERE .. (f2=TO_BASE64('test') OR f2=TO_BASE64('TEST')) +# +CREATE TABLE t1 (f1 VARCHAR(4), f2 VARCHAR(255), UNIQUE KEY k1 (f1,f2)); +INSERT INTO t1 VALUES ('test',hex('test')), ('TEST', hex('TEST')); +SELECT * FROM t1 IGNORE INDEX(k1) WHERE f1='test' AND (f2= hex("test") OR f2= hex("TEST")); +f1 f2 +test 74657374 +TEST 54455354 +SELECT * FROM t1 WHERE f1='test' AND (f2= hex("test") OR f2= hex("TEST")); +f1 f2 +TEST 54455354 +test 74657374 +SELECT * FROM t1 WHERE f1='test' AND (f2= hex("TEST") OR f2= hex("test")); +f1 f2 +TEST 54455354 +test 74657374 +DROP TABLE t1; +# +# MDEV-10425 Assertion `collation.derivation == DERIVATION_IMPLICIT' failed in Item_func_conv_charset::fix_length_and_dec() +# +PREPARE stmt FROM "SELECT hex(CONVERT('foo' USING latin1))"; +EXECUTE stmt; +hex(CONVERT('foo' USING latin1)) +666F6F +DEALLOCATE PREPARE stmt; +# End of func_str_ascii_checksum.inc +# Start of func_str_ascii_checksum.inc +# +# MDEV-10850 Wrong result for WHERE .. (f2=TO_BASE64('test') OR f2=TO_BASE64('TEST')) +# +CREATE TABLE t1 (f1 VARCHAR(4), f2 VARCHAR(255), UNIQUE KEY k1 (f1,f2)); +INSERT INTO t1 VALUES ('test',to_base64('test')), ('TEST', to_base64('TEST')); +SELECT * FROM t1 IGNORE INDEX(k1) WHERE f1='test' AND (f2= to_base64("test") OR f2= to_base64("TEST")); +f1 f2 +test dGVzdA== +TEST VEVTVA== +SELECT * FROM t1 WHERE f1='test' AND (f2= to_base64("test") OR f2= to_base64("TEST")); +f1 f2 +test dGVzdA== +TEST VEVTVA== +SELECT * FROM t1 WHERE f1='test' AND (f2= to_base64("TEST") OR f2= to_base64("test")); +f1 f2 +test dGVzdA== +TEST VEVTVA== +DROP TABLE t1; +# +# MDEV-10425 Assertion `collation.derivation == DERIVATION_IMPLICIT' failed in Item_func_conv_charset::fix_length_and_dec() +# +PREPARE stmt FROM "SELECT to_base64(CONVERT('foo' USING latin1))"; +EXECUTE stmt; +to_base64(CONVERT('foo' USING latin1)) +Zm9v +DEALLOCATE PREPARE stmt; +# End of func_str_ascii_checksum.inc +# +# MDEV-10864 Wrong result for WHERE .. (f2=COMPRESS('test') OR f2=COMPRESS('TEST')) +# +CREATE TABLE t1 (f1 VARCHAR(4), f2 VARCHAR(128), UNIQUE KEY k1 (f1,f2)); +INSERT INTO t1 VALUES ('YQ==',from_base64('YQ==')), ('Yq==', from_base64('Yq==')); +SELECT f1,HEX(f2) FROM t1 ignore index(k1) WHERE f1='YQ==' AND (f2= from_base64("YQ==") OR f2= from_base64("Yq==")); +f1 HEX(f2) +YQ== 61 +Yq== 62 +SELECT f1,HEX(f2) FROM t1 WHERE f1='YQ==' AND (f2= from_base64("YQ==") OR f2= from_base64("Yq==")); +f1 HEX(f2) +YQ== 61 +Yq== 62 +SELECT f1,HEX(f2) FROM t1 WHERE f1='YQ==' AND (f2= from_base64("Yq==") OR f2= from_base64("YQ==")); +f1 HEX(f2) +YQ== 61 +Yq== 62 +DROP TABLE t1; +# ++# MDEV-18738 ASAN heap-use-after-free in copy_if_not_alloced / copy_fields ++# ++CREATE TABLE t1 (a INT); ++INSERT INTO t1 VALUES (1),(2); ++SELECT REPLACE( CAST( CURDATE() AS BINARY ), CURDATE(), REPEAT('a',32) ) AS f FROM t1 GROUP BY f; ++f ++aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ++DROP TABLE t1; ++CREATE TABLE t1 (a INT); ++INSERT INTO t1 VALUES (1),(2); ++SELECT REPLACE( LEFT( CURDATE(), 4), LEFT(CURDATE(),4), REPEAT('a',32) ) AS f FROM t1 GROUP BY f; ++f ++aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ++DROP TABLE t1; ++CREATE TABLE t1 (a INT); ++INSERT INTO t1 VALUES (1),(2); ++SELECT REPLACE(RIGHT(CURDATE(), 4), RIGHT(CURDATE(),4), REPEAT('a',32)) AS f FROM t1 GROUP BY f; ++f ++aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ++DROP TABLE t1; ++CREATE TABLE t1 (a INT); ++INSERT INTO t1 VALUES (1),(2); ++SELECT REPLACE(SUBSTR(CURDATE(),2,3), SUBSTR(CURDATE(),2,3), REPEAT('a',32)) AS f FROM t1 GROUP BY f; ++f ++aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ++DROP TABLE t1; ++# ++# MDEV-19359 ASAN heap-use-after-free in copy_if_not_alloced / make_sortkey ++# ++CREATE TABLE t1 (a INT, b TIME, c TIME); ++INSERT INTO t1 VALUES (NULL,'22:56:45','22:56:45'),(4,'12:51:42','12:51:42'); ++SELECT REPLACE( BINARY c, a, b ) f FROM t1 GROUP BY f WITH ROLLUP; ++f ++NULL ++12:51:12:51:422 ++NULL ++DROP TABLE t1; ++# +# End of 10.1 tests +# +# +# Start of 10.3 tests +# +# +# MDEV-12685 Oracle-compatible function CHR() +# +select chr(65); +chr(65) +A +create database mysqltest1 CHARACTER SET = 'utf8' COLLATE = 'utf8_bin'; +use mysqltest1; +select charset(chr(65)), length(chr(65)),char_length(chr(65)); +charset(chr(65)) length(chr(65)) char_length(chr(65)) +utf8 1 1 +select charset(chr(14844588)), length(chr(14844588)),char_length(chr(14844588)); +charset(chr(14844588)) length(chr(14844588)) char_length(chr(14844588)) +utf8 3 1 +drop database mysqltest1; +use test; +# +# MDEV-12592 Illegal mix of collations with the HEX function +# +SET NAMES utf8; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1); +INSERT INTO t1 VALUES (0x09),('a'); +SELECT IF(a<' ',HEX(a),a) FROM t1 ORDER BY a; +IF(a<' ',HEX(a),a) +09 +a +DROP TABLE t1; +# +# MDEV-12783 sql_mode=ORACLE: Functions LENGTH() and LENGTHB() +# +SELECT LENGTHB('a'), LENGTHB(_utf8 0xC39F), LENGTHB(123), LENGTH(null); +LENGTHB('a') LENGTHB(_utf8 0xC39F) LENGTHB(123) LENGTH(null) +1 2 3 NULL +EXPLAIN EXTENDED SELECT LENGTH('a'), LENGTHB('a'); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select octet_length('a') AS `LENGTH('a')`,octet_length('a') AS `LENGTHB('a')` +# +# MDEV-13555 Assertion `!item->null_value' failed in Type_handler::Item_send_str +# +CREATE TABLE t1 (c VARCHAR(8)); +INSERT INTO t1 VALUES (NULL),('bar'); +SELECT LPAD( c, 0, '?' ) FROM t1; +LPAD( c, 0, '?' ) +NULL + +SELECT RPAD( c, 0, '?' ) FROM t1; +RPAD( c, 0, '?' ) +NULL + +DROP TABLE t1; +# +# End of 10.3 tests +# diff --cc mysql-test/main/func_str.test index 64aca38c115,00000000000..c122516d756 mode 100644,000000..100644 --- a/mysql-test/main/func_str.test +++ b/mysql-test/main/func_str.test @@@ -1,1998 -1,0 +1,2034 @@@ +# Description +# ----------- +# Testing string functions + +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + +set global max_allowed_packet=1048576; +connect (conn1,localhost,root,,); +connection conn1; + +let $mysqld_datadir= `select @@datadir`; + +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 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 hex(char(256)); +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'); +# +# Bug#11728 string function LEFT, +# strange undocumented behaviour, strict mode +# +select left('hello',null), right('hello',null); +select left('hello',2),right('hello',2),substring('hello',2,2),mid('hello',1,5) ; +select concat('',left(right(concat('what ',concat('is ','happening')),9),4),'',substring('monty',5,1)) ; +select substring_index('www.tcx.se','.',-2),substring_index('www.tcx.se','.',1); +select substring_index('www.tcx.se','tcx',1),substring_index('www.tcx.se','tcx',-1); +select substring_index('.tcx.se','.',-2),substring_index('.tcx.se','.tcx',-1); +select substring_index('aaaaaaaaa1','a',1); +select substring_index('aaaaaaaaa1','aa',1); +select substring_index('aaaaaaaaa1','aa',2); +select substring_index('aaaaaaaaa1','aa',3); +select substring_index('aaaaaaaaa1','aa',4); +select substring_index('aaaaaaaaa1','aa',5); +select substring_index('aaaaaaaaa1','aaa',1); +select substring_index('aaaaaaaaa1','aaa',2); +select substring_index('aaaaaaaaa1','aaa',3); +select substring_index('aaaaaaaaa1','aaa',4); +select substring_index('aaaaaaaaa1','aaaa',1); +select substring_index('aaaaaaaaa1','aaaa',2); +select substring_index('aaaaaaaaa1','1',1); +select substring_index('aaaaaaaaa1','a',-1); +select substring_index('aaaaaaaaa1','aa',-1); +select substring_index('aaaaaaaaa1','aa',-2); +select substring_index('aaaaaaaaa1','aa',-3); +select substring_index('aaaaaaaaa1','aa',-4); +select substring_index('aaaaaaaaa1','aa',-5); +select substring_index('aaaaaaaaa1','aaa',-1); +select substring_index('aaaaaaaaa1','aaa',-2); +select substring_index('aaaaaaaaa1','aaa',-3); +select substring_index('aaaaaaaaa1','aaa',-4); +select substring_index('the king of thethe hill','the',-2); +select substring_index('the king of the the hill','the',-2); +select substring_index('the king of the the hill','the',-2); +select substring_index('the king of the the hill',' the ',-1); +select substring_index('the king of the the hill',' the ',-2); +select substring_index('the king of the the hill',' ',-1); +select substring_index('the king of the the hill',' ',-2); +select substring_index('the king of the the hill',' ',-3); +select substring_index('the king of the the hill',' ',-4); +select substring_index('the king of the the hill',' ',-5); +select substring_index('the king of the.the hill','the',-2); +select substring_index('the king of thethethe.the hill','the',-3); +select substring_index('the king of thethethe.the hill','the',-1); +select substring_index('the king of the the hill','the',1); +select substring_index('the king of the the hill','the',2); +select substring_index('the king of the the hill','the',3); + +select concat(':',ltrim(' left '),':',rtrim(' right '),':'); +select concat(':',trim(leading from ' left '),':',trim(trailing from ' right '),':'); +select concat(':',trim(LEADING FROM ' left'),':',trim(TRAILING FROM ' right '),':'); +select concat(':',trim(' m '),':',trim(BOTH FROM ' y '),':',trim('*' FROM '*s*'),':'); +select concat(':',trim(BOTH 'ab' FROM 'ababmyabab'),':',trim(BOTH '*' FROM '***sql'),':'); +select concat(':',trim(LEADING '.*' FROM '.*my'),':',trim(TRAILING '.*' FROM 'sql.*.*'),':'); +select TRIM("foo" FROM "foo"), TRIM("foo" FROM "foook"), TRIM("foo" FROM "okfoo"); + +select concat_ws(', ','monty','was here','again'); +select concat_ws(NULL,'a'),concat_ws(',',NULL,''); +select concat_ws(',','',NULL,'a'); +SELECT CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),repeat('d',100)), '"'); + +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'); +select aes_decrypt(aes_encrypt('abc','1'),1); +select aes_encrypt(NULL,"a"); +select aes_encrypt("a",NULL); +select aes_decrypt(NULL,"a"); +select aes_decrypt("a",NULL); +select aes_decrypt("a","a"); +select aes_decrypt(aes_encrypt("","a"),"a"); +select aes_decrypt("", "a"); +select repeat('monty',5),concat('*',space(5),'*'); +select reverse('abc'),reverse('abcd'); +select rpad('a',4,'1'),rpad('a',4,'12'),rpad('abcd',3,'12'), rpad(11, 10 , 22), rpad("ab", 10, 22); +select lpad('a',4,'1'),lpad('a',4,'12'),lpad('abcd',3,'12'), lpad(11, 10 , 22); +select rpad(741653838,17,'0'),lpad(741653838,17,'0'); +select rpad('abcd',7,'ab'),lpad('abcd',7,'ab'); +select rpad('abcd',1,'ab'),lpad('abcd',1,'ab'); +select rpad('STRING', 20, CONCAT('p','a','d') ); +select lpad('STRING', 20, CONCAT('p','a','d') ); +select rpad('abcd',7),lpad('abcd',7); + +select LEAST(NULL,'HARRY','HARRIOT',NULL,'HAROLD'),GREATEST(NULL,'HARRY','HARRIOT',NULL,'HAROLD'); +select least(1,2,3) | greatest(16,32,8), least(5,4)*1,greatest(-1.0,1.0)*1,least(3,2,1)*1.0,greatest(1,1.1,1.0),least("10",9),greatest("A","B","0"); + +select decode(encode(repeat("a",100000),"monty"),"monty")=repeat("a",100000); +select decode(encode("abcdef","monty"),"monty")="abcdef"; + +select quote('\'\"\\test'); +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 +# + +select concat('a', quote(NULL)); + +# +# Wrong usage of functions +# + +select reverse(""); +select insert("aa",100,1,"b"),insert("aa",1,3,"b"),left("aa",-1),substring("a",1,2); +select elt(2,1),field(NULL,"a","b","c"),reverse(""); +select locate("a","b",2),locate("","a",1); +select ltrim("a"),rtrim("a"),trim(BOTH "" from "a"),trim(BOTH " " from "a"); +select concat("1","2")|0,concat("1",".5")+0.0; +select substring_index("www.tcx.se","",3); +select length(repeat("a",100000000)),length(repeat("a",1000*64)); +select position("0" in "baaa" in (1)),position("0" in "1" in (1,2,3)),position("sql" in ("mysql")); +select position(("1" in (1,2,3)) in "01"); +select length(repeat("a",65500)),length(concat(repeat("a",32000),repeat("a",32000))),length(replace("aaaaa","a",concat(repeat("a",10000)))),length(insert(repeat("a",40000),1,30000,repeat("b",50000))); +select length(repeat("a",1000000)),length(concat(repeat("a",32000),repeat("a",32000),repeat("a",32000))),length(replace("aaaaa","a",concat(repeat("a",32000)))),length(insert(repeat("a",48000),1,1000,repeat("a",48000))); + +# +# Problem med concat +# + +create table t1 ( domain char(50) ); +insert into t1 VALUES ("hello.de" ), ("test.de" ); +select domain from t1 where concat('@', trim(leading '.' from concat('.', domain))) = '@hello.de'; +select domain from t1 where concat('@', trim(leading '.' from concat('.', domain))) = '@test.de'; +drop table t1; + +# +# Test bug in concat_ws +# + +CREATE TABLE t1 ( + id int(10) unsigned NOT NULL, + title varchar(255) default NULL, + prio int(10) unsigned default NULL, + category int(10) unsigned default NULL, + program int(10) unsigned default NULL, + bugdesc text, + created datetime default NULL, + modified timestamp NOT NULL, + bugstatus int(10) unsigned default NULL, + submitter int(10) unsigned default NULL +) 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+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+0,bugstatus,submitter) FROM t1; +SELECT bugdesc, REPLACE(bugdesc, 'xxxxxxxxxxxxxxxxxxxx', 'bbbbbbbbbbbbbbbbbbbb') from t1 group by bugdesc; +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)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1, 'a545f661efdd1fb66fdee3aab79945bf'); +SELECT 1 FROM t1 WHERE tmp=AES_DECRYPT(tmp,"password"); +DROP TABLE t1; + +CREATE TABLE t1 ( + wid int(10) unsigned NOT NULL auto_increment, + data_podp date default NULL, + status_wnio enum('nowy','podp','real','arch') NOT NULL default 'nowy', + PRIMARY KEY(wid) +); + +INSERT INTO t1 VALUES (8,NULL,'real'); +INSERT INTO t1 VALUES (9,NULL,'nowy'); +SELECT elt(status_wnio,data_podp) FROM t1 GROUP BY wid; +DROP TABLE t1; + +# +# test for #739 + +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; + +# +# test for Bug #2290 "output truncated with ELT when using DISTINCT" +# + +CREATE TABLE t1 (i int, j int); +INSERT INTO t1 VALUES (1,1),(2,2); +SELECT DISTINCT i, ELT(j, '345', '34') FROM t1; +DROP TABLE t1; + +# +# bug #3756: quote and NULL +# + +create table t1(a char(4)); +insert into t1 values ('one'),(NULL),('two'),('four'); +select a, quote(a), isnull(quote(a)), quote(a) is null, ifnull(quote(a), 'n') from t1; +drop table t1; + +# +# Bug #5498: TRIM fails with LEADING or TRAILING if remstr = str +# + +select trim(trailing 'foo' from 'foo'); +select trim(leading 'foo' from 'foo'); + +# +# crashing bug with QUOTE() and LTRIM() or TRIM() fixed +# Bug #7495 +# + +select quote(ltrim(concat(' ', 'a'))); +select quote(trim(concat(' ', 'a'))); + +# Bad results from QUOTE(). Bug #8248 +CREATE TABLE t1 SELECT 1 UNION SELECT 2 UNION SELECT 3; +SELECT QUOTE('A') FROM t1; +DROP TABLE t1; + +# 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('1',_latin2'3','2',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: +--disable_parsing +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'); +--enable_parsing + +--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: +--disable_parsing +select SUBSTRING_INDEX(_latin1'abcdabcdabcd' COLLATE latin1_bin,_latin1'd',2); +select SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin1'd' COLLATE latin1_bin,2); +--enable_parsing + +--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(lpad(_latin2'a',4)), coercibility(lpad(_latin2'a',4)); +select collation(rpad(_latin2'a',4,_latin2'b')), coercibility(rpad(_latin2'a',4,_latin2'b')); +select collation(rpad(_latin2'a',4)), coercibility(rpad(_latin2'a',4)); +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'), + lpad(_latin2'a',4), + rpad(_latin2'a',4), + 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; + +# +# Bug#9129 +# +create table t1 (a char character set latin2); +insert into t1 values (null); +select charset(a), collation(a), coercibility(a) from t1; +drop table t1; +select charset(null), collation(null), coercibility(null); +# +# Make sure OUTER JOIN is not replaced with a regular joun +# +CREATE TABLE t1 (a int, b int); +CREATE TABLE t2 (a int, b int); +INSERT INTO t1 VALUES (1,1),(2,2); +INSERT INTO t2 VALUES (2,2),(3,3); +select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b) +where collation(t2.a) = _utf8'binary' order by t1.a,t2.a; +select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b) +where charset(t2.a) = _utf8'binary' order by t1.a,t2.a; +select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b) +where coercibility(t2.a) = 5 order by t1.a,t2.a; +DROP TABLE t1, t2; + +# +# 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'); +explain extended select sha('abc'); +explain extended select sha1('abc'); +explain extended select soundex(''); +explain extended select 'mood' sounds like 'mud'; +explain extended select aes_decrypt(aes_encrypt('abc','1'),'1'); +explain extended select concat('*',space(5),'*'); +explain extended select reverse('abc'); +explain extended select rpad('a',4,'1'); +explain extended select lpad('a',4,'1'); +explain extended select rpad('a',4); +explain extended select lpad('a',4); +explain extended select concat_ws(',','',NULL,'a'); +explain extended select make_set(255,_latin2'a', _latin2'b', _latin2'c'); +explain extended select elt(2,1); +explain extended select locate("a","b",2); +explain extended select format(130,10); +explain extended select char(0); +explain extended select conv(130,16,10); +explain extended select hex(130); +explain extended select binary 'HE'; +explain extended select export_set(255,_latin2'y', _latin2'n', _latin2' '); +explain extended select FIELD('b' COLLATE latin1_bin,'A','B'); +explain extended select FIND_IN_SET(_latin1'B', _latin1'a,b,c,d'); +explain extended select collation(conv(130,16,10)); +explain extended select coercibility(conv(130,16,10)); +explain extended select length('\n\t\r\b\0\_\%\\'); +explain extended select bit_length('\n\t\r\b\0\_\%\\'); +explain extended select bit_length('\n\t\r\b\0\_\%\\'); +explain extended select concat('monty',' was here ','again'); +explain extended select length('hello'); +explain extended select char(ascii('h')); +explain extended select ord('h'); +explain extended select quote(1/0); +explain extended select crc32("123"); +explain extended select replace('aaaa','a','b'); +explain extended select insert('txs',2,1,'hi'); +explain extended select left(_latin2'a',1); +explain extended select right(_latin2'a',1); +explain extended select lcase(_latin2'a'); +explain extended select ucase(_latin2'a'); +explain extended select SUBSTR('abcdefg',3,2); +explain extended select substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2); +explain extended select trim(_latin2' a '); +explain extended select ltrim(_latin2' a '); +explain extended select rtrim(_latin2' a '); +explain extended select 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); +SELECT conv(71, 10, 37), conv('1Z', 37, 10), conv(0,1,10),conv(0,0,10), conv(0,-1,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 ignore into t1 values ('21474836461','21474836461'); +insert ignore 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; + +# +# Bug#7455 unexpected result: TRIM(<NULL> FROM <whatever>) gives NOT NULL +# According to ANSI if one of the TRIM arguments is NULL, then the result +# must be NULL too. +# +select trim(null from 'kate') as "must_be_null"; +select trim('xyz' from null) as "must_be_null"; +select trim(leading NULL from 'kate') as "must_be_null"; +select trim(trailing NULL from 'xyz') as "must_be_null"; + +# +# Bug #7751 - conversion for a bigint unsigned constant +# + +CREATE TABLE t1 ( + id int(11) NOT NULL auto_increment, + a bigint(20) unsigned default NULL, + PRIMARY KEY (id) +) ENGINE=MyISAM; + +INSERT INTO t1 VALUES +('0','16307858876001849059'); + +SELECT CONV('e251273eb74a8ee3', 16, 10); + +EXPLAIN +SELECT id + FROM t1 + WHERE a = 16307858876001849059; + +EXPLAIN + SELECT id + FROM t1 + WHERE a = CONV('e251273eb74a8ee3', 16, 10); + +DROP TABLE t1; + +# +# Bug #6317: string function CHAR, parameter is NULL, wrong result +# +SELECT CHAR(NULL,121,83,81,'76') as my_column; +SELECT CHAR_LENGTH(CHAR(NULL,121,83,81,'76')) as my_column; +# +# Test case for bug #8669: null aes_decrypt result in order by query +# + +CREATE TABLE t1 (id int PRIMARY KEY, str char(255) NOT NULL); +CREATE TABLE t2 (id int NOT NULL UNIQUE); +INSERT INTO t2 VALUES (1),(2); +INSERT INTO t1 VALUES (1, aes_encrypt('foo', 'bar')); +INSERT INTO t1 VALUES (2, 'not valid'); + +SELECT t1.id, aes_decrypt(str, 'bar') FROM t1, t2 WHERE t1.id = t2.id; +SELECT t1.id, aes_decrypt(str, 'bar') FROM t1, t2 WHERE t1.id = t2.id + ORDER BY t1.id; + +DROP TABLE t1, t2; + +# +# Bug #10944: Mishandling of NULL arguments in FIELD() +# +select field(0,NULL,1,0), field("",NULL,"bar",""), field(0.0,NULL,1.0,0.0); +select field(NULL,1,2,NULL), field(NULL,1,2,0); + +# +# Bug #10124: access by integer index with a string key that is not a number +# + +CREATE TABLE t1 (str varchar(20) PRIMARY KEY); +CREATE TABLE t2 (num int primary key); +INSERT INTO t1 VALUES ('notnumber'); +INSERT INTO t2 VALUES (0), (1); + +SELECT * FROM t1, t2 WHERE num=str; +SELECT * FROM t1, t2 WHERE num=substring(str from 1 for 6); + +DROP TABLE t1,t2; + +# +# Bug #11469: NOT NULL optimization wrongly used for arguments of CONCAT_WS +# + +CREATE TABLE t1( + id int(11) NOT NULL auto_increment, + pc int(11) NOT NULL default '0', + title varchar(20) default NULL, + PRIMARY KEY (id) +); + +INSERT INTO t1 VALUES + (1, 0, 'Main'), + (2, 1, 'Toys'), + (3, 1, 'Games'); + +SELECT t1.id, CONCAT_WS('->', t3.title, t2.title, t1.title) as col1 + FROM t1 LEFT JOIN t1 AS t2 ON t1.pc=t2.id + LEFT JOIN t1 AS t3 ON t2.pc=t3.id; +SELECT t1.id, CONCAT_WS('->', t3.title, t2.title, t1.title) as col1 + FROM t1 LEFT JOIN t1 AS t2 ON t1.pc=t2.id + LEFT JOIN t1 AS t3 ON t2.pc=t3.id + WHERE CONCAT_WS('->', t3.title, t2.title, t1.title) LIKE '%Toys%'; + +DROP TABLE t1; + + +CREATE TABLE t1( + trackid int(10) unsigned NOT NULL auto_increment, + trackname varchar(100) NOT NULL default '', + PRIMARY KEY (trackid) +); + +CREATE TABLE t2( + artistid int(10) unsigned NOT NULL auto_increment, + artistname varchar(100) NOT NULL default '', + PRIMARY KEY (artistid) +); + +CREATE TABLE t3( + trackid int(10) unsigned NOT NULL, + artistid int(10) unsigned NOT NULL, + PRIMARY KEY (trackid,artistid) +); + +INSERT INTO t1 VALUES (1, 'April In Paris'), (2, 'Autumn In New York'); +INSERT INTO t2 VALUES (1, 'Vernon Duke'); +INSERT INTO t3 VALUES (1,1); + +SELECT CONCAT_WS(' ', trackname, artistname) trackname, artistname + FROM t1 LEFT JOIN t3 ON t1.trackid=t3.trackid + LEFT JOIN t2 ON t2.artistid=t3.artistid + WHERE CONCAT_WS(' ', trackname, artistname) LIKE '%In%'; + +DROP TABLE t1,t2,t3; + +# +# Correct length reporting from substring() (BUG#10269) +# +create table t1 (b varchar(5)); +insert t1 values ('ab'), ('abc'), ('abcd'), ('abcde'); +select *,substring(b,1),substring(b,-1),substring(b,-2),substring(b,-3),substring(b,-4),substring(b,-5) from t1; +select * from (select *,substring(b,1),substring(b,-1),substring(b,-2),substring(b,-3),substring(b,-4),substring(b,-5) from t1) t; +drop table t1; + +# +# Bug #9854 hex() and out of range handling +# +select hex(29223372036854775809), hex(-29223372036854775809); + +# +# Bug #11311: Incorrect length returned from LPAD() and RPAD() +# +create table t1 (i int); +insert into t1 values (1000000000),(1); +--enable_metadata +select lpad(i, 7, ' ') as t from t1; +select rpad(i, 7, ' ') as t from t1; +--disable_metadata +drop table t1; + +# +# Bug #10418: LOAD_FILE does not behave like in manual if file does not exist +# + +select load_file("lkjlkj"); +select ifnull(load_file("lkjlkj"),"it's null"); + +# +# Bug#15351: Wrong collation used for comparison of md5() and sha() +# parameter can lead to a wrong result. +# +create table t1 (f1 varchar(4), f2 varchar(64), unique key k1 (f1,f2)); +insert into t1 values ( 'test',md5('test')), ('test', sha('test')); +select * from t1 where f1='test' and (f2= md5("test") or f2= md5("TEST")); +select * from t1 where f1='test' and (f2= md5("TEST") or f2= md5("test")); +select * from t1 where f1='test' and (f2= sha("test") or f2= sha("TEST")); +select * from t1 where f1='test' and (f2= sha("TEST") or f2= sha("test")); +drop table t1; + +# +# Bug#18243: REVERSE changes its argument +# + +CREATE TABLE t1 (a varchar(10)); +INSERT INTO t1 VALUES ('abc'), ('xyz'); + +SELECT a, CONCAT(a,' ',a) AS c FROM t1 + HAVING LEFT(c,LENGTH(c)-INSTR(REVERSE(c)," ")) = a; + +SELECT a, CONCAT(a,' ',a) AS c FROM t1 + HAVING LEFT(CONCAT(a,' ',a), + LENGTH(CONCAT(a,' ',a))- + INSTR(REVERSE(CONCAT(a,' ',a))," ")) = a; + +DROP TABLE t1; + +# +# Bug#17526: WRONG PRINT for TRIM FUNCTION with two arguments +# + +CREATE TABLE t1 (s varchar(10)); +INSERT INTO t1 VALUES ('yadda'), ('yaddy'); + +EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(s) > 'ab'; +EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM('y' FROM s) > 'ab'; +EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(LEADING 'y' FROM s) > 'ab'; +EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(TRAILING 'y' FROM s) > 'ab'; +EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(BOTH 'y' FROM s) > 'ab'; + +DROP TABLE t1; + +# +# Bug#23409: ENCODE() and DECODE() functions aren't printed correctly +# +create table t1(f1 varchar(4)); +explain extended select encode(f1,'zxcv') as 'enc' from t1; +explain extended select decode(f1,'zxcv') as 'enc' from t1; +drop table t1; + +# +# Bug #31758 inet_ntoa, oct, crashes server with null + filesort +# +create table t1 (a bigint not null)engine=myisam; +insert into t1 set a = 1024*1024*1024*4; +delete from t1 order by (inet_ntoa(a)) desc limit 10; +drop table t1; +create table t1 (a char(36) not null)engine=myisam; +insert ignore into t1 set a = ' '; +insert ignore into t1 set a = ' '; +select * from t1 order by (oct(a)); +drop table t1; + +--echo End of 4.1 tests + +# +# Bug #13361: SELECT FORMAT(<decimal field with null>, 2) crashes +# +create table t1 (d decimal default null); +insert into t1 values (null); +select format(d, 2) from t1; +drop table t1; + +# +# Bug #14676: substring_index() returns incorrect results +# +create table t1 (c varchar(40)); +insert into t1 values ('y,abc'),('y,abc'); +select c, substring_index(lcase(c), @q:=',', -1) as res from t1; +drop table t1; + +# +# Bug #17043: Casting trimmed string to decimal loses precision +# +select cast(rtrim(' 20.06 ') as decimal(19,2)); +select cast(ltrim(' 20.06 ') as decimal(19,2)); +select cast(rtrim(ltrim(' 20.06 ')) as decimal(19,2)); + +# +# Bug #13975: "same string" + 0 has 2 different results +# +select conv("18383815659218730760",10,10) + 0; +select "18383815659218730760" + 0; + +# +# Bug #21698: substitution of a string field for a constant under a function +# + +CREATE TABLE t1 (code varchar(10)); +INSERT INTO t1 VALUES ('a12'), ('A12'), ('a13'); + +SELECT ASCII(code), code FROM t1 WHERE code='A12'; +SELECT ASCII(code), code FROM t1 WHERE code='A12' AND ASCII(code)=65; + +INSERT INTO t1 VALUES ('a12 '), ('A12 '); + +SELECT LENGTH(code), code FROM t1 WHERE code='A12'; +SELECT LENGTH(code), code FROM t1 WHERE code='A12' AND LENGTH(code)=5; + +ALTER TABLE t1 ADD INDEX (code); +CREATE TABLE t2 (id varchar(10) PRIMARY KEY); +INSERT INTO t2 VALUES ('a11'), ('a12'), ('a13'), ('a14'); + +SELECT * FROM t1 INNER JOIN t2 ON t1.code=t2.id + WHERE t2.id='a12' AND (LENGTH(code)=5 OR code < 'a00'); +EXPLAIN EXTENDED +SELECT * FROM t1 INNER JOIN t2 ON code=id + WHERE id='a12' AND (LENGTH(code)=5 OR code < 'a00'); + +DROP TABLE t1,t2; + +# +# Bug#22684: The Functions ENCODE, DECODE and FORMAT are not real functions +# + +select encode(NULL, NULL); +select encode("data", NULL); +select encode(NULL, "password"); + +select decode(NULL, NULL); +select decode("data", NULL); +select decode(NULL, "password"); + +select format(NULL, NULL); +select format(pi(), NULL); +select format(NULL, 2); + +select benchmark(NULL, NULL); +select benchmark(0, NULL); +select benchmark(100, NULL); +select benchmark(NULL, 1+1); + +# +# Bug #20752: BENCHMARK with many iterations returns too quickly +# + +# not a string, but belongs with the above Bug#22684 +select benchmark(-1, 1); + +# +# Please note: +# 1) The collation of the password is irrelevant, the encryption uses +# the binary representation of the string without charset/collation. +# 2) These tests can not print the encoded text directly, because it's binary, +# and doing this would cause problems with source control. +# Instead, an md5() checksum is used, to verify the result indirectly. +# 3) Each md5() result must be identical. +# 4) The md5() result must never change, and must be stable across releases. +# +set @password="password"; +set @my_data="clear text to encode"; +select md5(encode(@my_data, "password")); +select md5(encode(@my_data, _utf8 "password")); +select md5(encode(@my_data, binary "password")); +select md5(encode(@my_data, _latin1 "password")); +select md5(encode(@my_data, _koi8r "password")); +select md5(encode(@my_data, (select "password" from dual))); +select md5(encode(@my_data, concat("pass", "word"))); +select md5(encode(@my_data, @password)); + +set @my_data="binary encoded data"; +select md5(decode(@my_data, "password")); +select md5(decode(@my_data, _utf8 "password")); +select md5(decode(@my_data, binary "password")); +select md5(decode(@my_data, _latin1 "password")); +select md5(decode(@my_data, _koi8r "password")); +select md5(decode(@my_data, (select "password" from dual))); +select md5(decode(@my_data, concat("pass", "word"))); +select md5(decode(@my_data, @password)); + +set @dec=5; +select format(pi(), (1+1)); +select format(pi(), (select 3 from dual)); +select format(pi(), @dec); + +set @bench_count=10; +select benchmark(10, pi()); +select benchmark(5+5, pi()); +select benchmark((select 10 from dual), pi()); +select benchmark(@bench_count, pi()); + + +# +# Bug #10963 +# 4294967296 18446744073709551616 + +select locate('he','hello',-2); +select locate('lo','hello',-4294967295); +select locate('lo','hello',4294967295); +select locate('lo','hello',-4294967296); +select locate('lo','hello',4294967296); +select locate('lo','hello',-4294967297); +select locate('lo','hello',4294967297); +select locate('lo','hello',-18446744073709551615); +select locate('lo','hello',18446744073709551615); +select locate('lo','hello',-18446744073709551616); +select locate('lo','hello',18446744073709551616); +select locate('lo','hello',-18446744073709551617); +select locate('lo','hello',18446744073709551617); + +select left('hello', 10); +select left('hello', 0); +select left('hello', -1); +select left('hello', -4294967295); +select left('hello', 4294967295); +select left('hello', -4294967296); +select left('hello', 4294967296); +select left('hello', -4294967297); +select left('hello', 4294967297); +select left('hello', -18446744073709551615); +select left('hello', 18446744073709551615); +select left('hello', -18446744073709551616); +select left('hello', 18446744073709551616); +select left('hello', -18446744073709551617); +select left('hello', 18446744073709551617); + +select right('hello', 10); +select right('hello', 0); +select right('hello', -1); +select right('hello', -4294967295); +select right('hello', 4294967295); +select right('hello', -4294967296); +select right('hello', 4294967296); +select right('hello', -4294967297); +select right('hello', 4294967297); +select right('hello', -18446744073709551615); +select right('hello', 18446744073709551615); +select right('hello', -18446744073709551616); +select right('hello', 18446744073709551616); +select right('hello', -18446744073709551617); +select right('hello', 18446744073709551617); + +select substring('hello', 2, -1); + +select substring('hello', -1, 1); +select substring('hello', -2, 1); +select substring('hello', -4294967295, 1); +select substring('hello', 4294967295, 1); +select substring('hello', -4294967296, 1); +select substring('hello', 4294967296, 1); +select substring('hello', -4294967297, 1); +select substring('hello', 4294967297, 1); +select substring('hello', -18446744073709551615, 1); +select substring('hello', 18446744073709551615, 1); +select substring('hello', -18446744073709551616, 1); +select substring('hello', 18446744073709551616, 1); +select substring('hello', -18446744073709551617, 1); +select substring('hello', 18446744073709551617, 1); +select substring('hello', 1, -1); +select substring('hello', 1, -4294967295); +select substring('hello', 1, 4294967295); +select substring('hello', 1, -4294967296); +select substring('hello', 1, 4294967296); +select substring('hello', 1, -4294967297); +select substring('hello', 1, 4294967297); +select substring('hello', 1, -18446744073709551615); +select substring('hello', 1, 18446744073709551615); +select substring('hello', 1, -18446744073709551616); +select substring('hello', 1, 18446744073709551616); +select substring('hello', 1, -18446744073709551617); +select substring('hello', 1, 18446744073709551617); +select substring('hello', -1, -1); +select substring('hello', -4294967295, -4294967295); +select substring('hello', 4294967295, 4294967295); +select substring('hello', -4294967296, -4294967296); +select substring('hello', 4294967296, 4294967296); +select substring('hello', -4294967297, -4294967297); +select substring('hello', 4294967297, 4294967297); +select substring('hello', -18446744073709551615, -18446744073709551615); +select substring('hello', 18446744073709551615, 18446744073709551615); +select substring('hello', -18446744073709551616, -18446744073709551616); +select substring('hello', 18446744073709551616, 18446744073709551616); +select substring('hello', -18446744073709551617, -18446744073709551617); +select substring('hello', 18446744073709551617, 18446744073709551617); + +select insert('hello', -1, 1, 'hi'); +select insert('hello', -4294967295, 1, 'hi'); +select insert('hello', 4294967295, 1, 'hi'); +select insert('hello', -4294967296, 1, 'hi'); +select insert('hello', 4294967296, 1, 'hi'); +select insert('hello', -4294967297, 1, 'hi'); +select insert('hello', 4294967297, 1, 'hi'); +select insert('hello', -18446744073709551615, 1, 'hi'); +select insert('hello', 18446744073709551615, 1, 'hi'); +select insert('hello', -18446744073709551616, 1, 'hi'); +select insert('hello', 18446744073709551616, 1, 'hi'); +select insert('hello', -18446744073709551617, 1, 'hi'); +select insert('hello', 18446744073709551617, 1, 'hi'); +select insert('hello', 1, -1, 'hi'); +select insert('hello', 1, -4294967295, 'hi'); +select insert('hello', 1, 4294967295, 'hi'); +select insert('hello', 1, -4294967296, 'hi'); +select insert('hello', 1, 4294967296, 'hi'); +select insert('hello', 1, -4294967297, 'hi'); +select insert('hello', 1, 4294967297, 'hi'); +select insert('hello', 1, -18446744073709551615, 'hi'); +select insert('hello', 1, 18446744073709551615, 'hi'); +select insert('hello', 1, -18446744073709551616, 'hi'); +select insert('hello', 1, 18446744073709551616, 'hi'); +select insert('hello', 1, -18446744073709551617, 'hi'); +select insert('hello', 1, 18446744073709551617, 'hi'); +select insert('hello', -1, -1, 'hi'); +select insert('hello', -4294967295, -4294967295, 'hi'); +select insert('hello', 4294967295, 4294967295, 'hi'); +select insert('hello', -4294967296, -4294967296, 'hi'); +select insert('hello', 4294967296, 4294967296, 'hi'); +select insert('hello', -4294967297, -4294967297, 'hi'); +select insert('hello', 4294967297, 4294967297, 'hi'); +select insert('hello', -18446744073709551615, -18446744073709551615, 'hi'); +select insert('hello', 18446744073709551615, 18446744073709551615, 'hi'); +select insert('hello', -18446744073709551616, -18446744073709551616, 'hi'); +select insert('hello', 18446744073709551616, 18446744073709551616, 'hi'); +select insert('hello', -18446744073709551617, -18446744073709551617, 'hi'); +select insert('hello', 18446744073709551617, 18446744073709551617, 'hi'); + +select repeat('hello', -1); +select repeat('hello', -4294967295); +select repeat('hello', 4294967295); +select repeat('hello', -4294967296); +select repeat('hello', 4294967296); +select repeat('hello', -4294967297); +select repeat('hello', 4294967297); +select repeat('hello', -18446744073709551615); +select repeat('hello', 18446744073709551615); +select repeat('hello', -18446744073709551616); +select repeat('hello', 18446744073709551616); +select repeat('hello', -18446744073709551617); +select repeat('hello', 18446744073709551617); + +select space(-1); +select space(-4294967295); +select space(4294967295); +select space(-4294967296); +select space(4294967296); +select space(-4294967297); +select space(4294967297); +select space(-18446744073709551615); +select space(18446744073709551615); +select space(-18446744073709551616); +select space(18446744073709551616); +select space(-18446744073709551617); +select space(18446744073709551617); + +select rpad('hello', -1, '1'); +select rpad('hello', -4294967295, '1'); +select rpad('hello', 4294967295, '1'); +select rpad('hello', -4294967296, '1'); +select rpad('hello', 4294967296, '1'); +select rpad('hello', -4294967297, '1'); +select rpad('hello', 4294967297, '1'); +select rpad('hello', -18446744073709551615, '1'); +select rpad('hello', 18446744073709551615, '1'); +select rpad('hello', -18446744073709551616, '1'); +select rpad('hello', 18446744073709551616, '1'); +select rpad('hello', -18446744073709551617, '1'); +select rpad('hello', 18446744073709551617, '1'); +select rpad('hello', -1); +select rpad('hello', -4294967295); +select rpad('hello', 4294967295); +select rpad('hello', -4294967296); +select rpad('hello', 4294967296); +select rpad('hello', -4294967297); +select rpad('hello', 4294967297); +select rpad('hello', -18446744073709551615); +select rpad('hello', 18446744073709551615); +select rpad('hello', -18446744073709551616); +select rpad('hello', 18446744073709551616); +select rpad('hello', -18446744073709551617); +select rpad('hello', 18446744073709551617); +select rpad('hello', 0, 'x'); +select rpad('hello', 0); + +select lpad('hello', -1, '1'); +select lpad('hello', -4294967295, '1'); +select lpad('hello', 4294967295, '1'); +select lpad('hello', -4294967296, '1'); +select lpad('hello', 4294967296, '1'); +select lpad('hello', -4294967297, '1'); +select lpad('hello', 4294967297, '1'); +select lpad('hello', -18446744073709551615, '1'); +select lpad('hello', 18446744073709551615, '1'); +select lpad('hello', -18446744073709551616, '1'); +select lpad('hello', 18446744073709551616, '1'); +select lpad('hello', -18446744073709551617, '1'); +select lpad('hello', 18446744073709551617, '1'); +select lpad('hello', -1); +select lpad('hello', -4294967295); +select lpad('hello', 4294967295); +select lpad('hello', -4294967296); +select lpad('hello', 4294967296); +select lpad('hello', -4294967297); +select lpad('hello', 4294967297); +select lpad('hello', -18446744073709551615); +select lpad('hello', 18446744073709551615); +select lpad('hello', -18446744073709551616); +select lpad('hello', 18446744073709551616); +select lpad('hello', -18446744073709551617); +select lpad('hello', 18446744073709551617); +select lpad('hello', 0, 'x'); +select lpad('hello', 0); + +--echo Check parameters count rpad / lpad +--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT +select rpad('x'); +--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT +select rpad('x',2,'.','z'); + +--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT +select lpad('x'); +--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT +select lpad('x',2,'.','z'); + +# +# BUG#17047: CHAR() and IN() can return NULL without signaling NULL +# result +# +SET @orig_sql_mode = @@SQL_MODE; +SET SQL_MODE=traditional; + +SELECT CHAR(0xff,0x8f USING utf8); +SELECT CHAR(0xff,0x8f USING utf8) IS NULL; + +SET SQL_MODE=@orig_sql_mode; + +# +# Bug #24947: problem with some string function with unsigned int parameters +# + +select substring('abc', cast(2 as unsigned int)); +select repeat('a', cast(2 as unsigned int)); +select rpad('abc', cast(5 as unsigned integer), 'x'); +select lpad('abc', cast(5 as unsigned integer), 'x'); +select rpad('abc', cast(5 as unsigned integer)); +select lpad('abc', cast(5 as unsigned integer)); + +# +# Bug#15757: Wrong SUBSTRING() result when a tmp table was employed. +# +create table t1(f1 longtext); +insert into t1 values ("123"),("456"); +select substring(f1,1,1) from t1 group by 1; +create table t2(f1 varchar(3)); +insert into t1 values ("123"),("456"); +select substring(f1,4,1), substring(f1,-4,1) from t2; +drop table t1,t2; + +# +# Bug #25197 :repeat function returns null when using table field directly as count +# + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE `t1` ( + `id` varchar(20) NOT NULL, + `tire` tinyint(3) unsigned NOT NULL, + PRIMARY KEY (`id`) +); + +INSERT INTO `t1` (`id`, `tire`) VALUES ('A', 0), ('B', 1),('C', 2); + +SELECT REPEAT( '#', tire ) AS A, + REPEAT( '#', tire % 999 ) AS B, tire FROM `t1`; + +SELECT REPEAT('0', CAST(0 AS UNSIGNED)); +SELECT REPEAT('0', -2); +SELECT REPEAT('0', 2); + +DROP TABLE t1; + +# +# Bug #26537: UNHEX() IS NULL comparison fails +# +SELECT UNHEX('G'); +SELECT UNHEX('G') IS NULL; + +# +# Bug #26281: INSERT() function mishandles NUL on boundary condition +# +SELECT INSERT('abc', 3, 3, '1234'); +SELECT INSERT('abc', 4, 3, '1234'); +SELECT INSERT('abc', 5, 3, '1234'); +SELECT INSERT('abc', 6, 3, '1234'); + +# +# Bug #27530: Grouping on crc32, or create table select crc32 +# +CREATE TABLE t1 (a INT); +CREATE VIEW v1 AS SELECT CRC32(a) AS C FROM t1; + +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +SELECT CRC32(a), COUNT(*) FROM t1 GROUP BY 1; +SELECT CRC32(a), COUNT(*) FROM t1 GROUP BY 1 ORDER BY 1; +SELECT * FROM (SELECT CRC32(a) FROM t1) t2; +CREATE TABLE t2 SELECT CRC32(a) FROM t1; +desc t2; +SELECT * FROM v1; +SELECT * FROM (SELECT * FROM v1) x; + +DROP TABLE t1, t2; +DROP VIEW v1; + +# +# Bug #27932: LOCATE with argument evaluated to NULL +# + +SELECT LOCATE('foo', NULL) FROM DUAL; +SELECT LOCATE(NULL, 'o') FROM DUAL; +SELECT LOCATE(NULL, NULL) FROM DUAL; +SELECT LOCATE('foo', NULL) IS NULL FROM DUAL; +SELECT LOCATE(NULL, 'o') IS NULL FROM DUAL; +SELECT LOCATE(NULL, NULL) IS NULL FROM DUAL; +SELECT ISNULL(LOCATE('foo', NULL)) FROM DUAL; +SELECT ISNULL(LOCATE(NULL, 'o')) FROM DUAL; +SELECT ISNULL(LOCATE(NULL, NULL)) FROM DUAL; +SELECT LOCATE('foo', NULL) <=> NULL FROM DUAL; +SELECT LOCATE(NULL, 'o') <=> NULL FROM DUAL; +SELECT LOCATE(NULL, NULL) <=> NULL FROM DUAL; + +CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a varchar(10), p varchar(10)); + +INSERT INTO t1 VALUES (1, 'foo', 'o'); +INSERT INTO t1 VALUES (2, 'foo', NULL); +INSERT INTO t1 VALUES (3, NULL, 'o'); +INSERT INTO t1 VALUES (4, NULL, NULL); + +SELECT id, LOCATE(a,p) FROM t1; +SELECT id, LOCATE(a,p) IS NULL FROM t1; +SELECT id, ISNULL(LOCATE(a,p)) FROM t1; +SELECT id, LOCATE(a,p) <=> NULL FROM t1; +SELECT id FROM t1 WHERE LOCATE(a,p) IS NULL; +SELECT id FROM t1 WHERE LOCATE(a,p) <=> NULL; + +DROP TABLE t1; + +# +# Bug #27130: SUBSTR with UNSIGNED 0 as the last argument +# + +SELECT SUBSTR('foo',1,0) FROM DUAL; +SELECT SUBSTR('foo',1,CAST(0 AS SIGNED)) FROM DUAL; +SELECT SUBSTR('foo',1,CAST(0 AS UNSIGNED)) FROM DUAL; + +CREATE TABLE t1 (a varchar(10), len int unsigned); +INSERT INTO t1 VALUES ('bar', 2), ('foo', 0); + +SELECT SUBSTR(a,1,len) FROM t1; + +DROP TABLE t1; + +# +# Bug #28850: Potential bugs related to the return type of the CHAR function +# + +CREATE TABLE t1 AS SELECT CHAR(0x414243) as c1; +SELECT HEX(c1) from t1; +DROP TABLE t1; + +CREATE VIEW v1 AS SELECT CHAR(0x414243) as c1; +SELECT HEX(c1) from v1; +DROP VIEW v1; + +# +# Bug #35558 Wrong server metadata blows up the client +# +create table t1(a float); +insert into t1 values (1.33); +--enable_metadata +select format(a, 2) from t1; +--disable_metadata +drop table t1; + +# +# Bug #41868: crash or memory overrun with concat + upper, date_format functions +# + +CREATE TABLE t1 (c DATE, aa VARCHAR(30)); +INSERT INTO t1 VALUES ('2008-12-31','aaaaaa'); +SELECT DATE_FORMAT(c, GET_FORMAT(DATE, 'eur')) h, CONCAT(UPPER(aa),', ', aa) i FROM t1; +DROP TABLE t1; + + +--echo # +--echo # BUG#44774: load_file function produces valgrind warnings +--echo # +CREATE TABLE t1 (a TINYBLOB); +INSERT INTO t1 VALUES ('aaaaaaaa'); +SELECT LOAD_FILE(a) FROM t1; +DROP TABLE t1; + +# +# Bug#46815 CONCAT_WS returning wrong data +# +CREATE TABLE t1 (f2 VARCHAR(20)); +CREATE TABLE t2 (f2 VARCHAR(20)); + +INSERT INTO t1 VALUES ('MIN'),('MAX'); +INSERT INTO t2 VALUES ('LOAD'); + +SELECT CONCAT_WS('_', (SELECT t2.f2 FROM t2), t1.f2) AS concat_name FROM t1; + +DROP TABLE t1, t2; + + +--echo End of 5.0 tests + +# +# Bug#44358 valgrind errors with decode() function +# +--disable_warnings +drop table if exists t1; +--enable_warnings +create table t1(f1 tinyint default null)engine=myisam; +insert into t1 values (-1),(null); + +set @tmp_optimizer_switch=@@optimizer_switch; +set optimizer_switch='derived_merge=off,derived_with_keys=off'; +explain select 1 as a from t1,(select decode(f1,f1) as b from t1) a; +explain select 1 as a from t1,(select encode(f1,f1) as b from t1) a; +set optimizer_switch=@tmp_optimizer_switch; +drop table t1; + + +--echo # +--echo # Bug#49141: Encode function is significantly slower in 5.1 compared to 5.0 +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings + +CREATE TABLE t1 (a VARCHAR(20), b INT); +CREATE TABLE t2 (a VARCHAR(20), b INT); + +INSERT INTO t1 VALUES ('ABC', 1); +INSERT INTO t2 VALUES ('ABC', 1); + +SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a) + FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b; + +SELECT DECODE((SELECT ENCODE('secret', 'ABC') FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a) + FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b; + +SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), 'ABC') + FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b; + +TRUNCATE TABLE t1; +TRUNCATE TABLE t2; + +INSERT INTO t1 VALUES ('EDF', 3), ('BCD', 2), ('ABC', 1); +INSERT INTO t2 VALUES ('EDF', 3), ('BCD', 2), ('ABC', 1); + +SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b LIMIT 1), t2.a) + FROM t2 WHERE t2.b = 1 GROUP BY t2.b; + +DROP TABLE t1, t2; + +--echo # +--echo # Bug#52164 Assertion failed: param.sort_length, file .\filesort.cc, line 149 +--echo # +CREATE TABLE t1 (a LONGBLOB NOT NULL); +INSERT INTO t1 VALUES (''),(''); +SELECT 1 FROM t1, t1 t2 +ORDER BY QUOTE(t1.a); +DROP TABLE t1; + +--echo # +--echo # Bug#57913 large negative number to string conversion functions crash +--echo # Bug#57810 case/when/then : Assertion failed: length || !scale +--echo # +SELECT '1' IN ('1', SUBSTRING(-9223372036854775809, 1)); +SELECT CONVERT(('' IN (REVERSE(CAST(('') AS DECIMAL)), '')), CHAR(3)); + +--echo # +--echo # Bug#58165: "my_empty_string" gets modified and causes LOAD DATA to fail +--echo # and other crashes +--echo # +CREATE TABLE t1 ( a TEXT ); +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval SELECT 'aaaaaaaaaaaaaa' INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug58165.txt'; +SELECT insert( substring_index( 'a', 'a', 'b' ), 1, 0, 'x' ); +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug58165.txt' INTO TABLE t1; +SELECT * FROM t1; +DROP TABLE t1; + +# +# MDEV-759 lp:998340 - Valgrind complains on simple selects containing expression DAY(FROM_UNIXTIME(-1)) +# +SELECT SUBSTRING('1', DAY(FROM_UNIXTIME(-1))); +SELECT LEFT('1', DAY(FROM_UNIXTIME(-1))); +SELECT RIGHT('1', DAY(FROM_UNIXTIME(-1))); +SELECT REPEAT('1', DAY(FROM_UNIXTIME(-1))); +SELECT RPAD('hi', DAY(FROM_UNIXTIME(-1)),'?'); +SELECT LPAD('hi', DAY(FROM_UNIXTIME(-1)),'?'); +SELECT RPAD('hi', DAY(FROM_UNIXTIME(-1))); +SELECT LPAD('hi', DAY(FROM_UNIXTIME(-1))); + +# +# MDEV-4289 Assertion `0' fails in make_sortkey with GROUP_CONCAT, MAKE_SET, GROUP BY +# +create table t1 (i int); +insert into t1 values (null),(8); +select group_concat( i ), make_set( i, 'a', 'b' ) field from t1 group by field; +drop table t1; + +--echo # +--echo # Bug#11766684 59851: UNINITIALISED VALUE IN ITEM_FUNC_LIKE::SELECT_OPTIMIZE WITH SUBQUERY AND +--echo # + +CREATE TABLE t2(a INT, KEY(a)); +INSERT INTO t2 VALUES (1),(2); +CREATE TABLE t1(b INT, PRIMARY KEY(b)); +INSERT INTO t1 VALUES (0),(254); +SELECT 1 FROM t2 WHERE a LIKE +(SELECT EXPORT_SET(1, b, b, b, b) FROM t1 LIMIT 1); +DROP TABLE t1, t2; + +--echo End of 5.1 tests + +--echo # +--echo # Start of 5.3 tests +--echo # + +--echo # +--echo # Bug#11829861: SUBSTRING_INDEX() RESULTS IN MISSING CHARACTERS WHEN USED +--echo # INSIDE LOWER() +--echo # +SET @user_at_host = 'root@mytinyhost-PC.local'; +SELECT LOWER(SUBSTRING_INDEX(@user_at_host, '@', -1)); +--echo # End of test BUG#11829861 + +--echo # +--echo # Bug#42404: SUBSTRING_INDEX() RESULTS ARE INCONSISTENT +--echo # + +CREATE TABLE t (i INT NOT NULL, c CHAR(255) NOT NULL); +INSERT INTO t VALUES (0,'.www.mysql.com'),(1,'.wwwmysqlcom'); +SELECT i, SUBSTRING_INDEX(c, '.', -2) FROM t WHERE i = 1; +SELECT i, SUBSTRING_INDEX(c, '.', -2) FROM t; +DROP TABLE t; +--echo # End of test BUG#42404 + +--echo # +--echo # End of 5.3 tests +--echo # + + +--echo Start of 5.4 tests +# +# WL#4584 Internationalized number format +# +SELECT format(12345678901234567890.123, 3); +SELECT format(12345678901234567890.123, 3, NULL); +SELECT format(12345678901234567890.123, 3, 'ar_AE'); +SELECT format(12345678901234567890.123, 3, 'ar_SA'); +SELECT format(12345678901234567890.123, 3, 'be_BY'); +SELECT format(12345678901234567890.123, 3, 'de_DE'); +SELECT format(12345678901234567890.123, 3, 'en_IN'); +SELECT format(12345678901234567890.123, 3, 'en_US'); +SELECT format(12345678901234567890.123, 3, 'it_CH'); +SELECT format(12345678901234567890.123, 3, 'ru_RU'); +SELECT format(12345678901234567890.123, 3, 'ta_IN'); + +CREATE TABLE t1 (fmt CHAR(5) NOT NULL); +INSERT INTO t1 VALUES ('ar_AE'); +INSERT INTO t1 VALUES ('ar_SA'); +INSERT INTO t1 VALUES ('be_BY'); +INSERT INTO t1 VALUES ('de_DE'); +INSERT INTO t1 VALUES ('en_IN'); +INSERT INTO t1 VALUES ('en_US'); +INSERT INTO t1 VALUES ('it_CH'); +INSERT INTO t1 VALUES ('ru_RU'); +INSERT INTO t1 VALUES ('ta_IN'); +SELECT fmt, format(12345678901234567890.123, 3, fmt) FROM t1 ORDER BY fmt; +SELECT fmt, format(12345678901234567890.123, 0, fmt) FROM t1 ORDER BY fmt; +SELECT fmt, format(12345678901234567890, 3, fmt) FROM t1 ORDER BY fmt; +SELECT fmt, format(-12345678901234567890, 3, fmt) FROM t1 ORDER BY fmt; +SELECT fmt, format(-02345678901234567890, 3, fmt) FROM t1 ORDER BY fmt; +SELECT fmt, format(-00345678901234567890, 3, fmt) FROM t1 ORDER BY fmt; +SELECT fmt, format(-00045678901234567890, 3, fmt) FROM t1 ORDER BY fmt; +DROP TABLE t1; + +SELECT format(123, 1, 'Non-existent-locale'); + +--echo End of 5.4 tests + +--echo # +--echo # Start of 5.5 tests +--echo # + +--echo # +--echo # Bug#55912 FORMAT with locale set fails for numbers < 1000 +--echo # +SELECT FORMAT(123.33, 2, 'no_NO'), FORMAT(1123.33, 2, 'no_NO'); +SELECT FORMAT(12333e-2, 2, 'no_NO'), FORMAT(112333e-2, 2, 'no_NO'); +CREATE TABLE t1 AS SELECT format(123,2,'no_NO'); +SHOW CREATE TABLE t1; +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # Bug#11764310 conv function crashes, negative argument to memcpy +--echo # +SELECT CONV(1,-2147483648,-2147483648); + +--echo # +--echo # Bug#12985030 SIMPLE QUERY WITH DECIMAL NUMBERS LEAKS MEMORY +--echo # + +SELECT (rpad(1.0,2048,1)) IS NOT FALSE; +SELECT ((+0) IN +((0b111111111111111111111111111111111111111111111111111),(rpad(1.0,2048,1)), +(32767.1))); +SELECT ((rpad(1.0,2048,1)) = ('4(') ^ (0.1)); + +--error 1690 +SELECT +pow((rpad(10.0,2048,1)),(b'1111111111111111111111111111111111111111111')); +SELECT ((rpad(1.0,2048,1)) + (0) ^ ('../')); +SELECT stddev_samp(rpad(1.0,2048,1)); +SELECT ((127.1) not in ((rpad(1.0,2048,1)),(''),(-1.1))); +SELECT ((0xf3) * (rpad(1.0,2048,1)) << (0xcc)); + +--echo # +--echo # Bug#13359121 LARGE NUMBERS, /STRINGS/DTOA.C:662: +--echo # BALLOC: ASSERTION `K <= 15' FAILED. +--echo # Bug#12985021 SIMPLE QUERY WITH DECIMAL NUMBERS TAKE AN +--echo # EXTRAORDINARY LONG TIME TO EXECUTE + +SELECT @tmp_max:= @@global.max_allowed_packet; +SET @@global.max_allowed_packet=1024*1024*1024; +# switching connection to allow the new max_allowed_packet take effect +--connect (newconn, localhost, root,,) + +SELECT @@global.max_allowed_packet; + +do +format(rpad('111111111.1', + 1111111, + '999999999999999999999999999999999999999999'),0,'be_BY') +; + +# +# Originally it was DO instead of SELECT here. +# But in mysqltest --disable_prepare_warnings affects SELECT queries only +# and can't suppress prepare time warnings for DO. +# + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT +round( + concat( ( + coalesce( ( + linefromwkb('2147483648', + -b'1111111111111111111111111111111111111111111')), + ( convert('[.DC2.]',decimal(30,30)) ), + bit_count('') + ) ), + ( lpad( ( elt('01','}:K5')), + sha1('P'), + ( ( select '-9223372036854775808.1' > all (select ''))) + ) + ) + ) +) AS r; + +--connection conn1 +SET @@global.max_allowed_packet:= @tmp_max; +--disconnect newconn +# +# Bug#11765562 58545: +# EXPORT_SET() CAN BE USED TO MAKE ENTIRE SERVER COMPLETELY UNRESPONSIVE +# +SELECT @tmp_max:= @@global.max_allowed_packet; +SET @@global.max_allowed_packet=1024*1024*1024; +SELECT @@global.max_allowed_packet; +SELECT CHAR_LENGTH(EXPORT_SET(1,1,1,REPEAT(1,100000000))); +SET @@global.max_allowed_packet:= @tmp_max; + +--echo # +--echo # MDEV-4272: DIV operator crashes in Item_func_int_div::val_int +--echo # (incorrect NULL value handling by convert) +--echo # +create table t1(a int) select null; +select 1 div convert(a using utf8) from t1; +drop table t1; + +# +# BUG#11757250: REPLACE(...) INSIDE A STORED PROCEDURE. +# +create table t1 (a int); +create table t2 (a int); +create procedure foo (var char(100)) + select replace(var, '00000000', table_name) + from information_schema.tables where table_schema='test'; +--sorted_result +call foo('(( 00000000 ++ 00000000 ))'); +drop procedure foo; +drop table t1,t2; + +# +# Bug#18786138 SHA/MD5 HASHING FUNCTIONS DIE WITH "FILENAME" CHARACTER SET +# +select md5(_filename "a"), sha(_filename "a"); + +--echo # +--echo # MDEV-18881 Assertion `0' failed in make_sortkey upon SELECT with GROUP BY after LOAD DATA +--echo # + +CREATE TABLE t1 (a BIT(22), b CHAR(8) NOT NULL, c CHAR(8)); +INSERT INTO t1 VALUES (0xA4B,'foo','qux'); +INSERT INTO t1 VALUES (0x8F5,'bar','foobar'); +INSERT INTO t1 VALUES (0x0, '', NULL); +INSERT INTO t1 VALUES (0x4B, 'foo','qux'); +INSERT INTO t1 VALUES (0x8F5, 'bar', 'foobar'); +SET SESSION SQL_MODE= ''; +SELECT GROUP_CONCAT(c) AS f FROM t1 GROUP BY LPAD('foo', 20, b); +DROP TABLE t1; +SET SESSION SQL_MODE=DEFAULT; + +CREATE TABLE t1 AS SELECT + LPAD('a',10,' '), + RPAD('a',10,' '), + LPAD('a',10,' '), + RPAD('a',10,' '), + LPAD('a',10,NULL), + RPAD('a',10,NULL), + LPAD('a',10,''), + RPAD('a',10,''), + LPAD('a',10,RAND()), + RPAD('a',10,RAND()); +SHOW CREATE TABLE t1; +DROP TABLE t1; +SET SESSION SQL_MODE= ''; +CREATE TABLE t1 AS SELECT + LPAD('a',10,' '), + RPAD('a',10,' '), + LPAD('a',10,' '), + RPAD('a',10,' '), + LPAD('a',10,NULL), + RPAD('a',10,NULL), + LPAD('a',10,''), + RPAD('a',10,''), + LPAD('a',10,RAND()), + RPAD('a',10,RAND()); +SHOW CREATE TABLE t1; +DROP TABLE t1; +SET SESSION SQL_MODE=DEFAULT; + + +--echo # +--echo # End of 5.5 tests +--echo # + + +--echo # +--echo # Start of 5.6 tests +--echo # + +--echo # +--echo # WL#5510 Functions to_base64 and from_base64 +--echo # +let $1=64; +while($1) +{ + dec $1; + eval CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',$1)) AS to_base64; + SHOW CREATE TABLE t1; + SELECT to_base64, LENGTH(to_base64) FROM t1; + CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1; + SHOW CREATE TABLE t2; + SELECT from_base64, LENGTH(from_base64) FROM t2; + DROP TABLE t2; + DROP TABLE t1; + --echo +} +CREATE TABLE t1 (a VARBINARY(64)); +INSERT INTO t1 VALUES (0x00), (0x0000), (0x000000), (0x00000000); +INSERT INTO t1 VALUES (0x00010203040506070809); +SELECT TO_BASE64(a), hex(a) FROM t1 ORDER BY a; +DROP TABLE t1; + +--echo # +--echo # Test NULL output for NULL input +--echo # +SELECT TO_BASE64(NULL); +SELECT FROM_BASE64(NULL); + +--echo # +--echo # RFC4648 test vectors +--echo # +SELECT @b:= TO_BASE64(''), FROM_BASE64(@b); # "" +SELECT @b:= TO_BASE64('f'), FROM_BASE64(@b); # "Zg==" +SELECT @b:= TO_BASE64('fo'), FROM_BASE64(@b); # "Zm8=" +SELECT @b:= TO_BASE64('foo'), FROM_BASE64(@b); # "Zm9v" +SELECT @b:= TO_BASE64('foob'), FROM_BASE64(@b); # "Zm9vYg==" +SELECT @b:= TO_BASE64('fooba'), FROM_BASE64(@b); # "Zm9vYmE=" +SELECT @b:= TO_BASE64('foobar'), FROM_BASE64(@b); # "Zm9vYmFy" + + +--echo # +--echo # Invalid characters - return NULL +--echo # +SELECT hex(FROM_BASE64('#')); +SELECT hex(FROM_BASE64('A#')); +SELECT hex(FROM_BASE64('AB#')); +SELECT hex(FROM_BASE64('ABC#')); +SELECT hex(FROM_BASE64('ABCD#')); + +--echo # +--echo # "=" is not valid on the first and second positions of a quadruple +--echo # +SELECT hex(FROM_BASE64('=')); +SELECT hex(FROM_BASE64('A=')); +SELECT hex(FROM_BASE64('ABCD=')); +SELECT hex(FROM_BASE64('ABCDE=')); + +--echo # +--echo # Incomplete sequences - return NULL +--echo # +SELECT hex(FROM_BASE64('A')); +SELECT hex(FROM_BASE64('AB')); +SELECT hex(FROM_BASE64('ABC')); + +--echo # +--echo # Unexpected input after pad characters - return NULL +--echo # +SELECT hex(FROM_BASE64('AAA=x')); +SELECT hex(FROM_BASE64('AA==x')); + + +--echo # +--echo # Delimiters are allowed at any position +--echo # +SELECT hex(FROM_BASE64(' A B C D ')); +SELECT hex(FROM_BASE64(' A A = = ')); +SELECT hex(FROM_BASE64(' A A A = ')); +SELECT hex(FROM_BASE64(' A \n B \r C \t D ')); + +--echo # +--echo # Testing that to_base64 respects max_allowed_packet +--echo # +SELECT LENGTH(TO_BASE64(REPEAT('a', @@max_allowed_packet-10))); + +--echo # +--echo # Testing base64 with various data types +--echo # +CREATE TABLE t1 ( + i1 INT, + f1 FLOAT, + dc1 DECIMAL(10,5), + e1 ENUM('enum11','enum12','enum13'), + s1 SET('set1','set2','set3'), + t1 TIME, + d1 DATE, + dt1 DATETIME +); +INSERT INTO t1 VALUES +(-12345, -456.789, 123.45, 'enum13', 'set1,set3', +'01:02:03', '2010-01-01', '2011-01-01 02:03:04'); +SELECT FROM_BASE64(TO_BASE64(i1)) FROM t1; +SELECT FROM_BASE64(TO_BASE64(f1)) FROM t1; +SELECT FROM_BASE64(TO_BASE64(dc1)) FROM t1; +SELECT FROM_BASE64(TO_BASE64(e1)) FROM t1; +SELECT FROM_BASE64(TO_BASE64(s1)) FROM t1; +SELECT FROM_BASE64(TO_BASE64(t1)) FROM t1; +SELECT FROM_BASE64(TO_BASE64(d1)) FROM t1; +SELECT FROM_BASE64(TO_BASE64(dt1)) FROM t1; +DROP TABLE t1; + + +# +# BUG #12735829: SPACE() FUNCTION WARNING REFERS TO REPEAT() IN ER_WARN_ALLOWED_PACKET_OVERFLOWED +# + +SELECT SPACE(@@global.max_allowed_packet*2); + + +# +# BUG #11746123-23637: CHARSET AND COLLATION OF THE FUNCTION SPACE() +# + +SET NAMES latin1; +PREPARE stmt FROM "SELECT COLLATION(space(2))"; +EXECUTE stmt; +SET NAMES latin2; +EXECUTE stmt; + +disconnect conn1; +connection default; +set global max_allowed_packet=default; + +--echo # +--echo # End of 5.6 tests +--echo # + +--echo # +--echo # Start of 10.0 tests +--echo # + +--echo # +--echo # MDEV-12681 Wrong VIEW results for CHAR(0xDF USING latin1) +--echo # + +EXPLAIN EXTENDED SELECT CHAR(0xDF USING latin1); +EXPLAIN EXTENDED SELECT CHAR(0xDF USING `binary`); +EXPLAIN EXTENDED SELECT CHAR(0xDF); + +--echo # +--echo # MDEV-15619 using CONVERT() inside AES_ENCRYPT() in an UPDATE corrupts data +--echo # + +CREATE TABLE t1 ( + id int(11) NOT NULL, + session_id varchar(255) DEFAULT NULL, + directory mediumtext, + checksum int(10) DEFAULT NULL, + last_update datetime DEFAULT NULL, + PRIMARY KEY (id), + KEY lastupdate (last_update) +) DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES (1,'',NULL,38391,'2017-06-24 07:35:28'); +UPDATE t1 SET directory = AES_ENCRYPT(CONVERT('test stringrererejrjerjehrjekhrjkehrjkehrkjehrjkerhkjehrjekrhkjehrkjerhjkehrkjehrkjehrjkehrjkehrjkehrjkerjkehrjkehrjkehrjke rekjhrejrejhrjehgrehjgrhjerjhegrjherejhgrjhegrjehgrjhegrejhrgjehgrjhegrjhegrjhergjhegrjhegrhjegrjerhthkjjkdhjkgdfjkgjkdgdjkfjkhgjkfdhjgjkfdghkjdfghkjfdghfjkdghkdjfghdkjfghfjkdghfkjdghkjfdghfkjdghfkdjghfkjdghfdjkghjkdfhgdfjkghfjkdghfjkdghfjdkghfjkdghkfjdghfkjdghfkjdghkjdfghfjdkghjkfdghkjdfhgjkdfhgjkfdhgkjfdghkfjdhgkjfdgdjkejktjherjthkjrethkjrethjkerthjkerhtjkerhtkjerhtjkerhtjkerhtjkrehtkjerhtkjrehtjkrehtkjrehtkjerhtkjerhtjkrehtkjrehtjkrehtkjrethjkrethkjrehtkjethjkerhtjkrehtjkretkjerhtkjrehtjkerhtjkrehtjrehtkjrekjtrfgdsfgdhjsghjgfdhjsfhjdfgdhjshjdshjfghjdsfgjhsfgjhsdfgjhdsfgjdhsfgsjhfgjhsdfgsdjhfgjdhsfdjshfgdsjhfgjsdhfdjshfgdjhsfgdjshfgjdhsfgjhsdfgjhsdgfjhsdgfjhdsgfjhsgfjhsdgfjhdsgfhjsdehkjthrkjethjkre' USING latin1), '95F5A1F52A554'), last_update= NOW(); +SELECT directory IS NULL FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 ( + id int(11) NOT NULL PRIMARY KEY, + directory mediumtext +) DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES (1,AES_ENCRYPT(CONVERT(REPEAT('a',800) USING latin1),'95F5A1F52A554')); +SELECT AES_DECRYPT(directory,'95F5A1F52A554') FROM t1; +DROP TABLE t1; + +SET @enc=AES_ENCRYPT(REPEAT(_latin1'a',800),'95F5A1F52A554'); +CREATE TABLE t1 ( + id int(11) NOT NULL PRIMARY KEY, + directory mediumtext +) DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES (1,AES_DECRYPT(CONVERT(@enc USING binary),'95F5A1F52A554')); +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # Start of 10.1 tests +--echo # + +--echo # +--echo # MDEV-8369 Unexpected impossible WHERE for a condition on a ZEROFILL field +--echo # +CREATE TABLE t1 (a BIGINT(20) ZEROFILL); +INSERT INTO t1 VALUES (18446744073709551615),(0); +SELECT * FROM t1 WHERE a=18446744073709551615; +SELECT * FROM t1 WHERE FORMAT(a,0)='18,446,744,073,709,551,615'; +SELECT * FROM t1 WHERE a=18446744073709551615 AND FORMAT(a,0)='18,446,744,073,709,551,615'; +# This should not propagate the equality into FORMAT() +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE a=18446744073709551615 AND FORMAT(a,0)='18,446,744,073,709,551,615'; +DROP TABLE t1; + +--echo # +--echo # Bug#58081 Duplicate entry error when doing GROUP BY +--echo # MDEV-9332 Bug after upgrade to 10.1.10 +--echo # +SET NAMES latin1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (0),(0),(1),(0),(0); +SELECT COUNT(*) FROM t1, t1 t2 GROUP BY INSERT('', t2.a, t1.a, @@global.max_binlog_size); +DROP TABLE t1; + +--let func=hex +--source include/func_str_ascii_checksum.inc + +--let func=to_base64 +--source include/func_str_ascii_checksum.inc + +--echo # +--echo # MDEV-10864 Wrong result for WHERE .. (f2=COMPRESS('test') OR f2=COMPRESS('TEST')) +--echo # + +CREATE TABLE t1 (f1 VARCHAR(4), f2 VARCHAR(128), UNIQUE KEY k1 (f1,f2)); +INSERT INTO t1 VALUES ('YQ==',from_base64('YQ==')), ('Yq==', from_base64('Yq==')); +SELECT f1,HEX(f2) FROM t1 ignore index(k1) WHERE f1='YQ==' AND (f2= from_base64("YQ==") OR f2= from_base64("Yq==")); +SELECT f1,HEX(f2) FROM t1 WHERE f1='YQ==' AND (f2= from_base64("YQ==") OR f2= from_base64("Yq==")); +SELECT f1,HEX(f2) FROM t1 WHERE f1='YQ==' AND (f2= from_base64("Yq==") OR f2= from_base64("YQ==")); +DROP TABLE t1; + ++ ++--echo # ++--echo # MDEV-18738 ASAN heap-use-after-free in copy_if_not_alloced / copy_fields ++--echo # ++ ++CREATE TABLE t1 (a INT); ++INSERT INTO t1 VALUES (1),(2); ++SELECT REPLACE( CAST( CURDATE() AS BINARY ), CURDATE(), REPEAT('a',32) ) AS f FROM t1 GROUP BY f; ++DROP TABLE t1; ++ ++CREATE TABLE t1 (a INT); ++INSERT INTO t1 VALUES (1),(2); ++SELECT REPLACE( LEFT( CURDATE(), 4), LEFT(CURDATE(),4), REPEAT('a',32) ) AS f FROM t1 GROUP BY f; ++DROP TABLE t1; ++ ++CREATE TABLE t1 (a INT); ++INSERT INTO t1 VALUES (1),(2); ++SELECT REPLACE(RIGHT(CURDATE(), 4), RIGHT(CURDATE(),4), REPEAT('a',32)) AS f FROM t1 GROUP BY f; ++DROP TABLE t1; ++ ++CREATE TABLE t1 (a INT); ++INSERT INTO t1 VALUES (1),(2); ++SELECT REPLACE(SUBSTR(CURDATE(),2,3), SUBSTR(CURDATE(),2,3), REPEAT('a',32)) AS f FROM t1 GROUP BY f; ++DROP TABLE t1; ++ ++ ++--echo # ++--echo # MDEV-19359 ASAN heap-use-after-free in copy_if_not_alloced / make_sortkey ++--echo # ++ ++CREATE TABLE t1 (a INT, b TIME, c TIME); ++INSERT INTO t1 VALUES (NULL,'22:56:45','22:56:45'),(4,'12:51:42','12:51:42'); ++SELECT REPLACE( BINARY c, a, b ) f FROM t1 GROUP BY f WITH ROLLUP; ++DROP TABLE t1; ++ ++ +--echo # +--echo # End of 10.1 tests +--echo # + + +--echo # +--echo # Start of 10.3 tests +--echo # + +--echo # +--echo # MDEV-12685 Oracle-compatible function CHR() +--echo # +select chr(65); +create database mysqltest1 CHARACTER SET = 'utf8' COLLATE = 'utf8_bin'; +use mysqltest1; +select charset(chr(65)), length(chr(65)),char_length(chr(65)); +select charset(chr(14844588)), length(chr(14844588)),char_length(chr(14844588)); +drop database mysqltest1; +use test; + +--echo # +--echo # MDEV-12592 Illegal mix of collations with the HEX function +--echo # + +SET NAMES utf8; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1); +INSERT INTO t1 VALUES (0x09),('a'); +SELECT IF(a<' ',HEX(a),a) FROM t1 ORDER BY a; +DROP TABLE t1; + +--echo # +--echo # MDEV-12783 sql_mode=ORACLE: Functions LENGTH() and LENGTHB() +--echo # +SELECT LENGTHB('a'), LENGTHB(_utf8 0xC39F), LENGTHB(123), LENGTH(null); +EXPLAIN EXTENDED SELECT LENGTH('a'), LENGTHB('a'); + + +--echo # +--echo # MDEV-13555 Assertion `!item->null_value' failed in Type_handler::Item_send_str +--echo # + +CREATE TABLE t1 (c VARCHAR(8)); +INSERT INTO t1 VALUES (NULL),('bar'); +SELECT LPAD( c, 0, '?' ) FROM t1; +SELECT RPAD( c, 0, '?' ) FROM t1; +DROP TABLE t1; + + +--echo # +--echo # End of 10.3 tests +--echo # diff --cc mysql-test/main/gis.result index 0ee502d8f87,00000000000..fb8919ef061 mode 100644,000000..100644 --- a/mysql-test/main/gis.result +++ b/mysql-test/main/gis.result @@@ -1,4938 -1,0 +1,4964 @@@ +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) NO PRI NULL +g point YES NULL +SHOW FIELDS FROM gis_line; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL +g linestring YES NULL +SHOW FIELDS FROM gis_polygon; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL +g polygon YES NULL +SHOW FIELDS FROM gis_multi_point; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL +g multipoint YES NULL +SHOW FIELDS FROM gis_multi_line; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL +g multilinestring YES NULL +SHOW FIELDS FROM gis_multi_polygon; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL +g multipolygon YES NULL +SHOW FIELDS FROM gis_geometrycollection; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL +g geometrycollection YES NULL +SHOW FIELDS FROM gis_geometry; +Field Type Null Key Default Extra +fid int(11) NO PRI NULL +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(AsWKB(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(AsWKB(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(AsWKB(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(AsWKB(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(AsWKB(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(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))), +(122, GeomFromText('GeometryCollection()')), +(123, GeomFromText('GeometryCollection EMPTY')); +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)) +122 GEOMETRYCOLLECTION EMPTY +123 GEOMETRYCOLLECTION EMPTY +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)) +122 GEOMETRYCOLLECTION EMPTY +123 GEOMETRYCOLLECTION EMPTY +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 +122 0 +123 0 +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 +122 GEOMETRYCOLLECTION +123 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 +122 0 +123 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)) +122 GEOMETRYCOLLECTION EMPTY +123 GEOMETRYCOLLECTION EMPTY +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 filtered Extra +1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 23 100.00 +Warnings: +Note 1003 select st_dimension(`test`.`gis_geometry`.`g`) AS `Dimension(g)`,st_geometrytype(`test`.`gis_geometry`.`g`) AS `GeometryType(g)`,st_isempty(`test`.`gis_geometry`.`g`) AS `IsEmpty(g)`,st_astext(st_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 filtered Extra +1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 100.00 +Warnings: +Note 1003 select st_x(`test`.`gis_point`.`g`) AS `X(g)`,st_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.14213562373095 +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 filtered Extra +1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 100.00 +Warnings: +Note 1003 select st_astext(st_startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint(g))`,st_astext(st_endpoint(`test`.`gis_line`.`g`)) AS `AsText(EndPoint(g))`,st_length(`test`.`gis_line`.`g`) AS `GLength(g)`,st_numpoints(`test`.`gis_line`.`g`) AS `NumPoints(g)`,st_astext(st_pointn(`test`.`gis_line`.`g`,2)) AS `AsText(PointN(g, 2))`,st_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.416666666666668 25.416666666666668) +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 filtered Extra +1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 100.00 +Warnings: +Note 1003 select st_astext(st_centroid(`test`.`gis_polygon`.`g`)) AS `AsText(Centroid(g))`,st_area(`test`.`gis_polygon`.`g`) AS `Area(g)`,st_astext(st_exteriorring(`test`.`gis_polygon`.`g`)) AS `AsText(ExteriorRing(g))`,st_numinteriorrings(`test`.`gis_polygon`.`g`) AS `NumInteriorRings(g)`,st_astext(st_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(57.98031067576927 17.854754130800433) +118 POINT(57.98031067576927 17.854754130800433) +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 +122 0 +123 0 +explain extended SELECT fid, NumGeometries(g) from gis_multi_point; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00 +Warnings: +Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_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) +122 NULL +123 NULL +SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection; +fid AsText(GeometryN(g, 1)) +120 POINT(0 0) +121 POINT(44 6) +122 NULL +123 NULL +explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00 +Warnings: +Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_astext(st_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 1 0 0 0 1 0 +120 122 NULL NULL NULL NULL NULL NULL NULL NULL +120 123 NULL NULL NULL NULL NULL NULL NULL NULL +121 120 0 0 1 0 0 0 1 0 +121 121 1 1 0 1 0 0 1 0 +121 122 NULL NULL NULL NULL NULL NULL NULL NULL +121 123 NULL NULL NULL NULL NULL NULL NULL NULL +122 120 NULL NULL NULL NULL NULL NULL NULL NULL +122 121 NULL NULL NULL NULL NULL NULL NULL NULL +122 122 NULL NULL NULL NULL NULL NULL NULL NULL +122 123 NULL NULL NULL NULL NULL NULL NULL NULL +123 120 NULL NULL NULL NULL NULL NULL NULL NULL +123 121 NULL NULL NULL NULL NULL NULL NULL NULL +123 122 NULL NULL NULL NULL NULL NULL NULL NULL +123 123 NULL NULL NULL NULL NULL NULL NULL NULL +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 filtered Extra +1 SIMPLE g1 ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort +1 SIMPLE g2 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join) +Warnings: +Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,st_within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,st_contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,mbroverlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,st_equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,mbrdisjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,st_touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,mbrintersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,st_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) NO NULL +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 filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select st_astext(st_geometryfromwkb(st_aswkb(st_geometryfromtext('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 filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select st_astext(st_geometryfromwkb(st_aswkb(st_geometryfromtext('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 filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select srid(st_geometryfromtext('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 filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select st_issimple(geometrycollection(point(3,6),point(4,10))) AS `issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,st_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 22003: Cannot get geometry object from data you send to the GEOMETRY field +insert IGNORE into t1 values ('Garbage'); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +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 GeomFromWKB(POINT(1,3)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `GeomFromWKB(POINT(1,3))` geometry DEFAULT 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 1 POINT(115.2970604672862 -36.23335610879993) +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 1 POINT(-114.86854472054372 36.34725218253213) +drop table t1; +create table t1 (fl geometry not null); +insert into t1 values (1); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +insert into t1 values (1.11); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +insert into t1 values ("qwerty"); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +insert into t1 values (pointfromtext('point(1,1)')); +ERROR 23000: Column 'fl' cannot be null +drop table t1; +select (asWKT(geomfromwkb((0x000000000140240000000000004024000000000000)))); +(asWKT(geomfromwkb((0x000000000140240000000000004024000000000000)))) +POINT(10 10) +select (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440)))); +(asWKT(geomfromwkb((0x010100000000000000000024400000000000002440)))) +POINT(10 10) +create table t1 (g GEOMETRY); +select * from t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 g g 255 4294967295 0 Y 144 0 63 +g +select asbinary(g) from t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def asbinary(g) 251 4294967295 0 Y 128 0 63 +asbinary(g) +drop table t1; +create table t1 (a TEXT, b GEOMETRY NOT NULL, SPATIAL KEY(b)); +alter table t1 disable keys; +load data infile '../../std_data/bad_gis_data.dat' into table t1; +ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'b' at row 1 +alter table t1 enable keys; +drop table t1; +create table t1 (a int, b blob); +insert into t1 values (1, ''), (2, NULL), (3, '1'); +select * from t1; +a b +1 +2 NULL +3 1 +select +geometryfromtext(b) IS NULL, geometryfromwkb(b) IS NULL, astext(b) IS NULL, +aswkb(b) IS NULL, geometrytype(b) IS NULL, centroid(b) IS NULL, +envelope(b) IS NULL, startpoint(b) IS NULL, endpoint(b) IS NULL, +exteriorring(b) IS NULL, pointn(b, 1) IS NULL, geometryn(b, 1) IS NULL, +interiorringn(b, 1) IS NULL, multipoint(b) IS NULL, isempty(b) IS NULL, +issimple(b) IS NULL, isclosed(b) IS NULL, dimension(b) IS NULL, +numgeometries(b) IS NULL, numinteriorrings(b) IS NULL, numpoints(b) IS NULL, +area(b) IS NULL, glength(b) IS NULL, srid(b) IS NULL, x(b) IS NULL, +y(b) IS NULL +from t1; +ERROR 22007: Illegal non geometric '`test`.`t1`.`b`' value found during parsing +select +within(b, b) IS NULL, contains(b, b) IS NULL, overlaps(b, b) IS NULL, +equals(b, b) IS NULL, disjoint(b, b) IS NULL, touches(b, b) IS NULL, +intersects(b, b) IS NULL, crosses(b, b) IS NULL +from t1; +within(b, b) IS NULL contains(b, b) IS NULL overlaps(b, b) IS NULL equals(b, b) IS NULL disjoint(b, b) IS NULL touches(b, b) IS NULL intersects(b, b) IS NULL crosses(b, b) IS NULL +1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 +select +point(b, b) IS NULL, linestring(b) IS NULL, polygon(b) IS NULL, multipoint(b) IS NULL, +multilinestring(b) IS NULL, multipolygon(b) IS NULL, +geometrycollection(b) IS NULL +from t1; +ERROR 22007: Illegal non geometric '`test`.`t1`.`b`' value found during parsing +drop table t1; +CREATE TABLE t1(a POINT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (NULL); +SELECT * FROM t1; +a +NULL +DROP TABLE t1; +CREATE TABLE `t1` ( `col9` set('a'), `col89` date); +INSERT INTO `t1` VALUES ('','0000-00-00'); +select geomfromtext(col9,col89) as a from t1; +a +NULL +DROP TABLE t1; +CREATE TABLE t1 ( +geomdata polygon NOT NULL, +SPATIAL KEY index_geom (geomdata) +) ENGINE=MyISAM DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED; +CREATE TABLE t2 ( +geomdata polygon NOT NULL, +SPATIAL KEY index_geom (geomdata) +) ENGINE=MyISAM DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED; +CREATE TABLE t3 +select +aswkb(ws.geomdata) AS geomdatawkb +from +t1 ws +union +select +aswkb(ws.geomdata) AS geomdatawkb +from +t2 ws; +describe t3; +Field Type Null Key Default Extra +geomdatawkb longblob YES NULL +drop table t1; +drop table t2; +drop table t3; +create table t1(col1 geometry default null,col15 geometrycollection not +null,spatial index(col15),index(col1(15)))engine=myisam; +insert into t1 set col15 = GeomFromText('POINT(6 5)'); +insert into t1 set col15 = GeomFromText('POINT(6 5)'); +check table t1 extended; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; +End of 4.1 tests +create table t1 (s1 geometry not null,s2 char(100)); +create trigger t1_bu before update on t1 for each row set new.s1 = null; +insert into t1 values (null,null); +ERROR 23000: Column 's1' cannot be null +drop table t1; +drop procedure if exists fn3; +create function fn3 () returns point deterministic return GeomFromText("point(1 1)"); +show create function fn3; +Function sql_mode Create Function character_set_client collation_connection Database Collation +fn3 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS point + DETERMINISTIC +return GeomFromText("point(1 1)") latin1 latin1_swedish_ci latin1_swedish_ci +select astext(fn3()); +astext(fn3()) +POINT(1 1) +drop function fn3; +create table t1(pt POINT); +alter table t1 add primary key pti(pt); +drop table t1; +create table t1(pt GEOMETRY); +alter table t1 add primary key pti(pt); +ERROR 42000: BLOB/TEXT column 'pt' used in key specification without a key length +alter table t1 add primary key pti(pt(20)); +drop table t1; +create table t1 select GeomFromText('point(1 1)'); +desc t1; +Field Type Null Key Default Extra +GeomFromText('point(1 1)') geometry YES NULL +drop table t1; +create table t1 (g geometry not null); +insert into t1 values(default); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +drop table t1; +CREATE TABLE t1 (a GEOMETRY); +CREATE VIEW v1 AS SELECT GeomFromwkb(ASBINARY(a)) FROM t1; +CREATE VIEW v2 AS SELECT a FROM t1; +DESCRIBE v1; +Field Type Null Key Default Extra +GeomFromwkb(ASBINARY(a)) geometry YES NULL +DESCRIBE v2; +Field Type Null Key Default Extra +a geometry YES NULL +DROP VIEW v1,v2; +DROP TABLE t1; +create table t1 (name VARCHAR(100), square GEOMETRY); +INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))')); +INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))')); +INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))')); +INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))')); +INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))')); +INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))')); +INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))')); +INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))')); +INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))')); +INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))')); +INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))')); +INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))')); +INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))')); +INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))')); +INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))')); +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrcontains +center,small +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrdisjoint +down3,left3,right3,up3 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrequal +center +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrintersect +big,center,down,down2,left,left2,right,right2,small,up,up2 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbroverlaps +down,left,right,up +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrtouches +down2,left2,right2,up2 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +mbrwithin +big,center +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +contains +center,small +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +disjoint +down3,left3,right3,up3 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +equals +center +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersects FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +intersects +big,center,down,down2,left,left2,right,right2,small,up,up2 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +overlaps +down,left,right,up +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +touches +down2,left2,right2,up2 +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +within +big,center +SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))'); +SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))'); +SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))'); +SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))'); +SET @point1 = GeomFromText('POLYGON ((0 0))'); +SET @point2 = GeomFromText('POLYGON ((-2 0))'); +SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name; +overlaps +SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name; +overlaps +SELECT Overlaps(@horiz1, @vert1) FROM DUAL; +Overlaps(@horiz1, @vert1) +0 +SELECT Overlaps(@horiz1, @horiz2) FROM DUAL; +Overlaps(@horiz1, @horiz2) +1 +SELECT Overlaps(@horiz1, @horiz3) FROM DUAL; +Overlaps(@horiz1, @horiz3) +0 +SELECT Overlaps(@horiz1, @point1) FROM DUAL; +Overlaps(@horiz1, @point1) +0 +SELECT Overlaps(@horiz1, @point2) FROM DUAL; +Overlaps(@horiz1, @point2) +0 +DROP TABLE t1; +create table t1(f1 geometry, f2 linestring, f3 linestring); +select f1 from t1 union select f1 from t1; +f1 +insert into t1 (f2,f3) values (GeomFromText('LINESTRING(1 1, 2 2)'), +GeomFromText('LINESTRING(0 0,1 1,2 2)')); +select AsText(f2),AsText(f3) from t1; +AsText(f2) AsText(f3) +LINESTRING(1 1,2 2) LINESTRING(0 0,1 1,2 2) +select AsText(a) from (select f2 as a from t1 union select f3 from t1) t; +AsText(a) +LINESTRING(1 1,2 2) +LINESTRING(0 0,1 1,2 2) +create table t2 as select f2 as a from t1 union select f3 from t1; +desc t2; +Field Type Null Key Default Extra +a linestring YES NULL +select AsText(a) from t2; +AsText(a) +LINESTRING(1 1,2 2) +LINESTRING(0 0,1 1,2 2) +drop table t1, t2; +SELECT 1; +1 +1 +CREATE TABLE t1 (p POINT); +CREATE TABLE t2 (p POINT, INDEX(p)); +INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)')); +INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)')); +SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +1 +EXPLAIN +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 system p NULL NULL NULL 1 +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +1 +INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)')); +INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)')); +EXPLAIN +SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +2 +EXPLAIN +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ref p p 28 const # Using where +SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +2 +EXPLAIN +SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where +SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); +COUNT(*) +2 +DROP TABLE t1, t2; +End of 5.0 tests +# +# Test for bug #58650 "Failing assertion: primary_key_no == -1 || +# primary_key_no == 0". +# +drop table if exists t1; +# The minimal test case. +create table t1 (a int not null, b linestring not null, unique key b (b(12)), unique key a (a)); +drop table t1; +# The original test case. +create table t1 (a int not null, b linestring not null, unique key b (b(12))); +create unique index a on t1(a); +drop table t1; +create table `t1` (`col002` point)engine=myisam; +insert into t1 values (),(),(); +select min(`col002`) from t1 union select `col002` from t1; +min(`col002`) +NULL +drop table t1; +# +# Bug #47780: crash when comparing GIS items from subquery +# +CREATE TABLE t1(a INT, b MULTIPOLYGON); +INSERT INTO t1 VALUES +(0, +GEOMFROMTEXT( +'multipolygon(((1 2,3 4,5 6,7 8,9 8),(7 6,5 4,3 2,1 2,3 4)))')); +# must not crash +SELECT 1 FROM t1 WHERE a <> (SELECT GEOMETRYCOLLECTIONFROMWKB(b) FROM t1); +ERROR HY000: Illegal parameter data types int and geometry for operation '<>' +DROP TABLE t1; +# +# Bug #49250 : spatial btree index corruption and crash +# Part one : spatial syntax check +# +CREATE TABLE t1(col1 MULTIPOLYGON NOT NULL, +SPATIAL INDEX USING BTREE (col1)); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USING BTREE (col1))' at line 2 +CREATE TABLE t2(col1 MULTIPOLYGON NOT NULL); +CREATE SPATIAL INDEX USING BTREE ON t2(col); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USING BTREE ON t2(col)' at line 1 +ALTER TABLE t2 ADD SPATIAL INDEX USING BTREE (col1); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USING BTREE (col1)' at line 1 +DROP TABLE t2; +End of 5.0 tests +create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime); +create view v1 as select * from t1; +desc v1; +Field Type Null Key Default Extra +f1 tinyint(1) YES NULL +f2 char(1) YES NULL +f3 varchar(1) YES NULL +f4 geometry YES NULL +f5 datetime YES NULL +drop view v1; +drop table t1; +SELECT MultiPoint(12345,''); +ERROR HY000: Illegal parameter data type int for operation 'geometrycollection' +SELECT 1 FROM (SELECT GREATEST(1,GEOMETRYCOLLECTION('00000','00000')) b FROM DUAL) AS d WHERE (LINESTRING(d.b)); +ERROR HY000: Illegal parameter data type varchar for operation 'geometrycollection' +# +# BUG#51875: crash when loading data into geometry function polyfromwkb +# +SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; +SET @a=POLYFROMWKB(@a); +SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; +SET @a=POLYFROMWKB(@a); +create table t1(a geometry NOT NULL)engine=myisam; +insert into t1 values (geomfromtext("point(0 1)")); +insert into t1 values (geomfromtext("point(1 0)")); +select * from (select polygon(t1.a) as p from t1 order by t1.a) d; +p +NULL +NULL +drop table t1; +# +# Test for bug #59888 "debug assertion when attempt to create spatial index +# on char > 31 bytes". +# +create table t1(a char(32) not null) engine=myisam; +create spatial index i on t1 (a); +ERROR HY000: Incorrect arguments to SPATIAL INDEX +drop table t1; +CREATE TABLE t0 (a BINARY(32) NOT NULL); +CREATE SPATIAL INDEX i on t0 (a); +ERROR HY000: Incorrect arguments to SPATIAL INDEX +INSERT INTO t0 VALUES (1); +CREATE TABLE t1( +col0 BINARY NOT NULL, +col2 TIMESTAMP, +SPATIAL INDEX i1 (col0) +) ENGINE=MyISAM; +ERROR HY000: Incorrect arguments to SPATIAL INDEX +CREATE TABLE t1 ( +col0 BINARY NOT NULL, +col2 TIMESTAMP +) ENGINE=MyISAM; +CREATE SPATIAL INDEX idx0 ON t1(col0); +ERROR HY000: Incorrect arguments to SPATIAL INDEX +ALTER TABLE t1 ADD SPATIAL INDEX i1 (col0); +ERROR HY000: Incorrect arguments to SPATIAL INDEX +CREATE TABLE t2 ( +col0 INTEGER NOT NULL, +col1 POINT, +col2 POINT +); +CREATE SPATIAL INDEX idx0 ON t2 (col1, col2); +ERROR HY000: Incorrect arguments to SPATIAL INDEX +CREATE TABLE t3 ( +col0 INTEGER NOT NULL, +col1 POINT, +col2 LINESTRING, +SPATIAL INDEX i1 (col1, col2) +); +ERROR HY000: Incorrect arguments to SPATIAL INDEX +DROP TABLE t0, t1, t2; +# +# BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS +# +SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20))); +ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20))) +-1 +# +# BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN +# GEOMETRY FUNCTION ARGUMENTS +# +SELECT GEOMETRYCOLLECTION((SELECT @@OLD)); +ERROR HY000: Illegal parameter data type bigint for operation 'geometrycollection' +# +# MDEV-4252 geometry query crashes server +# +select astext(0x0100000000030000000100000000000010); +astext(0x0100000000030000000100000000000010) +NULL +select astext(st_centroid(0x0100000000030000000100000000000010)); +astext(st_centroid(0x0100000000030000000100000000000010)) +NULL +select astext(st_exteriorring(0x0100000000030000000100000000000010)); +astext(st_exteriorring(0x0100000000030000000100000000000010)) +NULL +select envelope(0x0100000000030000000100000000000010); +envelope(0x0100000000030000000100000000000010) +NULL +select geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1); +geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1) +NULL +select geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1); +geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1) +NULL +# +# MDEV-4296 Assertion `n_linear_rings > 0' fails in Gis_polygon::centroid_xy +# +SELECT Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) ))); +Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) ))) +NULL +# +# MDEV-4295 Server crashes in get_point on a query with Area, AsBinary, MultiPoint +# +SELECT Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2)))); +Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2)))) +NULL +End of 5.1 tests +select ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))')); +ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))')) +1.5 +select ST_LENGTH(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 100 30, 20 30), POINT(3 3), LINESTRING(20 20, 30 20))')); +ST_LENGTH(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 100 30, 20 30), POINT(3 3), LINESTRING(20 20, 30 20))')) +160 +DROP DATABASE IF EXISTS gis_ogs; +CREATE DATABASE gis_ogs; +USE gis_ogs; +# +# C.3.3.1 Geometry types and functions schema construction +# +CREATE TABLE lakes ( +fid INTEGER NOT NULL PRIMARY KEY, +name CHARACTER VARYING(64), +shore POLYGON); +CREATE TABLE road_segments ( +fid INTEGER NOT NULL PRIMARY KEY, +name CHARACTER VARYING(64), +aliases CHARACTER VARYING(64), +num_lanes INTEGER, +centerline LINESTRING); +CREATE TABLE divided_routes ( +fid INTEGER NOT NULL PRIMARY KEY, +name CHARACTER VARYING(64), +num_lanes INTEGER, +centerlines MULTILINESTRING); +CREATE TABLE forests ( +fid INTEGER NOT NULL PRIMARY KEY, +name CHARACTER VARYING(64), +boundary MULTIPOLYGON); +CREATE TABLE bridges ( +fid INTEGER NOT NULL PRIMARY KEY, +name CHARACTER VARYING(64), +position POINT); +CREATE TABLE streams ( +fid INTEGER NOT NULL PRIMARY KEY, +name CHARACTER VARYING(64), +centerline LINESTRING); +CREATE TABLE buildings ( +fid INTEGER NOT NULL PRIMARY KEY, +address CHARACTER VARYING(64), +position POINT, +footprint POLYGON); +CREATE TABLE ponds ( +fid INTEGER NOT NULL PRIMARY KEY, +name CHARACTER VARYING(64), +type CHARACTER VARYING(64), +shores MULTIPOLYGON); +CREATE TABLE named_places ( +fid INTEGER NOT NULL PRIMARY KEY, +name CHARACTER VARYING(64), +boundary POLYGON); +CREATE TABLE map_neatlines ( +fid INTEGER NOT NULL PRIMARY KEY, +neatline POLYGON); +# +# C.3.3.2 Geometry types and functions schema data loading +# +# Lakes +INSERT INTO lakes VALUES ( +101, 'BLUE LAKE', +PolyFromText( +'POLYGON( +(52 18,66 23,73 9,48 6,52 18), +(59 18,67 18,67 13,59 13,59 18) +)', +101)); +# Road Segments +INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2, +LineFromText( +'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101)); +INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4, +LineFromText( +'LINESTRING( 44 31, 56 34, 70 38 )' ,101)); +INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2, +LineFromText( +'LINESTRING( 70 38, 72 48 )' ,101)); +INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4, +LineFromText( +'LINESTRING( 70 38, 84 42 )' ,101)); +INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL, +1, +LineFromText( +'LINESTRING( 28 26, 28 0 )',101)); +# DividedRoutes +INSERT INTO divided_routes VALUES(119, 'Route 75', 4, +MLineFromText( +'MULTILINESTRING((10 48,10 21,10 0), +(16 0,16 23,16 48))', 101)); +# Forests +INSERT INTO forests VALUES(109, 'Green Forest', +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)))', +101)); +# Bridges +INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText( +'POINT( 44 31 )', 101)); +# Streams +INSERT INTO streams VALUES(111, 'Cam Stream', +LineFromText( +'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101)); +INSERT INTO streams VALUES(112, NULL, +LineFromText( +'LINESTRING( 76 0, 78 4, 73 9 )', 101)); +# Buildings +INSERT INTO buildings VALUES(113, '123 Main Street', +PointFromText( +'POINT( 52 30 )', 101), +PolyFromText( +'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101)); +INSERT INTO buildings VALUES(114, '215 Main Street', +PointFromText( +'POINT( 64 33 )', 101), +PolyFromText( +'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101)); +# Ponds +INSERT INTO ponds VALUES(120, NULL, 'Stock Pond', +MPolyFromText( +'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ), +( ( 26 44, 26 40, 28 42, 26 44) ) )', 101)); +# Named Places +INSERT INTO named_places VALUES(117, 'Ashton', +PolyFromText( +'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101)); +INSERT INTO named_places VALUES(118, 'Goose Island', +PolyFromText( +'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101)); +# Map Neatlines +INSERT INTO map_neatlines VALUES(115, +PolyFromText( +'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101)); +# +# C.3.3.3 Geometry types and functions schema test queries + +# Conformance Item T6 +SELECT Dimension(shore) +FROM lakes +WHERE name = 'Blue Lake'; +Dimension(shore) +2 +# Conformance Item T7 +SELECT GeometryType(centerlines) +FROM divided_routes +WHERE name = 'Route 75'; +GeometryType(centerlines) +MULTILINESTRING +# Conformance Item T8 +SELECT AsText(boundary) +FROM named_places +WHERE name = 'Goose Island'; +AsText(boundary) +POLYGON((67 13,67 18,59 18,59 13,67 13)) +# Conformance Item T9 +SELECT AsText(PolyFromWKB(AsBinary(boundary),101)) +FROM named_places +WHERE name = 'Goose Island'; +AsText(PolyFromWKB(AsBinary(boundary),101)) +POLYGON((67 13,67 18,59 18,59 13,67 13)) +# Conformance Item T10 +SELECT SRID(boundary) +FROM named_places +WHERE name = 'Goose Island'; +SRID(boundary) +101 +# Conformance Item T11 +SELECT IsEmpty(centerline) +FROM road_segments +WHERE name = 'Route 5' +AND aliases = 'Main Street'; +IsEmpty(centerline) +0 +# Conformance Item T12 +SELECT IsSimple(shore) +FROM lakes +WHERE name = 'Blue Lake'; +IsSimple(shore) +1 +# Conformance Item T13 +SELECT AsText(ST_Boundary(boundary)) +FROM named_places +WHERE name = 'Goose Island'; +AsText(ST_Boundary(boundary)) +LINESTRING(67 13,67 18,59 18,59 13,67 13) +# Conformance Item T14 +SELECT AsText(Envelope(boundary)) +FROM named_places +WHERE name = 'Goose Island'; +AsText(Envelope(boundary)) +POLYGON((59 13,67 13,67 18,59 18,59 13)) +# Conformance Item T15 +SELECT X(position) +FROM bridges +WHERE name = 'Cam Bridge'; +X(position) +44 +# Conformance Item T16 +SELECT Y(position) +FROM bridges +WHERE name = 'Cam Bridge'; +Y(position) +31 +# Conformance Item T17 +SELECT AsText(StartPoint(centerline)) +FROM road_segments +WHERE fid = 102; +AsText(StartPoint(centerline)) +POINT(0 18) +# Conformance Item T18 +SELECT AsText(EndPoint(centerline)) +FROM road_segments +WHERE fid = 102; +AsText(EndPoint(centerline)) +POINT(44 31) +SELECT IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) +FROM named_places +WHERE name = 'Goose Island'; +IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) +1 +# Conformance Item T20 +SELECT IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) +FROM named_places +WHERE name = 'Goose Island'; +IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) +1 +# Conformance Item T21 +SELECT GLength(centerline) +FROM road_segments +WHERE fid = 106; +GLength(centerline) +26 +# Conformance Item T22 +SELECT NumPoints(centerline) +FROM road_segments +WHERE fid = 102; +NumPoints(centerline) +5 +# Conformance Item T23 +SELECT AsText(PointN(centerline, 1)) +FROM road_segments +WHERE fid = 102; +AsText(PointN(centerline, 1)) +POINT(0 18) +# Conformance Item T24 +SELECT AsText(Centroid(boundary)) +FROM named_places +WHERE name = 'Goose Island'; +AsText(Centroid(boundary)) +POINT(63 15.5) +SELECT ST_Contains(boundary, PointOnSurface(boundary)) +FROM named_places +WHERE name = 'Goose Island'; +ST_Contains(boundary, PointOnSurface(boundary)) +1 +# Conformance Item T26 +SELECT Area(boundary) +FROM named_places +WHERE name = 'Goose Island'; +Area(boundary) +40 +# Conformance Item T27 +SELECT AsText(ExteriorRing(shore)) +FROM lakes +WHERE name = 'Blue Lake'; +AsText(ExteriorRing(shore)) +LINESTRING(52 18,66 23,73 9,48 6,52 18) +# Conformance Item T28 +SELECT NumInteriorRings(shore) +FROM lakes +WHERE name = 'Blue Lake'; +NumInteriorRings(shore) +1 +# Conformance Item T29 +SELECT AsText(InteriorRingN(shore, 1)) +FROM lakes +WHERE name = 'Blue Lake'; +AsText(InteriorRingN(shore, 1)) +LINESTRING(59 18,67 18,67 13,59 13,59 18) +# Conformance Item T30 +SELECT NumGeometries(centerlines) +FROM divided_routes +WHERE name = 'Route 75'; +NumGeometries(centerlines) +2 +# Conformance Item T31 +SELECT AsText(GeometryN(centerlines, 2)) +FROM divided_routes +WHERE name = 'Route 75'; +AsText(GeometryN(centerlines, 2)) +LINESTRING(16 0,16 23,16 48) +# Conformance Item T32 +SELECT IsClosed(centerlines) +FROM divided_routes +WHERE name = 'Route 75'; +IsClosed(centerlines) +0 +# Conformance Item T33 +SELECT GLength(centerlines) +FROM divided_routes +WHERE name = 'Route 75'; +GLength(centerlines) +96 +# Conformance Item T34 +SELECT AsText(Centroid(shores)) +FROM ponds +WHERE fid = 120; +AsText(Centroid(shores)) +POINT(25 42) +# Conformance Item T35 +SELECT Contains(shores, PointOnSurface(shores)) +FROM ponds +WHERE fid = 120; +Contains(shores, PointOnSurface(shores)) +1 +# Conformance Item T36 +SELECT Area(shores) +FROM ponds +WHERE fid = 120; +Area(shores) +8 +# Conformance Item T37 +SELECT ST_Equals(boundary, +PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) +FROM named_places +WHERE name = 'Goose Island'; +ST_Equals(boundary, +PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) +1 +# Conformance Item T38 +SELECT ST_Disjoint(centerlines, boundary) +FROM divided_routes, named_places +WHERE divided_routes.name = 'Route 75' +AND named_places.name = 'Ashton'; +ST_Disjoint(centerlines, boundary) +1 +# Conformance Item T39 +SELECT ST_Touches(centerline, shore) +FROM streams, lakes +WHERE streams.name = 'Cam Stream' +AND lakes.name = 'Blue Lake'; +ST_Touches(centerline, shore) +1 +# Conformance Item T40 +SELECT ST_Within(footprint, boundary) +FROM named_places, buildings +WHERE named_places.name = 'Ashton' +AND buildings.address = '215 Main Street'; +ST_Within(footprint, boundary) +1 +# Conformance Item T41 +SELECT ST_Overlaps(forests.boundary, named_places.boundary) +FROM forests, named_places +WHERE forests.name = 'Green Forest' +AND named_places.name = 'Ashton'; +ST_Overlaps(forests.boundary, named_places.boundary) +1 +# Conformance Item T42 +SELECT Crosses(road_segments.centerline, divided_routes.centerlines) +FROM road_segments, divided_routes +WHERE road_segments.fid = 102 +AND divided_routes.name = 'Route 75'; +Crosses(road_segments.centerline, divided_routes.centerlines) +1 +# Conformance Item T43 +SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines) +FROM road_segments, divided_routes +WHERE road_segments.fid = 102 +AND divided_routes.name = 'Route 75'; +ST_Intersects(road_segments.centerline, divided_routes.centerlines) +1 +# Conformance Item T44 +SELECT ST_Contains(forests.boundary, named_places.boundary) +FROM forests, named_places +WHERE forests.name = 'Green Forest' +AND named_places.name = 'Ashton'; +ST_Contains(forests.boundary, named_places.boundary) +0 +# Conformance Item T45 +SELECT ST_Relate(forests.boundary, named_places.boundary, 'TTTTTTTTT') +FROM forests, named_places +WHERE forests.name = 'Green Forest' +AND named_places.name = 'Ashton'; +ST_Relate(forests.boundary, named_places.boundary, 'TTTTTTTTT') +1 +# Conformance Item T46 +SELECT ST_Distance(position, boundary) +FROM bridges, named_places +WHERE bridges.name = 'Cam Bridge' +AND named_places.name = 'Ashton'; +ST_Distance(position, boundary) +12 +# Conformance Item T47 +SELECT AsText(ST_Intersection(centerline, shore)) +FROM streams, lakes +WHERE streams.name = 'Cam Stream' +AND lakes.name = 'Blue Lake'; +AsText(ST_Intersection(centerline, shore)) +POINT(52 18) +# Conformance Item T48 +SELECT AsText(ST_Difference(named_places.boundary, forests.boundary)) +FROM named_places, forests +WHERE named_places.name = 'Ashton' +AND forests.name = 'Green Forest'; +AsText(ST_Difference(named_places.boundary, forests.boundary)) +POLYGON((56 34,62 48,84 48,84 42,56 34)) +SELECT AsText(ST_Union(shore, boundary)) +FROM lakes, named_places +WHERE lakes.name = 'Blue Lake' +AND named_places.name = 'Goose Island'; +AsText(ST_Union(shore, boundary)) +POLYGON((48 6,52 18,66 23,73 9,48 6)) +# Conformance Item T50 +SELECT AsText(ST_SymDifference(shore, boundary)) +FROM lakes, named_places +WHERE lakes.name = 'Blue Lake' +AND named_places.name = 'Ashton'; +AsText(ST_SymDifference(shore, boundary)) +MULTIPOLYGON(((48 6,52 18,66 23,73 9,48 6),(59 13,59 18,67 18,67 13,59 13)),((56 30,56 34,62 48,84 48,84 30,56 30))) +# Conformance Item T51 +SELECT count(*) +FROM buildings, bridges +WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1; +count(*) +1 +# Conformance Item T52 +SELECT AsText(ConvexHull(shore)) +FROM lakes +WHERE lakes.name = 'Blue Lake'; +AsText(ConvexHull(shore)) +POLYGON((48 6,52 18,66 23,73 9,48 6)) +DROP DATABASE gis_ogs; +USE test; +# +# BUG #1043845 st_distance() results are incorrect depending on variable order +# +select st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461, + -95.9673057475387 36.1344478941074, + -95.9673063519371 36.134484524621, + -95.9673049102515 36.1343976584193)'), +geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)')) ; +st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461, + -95.9673057475387 36.1344478941074, + -95.9673063519371 36.134484524621, + +0.008148695928146028 +select st_distance(geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)'), +geomfromtext('LINESTRING(-95.9673005697771 36.13509598461, + -95.9673057475387 36.1344478941074, + -95.9673063519371 36.134484524621, + -95.9673049102515 36.1343976584193) ')) ; +st_distance(geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)'), +geomfromtext('LINESTRING(-95.9673005697771 36.13509598461, + -95.9673057475387 36.1344478941074, + -95.9673063519371 36. +0.008148695928146028 +# +# MDEV-4310 geometry function equals hangs forever. +# +create table t1(a geometry not null)engine=myisam; +insert into t1 values(geomfromtext("POINT(0 0)")); +insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)")); +insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)")); +select equals(`a`,convert(`a` using utf8)) from `t1`; +ERROR HY000: Illegal parameter data type longblob for operation 'st_equals' +select equals(`a`,left(`a`,23)) from `t1`; +equals(`a`,left(`a`,23)) +NULL +NULL +NULL +drop table t1; +# +# MDEV-6883 ST_WITHIN crashes server if (0,0) is matched to POLYGON((0 0)) +# +select st_within(GeomFromText('Polygon((0 0))'), Point(0,0)); +st_within(GeomFromText('Polygon((0 0))'), Point(0,0)) +1 +End of 5.3 tests +# +# Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE +# +CREATE TABLE g1 +(a geometry NOT NULL, UNIQUE KEY i (a(151))) engine=myisam; +INSERT INTO g1 VALUES (geomfromtext('point(1 1)')); +INSERT INTO g1 VALUES (geomfromtext('point(1 2)')); +FLUSH TABLES; +SELECT 1 FROM g1 +FORCE INDEX(i) WHERE a = date_sub(now(), interval 2808.4 year_month) +; +ERROR HY000: Illegal parameter data types geometry and datetime for operation '=' +DROP TABLE g1; +# +# Bug#13013970 MORE CRASHES IN FIELD_BLOB::GET_KEY_IMAGE +# +CREATE TABLE g1(a TEXT NOT NULL, KEY(a(255))); +INSERT INTO g1 VALUES ('a'),('a'); +SELECT 1 FROM g1 WHERE a >= ANY +(SELECT 1 FROM g1 WHERE a = geomfromtext('') OR a) ; +1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'a' +DROP TABLE g1; +# +# Bug#16451878 GEOMETRY QUERY CRASHES SERVER +# +# should not crash +SELECT ASTEXT(0x0100000000030000000100000000000010); +ASTEXT(0x0100000000030000000100000000000010) +NULL +#should not crash +SELECT ENVELOPE(0x0100000000030000000100000000000010); +ENVELOPE(0x0100000000030000000100000000000010) +NULL +#should not crash +SELECT +GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffff0000, 1); +GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffff0000, 1) +NULL +#should not crash +SELECT +GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1); +GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1) +NULL +# +# MDEV-3819 missing constraints for spatial column types +# +create table t1 (pt point); +insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))')); +ERROR 22007: Incorrect POINT value: 'POLYGON' for column `test`.`t1`.`pt` at row 1 +drop table t1; +SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100)); +st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100)) +GEOMETRYCOLLECTION EMPTY +CREATE VIEW v1 AS SELECT POINT(1,1) AS p; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select point(1,1) AS `p` latin1 latin1_swedish_ci +SELECT ASTEXT(p) FROM v1; +ASTEXT(p) +POINT(1 1) +DROP VIEW v1; +# +# Start of 10.0 tests +# +# +# MDEV-12495 Conditional jump depends on uninitialised value for: SELECT NULL UNION geom_expression +# +SELECT AsText(g) FROM (SELECT NULL AS g UNION SELECT Point(1,1)) AS t1; +AsText(g) +NULL +POINT(1 1) +# +# MDEV-10306 Wrong results with combination of CONCAT, SUBSTR and CONVERT in subquery +# +SET @save_optimizer_switch=@@optimizer_switch; +SET optimizer_switch='derived_merge=on'; +CREATE TABLE t1 (x INT, y INT); +INSERT INTO t1 VALUES(0,0); +SELECT LENGTH(t2) c2 FROM (SELECT ST_BUFFER(POINT(x,y), 0) t2 FROM t1) sub; +c2 +25 +SELECT LENGTH(CONCAT(t2,'-',t2)) c2 FROM (SELECT ST_BUFFER(POINT(x,y), 0) t2 FROM t1) sub; +c2 +51 +SELECT LENGTH(CONCAT(t2,'--',t2)) c2 FROM (SELECT ST_BUFFER(POINT(x,y), 0) t2 FROM t1) sub; +c2 +52 +DROP TABLE t1; +SET optimizer_switch=@save_optimizer_switch; +# +# MDEV-16995: ER_CANT_CREATE_GEOMETRY_OBJECT encountered for a query with +# optimizer_use_condition_selectivity>=3 +# +CREATE TABLE t1 (a POINT); +INSERT INTO t1 VALUES (POINT(1,1)),(POINT(1,2)),(POINT(1,3)); +set @save_use_stat_tables= @@use_stat_tables; +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @@use_stat_tables= PREFERABLY; +set @@optimizer_use_condition_selectivity=3; +SELECT COUNT(*) FROM t1 WHERE a IN ('test','test1'); +COUNT(*) +0 +set @@use_stat_tables= @save_use_stat_tables; +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +drop table t1; +# +# End 10.0 tests +# +SHOW CREATE TABLE information_schema.geometry_columns; +Table Create Table +GEOMETRY_COLUMNS CREATE TEMPORARY TABLE `GEOMETRY_COLUMNS` ( + `F_TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '', + `F_TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '', + `F_TABLE_NAME` varchar(64) NOT NULL DEFAULT '', + `F_GEOMETRY_COLUMN` varchar(64) NOT NULL DEFAULT '', + `G_TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '', + `G_TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '', + `G_TABLE_NAME` varchar(64) NOT NULL DEFAULT '', + `G_GEOMETRY_COLUMN` varchar(64) NOT NULL DEFAULT '', + `STORAGE_TYPE` tinyint(2) NOT NULL DEFAULT 0, + `GEOMETRY_TYPE` int(7) NOT NULL DEFAULT 0, + `COORD_DIMENSION` tinyint(2) NOT NULL DEFAULT 0, + `MAX_PPR` tinyint(2) NOT NULL DEFAULT 0, + `SRID` smallint(5) NOT NULL DEFAULT 0 +) ENGINE=MEMORY DEFAULT CHARSET=utf8 +SHOW CREATE TABLE information_schema.spatial_ref_sys; +Table Create Table +SPATIAL_REF_SYS CREATE TEMPORARY TABLE `SPATIAL_REF_SYS` ( + `SRID` smallint(5) NOT NULL DEFAULT 0, + `AUTH_NAME` varchar(512) NOT NULL DEFAULT '', + `AUTH_SRID` int(5) NOT NULL DEFAULT 0, + `SRTEXT` varchar(2048) NOT NULL DEFAULT '' +) ENGINE=MEMORY DEFAULT CHARSET=utf8 +create table t1(g GEOMETRY, pt POINT); +create table t2(g LINESTRING, pl POLYGON); +select * from information_schema.geometry_columns where f_table_schema='test'; +F_TABLE_CATALOG F_TABLE_SCHEMA F_TABLE_NAME F_GEOMETRY_COLUMN G_TABLE_CATALOG G_TABLE_SCHEMA G_TABLE_NAME G_GEOMETRY_COLUMN STORAGE_TYPE GEOMETRY_TYPE COORD_DIMENSION MAX_PPR SRID +def test t1 def test t1 g 1 0 2 0 0 +def test t1 def test t1 pt 1 1 2 0 0 +def test t2 def test t2 g 1 2 2 0 0 +def test t2 def test t2 pl 1 3 2 0 0 +drop table t1, t2; +10.1 tests +create table t1(g GEOMETRY(9,4) REF_SYSTEM_ID=101, pt POINT(8,2), pg GEOMETRY REF_SYSTEM_ID=102); +SELECT SRID from information_schema.geometry_columns WHERE f_table_schema='test' and G_TABLE_NAME='t1'; +SRID +101 +0 +102 +drop table t1; +# Expect an int(1) column to be created +CREATE TABLE t1 AS SELECT CONTAINS(NULL, NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `CONTAINS(NULL, NULL)` int(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# MDEV-7334 valgrind warning "unitialized bytes" in 10.1. +# +CREATE TABLE t1 ( +gp point, +ln linestring, +pg polygon, +mp multipoint, +mln multilinestring, +mpg multipolygon, +gc geometrycollection, +gm geometry +); +ALTER TABLE t1 ADD fid INT NOT NULL; +select SRID from information_schema.geometry_columns where F_TABLE_NAME='t1'; +SRID +0 +0 +0 +0 +0 +0 +0 +0 +drop table t1; +# +# MDEV-7510 GIS: IsRing returns false for a primitive triangle. +# +select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,0 0)')); +ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,0 0)')) +1 +select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,-10 -10, 0 -10, 0 0)')); +ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,-10 -10, 0 -10, 0 0)')) +0 +# +# MDEV-7514 GIS: PointOnSurface returns NULL instead of the point. +# +SELECT ST_GEOMETRYTYPE(ST_PointOnSurface(ST_PolyFromText('POLYGON((-70.916 42.1002,-70.9468 42.0946,-70.9754 42.0875,-70.9749 42.0879,-70.9759 42.0897,-70.916 42.1002))'))); +ST_GEOMETRYTYPE(ST_PointOnSurface(ST_PolyFromText('POLYGON((-70.916 42.1002,-70.9468 42.0946,-70.9754 42.0875,-70.9749 42.0879,-70.9759 42.0897,-70.916 42.1002))'))) +NULL +# +# MDEV-7529 GIS: ST_Relate returns unexpected results for POINT relations +# +select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'T*F**FFF*') AS equals; +equals +1 +select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'T*****FF*') AS contains; +contains +1 +select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'T*F**F***') AS within; +within +1 +select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(1 1)'),'FF*FF****') as disjoint; +disjoint +1 +select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'FF*FF****') as disjoint; +disjoint +0 +# +# MDEV-7528 GIS: Functions return NULL instead of specified -1 for NULL arguments. +# +select ST_IsRing(NULL); +ST_IsRing(NULL) +-1 +# +# MDEV-8675 Different results of GIS functions on NULL vs NOT NULL columns +# +CREATE TABLE t1 (g1 GEOMETRY NOT NULL,g2 GEOMETRY NULL); +CREATE TABLE t2 AS SELECT WITHIN(g1,g1) as w1,WITHIN(g2,g2) AS w2 FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `w1` int(1) DEFAULT NULL, + `w2` int(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1,t2; ++CREATE TABLE t1 ( ++id INT UNSIGNED NOT NULL AUTO_INCREMENT, ++point_data POINT NOT NULL, ++PRIMARY KEY (id), ++KEY idx_point_data(point_data) ++) ENGINE=MyISAM; ++INSERT t1 (point_data) VALUES ++(GeomFromText('Point(37.0248492 23.8512726)')), ++(GeomFromText('Point(38.0248492 23.8512726)')); ++SELECT id FROM t1 ++WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)')); ++id ++2 ++DROP TABLE t1; +# +# Start of 10.2 tests +# +create view v1 as select AsWKT(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))); +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select st_astext(geometrycollection(point(44,6),geometrycollection(point(3,6),point(7,9)))) AS `Name_exp_1` latin1 latin1_swedish_ci +select * from v1; +Name_exp_1 +GEOMETRYCOLLECTION(POINT(44 6),GEOMETRYCOLLECTION(POINT(3 6),POINT(7 9))) +drop view v1; +# +# MDEV-10134 Add full support for DEFAULT +# +CREATE TABLE t1 (a POINT, x DOUBLE DEFAULT x(a), y DOUBLE DEFAULT y(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` point DEFAULT NULL, + `x` double DEFAULT st_x(`a`), + `y` double DEFAULT st_y(`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a) VALUES (Point(1,2)); +SELECT x,y FROM t1; +x y +1 2 +DROP TABLE t1; +CREATE TABLE t1 (g GEOMETRY, area DOUBLE DEFAULT ST_AREA(g)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `g` geometry DEFAULT NULL, + `area` double DEFAULT st_area(`g`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (g) VALUES (GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))')); +SELECT area FROM t1; +area +400 +DROP TABLE t1; +CREATE TABLE t1 (g GEOMETRY, length DOUBLE DEFAULT ST_LENGTH(g)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `g` geometry DEFAULT NULL, + `length` double DEFAULT st_length(`g`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (g) VALUES (GeomFromText('LINESTRING(0 0,20 0,20 20,0 20,0 0)')); +SELECT length FROM t1; +length +80 +DROP TABLE t1; +CREATE TABLE t1 (g POINT, distance DOUBLE DEFAULT ST_DISTANCE(g, POINT(0,0))); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `g` point DEFAULT NULL, + `distance` double DEFAULT st_distance(`g`,point(0,0)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (g) VALUES (Point(1,0)); +SELECT distance FROM t1; +distance +1 +DROP TABLE t1; +CREATE TABLE t1 (a TEXT, g GEOMETRY DEFAULT GeomFromText(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text DEFAULT NULL, + `g` geometry DEFAULT st_geometryfromtext(`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a) VALUES ('point(1 1)'); +SELECT AsText(g) FROM t1; +AsText(g) +POINT(1 1) +DROP TABLE t1; +CREATE TABLE t1 (x INT, y INT, g GEOMETRY DEFAULT POINT(x,y)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `x` int(11) DEFAULT NULL, + `y` int(11) DEFAULT NULL, + `g` geometry DEFAULT point(`x`,`y`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (x,y) VALUES (10,20); +SELECT AsText(g) FROM t1; +AsText(g) +POINT(10 20) +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT PointN(a,2)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` geometry DEFAULT NULL, + `b` geometry DEFAULT st_pointn(`a`,2) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,2 2,3 3)')); +SELECT AsText(b) FROM t1; +AsText(b) +POINT(2 2) +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT StartPoint(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` geometry DEFAULT NULL, + `b` geometry DEFAULT st_startpoint(`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,2 2,3 3)')); +SELECT AsText(b) FROM t1; +AsText(b) +POINT(1 1) +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c GEOMETRY DEFAULT GeometryCollection(a,b)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` geometry DEFAULT NULL, + `b` geometry DEFAULT NULL, + `c` geometry DEFAULT geometrycollection(`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a,b) VALUES (Point(1,1), Point(2,2)); +SELECT AsText(c) FROM t1; +AsText(c) +GEOMETRYCOLLECTION(POINT(1 1),POINT(2 2)) +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT GeomFromWKB(AsBinary(a),20)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` geometry DEFAULT NULL, + `b` geometry DEFAULT st_geometryfromwkb(st_aswkb(`a`),20) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a) VALUES (GeomFromText('POINT(1 1)', 10)); +SELECT AsText(a), SRID(a), AsText(b), SRID(b) FROM t1; +AsText(a) SRID(a) AsText(b) SRID(b) +POINT(1 1) 10 POINT(1 1) 20 +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT BOUNDARY(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` geometry DEFAULT NULL, + `b` geometry DEFAULT st_boundary(`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))')); +SELECT AsText(b) FROM t1; +AsText(b) +LINESTRING(10 10,10 20,20 20,20 10,10 10) +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT BUFFER(a,10)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` geometry DEFAULT NULL, + `b` geometry DEFAULT st_buffer(`a`,10) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))')); +SELECT GeometryType(b) FROM t1; +GeometryType(b) +POLYGON +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT CENTROID(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` geometry DEFAULT NULL, + `b` geometry DEFAULT st_centroid(`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))')); +SELECT AsText(b) FROM t1; +AsText(b) +POINT(15 15) +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT ENVELOPE(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` geometry DEFAULT NULL, + `b` geometry DEFAULT st_envelope(`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,4 4)')); +SELECT AsText(b) FROM t1; +AsText(b) +POLYGON((1 1,4 1,4 4,1 4,1 1)) +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT PointOnSurface(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` geometry DEFAULT NULL, + `b` geometry DEFAULT st_pointonsurface(`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))')); +SELECT GeometryType(b) FROM t1; +GeometryType(b) +POINT +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT Point(1,1), c GEOMETRY DEFAULT ST_UNION(a,b)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` geometry DEFAULT NULL, + `b` geometry DEFAULT point(1,1), + `c` geometry DEFAULT st_union(`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a) VALUES (Point(0,0)); +SELECT AsText(c) FROM t1; +AsText(c) +MULTIPOINT(0 0,1 1) +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY, b VARCHAR(20) DEFAULT GeometryType(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` geometry DEFAULT NULL, + `b` varchar(20) DEFAULT st_geometrytype(`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a) VALUES (Point(0, 0)); +SELECT b FROM t1; +b +POINT +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsSimple(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` geometry DEFAULT NULL, + `b` int(11) DEFAULT st_issimple(`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a) VALUES (Point(0, 0)); +SELECT b FROM t1; +b +1 +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsEmpty(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` geometry DEFAULT NULL, + `b` int(11) DEFAULT st_isempty(`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a) VALUES (Point(0, 0)); +SELECT b FROM t1; +b +0 +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsRing(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` geometry DEFAULT NULL, + `b` int(11) DEFAULT st_isring(`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a) VALUES (GeomFromText('LineString(0 0,0 1,1 1,1 0,0 0)')); +SELECT b FROM t1; +b +1 +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsClosed(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` geometry DEFAULT NULL, + `b` int(11) DEFAULT st_isclosed(`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a) VALUES (GeomFromText('LineString(0 0,0 1,1 1,1 0,0 0)')); +SELECT b FROM t1; +b +1 +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT Dimension(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` geometry DEFAULT NULL, + `b` int(11) DEFAULT st_dimension(`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a) VALUES (Buffer(Point(1,1),1)); +SELECT b FROM t1; +b +2 +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT NumGeometries(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` geometry DEFAULT NULL, + `b` int(11) DEFAULT st_numgeometries(`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a) VALUES (ST_UNION(Point(1,1),Point(0,0))); +SELECT b FROM t1; +b +2 +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT NumInteriorRings(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` geometry DEFAULT NULL, + `b` int(11) DEFAULT st_numinteriorrings(`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a) VALUES (GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))')); +SELECT b FROM t1; +b +1 +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT NumPoints(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` geometry DEFAULT NULL, + `b` int(11) DEFAULT st_numpoints(`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a) VALUES (LineString(Point(1,1),Point(0,0))); +SELECT b FROM t1; +b +2 +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT SRID(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` geometry DEFAULT NULL, + `b` int(11) DEFAULT srid(`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a) VALUES (GeomFromText('Point(1 1)', 100)); +SELECT b FROM t1; +b +100 +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c INT DEFAULT MBRDisjoint(a,b)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` geometry DEFAULT NULL, + `b` geometry DEFAULT NULL, + `c` int(11) DEFAULT mbrdisjoint(`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1)); +SELECT c FROM t1; +c +0 +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c INT DEFAULT ST_Disjoint(a,b)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` geometry DEFAULT NULL, + `b` geometry DEFAULT NULL, + `c` int(11) DEFAULT st_disjoint(`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1)); +SELECT c FROM t1; +c +0 +DROP TABLE t1; +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c INT DEFAULT ST_Relate(a,b,'T*F**FFF*')); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` geometry DEFAULT NULL, + `b` geometry DEFAULT NULL, + `c` int(11) DEFAULT st_relate(`a`,`b`,'T*F**FFF*') +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1)); +SELECT c FROM t1; +c +1 +DROP TABLE t1; ++create table t1 (p point default "qwer"); ++ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field ++create table t1 (p point default 0); ++ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field ++create table t1 (p point not null default st_geometryfromtext('point 0)')); ++ERROR 42000: Invalid default value for 'p' ++create table t1 (p point not null default st_geometryfromtext('point(0 0)')); ++insert into t1 values(default); ++select st_astext(p) from t1; ++st_astext(p) ++POINT(0 0) ++drop table t1; +# - # Start of 10.3 tests ++# End of 10.2 tests +# +# +# MDEV-11478 Result data type aggregation for pluggable data types +# +CREATE PROCEDURE p2(query TEXT) +BEGIN +DECLARE errcount INT DEFAULT 0; +DECLARE CONTINUE HANDLER FOR SQLEXCEPTION +BEGIN +SET errcount = errcount+1; +#SHOW WARNINGS; +GET DIAGNOSTICS CONDITION 1 @p= MESSAGE_TEXT; +SELECT @p AS `ERROR: `; +END; +SELECT query AS ``; +EXECUTE IMMEDIATE query; +IF errcount = 0 +THEN +SHOW CREATE TABLE t2; +DROP TABLE t2; +END IF; +END; +$$ +CREATE PROCEDURE p1(query TEXT) +BEGIN +SELECT query AS `-------------------------------------`; +EXECUTE IMMEDIATE query; +CALL p2('CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1'); +CALL p2('CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1'); +CALL p2('CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1'); +CALL p2('CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1'); +CALL p2('CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1'); +DROP TABLE t1; +END; +$$ +------------------------------------- +CREATE TABLE t1 (a CHAR(10), b Point) + +CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `CASE WHEN TRUE THEN a ELSE b END` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `COALESCE(a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `IF(TRUE,a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `IFNULL(a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `a` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +------------------------------------- +CREATE TABLE t1 (a VARCHAR(10), b Point) + +CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `CASE WHEN TRUE THEN a ELSE b END` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `COALESCE(a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `IF(TRUE,a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `IFNULL(a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `a` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +------------------------------------- +CREATE TABLE t1 (a TINYTEXT, b Point) + +CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `CASE WHEN TRUE THEN a ELSE b END` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `COALESCE(a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `IF(TRUE,a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `IFNULL(a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `a` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +------------------------------------- +CREATE TABLE t1 (a TEXT, b Point) + +CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `CASE WHEN TRUE THEN a ELSE b END` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `COALESCE(a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `IF(TRUE,a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `IFNULL(a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `a` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +------------------------------------- +CREATE TABLE t1 (a MEDIUMTEXT, b Point) + +CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `CASE WHEN TRUE THEN a ELSE b END` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `COALESCE(a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `IF(TRUE,a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `IFNULL(a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `a` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +------------------------------------- +CREATE TABLE t1 (a LONGTEXT, b Point) + +CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `CASE WHEN TRUE THEN a ELSE b END` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `COALESCE(a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `IF(TRUE,a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `IFNULL(a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `a` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +------------------------------------- +CREATE TABLE t1 (a TINYINT, b Point) + +CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 +ERROR: +Illegal parameter data types tinyint and geometry for operation 'case' + +CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 +ERROR: +Illegal parameter data types tinyint and geometry for operation 'coalesce' + +CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 +ERROR: +Illegal parameter data types tinyint and geometry for operation 'if' + +CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 +ERROR: +Illegal parameter data types tinyint and geometry for operation 'ifnull' + +CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 +ERROR: +Illegal parameter data types tinyint and geometry for operation 'UNION' +------------------------------------- +CREATE TABLE t1 (a SMALLINT, b Point) + +CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 +ERROR: +Illegal parameter data types smallint and geometry for operation 'case' + +CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 +ERROR: +Illegal parameter data types smallint and geometry for operation 'coalesce' + +CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 +ERROR: +Illegal parameter data types smallint and geometry for operation 'if' + +CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 +ERROR: +Illegal parameter data types smallint and geometry for operation 'ifnull' + +CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 +ERROR: +Illegal parameter data types smallint and geometry for operation 'UNION' +------------------------------------- +CREATE TABLE t1 (a MEDIUMINT, b Point) + +CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 +ERROR: +Illegal parameter data types mediumint and geometry for operation 'case' + +CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 +ERROR: +Illegal parameter data types mediumint and geometry for operation 'coalesce' + +CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 +ERROR: +Illegal parameter data types mediumint and geometry for operation 'if' + +CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 +ERROR: +Illegal parameter data types mediumint and geometry for operation 'ifnull' + +CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 +ERROR: +Illegal parameter data types mediumint and geometry for operation 'UNION' +------------------------------------- +CREATE TABLE t1 (a INT, b Point) + +CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 +ERROR: +Illegal parameter data types int and geometry for operation 'case' + +CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 +ERROR: +Illegal parameter data types int and geometry for operation 'coalesce' + +CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 +ERROR: +Illegal parameter data types int and geometry for operation 'if' + +CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 +ERROR: +Illegal parameter data types int and geometry for operation 'ifnull' + +CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 +ERROR: +Illegal parameter data types int and geometry for operation 'UNION' +------------------------------------- +CREATE TABLE t1 (a BIGINT, b Point) + +CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation 'case' + +CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation 'coalesce' + +CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation 'if' + +CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation 'ifnull' + +CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation 'UNION' +------------------------------------- +CREATE TABLE t1 (a FLOAT, b Point) + +CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 +ERROR: +Illegal parameter data types float and geometry for operation 'case' + +CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 +ERROR: +Illegal parameter data types float and geometry for operation 'coalesce' + +CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 +ERROR: +Illegal parameter data types float and geometry for operation 'if' + +CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 +ERROR: +Illegal parameter data types float and geometry for operation 'ifnull' + +CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 +ERROR: +Illegal parameter data types float and geometry for operation 'UNION' +------------------------------------- +CREATE TABLE t1 (a DOUBLE, b Point) + +CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 +ERROR: +Illegal parameter data types double and geometry for operation 'case' + +CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 +ERROR: +Illegal parameter data types double and geometry for operation 'coalesce' + +CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 +ERROR: +Illegal parameter data types double and geometry for operation 'if' + +CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 +ERROR: +Illegal parameter data types double and geometry for operation 'ifnull' + +CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 +ERROR: +Illegal parameter data types double and geometry for operation 'UNION' +------------------------------------- +CREATE TABLE t1 (a DECIMAL(10,2), b Point) + +CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 +ERROR: +Illegal parameter data types decimal and geometry for operation 'case' + +CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 +ERROR: +Illegal parameter data types decimal and geometry for operation 'coalesce' + +CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 +ERROR: +Illegal parameter data types decimal and geometry for operation 'if' + +CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 +ERROR: +Illegal parameter data types decimal and geometry for operation 'ifnull' + +CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 +ERROR: +Illegal parameter data types decimal and geometry for operation 'UNION' +------------------------------------- +CREATE TABLE t1 (a BIT(8), b Point) + +CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation 'case' + +CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation 'coalesce' + +CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation 'if' + +CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation 'ifnull' + +CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 +ERROR: +Illegal parameter data types bit and geometry for operation 'UNION' +------------------------------------- +CREATE TABLE t1 (a TIME, b Point) + +CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 +ERROR: +Illegal parameter data types time and geometry for operation 'case' + +CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 +ERROR: +Illegal parameter data types time and geometry for operation 'coalesce' + +CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 +ERROR: +Illegal parameter data types time and geometry for operation 'if' + +CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 +ERROR: +Illegal parameter data types time and geometry for operation 'ifnull' + +CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 +ERROR: +Illegal parameter data types time and geometry for operation 'UNION' +------------------------------------- +CREATE TABLE t1 (a DATE, b Point) + +CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 +ERROR: +Illegal parameter data types date and geometry for operation 'case' + +CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 +ERROR: +Illegal parameter data types date and geometry for operation 'coalesce' + +CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 +ERROR: +Illegal parameter data types date and geometry for operation 'if' + +CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 +ERROR: +Illegal parameter data types date and geometry for operation 'ifnull' + +CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 +ERROR: +Illegal parameter data types date and geometry for operation 'UNION' +------------------------------------- +CREATE TABLE t1 (a DATETIME, b Point) + +CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 +ERROR: +Illegal parameter data types datetime and geometry for operation 'case' + +CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 +ERROR: +Illegal parameter data types datetime and geometry for operation 'coalesce' + +CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 +ERROR: +Illegal parameter data types datetime and geometry for operation 'if' + +CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 +ERROR: +Illegal parameter data types datetime and geometry for operation 'ifnull' + +CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 +ERROR: +Illegal parameter data types datetime and geometry for operation 'UNION' +------------------------------------- +CREATE TABLE t1 (a TIMESTAMP, b Point) + +CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 +ERROR: +Illegal parameter data types timestamp and geometry for operation 'case' + +CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 +ERROR: +Illegal parameter data types timestamp and geometry for operation 'coalesce' + +CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 +ERROR: +Illegal parameter data types timestamp and geometry for operation 'if' + +CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 +ERROR: +Illegal parameter data types timestamp and geometry for operation 'ifnull' + +CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 +ERROR: +Illegal parameter data types timestamp and geometry for operation 'UNION' +------------------------------------- +CREATE TABLE t1 (a YEAR, b Point) + +CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 +ERROR: +Illegal parameter data types year and geometry for operation 'case' + +CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 +ERROR: +Illegal parameter data types year and geometry for operation 'coalesce' + +CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 +ERROR: +Illegal parameter data types year and geometry for operation 'if' + +CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 +ERROR: +Illegal parameter data types year and geometry for operation 'ifnull' + +CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 +ERROR: +Illegal parameter data types year and geometry for operation 'UNION' +# This creates BLOB with hybrid functions, but fails on error with UNION (MDEV-11458) +------------------------------------- +CREATE TABLE t1 (a ENUM(0x61), b Point) + +CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `CASE WHEN TRUE THEN a ELSE b END` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `COALESCE(a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `IF(TRUE,a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `IFNULL(a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 +ERROR: +Illegal parameter data types enum and geometry for operation 'UNION' +------------------------------------- +CREATE TABLE t1 (a SET(0x61), b Point) + +CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `CASE WHEN TRUE THEN a ELSE b END` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `COALESCE(a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `IF(TRUE,a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `IFNULL(a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1 +ERROR: +Illegal parameter data types set and geometry for operation 'UNION' +CREATE TABLE t1 AS SELECT COALESCE(NULL, Point(1,1)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `COALESCE(NULL, Point(1,1))` point DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 AS SELECT NULL UNION SELECT Point(1,1); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `NULL` point DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +DROP PROCEDURE p1; +DROP PROCEDURE p2; +# +# MDEV-11692 Comparison data type aggregation for pluggable data types +# +CREATE PROCEDURE p2(query TEXT) +BEGIN +DECLARE errcount INT DEFAULT 0; +DECLARE CONTINUE HANDLER FOR SQLEXCEPTION +BEGIN +SET errcount = errcount+1; +GET DIAGNOSTICS CONDITION 1 @p= MESSAGE_TEXT; +SELECT @p AS `ERROR: `; +END; +SELECT query AS ``; +EXECUTE IMMEDIATE query; +END; +$$ +CREATE PROCEDURE p1(query TEXT) +BEGIN +SELECT query AS `-------------------------------------`; +EXECUTE IMMEDIATE query; +CALL p2('SELECT a=b FROM t1'); +CALL p2('SELECT b=a FROM t1'); +CALL p2('SELECT a BETWEEN b AND c FROM t1'); +CALL p2('SELECT a IN (b,c) FROM t1'); +CALL p2('SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1'); +CALL p2('SELECT a=POINT(1,1) FROM t1'); +CALL p2('SELECT POINT(1,1)=a FROM t1'); +CALL p2('SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1'); +CALL p2('SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1'); +CALL p2('SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1'); +DROP TABLE t1; +END; +$$ +CALL p1('CREATE TABLE t1 (a CHAR(10), b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a CHAR(10), b Point, c Point) + +SELECT a=b FROM t1 +a=b + +SELECT b=a FROM t1 +b=a + +SELECT a BETWEEN b AND c FROM t1 +a BETWEEN b AND c + +SELECT a IN (b,c) FROM t1 +a IN (b,c) + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +CASE a WHEN b THEN "a" WHEN c THEN "b" END + +SELECT a=POINT(1,1) FROM t1 +a=POINT(1,1) + +SELECT POINT(1,1)=a FROM t1 +POINT(1,1)=a + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +a BETWEEN POINT(1,1) AND POINT(1,2) + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +a IN (POINT(1,1),POINT(1,2)) + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END +CALL p1('CREATE TABLE t1 (a VARCHAR(10), b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a VARCHAR(10), b Point, c Point) + +SELECT a=b FROM t1 +a=b + +SELECT b=a FROM t1 +b=a + +SELECT a BETWEEN b AND c FROM t1 +a BETWEEN b AND c + +SELECT a IN (b,c) FROM t1 +a IN (b,c) + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +CASE a WHEN b THEN "a" WHEN c THEN "b" END + +SELECT a=POINT(1,1) FROM t1 +a=POINT(1,1) + +SELECT POINT(1,1)=a FROM t1 +POINT(1,1)=a + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +a BETWEEN POINT(1,1) AND POINT(1,2) + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +a IN (POINT(1,1),POINT(1,2)) + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END +CALL p1('CREATE TABLE t1 (a TINYTEXT, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a TINYTEXT, b Point, c Point) + +SELECT a=b FROM t1 +a=b + +SELECT b=a FROM t1 +b=a + +SELECT a BETWEEN b AND c FROM t1 +a BETWEEN b AND c + +SELECT a IN (b,c) FROM t1 +a IN (b,c) + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +CASE a WHEN b THEN "a" WHEN c THEN "b" END + +SELECT a=POINT(1,1) FROM t1 +a=POINT(1,1) + +SELECT POINT(1,1)=a FROM t1 +POINT(1,1)=a + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +a BETWEEN POINT(1,1) AND POINT(1,2) + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +a IN (POINT(1,1),POINT(1,2)) + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END +CALL p1('CREATE TABLE t1 (a TEXT, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a TEXT, b Point, c Point) + +SELECT a=b FROM t1 +a=b + +SELECT b=a FROM t1 +b=a + +SELECT a BETWEEN b AND c FROM t1 +a BETWEEN b AND c + +SELECT a IN (b,c) FROM t1 +a IN (b,c) + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +CASE a WHEN b THEN "a" WHEN c THEN "b" END + +SELECT a=POINT(1,1) FROM t1 +a=POINT(1,1) + +SELECT POINT(1,1)=a FROM t1 +POINT(1,1)=a + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +a BETWEEN POINT(1,1) AND POINT(1,2) + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +a IN (POINT(1,1),POINT(1,2)) + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END +CALL p1('CREATE TABLE t1 (a MEDIUMTEXT, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a MEDIUMTEXT, b Point, c Point) + +SELECT a=b FROM t1 +a=b + +SELECT b=a FROM t1 +b=a + +SELECT a BETWEEN b AND c FROM t1 +a BETWEEN b AND c + +SELECT a IN (b,c) FROM t1 +a IN (b,c) + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +CASE a WHEN b THEN "a" WHEN c THEN "b" END + +SELECT a=POINT(1,1) FROM t1 +a=POINT(1,1) + +SELECT POINT(1,1)=a FROM t1 +POINT(1,1)=a + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +a BETWEEN POINT(1,1) AND POINT(1,2) + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +a IN (POINT(1,1),POINT(1,2)) + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END +CALL p1('CREATE TABLE t1 (a LONGTEXT, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a LONGTEXT, b Point, c Point) + +SELECT a=b FROM t1 +a=b + +SELECT b=a FROM t1 +b=a + +SELECT a BETWEEN b AND c FROM t1 +a BETWEEN b AND c + +SELECT a IN (b,c) FROM t1 +a IN (b,c) + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +CASE a WHEN b THEN "a" WHEN c THEN "b" END + +SELECT a=POINT(1,1) FROM t1 +a=POINT(1,1) + +SELECT POINT(1,1)=a FROM t1 +POINT(1,1)=a + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +a BETWEEN POINT(1,1) AND POINT(1,2) + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +a IN (POINT(1,1),POINT(1,2)) + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END +CALL p1('CREATE TABLE t1 (a ENUM("a","b"), b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a ENUM("a","b"), b Point, c Point) + +SELECT a=b FROM t1 +a=b + +SELECT b=a FROM t1 +b=a + +SELECT a BETWEEN b AND c FROM t1 +a BETWEEN b AND c + +SELECT a IN (b,c) FROM t1 +a IN (b,c) + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +CASE a WHEN b THEN "a" WHEN c THEN "b" END + +SELECT a=POINT(1,1) FROM t1 +a=POINT(1,1) + +SELECT POINT(1,1)=a FROM t1 +POINT(1,1)=a + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +a BETWEEN POINT(1,1) AND POINT(1,2) + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +a IN (POINT(1,1),POINT(1,2)) + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END +CALL p1('CREATE TABLE t1 (a TINYINT, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a TINYINT, b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types tinyint and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and tinyint for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types tinyint and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types tinyint and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types tinyint and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types tinyint and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and tinyint for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types tinyint and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types tinyint and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types tinyint and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a SMALLINT, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a SMALLINT, b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types smallint and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and smallint for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types smallint and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types smallint and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types smallint and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types smallint and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and smallint for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types smallint and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types smallint and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types smallint and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a MEDIUMINT, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a MEDIUMINT, b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types mediumint and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and mediumint for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types mediumint and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types mediumint and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types mediumint and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types mediumint and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and mediumint for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types mediumint and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types mediumint and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types mediumint and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a INT, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a INT, b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types int and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and int for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types int and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types int and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types int and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types int and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and int for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types int and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types int and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types int and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a BIGINT, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a BIGINT, b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and bigint for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and bigint for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a FLOAT, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a FLOAT, b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types float and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and float for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types float and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types float and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types float and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types float and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and float for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types float and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types float and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types float and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a DOUBLE, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a DOUBLE, b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types double and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and double for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types double and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types double and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types double and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types double and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and double for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types double and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types double and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types double and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a DECIMAL(10,2), b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a DECIMAL(10,2), b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types decimal and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and decimal for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types decimal and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types decimal and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types decimal and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types decimal and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and decimal for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types decimal and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types decimal and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types decimal and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a BIT(8), b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a BIT(8), b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types bit and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and bit for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types bit and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types bit and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types bit and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types bit and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and bit for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types bit and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types bit and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types bit and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a TIME, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a TIME, b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types time and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and time for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types time and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types time and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types time and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types time and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and time for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types time and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types time and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types time and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a DATE, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a DATE, b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types date and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and date for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types date and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types date and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types date and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types date and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and date for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types date and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types date and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types date and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a DATETIME, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a DATETIME, b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types datetime and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and datetime for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types datetime and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types datetime and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types datetime and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types datetime and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and datetime for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types datetime and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types datetime and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types datetime and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a TIMESTAMP, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a TIMESTAMP, b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types timestamp and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and timestamp for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types timestamp and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types timestamp and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types timestamp and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types timestamp and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and timestamp for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types timestamp and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types timestamp and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types timestamp and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a YEAR, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a YEAR, b Point, c Point) + +SELECT a=b FROM t1 +ERROR: +Illegal parameter data types year and geometry for operation '=' + +SELECT b=a FROM t1 +ERROR: +Illegal parameter data types geometry and year for operation '=' + +SELECT a BETWEEN b AND c FROM t1 +ERROR: +Illegal parameter data types year and geometry for operation 'between' + +SELECT a IN (b,c) FROM t1 +ERROR: +Illegal parameter data types year and geometry for operation 'in' + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +ERROR: +Illegal parameter data types year and geometry for operation 'case..when' + +SELECT a=POINT(1,1) FROM t1 +ERROR: +Illegal parameter data types year and geometry for operation '=' + +SELECT POINT(1,1)=a FROM t1 +ERROR: +Illegal parameter data types geometry and year for operation '=' + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +ERROR: +Illegal parameter data types year and geometry for operation 'between' + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +ERROR: +Illegal parameter data types year and geometry for operation 'in' + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +ERROR: +Illegal parameter data types year and geometry for operation 'case..when' +CALL p1('CREATE TABLE t1 (a Point, b Point, c Point)'); +------------------------------------- +CREATE TABLE t1 (a Point, b Point, c Point) + +SELECT a=b FROM t1 +a=b + +SELECT b=a FROM t1 +b=a + +SELECT a BETWEEN b AND c FROM t1 +a BETWEEN b AND c + +SELECT a IN (b,c) FROM t1 +a IN (b,c) + +SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1 +CASE a WHEN b THEN "a" WHEN c THEN "b" END + +SELECT a=POINT(1,1) FROM t1 +a=POINT(1,1) + +SELECT POINT(1,1)=a FROM t1 +POINT(1,1)=a + +SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1 +a BETWEEN POINT(1,1) AND POINT(1,2) + +SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1 +a IN (POINT(1,1),POINT(1,2)) + +SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1 +CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END +DROP PROCEDURE p1; +DROP PROCEDURE p2; +# +# MDEV-12506 Split Item_func_min_max::fix_length_and_dec() into methods in Type_handler +# +CREATE PROCEDURE p2(query TEXT) +BEGIN +DECLARE errcount INT DEFAULT 0; +DECLARE CONTINUE HANDLER FOR SQLEXCEPTION +BEGIN +SET errcount = errcount+1; +#SHOW WARNINGS; +GET DIAGNOSTICS CONDITION 1 @p= MESSAGE_TEXT; +SELECT @p AS `ERROR: `; +END; +SELECT query AS ``; +EXECUTE IMMEDIATE query; +IF errcount = 0 +THEN +SHOW CREATE TABLE t2; +DROP TABLE t2; +END IF; +END; +$$ +CREATE PROCEDURE p1(query TEXT) +BEGIN +SELECT query AS `-------------------------------------`; +EXECUTE IMMEDIATE query; +CALL p2('CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1'); +DROP TABLE t1; +END; +$$ +------------------------------------- +CREATE TABLE t1 (a CHAR(10), b Point) + +CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `LEAST(a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +------------------------------------- +CREATE TABLE t1 (a VARCHAR(10), b Point) + +CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `LEAST(a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +------------------------------------- +CREATE TABLE t1 (a TINYTEXT, b Point) + +CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `LEAST(a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +------------------------------------- +CREATE TABLE t1 (a TEXT, b Point) + +CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `LEAST(a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +------------------------------------- +CREATE TABLE t1 (a MEDIUMTEXT, b Point) + +CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `LEAST(a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +------------------------------------- +CREATE TABLE t1 (a LONGTEXT, b Point) + +CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `LEAST(a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +------------------------------------- +CREATE TABLE t1 (a TINYINT, b Point) + +CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 +ERROR: +Illegal parameter data types tinyint and geometry for operation 'least' +------------------------------------- +CREATE TABLE t1 (a SMALLINT, b Point) + +CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 +ERROR: +Illegal parameter data types smallint and geometry for operation 'least' +------------------------------------- +CREATE TABLE t1 (a MEDIUMINT, b Point) + +CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 +ERROR: +Illegal parameter data types mediumint and geometry for operation 'least' +------------------------------------- +CREATE TABLE t1 (a INT, b Point) + +CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 +ERROR: +Illegal parameter data types int and geometry for operation 'least' +------------------------------------- +CREATE TABLE t1 (a BIGINT, b Point) + +CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 +ERROR: +Illegal parameter data types bigint and geometry for operation 'least' +------------------------------------- +CREATE TABLE t1 (a FLOAT, b Point) + +CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 +ERROR: +Illegal parameter data types float and geometry for operation 'least' +------------------------------------- +CREATE TABLE t1 (a DOUBLE, b Point) + +CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 +ERROR: +Illegal parameter data types double and geometry for operation 'least' +------------------------------------- +CREATE TABLE t1 (a DECIMAL(10,2), b Point) + +CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 +ERROR: +Illegal parameter data types decimal and geometry for operation 'least' +------------------------------------- +CREATE TABLE t1 (a BIT(8), b Point) + +CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 +ERROR: +Illegal parameter data types bit and geometry for operation 'least' +------------------------------------- +CREATE TABLE t1 (a TIME, b Point) + +CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 +ERROR: +Illegal parameter data types time and geometry for operation 'least' +------------------------------------- +CREATE TABLE t1 (a DATE, b Point) + +CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 +ERROR: +Illegal parameter data types date and geometry for operation 'least' +------------------------------------- +CREATE TABLE t1 (a DATETIME, b Point) + +CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 +ERROR: +Illegal parameter data types datetime and geometry for operation 'least' +------------------------------------- +CREATE TABLE t1 (a TIMESTAMP, b Point) + +CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 +ERROR: +Illegal parameter data types timestamp and geometry for operation 'least' +------------------------------------- +CREATE TABLE t1 (a YEAR, b Point) + +CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 +ERROR: +Illegal parameter data types year and geometry for operation 'least' +# This LEAST(ENUM,GEOMETRY) creates BLOB, but fails on error with UNION (see MDEV-12503) +------------------------------------- +CREATE TABLE t1 (a ENUM(0x61), b Point) + +CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `LEAST(a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +------------------------------------- +CREATE TABLE t1 (a SET(0x61), b Point) + +CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1 +Table Create Table +t2 CREATE TABLE `t2` ( + `LEAST(a,b)` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CREATE TABLE t1 AS SELECT LEAST(NULL, Point(1,1)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `LEAST(NULL, Point(1,1))` point DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +DROP PROCEDURE p1; +DROP PROCEDURE p2; +# +# MDEV-12001 Split Item_func_round::fix_length_and_dec to virtual methods in Type_handler +# +CREATE TABLE t1 (a GEOMETRY); +SELECT ROUND(a) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'round' +DROP TABLE t1; +SELECT ROUND(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'round' +# +# MDEV-12199 Split Item_func_{abs|neg|int_val}::fix_length_and_dec() into methods in Type_handler +# +CREATE TABLE t1 (a GEOMETRY); +SELECT -a FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation '-' +SELECT ABS(a) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'abs' +SELECT CEILING(a) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'ceiling' +SELECT FLOOR(a) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'floor' +SELECT -COALESCE(a) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation '-' +SELECT ABS(COALESCE(a)) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'abs' +SELECT CEILING(COALESCE(a)) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'ceiling' +SELECT FLOOR(COALESCE(a)) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'floor' +DROP TABLE t1; +SELECT -POINT(1,1); +ERROR HY000: Illegal parameter data type geometry for operation '-' +SELECT ABS(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'abs' +SELECT CEILING(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'ceiling' +SELECT FLOOR(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'floor' +# +# MDEV-12239 Add Type_handler::Item_sum_{sum|avg|variance}_fix_length_and_dec() +# +CREATE TABLE t1 (a GEOMETRY); +SELECT SUM(POINT(1,1)) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'sum' +SELECT SUM(a) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'sum' +SELECT SUM(COALESCE(a)) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'sum' +SELECT AVG(POINT(1,1)) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'avg' +SELECT AVG(a) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'avg' +SELECT AVG(COALESCE(a)) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'avg' +SELECT VARIANCE(POINT(1,1)) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'variance(' +SELECT VARIANCE(a) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'variance(' +SELECT VARIANCE(COALESCE(a)) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'variance(' +SELECT STDDEV(POINT(1,1)) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'std(' +SELECT STDDEV(a) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'std(' +SELECT STDDEV(COALESCE(a)) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'std(' +DROP TABLE t1; +# +# MDEV-12303 Add Type_handler::Item_xxx_fix_length_and_dec() for CAST classes +# +CREATE TABLE t1 (a GEOMETRY); +SELECT CAST(POINT(1,1) AS SIGNED) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_signed' +SELECT CAST(POINT(1,1) AS UNSIGNED) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_unsigned' +SELECT CAST(POINT(1,1) AS DOUBLE) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'double_typecast' +SELECT CAST(POINT(1,1) AS DECIMAL(10,1)) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'decimal_typecast' +SELECT CAST(POINT(1,1) AS CHAR) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_char' +SELECT CAST(POINT(1,1) AS TIME) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_time' +SELECT CAST(POINT(1,1) AS DATE) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_date' +SELECT CAST(POINT(1,1) AS DATETIME) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_datetime' +SELECT CAST(a AS SIGNED) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_signed' +SELECT CAST(a AS UNSIGNED) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_unsigned' +SELECT CAST(a AS DOUBLE) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'double_typecast' +SELECT CAST(a AS DECIMAL(10,1)) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'decimal_typecast' +SELECT CAST(a AS CHAR) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_char' +SELECT CAST(a AS TIME) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_time' +SELECT CAST(a AS DATE) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_date' +SELECT CAST(a AS DATETIME) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_datetime' +SELECT CAST(COALESCE(a) AS SIGNED) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_signed' +SELECT CAST(COALESCE(a) AS UNSIGNED) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_unsigned' +SELECT CAST(COALESCE(a) AS DOUBLE) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'double_typecast' +SELECT CAST(COALESCE(a) AS DECIMAL(10,1)) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'decimal_typecast' +SELECT CAST(COALESCE(a) AS CHAR) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_char' +SELECT CAST(COALESCE(a) AS TIME) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_time' +SELECT CAST(COALESCE(a) AS DATE) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_date' +SELECT CAST(COALESCE(a) AS DATETIME) FROM t1; +ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_datetime' +SELECT LENGTH(CAST(POINT(1,1) AS BINARY)) FROM t1; +LENGTH(CAST(POINT(1,1) AS BINARY)) +SELECT LENGTH(CAST(a AS BINARY)) FROM t1; +LENGTH(CAST(a AS BINARY)) +SELECT LENGTH(CAST(COALESCE(a) AS BINARY)) FROM t1; +LENGTH(CAST(COALESCE(a) AS BINARY)) +DROP TABLE t1; +# +# MDEV-12238 Add Type_handler::Item_func_{plus|minus|mul|div|mod}_fix_length_and_dec() +# +CREATE TABLE t1 (a GEOMETRY); +SELECT POINT(1,1) + 1; +ERROR HY000: Illegal parameter data types geometry and int for operation '+' +SELECT POINT(1,1) - 1; +ERROR HY000: Illegal parameter data types geometry and int for operation '-' +SELECT POINT(1,1) * 1; +ERROR HY000: Illegal parameter data types geometry and int for operation '*' +SELECT POINT(1,1) / 1; +ERROR HY000: Illegal parameter data types geometry and int for operation '/' +SELECT POINT(1,1) MOD 1; +ERROR HY000: Illegal parameter data types geometry and int for operation 'MOD' +SELECT 1 + POINT(1,1); +ERROR HY000: Illegal parameter data types int and geometry for operation '+' +SELECT 1 - POINT(1,1); +ERROR HY000: Illegal parameter data types int and geometry for operation '-' +SELECT 1 * POINT(1,1); +ERROR HY000: Illegal parameter data types int and geometry for operation '*' +SELECT 1 / POINT(1,1); +ERROR HY000: Illegal parameter data types int and geometry for operation '/' +SELECT 1 MOD POINT(1,1); +ERROR HY000: Illegal parameter data types int and geometry for operation 'MOD' +SELECT a + 1 FROM t1; +ERROR HY000: Illegal parameter data types geometry and int for operation '+' +SELECT a - 1 FROM t1; +ERROR HY000: Illegal parameter data types geometry and int for operation '-' +SELECT a * 1 FROM t1; +ERROR HY000: Illegal parameter data types geometry and int for operation '*' +SELECT a / 1 FROM t1; +ERROR HY000: Illegal parameter data types geometry and int for operation '/' +SELECT a MOD 1 FROM t1; +ERROR HY000: Illegal parameter data types geometry and int for operation 'MOD' +SELECT 1 + a FROM t1; +ERROR HY000: Illegal parameter data types int and geometry for operation '+' +SELECT 1 - a FROM t1; +ERROR HY000: Illegal parameter data types int and geometry for operation '-' +SELECT 1 * a FROM t1; +ERROR HY000: Illegal parameter data types int and geometry for operation '*' +SELECT 1 / a FROM t1; +ERROR HY000: Illegal parameter data types int and geometry for operation '/' +SELECT 1 MOD a FROM t1; +ERROR HY000: Illegal parameter data types int and geometry for operation 'MOD' +SELECT COALESCE(a) + 1 FROM t1; +ERROR HY000: Illegal parameter data types geometry and int for operation '+' +SELECT COALESCE(a) - 1 FROM t1; +ERROR HY000: Illegal parameter data types geometry and int for operation '-' +SELECT COALESCE(a) * 1 FROM t1; +ERROR HY000: Illegal parameter data types geometry and int for operation '*' +SELECT COALESCE(a) / 1 FROM t1; +ERROR HY000: Illegal parameter data types geometry and int for operation '/' +SELECT COALESCE(a) MOD 1 FROM t1; +ERROR HY000: Illegal parameter data types geometry and int for operation 'MOD' +SELECT 1 + COALESCE(a) FROM t1; +ERROR HY000: Illegal parameter data types int and geometry for operation '+' +SELECT 1 - COALESCE(a) FROM t1; +ERROR HY000: Illegal parameter data types int and geometry for operation '-' +SELECT 1 * COALESCE(a) FROM t1; +ERROR HY000: Illegal parameter data types int and geometry for operation '*' +SELECT 1 / COALESCE(a) FROM t1; +ERROR HY000: Illegal parameter data types int and geometry for operation '/' +SELECT 1 MOD COALESCE(a) FROM t1; +ERROR HY000: Illegal parameter data types int and geometry for operation 'MOD' +DROP TABLE t1; +# +# MDEV-12514 Split Item_temporal_func::fix_length_and_dec() +# +SELECT DATE_ADD(POINT(1,1), INTERVAL 10 DAY); +ERROR HY000: Illegal parameter data types geometry and interval for operation 'date_add_interval' +SELECT DATE_SUB(POINT(1,1), INTERVAL 10 DAY); +ERROR HY000: Illegal parameter data types geometry and interval for operation 'date_add_interval' +SELECT POINT(1,1) + INTERVAL 10 DAY; +ERROR HY000: Illegal parameter data types geometry and interval for operation 'date_add_interval' +SELECT POINT(1,1) - INTERVAL 10 DAY; +ERROR HY000: Illegal parameter data types geometry and interval for operation 'date_add_interval' +SELECT INTERVAL 10 DAY + POINT(1,1); +ERROR HY000: Illegal parameter data types geometry and interval for operation 'date_add_interval' +SELECT INTERVAL 10 DAY + POINT(1,1); +ERROR HY000: Illegal parameter data types geometry and interval for operation 'date_add_interval' +SELECT ADDTIME(POINT(1,1), '10:10:10'); +ERROR HY000: Illegal parameter data types geometry and varchar for operation 'addtime' +SELECT ADDTIME('10:10:10', POINT(1,1)); +ERROR HY000: Illegal parameter data types varchar and geometry for operation 'addtime' +SELECT ADDTIME(POINT(1,1), TIME'10:10:10'); +ERROR HY000: Illegal parameter data types geometry and time for operation 'addtime' +SELECT ADDTIME(TIME'10:10:10', POINT(1,1)); +ERROR HY000: Illegal parameter data types time and geometry for operation 'addtime' +SELECT ADDTIME(POINT(1,1), TIMESTAMP'2001-01-01 10:10:10'); +ERROR HY000: Illegal parameter data types geometry and datetime for operation 'addtime' +SELECT ADDTIME(TIMESTAMP'2001-01-01 10:10:10', POINT(1,1)); +ERROR HY000: Illegal parameter data types datetime and geometry for operation 'addtime' +SELECT STR_TO_DATE(POINT(1,1),'%M %d,%Y'); +ERROR HY000: Illegal parameter data types geometry and varchar for operation 'str_to_date' +SELECT STR_TO_DATE('2001-01-01', POINT(1,1)); +ERROR HY000: Illegal parameter data types varchar and geometry for operation 'str_to_date' +# +# MDEV-12665 Hybrid functions do not preserve geometry type +# +CREATE TABLE t1 AS SELECT +Point(0,0) AS p0, +COALESCE(Point(0,0)) AS p1, +CASE WHEN 0 THEN Point(0,0) ELSE Point(1,1) END AS p2; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `p0` point DEFAULT NULL, + `p1` point DEFAULT NULL, + `p2` point DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 AS SELECT LEAST(Point(0,0),Point(0,0)) AS p1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `p1` point DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 ( +c_geometry GEOMETRY, +c_point POINT, +c_linestring LINESTRING, +c_polygon POLYGON, +c_multipoint MULTIPOINT, +c_multilinestring MULTILINESTRING, +c_multipolygon MULTIPOLYGON, +c_geometrycollection GEOMETRYCOLLECTION +); +CREATE TABLE t2 AS SELECT +COALESCE(NULL, c_geometry), +COALESCE(NULL, c_point), +COALESCE(NULL, c_linestring), +COALESCE(NULL, c_polygon), +COALESCE(NULL, c_multipoint), +COALESCE(NULL, c_multilinestring), +COALESCE(NULL, c_multipolygon), +COALESCE(NULL, c_geometrycollection) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `COALESCE(NULL, c_geometry)` geometry DEFAULT NULL, + `COALESCE(NULL, c_point)` point DEFAULT NULL, + `COALESCE(NULL, c_linestring)` linestring DEFAULT NULL, + `COALESCE(NULL, c_polygon)` polygon DEFAULT NULL, + `COALESCE(NULL, c_multipoint)` multipoint DEFAULT NULL, + `COALESCE(NULL, c_multilinestring)` multilinestring DEFAULT NULL, + `COALESCE(NULL, c_multipolygon)` multipolygon DEFAULT NULL, + `COALESCE(NULL, c_geometrycollection)` geometrycollection DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +COALESCE(c_geometry, NULL), +COALESCE(c_point, NULL), +COALESCE(c_linestring, NULL), +COALESCE(c_polygon, NULL), +COALESCE(c_multipoint, NULL), +COALESCE(c_multilinestring, NULL), +COALESCE(c_multipolygon, NULL), +COALESCE(c_geometrycollection, NULL) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `COALESCE(c_geometry, NULL)` geometry DEFAULT NULL, + `COALESCE(c_point, NULL)` point DEFAULT NULL, + `COALESCE(c_linestring, NULL)` linestring DEFAULT NULL, + `COALESCE(c_polygon, NULL)` polygon DEFAULT NULL, + `COALESCE(c_multipoint, NULL)` multipoint DEFAULT NULL, + `COALESCE(c_multilinestring, NULL)` multilinestring DEFAULT NULL, + `COALESCE(c_multipolygon, NULL)` multipolygon DEFAULT NULL, + `COALESCE(c_geometrycollection, NULL)` geometrycollection DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 AS SELECT +COALESCE(c_geometry, c_geometry), +COALESCE(c_point, c_point), +COALESCE(c_linestring, c_linestring), +COALESCE(c_polygon, c_polygon), +COALESCE(c_multipoint, c_multipoint), +COALESCE(c_multilinestring, c_multilinestring), +COALESCE(c_multipolygon, c_multipolygon), +COALESCE(c_geometrycollection, c_geometrycollection) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `COALESCE(c_geometry, c_geometry)` geometry DEFAULT NULL, + `COALESCE(c_point, c_point)` point DEFAULT NULL, + `COALESCE(c_linestring, c_linestring)` linestring DEFAULT NULL, + `COALESCE(c_polygon, c_polygon)` polygon DEFAULT NULL, + `COALESCE(c_multipoint, c_multipoint)` multipoint DEFAULT NULL, + `COALESCE(c_multilinestring, c_multilinestring)` multilinestring DEFAULT NULL, + `COALESCE(c_multipolygon, c_multipolygon)` multipolygon DEFAULT NULL, + `COALESCE(c_geometrycollection, c_geometrycollection)` geometrycollection DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +# MDEV-12560 Wrong data type for SELECT NULL UNION SELECT Point(1,1) +# +CREATE TABLE t1 AS SELECT NULL AS c1 UNION SELECT POINT(1,1); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` point DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE PROCEDURE p1(name TEXT) +BEGIN +EXECUTE IMMEDIATE CONCAT('CREATE TABLE t1 (a ', name, ')'); +CREATE TABLE t2 AS +SELECT a AS a1, a AS a2, NULL AS a3 FROM t1 UNION +SELECT a AS a1, NULL AS a2, a AS a3 FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; +DROP TABLE t1; +END; +$$ +CALL p1('geometry'); +Table Create Table +t2 CREATE TABLE `t2` ( + `a1` geometry DEFAULT NULL, + `a2` geometry DEFAULT NULL, + `a3` geometry DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CALL p1('point'); +Table Create Table +t2 CREATE TABLE `t2` ( + `a1` point DEFAULT NULL, + `a2` point DEFAULT NULL, + `a3` point DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CALL p1('linestring'); +Table Create Table +t2 CREATE TABLE `t2` ( + `a1` linestring DEFAULT NULL, + `a2` linestring DEFAULT NULL, + `a3` linestring DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CALL p1('polygon'); +Table Create Table +t2 CREATE TABLE `t2` ( + `a1` polygon DEFAULT NULL, + `a2` polygon DEFAULT NULL, + `a3` polygon DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CALL p1('multipoint'); +Table Create Table +t2 CREATE TABLE `t2` ( + `a1` multipoint DEFAULT NULL, + `a2` multipoint DEFAULT NULL, + `a3` multipoint DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CALL p1('multilinestring'); +Table Create Table +t2 CREATE TABLE `t2` ( + `a1` multilinestring DEFAULT NULL, + `a2` multilinestring DEFAULT NULL, + `a3` multilinestring DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CALL p1('multipolygon'); +Table Create Table +t2 CREATE TABLE `t2` ( + `a1` multipolygon DEFAULT NULL, + `a2` multipolygon DEFAULT NULL, + `a3` multipolygon DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +CALL p1('geometrycollection'); +Table Create Table +t2 CREATE TABLE `t2` ( + `a1` geometrycollection DEFAULT NULL, + `a2` geometrycollection DEFAULT NULL, + `a3` geometrycollection DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP PROCEDURE p1; +# +# MDEV-12798 Item_param does not preserve exact field type in EXECUTE IMMEDIATE 'CREATE TABLE AS SELECT ?' USING POINT(1,1) +# +EXECUTE IMMEDIATE 'CREATE TABLE t1 AS SELECT ?' USING POINT(1,1); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `?` point NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +PREPARE stmt FROM 'CREATE OR REPLACE TABLE t1 AS SELECT ?'; +EXECUTE stmt USING POINT(1,1); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `?` point NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions +# +SELECT +ST_ISSIMPLE(POINT(1,1)), +ST_ISRING(POINT(1,1)), +ST_ISCLOSED(POINT(1,1)), +ST_DIMENSION(POINT(1,1)), +ST_NUMGEOMETRIES(POINT(1,1)), +ST_NUMINTERIORRINGS(POINT(1,1)), +ST_NUMPOINTS(POINT(1,1)), +ST_SRID(POINT(1,1)); +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def ST_ISSIMPLE(POINT(1,1)) 3 2 1 Y 32896 0 63 +def ST_ISRING(POINT(1,1)) 3 2 2 Y 32896 0 63 +def ST_ISCLOSED(POINT(1,1)) 3 2 2 Y 32896 0 63 +def ST_DIMENSION(POINT(1,1)) 3 10 1 Y 32896 0 63 +def ST_NUMGEOMETRIES(POINT(1,1)) 3 10 0 Y 32896 0 63 +def ST_NUMINTERIORRINGS(POINT(1,1)) 3 10 0 Y 32896 0 63 +def ST_NUMPOINTS(POINT(1,1)) 3 10 0 Y 32896 0 63 +def ST_SRID(POINT(1,1)) 3 10 1 Y 32896 0 63 +ST_ISSIMPLE(POINT(1,1)) ST_ISRING(POINT(1,1)) ST_ISCLOSED(POINT(1,1)) ST_DIMENSION(POINT(1,1)) ST_NUMGEOMETRIES(POINT(1,1)) ST_NUMINTERIORRINGS(POINT(1,1)) ST_NUMPOINTS(POINT(1,1)) ST_SRID(POINT(1,1)) +1 -1 -1 0 NULL NULL NULL 0 +# +# MDEV-12803 Improve function parameter data type control +# +# +# Item_geometry_func_args_geometry +# +SELECT ST_CENTROID(1); +ERROR HY000: Illegal parameter data type int for operation 'st_centroid' +SELECT ST_ENVELOPE(1); +ERROR HY000: Illegal parameter data type int for operation 'st_envelope' +SELECT ST_BOUNDARY(1); +ERROR HY000: Illegal parameter data type int for operation 'st_boundary' +SELECT ST_STARTPOINT(1); +ERROR HY000: Illegal parameter data type int for operation 'st_startpoint' +SELECT ST_POINTONSURFACE(1); +ERROR HY000: Illegal parameter data type int for operation 'st_pointonsurface' +SELECT ST_POINTN(1,1); +ERROR HY000: Illegal parameter data type int for operation 'st_pointn' +SELECT ST_POINTN(LineString(Point(1,1)),Point(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'st_pointn' +SELECT ST_BUFFER(1, 1); +ERROR HY000: Illegal parameter data type int for operation 'st_buffer' +SELECT ST_BUFFER(Point(1,1), Point(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'st_buffer' +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_ENVELOPE(?) AS g'; +EXECUTE stmt USING 1; +ERROR HY000: Illegal parameter data type int for operation 'st_envelope' +EXECUTE stmt USING POINT(1,1); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `g` polygon DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT ST_ASTEXT(g) FROM t1; +ST_ASTEXT(g) +POLYGON((1 1,1 1,1 1,1 1,1 1)) +DROP TABLE t1; +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_BUFFER(?,?) AS g'; +EXECUTE stmt USING 1,1; +ERROR HY000: Illegal parameter data type int for operation 'st_buffer' +EXECUTE stmt USING POINT(1,1),POINT(1,1); +ERROR HY000: Illegal parameter data type geometry for operation 'st_buffer' +EXECUTE stmt USING POINT(1,1),0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `g` geometry DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT ST_GEOMETRYTYPE(g) FROM t1; +ST_GEOMETRYTYPE(g) +POINT +DROP TABLE t1; +DEALLOCATE PREPARE stmt; +# +# Functions created GEOMETRY from non-GEOMETRY +# +SELECT ST_GEOMETRYFROMTEXT(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_geometryfromtext' +SELECT ST_GEOMETRYFROMTEXT(Point(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'st_geometryfromtext' +SELECT ST_GEOMETRYFROMTEXT(Point(1,1), 1); +ERROR HY000: Illegal parameter data type geometry for operation 'st_geometryfromtext' +SELECT ST_GEOMETRYFROMTEXT('test', Point(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'st_geometryfromtext' +SELECT ST_GEOMETRYFROMWKB(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_geometryfromwkb' +SELECT ST_GEOMETRYFROMWKB(1); +ERROR HY000: Illegal parameter data type int for operation 'st_geometryfromwkb' +SELECT ST_GEOMETRYFROMWKB(1, 1); +ERROR HY000: Illegal parameter data type int for operation 'st_geometryfromwkb' +SELECT ST_GEOMETRYFROMWKB(Point(1,1), Point(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'st_geometryfromwkb' +SELECT ST_GEOMFROMGEOJSON(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_geomfromgeojson' +SELECT ST_GEOMFROMGEOJSON(1); +ERROR HY000: Illegal parameter data type int for operation 'st_geomfromgeojson' +SELECT ST_GEOMFROMGEOJSON(1,1); +ERROR HY000: Illegal parameter data type int for operation 'st_geomfromgeojson' +SELECT ST_GEOMFROMGEOJSON(Point(1,1), Point(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'st_geomfromgeojson' +SELECT POINT(ROW(1,1),1); +ERROR HY000: Illegal parameter data type row for operation 'point' +SELECT POINT(POINT(1,1),1); +ERROR HY000: Illegal parameter data type geometry for operation 'point' +SELECT POINT(1,ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'point' +SELECT POINT(1,POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'point' +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_GEOMFROMTEXT(?,?) AS g'; +EXECUTE stmt USING 1,1; +ERROR HY000: Illegal parameter data type int for operation 'st_geometryfromtext' +EXECUTE stmt USING POINT(1,1),POINT(1,1); +ERROR HY000: Illegal parameter data type geometry for operation 'st_geometryfromtext' +EXECUTE stmt USING 'POINT(1 1)',1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `g` geometry DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT ST_ASTEXT(g), SRID(g) FROM t1; +ST_ASTEXT(g) SRID(g) +POINT(1 1) 1 +DROP TABLE t1; +DEALLOCATE PREPARE stmt; +# Item_func_spatial_collection +SELECT GEOMETRYCOLLECTION(ROW(1,1), POINT(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'geometrycollection' +SELECT GEOMETRYCOLLECTION(POINT(1,1), ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'geometrycollection' +SELECT GEOMETRYCOLLECTION(1, POINT(1,1)); +ERROR HY000: Illegal parameter data type int for operation 'geometrycollection' +SELECT GEOMETRYCOLLECTION(POINT(1,1), 1); +ERROR HY000: Illegal parameter data type int for operation 'geometrycollection' +# Item_func_spatial_operation +SELECT ST_UNION(ROW(1,1), POINT(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_union' +SELECT ST_UNION(POINT(1,1), ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_union' +SELECT ST_UNION(1, POINT(1,1)); +ERROR HY000: Illegal parameter data type int for operation 'st_union' +SELECT ST_UNION(POINT(1,1), 1); +ERROR HY000: Illegal parameter data type int for operation 'st_union' +# Item_binary_func_args_geometry +SELECT ST_ASWKB(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_aswkb' +SELECT ST_ASWKB(1); +ERROR HY000: Illegal parameter data type int for operation 'st_aswkb' +SELECT ST_ASWKB('test'); +ERROR HY000: Illegal parameter data type varchar for operation 'st_aswkb' +# Item_real_func_args_geometry +SELECT ST_X(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_x' +SELECT ST_X(1); +ERROR HY000: Illegal parameter data type int for operation 'st_x' +SELECT ST_X('test'); +ERROR HY000: Illegal parameter data type varchar for operation 'st_x' +SELECT ST_Y(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_y' +SELECT ST_Y(1); +ERROR HY000: Illegal parameter data type int for operation 'st_y' +SELECT ST_Y('test'); +ERROR HY000: Illegal parameter data type varchar for operation 'st_y' +SELECT ST_AREA(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_area' +SELECT ST_AREA(1); +ERROR HY000: Illegal parameter data type int for operation 'st_area' +SELECT ST_AREA('test'); +ERROR HY000: Illegal parameter data type varchar for operation 'st_area' +SELECT ST_LENGTH(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_length' +SELECT ST_LENGTH(1); +ERROR HY000: Illegal parameter data type int for operation 'st_length' +SELECT ST_LENGTH('test'); +ERROR HY000: Illegal parameter data type varchar for operation 'st_length' +# Item_real_func_geometry_args_geometry_geometry +SELECT ST_DISTANCE(ROW(1,1), 1); +ERROR HY000: Illegal parameter data type row for operation 'st_distance' +SELECT ST_DISTANCE(1, 1); +ERROR HY000: Illegal parameter data type int for operation 'st_distance' +SELECT ST_DISTANCE('test', 1); +ERROR HY000: Illegal parameter data type varchar for operation 'st_distance' +SELECT ST_DISTANCE(POINT(1,1), ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_distance' +SELECT ST_DISTANCE(POINT(1,1), 1); +ERROR HY000: Illegal parameter data type int for operation 'st_distance' +SELECT ST_DISTANCE(POINT(1,1), 'test'); +ERROR HY000: Illegal parameter data type varchar for operation 'st_distance' +# Item_int_func_args_geometry +SELECT ST_ISSIMPLE(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_issimple' +SELECT ST_ISSIMPLE(1); +ERROR HY000: Illegal parameter data type int for operation 'st_issimple' +SELECT ST_ISSIMPLE('test'); +ERROR HY000: Illegal parameter data type varchar for operation 'st_issimple' +SELECT ST_ISRING(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_isring' +SELECT ST_ISRING(1); +ERROR HY000: Illegal parameter data type int for operation 'st_isring' +SELECT ST_ISRING('test'); +ERROR HY000: Illegal parameter data type varchar for operation 'st_isring' +SELECT ST_ISCLOSED(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_isclosed' +SELECT ST_ISCLOSED(1); +ERROR HY000: Illegal parameter data type int for operation 'st_isclosed' +SELECT ST_ISCLOSED('test'); +ERROR HY000: Illegal parameter data type varchar for operation 'st_isclosed' +SELECT ST_DIMENSION(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_dimension' +SELECT ST_DIMENSION(1); +ERROR HY000: Illegal parameter data type int for operation 'st_dimension' +SELECT ST_DIMENSION('test'); +ERROR HY000: Illegal parameter data type varchar for operation 'st_dimension' +SELECT ST_NUMGEOMETRIES(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_numgeometries' +SELECT ST_NUMGEOMETRIES(1); +ERROR HY000: Illegal parameter data type int for operation 'st_numgeometries' +SELECT ST_NUMGEOMETRIES('test'); +ERROR HY000: Illegal parameter data type varchar for operation 'st_numgeometries' +SELECT ST_NUMINTERIORRINGS(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_numinteriorrings' +SELECT ST_NUMINTERIORRINGS(1); +ERROR HY000: Illegal parameter data type int for operation 'st_numinteriorrings' +SELECT ST_NUMINTERIORRINGS('test'); +ERROR HY000: Illegal parameter data type varchar for operation 'st_numinteriorrings' +SELECT ST_NUMPOINTS(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_numpoints' +SELECT ST_NUMPOINTS(1); +ERROR HY000: Illegal parameter data type int for operation 'st_numpoints' +SELECT ST_NUMPOINTS('test'); +ERROR HY000: Illegal parameter data type varchar for operation 'st_numpoints' +SELECT ST_SRID(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'srid' +SELECT ST_SRID(1); +ERROR HY000: Illegal parameter data type int for operation 'srid' +SELECT ST_SRID('test'); +ERROR HY000: Illegal parameter data type varchar for operation 'srid' +# Item_bool_func_args_geometry +SELECT ST_ISEMPTY(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_isempty' +SELECT ST_ISEMPTY(1); +ERROR HY000: Illegal parameter data type int for operation 'st_isempty' +SELECT ST_ISEMPTY('test'); +ERROR HY000: Illegal parameter data type varchar for operation 'st_isempty' +# Item_bool_func_geometry_args_geometry_geometry +SELECT ST_RELATE(ROW(1,1), POINT(1,1), 'T*F**FFF*'); +ERROR HY000: Illegal parameter data type row for operation 'st_relate' +SELECT ST_RELATE(POINT(1,1), ROW(1,1), 'T*F**FFF*'); +ERROR HY000: Illegal parameter data type row for operation 'st_relate' +SELECT ST_RELATE(1, POINT(1,1), 'T*F**FFF*'); +ERROR HY000: Illegal parameter data type int for operation 'st_relate' +SELECT ST_RELATE(POINT(1,1), 1, 'T*F**FFF*'); +ERROR HY000: Illegal parameter data type int for operation 'st_relate' +SELECT ST_RELATE(Point(1,1),Point(1,1),'T*F**FFF*') AS equals; +equals +1 +SELECT ST_RELATE(Point(1,1),Point(1,1),NULL); +ST_RELATE(Point(1,1),Point(1,1),NULL) +NULL +SELECT ST_RELATE(Point(1,1),Point(1,1),ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_relate' +SELECT ST_RELATE(Point(1,1),Point(1,1),1); +ERROR HY000: Illegal parameter data type int for operation 'st_relate' +SELECT ST_RELATE(Point(1,1),Point(1,1),1.0); +ERROR HY000: Illegal parameter data type decimal for operation 'st_relate' +SELECT ST_RELATE(Point(1,1),Point(1,1),1e0); +ERROR HY000: Illegal parameter data type double for operation 'st_relate' +SELECT ST_RELATE(Point(1,1),Point(1,1),TIME'10:10:10'); +ERROR HY000: Illegal parameter data type time for operation 'st_relate' +SELECT ST_RELATE(Point(1,1),Point(1,1),DATE'2010-01-01'); +ERROR HY000: Illegal parameter data type date for operation 'st_relate' +SELECT ST_RELATE(Point(1,1),Point(1,1),TIMESTAMP'2010-01-01 10:10:10'); +ERROR HY000: Illegal parameter data type datetime for operation 'st_relate' +SELECT ST_RELATE(Point(1,1),Point(1,1),Point(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'st_relate' +# Item_str_ascii_func_args_geometry +SELECT ST_ASTEXT(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_astext' +SELECT ST_ASTEXT(1); +ERROR HY000: Illegal parameter data type int for operation 'st_astext' +SELECT ST_ASTEXT('test'); +ERROR HY000: Illegal parameter data type varchar for operation 'st_astext' +SELECT ST_GEOMETRYTYPE(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_geometrytype' +SELECT ST_GEOMETRYTYPE(1); +ERROR HY000: Illegal parameter data type int for operation 'st_geometrytype' +SELECT ST_GEOMETRYTYPE('test'); +ERROR HY000: Illegal parameter data type varchar for operation 'st_geometrytype' +SELECT ST_ASGEOJSON(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_asgeojson' +SELECT ST_ASGEOJSON(1); +ERROR HY000: Illegal parameter data type int for operation 'st_asgeojson' +SELECT ST_ASGEOJSON('test'); +ERROR HY000: Illegal parameter data type varchar for operation 'st_asgeojson' +SELECT ST_ASGEOJSON(POINT(1,1), POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'st_asgeojson' +SELECT ST_ASGEOJSON(POINT(1,1), 1, POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'st_asgeojson' +# Item_func_spatial_rel +SELECT ST_TOUCHES(ROW(1,1), POINT(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_touches' +SELECT ST_TOUCHES(POINT(1,1), ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_touches' +SELECT ST_TOUCHES(1, POINT(1,1)); +ERROR HY000: Illegal parameter data type int for operation 'st_touches' +SELECT ST_TOUCHES(POINT(1,1), 1); +ERROR HY000: Illegal parameter data type int for operation 'st_touches' +SELECT ST_TOUCHES('test', POINT(1,1)); +ERROR HY000: Illegal parameter data type varchar for operation 'st_touches' +SELECT ST_TOUCHES(POINT(1,1), 'test'); +ERROR HY000: Illegal parameter data type varchar for operation 'st_touches' +SELECT MBRTOUCHES(ROW(1,1), POINT(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_touches' +SELECT MBRTOUCHES(POINT(1,1), ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'st_touches' +SELECT MBRTOUCHES(1, POINT(1,1)); +ERROR HY000: Illegal parameter data type int for operation 'st_touches' +SELECT MBRTOUCHES(POINT(1,1), 1); +ERROR HY000: Illegal parameter data type int for operation 'st_touches' +SELECT MBRTOUCHES('test', POINT(1,1)); +ERROR HY000: Illegal parameter data type varchar for operation 'st_touches' +SELECT MBRTOUCHES(POINT(1,1), 'test'); +ERROR HY000: Illegal parameter data type varchar for operation 'st_touches' +# +# MDEV-13964 Parameter data type control for Item_real_func +# +SELECT EXP(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'exp' +SELECT LN(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'ln' +SELECT LOG2(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'log2' +SELECT LOG10(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'log10' +SELECT SQRT(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'sqrt' +SELECT ACOS(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'acos' +SELECT ASIN(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'asin' +SELECT COS(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'cos' +SELECT SIN(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'sin' +SELECT TAN(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'tan' +SELECT COT(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'cot' +SELECT LOG(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'log' +SELECT LOG(POINT(1,1),POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'log' +SELECT LOG(1, POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'log' +SELECT ATAN(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'atan' +SELECT ATAN(POINT(1,1),POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'atan' +SELECT ATAN(1, POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'atan' +SELECT POW(POINT(1,1),POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'pow' +SELECT RAND(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'rand' +SELECT RADIANS(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'radians' +SELECT DEGREES(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'degrees' +SELECT EXP(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'exp' +SELECT LN(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'ln' +SELECT LOG2(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'log2' +SELECT LOG10(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'log10' +SELECT SQRT(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'sqrt' +SELECT ACOS(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'acos' +SELECT ASIN(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'asin' +SELECT COS(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'cos' +SELECT SIN(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'sin' +SELECT TAN(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'tan' +SELECT COT(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'cot' +SELECT LOG(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'log' +SELECT LOG(ROW(1,1),ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'log' +SELECT LOG(1, ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'log' +SELECT ATAN(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'atan' +SELECT ATAN(ROW(1,1),ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'atan' +SELECT ATAN(1, ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'atan' +SELECT POW(ROW(1,1),ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'pow' +SELECT RAND(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'rand' +SELECT RADIANS(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'radians' +SELECT DEGREES(ROW(1,1)); +ERROR HY000: Illegal parameter data type row for operation 'degrees' +# +# MDEV-13965 Parameter data type control for Item_longlong_func +# +SELECT POINT(1,1) | 1; +ERROR HY000: Illegal parameter data type geometry for operation '|' +SELECT 1 | POINT(1,1); +ERROR HY000: Illegal parameter data type geometry for operation '|' +SELECT POINT(1,1) & 1; +ERROR HY000: Illegal parameter data type geometry for operation '&' +SELECT 1 & POINT(1,1); +ERROR HY000: Illegal parameter data type geometry for operation '&' +SELECT POINT(1,1) << 1; +ERROR HY000: Illegal parameter data type geometry for operation '<<' +SELECT 1 << POINT(1,1); +ERROR HY000: Illegal parameter data type geometry for operation '<<' +SELECT POINT(1,1) >> 1; +ERROR HY000: Illegal parameter data type geometry for operation '>>' +SELECT 1 >> POINT(1,1); +ERROR HY000: Illegal parameter data type geometry for operation '>>' +SELECT ~POINT(1,1); +ERROR HY000: Illegal parameter data type geometry for operation '~' +SELECT TO_SECONDS(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'to_seconds' +SELECT TIMESTAMPDIFF(SECOND,POINT(1,1), 1); +ERROR HY000: Illegal parameter data type geometry for operation 'timestampdiff' +SELECT TIMESTAMPDIFF(SECOND,1, POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'timestampdiff' +SELECT INET_ATON(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'inet_aton' +SELECT LAST_INSERT_ID(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'last_insert_id' +# +# MDEV-13966 Parameter data type control for Item_temporal_func +# +SELECT FROM_DAYS(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'from_days' +SELECT MAKEDATE(POINT(1,1),1); +ERROR HY000: Illegal parameter data type geometry for operation 'makedate' +SELECT MAKEDATE(1, POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'makedate' +SELECT LAST_DAY(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'last_day' +SELECT SEC_TO_TIME(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'sec_to_time' +SELECT TIMEDIFF(POINT(1,1),1); +ERROR HY000: Illegal parameter data type geometry for operation 'timediff' +SELECT TIMEDIFF(1, POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'timediff' +SELECT MAKETIME(POINT(1,1),1,1); +ERROR HY000: Illegal parameter data type geometry for operation 'maketime' +SELECT MAKETIME(1, POINT(1,1), 1); +ERROR HY000: Illegal parameter data type geometry for operation 'maketime' +SELECT MAKETIME(1, 1, POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'maketime' +SELECT FROM_UNIXTIME(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'from_unixtime' +SELECT CONVERT_TZ(POINT(1,1),1,1); +ERROR HY000: Illegal parameter data type geometry for operation 'convert_tz' +SELECT CONVERT_TZ(1, POINT(1,1), 1); +ERROR HY000: Illegal parameter data type geometry for operation 'convert_tz' +SELECT CONVERT_TZ(1, 1, POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'convert_tz' +# +# MDEV-13967 Parameter data type control for Item_long_func +# +SELECT STRCMP(POINT(1,1),POINT(1,1)); +STRCMP(POINT(1,1),POINT(1,1)) +0 +SELECT CHAR_LENGTH(POINT(1,1)); +CHAR_LENGTH(POINT(1,1)) +25 +SELECT OCTET_LENGTH(POINT(1,1)); +OCTET_LENGTH(POINT(1,1)) +25 +SELECT UNCOMPRESSED_LENGTH(POINT(1,1)); +UNCOMPRESSED_LENGTH(POINT(1,1)) +0 +SELECT COERCIBILITY(POINT(1,1)); +COERCIBILITY(POINT(1,1)) +4 +SELECT ASCII(POINT(1,1)); +ASCII(POINT(1,1)) +0 +SELECT CRC32(POINT(1,1)); +CRC32(POINT(1,1)) +1349318989 +SELECT ORD(POINT(1,1)); +ORD(POINT(1,1)) +0 +SELECT SIGN(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'sign' +SELECT LOCATE('a','a',POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'locate' +SELECT LOCATE(POINT(1,1),POINT(1,1)); +LOCATE(POINT(1,1),POINT(1,1)) +1 +SELECT BIT_COUNT(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'bit_count' +SELECT BENCHMARK(POINT(1,1),''); +ERROR HY000: Illegal parameter data type geometry for operation 'benchmark' +SELECT SLEEP(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'sleep' +SELECT GET_LOCK('x', POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'get_lock' +SELECT PERIOD_ADD(POINT(1,1),1); +ERROR HY000: Illegal parameter data type geometry for operation 'period_add' +SELECT PERIOD_ADD(1,POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'period_add' +SELECT PERIOD_DIFF(POINT(1,1),1); +ERROR HY000: Illegal parameter data type geometry for operation 'period_diff' +SELECT PERIOD_DIFF(1,POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'period_diff' +SELECT TO_DAYS(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'to_days' +SELECT DAYOFMONTH(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'dayofmonth' +SELECT DAYOFYEAR(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'dayofyear' +SELECT QUARTER(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'quarter' +SELECT YEAR(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'year' +SELECT YEARWEEK(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'yearweek' +SELECT WEEK(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'week' +SELECT WEEK(POINT(1,1),1); +ERROR HY000: Illegal parameter data type geometry for operation 'week' +SELECT WEEK(1,POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'week' +SELECT HOUR(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'hour' +SELECT MINUTE(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'minute' +SELECT SECOND(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'second' +SELECT MICROSECOND(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'microsecond' +SELECT JSON_DEPTH(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'json_depth' +SELECT JSON_LENGTH(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'json_length' +SELECT JSON_LENGTH('json', POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'json_length' +SELECT JSON_LENGTH(POINT(1,1), POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'json_length' +SELECT REGEXP_INSTR(POINT(1,1),''); +REGEXP_INSTR(POINT(1,1),'') +1 +SELECT REGEXP_INSTR('',POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'regexp_instr' +SELECT FIND_IN_SET(POINT(1,1),''); +FIND_IN_SET(POINT(1,1),'') +0 +SELECT FIND_IN_SET('',POINT(1,1)); +FIND_IN_SET('',POINT(1,1)) +0 +SELECT RELEASE_LOCK(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'release_lock' +SELECT IS_FREE_LOCK(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'is_free_lock' +SELECT IS_USED_LOCK(POINT(1,1)); +ERROR HY000: Illegal parameter data type geometry for operation 'is_used_lock' +# +# End of 10.3 tests +# diff --cc mysql-test/main/gis.test index fbc130fcb7e,00000000000..c4115f7ed54 mode 100644,000000..100644 --- a/mysql-test/main/gis.test +++ b/mysql-test/main/gis.test @@@ -1,3006 -1,0 +1,3039 @@@ +-- source include/have_geometry.inc + + +# +# Spatial objects +# + +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(AsWKB(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(AsWKB(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(AsWKB(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(AsWKB(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(AsWKB(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(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))), +(122, GeomFromText('GeometryCollection()')), +(123, GeomFromText('GeometryCollection EMPTY')); + +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 1416 +insert into t1 values ('Garbage'); +-- error 1416 +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 GeomFromWKB(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)))')); + +# Expected results are 115.2970604672862 and 36.23335610879993, but IA64 returns +# slightly different values due to fused multiply-add instructions. +--replace_result 115.29706047613604 115.2970604672862 36.23335611157958 36.23335610879993 +select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from +t1 where object_id=85998; + +# Expected result is 36.34725218253213, but IA64 returns 36.34725217627852 +# due to fused multiply-add instructions. +--replace_result 36.34725217627852 36.34725218253213 -114.86854470090232 -114.86854472054372 +select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from +t1 where object_id=85984; + +drop table t1; + +create table t1 (fl geometry not null); +--error 1416 +insert into t1 values (1); +--error 1416 +insert into t1 values (1.11); +--error 1416 +insert into t1 values ("qwerty"); +--error 1048 +insert into t1 values (pointfromtext('point(1,1)')); + +drop table t1; + +select (asWKT(geomfromwkb((0x000000000140240000000000004024000000000000)))); +select (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440)))); + +--enable_metadata +create table t1 (g GEOMETRY); +select * from t1; +select asbinary(g) from t1; +--disable_metadata +drop table t1; + +create table t1 (a TEXT, b GEOMETRY NOT NULL, SPATIAL KEY(b)); +alter table t1 disable keys; +--error 1263 +load data infile '../../std_data/bad_gis_data.dat' into table t1; +alter table t1 enable keys; +drop table t1; + +# +# Bug #26038: is null and bad data +# + +create table t1 (a int, b blob); +insert into t1 values (1, ''), (2, NULL), (3, '1'); +select * from t1; + +--error ER_ILLEGAL_VALUE_FOR_TYPE +select + geometryfromtext(b) IS NULL, geometryfromwkb(b) IS NULL, astext(b) IS NULL, + aswkb(b) IS NULL, geometrytype(b) IS NULL, centroid(b) IS NULL, + envelope(b) IS NULL, startpoint(b) IS NULL, endpoint(b) IS NULL, + exteriorring(b) IS NULL, pointn(b, 1) IS NULL, geometryn(b, 1) IS NULL, + interiorringn(b, 1) IS NULL, multipoint(b) IS NULL, isempty(b) IS NULL, + issimple(b) IS NULL, isclosed(b) IS NULL, dimension(b) IS NULL, + numgeometries(b) IS NULL, numinteriorrings(b) IS NULL, numpoints(b) IS NULL, + area(b) IS NULL, glength(b) IS NULL, srid(b) IS NULL, x(b) IS NULL, + y(b) IS NULL +from t1; + +select + within(b, b) IS NULL, contains(b, b) IS NULL, overlaps(b, b) IS NULL, + equals(b, b) IS NULL, disjoint(b, b) IS NULL, touches(b, b) IS NULL, + intersects(b, b) IS NULL, crosses(b, b) IS NULL +from t1; + +--error ER_ILLEGAL_VALUE_FOR_TYPE +select + point(b, b) IS NULL, linestring(b) IS NULL, polygon(b) IS NULL, multipoint(b) IS NULL, + multilinestring(b) IS NULL, multipolygon(b) IS NULL, + geometrycollection(b) IS NULL +from t1; + +drop table t1; + +# +# Bug #27164: Crash when mixing InnoDB and MyISAM Geospatial tables +# +CREATE TABLE t1(a POINT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (NULL); +SELECT * FROM t1; +DROP TABLE t1; + +# +# Bug #30955 geomfromtext() crasher +# +CREATE TABLE `t1` ( `col9` set('a'), `col89` date); +INSERT INTO `t1` VALUES ('','0000-00-00'); +select geomfromtext(col9,col89) as a from t1; +DROP TABLE t1; + +# +# Bug #31158 Spatial, Union, LONGBLOB vs BLOB bug (crops data) +# + +CREATE TABLE t1 ( + geomdata polygon NOT NULL, + SPATIAL KEY index_geom (geomdata) +) ENGINE=MyISAM DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED; + +CREATE TABLE t2 ( + geomdata polygon NOT NULL, + SPATIAL KEY index_geom (geomdata) +) ENGINE=MyISAM DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED; + +CREATE TABLE t3 +select + aswkb(ws.geomdata) AS geomdatawkb + from + t1 ws +union + select + aswkb(ws.geomdata) AS geomdatawkb + from + t2 ws; + +describe t3; + +drop table t1; +drop table t2; +drop table t3; + +# +# Bug #30284 spatial key corruption +# + +create table t1(col1 geometry default null,col15 geometrycollection not +null,spatial index(col15),index(col1(15)))engine=myisam; +insert into t1 set col15 = GeomFromText('POINT(6 5)'); +insert into t1 set col15 = GeomFromText('POINT(6 5)'); +check table t1 extended; +drop table t1; + +--echo End of 4.1 tests + +# +# Bug #12281 (Geometry: crash in trigger) +# + +create table t1 (s1 geometry not null,s2 char(100)); +create trigger t1_bu before update on t1 for each row set new.s1 = null; +--error 1048 +insert into t1 values (null,null); +drop table t1; + +# +# Bug #10499 (function creation with GEOMETRY datatype) +# +--disable_warnings +drop procedure if exists fn3; +--enable_warnings +create function fn3 () returns point deterministic return GeomFromText("point(1 1)"); +show create function fn3; +select astext(fn3()); +drop function fn3; + +# +# Bug #12267 (primary key over GIS) +# +create table t1(pt POINT); +alter table t1 add primary key pti(pt); +drop table t1; +create table t1(pt GEOMETRY); +--error 1170 +alter table t1 add primary key pti(pt); +alter table t1 add primary key pti(pt(20)); +drop table t1; + + +create table t1 select GeomFromText('point(1 1)'); +desc t1; +drop table t1; + +# +# Bug #20691 (DEFAULT over NOT NULL field) +# +create table t1 (g geometry not null); +--error ER_CANT_CREATE_GEOMETRY_OBJECT +insert into t1 values(default); +drop table t1; + +# +# Bug #27300: create view with geometry functions lost columns types +# +CREATE TABLE t1 (a GEOMETRY); +CREATE VIEW v1 AS SELECT GeomFromwkb(ASBINARY(a)) FROM t1; +CREATE VIEW v2 AS SELECT a FROM t1; +DESCRIBE v1; +DESCRIBE v2; + +DROP VIEW v1,v2; +DROP TABLE t1; + +# +# Bug#24563: MBROverlaps does not seem to function propertly +# Bug#54888: MBROverlaps missing in 5.1? +# + +# Test all MBR* functions and their non-MBR-prefixed aliases, +# using shifted squares to verify the spatial relations. + +create table t1 (name VARCHAR(100), square GEOMETRY); + +INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))')); + +INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))')); +INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))')); + +INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))')); +INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))')); +INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))')); + +INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))')); +INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))')); +INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))')); + +INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))')); +INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))')); +INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))')); + +INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))')); +INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))')); +INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))')); + +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; + +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersects FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; +SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; + +# Overlaps needs a few more tests, with point and line dimensions + +SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))'); +SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))'); +SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))'); +SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))'); +SET @point1 = GeomFromText('POLYGON ((0 0))'); +SET @point2 = GeomFromText('POLYGON ((-2 0))'); + +SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name; +SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name; +SELECT Overlaps(@horiz1, @vert1) FROM DUAL; +SELECT Overlaps(@horiz1, @horiz2) FROM DUAL; +SELECT Overlaps(@horiz1, @horiz3) FROM DUAL; +SELECT Overlaps(@horiz1, @point1) FROM DUAL; +SELECT Overlaps(@horiz1, @point2) FROM DUAL; + +DROP TABLE t1; + +# +# Bug#28763: Selecting geometry fields in UNION caused server crash. +# +create table t1(f1 geometry, f2 linestring, f3 linestring); +select f1 from t1 union select f1 from t1; +insert into t1 (f2,f3) values (GeomFromText('LINESTRING(1 1, 2 2)'), + GeomFromText('LINESTRING(0 0,1 1,2 2)')); +select AsText(f2),AsText(f3) from t1; +select AsText(a) from (select f2 as a from t1 union select f3 from t1) t; +create table t2 as select f2 as a from t1 union select f3 from t1; +desc t2; +select AsText(a) from t2; +drop table t1, t2; + +# +# Bug #29166: MYsql crash when query is run +# + +# The test query itself is not logged : too large output. +# The real test is the second query : see if the first hasn't crashed the +# server +--disable_query_log +--disable_result_log +SELECT AsText(GeometryFromText(CONCAT( + 'MULTIPOLYGON(((', + REPEAT ('-0.00000000001234567890123456789012 -0.123456789012345678,', 1000), + '-0.00000000001234567890123456789012 -0.123456789012345678', + ')))' +))) AS a; +--enable_result_log +--enable_query_log +SELECT 1; + +-- source include/gis_keys.inc + +# +# Bug #31155 gis types in union'd select cause crash +# + +create table `t1` (`col002` point)engine=myisam; +insert into t1 values (),(),(); +select min(`col002`) from t1 union select `col002` from t1; +drop table t1; + +--echo # +--echo # Bug #47780: crash when comparing GIS items from subquery +--echo # + +CREATE TABLE t1(a INT, b MULTIPOLYGON); +INSERT INTO t1 VALUES + (0, + GEOMFROMTEXT( + 'multipolygon(((1 2,3 4,5 6,7 8,9 8),(7 6,5 4,3 2,1 2,3 4)))')); + +--echo # must not crash +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 FROM t1 WHERE a <> (SELECT GEOMETRYCOLLECTIONFROMWKB(b) FROM t1); + +DROP TABLE t1; + +--echo # +--echo # Bug #49250 : spatial btree index corruption and crash +--echo # Part one : spatial syntax check +--echo # + +--error ER_PARSE_ERROR +CREATE TABLE t1(col1 MULTIPOLYGON NOT NULL, + SPATIAL INDEX USING BTREE (col1)); +CREATE TABLE t2(col1 MULTIPOLYGON NOT NULL); +--error ER_PARSE_ERROR +CREATE SPATIAL INDEX USING BTREE ON t2(col); +--error ER_PARSE_ERROR +ALTER TABLE t2 ADD SPATIAL INDEX USING BTREE (col1); + +DROP TABLE t2; + +--echo End of 5.0 tests + + +# +# Bug #11335 View redefines column types +# +create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime); +create view v1 as select * from t1; +desc v1; +drop view v1; +drop table t1; + +# +# Bug#44684: valgrind reports invalid reads in +# Item_func_spatial_collection::val_str +# +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT MultiPoint(12345,''); +#SELECT MultiPoint(123451,''); +#SELECT MultiPoint(1234512,''); +#SELECT MultiPoint(12345123,''); + +--error ER_ILLEGAL_VALUE_FOR_TYPE +#SELECT MultiLineString(12345,''); +#SELECT MultiLineString(123451,''); +#SELECT MultiLineString(1234512,''); +#SELECT MultiLineString(12345123,''); + +--error ER_ILLEGAL_VALUE_FOR_TYPE +#SELECT LineString(12345,''); +#SELECT LineString(123451,''); +#SELECT LineString(1234512,''); +#SELECT LineString(12345123,''); + +--error ER_ILLEGAL_VALUE_FOR_TYPE +#SELECT Polygon(12345,''); +#SELECT Polygon(123451,''); +#SELECT Polygon(1234512,''); +#SELECT Polygon(12345123,''); + +# +# Bug55531 crash with conversions of geometry types / strings +# +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT 1 FROM (SELECT GREATEST(1,GEOMETRYCOLLECTION('00000','00000')) b FROM DUAL) AS d WHERE (LINESTRING(d.b)); + + +--echo # +--echo # BUG#51875: crash when loading data into geometry function polyfromwkb +--echo # +SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; +SET @a=POLYFROMWKB(@a); +SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440; +SET @a=POLYFROMWKB(@a); + + +# +# Bug #57321 crashes and valgrind errors from spatial types +# + +create table t1(a geometry NOT NULL)engine=myisam; +insert into t1 values (geomfromtext("point(0 1)")); +insert into t1 values (geomfromtext("point(1 0)")); +select * from (select polygon(t1.a) as p from t1 order by t1.a) d; +drop table t1; + + +--echo # +--echo # Test for bug #59888 "debug assertion when attempt to create spatial index +--echo # on char > 31 bytes". +--echo # +create table t1(a char(32) not null) engine=myisam; +--error ER_WRONG_ARGUMENTS +create spatial index i on t1 (a); +drop table t1; + + +# +# Bug#11767480 - SPATIAL INDEXES ON NON-SPATIAL COLUMNS CAUSE CRASHES. +# +CREATE TABLE t0 (a BINARY(32) NOT NULL); +--error ER_WRONG_ARGUMENTS +CREATE SPATIAL INDEX i on t0 (a); +INSERT INTO t0 VALUES (1); + +--error ER_WRONG_ARGUMENTS +CREATE TABLE t1( + col0 BINARY NOT NULL, + col2 TIMESTAMP, + SPATIAL INDEX i1 (col0) +) ENGINE=MyISAM; + +# Test other ways to add indices +CREATE TABLE t1 ( + col0 BINARY NOT NULL, + col2 TIMESTAMP +) ENGINE=MyISAM; + +--error ER_WRONG_ARGUMENTS +CREATE SPATIAL INDEX idx0 ON t1(col0); + +--error ER_WRONG_ARGUMENTS +ALTER TABLE t1 ADD SPATIAL INDEX i1 (col0); + +CREATE TABLE t2 ( + col0 INTEGER NOT NULL, + col1 POINT, + col2 POINT +); + +--error ER_WRONG_ARGUMENTS +CREATE SPATIAL INDEX idx0 ON t2 (col1, col2); + +--error ER_WRONG_ARGUMENTS +CREATE TABLE t3 ( + col0 INTEGER NOT NULL, + col1 POINT, + col2 LINESTRING, + SPATIAL INDEX i1 (col1, col2) +); + +# cleanup +DROP TABLE t0, t1, t2; + + +--echo # +--echo # BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS +--echo # +SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20))); + +--echo # +--echo # BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN +--echo # GEOMETRY FUNCTION ARGUMENTS +--echo # +--replace_regex /non geometric .* value/non geometric '' value/ +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT GEOMETRYCOLLECTION((SELECT @@OLD)); + +--echo # +--echo # MDEV-4252 geometry query crashes server +--echo # +select astext(0x0100000000030000000100000000000010); +select astext(st_centroid(0x0100000000030000000100000000000010)); +select astext(st_exteriorring(0x0100000000030000000100000000000010)); +select envelope(0x0100000000030000000100000000000010); +select geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1); +select geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1); + +--echo # +--echo # MDEV-4296 Assertion `n_linear_rings > 0' fails in Gis_polygon::centroid_xy +--echo # + +SELECT Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) ))); + +--echo # +--echo # MDEV-4295 Server crashes in get_point on a query with Area, AsBinary, MultiPoint +--echo # +SELECT Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2)))); +--echo End of 5.1 tests + +#bug 850775 ST_AREA does not work on GEOMETRYCOLLECTIONs in maria-5.3-gis +select ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))')); + +#bug 855336 ST_LENGTH does not work on GEOMETRYCOLLECTIONs +select ST_LENGTH(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 100 30, 20 30), POINT(3 3), LINESTRING(20 20, 30 20))')); + + +# Conformance tests +# +# C.3.3 Geometry types and functions +# + +--disable_warnings +DROP DATABASE IF EXISTS gis_ogs; +--enable_warnings + +CREATE DATABASE gis_ogs; +USE gis_ogs; + +--echo # +--echo # C.3.3.1 Geometry types and functions schema construction +--echo # + +# TODO: WL#2377 +#CREATE TABLE spatial_ref_sys ( +#srid INTEGER NOT NULL PRIMARY KEY, +#auth_name CHARACTER VARYING, +#auth_srid INTEGER, +#srtext CHARACTER VARYING(2048)); + +CREATE TABLE lakes ( + fid INTEGER NOT NULL PRIMARY KEY, + name CHARACTER VARYING(64), + shore POLYGON); + +CREATE TABLE road_segments ( + fid INTEGER NOT NULL PRIMARY KEY, + name CHARACTER VARYING(64), + aliases CHARACTER VARYING(64), + num_lanes INTEGER, + centerline LINESTRING); + +CREATE TABLE divided_routes ( + fid INTEGER NOT NULL PRIMARY KEY, + name CHARACTER VARYING(64), + num_lanes INTEGER, + centerlines MULTILINESTRING); + +CREATE TABLE forests ( + fid INTEGER NOT NULL PRIMARY KEY, + name CHARACTER VARYING(64), + boundary MULTIPOLYGON); + +CREATE TABLE bridges ( + fid INTEGER NOT NULL PRIMARY KEY, + name CHARACTER VARYING(64), + position POINT); + +CREATE TABLE streams ( + fid INTEGER NOT NULL PRIMARY KEY, + name CHARACTER VARYING(64), + centerline LINESTRING); + +CREATE TABLE buildings ( + fid INTEGER NOT NULL PRIMARY KEY, + address CHARACTER VARYING(64), + position POINT, + footprint POLYGON); + +CREATE TABLE ponds ( + fid INTEGER NOT NULL PRIMARY KEY, + name CHARACTER VARYING(64), + type CHARACTER VARYING(64), + shores MULTIPOLYGON); + +CREATE TABLE named_places ( + fid INTEGER NOT NULL PRIMARY KEY, + name CHARACTER VARYING(64), + boundary POLYGON); + +CREATE TABLE map_neatlines ( + fid INTEGER NOT NULL PRIMARY KEY, + neatline POLYGON); + +--echo # +--echo # C.3.3.2 Geometry types and functions schema data loading +--echo # + +# TODO: WL#2377 +#-- Spatial Reference System +#INSERT INTO spatial_ref_sys VALUES +#(101, 'POSC', 32214, 'PROJCS["UTM_ZONE_14N", +#GEOGCS["World Geodetic System 72", +#DATUM["WGS_72", +#ELLIPSOID["NWL_10D", 6378135, 298.26]], +#PRIMEM["Greenwich", 0], +#UNIT["Meter", 1.0]], +#PROJECTION["Transverse_Mercator"], +#PARAMETER["False_Easting", 500000.0], +#PARAMETER["False_Northing", 0.0], +#PARAMETER["Central_Meridian", -99.0], +#PARAMETER["Scale_Factor", 0.9996], +#PARAMETER["Latitude_of_origin", 0.0], +#UNIT["Meter", 1.0]]'); + +--echo # Lakes +INSERT INTO lakes VALUES ( +101, 'BLUE LAKE', +PolyFromText( +'POLYGON( +(52 18,66 23,73 9,48 6,52 18), +(59 18,67 18,67 13,59 13,59 18) +)', +101)); + + +--echo # Road Segments + +INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2, +LineFromText( +'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101)); + +INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4, +LineFromText( +'LINESTRING( 44 31, 56 34, 70 38 )' ,101)); + +INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2, +LineFromText( +'LINESTRING( 70 38, 72 48 )' ,101)); + +INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4, +LineFromText( +'LINESTRING( 70 38, 84 42 )' ,101)); + +INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL, +1, +LineFromText( +'LINESTRING( 28 26, 28 0 )',101)); + +--echo # DividedRoutes + +INSERT INTO divided_routes VALUES(119, 'Route 75', 4, +MLineFromText( +'MULTILINESTRING((10 48,10 21,10 0), +(16 0,16 23,16 48))', 101)); + +--echo # Forests + +INSERT INTO forests VALUES(109, 'Green Forest', +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)))', +101)); + +--echo # Bridges + +INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText( +'POINT( 44 31 )', 101)); + +--echo # Streams + +INSERT INTO streams VALUES(111, 'Cam Stream', +LineFromText( +'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101)); + +INSERT INTO streams VALUES(112, NULL, +LineFromText( +'LINESTRING( 76 0, 78 4, 73 9 )', 101)); + +--echo # Buildings + +INSERT INTO buildings VALUES(113, '123 Main Street', +PointFromText( +'POINT( 52 30 )', 101), +PolyFromText( +'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101)); + +INSERT INTO buildings VALUES(114, '215 Main Street', +PointFromText( +'POINT( 64 33 )', 101), +PolyFromText( +'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101)); + + +--echo # Ponds + +INSERT INTO ponds VALUES(120, NULL, 'Stock Pond', +MPolyFromText( +'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ), +( ( 26 44, 26 40, 28 42, 26 44) ) )', 101)); + +--echo # Named Places + +INSERT INTO named_places VALUES(117, 'Ashton', +PolyFromText( +'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101)); + +INSERT INTO named_places VALUES(118, 'Goose Island', +PolyFromText( +'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101)); + +--echo # Map Neatlines + +INSERT INTO map_neatlines VALUES(115, +PolyFromText( +'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101)); + +--echo # +--echo # C.3.3.3 Geometry types and functions schema test queries +--echo + +# TODO: WL#2377 +#--echo # Conformance Item T1 +#SELECT f_table_name +#FROM geometry_columns; +# +#--echo # Conformance Item T2 +#SELECT f_geometry_column +#FROM geometry_columns +#WHERE f_table_name = 'streams'; +# +#--echo # Conformance Item T3 +#SELECT coord_dimension +#FROM geometry_columns +#WHERE f_table_name = 'streams'; +# +#--echo # Conformance Item T4 +# +#SELECT srid +#FROM geometry_columns +#WHERE f_table_name = 'streams'; +# +#--echo # Conformance Item T5 +# +#SELECT srtext +#FROM SPATIAL_REF_SYS +#WHERE SRID = 101; +# + + +--echo # Conformance Item T6 +# TODO: ST_Dimension() alias +SELECT Dimension(shore) +FROM lakes +WHERE name = 'Blue Lake'; + +--echo # Conformance Item T7 +# TODO: ST_GeometryType() alias +SELECT GeometryType(centerlines) +FROM divided_routes +WHERE name = 'Route 75'; + +--echo # Conformance Item T8 +# TODO: ST_AsText() alias +SELECT AsText(boundary) +FROM named_places +WHERE name = 'Goose Island'; + +--echo # Conformance Item T9 +# TODO: ST_AsBinary(), ST_PolyFromWKB() aliases +SELECT AsText(PolyFromWKB(AsBinary(boundary),101)) +FROM named_places +WHERE name = 'Goose Island'; + +--echo # Conformance Item T10 +SELECT SRID(boundary) +FROM named_places +WHERE name = 'Goose Island'; + +--echo # Conformance Item T11 +SELECT IsEmpty(centerline) +FROM road_segments +WHERE name = 'Route 5' +AND aliases = 'Main Street'; + +--echo # Conformance Item T12 +SELECT IsSimple(shore) +FROM lakes +WHERE name = 'Blue Lake'; + +--echo # Conformance Item T13 +SELECT AsText(ST_Boundary(boundary)) +FROM named_places +WHERE name = 'Goose Island'; + +--echo # Conformance Item T14 +# FIXME: we get anticlockwise, GIS suggests clockwise +SELECT AsText(Envelope(boundary)) +FROM named_places +WHERE name = 'Goose Island'; + +--echo # Conformance Item T15 +# TODO: ST_X() alias +SELECT X(position) +FROM bridges +WHERE name = 'Cam Bridge'; + +--echo # Conformance Item T16 +# TODO: ST_Y() alias +SELECT Y(position) +FROM bridges +WHERE name = 'Cam Bridge'; + +--echo # Conformance Item T17 +# TODO: ST_StartPoint() alias +SELECT AsText(StartPoint(centerline)) +FROM road_segments +WHERE fid = 102; + +--echo # Conformance Item T18 +SELECT AsText(EndPoint(centerline)) +FROM road_segments +WHERE fid = 102; + +SELECT IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) +FROM named_places +WHERE name = 'Goose Island'; + +--echo # Conformance Item T20 +SELECT IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) +FROM named_places +WHERE name = 'Goose Island'; + +--echo # Conformance Item T21 +SELECT GLength(centerline) +FROM road_segments +WHERE fid = 106; + +--echo # Conformance Item T22 +SELECT NumPoints(centerline) +FROM road_segments +WHERE fid = 102; + +--echo # Conformance Item T23 +SELECT AsText(PointN(centerline, 1)) +FROM road_segments +WHERE fid = 102; + +--echo # Conformance Item T24 +SELECT AsText(Centroid(boundary)) +FROM named_places +WHERE name = 'Goose Island'; + +SELECT ST_Contains(boundary, PointOnSurface(boundary)) +FROM named_places +WHERE name = 'Goose Island'; + +--echo # Conformance Item T26 +SELECT Area(boundary) +FROM named_places +WHERE name = 'Goose Island'; + +--echo # Conformance Item T27 +SELECT AsText(ExteriorRing(shore)) +FROM lakes +WHERE name = 'Blue Lake'; + +--echo # Conformance Item T28 +SELECT NumInteriorRings(shore) +FROM lakes +WHERE name = 'Blue Lake'; + +--echo # Conformance Item T29 +SELECT AsText(InteriorRingN(shore, 1)) +FROM lakes +WHERE name = 'Blue Lake'; + +--echo # Conformance Item T30 +SELECT NumGeometries(centerlines) +FROM divided_routes +WHERE name = 'Route 75'; + +--echo # Conformance Item T31 +SELECT AsText(GeometryN(centerlines, 2)) +FROM divided_routes +WHERE name = 'Route 75'; + +--echo # Conformance Item T32 +SELECT IsClosed(centerlines) +FROM divided_routes +WHERE name = 'Route 75'; + +--echo # Conformance Item T33 +SELECT GLength(centerlines) +FROM divided_routes +WHERE name = 'Route 75'; + +--echo # Conformance Item T34 +SELECT AsText(Centroid(shores)) +FROM ponds +WHERE fid = 120; + +# TODO: WL#2377 +--echo # Conformance Item T35 +SELECT Contains(shores, PointOnSurface(shores)) +FROM ponds +WHERE fid = 120; + +--echo # Conformance Item T36 +SELECT Area(shores) +FROM ponds +WHERE fid = 120; + +--echo # Conformance Item T37 +SELECT ST_Equals(boundary, +PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) +FROM named_places +WHERE name = 'Goose Island'; + +--echo # Conformance Item T38 +SELECT ST_Disjoint(centerlines, boundary) +FROM divided_routes, named_places +WHERE divided_routes.name = 'Route 75' +AND named_places.name = 'Ashton'; + +--echo # Conformance Item T39 +SELECT ST_Touches(centerline, shore) +FROM streams, lakes +WHERE streams.name = 'Cam Stream' +AND lakes.name = 'Blue Lake'; + +--echo # Conformance Item T40 +SELECT ST_Within(footprint, boundary) +FROM named_places, buildings +WHERE named_places.name = 'Ashton' +AND buildings.address = '215 Main Street'; + +--echo # Conformance Item T41 +SELECT ST_Overlaps(forests.boundary, named_places.boundary) +FROM forests, named_places +WHERE forests.name = 'Green Forest' +AND named_places.name = 'Ashton'; + +--echo # Conformance Item T42 +SELECT Crosses(road_segments.centerline, divided_routes.centerlines) +FROM road_segments, divided_routes +WHERE road_segments.fid = 102 +AND divided_routes.name = 'Route 75'; + +--echo # Conformance Item T43 +SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines) +FROM road_segments, divided_routes +WHERE road_segments.fid = 102 +AND divided_routes.name = 'Route 75'; + +--echo # Conformance Item T44 +SELECT ST_Contains(forests.boundary, named_places.boundary) +FROM forests, named_places +WHERE forests.name = 'Green Forest' +AND named_places.name = 'Ashton'; + +--echo # Conformance Item T45 +SELECT ST_Relate(forests.boundary, named_places.boundary, 'TTTTTTTTT') +FROM forests, named_places +WHERE forests.name = 'Green Forest' +AND named_places.name = 'Ashton'; + +--echo # Conformance Item T46 +SELECT ST_Distance(position, boundary) +FROM bridges, named_places +WHERE bridges.name = 'Cam Bridge' +AND named_places.name = 'Ashton'; + +--echo # Conformance Item T47 +SELECT AsText(ST_Intersection(centerline, shore)) +FROM streams, lakes +WHERE streams.name = 'Cam Stream' +AND lakes.name = 'Blue Lake'; + +--echo # Conformance Item T48 +SELECT AsText(ST_Difference(named_places.boundary, forests.boundary)) +FROM named_places, forests +WHERE named_places.name = 'Ashton' +AND forests.name = 'Green Forest'; + +#--echo # Conformance Item T49 +SELECT AsText(ST_Union(shore, boundary)) +FROM lakes, named_places +WHERE lakes.name = 'Blue Lake' +AND named_places.name = 'Goose Island'; + +--echo # Conformance Item T50 +SELECT AsText(ST_SymDifference(shore, boundary)) +FROM lakes, named_places +WHERE lakes.name = 'Blue Lake' +AND named_places.name = 'Ashton'; + +--echo # Conformance Item T51 +SELECT count(*) +FROM buildings, bridges +WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1; + +--echo # Conformance Item T52 +SELECT AsText(ConvexHull(shore)) +FROM lakes +WHERE lakes.name = 'Blue Lake'; + +DROP DATABASE gis_ogs; +USE test; + +--echo # +--echo # BUG #1043845 st_distance() results are incorrect depending on variable order +--echo # + +select st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461, + -95.9673057475387 36.1344478941074, + -95.9673063519371 36.134484524621, + -95.9673049102515 36.1343976584193)'), + geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)')) ; +select st_distance(geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)'), + geomfromtext('LINESTRING(-95.9673005697771 36.13509598461, + -95.9673057475387 36.1344478941074, + -95.9673063519371 36.134484524621, + -95.9673049102515 36.1343976584193) ')) ; + +--echo # +--echo # MDEV-4310 geometry function equals hangs forever. +--echo # +create table t1(a geometry not null)engine=myisam; +insert into t1 values(geomfromtext("POINT(0 0)")); +insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)")); +insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)")); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +select equals(`a`,convert(`a` using utf8)) from `t1`; +select equals(`a`,left(`a`,23)) from `t1`; +drop table t1; + +--echo # +--echo # MDEV-6883 ST_WITHIN crashes server if (0,0) is matched to POLYGON((0 0)) +--echo # +select st_within(GeomFromText('Polygon((0 0))'), Point(0,0)); + +--echo End of 5.3 tests + +--echo # +--echo # Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE +--echo # + +CREATE TABLE g1 +(a geometry NOT NULL, UNIQUE KEY i (a(151))) engine=myisam; + +INSERT INTO g1 VALUES (geomfromtext('point(1 1)')); +INSERT INTO g1 VALUES (geomfromtext('point(1 2)')); + +FLUSH TABLES; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 FROM g1 +FORCE INDEX(i) WHERE a = date_sub(now(), interval 2808.4 year_month) +; + +DROP TABLE g1; + +--echo # +--echo # Bug#13013970 MORE CRASHES IN FIELD_BLOB::GET_KEY_IMAGE +--echo # + +CREATE TABLE g1(a TEXT NOT NULL, KEY(a(255))); + +INSERT INTO g1 VALUES ('a'),('a'); +SELECT 1 FROM g1 WHERE a >= ANY +(SELECT 1 FROM g1 WHERE a = geomfromtext('') OR a) ; + +DROP TABLE g1; + +--echo # +--echo # Bug#16451878 GEOMETRY QUERY CRASHES SERVER +--echo # + +--echo # should not crash +SELECT ASTEXT(0x0100000000030000000100000000000010); + +--echo #should not crash +SELECT ENVELOPE(0x0100000000030000000100000000000010); + +--echo #should not crash +SELECT + GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffff0000, 1); + +--echo #should not crash +SELECT + GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1); + +--echo # +--echo # MDEV-3819 missing constraints for spatial column types +--echo # + +create table t1 (pt point); +--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD +insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))')); +drop table t1; + +# +# MDEV-7516 Assertion `!cur_p->event' failed in Gcalc_scan_iterator::arrange_event(int, int) +# +SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100)); + +# +# MDEV-7779 View definition changes upon creation +# +CREATE VIEW v1 AS SELECT POINT(1,1) AS p; +SHOW CREATE VIEW v1; +SELECT ASTEXT(p) FROM v1; +DROP VIEW v1; + +# --echo End of 5.5 tests + +--echo # +--echo # Start of 10.0 tests +--echo # + +--echo # +--echo # MDEV-12495 Conditional jump depends on uninitialised value for: SELECT NULL UNION geom_expression +--echo # +SELECT AsText(g) FROM (SELECT NULL AS g UNION SELECT Point(1,1)) AS t1; + +--echo # +--echo # MDEV-10306 Wrong results with combination of CONCAT, SUBSTR and CONVERT in subquery +--echo # + +SET @save_optimizer_switch=@@optimizer_switch; +SET optimizer_switch='derived_merge=on'; +CREATE TABLE t1 (x INT, y INT); +INSERT INTO t1 VALUES(0,0); +SELECT LENGTH(t2) c2 FROM (SELECT ST_BUFFER(POINT(x,y), 0) t2 FROM t1) sub; +SELECT LENGTH(CONCAT(t2,'-',t2)) c2 FROM (SELECT ST_BUFFER(POINT(x,y), 0) t2 FROM t1) sub; +SELECT LENGTH(CONCAT(t2,'--',t2)) c2 FROM (SELECT ST_BUFFER(POINT(x,y), 0) t2 FROM t1) sub; +DROP TABLE t1; +SET optimizer_switch=@save_optimizer_switch; + +--echo # +--echo # MDEV-16995: ER_CANT_CREATE_GEOMETRY_OBJECT encountered for a query with +--echo # optimizer_use_condition_selectivity>=3 +--echo # + +CREATE TABLE t1 (a POINT); +INSERT INTO t1 VALUES (POINT(1,1)),(POINT(1,2)),(POINT(1,3)); +set @save_use_stat_tables= @@use_stat_tables; +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @@use_stat_tables= PREFERABLY; +set @@optimizer_use_condition_selectivity=3; +SELECT COUNT(*) FROM t1 WHERE a IN ('test','test1'); +set @@use_stat_tables= @save_use_stat_tables; +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +drop table t1; + +--echo # +--echo # End 10.0 tests +--echo # + +SHOW CREATE TABLE information_schema.geometry_columns; +SHOW CREATE TABLE information_schema.spatial_ref_sys; + +create table t1(g GEOMETRY, pt POINT); +create table t2(g LINESTRING, pl POLYGON); +--sorted_result +select * from information_schema.geometry_columns where f_table_schema='test'; +drop table t1, t2; + +--echo 10.1 tests +create table t1(g GEOMETRY(9,4) REF_SYSTEM_ID=101, pt POINT(8,2), pg GEOMETRY REF_SYSTEM_ID=102); +SELECT SRID from information_schema.geometry_columns WHERE f_table_schema='test' and G_TABLE_NAME='t1'; +drop table t1; + +-- echo # Expect an int(1) column to be created +CREATE TABLE t1 AS SELECT CONTAINS(NULL, NULL); +SHOW CREATE TABLE t1; +DROP TABLE t1; + + +--echo # +--echo # MDEV-7334 valgrind warning "unitialized bytes" in 10.1. +--echo # +CREATE TABLE t1 ( + gp point, + ln linestring, + pg polygon, + mp multipoint, + mln multilinestring, + mpg multipolygon, + gc geometrycollection, + gm geometry +); +ALTER TABLE t1 ADD fid INT NOT NULL; +select SRID from information_schema.geometry_columns where F_TABLE_NAME='t1'; +drop table t1; + +--echo # +--echo # MDEV-7510 GIS: IsRing returns false for a primitive triangle. +--echo # +select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,0 0)')); +select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,-10 -10, 0 -10, 0 0)')); + +--echo # +--echo # MDEV-7514 GIS: PointOnSurface returns NULL instead of the point. +--echo # +SELECT ST_GEOMETRYTYPE(ST_PointOnSurface(ST_PolyFromText('POLYGON((-70.916 42.1002,-70.9468 42.0946,-70.9754 42.0875,-70.9749 42.0879,-70.9759 42.0897,-70.916 42.1002))'))); + +--echo # +--echo # MDEV-7529 GIS: ST_Relate returns unexpected results for POINT relations +--echo # +select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'T*F**FFF*') AS equals; +select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'T*****FF*') AS contains; +select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'T*F**F***') AS within; +select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(1 1)'),'FF*FF****') as disjoint; +select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'FF*FF****') as disjoint; + + +--echo # +--echo # MDEV-7528 GIS: Functions return NULL instead of specified -1 for NULL arguments. +--echo # + +select ST_IsRing(NULL); + +--echo # +--echo # MDEV-8675 Different results of GIS functions on NULL vs NOT NULL columns +--echo # +CREATE TABLE t1 (g1 GEOMETRY NOT NULL,g2 GEOMETRY NULL); +CREATE TABLE t2 AS SELECT WITHIN(g1,g1) as w1,WITHIN(g2,g2) AS w2 FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t1,t2; + ++ ++# ++# MDEV-3934 Assertion `((keypart_map+1) & keypart_map) == 0' failed in _mi_pack_key with an index on a POINT column ++# ++ ++CREATE TABLE t1 ( ++ id INT UNSIGNED NOT NULL AUTO_INCREMENT, ++ point_data POINT NOT NULL, ++ PRIMARY KEY (id), ++ KEY idx_point_data(point_data) ++) ENGINE=MyISAM; ++INSERT t1 (point_data) VALUES ++ (GeomFromText('Point(37.0248492 23.8512726)')), ++ (GeomFromText('Point(38.0248492 23.8512726)')); ++SELECT id FROM t1 ++WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)')); ++DROP TABLE t1; ++ ++ +--echo # +--echo # Start of 10.2 tests +--echo # + +# +# Item_func_spatial_collection::print() +# +create view v1 as select AsWKT(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))); +show create view v1; +select * from v1; +drop view v1; + +--echo # +--echo # MDEV-10134 Add full support for DEFAULT +--echo # + +CREATE TABLE t1 (a POINT, x DOUBLE DEFAULT x(a), y DOUBLE DEFAULT y(a)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a) VALUES (Point(1,2)); +SELECT x,y FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (g GEOMETRY, area DOUBLE DEFAULT ST_AREA(g)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (g) VALUES (GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))')); +SELECT area FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (g GEOMETRY, length DOUBLE DEFAULT ST_LENGTH(g)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (g) VALUES (GeomFromText('LINESTRING(0 0,20 0,20 20,0 20,0 0)')); +SELECT length FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (g POINT, distance DOUBLE DEFAULT ST_DISTANCE(g, POINT(0,0))); +SHOW CREATE TABLE t1; +INSERT INTO t1 (g) VALUES (Point(1,0)); +SELECT distance FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a TEXT, g GEOMETRY DEFAULT GeomFromText(a)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a) VALUES ('point(1 1)'); +SELECT AsText(g) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (x INT, y INT, g GEOMETRY DEFAULT POINT(x,y)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (x,y) VALUES (10,20); +SELECT AsText(g) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT PointN(a,2)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,2 2,3 3)')); +SELECT AsText(b) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT StartPoint(a)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,2 2,3 3)')); +SELECT AsText(b) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c GEOMETRY DEFAULT GeometryCollection(a,b)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a,b) VALUES (Point(1,1), Point(2,2)); +SELECT AsText(c) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT GeomFromWKB(AsBinary(a),20)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a) VALUES (GeomFromText('POINT(1 1)', 10)); +SELECT AsText(a), SRID(a), AsText(b), SRID(b) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT BOUNDARY(a)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))')); +SELECT AsText(b) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT BUFFER(a,10)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))')); +SELECT GeometryType(b) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT CENTROID(a)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))')); +SELECT AsText(b) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT ENVELOPE(a)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,4 4)')); +SELECT AsText(b) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT PointOnSurface(a)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))')); +SELECT GeometryType(b) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT Point(1,1), c GEOMETRY DEFAULT ST_UNION(a,b)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a) VALUES (Point(0,0)); +SELECT AsText(c) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a GEOMETRY, b VARCHAR(20) DEFAULT GeometryType(a)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a) VALUES (Point(0, 0)); +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsSimple(a)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a) VALUES (Point(0, 0)); +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsEmpty(a)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a) VALUES (Point(0, 0)); +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsRing(a)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a) VALUES (GeomFromText('LineString(0 0,0 1,1 1,1 0,0 0)')); +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsClosed(a)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a) VALUES (GeomFromText('LineString(0 0,0 1,1 1,1 0,0 0)')); +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT Dimension(a)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a) VALUES (Buffer(Point(1,1),1)); +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT NumGeometries(a)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a) VALUES (ST_UNION(Point(1,1),Point(0,0))); +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT NumInteriorRings(a)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a) VALUES (GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))')); +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT NumPoints(a)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a) VALUES (LineString(Point(1,1),Point(0,0))); +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT SRID(a)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a) VALUES (GeomFromText('Point(1 1)', 100)); +SELECT b FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c INT DEFAULT MBRDisjoint(a,b)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1)); +SELECT c FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c INT DEFAULT ST_Disjoint(a,b)); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1)); +SELECT c FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c INT DEFAULT ST_Relate(a,b,'T*F**FFF*')); +SHOW CREATE TABLE t1; +INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1)); +SELECT c FROM t1; +DROP TABLE t1; + ++# ++# MDEV-13923 Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed upon altering table with geometry field ++# ++--error ER_CANT_CREATE_GEOMETRY_OBJECT ++create table t1 (p point default "qwer"); ++--error ER_CANT_CREATE_GEOMETRY_OBJECT ++create table t1 (p point default 0); ++--error ER_INVALID_DEFAULT ++create table t1 (p point not null default st_geometryfromtext('point 0)')); ++create table t1 (p point not null default st_geometryfromtext('point(0 0)')); ++insert into t1 values(default); ++select st_astext(p) from t1; ++drop table t1; ++ +--echo # - --echo # Start of 10.3 tests ++--echo # End of 10.2 tests +--echo # + +--echo # +--echo # MDEV-11478 Result data type aggregation for pluggable data types +--echo # + +DELIMITER $$; +CREATE PROCEDURE p2(query TEXT) +BEGIN + DECLARE errcount INT DEFAULT 0; + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION + BEGIN + SET errcount = errcount+1; + #SHOW WARNINGS; + GET DIAGNOSTICS CONDITION 1 @p= MESSAGE_TEXT; + SELECT @p AS `ERROR: `; + END; + SELECT query AS ``; + EXECUTE IMMEDIATE query; + IF errcount = 0 + THEN + SHOW CREATE TABLE t2; + DROP TABLE t2; + END IF; +END; +$$ +CREATE PROCEDURE p1(query TEXT) +BEGIN + SELECT query AS `-------------------------------------`; + EXECUTE IMMEDIATE query; + CALL p2('CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1'); + CALL p2('CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1'); + CALL p2('CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1'); + CALL p2('CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1'); + CALL p2('CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1'); + DROP TABLE t1; +END; +$$ +DELIMITER ;$$ + +--disable_query_log +CALL p1('CREATE TABLE t1 (a CHAR(10), b Point)'); +CALL p1('CREATE TABLE t1 (a VARCHAR(10), b Point)'); +CALL p1('CREATE TABLE t1 (a TINYTEXT, b Point)'); +CALL p1('CREATE TABLE t1 (a TEXT, b Point)'); +CALL p1('CREATE TABLE t1 (a MEDIUMTEXT, b Point)'); +CALL p1('CREATE TABLE t1 (a LONGTEXT, b Point)'); + +CALL p1('CREATE TABLE t1 (a TINYINT, b Point)'); +CALL p1('CREATE TABLE t1 (a SMALLINT, b Point)'); +CALL p1('CREATE TABLE t1 (a MEDIUMINT, b Point)'); +CALL p1('CREATE TABLE t1 (a INT, b Point)'); +CALL p1('CREATE TABLE t1 (a BIGINT, b Point)'); +CALL p1('CREATE TABLE t1 (a FLOAT, b Point)'); +CALL p1('CREATE TABLE t1 (a DOUBLE, b Point)'); +CALL p1('CREATE TABLE t1 (a DECIMAL(10,2), b Point)'); +CALL p1('CREATE TABLE t1 (a BIT(8), b Point)'); + +CALL p1('CREATE TABLE t1 (a TIME, b Point)'); +CALL p1('CREATE TABLE t1 (a DATE, b Point)'); +CALL p1('CREATE TABLE t1 (a DATETIME, b Point)'); +CALL p1('CREATE TABLE t1 (a TIMESTAMP, b Point)'); +CALL p1('CREATE TABLE t1 (a YEAR, b Point)'); + +--echo # This creates BLOB with hybrid functions, but fails on error with UNION (MDEV-11458) +CALL p1('CREATE TABLE t1 (a ENUM(0x61), b Point)'); +CALL p1('CREATE TABLE t1 (a SET(0x61), b Point)'); +--enable_query_log + +CREATE TABLE t1 AS SELECT COALESCE(NULL, Point(1,1)); +SHOW CREATE TABLE t1; +DROP TABLE t1; +CREATE TABLE t1 AS SELECT NULL UNION SELECT Point(1,1); +SHOW CREATE TABLE t1; +DROP TABLE t1; + +DROP PROCEDURE p1; +DROP PROCEDURE p2; + + +--echo # +--echo # MDEV-11692 Comparison data type aggregation for pluggable data types +--echo # + +DELIMITER $$; +CREATE PROCEDURE p2(query TEXT) +BEGIN + DECLARE errcount INT DEFAULT 0; + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION + BEGIN + SET errcount = errcount+1; + GET DIAGNOSTICS CONDITION 1 @p= MESSAGE_TEXT; + SELECT @p AS `ERROR: `; + END; + SELECT query AS ``; + EXECUTE IMMEDIATE query; +END; +$$ +CREATE PROCEDURE p1(query TEXT) +BEGIN + SELECT query AS `-------------------------------------`; + EXECUTE IMMEDIATE query; + CALL p2('SELECT a=b FROM t1'); + CALL p2('SELECT b=a FROM t1'); + CALL p2('SELECT a BETWEEN b AND c FROM t1'); + CALL p2('SELECT a IN (b,c) FROM t1'); + CALL p2('SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1'); + CALL p2('SELECT a=POINT(1,1) FROM t1'); + CALL p2('SELECT POINT(1,1)=a FROM t1'); + CALL p2('SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1'); + CALL p2('SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1'); + CALL p2('SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1'); + DROP TABLE t1; +END; +$$ +DELIMITER ;$$ + +CALL p1('CREATE TABLE t1 (a CHAR(10), b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a VARCHAR(10), b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a TINYTEXT, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a TEXT, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a MEDIUMTEXT, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a LONGTEXT, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a ENUM("a","b"), b Point, c Point)'); + +CALL p1('CREATE TABLE t1 (a TINYINT, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a SMALLINT, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a MEDIUMINT, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a INT, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a BIGINT, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a FLOAT, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a DOUBLE, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a DECIMAL(10,2), b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a BIT(8), b Point, c Point)'); + +CALL p1('CREATE TABLE t1 (a TIME, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a DATE, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a DATETIME, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a TIMESTAMP, b Point, c Point)'); +CALL p1('CREATE TABLE t1 (a YEAR, b Point, c Point)'); + +CALL p1('CREATE TABLE t1 (a Point, b Point, c Point)'); + + +DROP PROCEDURE p1; +DROP PROCEDURE p2; + + +--echo # +--echo # MDEV-12506 Split Item_func_min_max::fix_length_and_dec() into methods in Type_handler +--echo # + +DELIMITER $$; +CREATE PROCEDURE p2(query TEXT) +BEGIN + DECLARE errcount INT DEFAULT 0; + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION + BEGIN + SET errcount = errcount+1; + #SHOW WARNINGS; + GET DIAGNOSTICS CONDITION 1 @p= MESSAGE_TEXT; + SELECT @p AS `ERROR: `; + END; + SELECT query AS ``; + EXECUTE IMMEDIATE query; + IF errcount = 0 + THEN + SHOW CREATE TABLE t2; + DROP TABLE t2; + END IF; +END; +$$ +CREATE PROCEDURE p1(query TEXT) +BEGIN + SELECT query AS `-------------------------------------`; + EXECUTE IMMEDIATE query; + CALL p2('CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1'); + DROP TABLE t1; +END; +$$ +DELIMITER ;$$ + +--disable_query_log +CALL p1('CREATE TABLE t1 (a CHAR(10), b Point)'); +CALL p1('CREATE TABLE t1 (a VARCHAR(10), b Point)'); +CALL p1('CREATE TABLE t1 (a TINYTEXT, b Point)'); +CALL p1('CREATE TABLE t1 (a TEXT, b Point)'); +CALL p1('CREATE TABLE t1 (a MEDIUMTEXT, b Point)'); +CALL p1('CREATE TABLE t1 (a LONGTEXT, b Point)'); + +CALL p1('CREATE TABLE t1 (a TINYINT, b Point)'); +CALL p1('CREATE TABLE t1 (a SMALLINT, b Point)'); +CALL p1('CREATE TABLE t1 (a MEDIUMINT, b Point)'); +CALL p1('CREATE TABLE t1 (a INT, b Point)'); +CALL p1('CREATE TABLE t1 (a BIGINT, b Point)'); +CALL p1('CREATE TABLE t1 (a FLOAT, b Point)'); +CALL p1('CREATE TABLE t1 (a DOUBLE, b Point)'); +CALL p1('CREATE TABLE t1 (a DECIMAL(10,2), b Point)'); +CALL p1('CREATE TABLE t1 (a BIT(8), b Point)'); + +CALL p1('CREATE TABLE t1 (a TIME, b Point)'); +CALL p1('CREATE TABLE t1 (a DATE, b Point)'); +CALL p1('CREATE TABLE t1 (a DATETIME, b Point)'); +CALL p1('CREATE TABLE t1 (a TIMESTAMP, b Point)'); +CALL p1('CREATE TABLE t1 (a YEAR, b Point)'); + +--echo # This LEAST(ENUM,GEOMETRY) creates BLOB, but fails on error with UNION (see MDEV-12503) +CALL p1('CREATE TABLE t1 (a ENUM(0x61), b Point)'); +CALL p1('CREATE TABLE t1 (a SET(0x61), b Point)'); +--enable_query_log + +CREATE TABLE t1 AS SELECT LEAST(NULL, Point(1,1)); +SHOW CREATE TABLE t1; +DROP TABLE t1; + +DROP PROCEDURE p1; +DROP PROCEDURE p2; + +--echo # +--echo # MDEV-12001 Split Item_func_round::fix_length_and_dec to virtual methods in Type_handler +--echo # + +CREATE TABLE t1 (a GEOMETRY); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ROUND(a) FROM t1; +DROP TABLE t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ROUND(POINT(1,1)); + + +--echo # +--echo # MDEV-12199 Split Item_func_{abs|neg|int_val}::fix_length_and_dec() into methods in Type_handler +--echo # + +CREATE TABLE t1 (a GEOMETRY); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT -a FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ABS(a) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CEILING(a) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT FLOOR(a) FROM t1; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT -COALESCE(a) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ABS(COALESCE(a)) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CEILING(COALESCE(a)) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT FLOOR(COALESCE(a)) FROM t1; +DROP TABLE t1; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT -POINT(1,1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ABS(POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CEILING(POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT FLOOR(POINT(1,1)); + + +--echo # +--echo # MDEV-12239 Add Type_handler::Item_sum_{sum|avg|variance}_fix_length_and_dec() +--echo # + +CREATE TABLE t1 (a GEOMETRY); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT SUM(POINT(1,1)) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT SUM(a) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT SUM(COALESCE(a)) FROM t1; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT AVG(POINT(1,1)) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT AVG(a) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT AVG(COALESCE(a)) FROM t1; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT VARIANCE(POINT(1,1)) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT VARIANCE(a) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT VARIANCE(COALESCE(a)) FROM t1; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT STDDEV(POINT(1,1)) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT STDDEV(a) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT STDDEV(COALESCE(a)) FROM t1; + +DROP TABLE t1; + +--echo # +--echo # MDEV-12303 Add Type_handler::Item_xxx_fix_length_and_dec() for CAST classes +--echo # + +CREATE TABLE t1 (a GEOMETRY); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(POINT(1,1) AS SIGNED) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(POINT(1,1) AS UNSIGNED) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(POINT(1,1) AS DOUBLE) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(POINT(1,1) AS DECIMAL(10,1)) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(POINT(1,1) AS CHAR) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(POINT(1,1) AS TIME) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(POINT(1,1) AS DATE) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(POINT(1,1) AS DATETIME) FROM t1; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(a AS SIGNED) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(a AS UNSIGNED) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(a AS DOUBLE) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(a AS DECIMAL(10,1)) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(a AS CHAR) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(a AS TIME) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(a AS DATE) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(a AS DATETIME) FROM t1; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(COALESCE(a) AS SIGNED) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(COALESCE(a) AS UNSIGNED) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(COALESCE(a) AS DOUBLE) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(COALESCE(a) AS DECIMAL(10,1)) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(COALESCE(a) AS CHAR) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(COALESCE(a) AS TIME) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(COALESCE(a) AS DATE) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CAST(COALESCE(a) AS DATETIME) FROM t1; + +# CAST from GEOMETRY to BINARY is OK +SELECT LENGTH(CAST(POINT(1,1) AS BINARY)) FROM t1; +SELECT LENGTH(CAST(a AS BINARY)) FROM t1; +SELECT LENGTH(CAST(COALESCE(a) AS BINARY)) FROM t1; + +DROP TABLE t1; + +--echo # +--echo # MDEV-12238 Add Type_handler::Item_func_{plus|minus|mul|div|mod}_fix_length_and_dec() +--echo # + +CREATE TABLE t1 (a GEOMETRY); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT POINT(1,1) + 1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT POINT(1,1) - 1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT POINT(1,1) * 1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT POINT(1,1) / 1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT POINT(1,1) MOD 1; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 + POINT(1,1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 - POINT(1,1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 * POINT(1,1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 / POINT(1,1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 MOD POINT(1,1); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT a + 1 FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT a - 1 FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT a * 1 FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT a / 1 FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT a MOD 1 FROM t1; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 + a FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 - a FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 * a FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 / a FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 MOD a FROM t1; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT COALESCE(a) + 1 FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT COALESCE(a) - 1 FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT COALESCE(a) * 1 FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT COALESCE(a) / 1 FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT COALESCE(a) MOD 1 FROM t1; + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 + COALESCE(a) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 - COALESCE(a) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 * COALESCE(a) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 / COALESCE(a) FROM t1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT 1 MOD COALESCE(a) FROM t1; + +DROP TABLE t1; + +--echo # +--echo # MDEV-12514 Split Item_temporal_func::fix_length_and_dec() +--echo # + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT DATE_ADD(POINT(1,1), INTERVAL 10 DAY); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT DATE_SUB(POINT(1,1), INTERVAL 10 DAY); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT POINT(1,1) + INTERVAL 10 DAY; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT POINT(1,1) - INTERVAL 10 DAY; +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT INTERVAL 10 DAY + POINT(1,1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT INTERVAL 10 DAY + POINT(1,1); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT ADDTIME(POINT(1,1), '10:10:10'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT ADDTIME('10:10:10', POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT ADDTIME(POINT(1,1), TIME'10:10:10'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT ADDTIME(TIME'10:10:10', POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT ADDTIME(POINT(1,1), TIMESTAMP'2001-01-01 10:10:10'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT ADDTIME(TIMESTAMP'2001-01-01 10:10:10', POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT STR_TO_DATE(POINT(1,1),'%M %d,%Y'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT STR_TO_DATE('2001-01-01', POINT(1,1)); + +--echo # +--echo # MDEV-12665 Hybrid functions do not preserve geometry type +--echo # + +CREATE TABLE t1 AS SELECT + Point(0,0) AS p0, + COALESCE(Point(0,0)) AS p1, + CASE WHEN 0 THEN Point(0,0) ELSE Point(1,1) END AS p2; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT LEAST(Point(0,0),Point(0,0)) AS p1; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1 ( + c_geometry GEOMETRY, + c_point POINT, + c_linestring LINESTRING, + c_polygon POLYGON, + c_multipoint MULTIPOINT, + c_multilinestring MULTILINESTRING, + c_multipolygon MULTIPOLYGON, + c_geometrycollection GEOMETRYCOLLECTION +); + +CREATE TABLE t2 AS SELECT + COALESCE(NULL, c_geometry), + COALESCE(NULL, c_point), + COALESCE(NULL, c_linestring), + COALESCE(NULL, c_polygon), + COALESCE(NULL, c_multipoint), + COALESCE(NULL, c_multilinestring), + COALESCE(NULL, c_multipolygon), + COALESCE(NULL, c_geometrycollection) +FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; + +CREATE TABLE t2 AS SELECT + COALESCE(c_geometry, NULL), + COALESCE(c_point, NULL), + COALESCE(c_linestring, NULL), + COALESCE(c_polygon, NULL), + COALESCE(c_multipoint, NULL), + COALESCE(c_multilinestring, NULL), + COALESCE(c_multipolygon, NULL), + COALESCE(c_geometrycollection, NULL) +FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; + +CREATE TABLE t2 AS SELECT + COALESCE(c_geometry, c_geometry), + COALESCE(c_point, c_point), + COALESCE(c_linestring, c_linestring), + COALESCE(c_polygon, c_polygon), + COALESCE(c_multipoint, c_multipoint), + COALESCE(c_multilinestring, c_multilinestring), + COALESCE(c_multipolygon, c_multipolygon), + COALESCE(c_geometrycollection, c_geometrycollection) +FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; + +DROP TABLE t1; + + +--echo # +--echo # MDEV-12560 Wrong data type for SELECT NULL UNION SELECT Point(1,1) +--echo # + +CREATE TABLE t1 AS SELECT NULL AS c1 UNION SELECT POINT(1,1); +SHOW CREATE TABLE t1; +DROP TABLE t1; + +DELIMITER $$; +CREATE PROCEDURE p1(name TEXT) +BEGIN + EXECUTE IMMEDIATE CONCAT('CREATE TABLE t1 (a ', name, ')'); + CREATE TABLE t2 AS + SELECT a AS a1, a AS a2, NULL AS a3 FROM t1 UNION + SELECT a AS a1, NULL AS a2, a AS a3 FROM t1; + SHOW CREATE TABLE t2; + DROP TABLE t2; + DROP TABLE t1; +END; +$$ +DELIMITER ;$$ +CALL p1('geometry'); +CALL p1('point'); +CALL p1('linestring'); +CALL p1('polygon'); +CALL p1('multipoint'); +CALL p1('multilinestring'); +CALL p1('multipolygon'); +CALL p1('geometrycollection'); +DROP PROCEDURE p1; + +--echo # +--echo # MDEV-12798 Item_param does not preserve exact field type in EXECUTE IMMEDIATE 'CREATE TABLE AS SELECT ?' USING POINT(1,1) +--echo # +EXECUTE IMMEDIATE 'CREATE TABLE t1 AS SELECT ?' USING POINT(1,1); +SHOW CREATE TABLE t1; +DROP TABLE t1; + +PREPARE stmt FROM 'CREATE OR REPLACE TABLE t1 AS SELECT ?'; +EXECUTE stmt USING POINT(1,1); +SHOW CREATE TABLE t1; +DROP TABLE t1; + +--echo # +--echo # MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions +--echo # + +--enable_metadata +--disable_ps_protocol +SELECT + ST_ISSIMPLE(POINT(1,1)), + ST_ISRING(POINT(1,1)), + ST_ISCLOSED(POINT(1,1)), + ST_DIMENSION(POINT(1,1)), + ST_NUMGEOMETRIES(POINT(1,1)), + ST_NUMINTERIORRINGS(POINT(1,1)), + ST_NUMPOINTS(POINT(1,1)), + ST_SRID(POINT(1,1)); +--enable_ps_protocol +--disable_metadata + + +--echo # +--echo # MDEV-12803 Improve function parameter data type control +--echo # + +--echo # +--echo # Item_geometry_func_args_geometry +--echo # + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_CENTROID(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ENVELOPE(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_BOUNDARY(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_STARTPOINT(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_POINTONSURFACE(1); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_POINTN(1,1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_POINTN(LineString(Point(1,1)),Point(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_BUFFER(1, 1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_BUFFER(Point(1,1), Point(1,1)); + + +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_ENVELOPE(?) AS g'; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +EXECUTE stmt USING 1; +EXECUTE stmt USING POINT(1,1); +SHOW CREATE TABLE t1; +SELECT ST_ASTEXT(g) FROM t1; +DROP TABLE t1; +DEALLOCATE PREPARE stmt; + +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_BUFFER(?,?) AS g'; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +EXECUTE stmt USING 1,1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +EXECUTE stmt USING POINT(1,1),POINT(1,1); +EXECUTE stmt USING POINT(1,1),0; +SHOW CREATE TABLE t1; +SELECT ST_GEOMETRYTYPE(g) FROM t1; +DROP TABLE t1; +DEALLOCATE PREPARE stmt; + +--echo # +--echo # Functions created GEOMETRY from non-GEOMETRY +--echo # + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMETRYFROMTEXT(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMETRYFROMTEXT(Point(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMETRYFROMTEXT(Point(1,1), 1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMETRYFROMTEXT('test', Point(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMETRYFROMWKB(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMETRYFROMWKB(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMETRYFROMWKB(1, 1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMETRYFROMWKB(Point(1,1), Point(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMFROMGEOJSON(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMFROMGEOJSON(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMFROMGEOJSON(1,1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMFROMGEOJSON(Point(1,1), Point(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT POINT(ROW(1,1),1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT POINT(POINT(1,1),1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT POINT(1,ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT POINT(1,POINT(1,1)); + + +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_GEOMFROMTEXT(?,?) AS g'; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +EXECUTE stmt USING 1,1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +EXECUTE stmt USING POINT(1,1),POINT(1,1); +EXECUTE stmt USING 'POINT(1 1)',1; +SHOW CREATE TABLE t1; +SELECT ST_ASTEXT(g), SRID(g) FROM t1; +DROP TABLE t1; +DEALLOCATE PREPARE stmt; + + + +--echo # Item_func_spatial_collection + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT GEOMETRYCOLLECTION(ROW(1,1), POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT GEOMETRYCOLLECTION(POINT(1,1), ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT GEOMETRYCOLLECTION(1, POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT GEOMETRYCOLLECTION(POINT(1,1), 1); + +--echo # Item_func_spatial_operation + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_UNION(ROW(1,1), POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_UNION(POINT(1,1), ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_UNION(1, POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_UNION(POINT(1,1), 1); + +--echo # Item_binary_func_args_geometry + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ASWKB(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ASWKB(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ASWKB('test'); + + +--echo # Item_real_func_args_geometry + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_X(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_X(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_X('test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_Y(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_Y(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_Y('test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_AREA(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_AREA(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_AREA('test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_LENGTH(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_LENGTH(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_LENGTH('test'); + + +--echo # Item_real_func_geometry_args_geometry_geometry + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_DISTANCE(ROW(1,1), 1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_DISTANCE(1, 1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_DISTANCE('test', 1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_DISTANCE(POINT(1,1), ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_DISTANCE(POINT(1,1), 1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_DISTANCE(POINT(1,1), 'test'); + + +--echo # Item_int_func_args_geometry + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ISSIMPLE(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ISSIMPLE(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ISSIMPLE('test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ISRING(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ISRING(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ISRING('test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ISCLOSED(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ISCLOSED(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ISCLOSED('test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_DIMENSION(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_DIMENSION(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_DIMENSION('test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_NUMGEOMETRIES(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_NUMGEOMETRIES(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_NUMGEOMETRIES('test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_NUMINTERIORRINGS(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_NUMINTERIORRINGS(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_NUMINTERIORRINGS('test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_NUMPOINTS(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_NUMPOINTS(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_NUMPOINTS('test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_SRID(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_SRID(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_SRID('test'); + + +--echo # Item_bool_func_args_geometry + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ISEMPTY(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ISEMPTY(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ISEMPTY('test'); + +--echo # Item_bool_func_geometry_args_geometry_geometry + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_RELATE(ROW(1,1), POINT(1,1), 'T*F**FFF*'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_RELATE(POINT(1,1), ROW(1,1), 'T*F**FFF*'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_RELATE(1, POINT(1,1), 'T*F**FFF*'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_RELATE(POINT(1,1), 1, 'T*F**FFF*'); +SELECT ST_RELATE(Point(1,1),Point(1,1),'T*F**FFF*') AS equals; +SELECT ST_RELATE(Point(1,1),Point(1,1),NULL); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_RELATE(Point(1,1),Point(1,1),ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_RELATE(Point(1,1),Point(1,1),1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_RELATE(Point(1,1),Point(1,1),1.0); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_RELATE(Point(1,1),Point(1,1),1e0); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_RELATE(Point(1,1),Point(1,1),TIME'10:10:10'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_RELATE(Point(1,1),Point(1,1),DATE'2010-01-01'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_RELATE(Point(1,1),Point(1,1),TIMESTAMP'2010-01-01 10:10:10'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_RELATE(Point(1,1),Point(1,1),Point(1,1)); + + +--echo # Item_str_ascii_func_args_geometry + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ASTEXT(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ASTEXT(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ASTEXT('test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMETRYTYPE(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMETRYTYPE(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_GEOMETRYTYPE('test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ASGEOJSON(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ASGEOJSON(1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ASGEOJSON('test'); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ASGEOJSON(POINT(1,1), POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_ASGEOJSON(POINT(1,1), 1, POINT(1,1)); + +--echo # Item_func_spatial_rel + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_TOUCHES(ROW(1,1), POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_TOUCHES(POINT(1,1), ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_TOUCHES(1, POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_TOUCHES(POINT(1,1), 1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_TOUCHES('test', POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ST_TOUCHES(POINT(1,1), 'test'); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT MBRTOUCHES(ROW(1,1), POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT MBRTOUCHES(POINT(1,1), ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT MBRTOUCHES(1, POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT MBRTOUCHES(POINT(1,1), 1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT MBRTOUCHES('test', POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT MBRTOUCHES(POINT(1,1), 'test'); + + +--echo # +--echo # MDEV-13964 Parameter data type control for Item_real_func +--echo # + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT EXP(POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT LN(POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT LOG2(POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT LOG10(POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT SQRT(POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ACOS(POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ASIN(POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT COS(POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT SIN(POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT TAN(POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT COT(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT LOG(POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT LOG(POINT(1,1),POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT LOG(1, POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ATAN(POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ATAN(POINT(1,1),POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ATAN(1, POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT POW(POINT(1,1),POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT RAND(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT RADIANS(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT DEGREES(POINT(1,1)); + + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT EXP(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT LN(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT LOG2(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT LOG10(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT SQRT(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ACOS(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ASIN(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT COS(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT SIN(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT TAN(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT COT(ROW(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT LOG(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT LOG(ROW(1,1),ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT LOG(1, ROW(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ATAN(ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ATAN(ROW(1,1),ROW(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ATAN(1, ROW(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT POW(ROW(1,1),ROW(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT RAND(ROW(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT RADIANS(ROW(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT DEGREES(ROW(1,1)); + + +--echo # +--echo # MDEV-13965 Parameter data type control for Item_longlong_func +--echo # + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT POINT(1,1) | 1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT 1 | POINT(1,1); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT POINT(1,1) & 1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT 1 & POINT(1,1); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT POINT(1,1) << 1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT 1 << POINT(1,1); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT POINT(1,1) >> 1; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT 1 >> POINT(1,1); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT ~POINT(1,1); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT TO_SECONDS(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT TIMESTAMPDIFF(SECOND,POINT(1,1), 1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT TIMESTAMPDIFF(SECOND,1, POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT INET_ATON(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT LAST_INSERT_ID(POINT(1,1)); + + +--echo # +--echo # MDEV-13966 Parameter data type control for Item_temporal_func +--echo # + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT FROM_DAYS(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT MAKEDATE(POINT(1,1),1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT MAKEDATE(1, POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT LAST_DAY(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT SEC_TO_TIME(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT TIMEDIFF(POINT(1,1),1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT TIMEDIFF(1, POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT MAKETIME(POINT(1,1),1,1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT MAKETIME(1, POINT(1,1), 1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT MAKETIME(1, 1, POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT FROM_UNIXTIME(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CONVERT_TZ(POINT(1,1),1,1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CONVERT_TZ(1, POINT(1,1), 1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT CONVERT_TZ(1, 1, POINT(1,1)); + + +--echo # +--echo # MDEV-13967 Parameter data type control for Item_long_func +--echo # + +SELECT STRCMP(POINT(1,1),POINT(1,1)); +SELECT CHAR_LENGTH(POINT(1,1)); +SELECT OCTET_LENGTH(POINT(1,1)); +SELECT UNCOMPRESSED_LENGTH(POINT(1,1)); +SELECT COERCIBILITY(POINT(1,1)); +SELECT ASCII(POINT(1,1)); +SELECT CRC32(POINT(1,1)); +SELECT ORD(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT SIGN(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT LOCATE('a','a',POINT(1,1)); + +SELECT LOCATE(POINT(1,1),POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT BIT_COUNT(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT BENCHMARK(POINT(1,1),''); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT SLEEP(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT GET_LOCK('x', POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT PERIOD_ADD(POINT(1,1),1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT PERIOD_ADD(1,POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT PERIOD_DIFF(POINT(1,1),1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT PERIOD_DIFF(1,POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT TO_DAYS(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT DAYOFMONTH(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT DAYOFYEAR(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT QUARTER(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT YEAR(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT YEARWEEK(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT WEEK(POINT(1,1)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT WEEK(POINT(1,1),1); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT WEEK(1,POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT HOUR(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT MINUTE(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT SECOND(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT MICROSECOND(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT JSON_DEPTH(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT JSON_LENGTH(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT JSON_LENGTH('json', POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT JSON_LENGTH(POINT(1,1), POINT(1,1)); + +SELECT REGEXP_INSTR(POINT(1,1),''); +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT REGEXP_INSTR('',POINT(1,1)); + +SELECT FIND_IN_SET(POINT(1,1),''); +SELECT FIND_IN_SET('',POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT RELEASE_LOCK(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT IS_FREE_LOCK(POINT(1,1)); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT IS_USED_LOCK(POINT(1,1)); + + +--echo # +--echo # End of 10.3 tests +--echo # diff --cc mysql-test/main/gis_notembedded.result index 00000000000,64e90572bf0..64e90572bf0 mode 000000,100644..100644 --- a/mysql-test/main/gis_notembedded.result +++ b/mysql-test/main/gis_notembedded.result diff --cc mysql-test/main/gis_notembedded.test index 00000000000,d25d6a7097e..d25d6a7097e mode 000000,100644..100644 --- a/mysql-test/main/gis_notembedded.test +++ b/mysql-test/main/gis_notembedded.test diff --cc mysql-test/main/grant4.result index c3db2e03e3e,00000000000..99f1131143e mode 100644,000000..100644 --- a/mysql-test/main/grant4.result +++ b/mysql-test/main/grant4.result @@@ -1,226 -1,0 +1,247 @@@ +drop database if exists mysqltest_db1; +set GLOBAL sql_mode=""; +set LOCAL sql_mode=""; +create database mysqltest_db1; +use mysqltest_db1; +create table t_column_priv_only (a int, b int); +create table t_select_priv like t_column_priv_only; +create table t_no_priv like t_column_priv_only; +grant all privileges on test.* to mysqltest_u1@localhost; +grant insert (a) on mysqltest_db1.t_column_priv_only to mysqltest_u1@localhost; +grant select on mysqltest_db1.t_select_priv to mysqltest_u1@localhost; +** Connect as restricted user mysqltest_u1. + +connect con1,localhost,mysqltest_u1,,; +connection con1; +** Test column level privileges only. No SELECT privileges on the table. +** INSERT INTO ... VALUES ... +** Attempting to insert values to a table with only column privileges +** should work. +insert into mysqltest_db1.t_column_priv_only (a) VALUES (1); + +** SHOW COLUMNS +** Should succeed because we have privileges (any) on at least one of the columns. +select column_name as 'Field',column_type as 'Type',is_nullable as 'Null',column_key as 'Key',column_default as 'Default',extra as 'Extra' from information_schema.columns where table_schema='mysqltest_db1' and table_name='t_column_priv_only'; +Field Type Null Key Default Extra +a int(11) YES NULL +show columns from mysqltest_db1.t_column_priv_only; +Field Type Null Key Default Extra +a int(11) YES NULL +** SHOW COLUMNS +** Should fail because there are no privileges on any column combination. +show columns from mysqltest_db1.t_no_priv; +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't_no_priv' +** However, select from I_S.COLUMNS will succeed but not show anything: +select column_name as 'Field',column_type as 'Type',is_nullable as 'Null',column_key as 'Key',column_default as 'Default',extra as 'Extra' from information_schema.columns where table_schema='mysqltest_db1' and table_name='t_no_priv'; +Field Type Null Key Default Extra + +** CREATE TABLE ... LIKE ... require SELECT privleges and will fail. +create table test.t_no_priv like mysqltest_db1.column_priv_only; +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 'column_priv_only' + +** Just to be sure... SELECT also fails. +select * from mysqltest_db1.t_column_priv_only; +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't_column_priv_only' + +** SHOW CREATE TABLE ... require any privileges on all columns (the entire table). +** First we try and fail on a table with only one column privilege. +show create table mysqltest_db1.t_column_priv_only; +ERROR 42000: SHOW command denied to user 'mysqltest_u1'@'localhost' for table 't_column_priv_only' + +** Now we do the same on a table with SELECT privileges. + +** SHOW COLUMNS +** Success because we got some privileges on the table (SELECT_ACL) +show columns from mysqltest_db1.t_select_priv; +Field Type Null Key Default Extra +a int(11) YES NULL +b int(11) YES NULL + +** CREATE TABLE ... LIKE ... require SELECT privleges and will SUCCEED. +drop table if exists test.t_duplicated; +create table test.t_duplicated like mysqltest_db1.t_select_priv; +drop table test.t_duplicated; + +** SHOW CREATE TABLE will succeed because we have a privilege on all columns in the table (table-level privilege). +show create table mysqltest_db1.t_select_priv; +Table Create Table +t_select_priv CREATE TABLE `t_select_priv` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +** SHOW CREATE TABLE will fail if there is no grants at all: +show create table mysqltest_db1.t_no_priv; +ERROR 42000: SHOW command denied to user 'mysqltest_u1'@'localhost' for table 't_no_priv' + +connection default; +use mysqltest_db1; +CREATE TABLE t5 (s1 INT); +CREATE INDEX i ON t5 (s1); +CREATE TABLE t6 (s1 INT, s2 INT); +CREATE VIEW v5 AS SELECT * FROM t5; +CREATE VIEW v6 AS SELECT * FROM t6; +CREATE VIEW v2 AS SELECT * FROM t_select_priv; +CREATE VIEW v3 AS SELECT * FROM t_select_priv; +CREATE INDEX i ON t6 (s1); +GRANT UPDATE (s2) ON t6 to mysqltest_u1@localhost; +GRANT UPDATE (s2) ON v6 to mysqltest_u1@localhost; +GRANT SHOW VIEW ON v2 to mysqltest_u1@localhost; +GRANT SHOW VIEW, SELECT ON v3 to mysqltest_u1@localhost; +connection con1; +use mysqltest_db1; +** Connect as restricted user mysqltest_u1. +** SELECT FROM INFORMATION_SCHEMA.STATISTICS will succeed because any privileges will do (authentication is enough). +** but will return no rows +SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE table_name='t5'; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT +** SHOW INDEX FROM t5 will fail because we don't have any privileges on any column combination. +SHOW INDEX FROM t5; +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't5' +** SHOW INDEX FROM t6 will succeed because there exist a privilege on a column combination on t6. +SHOW INDEX FROM t6; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +t6 1 i 1 s1 A NULL NULL NULL YES BTREE +** CHECK TABLE requires any privilege on any column combination and should succeed for t6: +CHECK TABLE t6; +Table Op Msg_type Msg_text +mysqltest_db1.t6 check status OK +** With no privileges access is naturally denied: +CHECK TABLE t5; +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't5' +** CHECKSUM TABLE requires SELECT privileges on the table. The following should fail: +CHECKSUM TABLE t6; +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't6' +** And this should work: +CHECKSUM TABLE t_select_priv; +Table Checksum +mysqltest_db1.t_select_priv 0 +SHOW CREATE VIEW v5; +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 'v5' +SHOW CREATE VIEW v6; +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 'v6' +SHOW CREATE VIEW v2; +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 'v2' +SHOW CREATE VIEW v3; +View Create View character_set_client collation_connection +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t_select_priv`.`a` AS `a`,`t_select_priv`.`b` AS `b` from `t_select_priv` latin1 latin1_swedish_ci +connection default; +disconnect con1; +drop database mysqltest_db1; +drop user mysqltest_u1@localhost; ++call mtr.add_suppression("Table 'mysql.user' doesn't exist"); ++call mtr.add_suppression("'mysql.user' is not of type 'TABLE'"); ++rename table mysql.user to mysql.user1; ++create view mysql.user as select * from mysql.user1; ++flush privileges; ++ERROR HY000: 'mysql.user' is not of type 'TABLE' ++drop view mysql.user; ++create temporary table mysql.user select * from mysql.user1 limit 0; ++flush privileges; ++ERROR 42S02: Table 'mysql.user' doesn't exist ++drop temporary table mysql.user; ++rename table mysql.user1 to mysql.user; ++call mtr.add_suppression('mysql.user table is damaged'); ++rename table mysql.user to mysql.user1; ++create table mysql.user (Host char(100), User char(100)); ++flush privileges; ++ERROR HY000: Unknown error ++drop table mysql.user; ++rename table mysql.user1 to mysql.user; ++End of 5.5 tests +# +# Additional coverage for refactoring which is made as part +# of fix for bug #27480 "Extend CREATE TEMPORARY TABLES privilege +# to allow temp table operations". +# +# Check that for statements like CHECK/REPAIR and OPTIMIZE TABLE +# privileges for all tables involved are checked before processing +# any tables. Doing otherwise, i.e. checking privileges for table +# right before processing it might result in lost results for tables +# which were processed by the time when table for which privileges +# are insufficient are discovered. +# +call mtr.add_suppression("Got an error from thread_id=.*ha_myisam.cc:"); +call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*mysqltest_u1 Checking table"); +drop database if exists mysqltest_db1; +create database mysqltest_db1; +# Create tables which we are going to CHECK/REPAIR. +create table mysqltest_db1.t1 (a int, key(a)) engine=myisam; +create table mysqltest_db1.t2 (b int); +insert into mysqltest_db1.t1 values (1), (2); +insert into mysqltest_db1.t2 values (1); +# Create user which will try to do this. +create user mysqltest_u1@localhost; +grant insert, select on mysqltest_db1.t1 to mysqltest_u1@localhost; +connect con1,localhost,mysqltest_u1,,; +connection default; +# Corrupt t1 by replacing t1.MYI with a corrupt + unclosed one created +# by doing: 'create table t1 (a int key(a))' +# head -c1024 t1.MYI > corrupt_t1.MYI +flush table mysqltest_db1.t1; +connection con1; +check table mysqltest_db1.t1; +Table Op Msg_type Msg_text +mysqltest_db1.t1 check warning 1 client is using or hasn't closed the table properly +mysqltest_db1.t1 check error Size of indexfile is: 1024 Should be: 2048 +mysqltest_db1.t1 check warning Size of datafile is: 14 Should be: 7 +mysqltest_db1.t1 check error Corrupt +# The below statement should fail before repairing t1. +# Otherwise info about such repair will be missing from its result-set. +repair table mysqltest_db1.t1, mysqltest_db1.t2; +ERROR 42000: SELECT, INSERT command denied to user 'mysqltest_u1'@'localhost' for table 't2' +# The same is true for CHECK TABLE statement. +check table mysqltest_db1.t1, mysqltest_db1.t2; +ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't2' +check table mysqltest_db1.t1; +Table Op Msg_type Msg_text +mysqltest_db1.t1 check warning Table is marked as crashed +mysqltest_db1.t1 check warning 1 client is using or hasn't closed the table properly +mysqltest_db1.t1 check error Size of indexfile is: 1024 Should be: 2048 +mysqltest_db1.t1 check warning Size of datafile is: 14 Should be: 7 +mysqltest_db1.t1 check error Corrupt +repair table mysqltest_db1.t1; +Table Op Msg_type Msg_text +mysqltest_db1.t1 repair warning Number of rows changed from 1 to 2 +mysqltest_db1.t1 repair status OK +# Clean-up. +disconnect con1; +connection default; +drop database mysqltest_db1; +drop user mysqltest_u1@localhost; +create user foo1 identified by password '11111111111111111111111111111111111111111'; +create user foo2 identified by password '2222222222222222'; +create user foo3 identified via mysql_native_password using '11111111111111111111111111111111111111111'; +create user foo4 identified via mysql_old_password using '2222222222222222'; +grant select on test.* to foo5 identified by password '11111111111111111111111111111111111111111'; +grant select on test.* to foo6 identified by password '2222222222222222'; +grant select on test.* to foo7 identified via mysql_native_password using '11111111111111111111111111111111111111111'; +grant select on test.* to foo8 identified via mysql_old_password using '2222222222222222'; +select user,password,plugin,authentication_string from mysql.user where user like 'foo%'; +user password plugin authentication_string +foo1 11111111111111111111111111111111111111111 +foo2 2222222222222222 +foo3 11111111111111111111111111111111111111111 +foo4 2222222222222222 +foo5 11111111111111111111111111111111111111111 +foo6 2222222222222222 +foo7 11111111111111111111111111111111111111111 +foo8 2222222222222222 +drop user foo1; +drop user foo2; +drop user foo3; +drop user foo4; +drop user foo5; +drop user foo6; +drop user foo7; +drop user foo8; +create user foo1 identified via mysql_native_password using '00'; +ERROR HY000: Password hash should be a 41-digit hexadecimal number +create user foo2 identified via mysql_native_password using '2222222222222222'; +ERROR HY000: Password hash should be a 41-digit hexadecimal number +create user foo3 identified via mysql_old_password using '00'; +ERROR HY000: Password hash should be a 16-digit hexadecimal number +create user foo4 identified via mysql_old_password using '11111111111111111111111111111111111111111'; +ERROR HY000: Password hash should be a 16-digit hexadecimal number +set GLOBAL sql_mode=default; ++End of 10.1 tests diff --cc mysql-test/main/grant4.test index 2715b7c7145,00000000000..30f08f9eea2 mode 100644,000000..100644 --- a/mysql-test/main/grant4.test +++ b/mysql-test/main/grant4.test @@@ -1,237 -1,0 +1,266 @@@ +--source include/not_embedded.inc + +# Setup database, tables and user accounts +--disable_warnings +drop database if exists mysqltest_db1; +--enable_warnings +set GLOBAL sql_mode=""; +set LOCAL sql_mode=""; +create database mysqltest_db1; +use mysqltest_db1; +create table t_column_priv_only (a int, b int); +create table t_select_priv like t_column_priv_only; +create table t_no_priv like t_column_priv_only; +grant all privileges on test.* to mysqltest_u1@localhost; +grant insert (a) on mysqltest_db1.t_column_priv_only to mysqltest_u1@localhost; +grant select on mysqltest_db1.t_select_priv to mysqltest_u1@localhost; + +--echo ** Connect as restricted user mysqltest_u1. +--echo +connect (con1,localhost,mysqltest_u1,,); +connection con1; + +######################################################################## +--echo ** Test column level privileges only. No SELECT privileges on the table. +--echo ** INSERT INTO ... VALUES ... +--echo ** Attempting to insert values to a table with only column privileges +--echo ** should work. +insert into mysqltest_db1.t_column_priv_only (a) VALUES (1); +--echo + +######################################################################### +--echo ** SHOW COLUMNS +--echo ** Should succeed because we have privileges (any) on at least one of the columns. +select column_name as 'Field',column_type as 'Type',is_nullable as 'Null',column_key as 'Key',column_default as 'Default',extra as 'Extra' from information_schema.columns where table_schema='mysqltest_db1' and table_name='t_column_priv_only'; +show columns from mysqltest_db1.t_column_priv_only; +######################################################################### +--echo ** SHOW COLUMNS +--echo ** Should fail because there are no privileges on any column combination. +--error 1142 +show columns from mysqltest_db1.t_no_priv; +--echo ** However, select from I_S.COLUMNS will succeed but not show anything: +select column_name as 'Field',column_type as 'Type',is_nullable as 'Null',column_key as 'Key',column_default as 'Default',extra as 'Extra' from information_schema.columns where table_schema='mysqltest_db1' and table_name='t_no_priv'; +--echo +######################################################################### +--echo ** CREATE TABLE ... LIKE ... require SELECT privleges and will fail. +--error 1142 +create table test.t_no_priv like mysqltest_db1.column_priv_only; +--echo +######################################################################### +--echo ** Just to be sure... SELECT also fails. +--error 1142 +select * from mysqltest_db1.t_column_priv_only; +--echo +######################################################################### +--echo ** SHOW CREATE TABLE ... require any privileges on all columns (the entire table). +--echo ** First we try and fail on a table with only one column privilege. +--error 1142 +show create table mysqltest_db1.t_column_priv_only; +--echo +######################################################################### +--echo ** Now we do the same on a table with SELECT privileges. +--echo +######################################################################### +--echo ** SHOW COLUMNS +--echo ** Success because we got some privileges on the table (SELECT_ACL) +show columns from mysqltest_db1.t_select_priv; +--echo +######################################################################### +--echo ** CREATE TABLE ... LIKE ... require SELECT privleges and will SUCCEED. +--disable_warnings +drop table if exists test.t_duplicated; +--enable_warnings +create table test.t_duplicated like mysqltest_db1.t_select_priv; +drop table test.t_duplicated; +--echo +######################################################################### +--echo ** SHOW CREATE TABLE will succeed because we have a privilege on all columns in the table (table-level privilege). +show create table mysqltest_db1.t_select_priv; +--echo +######################################################################### +--echo ** SHOW CREATE TABLE will fail if there is no grants at all: +--error 1142 +show create table mysqltest_db1.t_no_priv; +--echo + +connection default; + +# +# SHOW INDEX +# +use mysqltest_db1; +CREATE TABLE t5 (s1 INT); +CREATE INDEX i ON t5 (s1); +CREATE TABLE t6 (s1 INT, s2 INT); +CREATE VIEW v5 AS SELECT * FROM t5; +CREATE VIEW v6 AS SELECT * FROM t6; +CREATE VIEW v2 AS SELECT * FROM t_select_priv; +CREATE VIEW v3 AS SELECT * FROM t_select_priv; +CREATE INDEX i ON t6 (s1); +GRANT UPDATE (s2) ON t6 to mysqltest_u1@localhost; +GRANT UPDATE (s2) ON v6 to mysqltest_u1@localhost; +GRANT SHOW VIEW ON v2 to mysqltest_u1@localhost; +GRANT SHOW VIEW, SELECT ON v3 to mysqltest_u1@localhost; + +connection con1; +use mysqltest_db1; +--echo ** Connect as restricted user mysqltest_u1. +--echo ** SELECT FROM INFORMATION_SCHEMA.STATISTICS will succeed because any privileges will do (authentication is enough). +--echo ** but will return no rows +SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE table_name='t5'; +# +# Bug27145 EXTRA_ACL trouble +# +--echo ** SHOW INDEX FROM t5 will fail because we don't have any privileges on any column combination. +--error 1142 +SHOW INDEX FROM t5; +--echo ** SHOW INDEX FROM t6 will succeed because there exist a privilege on a column combination on t6. +SHOW INDEX FROM t6; + +# CHECK TABLE +--echo ** CHECK TABLE requires any privilege on any column combination and should succeed for t6: +CHECK TABLE t6; +--echo ** With no privileges access is naturally denied: +--error 1142 +CHECK TABLE t5; + +# CHECKSUM +--echo ** CHECKSUM TABLE requires SELECT privileges on the table. The following should fail: +--error 1142 +CHECKSUM TABLE t6; +--echo ** And this should work: +CHECKSUM TABLE t_select_priv; + +# SHOW CREATE VIEW +--error 1142 +SHOW CREATE VIEW v5; +--error 1142 +SHOW CREATE VIEW v6; +--error 1142 +SHOW CREATE VIEW v2; +SHOW CREATE VIEW v3; + +connection default; +disconnect con1; +drop database mysqltest_db1; +drop user mysqltest_u1@localhost; + ++# ++# MDEV-18241 Downgrade from 10.4 to 10.3 crashes ++# ++call mtr.add_suppression("Table 'mysql.user' doesn't exist"); ++call mtr.add_suppression("'mysql.user' is not of type 'TABLE'"); ++rename table mysql.user to mysql.user1; ++create view mysql.user as select * from mysql.user1; ++--error ER_WRONG_OBJECT ++flush privileges; ++drop view mysql.user; ++create temporary table mysql.user select * from mysql.user1 limit 0; ++--error ER_NO_SUCH_TABLE ++flush privileges; ++drop temporary table mysql.user; ++rename table mysql.user1 to mysql.user; ++ ++# ++# Bug#28986737: RENAMING AND REPLACING MYSQL.USER TABLE CAN LEAD TO A SERVER CRASH ++# ++call mtr.add_suppression('mysql.user table is damaged'); ++rename table mysql.user to mysql.user1; ++create table mysql.user (Host char(100), User char(100)); ++--error ER_UNKNOWN_ERROR ++flush privileges; ++drop table mysql.user; ++rename table mysql.user1 to mysql.user; ++ ++--echo End of 5.5 tests + +--echo # +--echo # Additional coverage for refactoring which is made as part +--echo # of fix for bug #27480 "Extend CREATE TEMPORARY TABLES privilege +--echo # to allow temp table operations". +--echo # +--echo # Check that for statements like CHECK/REPAIR and OPTIMIZE TABLE +--echo # privileges for all tables involved are checked before processing +--echo # any tables. Doing otherwise, i.e. checking privileges for table +--echo # right before processing it might result in lost results for tables +--echo # which were processed by the time when table for which privileges +--echo # are insufficient are discovered. +--echo # +call mtr.add_suppression("Got an error from thread_id=.*ha_myisam.cc:"); +call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*mysqltest_u1 Checking table"); +--disable_warnings +drop database if exists mysqltest_db1; +--enable_warnings +let $MYSQLD_DATADIR = `SELECT @@datadir`; +create database mysqltest_db1; +--echo # Create tables which we are going to CHECK/REPAIR. +create table mysqltest_db1.t1 (a int, key(a)) engine=myisam; +create table mysqltest_db1.t2 (b int); +insert into mysqltest_db1.t1 values (1), (2); +insert into mysqltest_db1.t2 values (1); +--echo # Create user which will try to do this. +create user mysqltest_u1@localhost; +grant insert, select on mysqltest_db1.t1 to mysqltest_u1@localhost; +connect (con1,localhost,mysqltest_u1,,); +connection default; + +--echo # Corrupt t1 by replacing t1.MYI with a corrupt + unclosed one created +--echo # by doing: 'create table t1 (a int key(a))' +--echo # head -c1024 t1.MYI > corrupt_t1.MYI +flush table mysqltest_db1.t1; +--remove_file $MYSQLD_DATADIR/mysqltest_db1/t1.MYI +--copy_file std_data/corrupt_t1.MYI $MYSQLD_DATADIR/mysqltest_db1/t1.MYI + +connection con1; +check table mysqltest_db1.t1; +--echo # The below statement should fail before repairing t1. +--echo # Otherwise info about such repair will be missing from its result-set. +--error ER_TABLEACCESS_DENIED_ERROR +repair table mysqltest_db1.t1, mysqltest_db1.t2; +--echo # The same is true for CHECK TABLE statement. +--error ER_TABLEACCESS_DENIED_ERROR +check table mysqltest_db1.t1, mysqltest_db1.t2; +check table mysqltest_db1.t1; +repair table mysqltest_db1.t1; + +--echo # Clean-up. +disconnect con1; +--source include/wait_until_disconnected.inc +connection default; +drop database mysqltest_db1; +drop user mysqltest_u1@localhost; + +create user foo1 identified by password '11111111111111111111111111111111111111111'; +create user foo2 identified by password '2222222222222222'; +create user foo3 identified via mysql_native_password using '11111111111111111111111111111111111111111'; +create user foo4 identified via mysql_old_password using '2222222222222222'; + +grant select on test.* to foo5 identified by password '11111111111111111111111111111111111111111'; +grant select on test.* to foo6 identified by password '2222222222222222'; +grant select on test.* to foo7 identified via mysql_native_password using '11111111111111111111111111111111111111111'; +grant select on test.* to foo8 identified via mysql_old_password using '2222222222222222'; + +--sorted_result +select user,password,plugin,authentication_string from mysql.user where user like 'foo%'; + +drop user foo1; +drop user foo2; +drop user foo3; +drop user foo4; +drop user foo5; +drop user foo6; +drop user foo7; +drop user foo8; + +--error ER_PASSWD_LENGTH +create user foo1 identified via mysql_native_password using '00'; +--error ER_PASSWD_LENGTH +create user foo2 identified via mysql_native_password using '2222222222222222'; +--error ER_PASSWD_LENGTH +create user foo3 identified via mysql_old_password using '00'; +--error ER_PASSWD_LENGTH +create user foo4 identified via mysql_old_password using '11111111111111111111111111111111111111111'; + - +set GLOBAL sql_mode=default; ++ ++--echo End of 10.1 tests diff --cc mysql-test/main/information_schema_prepare.result index 00000000000,3b5ee16b14b..3b5ee16b14b mode 000000,100644..100644 --- a/mysql-test/main/information_schema_prepare.result +++ b/mysql-test/main/information_schema_prepare.result diff --cc mysql-test/main/information_schema_prepare.test index 00000000000,c5f3f89ff29..c5f3f89ff29 mode 000000,100644..100644 --- a/mysql-test/main/information_schema_prepare.test +++ b/mysql-test/main/information_schema_prepare.test diff --cc mysql-test/main/mdev_19276.result index 00000000000,c1b822de6bf..c1b822de6bf mode 000000,100644..100644 --- a/mysql-test/main/mdev_19276.result +++ b/mysql-test/main/mdev_19276.result diff --cc mysql-test/main/mdev_19276.test index 00000000000,3e6b72a3f55..3e6b72a3f55 mode 000000,100644..100644 --- a/mysql-test/main/mdev_19276.test +++ b/mysql-test/main/mdev_19276.test diff --cc mysql-test/main/multi_update.result index c40de47668a,00000000000..2cc85039e3a mode 100644,000000..100644 --- a/mysql-test/main/multi_update.result +++ b/mysql-test/main/multi_update.result @@@ -1,1042 -1,0 +1,1065 @@@ +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)); +select count(*) from t1 where id1 > 95; +count(*) +5 +select count(*) from t2 where id2 > 95; +count(*) +25 +select count(*) from t3 where id3 > 95; +count(*) +250 +update t1,t2,t3 set t1.t="aaa", t2.t="bbb", t3.t="cc" where t1.id1 = t2.id2 and t2.id2 = t3.id3 and t1.id1 > 90; +select count(*) from t1 where t = "aaa"; +count(*) +10 +select count(*) from t1 where id1 > 90; +count(*) +10 +select count(*) from t2 where t = "bbb"; +count(*) +50 +select count(*) from t2 where id2 > 90; +count(*) +50 +select count(*) from t3 where t = "cc"; +count(*) +500 +select count(*) from t3 where id3 > 90; +count(*) +500 +delete t1.*, t2.*, t3.* from t1,t2,t3 where t1.id1 = t2.id2 and t2.id2 = t3.id3 and t1.id1 > 95; +check table t1, t2, t3; +Table Op Msg_type Msg_text +test.t1 check status OK +test.t2 check status OK +test.t3 check status OK +select count(*) from t1 where id1 > 95; +count(*) +0 +select count(*) from t2 where id2 > 95; +count(*) +0 +select count(*) from t3 where id3 > 95; +count(*) +0 +delete t1, t2, t3 from t1,t2,t3 where t1.id1 = t2.id2 and t2.id2 = t3.id3 and t1.id1 > 5; +select count(*) from t1 where id1 > 5; +count(*) +0 +select count(*) from t2 where id2 > 5; +count(*) +0 +select count(*) from t3 where id3 > 5; +count(*) +0 +delete from t1, t2, t3 using t1,t2,t3 where t1.id1 = t2.id2 and t2.id2 = t3.id3 and t1.id1 > 0; +select count(*) from t1 where id1; +count(*) +0 +select count(*) from t2 where id2; +count(*) +0 +select count(*) from t3 where id3; +count(*) +0 +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; +delete t1 from t1,t2 where t1.id1 = t2.id2 and t1.id1 > 500; +drop table t1,t2; +CREATE TABLE t1 ( +id int(11) NOT NULL default '0', +name varchar(10) default NULL, +PRIMARY KEY (id) +) 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) +) 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) +) 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; +id mydate +1 2002-02-04 00:00:00 +5 2002-05-12 00:00:00 +6 2002-06-22 00:00:00 +7 2002-07-22 00:00:00 +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`) +) ENGINE=MyISAM; +CREATE TABLE IF NOT EXISTS `t2` ( +`ID` int(11) NOT NULL auto_increment, +`ParId` int(11) default NULL, +`tst` text, +`tst1` text, +PRIMARY KEY (`ID`), +KEY `IX_ParId_t2` (`ParId`), +FOREIGN KEY (`ParId`) REFERENCES `t1` (`id`) +) 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; +ID ParId tst tst1 +1 1 NULL NULL +2 2 NULL NULL +3 3 NULL NULL +UPDATE t2, t1 SET t2.tst = t1.tst, t2.tst1 = t1.tst1 WHERE t2.ParId = t1.Id; +select * from t2; +ID ParId tst tst1 +1 1 MySQL MySQL AB +2 2 MSSQL Microsoft +3 3 ORACLE ORACLE +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); +select * from t2 left outer join t1 using (n); +n +1 +2 +4 +8 +16 +32 +delete t1,t2 from t2 left outer join t1 using (n); +select * from t2 left outer join t1 using (n); +n +drop table t1,t2 ; +create table t1 (n int(10) not null primary key, d int(10)); +create table t2 (n int(10) not null primary key, d int(10)); +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; +ERROR HY000: Table 't2' was locked with a READ lock and can't be updated +UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n; +ERROR HY000: Table 't2' was locked with a READ lock and can't be updated +UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n; +unlock tables; +LOCK TABLES t1 write, t2 write; +UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n; +select * from t1; +n d +1 10 +DELETE t1.*, t2.* FROM t1,t2 where t1.n=t2.n; +select * from t1; +n d +select * from t2; +n d +2 20 +unlock tables; +drop table t1,t2; +set sql_safe_updates=1; +create table t1 (n int(10), d int(10)); +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; +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; +create table t1 (n int(10) not null primary key, d int(10), t timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); +create table t2 (n int(10) not null primary key, d int(10), t timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); +insert into t1 values(1,1,NULL); +insert into t2 values(1,10,NULL),(2,20,NULL); +set timestamp=1038000000; +UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n; +select n,d,unix_timestamp(t) from t1; +n d unix_timestamp(t) +1 10 1038000000 +select n,d,unix_timestamp(t) from t2; +n d unix_timestamp(t) +1 10 1038401397 +2 20 1038401397 +UPDATE t1,t2 SET 1=2 WHERE t1.n=t2.n; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB 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; +create table t1 (n int(10) not null primary key, d int(10)); +create table t2 (n int(10) not null primary key, d int(10)); +insert into t1 values(1,1), (3,3); +insert into t2 values(1,10),(2,20); +UPDATE t2 left outer join t1 on t1.n=t2.n SET t1.d=t2.d; +select * from t1; +n d +1 10 +3 3 +select * from t2; +n d +1 10 +2 20 +drop table t1,t2; +create table t1 (n int(10), d int(10)); +create table t2 (n int(10), d int(10)); +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 (n int(10), d int(10)); +create table t2 (n int(10), d int(10)); +insert into t1 values(1,1),(3,2); +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; +n d +1 10 +3 2 +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; +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)) 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)) 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 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); +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 +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 +update t1,t2 set t1.b=t1.b+10 where t1.b=2; +select * from t1; +a b +201 1 +102 12 +103 3 +104 4 +105 5 +106 6 +107 7 +108 8 +109 9 +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.a-100; +select * from t1; +a b +201 1 +102 12 +103 5 +104 6 +105 7 +106 6 +107 7 +108 8 +109 9 +select * from t2; +a b +1 1 +2 2 +3 13 +4 14 +5 15 +6 6 +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)) 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"); +create table t2(Z varchar(15)); +insert into t2(Z) select concat(a.a,b.a,c.a,d.a) from t1 as a, t1 as b, t1 as c, t1 as d; +update t2,t3 set Z =param_scenario_costs; +drop table t1,t2,t3; +create table t1 (a int, b int); +create table t2 (a int, b int); +insert into t1 values (1,1),(2,1),(3,1); +insert into t2 values (1,1), (3,1); +update t1 left join t2 on t1.a=t2.a set t1.b=2, t2.b=2 where t1.b=1 and t2.b=1 or t2.a is NULL; +select t1.a, t1.b,t2.a, t2.b from t1 left join t2 on t1.a=t2.a where t1.b=1 and t2.b=1 or t2.a is NULL; +a b a b +2 2 NULL NULL +drop table t1,t2; +create table t1 (a int not null auto_increment primary key, b int not null); +insert into t1 (b) values (1),(2),(3),(4); +update t1, t1 as t2 set t1.b=t2.b+1 where t1.a=t2.a; +select * from t1; +a b +1 2 +2 3 +3 4 +4 5 +drop table t1; +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'); +insert into t2 values (1, 'b'), (2, 'bb'); +select * from t1; +id1 field +1 a +2 aa +select * from t2; +id2 field +1 b +2 bb +update t2 inner join t1 on t1.id1=t2.id2 +set t2.field=t1.field +where 0=1; +update t2, t1 set t2.field=t1.field +where t1.id1=t2.id2 and 0=1; +delete t1, t2 from t2 inner join t1 on t1.id1=t2.id2 +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 ); +CREATE TABLE t2 ( a int ); +DELETE t1 FROM t1, t2 AS t3; +DELETE t4 FROM t1, t1 AS t4; +DELETE t3 FROM t1 AS t3, t1 AS t4; +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 +2 +DELETE t2 FROM t1 AS t2, t2 AS t1 where t1.a=t2.a and t1.a=2; +SELECT * from t1; +a +1 +SELECT * from t2; +a +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`) ); +insert into t1 values (0,'A01-Comp',1); +insert into t1 values (0,'B01-Comp',1); +insert into t2 values (0,1,'A Note',1); +update t1 left join t2 on p_id = c2_p_id set c2_note = 'asdf-1' where p_id = 2; +select * from t1; +p_id p_code p_active +1 A01-Comp 1 +2 B01-Comp 1 +select * from t2; +c2_id c2_p_id c2_note c2_active +1 1 A Note 1 +drop table t1, t2; +connect root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connection root; +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)); +create user mysqltest_1@localhost; +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'; +flush privileges; +drop database mysqltest; +connection default; +disconnect user1; +disconnect root; +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; +delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1; +ERROR HY000: Table 't1' is specified twice, both as a target for 'DELETE' and as a separate source for data +drop table t1,t2; +create table t1(a int); +create table t2(a int); +delete from t1,t2 using t1,t2 where t1.a=(select a from t1); +ERROR HY000: Table 't1' is specified twice, both as a target for 'DELETE' and as a separate source for data +drop table t1, t2; +create table t1 (a int, b int); +insert into t1 values (1, 2), (2, 3), (3, 4); +create table t2 (a int); +insert into t2 values (10), (20), (30); +create view v1 as select a as b, a/10 as a from t2; +connect locker,localhost,root,,test; +connection locker; +lock table t1 write; +connect changer,localhost,root,,test; +connection changer; +alter table t1 add column c int default 100 after a; +connect updater,localhost,root,,test; +connection updater; +update t1, v1 set t1.b=t1.a+t1.b+v1.b where t1.a=v1.a; +connection locker; +unlock tables; +connection changer; +connection updater; +select * from t1; +a c b +1 100 13 +2 100 25 +3 100 37 +select * from t2; +a +10 +20 +30 +drop view v1; +drop table t1, t2; +connection default; +disconnect locker; +disconnect changer; +disconnect updater; +create table t1 (i1 int, i2 int, i3 int); +create table t2 (id int, c1 varchar(20), c2 varchar(20)); +insert into t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2); +insert into t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test"); +select * from t1 order by i1; +i1 i2 i3 +1 5 10 +2 2 2 +3 7 12 +4 5 2 +9 10 15 +select * from t2; +id c1 c2 +9 abc def +5 opq lmn +2 test t t test +update t1,t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id; +select * from t1 order by i1; +i1 i2 i3 +1 5 10 +2 15 2 +3 7 12 +4 5 2 +9 15 15 +select * from t2 order by id; +id c1 c2 +2 test t ppc +5 opq lmn +9 abc ppc +delete t1.*,t2.* from t1,t2 where t1.i2=t2.id; +select * from t1 order by i1; +i1 i2 i3 +2 15 2 +3 7 12 +9 15 15 +select * from t2 order by id; +id c1 c2 +2 test t ppc +9 abc ppc +drop table t1, t2; +create table t1 (i1 int auto_increment not null, i2 int, i3 int, primary key (i1)); +create table t2 (id int auto_increment not null, c1 varchar(20), c2 varchar(20), primary key(id)); +insert into t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2); +insert into t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test"); +select * from t1 order by i1; +i1 i2 i3 +1 5 10 +2 2 2 +3 7 12 +4 5 2 +9 10 15 +select * from t2 order by id; +id c1 c2 +2 test t t test +5 opq lmn +9 abc def +update t1,t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id; +select * from t1 order by i1; +i1 i2 i3 +1 5 10 +2 15 2 +3 7 12 +4 5 2 +9 15 15 +select * from t2 order by id; +id c1 c2 +2 test t ppc +5 opq lmn +9 abc ppc +delete t1.*,t2.* from t1,t2 where t1.i2=t2.id; +select * from t1 order by i1; +i1 i2 i3 +2 15 2 +3 7 12 +9 15 15 +select * from t2 order by id; +id c1 c2 +2 test t ppc +9 abc ppc +drop table t1, t2; +# +# Bug#49534: multitable IGNORE update with sql_safe_updates error +# causes debug assertion +# +CREATE TABLE t1( a INT, KEY( a ) ); +INSERT INTO t1 VALUES (1), (2), (3); +SET SESSION sql_safe_updates = 1; +# Must not cause failed assertion +UPDATE IGNORE t1, t1 t1a SET t1.a = 1 WHERE t1a.a = 1; +ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column +DROP TABLE t1; +# +# Bug#54543: update ignore with incorrect subquery leads to assertion +# failure: inited==INDEX +# +SET SESSION sql_safe_updates = 0; +CREATE TABLE t1 ( a INT ); +INSERT INTO t1 VALUES (1), (2); +CREATE TABLE t2 ( a INT ); +INSERT INTO t2 VALUES (1), (2); +CREATE TABLE t3 ( a INT ); +INSERT INTO t3 VALUES (1), (2); +# Should not crash +UPDATE IGNORE +( SELECT ( SELECT COUNT(*) FROM t1 GROUP BY a, @v ) a FROM t2 ) x, t3 +SET t3.a = 0; +Warnings: +Warning 1242 Subquery returns more than 1 row +Warning 1242 Subquery returns more than 1 row +DROP TABLE t1, t2, t3; +SET SESSION sql_safe_updates = DEFAULT; +# +# Bug#52157 various crashes and assertions with multi-table update, stored function +# +CREATE FUNCTION f1 () RETURNS BLOB RETURN 1; +CREATE TABLE t1 (f1 DATE); +INSERT INTO t1 VALUES('2001-01-01'); +UPDATE IGNORE (SELECT 1 FROM t1 WHERE f1 = (SELECT f1() FROM t1)) x, t1 SET f1 = 1; +Warnings: +Warning 1292 Incorrect datetime value: '1' +CREATE view v1 as SELECT f1() FROM t1; +UPDATE IGNORE (SELECT 1 FROM t1 WHERE f1 = (select * from v1)) x, t1 SET f1 = 1; +Warnings: +Warning 1292 Incorrect datetime value: '1' +DROP VIEW v1; +DROP FUNCTION f1; +DROP TABLE t1; +# +# MDEV-4123: Incorrect results after multi-table update or +# assertion `!table || (!table->read_set || +# bitmap_is_set(table->read_set, field_index))' failure +# +DROP TABLE IF EXISTS t1; +Warnings: +Note 1051 Unknown table 'test.t1' +CREATE TABLE t1 ( +id int(10) unsigned NOT NULL, +level tinyint(3) unsigned NOT NULL, +PRIMARY KEY (id) +); +INSERT INTO t1 VALUES (2519583,1); +DROP TABLE IF EXISTS t2; +Warnings: +Note 1051 Unknown table 'test.t2' +CREATE TABLE t2 ( +club_id int(11) NOT NULL DEFAULT '0', +profile_id int(11) NOT NULL DEFAULT '0', +member_level_id int(11) NOT NULL DEFAULT '0', +PRIMARY KEY (profile_id,club_id) +); +INSERT INTO t2 VALUES (2,2519583,12); +DROP TABLE IF EXISTS t3; +Warnings: +Note 1051 Unknown table 'test.t3' +CREATE TABLE t3 ( +member_level_id int(11) unsigned NOT NULL DEFAULT '0', +map_level int(11) unsigned NOT NULL DEFAULT '0', +map_status int(11) unsigned NOT NULL DEFAULT '0', +PRIMARY KEY (member_level_id) +); +INSERT INTO t3 VALUES (12,12,1); +CREATE +VIEW v1 AS +select club_id,profile_id, +map_level AS member_level_id,map_status AS member_status +from (t2 tc join t3 map +on(((tc.member_level_id = map.member_level_id) and +(club_id = 2)))); +select level, count(*) as cnt from t1 group by level; +level cnt +1 1 +UPDATE t1 c LEFT JOIN v1 t ON (c.id = t.profile_id AND t.club_id = 2) +SET c.level = IF (t.member_status IS NULL, 1, IF (t.member_status = 1, 2,3)); +select level, count(*) as cnt from t1 group by level; +level cnt +2 1 +drop view v1; +drop table t1,t2,t3; +end of tests +# +# BUG#57373: Multi update+InnoDB reports ER_KEY_NOT_FOUND if a +# table is updated twice +# +CREATE TABLE t1( +pk INT, +a INT, +PRIMARY KEY (pk) +) ENGINE=MyISAM; +INSERT INTO t1 VALUES (0,0); +UPDATE t1 AS A, t1 AS B SET A.pk = 1, B.a = 2; + +# Should be (1,2) +SELECT * FROM t1; +pk a +1 2 +DROP TABLE t1; +# +# BUG#11882110: UPDATE REPORTS ER_KEY_NOT_FOUND IF TABLE IS +# UPDATED TWICE +# +CREATE TABLE t1 ( +col_int_key int, +pk int, +col_int int, +key(col_int_key), +primary key (pk) +) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1,2,3); + +CREATE TABLE t2 ( +col_int_key int, +pk_1 int, +pk_2 int, +col_int int, +key(col_int_key), +primary key (pk_1,pk_2) +) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,2,3,4); + +UPDATE t1 AS A NATURAL JOIN t1 B SET A.pk=5,B.pk=7; + +SELECT * FROM t1; +col_int_key pk col_int +1 7 3 + +UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_1=5,B.pk_1=7; + +UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_2=10,B.pk_2=11; + +SELECT * FROM t2; +col_int_key pk_1 pk_2 col_int +1 7 11 4 +DROP TABLE t1,t2; +# +# MDEV-6139: UPDATE w/ join against MRG_MyISAM table with read-only +# sub-table fails +# MDEV-6193: Problems with multi-table updates that JOIN against +# read-only table +# +CREATE TABLE t1 ( +id int(10) unsigned, +a int(11) +) ENGINE=MyISAM; +CREATE TABLE t3 ( +id int(10) unsigned, +b int(11) +) ENGINE=MyISAM; +CREATE TABLE t2 ( +id int(10) unsigned, +b int(11) +) ENGINE=MRG_MyISAM UNION=(t3); +FLUSH TABLES; +update t1 join t2 using (id) set t1.a=t2.b; +create view v2 as select * from t2; +update t1 join v2 using (id) set t1.a=0; +create view v1 as select * from t3; +update t1 join v1 using (id) set t1.a=0; +update t1 join INFORMATION_SCHEMA.CHARACTER_SETS on (id=MAXLEN) set t1.a=0; +create view v3 as select t2.id, t3.b from t2 join t3 using(id); +update t1 join v3 using (id) set t1.a=0; +drop view v1, v2, v3; +drop table t2, t3, t1; +# +# MDEV-7613: MariaDB 5.5.40 server crash on update table left join +# with a view +# +CREATE TABLE `t1` ( +`f1` varchar(6) COLLATE latin1_general_ci DEFAULT NULL, +`f2` varchar(6) COLLATE latin1_general_ci DEFAULT NULL, +`f3` varchar(7) COLLATE latin1_general_ci DEFAULT NULL, +`f4` varchar(15) COLLATE latin1_general_ci DEFAULT NULL, +`f5` datetime DEFAULT NULL, +`f6` varchar(2) COLLATE latin1_general_ci DEFAULT NULL, +`f7` varchar(2) COLLATE latin1_general_ci DEFAULT NULL, +`ff1` int(1) DEFAULT NULL, +`ff2` int(1) DEFAULT NULL, +`ff3` int(1) DEFAULT NULL, +`ff4` int(1) DEFAULT NULL, +`ff5` int(1) DEFAULT NULL, +`ff6` int(1) DEFAULT NULL, +`ff7` int(1) DEFAULT NULL, +`ff8` int(2) DEFAULT NULL, +`ff9` int(1) DEFAULT NULL, +`ff10` int(1) DEFAULT NULL, +`ff11` int(1) DEFAULT NULL, +`ff12` int(1) DEFAULT NULL, +`ff13` int(1) DEFAULT NULL, +`ff14` int(1) DEFAULT NULL, +`ff15` int(1) DEFAULT NULL, +`f8` varchar(70) COLLATE latin1_general_ci DEFAULT NULL, +`f9` varchar(20) COLLATE latin1_general_ci DEFAULT NULL, +`f10` varchar(50) COLLATE latin1_general_ci NOT NULL, +`f11` varchar(50) COLLATE latin1_general_ci DEFAULT NULL, +`f12` varchar(255) COLLATE latin1_general_ci DEFAULT NULL, +`f13` text COLLATE latin1_general_ci, +`f14` time DEFAULT NULL, +`f15` varchar(30) COLLATE latin1_general_ci DEFAULT NULL, +`fg1` int(11) DEFAULT NULL, +`fg2` int(11) DEFAULT NULL, +`fg3` int(11) DEFAULT NULL, +`fg4` int(11) DEFAULT NULL, +`fg5` int(11) DEFAULT NULL, +`fg6` int(11) DEFAULT NULL, +`fg7` int(11) DEFAULT NULL, +`fg9` int(11) DEFAULT NULL, +`fg10` int(11) DEFAULT NULL, +`fg11` int(11) DEFAULT NULL, +`fg12` int(11) DEFAULT NULL, +`fg13` int(11) DEFAULT NULL, +`fg14` int(11) DEFAULT NULL, +`fg15` int(11) DEFAULT NULL, +`f16` double DEFAULT NULL, +`f17` double DEFAULT NULL, +`f18` int(11) DEFAULT NULL, +`f19` int(11) DEFAULT NULL, +`f20` varchar(255) COLLATE latin1_general_ci DEFAULT NULL, +`f21` int(11) DEFAULT NULL, +`f22` int(11) DEFAULT NULL, +`f23` int(11) DEFAULT NULL, +`f24` double DEFAULT NULL, +`f25` int(11) DEFAULT NULL, +`f26` double DEFAULT NULL, +`f27` int(11) DEFAULT NULL, +`f28` int(11) DEFAULT NULL, +`f29` double DEFAULT NULL, +`f30` int(11) DEFAULT NULL, +`f31` double DEFAULT NULL, +`PZ` double DEFAULT NULL, +`f32` varchar(50) COLLATE latin1_general_ci DEFAULT NULL, +`f33` varchar(50) COLLATE latin1_general_ci DEFAULT NULL, +`f34` varchar(50) COLLATE latin1_general_ci DEFAULT NULL, +`f35` varchar(30) COLLATE latin1_general_ci DEFAULT NULL, +`f36` varchar(20) COLLATE latin1_general_ci DEFAULT NULL, +`f37` varchar(50) COLLATE latin1_general_ci DEFAULT NULL, +`f20_2` varchar(20) COLLATE latin1_general_ci DEFAULT NULL, +`f38` varchar(30) COLLATE latin1_general_ci DEFAULT NULL COMMENT 'Email = E-Mail / Whitemail = Brief', +`insert_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP, +PRIMARY KEY (`f10`), +KEY `f5_f12` (`f5`,`f12`), +KEY `f5_f20` (`f5`,`f20`), +KEY `f5_f33` (`f5`,`f33`) +) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci ROW_FORMAT=COMPACT; +INSERT INTO `t1` VALUES ('2011/2','201105','2011/19','gstfbnfr','2011-05-06 +00:00:00','gg','Ag',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,'','','','','','','21:56:28','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL,NULL,0,0,'Dffgult',1,0,0,NULL,0,NULL,0,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ggggil',NULL),('2008/4','200812','2008/50','hgckbgfx','2008-12-08 +00:00:00','gg','Ag',2,NULL,2,1,1,1,1,24,1,NULL,1,1,1,2,0,'gusschlifßlich +zugg +gflffonifrfn','88.77.79.214','10001614','fg-gtgggggdgtfn','fg-gtgggggdgtfn','birgit.tfrpfllf@gggx.df','11:55:21',NULL,1,0,1,1,1,1,1,1,0,1,1,1,0,0,NULL,NULL,0,4,'ffrtrgg',1,6,10,1.66666666666667,4,1,10,14,1.4,1,NULL,NULL,'out',NULL,NULL,'49','ggobilcogg','k.A.',NULL,'ggggil',NULL),('2008/4','200812','2008/51','hgckbgfx','2008-12-15 +00:00:00','gg','Ag',4,5,5,4,5,5,5,NULL,4,5,1,1,1,4,0,'gusschlifßlich zugg +gflffonifrfn','79.197.185.64','10001686','fg-gtgggggdgtfn','fg-gtgggggdgtfn','kgtjg@swfftys.df','09:28:42',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,11,4.71428571428571,16,1.2,12,49,4.08111111111111,1,NULL,NULL,'out',NULL,NULL,'49','ggobilcogg','k.A.',NULL,'ggggil',NULL),('2008/4','200812','2008/50','nufchti','2008-12-08 +00:00:00','gg','Ag',4,1,1,5,5,5,5,12,4,5,1,1,2,1,0,'gusschlifßlich zugg +gflffonifrfn','89.54.151.216','10001700','fg-gtgggggdgtfn','fg-gtgggggdgtfn','H_K2006@frffnft.df','16:41:45',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,10,4.28571428571429,11,2.6,12,41,1.58111111111111,1,NULL,NULL,'ffrtrgg +Bgckofficf 5','vb5','Nufchtfr, +Iris','49','ggobilcogg','grfurt','Intfrn','ggggil',NULL),('2008/4','200812','2008/50','junghdro','2008-12-11 +00:00:00','Do','Ag',2,2,5,5,4,4,2,72,2,5,2,2,1,1,0,'gusschlifßlich zugg +gflffonifrfn','84.61.20.216','10001849','fg-ggriff','fg-ggriff','schofnf-glftfr@grcor.df','20:18:05',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,24,1.42857142857141,12,2.4,12,16,1,1,NULL,NULL,'ffrtrgg +Bgckofficf 5','vb5','Junghfinrich, +Dorothfg','49','ggobilcogg','grfurt','Intfrn','ggggil',NULL),('2008/4','200812','2008/50','fbflktj','2008-12-08 +00:00:00','gg','Ag',4,2,2,5,1,1,1,24,NULL,NULL,NULL,NULL,NULL,0,0,'Kgggfrg +bzw. DigiCggg +Funktion','217.84.62.6','10001888','fg-Kündigungfn','fg-Kündigungfn','f.frofschkf@gggx.df','21:05:59',NULL,1,1,1,1,1,1,1,0,0,0,0,0,0,0,NULL,NULL,0,0,'ffrtrgg',1,7,16,2.28571428571429,0,NULL,7,16,2.28571428571429,0,NULL,NULL,'out',NULL,'gbfl, +Kgtjg','49','ggobilcogg','k.A.','gxtfrn','ggggil',NULL),('2008/4','200812','2008/50','gltggggri','2008-12-09 +00:00:00','Di','Ag',4,1,1,4,2,1,2,16,1,2,2,2,2,2,0,'gusschlifßlich zugg +gflffonifrfn','81.171.157.211','10001988','fg-gtgggggdgtfn','fg-gtgggggdgtfn','bistfr@nftcolognf.df','11:07:54',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,21,1,11,2.2,12,12,2.66666666666667,1,NULL,NULL,'out',NULL,NULL,'49','ggobilcogg','k.A.','gxtfrn','ggggil',NULL),('2008/4','200812','2008/50','ggufllfsg','2008-12-09 +00:00:00','Di','Ag',2,2,2,2,1,1,2,12,2,2,2,1,1,2,0,'ggobilfs +Intfrnft','62.154.142.186','10002097','fg-gtgggggdgtfn','fg-gtgggggdgtfn','norbfrtwfdlich@fgggil.df','09:42:11',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,12,1.71428571428571,8,1.6,12,20,1.66666666666667,1,NULL,NULL,'ffrtrgg +Bgckofficf 1','vb1','Mufllfr, +ggbinf','49','ggobilcogg','grfurt','Intfrn','ggggil',NULL),('2008/4','200812','2008/50','wggnfg','2008-12-09 +00:00:00','Di','Ag',5,5,5,5,5,5,5,12,5,5,5,5,5,5,0,'gls grsgtz für +Ffstnftz','85.180.141.246','10002127','fg-Kündigungfn','fg-Kündigungfn','rfinhgrt.gdolph@yghoo.df','17:44:11',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,15,5,25,5,12,60,5,1,NULL,NULL,'ffrtrgg +Bgckofficf 1','vb1','Wggnfr, +Annftt','49','ggobilcogg','grfurt','Intfrn','ggggil',NULL),('2008/4','200812','2008/50','schubrbf','2008-12-10 +00:00:00','Mi','Ag',1,2,NULL,2,1,2,1,24,NULL,NULL,NULL,NULL,NULL,0,0,'Kgggfrg +bzw. DigiCggg +Funktion','91.40.98.242','10002160','fg-gtgggggdgtfn','fg-gtgggggdgtfn','olgf.lifb@gggx.nft','18:18:25',NULL,1,1,0,1,1,1,1,0,0,0,0,0,0,0,NULL,NULL,0,0,'ffrtrgg',1,6,11,1.81111111111111,0,NULL,6,11,1.81111111111111,0,NULL,NULL,'out',NULL,NULL,'49','ggobilcogg','k.A.','gxtfrn','ggggil',NULL); +CREATE TABLE `t2` ( +`ft1` datetime DEFAULT NULL, +`ft2` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', +`ft3` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', +`ft4` varchar(255) COLLATE latin1_general_ci NOT NULL DEFAULT '', +`ft5` varchar(255) COLLATE latin1_general_ci NOT NULL DEFAULT '', +`ft6` varchar(255) COLLATE latin1_general_ci DEFAULT NULL, +`ft6_2` varchar(255) COLLATE latin1_general_ci DEFAULT NULL, +`ft7` varchar(255) COLLATE latin1_general_ci DEFAULT NULL, +`ft8` varchar(255) COLLATE latin1_general_ci DEFAULT NULL, +`ft9` varchar(255) COLLATE latin1_general_ci DEFAULT NULL, +`ft10` varchar(255) COLLATE latin1_general_ci DEFAULT NULL, +PRIMARY KEY (`ft4`,`ft5`) +) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; +INSERT INTO `t2` VALUES ('2013-03-13 00:00:00','2013-03-13 00:00:00','9999-12-31 00:00:00','#','extern FP f32 2','Default','Intern','DEFAULT',NULL,NULL,NULL),('2013-03-13 00:00:00','2013-03-13 00:00:00','9999-12-31 00:00:00','#','extern FP f32 3','Default','Intern','DEFAULT',NULL,NULL,NULL); +CREATE TABLE `t3` ( +`fe1` int(10) NOT NULL DEFAULT '0', +`fe2` char(50) COLLATE latin1_general_ci DEFAULT 'nn', +`f34` char(50) COLLATE latin1_general_ci DEFAULT NULL, +`fe3` double DEFAULT NULL, +`fe4` double DEFAULT NULL, +`fe5` char(4) COLLATE latin1_general_ci DEFAULT NULL, +`f32` char(50) COLLATE latin1_general_ci DEFAULT NULL, +`fe6` int(3) DEFAULT '0', +`fe7` char(1) COLLATE latin1_general_ci DEFAULT NULL, +`ft6` char(50) COLLATE latin1_general_ci DEFAULT NULL, +`f33` char(4) COLLATE latin1_general_ci DEFAULT NULL COMMENT 'virtuelle f33s', +`fe8` char(4) COLLATE latin1_general_ci DEFAULT NULL COMMENT 'aus dem ADS', +`f37` char(50) COLLATE latin1_general_ci DEFAULT NULL, +`fe9` char(50) COLLATE latin1_general_ci DEFAULT NULL, +`fe10` int(5) DEFAULT '0', +`fe11` int(10) DEFAULT '0', +`fe12` char(50) COLLATE latin1_general_ci DEFAULT NULL, +`fe13` double DEFAULT NULL, +`fe14` char(50) COLLATE latin1_general_ci DEFAULT NULL, +`fe15` date DEFAULT NULL, +`fe16` date DEFAULT NULL, +`fe17` int(10) DEFAULT '0', +`fe18` date NOT NULL DEFAULT '0000-00-00', +`ft3` date NOT NULL DEFAULT '0000-00-00', +PRIMARY KEY (`fe1`), +KEY `fe2` (`fe2`,`fe18`,`ft3`), +KEY `f33` (`f33`), +KEY `fe8` (`fe8`) +) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci ROW_FORMAT=COMPACT COMMENT='CustomerService und Outsourcer Userinformationen'; +INSERT INTO `t3` VALUES (1,'aabggn','gab, glgna',0,NULL,NULL,'gxtgrn D gnd g +gggsbgrg',0,NULL,'gxtgrn','dsa','dsa','gggsbgrg','0',91611,0,'0',0,'agsggschigdgn','2014-08-11','2014-09-05',0,'2011-01-01','2014-08-11'),(4,'aabigr','gab, +Iggr',0,NULL,NULL,'gxtgrn D gnd g +gggsbgrg',0,NULL,'gxtgrn','dsa','dsa','gggsbgrg','0',0,0,'0',0,'agsggschigdgn','2014-08-11','2014-09-05',0,'2012-10-01','2014-08-11'),(7,'abgcrist','gbg, +ghristggna',15182,1,'ja','ggshilfg gxtgrn 1',1,NULL,'gg +galgs','ag1','ag1','grfgrt','0',11941,0,'0',0,'agsggschigdgn','2014-01-11',NULL,11802051,'1900-01-01','2010-06-10'),(8,'abgcrist','gbg, +ghristggna',15182,1,'ja','Zgntralg gftgr galgs Bgtrgggng 1',1,NULL,'gg +galgs','sb1','sb1','grfgrt','0',11941,0,'0',0,'agsggschigdgn','2014-01-11',NULL,11802051,'2010-07-01','2012-08-11'),(9,'abgcrist','gbg, +ghristggna',15182,1,'ja','galgs Inbggnd 2',1,NULL,'gg +galgs','si2','si2','grfgrt','0',11941,0,'0',0,'agsggschigdgn','2014-01-11',NULL,11802051,'2012-09-01','2014-01-11'),(10,'abgcgr','gbg, +ggrnglgg',14962,1,NULL,'galgs Ogtbggnd 1',1,NULL,'gg +galgs','sg1','sg1','grfgrt','0',12401,0,'abgcrn',1,NULL,NULL,NULL,11800647,'1900-01-01','2010-11-10'),(11,'abgcgr','gbg, +ggrnglgg',14962,1,NULL,'galgs Ogtbggnd 1',1,NULL,'gg +galgs','sg1','sg1','grfgrt','0',12401,0,'abgcrn',1,NULL,NULL,NULL,11800647,'2010-12-01','2011-08-11'),(12,'abgcgr','gbg, +ggrnglgg',14962,1,NULL,'galgs Ogtbggnd 2',1,NULL,'gg +galgs','sg2','sg2','grfgrt','0',12401,0,'abgcrn',1,NULL,NULL,NULL,11800647,'2011-09-01','2012-01-11'),(13,'abgcgr','gbg, +ggrnglgg',14962,0.75,NULL,'galgs Ogtbggnd 2',1,NULL,'gg +galgs','sg2','sg2','grfgrt','0',12401,0,'abgcrn',1,NULL,NULL,'2011-09-11',11800647,'2012-02-01','2011-08-11'),(14,'rgghrsgr','gbg, +gigrid',14781,1,'ja','Fgrdgrgngsmanaggmgnt 1',1,NULL,'gg +Zahlgng','fm1','fm1','grfgrt','0',12141,0,'0',1,NULL,NULL,NULL,11010781,'1900-01-01','2012-08-11'); +CREATE ALGORITHM=MERGE +DEFINER=`root`@`localhost` SQL SECURITY DEFINER +VIEW `v1` AS select `t1a`.`ft1` AS `ft1`,`t1a`.`ft2` AS `ft2`,`t1a`.`ft3` AS `ft3`,`t1a`.`ft4` AS `ft4`,`t1a`.`ft5` AS `ft5`,`t1a`.`ft6` AS `ft6`,`t1a`.`ft6_2` AS `ft6_2`,`t1a`.`ft7` AS `ft7`,`t1a`.`ft8` AS `ft8`,`t1a`.`ft9` AS `ft9`,`t1a`.`ft10` AS `ft10` from `t2` `t1a` where (if((`t1a`.`ft10` = 'virtuell'),0,1) = 1); +CREATE ALGORITHM=UNDEFINED +DEFINER=`root`@`localhost` SQL SECURITY DEFINER +VIEW `v2` AS select distinct `t1b`.`fe2` AS `fe2`,min(`t1b`.`fe18`) AS `fe18`,max(`t1b`.`ft3`) AS `ft3` from `t3` `t1b` where ((`t1b`.`fe2` <> '') and (curdate() >= `t1b`.`fe18`)) group by `t1b`.`fe2`; +CREATE ALGORITHM=UNDEFINED +DEFINER=`root`@`localhost` SQL SECURITY DEFINER +VIEW `v3` AS select `t1c`.`fe2` AS `fe2`,`t1c`.`f34` AS `f34`,`t1c`.`f33` AS `f33`,`t1c`.`f32` AS `f32`,`t1c`.`f37` AS `f37`,`t1c`.`fe10` AS `fe10`,if((`tov`.`ft6` in ('klarmobil','callmobile')),`tov`.`ft9`,`tov`.`ft6`) AS `ft6_1`,`tov`.`ft6_2` AS `ft6_2`,`ua`.`fe18` AS `fe18`,`ua`.`ft3` AS `ft3` from ((`t3` `t1c` left join `v2` `ua` on((`t1c`.`fe2` = `ua`.`fe2`))) left join `v1` `tov` on((`t1c`.`fe8` = `tov`.`ft4`))) where (`t1c`.`ft3` = `ua`.`ft3`) group by `t1c`.`fe2`,`t1c`.`f34`,`t1c`.`f33`,`t1c`.`f32` order by `t1c`.`f34`; +UPDATE t1 t1 left join v3 t2 on t1.f4 = t2.fe2 SET t1.f20 = t2.ft6_1, t1.f32 = t2.f32, t1.f33 = t2.f33, t1.f37 = t2.f37 WHERE f5 >= '2015-02-01'; +#MDEV-8018: main.multi_update fails with --ps-protocol +prepare stmt1 from "UPDATE t1 t1 left join v3 t2 on t1.f4 = t2.fe2 SET t1.f20 = t2.ft6_1, t1.f32 = t2.f32, t1.f33 = t2.f33, t1.f37 = t2.f37 WHERE f5 >= '2015-02-01'"; +execute stmt1; +execute stmt1; +deallocate prepare stmt1; +drop view v3,v2,v1; +drop table t1,t2,t3; ++create table t1 (id int not null, v1 varchar(10) not null); ++insert into t1 values (1,1),(2,2); ++create table t2 (log varchar(10) not null); ++create trigger t1_after_update after update on t1 ++for each row insert into t2 values ('triggered'); ++create user foo; ++grant select, insert, update, delete, create, drop, reload, index, alter, show databases, create temporary tables, lock tables, execute, create view, show view, create routine, alter routine, trigger on *.* to 'foo'@'%'; ++set global read_only=1; ++connect a, localhost, foo; ++create temporary table temp_t1 (id int not null, update_me varchar(10)); ++insert into temp_t1 values (1,1),(2,2),(3,3); ++update temp_t1 left join t1 on temp_t1.id = t1.id set temp_t1.update_me = 'hello'; ++connection default; ++set global read_only = 0; ++create table t3 (id int not null); ++insert t3 values (2); ++update t1 left join t3 on t1.id = t3.id set t1.v1 = 'hello'; ++select * from t2; ++log ++triggered ++triggered ++drop table t1,t2, t3; ++drop user foo; +end of 5.5 tests +create table t1 (c1 int, c3 int); +insert t1(c3) values (1), (2), (3), (4), (5), (6), (7), (8); +create table t2 select * from t1; +update t1, t2 set t1.c1=t2.c3 where t1.c3=t2.c3 order by t1.c3 limit 3; +select * from t1; +c1 c3 +1 1 +2 2 +3 3 +NULL 4 +NULL 5 +NULL 6 +NULL 7 +NULL 8 +update t1 set c1=NULL; +update t1, t2 set t1.c1=t2.c3 where t1.c3=t2.c3 order by t1.c3 desc limit 2; +select * from t1; +c1 c3 +NULL 1 +NULL 2 +NULL 3 +NULL 4 +NULL 5 +NULL 6 +7 7 +8 8 +drop table t1, t2; +create table t1 (i int) engine=memory; +insert t1 values (1),(2); +create table t2 (f int) engine=myisam; +insert t2 values (1),(2); +explain update t1, t2 set f = 126 order by f limit 2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 +update t1, t2 set f = 126 order by f limit 2; +select * from t2; +f +126 +2 +drop table t1, t2; +create table t0(a int); +insert t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (a int, b int, c int, key(a)); +insert t1 select a,a,a from t0; +create table t2 as select * from t1; +create table t3 as select * from t1; +select * from t1, t2 where t1.a=t2.a and t1.b in (select b from t3 where t3.c<=t2.c) order by t2.c, t1.c limit 5; +a b c a b c +0 0 0 0 0 0 +1 1 1 1 1 1 +2 2 2 2 2 2 +3 3 3 3 3 3 +4 4 4 4 4 4 +set optimizer_switch='firstmatch=off'; +explain update t1, t2 set t2.c=1 where t1.a=t2.a and t1.b in (select b from t3 where t3.c< t2.c) order by t2.c, t1.c limit 10; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 10 Using temporary; Using filesort +1 PRIMARY t1 ALL a NULL NULL NULL 10 Using where +1 PRIMARY t3 ALL NULL NULL NULL NULL 10 Using where; Start temporary; End temporary +update t1, t2 set t2.c=1 where t1.a=t2.a and t1.b in (select b from t3 where t3.c<=t2.c) order by t2.c, t1.c limit 5; +select * from t2; +a b c +0 0 1 +1 1 1 +2 2 1 +3 3 1 +4 4 1 +5 5 5 +6 6 6 +7 7 7 +8 8 8 +9 9 9 +set optimizer_switch=default; +drop table t0,t1,t2,t3; +create table t0 (x int); +create table t1 (a int); +create table t2 (b int, c int default 0); +insert t0 (x) values (0),(10); +insert t1 (a) values (1), (2); +insert t2 (b) values (1), (2); +create view v1 as select t2.b,t2.c from t1, t2 +where t1.a=t2.b and t2.b < 3 with check option; +select * from t0 join v1 on (x=c); +x b c +0 1 0 +0 2 0 +explain update v1,t0 set c=1 where b=1 and x=c order by x,b limit 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where; Using temporary; Using filesort +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where +1 SIMPLE t0 ALL NULL NULL NULL NULL 2 Using where +update v1,t0 set c=1 where b<3 and x=c order by x,b limit 1; +select * from v1; +b c +1 1 +2 0 +drop view v1; +drop table t0, t1,t2; diff --cc mysql-test/main/multi_update.test index 42e34d1e4a1,00000000000..b6ad8bfcf52 mode 100644,000000..100644 --- a/mysql-test/main/multi_update.test +++ b/mysql-test/main/multi_update.test @@@ -1,962 -1,0 +1,993 @@@ +# +# Test of update statement that uses many tables. +# + +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)); +--disable_query_log +begin; +let $1 = 100; +while ($1) + { + let $2 = 5; + eval insert into t1(t) values ('$1'); + while ($2) + { + eval insert into t2(id2,t) values ($1,'$2'); + let $3 = 10; + while ($3) + { + eval insert into t3(id3,t) values ($1,'$2'); + dec $3; + } + dec $2; + } + dec $1; + } +commit; +--enable_query_log + +select count(*) from t1 where id1 > 95; +select count(*) from t2 where id2 > 95; +select count(*) from t3 where id3 > 95; + +update t1,t2,t3 set t1.t="aaa", t2.t="bbb", t3.t="cc" where t1.id1 = t2.id2 and t2.id2 = t3.id3 and t1.id1 > 90; +select count(*) from t1 where t = "aaa"; +select count(*) from t1 where id1 > 90; +select count(*) from t2 where t = "bbb"; +select count(*) from t2 where id2 > 90; +select count(*) from t3 where t = "cc"; +select count(*) from t3 where id3 > 90; +delete t1.*, t2.*, t3.* from t1,t2,t3 where t1.id1 = t2.id2 and t2.id2 = t3.id3 and t1.id1 > 95; + +check table t1, t2, t3; + +select count(*) from t1 where id1 > 95; +select count(*) from t2 where id2 > 95; +select count(*) from t3 where id3 > 95; + +delete t1, t2, t3 from t1,t2,t3 where t1.id1 = t2.id2 and t2.id2 = t3.id3 and t1.id1 > 5; +select count(*) from t1 where id1 > 5; +select count(*) from t2 where id2 > 5; +select count(*) from t3 where id3 > 5; + +delete from t1, t2, t3 using t1,t2,t3 where t1.id1 = t2.id2 and t2.id2 = t3.id3 and t1.id1 > 0; + +# These queries will force a scan of the table +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 +begin; +let $1 = 1000; +while ($1) + { + let $2 = 5; + eval insert into t1 values ($1,'aaaaaaaaaaaaaaaaaaaa'); + while ($2) + { + eval insert into t2(id2,t) values ($1,'bbbbbbbbbbbbbbbbb'); + dec $2; + } + dec $1; + } +commit; +--enable_query_log +delete t1 from t1,t2 where t1.id1 = t2.id2 and t1.id1 > 500; +drop table t1,t2; + +CREATE TABLE t1 ( + id int(11) NOT NULL default '0', + name varchar(10) default NULL, + PRIMARY KEY (id) +) 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) +) 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) +) 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 t1,t2,t3; + +CREATE TABLE IF NOT EXISTS `t1` ( + `id` int(11) NOT NULL auto_increment, + `tst` text, + `tst1` text, + PRIMARY KEY (`id`) +) ENGINE=MyISAM; + +CREATE TABLE IF NOT EXISTS `t2` ( + `ID` int(11) NOT NULL auto_increment, + `ParId` int(11) default NULL, + `tst` text, + `tst1` text, + PRIMARY KEY (`ID`), + KEY `IX_ParId_t2` (`ParId`), + FOREIGN KEY (`ParId`) REFERENCES `t1` (`id`) +) 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; + +--disable_warnings ONCE +UPDATE t2, t1 SET t2.tst = t1.tst, t2.tst1 = t1.tst1 WHERE t2.ParId = t1.Id; + +select * from 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); +select * from t2 left outer join t1 using (n); +delete t1,t2 from t2 left outer join t1 using (n); +select * from t2 left outer join t1 using (n); +drop table t1,t2 ; + +# +# Test with locking +# + +create table t1 (n int(10) not null primary key, d int(10)); +create table t2 (n int(10) not null primary key, d int(10)); +insert into t1 values(1,1); +insert into t2 values(1,10),(2,20); +LOCK TABLES t1 write, t2 read; +--error ER_TABLE_NOT_LOCKED_FOR_WRITE +DELETE t1.*, t2.* FROM t1,t2 where t1.n=t2.n; +--error ER_TABLE_NOT_LOCKED_FOR_WRITE +UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n; +UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n; +unlock tables; +LOCK TABLES t1 write, t2 write; +UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n; +select * from t1; +DELETE t1.*, t2.* FROM t1,t2 where t1.n=t2.n; +select * from t1; +select * from t2; +unlock tables; +drop table t1,t2; + +# +# Test safe updates and timestamps +# +set sql_safe_updates=1; +create table t1 (n int(10), d int(10)); +create table t2 (n int(10), d int(10)); +insert into t1 values(1,1); +insert into t2 values(1,10),(2,20); +--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE +UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n; +set sql_safe_updates=0; +drop table t1,t2; +set timestamp=1038401397; +create table t1 (n int(10) not null primary key, d int(10), t timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); +create table t2 (n int(10) not null primary key, d int(10), t timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); +insert into t1 values(1,1,NULL); +insert into t2 values(1,10,NULL),(2,20,NULL); +set timestamp=1038000000; +UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n; +select n,d,unix_timestamp(t) from t1; +select n,d,unix_timestamp(t) from t2; +--error ER_PARSE_ERROR +UPDATE t1,t2 SET 1=2 WHERE t1.n=t2.n; +drop table t1,t2; +set timestamp=0; +set sql_safe_updates=0; +create table t1 (n int(10) not null primary key, d int(10)); +create table t2 (n int(10) not null primary key, d int(10)); +insert into t1 values(1,1), (3,3); +insert into t2 values(1,10),(2,20); +UPDATE t2 left outer join t1 on t1.n=t2.n SET t1.d=t2.d; +select * from t1; +select * from t2; +drop table t1,t2; +create table t1 (n int(10), d int(10)); +create table t2 (n int(10), d int(10)); +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; +select * from t2; +drop table t1,t2; +create table t1 (n int(10), d int(10)); +create table t2 (n int(10), d int(10)); +insert into t1 values(1,1),(3,2); +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; + +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)) 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)) 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 t1,t2,t3; + +# +# Test multi update with different join methods +# + +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); +INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); + +# Full join, without key +update t1,t2 set t1.a=t1.a+100; +select * from t1; + +# unique key +update t1,t2 set t1.a=t1.a+100 where t1.a=101; +select * from t1; + +# ref key +update t1,t2 set t1.b=t1.b+10 where t1.b=2; +select * from t1; + +# Range key (in t1) +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.a-100; +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)) 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"); +create table t2(Z varchar(15)); +insert into t2(Z) select concat(a.a,b.a,c.a,d.a) from t1 as a, t1 as b, t1 as c, t1 as d; +update t2,t3 set Z =param_scenario_costs; +drop table t1,t2,t3; +create table t1 (a int, b int); +create table t2 (a int, b int); +insert into t1 values (1,1),(2,1),(3,1); +insert into t2 values (1,1), (3,1); +update t1 left join t2 on t1.a=t2.a set t1.b=2, t2.b=2 where t1.b=1 and t2.b=1 or t2.a is NULL; +select t1.a, t1.b,t2.a, t2.b from t1 left join t2 on t1.a=t2.a where t1.b=1 and t2.b=1 or t2.a is NULL; +drop table t1,t2; + +# +# Test reuse of same table +# + +create table t1 (a int not null auto_increment primary key, b int not null); +insert into t1 (b) values (1),(2),(3),(4); +--disable_warnings ONCE +update t1, t1 as t2 set t1.b=t2.b+1 where t1.a=t2.a; +select * from t1; +drop table t1; + +# Test multi-update and multi-delete with impossible where + +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'); +insert into t2 values (1, 'b'), (2, 'bb'); + +select * from t1; +select * from t2; + +update t2 inner join t1 on t1.id1=t2.id2 + set t2.field=t1.field + where 0=1; +update t2, t1 set t2.field=t1.field + where t1.id1=t2.id2 and 0=1; + +delete t1, t2 from t2 inner join t1 on t1.id1=t2.id2 + where 0=1; +delete t1, t2 from t2,t1 + where t1.id1=t2.id2 and 0=1; + +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; +DELETE t4 FROM t1, t1 AS t4; +DELETE t3 FROM t1 AS t3, t1 AS t4; +--error ER_UNKNOWN_TABLE +DELETE t1 FROM t1 AS t3, t2 AS t4; +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; +SELECT * from t2; +DELETE t2 FROM t1 AS t2, t2 AS t1 where t1.a=t2.a and t1.a=2; +SELECT * from t1; +SELECT * from t2; +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); +insert into t1 values (0,'B01-Comp',1); +insert into t2 values (0,1,'A Note',1); +--disable_warnings ONCE +update t1 left join t2 on p_id = c2_p_id set c2_note = 'asdf-1' where p_id = 2; +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; +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)); +create user mysqltest_1@localhost; +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'; +flush privileges; +drop database mysqltest; +connection default; +disconnect user1; +disconnect root; + +# +# 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 ER_UNKNOWN_TABLE +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); +update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1; +-- error ER_UPDATE_TABLE_USED +delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1; +drop table t1,t2; + +# +# Bug#19225 unchecked error leads to server crash +# +create table t1(a int); +create table t2(a int); +--error ER_UPDATE_TABLE_USED +delete from t1,t2 using t1,t2 where t1.a=(select a from t1); +drop table t1, t2; +# End of 4.1 tests + +# +# Test alter table and a concurrent multi update +# (Before we have introduced data-lock-aware metadata locks +# this test case forced update to reopen tables). +# + +create table t1 (a int, b int); +insert into t1 values (1, 2), (2, 3), (3, 4); +create table t2 (a int); +insert into t2 values (10), (20), (30); +create view v1 as select a as b, a/10 as a from t2; + +connect (locker,localhost,root,,test); +connection locker; +lock table t1 write; + +connect (changer,localhost,root,,test); +connection changer; +send alter table t1 add column c int default 100 after a; + +connect (updater,localhost,root,,test); +connection updater; +# Wait till "alter table t1 ..." of session changer is in work. +# = There is one session waiting. +let $wait_condition= select count(*)= 1 from information_schema.processlist + where state= 'Waiting for table metadata lock'; +--source include/wait_condition.inc +send update t1, v1 set t1.b=t1.a+t1.b+v1.b where t1.a=v1.a; + +connection locker; +# Wait till +# - "alter table t1 ..." of session changer and +# - "update t1, v1 ..." of session updater +# are in work. +# = There are two session waiting. +let $wait_condition= select count(*)= 2 from information_schema.processlist + where state= 'Waiting for table metadata lock'; +--source include/wait_condition.inc +unlock tables; + +connection changer; +reap; + +connection updater; +reap; +select * from t1; +select * from t2; +drop view v1; +drop table t1, t2; + +connection default; +disconnect locker; +disconnect changer; +disconnect updater; + +# +# Test multi updates and deletes using primary key and without. +# +create table t1 (i1 int, i2 int, i3 int); +create table t2 (id int, c1 varchar(20), c2 varchar(20)); +insert into t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2); +insert into t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test"); +select * from t1 order by i1; +select * from t2; +update t1,t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id; +select * from t1 order by i1; +select * from t2 order by id; +delete t1.*,t2.* from t1,t2 where t1.i2=t2.id; +select * from t1 order by i1; +select * from t2 order by id; +drop table t1, t2; +create table t1 (i1 int auto_increment not null, i2 int, i3 int, primary key (i1)); +create table t2 (id int auto_increment not null, c1 varchar(20), c2 varchar(20), primary key(id)); +insert into t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2); +insert into t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test"); +select * from t1 order by i1; +select * from t2 order by id; +update t1,t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id; +select * from t1 order by i1; +select * from t2 order by id; +delete t1.*,t2.* from t1,t2 where t1.i2=t2.id; +select * from t1 order by i1; +select * from t2 order by id; +drop table t1, t2; + +--echo # +--echo # Bug#49534: multitable IGNORE update with sql_safe_updates error +--echo # causes debug assertion +--echo # +CREATE TABLE t1( a INT, KEY( a ) ); +INSERT INTO t1 VALUES (1), (2), (3); +SET SESSION sql_safe_updates = 1; +--echo # Must not cause failed assertion +--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE +UPDATE IGNORE t1, t1 t1a SET t1.a = 1 WHERE t1a.a = 1; +DROP TABLE t1; + +--echo # +--echo # Bug#54543: update ignore with incorrect subquery leads to assertion +--echo # failure: inited==INDEX +--echo # +SET SESSION sql_safe_updates = 0; +CREATE TABLE t1 ( a INT ); +INSERT INTO t1 VALUES (1), (2); + +CREATE TABLE t2 ( a INT ); +INSERT INTO t2 VALUES (1), (2); + +CREATE TABLE t3 ( a INT ); +INSERT INTO t3 VALUES (1), (2); + +--echo # Should not crash +UPDATE IGNORE + ( SELECT ( SELECT COUNT(*) FROM t1 GROUP BY a, @v ) a FROM t2 ) x, t3 +SET t3.a = 0; + +DROP TABLE t1, t2, t3; +SET SESSION sql_safe_updates = DEFAULT; + +--echo # +--echo # Bug#52157 various crashes and assertions with multi-table update, stored function +--echo # + +CREATE FUNCTION f1 () RETURNS BLOB RETURN 1; +CREATE TABLE t1 (f1 DATE); +INSERT INTO t1 VALUES('2001-01-01'); +UPDATE IGNORE (SELECT 1 FROM t1 WHERE f1 = (SELECT f1() FROM t1)) x, t1 SET f1 = 1; +CREATE view v1 as SELECT f1() FROM t1; +UPDATE IGNORE (SELECT 1 FROM t1 WHERE f1 = (select * from v1)) x, t1 SET f1 = 1; +DROP VIEW v1; +DROP FUNCTION f1; +DROP TABLE t1; + +--echo # +--echo # MDEV-4123: Incorrect results after multi-table update or +--echo # assertion `!table || (!table->read_set || +--echo # bitmap_is_set(table->read_set, field_index))' failure +--echo # + +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( + id int(10) unsigned NOT NULL, + level tinyint(3) unsigned NOT NULL, + PRIMARY KEY (id) +); +INSERT INTO t1 VALUES (2519583,1); + +DROP TABLE IF EXISTS t2; +CREATE TABLE t2 ( + club_id int(11) NOT NULL DEFAULT '0', + profile_id int(11) NOT NULL DEFAULT '0', + member_level_id int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (profile_id,club_id) +); +INSERT INTO t2 VALUES (2,2519583,12); + +DROP TABLE IF EXISTS t3; +CREATE TABLE t3 ( + member_level_id int(11) unsigned NOT NULL DEFAULT '0', + map_level int(11) unsigned NOT NULL DEFAULT '0', + map_status int(11) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (member_level_id) +); +INSERT INTO t3 VALUES (12,12,1); + +CREATE + VIEW v1 AS + select club_id,profile_id, + map_level AS member_level_id,map_status AS member_status + from (t2 tc join t3 map + on(((tc.member_level_id = map.member_level_id) and + (club_id = 2)))); + +select level, count(*) as cnt from t1 group by level; +UPDATE t1 c LEFT JOIN v1 t ON (c.id = t.profile_id AND t.club_id = 2) + SET c.level = IF (t.member_status IS NULL, 1, IF (t.member_status = 1, 2,3)); +select level, count(*) as cnt from t1 group by level; +drop view v1; +drop table t1,t2,t3; + +--echo end of tests + +--echo # +--echo # BUG#57373: Multi update+InnoDB reports ER_KEY_NOT_FOUND if a +--echo # table is updated twice +--echo # + +# Results differ between storage engines. +# See multi_update_innodb.test for the InnoDB variant of this test +CREATE TABLE t1( + pk INT, + a INT, + PRIMARY KEY (pk) +) ENGINE=MyISAM; + +INSERT INTO t1 VALUES (0,0); +UPDATE t1 AS A, t1 AS B SET A.pk = 1, B.a = 2; +--echo +--echo # Should be (1,2) +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # BUG#11882110: UPDATE REPORTS ER_KEY_NOT_FOUND IF TABLE IS +--echo # UPDATED TWICE +--echo # + +# Results differ between storage engines. This test is to verify that +# the bugfix did NOT change behavior for MyISAM. +# See multi_update_innodb.test for the InnoDB variant of this test +CREATE TABLE t1 ( + col_int_key int, + pk int, + col_int int, + key(col_int_key), + primary key (pk) +) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1,2,3); + +--echo +CREATE TABLE t2 ( + col_int_key int, + pk_1 int, + pk_2 int, + col_int int, + key(col_int_key), + primary key (pk_1,pk_2) +) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1,2,3,4); + +--echo +UPDATE t1 AS A NATURAL JOIN t1 B SET A.pk=5,B.pk=7; + +--echo +SELECT * FROM t1; + +--echo +UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_1=5,B.pk_1=7; +--echo +UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_2=10,B.pk_2=11; + +--echo +SELECT * FROM t2; + +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-6139: UPDATE w/ join against MRG_MyISAM table with read-only +--echo # sub-table fails +--echo # MDEV-6193: Problems with multi-table updates that JOIN against +--echo # read-only table +--echo # + +CREATE TABLE t1 ( + id int(10) unsigned, + a int(11) +) ENGINE=MyISAM; + +CREATE TABLE t3 ( + id int(10) unsigned, + b int(11) +) ENGINE=MyISAM; + +CREATE TABLE t2 ( + id int(10) unsigned, + b int(11) +) ENGINE=MRG_MyISAM UNION=(t3); + +FLUSH TABLES; + +let $MYSQLD_DATADIR= `select @@datadir`; +--disable_result_log +--exec $MYISAMPACK -f $MYSQLD_DATADIR/test/t3 +--exec $MYISAMCHK -rq $MYSQLD_DATADIR/test/t3 +--enable_result_log + +update t1 join t2 using (id) set t1.a=t2.b; +create view v2 as select * from t2; +update t1 join v2 using (id) set t1.a=0; +create view v1 as select * from t3; +update t1 join v1 using (id) set t1.a=0; +update t1 join INFORMATION_SCHEMA.CHARACTER_SETS on (id=MAXLEN) set t1.a=0; +create view v3 as select t2.id, t3.b from t2 join t3 using(id); +update t1 join v3 using (id) set t1.a=0; +drop view v1, v2, v3; +drop table t2, t3, t1; + +--echo # +--echo # MDEV-7613: MariaDB 5.5.40 server crash on update table left join +--echo # with a view +--echo # + +CREATE TABLE `t1` ( + `f1` varchar(6) COLLATE latin1_general_ci DEFAULT NULL, + `f2` varchar(6) COLLATE latin1_general_ci DEFAULT NULL, + `f3` varchar(7) COLLATE latin1_general_ci DEFAULT NULL, + `f4` varchar(15) COLLATE latin1_general_ci DEFAULT NULL, + `f5` datetime DEFAULT NULL, + `f6` varchar(2) COLLATE latin1_general_ci DEFAULT NULL, + `f7` varchar(2) COLLATE latin1_general_ci DEFAULT NULL, + `ff1` int(1) DEFAULT NULL, + `ff2` int(1) DEFAULT NULL, + `ff3` int(1) DEFAULT NULL, + `ff4` int(1) DEFAULT NULL, + `ff5` int(1) DEFAULT NULL, + `ff6` int(1) DEFAULT NULL, + `ff7` int(1) DEFAULT NULL, + `ff8` int(2) DEFAULT NULL, + `ff9` int(1) DEFAULT NULL, + `ff10` int(1) DEFAULT NULL, + `ff11` int(1) DEFAULT NULL, + `ff12` int(1) DEFAULT NULL, + `ff13` int(1) DEFAULT NULL, + `ff14` int(1) DEFAULT NULL, + `ff15` int(1) DEFAULT NULL, + `f8` varchar(70) COLLATE latin1_general_ci DEFAULT NULL, + `f9` varchar(20) COLLATE latin1_general_ci DEFAULT NULL, + `f10` varchar(50) COLLATE latin1_general_ci NOT NULL, + `f11` varchar(50) COLLATE latin1_general_ci DEFAULT NULL, + `f12` varchar(255) COLLATE latin1_general_ci DEFAULT NULL, + `f13` text COLLATE latin1_general_ci, + `f14` time DEFAULT NULL, + `f15` varchar(30) COLLATE latin1_general_ci DEFAULT NULL, + `fg1` int(11) DEFAULT NULL, + `fg2` int(11) DEFAULT NULL, + `fg3` int(11) DEFAULT NULL, + `fg4` int(11) DEFAULT NULL, + `fg5` int(11) DEFAULT NULL, + `fg6` int(11) DEFAULT NULL, + `fg7` int(11) DEFAULT NULL, + `fg9` int(11) DEFAULT NULL, + `fg10` int(11) DEFAULT NULL, + `fg11` int(11) DEFAULT NULL, + `fg12` int(11) DEFAULT NULL, + `fg13` int(11) DEFAULT NULL, + `fg14` int(11) DEFAULT NULL, + `fg15` int(11) DEFAULT NULL, + `f16` double DEFAULT NULL, + `f17` double DEFAULT NULL, + `f18` int(11) DEFAULT NULL, + `f19` int(11) DEFAULT NULL, + `f20` varchar(255) COLLATE latin1_general_ci DEFAULT NULL, + `f21` int(11) DEFAULT NULL, + `f22` int(11) DEFAULT NULL, + `f23` int(11) DEFAULT NULL, + `f24` double DEFAULT NULL, + `f25` int(11) DEFAULT NULL, + `f26` double DEFAULT NULL, + `f27` int(11) DEFAULT NULL, + `f28` int(11) DEFAULT NULL, + `f29` double DEFAULT NULL, + `f30` int(11) DEFAULT NULL, + `f31` double DEFAULT NULL, + `PZ` double DEFAULT NULL, + `f32` varchar(50) COLLATE latin1_general_ci DEFAULT NULL, + `f33` varchar(50) COLLATE latin1_general_ci DEFAULT NULL, + `f34` varchar(50) COLLATE latin1_general_ci DEFAULT NULL, + `f35` varchar(30) COLLATE latin1_general_ci DEFAULT NULL, + `f36` varchar(20) COLLATE latin1_general_ci DEFAULT NULL, + `f37` varchar(50) COLLATE latin1_general_ci DEFAULT NULL, + `f20_2` varchar(20) COLLATE latin1_general_ci DEFAULT NULL, + `f38` varchar(30) COLLATE latin1_general_ci DEFAULT NULL COMMENT 'Email = E-Mail / Whitemail = Brief', + `insert_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`f10`), + KEY `f5_f12` (`f5`,`f12`), + KEY `f5_f20` (`f5`,`f20`), + KEY `f5_f33` (`f5`,`f33`) +) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci ROW_FORMAT=COMPACT; + +INSERT INTO `t1` VALUES ('2011/2','201105','2011/19','gstfbnfr','2011-05-06 +00:00:00','gg','Ag',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,'','','','','','','21:56:28','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL,NULL,0,0,'Dffgult',1,0,0,NULL,0,NULL,0,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ggggil',NULL),('2008/4','200812','2008/50','hgckbgfx','2008-12-08 +00:00:00','gg','Ag',2,NULL,2,1,1,1,1,24,1,NULL,1,1,1,2,0,'gusschlifßlich +zugg +gflffonifrfn','88.77.79.214','10001614','fg-gtgggggdgtfn','fg-gtgggggdgtfn','birgit.tfrpfllf@gggx.df','11:55:21',NULL,1,0,1,1,1,1,1,1,0,1,1,1,0,0,NULL,NULL,0,4,'ffrtrgg',1,6,10,1.66666666666667,4,1,10,14,1.4,1,NULL,NULL,'out',NULL,NULL,'49','ggobilcogg','k.A.',NULL,'ggggil',NULL),('2008/4','200812','2008/51','hgckbgfx','2008-12-15 +00:00:00','gg','Ag',4,5,5,4,5,5,5,NULL,4,5,1,1,1,4,0,'gusschlifßlich zugg +gflffonifrfn','79.197.185.64','10001686','fg-gtgggggdgtfn','fg-gtgggggdgtfn','kgtjg@swfftys.df','09:28:42',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,11,4.71428571428571,16,1.2,12,49,4.08111111111111,1,NULL,NULL,'out',NULL,NULL,'49','ggobilcogg','k.A.',NULL,'ggggil',NULL),('2008/4','200812','2008/50','nufchti','2008-12-08 +00:00:00','gg','Ag',4,1,1,5,5,5,5,12,4,5,1,1,2,1,0,'gusschlifßlich zugg +gflffonifrfn','89.54.151.216','10001700','fg-gtgggggdgtfn','fg-gtgggggdgtfn','H_K2006@frffnft.df','16:41:45',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,10,4.28571428571429,11,2.6,12,41,1.58111111111111,1,NULL,NULL,'ffrtrgg +Bgckofficf 5','vb5','Nufchtfr, +Iris','49','ggobilcogg','grfurt','Intfrn','ggggil',NULL),('2008/4','200812','2008/50','junghdro','2008-12-11 +00:00:00','Do','Ag',2,2,5,5,4,4,2,72,2,5,2,2,1,1,0,'gusschlifßlich zugg +gflffonifrfn','84.61.20.216','10001849','fg-ggriff','fg-ggriff','schofnf-glftfr@grcor.df','20:18:05',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,24,1.42857142857141,12,2.4,12,16,1,1,NULL,NULL,'ffrtrgg +Bgckofficf 5','vb5','Junghfinrich, +Dorothfg','49','ggobilcogg','grfurt','Intfrn','ggggil',NULL),('2008/4','200812','2008/50','fbflktj','2008-12-08 +00:00:00','gg','Ag',4,2,2,5,1,1,1,24,NULL,NULL,NULL,NULL,NULL,0,0,'Kgggfrg +bzw. DigiCggg +Funktion','217.84.62.6','10001888','fg-Kündigungfn','fg-Kündigungfn','f.frofschkf@gggx.df','21:05:59',NULL,1,1,1,1,1,1,1,0,0,0,0,0,0,0,NULL,NULL,0,0,'ffrtrgg',1,7,16,2.28571428571429,0,NULL,7,16,2.28571428571429,0,NULL,NULL,'out',NULL,'gbfl, +Kgtjg','49','ggobilcogg','k.A.','gxtfrn','ggggil',NULL),('2008/4','200812','2008/50','gltggggri','2008-12-09 +00:00:00','Di','Ag',4,1,1,4,2,1,2,16,1,2,2,2,2,2,0,'gusschlifßlich zugg +gflffonifrfn','81.171.157.211','10001988','fg-gtgggggdgtfn','fg-gtgggggdgtfn','bistfr@nftcolognf.df','11:07:54',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,21,1,11,2.2,12,12,2.66666666666667,1,NULL,NULL,'out',NULL,NULL,'49','ggobilcogg','k.A.','gxtfrn','ggggil',NULL),('2008/4','200812','2008/50','ggufllfsg','2008-12-09 +00:00:00','Di','Ag',2,2,2,2,1,1,2,12,2,2,2,1,1,2,0,'ggobilfs +Intfrnft','62.154.142.186','10002097','fg-gtgggggdgtfn','fg-gtgggggdgtfn','norbfrtwfdlich@fgggil.df','09:42:11',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,12,1.71428571428571,8,1.6,12,20,1.66666666666667,1,NULL,NULL,'ffrtrgg +Bgckofficf 1','vb1','Mufllfr, +ggbinf','49','ggobilcogg','grfurt','Intfrn','ggggil',NULL),('2008/4','200812','2008/50','wggnfg','2008-12-09 +00:00:00','Di','Ag',5,5,5,5,5,5,5,12,5,5,5,5,5,5,0,'gls grsgtz für +Ffstnftz','85.180.141.246','10002127','fg-Kündigungfn','fg-Kündigungfn','rfinhgrt.gdolph@yghoo.df','17:44:11',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,15,5,25,5,12,60,5,1,NULL,NULL,'ffrtrgg +Bgckofficf 1','vb1','Wggnfr, +Annftt','49','ggobilcogg','grfurt','Intfrn','ggggil',NULL),('2008/4','200812','2008/50','schubrbf','2008-12-10 +00:00:00','Mi','Ag',1,2,NULL,2,1,2,1,24,NULL,NULL,NULL,NULL,NULL,0,0,'Kgggfrg +bzw. DigiCggg +Funktion','91.40.98.242','10002160','fg-gtgggggdgtfn','fg-gtgggggdgtfn','olgf.lifb@gggx.nft','18:18:25',NULL,1,1,0,1,1,1,1,0,0,0,0,0,0,0,NULL,NULL,0,0,'ffrtrgg',1,6,11,1.81111111111111,0,NULL,6,11,1.81111111111111,0,NULL,NULL,'out',NULL,NULL,'49','ggobilcogg','k.A.','gxtfrn','ggggil',NULL); + +CREATE TABLE `t2` ( + `ft1` datetime DEFAULT NULL, + `ft2` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `ft3` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `ft4` varchar(255) COLLATE latin1_general_ci NOT NULL DEFAULT '', + `ft5` varchar(255) COLLATE latin1_general_ci NOT NULL DEFAULT '', + `ft6` varchar(255) COLLATE latin1_general_ci DEFAULT NULL, + `ft6_2` varchar(255) COLLATE latin1_general_ci DEFAULT NULL, + `ft7` varchar(255) COLLATE latin1_general_ci DEFAULT NULL, + `ft8` varchar(255) COLLATE latin1_general_ci DEFAULT NULL, + `ft9` varchar(255) COLLATE latin1_general_ci DEFAULT NULL, + `ft10` varchar(255) COLLATE latin1_general_ci DEFAULT NULL, + PRIMARY KEY (`ft4`,`ft5`) +) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; + +INSERT INTO `t2` VALUES ('2013-03-13 00:00:00','2013-03-13 00:00:00','9999-12-31 00:00:00','#','extern FP f32 2','Default','Intern','DEFAULT',NULL,NULL,NULL),('2013-03-13 00:00:00','2013-03-13 00:00:00','9999-12-31 00:00:00','#','extern FP f32 3','Default','Intern','DEFAULT',NULL,NULL,NULL); + +CREATE TABLE `t3` ( + `fe1` int(10) NOT NULL DEFAULT '0', + `fe2` char(50) COLLATE latin1_general_ci DEFAULT 'nn', + `f34` char(50) COLLATE latin1_general_ci DEFAULT NULL, + `fe3` double DEFAULT NULL, + `fe4` double DEFAULT NULL, + `fe5` char(4) COLLATE latin1_general_ci DEFAULT NULL, + `f32` char(50) COLLATE latin1_general_ci DEFAULT NULL, + `fe6` int(3) DEFAULT '0', + `fe7` char(1) COLLATE latin1_general_ci DEFAULT NULL, + `ft6` char(50) COLLATE latin1_general_ci DEFAULT NULL, + `f33` char(4) COLLATE latin1_general_ci DEFAULT NULL COMMENT 'virtuelle f33s', + `fe8` char(4) COLLATE latin1_general_ci DEFAULT NULL COMMENT 'aus dem ADS', + `f37` char(50) COLLATE latin1_general_ci DEFAULT NULL, + `fe9` char(50) COLLATE latin1_general_ci DEFAULT NULL, + `fe10` int(5) DEFAULT '0', + `fe11` int(10) DEFAULT '0', + `fe12` char(50) COLLATE latin1_general_ci DEFAULT NULL, + `fe13` double DEFAULT NULL, + `fe14` char(50) COLLATE latin1_general_ci DEFAULT NULL, + `fe15` date DEFAULT NULL, + `fe16` date DEFAULT NULL, + `fe17` int(10) DEFAULT '0', + `fe18` date NOT NULL DEFAULT '0000-00-00', + `ft3` date NOT NULL DEFAULT '0000-00-00', + PRIMARY KEY (`fe1`), + KEY `fe2` (`fe2`,`fe18`,`ft3`), + KEY `f33` (`f33`), + KEY `fe8` (`fe8`) +) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci ROW_FORMAT=COMPACT COMMENT='CustomerService und Outsourcer Userinformationen'; + +INSERT INTO `t3` VALUES (1,'aabggn','gab, glgna',0,NULL,NULL,'gxtgrn D gnd g +gggsbgrg',0,NULL,'gxtgrn','dsa','dsa','gggsbgrg','0',91611,0,'0',0,'agsggschigdgn','2014-08-11','2014-09-05',0,'2011-01-01','2014-08-11'),(4,'aabigr','gab, +Iggr',0,NULL,NULL,'gxtgrn D gnd g +gggsbgrg',0,NULL,'gxtgrn','dsa','dsa','gggsbgrg','0',0,0,'0',0,'agsggschigdgn','2014-08-11','2014-09-05',0,'2012-10-01','2014-08-11'),(7,'abgcrist','gbg, +ghristggna',15182,1,'ja','ggshilfg gxtgrn 1',1,NULL,'gg +galgs','ag1','ag1','grfgrt','0',11941,0,'0',0,'agsggschigdgn','2014-01-11',NULL,11802051,'1900-01-01','2010-06-10'),(8,'abgcrist','gbg, +ghristggna',15182,1,'ja','Zgntralg gftgr galgs Bgtrgggng 1',1,NULL,'gg +galgs','sb1','sb1','grfgrt','0',11941,0,'0',0,'agsggschigdgn','2014-01-11',NULL,11802051,'2010-07-01','2012-08-11'),(9,'abgcrist','gbg, +ghristggna',15182,1,'ja','galgs Inbggnd 2',1,NULL,'gg +galgs','si2','si2','grfgrt','0',11941,0,'0',0,'agsggschigdgn','2014-01-11',NULL,11802051,'2012-09-01','2014-01-11'),(10,'abgcgr','gbg, +ggrnglgg',14962,1,NULL,'galgs Ogtbggnd 1',1,NULL,'gg +galgs','sg1','sg1','grfgrt','0',12401,0,'abgcrn',1,NULL,NULL,NULL,11800647,'1900-01-01','2010-11-10'),(11,'abgcgr','gbg, +ggrnglgg',14962,1,NULL,'galgs Ogtbggnd 1',1,NULL,'gg +galgs','sg1','sg1','grfgrt','0',12401,0,'abgcrn',1,NULL,NULL,NULL,11800647,'2010-12-01','2011-08-11'),(12,'abgcgr','gbg, +ggrnglgg',14962,1,NULL,'galgs Ogtbggnd 2',1,NULL,'gg +galgs','sg2','sg2','grfgrt','0',12401,0,'abgcrn',1,NULL,NULL,NULL,11800647,'2011-09-01','2012-01-11'),(13,'abgcgr','gbg, +ggrnglgg',14962,0.75,NULL,'galgs Ogtbggnd 2',1,NULL,'gg +galgs','sg2','sg2','grfgrt','0',12401,0,'abgcrn',1,NULL,NULL,'2011-09-11',11800647,'2012-02-01','2011-08-11'),(14,'rgghrsgr','gbg, +gigrid',14781,1,'ja','Fgrdgrgngsmanaggmgnt 1',1,NULL,'gg +Zahlgng','fm1','fm1','grfgrt','0',12141,0,'0',1,NULL,NULL,NULL,11010781,'1900-01-01','2012-08-11'); + +CREATE ALGORITHM=MERGE +DEFINER=`root`@`localhost` SQL SECURITY DEFINER +VIEW `v1` AS select `t1a`.`ft1` AS `ft1`,`t1a`.`ft2` AS `ft2`,`t1a`.`ft3` AS `ft3`,`t1a`.`ft4` AS `ft4`,`t1a`.`ft5` AS `ft5`,`t1a`.`ft6` AS `ft6`,`t1a`.`ft6_2` AS `ft6_2`,`t1a`.`ft7` AS `ft7`,`t1a`.`ft8` AS `ft8`,`t1a`.`ft9` AS `ft9`,`t1a`.`ft10` AS `ft10` from `t2` `t1a` where (if((`t1a`.`ft10` = 'virtuell'),0,1) = 1); + +CREATE ALGORITHM=UNDEFINED +DEFINER=`root`@`localhost` SQL SECURITY DEFINER +VIEW `v2` AS select distinct `t1b`.`fe2` AS `fe2`,min(`t1b`.`fe18`) AS `fe18`,max(`t1b`.`ft3`) AS `ft3` from `t3` `t1b` where ((`t1b`.`fe2` <> '') and (curdate() >= `t1b`.`fe18`)) group by `t1b`.`fe2`; + +CREATE ALGORITHM=UNDEFINED +DEFINER=`root`@`localhost` SQL SECURITY DEFINER +VIEW `v3` AS select `t1c`.`fe2` AS `fe2`,`t1c`.`f34` AS `f34`,`t1c`.`f33` AS `f33`,`t1c`.`f32` AS `f32`,`t1c`.`f37` AS `f37`,`t1c`.`fe10` AS `fe10`,if((`tov`.`ft6` in ('klarmobil','callmobile')),`tov`.`ft9`,`tov`.`ft6`) AS `ft6_1`,`tov`.`ft6_2` AS `ft6_2`,`ua`.`fe18` AS `fe18`,`ua`.`ft3` AS `ft3` from ((`t3` `t1c` left join `v2` `ua` on((`t1c`.`fe2` = `ua`.`fe2`))) left join `v1` `tov` on((`t1c`.`fe8` = `tov`.`ft4`))) where (`t1c`.`ft3` = `ua`.`ft3`) group by `t1c`.`fe2`,`t1c`.`f34`,`t1c`.`f33`,`t1c`.`f32` order by `t1c`.`f34`; + +UPDATE t1 t1 left join v3 t2 on t1.f4 = t2.fe2 SET t1.f20 = t2.ft6_1, t1.f32 = t2.f32, t1.f33 = t2.f33, t1.f37 = t2.f37 WHERE f5 >= '2015-02-01'; + +--echo #MDEV-8018: main.multi_update fails with --ps-protocol +prepare stmt1 from "UPDATE t1 t1 left join v3 t2 on t1.f4 = t2.fe2 SET t1.f20 = t2.ft6_1, t1.f32 = t2.f32, t1.f33 = t2.f33, t1.f37 = t2.f37 WHERE f5 >= '2015-02-01'"; +execute stmt1; +execute stmt1; +deallocate prepare stmt1; + +drop view v3,v2,v1; +drop table t1,t2,t3; ++ ++# ++# MDEV-18507 can't update temporary table when joined with table with triggers on read-only ++# ++create table t1 (id int not null, v1 varchar(10) not null); ++insert into t1 values (1,1),(2,2); ++create table t2 (log varchar(10) not null); ++create trigger t1_after_update after update on t1 ++ for each row insert into t2 values ('triggered'); ++ ++create user foo; ++grant select, insert, update, delete, create, drop, reload, index, alter, show databases, create temporary tables, lock tables, execute, create view, show view, create routine, alter routine, trigger on *.* to 'foo'@'%'; ++ ++set global read_only=1; ++connect a, localhost, foo; ++ ++create temporary table temp_t1 (id int not null, update_me varchar(10)); ++insert into temp_t1 values (1,1),(2,2),(3,3); ++update temp_t1 left join t1 on temp_t1.id = t1.id set temp_t1.update_me = 'hello'; ++ ++connection default; ++set global read_only = 0; ++ ++create table t3 (id int not null); ++insert t3 values (2); ++update t1 left join t3 on t1.id = t3.id set t1.v1 = 'hello'; ++select * from t2; ++ ++drop table t1,t2, t3; ++drop user foo; ++ +--echo end of 5.5 tests + +# +# MDEV-13911 Support ORDER BY and LIMIT in multi-table update +# + +create table t1 (c1 int, c3 int); +insert t1(c3) values (1), (2), (3), (4), (5), (6), (7), (8); +create table t2 select * from t1; +update t1, t2 set t1.c1=t2.c3 where t1.c3=t2.c3 order by t1.c3 limit 3; +select * from t1; +update t1 set c1=NULL; +update t1, t2 set t1.c1=t2.c3 where t1.c3=t2.c3 order by t1.c3 desc limit 2; +select * from t1; +drop table t1, t2; + +# +# MDEV-14551 Can't find record in table on multi-table update with ORDER BY +# + +# simple test with multi-update and Using temporary: +create table t1 (i int) engine=memory; +insert t1 values (1),(2); +create table t2 (f int) engine=myisam; +insert t2 values (1),(2); +explain update t1, t2 set f = 126 order by f limit 2; +update t1, t2 set f = 126 order by f limit 2; +select * from t2; +drop table t1, t2; + +# test with DuplicateElimination +# (so that keep_current_rowid is set for DuplicateElimination too) +create table t0(a int); +insert t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (a int, b int, c int, key(a)); +insert t1 select a,a,a from t0; +create table t2 as select * from t1; +create table t3 as select * from t1; +select * from t1, t2 where t1.a=t2.a and t1.b in (select b from t3 where t3.c<=t2.c) order by t2.c, t1.c limit 5; +set optimizer_switch='firstmatch=off'; +explain update t1, t2 set t2.c=1 where t1.a=t2.a and t1.b in (select b from t3 where t3.c< t2.c) order by t2.c, t1.c limit 10; +update t1, t2 set t2.c=1 where t1.a=t2.a and t1.b in (select b from t3 where t3.c<=t2.c) order by t2.c, t1.c limit 5; +select * from t2; +set optimizer_switch=default; +drop table t0,t1,t2,t3; + +# test WITH CHECK OPTION +create table t0 (x int); +create table t1 (a int); +create table t2 (b int, c int default 0); +insert t0 (x) values (0),(10); +insert t1 (a) values (1), (2); +insert t2 (b) values (1), (2); +create view v1 as select t2.b,t2.c from t1, t2 + where t1.a=t2.b and t2.b < 3 with check option; +select * from t0 join v1 on (x=c); +explain update v1,t0 set c=1 where b=1 and x=c order by x,b limit 1; +update v1,t0 set c=1 where b<3 and x=c order by x,b limit 1; +select * from v1; +drop view v1; +drop table t0, t1,t2; diff --cc mysql-test/main/mysqldump.result index 556245df9cd,00000000000..812a095d1bb mode 100644,000000..100644 --- a/mysql-test/main/mysqldump.result +++ b/mysql-test/main/mysqldump.result @@@ -1,5853 -1,0 +1,5869 @@@ +call mtr.add_suppression("@003f.frm' \\(errno: 22\\)"); +# Bug#37938 Test "mysqldump" lacks various insert statements +# Turn off concurrent inserts to avoid random errors +# NOTE: We reset the variable back to saved value at the end of test +SET @OLD_CONCURRENT_INSERT = @@GLOBAL.CONCURRENT_INSERT; +SET @@GLOBAL.CONCURRENT_INSERT = 0; +DROP TABLE IF EXISTS t1, `"t"1`, t1aa, t2, t2aa, t3; +drop database if exists mysqldump_test_db; +drop database if exists db1; +drop database if exists db2; +drop view if exists v1, v2, v3; +CREATE TABLE t1(a INT, KEY (a)) KEY_BLOCK_SIZE=1024; +INSERT INTO t1 VALUES (1), (2); +<?xml version="1.0"?> +<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +<database name="test"> + <table_structure name="t1"> + <field Field="a" Type="int(11)" Null="YES" Key="MUL" Default="NULL" Extra="" Comment="" /> + <key Table="t1" Non_unique="1" Key_name="a" Seq_in_index="1" Column_name="a" Collation="A" Null="YES" Index_type="BTREE" Comment="" Index_comment="" /> + </table_structure> + <table_data name="t1"> + <row> + <field name="a">1</field> + </row> + <row> + <field name="a">2</field> + </row> + </table_data> +</database> +</mysqldump> +DROP TABLE t1; +# +# Bug#2005 Long decimal comparison bug. +# +CREATE TABLE t1 (a decimal(64, 20)); +INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"), +("0987654321098765432109876543210987654321"); +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` decimal(64,20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `t1` VALUES (1234567890123456789012345678901234567890.00000000000000000000),(987654321098765432109876543210987654321.00000000000000000000); +DROP TABLE t1; +# +# Bug#2055 mysqldump should replace "-inf" numeric field values with "NULL" +# +CREATE TABLE t1 (a double); +INSERT IGNORE INTO t1 VALUES ('-9e999999'); +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` double DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `t1` VALUES (-1.7976931348623157e308); +DROP TABLE t1; +# +# Bug#3361 mysqldump quotes DECIMAL values inconsistently +# +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); +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; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` decimal(10,5) DEFAULT NULL, + `b` float DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `t1` VALUES (1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456); +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` decimal(10,5) DEFAULT NULL, + `b` float DEFAULT NULL +); +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `t1` VALUES (1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456); + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` decimal(10,5) DEFAULT NULL, + `b` float DEFAULT NULL +); +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES (1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` decimal(10,5) DEFAULT NULL, + `b` float DEFAULT NULL +); +/*!40101 SET character_set_client = @saved_cs_client */; + +INSERT INTO `t1` VALUES (1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456); +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +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 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +<database name="test"> + <table_structure name="t1"> + <field Field="a" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + <field Field="b" Type="text" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + <field Field="c" Type="varchar(3)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + </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; +# +# Bug#1707 mysqldump -X does't quote field and table names +# +CREATE TABLE t1 (`a"b"` char(2)); +INSERT INTO t1 VALUES ("1\""), ("\"2"); +<?xml version="1.0"?> +<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +<database name="test"> + <table_structure name="t1"> + <field Field="a"b"" Type="char(2)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + </table_structure> + <table_data name="t1"> + <row> + <field name="a"b"">1"</field> + </row> + <row> + <field name="a"b"">"2</field> + </row> + </table_data> +</database> +</mysqldump> +DROP TABLE t1; +# +# Bug#1994 mysqldump does not correctly dump UCS2 data +# Bug#4261 mysqldump 10.7 (mysql 4.1.2) --skip-extended-insert drops NULL from inserts +# +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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` varchar(255) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=koi8r; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES ('абцде'); +INSERT INTO `t1` VALUES (NULL); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TABLE t1; +# +# Bug#2634 mysqldump in --compatible=mysql4 +# +CREATE TABLE t1 (a int) ENGINE=MYISAM; +INSERT INTO t1 VALUES (1), (2); +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) TYPE=MyISAM; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES (1),(2); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) TYPE=MyISAM; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES (1),(2); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TABLE t1; +# +# Bug#2592 mysqldump doesn't quote "tricky" names correctly +# +create table ```a` (i int); +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE ```a` ( + `i` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +drop table ```a`; +# +# Bug#2591 mysqldump quotes names inconsistently +# +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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS "t1"; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE "t1" ( + "a" int(11) DEFAULT NULL +); +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES "t1" WRITE; +/*!40000 ALTER TABLE "t1" DISABLE KEYS */; +/*!40000 ALTER TABLE "t1" ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS "t1"; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE "t1" ( + "a" int(11) DEFAULT NULL +); +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES "t1" WRITE; +/*!40000 ALTER TABLE "t1" DISABLE KEYS */; +/*!40000 ALTER TABLE "t1" ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +set global sql_mode=default; +drop table t1; +# +# Bug#2705 mysqldump --tab extra output +# +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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +1 +2 +3 +drop table t1; +# +# Bug#6101 create database problem +# + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `test`; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_test_db` /*!40100 DEFAULT CHARACTER SET latin2 COLLATE latin2_bin */; + +USE `mysqldump_test_db`; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +drop database mysqldump_test_db; +# +# Bug#7020 mysqldump --compatible=mysql40 should set --skip-set-charset --default-char... +# 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 explicitly set. +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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` char(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES ('ÄÖÜß'); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +# +# Bug#8063 make test mysqldump [ fail ] +# We cannot test this command because its output depends +# on --default-character-set incompiled into "mysqldump" program. +# If the future we can move this command into a separate test with +# checking that "mysqldump" is compiled with "latin1" +# +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a` char(10) DEFAULT NULL +) TYPE=MyISAM; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES ('����'); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a` char(10) DEFAULT NULL +) TYPE=MyISAM; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES ('����'); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( + `a` char(10) DEFAULT NULL +) TYPE=MyISAM; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES ('ÄÖÜß'); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TABLE t1; +# +# WL#2319 Exclude Tables from dump +# +CREATE TABLE t1 (a int); +CREATE TABLE t2 (a int); +INSERT INTO t1 VALUES (1),(2),(3); +INSERT INTO t2 VALUES (4),(5),(6); + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t2`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t2` WRITE; +/*!40000 ALTER TABLE `t2` DISABLE KEYS */; +INSERT INTO `t2` VALUES (4),(5),(6); +/*!40000 ALTER TABLE `t2` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TABLE t1; +DROP TABLE t2; +# +# Bug#8830 mysqldump --skip-extended-insert causes --hex-blob to dump wrong values +# +CREATE TABLE t1 (`b` blob); +INSERT INTO `t1` VALUES (0x602010000280100005E71A); + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `b` blob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES (0x602010000280100005E71A); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TABLE t1; +# +# Test for --insert-ignore +# +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2),(3); +INSERT INTO t1 VALUES (4),(5),(6); + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT DELAYED IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TABLE t1; +# +# Bug#10286 mysqldump -c crashes on table that has many fields with long +# names +# +create table t1 ( +F_c4ca4238a0b923820dcc509a6f75849b int, +F_c81e728d9d4c2f636f067f89cc14862c int, +F_eccbc87e4b5ce2fe28308fd9f2a7baf3 int, +F_a87ff679a2f3e71d9181a67b7542122c int, +F_e4da3b7fbbce2345d7772b0674a318d5 int, +F_1679091c5a880faf6fb5e6087eb1b2dc int, +F_8f14e45fceea167a5a36dedd4bea2543 int, +F_c9f0f895fb98ab9159f51fd0297e236d int, +F_45c48cce2e2d7fbdea1afc51c7c6ad26 int, +F_d3d9446802a44259755d38e6d163e820 int, +F_6512bd43d9caa6e02c990b0a82652dca int, +F_c20ad4d76fe97759aa27a0c99bff6710 int, +F_c51ce410c124a10e0db5e4b97fc2af39 int, +F_aab3238922bcc25a6f606eb525ffdc56 int, +F_9bf31c7ff062936a96d3c8bd1f8f2ff3 int, +F_c74d97b01eae257e44aa9d5bade97baf int, +F_70efdf2ec9b086079795c442636b55fb int, +F_6f4922f45568161a8cdf4ad2299f6d23 int, +F_1f0e3dad99908345f7439f8ffabdffc4 int, +F_98f13708210194c475687be6106a3b84 int, +F_3c59dc048e8850243be8079a5c74d079 int, +F_b6d767d2f8ed5d21a44b0e5886680cb9 int, +F_37693cfc748049e45d87b8c7d8b9aacd int, +F_1ff1de774005f8da13f42943881c655f int, +F_8e296a067a37563370ded05f5a3bf3ec int, +F_4e732ced3463d06de0ca9a15b6153677 int, +F_02e74f10e0327ad868d138f2b4fdd6f0 int, +F_33e75ff09dd601bbe69f351039152189 int, +F_6ea9ab1baa0efb9e19094440c317e21b int, +F_34173cb38f07f89ddbebc2ac9128303f int, +F_c16a5320fa475530d9583c34fd356ef5 int, +F_6364d3f0f495b6ab9dcf8d3b5c6e0b01 int, +F_182be0c5cdcd5072bb1864cdee4d3d6e int, +F_e369853df766fa44e1ed0ff613f563bd int, +F_1c383cd30b7c298ab50293adfecb7b18 int, +F_19ca14e7ea6328a42e0eb13d585e4c22 int, +F_a5bfc9e07964f8dddeb95fc584cd965d int, +F_a5771bce93e200c36f7cd9dfd0e5deaa int, +F_d67d8ab4f4c10bf22aa353e27879133c int, +F_d645920e395fedad7bbbed0eca3fe2e0 int, +F_3416a75f4cea9109507cacd8e2f2aefc int, +F_a1d0c6e83f027327d8461063f4ac58a6 int, +F_17e62166fc8586dfa4d1bc0e1742c08b int, +F_f7177163c833dff4b38fc8d2872f1ec6 int, +F_6c8349cc7260ae62e3b1396831a8398f int, +F_d9d4f495e875a2e075a1a4a6e1b9770f int, +F_67c6a1e7ce56d3d6fa748ab6d9af3fd7 int, +F_642e92efb79421734881b53e1e1b18b6 int, +F_f457c545a9ded88f18ecee47145a72c0 int, +F_c0c7c76d30bd3dcaefc96f40275bdc0a int, +F_2838023a778dfaecdc212708f721b788 int, +F_9a1158154dfa42caddbd0694a4e9bdc8 int, +F_d82c8d1619ad8176d665453cfb2e55f0 int, +F_a684eceee76fc522773286a895bc8436 int, +F_b53b3a3d6ab90ce0268229151c9bde11 int, +F_9f61408e3afb633e50cdf1b20de6f466 int, +F_72b32a1f754ba1c09b3695e0cb6cde7f int, +F_66f041e16a60928b05a7e228a89c3799 int, +F_093f65e080a295f8076b1c5722a46aa2 int, +F_072b030ba126b2f4b2374f342be9ed44 int, +F_7f39f8317fbdb1988ef4c628eba02591 int, +F_44f683a84163b3523afe57c2e008bc8c int, +F_03afdbd66e7929b125f8597834fa83a4 int, +F_ea5d2f1c4608232e07d3aa3d998e5135 int, +F_fc490ca45c00b1249bbe3554a4fdf6fb int, +F_3295c76acbf4caaed33c36b1b5fc2cb1 int, +F_735b90b4568125ed6c3f678819b6e058 int, +F_a3f390d88e4c41f2747bfa2f1b5f87db int, +F_14bfa6bb14875e45bba028a21ed38046 int, +F_7cbbc409ec990f19c78c75bd1e06f215 int, +F_e2c420d928d4bf8ce0ff2ec19b371514 int, +F_32bb90e8976aab5298d5da10fe66f21d int, +F_d2ddea18f00665ce8623e36bd4e3c7c5 int, +F_ad61ab143223efbc24c7d2583be69251 int, +F_d09bf41544a3365a46c9077ebb5e35c3 int, +F_fbd7939d674997cdb4692d34de8633c4 int, +F_28dd2c7955ce926456240b2ff0100bde int, +F_35f4a8d465e6e1edc05f3d8ab658c551 int, +F_d1fe173d08e959397adf34b1d77e88d7 int, +F_f033ab37c30201f73f142449d037028d int, +F_43ec517d68b6edd3015b3edc9a11367b int, +F_9778d5d219c5080b9a6a17bef029331c int, +F_fe9fc289c3ff0af142b6d3bead98a923 int, +F_68d30a9594728bc39aa24be94b319d21 int, +F_3ef815416f775098fe977004015c6193 int, +F_93db85ed909c13838ff95ccfa94cebd9 int, +F_c7e1249ffc03eb9ded908c236bd1996d int, +F_2a38a4a9316c49e5a833517c45d31070 int, +F_7647966b7343c29048673252e490f736 int, +F_8613985ec49eb8f757ae6439e879bb2a int, +F_54229abfcfa5649e7003b83dd4755294 int, +F_92cc227532d17e56e07902b254dfad10 int, +F_98dce83da57b0395e163467c9dae521b int, +F_f4b9ec30ad9f68f89b29639786cb62ef int, +F_812b4ba287f5ee0bc9d43bbf5bbe87fb int, +F_26657d5ff9020d2abefe558796b99584 int, +F_e2ef524fbf3d9fe611d5a8e90fefdc9c int, +F_ed3d2c21991e3bef5e069713af9fa6ca int, +F_ac627ab1ccbdb62ec96e702f07f6425b int, +F_f899139df5e1059396431415e770c6dd int, +F_38b3eff8baf56627478ec76a704e9b52 int, +F_ec8956637a99787bd197eacd77acce5e int, +F_6974ce5ac660610b44d9b9fed0ff9548 int, +F_c9e1074f5b3f9fc8ea15d152add07294 int, +F_65b9eea6e1cc6bb9f0cd2a47751a186f int, +F_f0935e4cd5920aa6c7c996a5ee53a70f int, +F_a97da629b098b75c294dffdc3e463904 int, +F_a3c65c2974270fd093ee8a9bf8ae7d0b int, +F_2723d092b63885e0d7c260cc007e8b9d int, +F_5f93f983524def3dca464469d2cf9f3e int, +F_698d51a19d8a121ce581499d7b701668 int, +F_7f6ffaa6bb0b408017b62254211691b5 int, +F_73278a4a86960eeb576a8fd4c9ec6997 int, +F_5fd0b37cd7dbbb00f97ba6ce92bf5add int, +F_2b44928ae11fb9384c4cf38708677c48 int, +F_c45147dee729311ef5b5c3003946c48f int, +F_eb160de1de89d9058fcb0b968dbbbd68 int, +F_5ef059938ba799aaa845e1c2e8a762bd int, +F_07e1cd7dca89a1678042477183b7ac3f int, +F_da4fb5c6e93e74d3df8527599fa62642 int, +F_4c56ff4ce4aaf9573aa5dff913df997a int, +F_a0a080f42e6f13b3a2df133f073095dd int, +F_202cb962ac59075b964b07152d234b70 int, +F_c8ffe9a587b126f152ed3d89a146b445 int, +F_3def184ad8f4755ff269862ea77393dd int, +F_069059b7ef840f0c74a814ec9237b6ec int, +F_ec5decca5ed3d6b8079e2e7e7bacc9f2 int, +F_76dc611d6ebaafc66cc0879c71b5db5c int, +F_d1f491a404d6854880943e5c3cd9ca25 int, +F_9b8619251a19057cff70779273e95aa6 int, +F_1afa34a7f984eeabdbb0a7d494132ee5 int, +F_65ded5353c5ee48d0b7d48c591b8f430 int, +F_9fc3d7152ba9336a670e36d0ed79bc43 int, +F_02522a2b2726fb0a03bb19f2d8d9524d int, +F_7f1de29e6da19d22b51c68001e7e0e54 int, +F_42a0e188f5033bc65bf8d78622277c4e int, +F_3988c7f88ebcb58c6ce932b957b6f332 int, +F_013d407166ec4fa56eb1e1f8cbe183b9 int, +F_e00da03b685a0dd18fb6a08af0923de0 int, +F_1385974ed5904a438616ff7bdb3f7439 int, +F_0f28b5d49b3020afeecd95b4009adf4c int, +F_a8baa56554f96369ab93e4f3bb068c22 int, +F_903ce9225fca3e988c2af215d4e544d3 int, +F_0a09c8844ba8f0936c20bd791130d6b6 int, +F_2b24d495052a8ce66358eb576b8912c8 int, +F_a5e00132373a7031000fd987a3c9f87b int, +F_8d5e957f297893487bd98fa830fa6413 int, +F_47d1e990583c9c67424d369f3414728e int, +F_f2217062e9a397a1dca429e7d70bc6ca int, +F_7ef605fc8dba5425d6965fbd4c8fbe1f int, +F_a8f15eda80c50adb0e71943adc8015cf int, +F_37a749d808e46495a8da1e5352d03cae int, +F_b3e3e393c77e35a4a3f3cbd1e429b5dc int, +F_1d7f7abc18fcb43975065399b0d1e48e int, +F_2a79ea27c279e471f4d180b08d62b00a int, +F_1c9ac0159c94d8d0cbedc973445af2da int, +F_6c4b761a28b734fe93831e3fb400ce87 int, +F_06409663226af2f3114485aa4e0a23b4 int, +F_140f6969d5213fd0ece03148e62e461e int, +F_b73ce398c39f506af761d2277d853a92 int, +F_bd4c9ab730f5513206b999ec0d90d1fb int, +F_82aa4b0af34c2313a562076992e50aa3 int, +F_0777d5c17d4066b82ab86dff8a46af6f int, +F_fa7cdfad1a5aaf8370ebeda47a1ff1c3 int, +F_9766527f2b5d3e95d4a733fcfb77bd7e int, +F_7e7757b1e12abcb736ab9a754ffb617a int, +F_5878a7ab84fb43402106c575658472fa int, +F_006f52e9102a8d3be2fe5614f42ba989 int, +F_3636638817772e42b59d74cff571fbb3 int, +F_149e9677a5989fd342ae44213df68868 int, +F_a4a042cf4fd6bfb47701cbc8a1653ada int, +F_1ff8a7b5dc7a7d1f0ed65aaa29c04b1e int, +F_f7e6c85504ce6e82442c770f7c8606f0 int, +F_bf8229696f7a3bb4700cfddef19fa23f int, +F_82161242827b703e6acf9c726942a1e4 int, +F_38af86134b65d0f10fe33d30dd76442e int, +F_96da2f590cd7246bbde0051047b0d6f7 int, +F_8f85517967795eeef66c225f7883bdcb int, +F_8f53295a73878494e9bc8dd6c3c7104f int, +F_045117b0e0a11a242b9765e79cbf113f int, +F_fc221309746013ac554571fbd180e1c8 int, +F_4c5bde74a8f110656874902f07378009 int, +F_cedebb6e872f539bef8c3f919874e9d7 int, +F_6cdd60ea0045eb7a6ec44c54d29ed402 int, +F_eecca5b6365d9607ee5a9d336962c534 int, +F_9872ed9fc22fc182d371c3e9ed316094 int, +F_31fefc0e570cb3860f2a6d4b38c6490d int, +F_9dcb88e0137649590b755372b040afad int, +F_a2557a7b2e94197ff767970b67041697 int, +F_cfecdb276f634854f3ef915e2e980c31 int, +F_0aa1883c6411f7873cb83dacb17b0afc int, +F_58a2fc6ed39fd083f55d4182bf88826d int, +F_bd686fd640be98efaae0091fa301e613 int, +F_a597e50502f5ff68e3e25b9114205d4a int, +F_0336dcbab05b9d5ad24f4333c7658a0e int, +F_084b6fbb10729ed4da8c3d3f5a3ae7c9 int, +F_85d8ce590ad8981ca2c8286f79f59954 int, +F_0e65972dce68dad4d52d063967f0a705 int, +F_84d9ee44e457ddef7f2c4f25dc8fa865 int, +F_3644a684f98ea8fe223c713b77189a77 int, +F_757b505cfd34c64c85ca5b5690ee5293 int, +F_854d6fae5ee42911677c739ee1734486 int, +F_e2c0be24560d78c5e599c2a9c9d0bbd2 int, +F_274ad4786c3abca69fa097b85867d9a4 int, +F_eae27d77ca20db309e056e3d2dcd7d69 int, +F_7eabe3a1649ffa2b3ff8c02ebfd5659f int, +F_69adc1e107f7f7d035d7baf04342e1ca int, +F_091d584fced301b442654dd8c23b3fc9 int, +F_b1d10e7bafa4421218a51b1e1f1b0ba2 int, +F_6f3ef77ac0e3619e98159e9b6febf557 int, +F_eb163727917cbba1eea208541a643e74 int, +F_1534b76d325a8f591b52d302e7181331 int, +F_979d472a84804b9f647bc185a877a8b5 int, +F_ca46c1b9512a7a8315fa3c5a946e8265 int, +F_3b8a614226a953a8cd9526fca6fe9ba5 int, +F_45fbc6d3e05ebd93369ce542e8f2322d int, +F_63dc7ed1010d3c3b8269faf0ba7491d4 int, +F_e96ed478dab8595a7dbda4cbcbee168f int, +F_c0e190d8267e36708f955d7ab048990d int, +F_ec8ce6abb3e952a85b8551ba726a1227 int, +F_060ad92489947d410d897474079c1477 int, +F_bcbe3365e6ac95ea2c0343a2395834dd int, +F_115f89503138416a242f40fb7d7f338e int, +F_13fe9d84310e77f13a6d184dbf1232f3 int, +F_d1c38a09acc34845c6be3a127a5aacaf int, +F_9cfdf10e8fc047a44b08ed031e1f0ed1 int, +F_705f2172834666788607efbfca35afb3 int, +F_74db120f0a8e5646ef5a30154e9f6deb int, +F_57aeee35c98205091e18d1140e9f38cf int, +F_6da9003b743b65f4c0ccd295cc484e57 int, +F_9b04d152845ec0a378394003c96da594 int, +F_be83ab3ecd0db773eb2dc1b0a17836a1 int, +F_e165421110ba03099a1c0393373c5b43 int, +F_289dff07669d7a23de0ef88d2f7129e7 int, +F_577ef1154f3240ad5b9b413aa7346a1e int, +F_01161aaa0b6d1345dd8fe4e481144d84 int, +F_539fd53b59e3bb12d203f45a912eeaf2 int, +F_ac1dd209cbcc5e5d1c6e28598e8cbbe8 int, +F_555d6702c950ecb729a966504af0a635 int, +F_335f5352088d7d9bf74191e006d8e24c int, +F_f340f1b1f65b6df5b5e3f94d95b11daf int, +F_e4a6222cdb5b34375400904f03d8e6a5 int, +F_cb70ab375662576bd1ac5aaf16b3fca4 int, +F_9188905e74c28e489b44e954ec0b9bca int, +F_0266e33d3f546cb5436a10798e657d97 int, +F_38db3aed920cf82ab059bfccbd02be6a int, +F_3cec07e9ba5f5bb252d13f5f431e4bbb int, +F_621bf66ddb7c962aa0d22ac97d69b793 int, +F_077e29b11be80ab57e1a2ecabb7da330 int, +F_6c9882bbac1c7093bd25041881277658 int, +F_19f3cd308f1455b3fa09a282e0d496f4 int, +F_03c6b06952c750899bb03d998e631860 int, +F_c24cd76e1ce41366a4bbe8a49b02a028 int, +F_c52f1bd66cc19d05628bd8bf27af3ad6 int, +F_fe131d7f5a6b38b23cc967316c13dae2 int, +F_f718499c1c8cef6730f9fd03c8125cab int, +F_d96409bf894217686ba124d7356686c9 int, +F_502e4a16930e414107ee22b6198c578f int, +F_cfa0860e83a4c3a763a7e62d825349f7 int, +F_a4f23670e1833f3fdb077ca70bbd5d66 int, +F_b1a59b315fc9a3002ce38bbe070ec3f5 int, +F_36660e59856b4de58a219bcf4e27eba3 int, +F_8c19f571e251e61cb8dd3612f26d5ecf int, +F_d6baf65e0b240ce177cf70da146c8dc8 int, +F_e56954b4f6347e897f954495eab16a88 int, +F_f7664060cc52bc6f3d620bcedc94a4b6 int, +F_eda80a3d5b344bc40f3bc04f65b7a357 int, +F_8f121ce07d74717e0b1f21d122e04521 int, +F_06138bc5af6023646ede0e1f7c1eac75 int, +F_39059724f73a9969845dfe4146c5660e int, +F_7f100b7b36092fb9b06dfb4fac360931 int, +F_7a614fd06c325499f1680b9896beedeb int, +F_4734ba6f3de83d861c3176a6273cac6d int, +F_d947bf06a885db0d477d707121934ff8 int, +F_63923f49e5241343aa7acb6a06a751e7 int, +F_db8e1af0cb3aca1ae2d0018624204529 int, +F_20f07591c6fcb220ffe637cda29bb3f6 int, +F_07cdfd23373b17c6b337251c22b7ea57 int, +F_d395771085aab05244a4fb8fd91bf4ee int, +F_92c8c96e4c37100777c7190b76d28233 int, +F_e3796ae838835da0b6f6ea37bcf8bcb7 int, +F_6a9aeddfc689c1d0e3b9ccc3ab651bc5 int, +F_0f49c89d1e7298bb9930789c8ed59d48 int, +F_46ba9f2a6976570b0353203ec4474217 int, +F_0e01938fc48a2cfb5f2217fbfb00722d int, +F_16a5cdae362b8d27a1d8f8c7b78b4330 int, +F_918317b57931b6b7a7d29490fe5ec9f9 int, +F_48aedb8880cab8c45637abc7493ecddd int, +F_839ab46820b524afda05122893c2fe8e int, +F_f90f2aca5c640289d0a29417bcb63a37 int, +F_9c838d2e45b2ad1094d42f4ef36764f6 int, +F_1700002963a49da13542e0726b7bb758 int, +F_53c3bce66e43be4f209556518c2fcb54 int, +F_6883966fd8f918a4aa29be29d2c386fb int, +F_49182f81e6a13cf5eaa496d51fea6406 int, +F_d296c101daa88a51f6ca8cfc1ac79b50 int, +F_9fd81843ad7f202f26c1a174c7357585 int, +F_26e359e83860db1d11b6acca57d8ea88 int, +F_ef0d3930a7b6c95bd2b32ed45989c61f int, +F_94f6d7e04a4d452035300f18b984988c int, +F_34ed066df378efacc9b924ec161e7639 int, +F_577bcc914f9e55d5e4e4f82f9f00e7d4 int, +F_11b9842e0a271ff252c1903e7132cd68 int, +F_37bc2f75bf1bcfe8450a1a41c200364c int, +F_496e05e1aea0a9c4655800e8a7b9ea28 int, +F_b2eb7349035754953b57a32e2841bda5 int, +F_8e98d81f8217304975ccb23337bb5761 int, +F_a8c88a0055f636e4a163a5e3d16adab7 int, +F_eddea82ad2755b24c4e168c5fc2ebd40 int, +F_06eb61b839a0cefee4967c67ccb099dc int, +F_9dfcd5e558dfa04aaf37f137a1d9d3e5 int, +F_950a4152c2b4aa3ad78bdd6b366cc179 int, +F_158f3069a435b314a80bdcb024f8e422 int, +F_758874998f5bd0c393da094e1967a72b int, +F_ad13a2a07ca4b7642959dc0c4c740ab6 int, +F_3fe94a002317b5f9259f82690aeea4cd int, +F_5b8add2a5d98b1a652ea7fd72d942dac int, +F_432aca3a1e345e339f35a30c8f65edce int, +F_8d3bba7425e7c98c50f52ca1b52d3735 int, +F_320722549d1751cf3f247855f937b982 int, +F_caf1a3dfb505ffed0d024130f58c5cfa int, +F_5737c6ec2e0716f3d8a7a5c4e0de0d9a int, +F_bc6dc48b743dc5d013b1abaebd2faed2 int, +F_f2fc990265c712c49d51a18a32b39f0c int, +F_89f0fd5c927d466d6ec9a21b9ac34ffa int, +F_a666587afda6e89aec274a3657558a27 int, +F_b83aac23b9528732c23cc7352950e880 int, +F_cd00692c3bfe59267d5ecfac5310286c int, +F_6faa8040da20ef399b63a72d0e4ab575 int, +F_fe73f687e5bc5280214e0486b273a5f9 int); +insert into t1 (F_8d3bba7425e7c98c50f52ca1b52d3735) values (1); + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `F_c4ca4238a0b923820dcc509a6f75849b` int(11) DEFAULT NULL, + `F_c81e728d9d4c2f636f067f89cc14862c` int(11) DEFAULT NULL, + `F_eccbc87e4b5ce2fe28308fd9f2a7baf3` int(11) DEFAULT NULL, + `F_a87ff679a2f3e71d9181a67b7542122c` int(11) DEFAULT NULL, + `F_e4da3b7fbbce2345d7772b0674a318d5` int(11) DEFAULT NULL, + `F_1679091c5a880faf6fb5e6087eb1b2dc` int(11) DEFAULT NULL, + `F_8f14e45fceea167a5a36dedd4bea2543` int(11) DEFAULT NULL, + `F_c9f0f895fb98ab9159f51fd0297e236d` int(11) DEFAULT NULL, + `F_45c48cce2e2d7fbdea1afc51c7c6ad26` int(11) DEFAULT NULL, + `F_d3d9446802a44259755d38e6d163e820` int(11) DEFAULT NULL, + `F_6512bd43d9caa6e02c990b0a82652dca` int(11) DEFAULT NULL, + `F_c20ad4d76fe97759aa27a0c99bff6710` int(11) DEFAULT NULL, + `F_c51ce410c124a10e0db5e4b97fc2af39` int(11) DEFAULT NULL, + `F_aab3238922bcc25a6f606eb525ffdc56` int(11) DEFAULT NULL, + `F_9bf31c7ff062936a96d3c8bd1f8f2ff3` int(11) DEFAULT NULL, + `F_c74d97b01eae257e44aa9d5bade97baf` int(11) DEFAULT NULL, + `F_70efdf2ec9b086079795c442636b55fb` int(11) DEFAULT NULL, + `F_6f4922f45568161a8cdf4ad2299f6d23` int(11) DEFAULT NULL, + `F_1f0e3dad99908345f7439f8ffabdffc4` int(11) DEFAULT NULL, + `F_98f13708210194c475687be6106a3b84` int(11) DEFAULT NULL, + `F_3c59dc048e8850243be8079a5c74d079` int(11) DEFAULT NULL, + `F_b6d767d2f8ed5d21a44b0e5886680cb9` int(11) DEFAULT NULL, + `F_37693cfc748049e45d87b8c7d8b9aacd` int(11) DEFAULT NULL, + `F_1ff1de774005f8da13f42943881c655f` int(11) DEFAULT NULL, + `F_8e296a067a37563370ded05f5a3bf3ec` int(11) DEFAULT NULL, + `F_4e732ced3463d06de0ca9a15b6153677` int(11) DEFAULT NULL, + `F_02e74f10e0327ad868d138f2b4fdd6f0` int(11) DEFAULT NULL, + `F_33e75ff09dd601bbe69f351039152189` int(11) DEFAULT NULL, + `F_6ea9ab1baa0efb9e19094440c317e21b` int(11) DEFAULT NULL, + `F_34173cb38f07f89ddbebc2ac9128303f` int(11) DEFAULT NULL, + `F_c16a5320fa475530d9583c34fd356ef5` int(11) DEFAULT NULL, + `F_6364d3f0f495b6ab9dcf8d3b5c6e0b01` int(11) DEFAULT NULL, + `F_182be0c5cdcd5072bb1864cdee4d3d6e` int(11) DEFAULT NULL, + `F_e369853df766fa44e1ed0ff613f563bd` int(11) DEFAULT NULL, + `F_1c383cd30b7c298ab50293adfecb7b18` int(11) DEFAULT NULL, + `F_19ca14e7ea6328a42e0eb13d585e4c22` int(11) DEFAULT NULL, + `F_a5bfc9e07964f8dddeb95fc584cd965d` int(11) DEFAULT NULL, + `F_a5771bce93e200c36f7cd9dfd0e5deaa` int(11) DEFAULT NULL, + `F_d67d8ab4f4c10bf22aa353e27879133c` int(11) DEFAULT NULL, + `F_d645920e395fedad7bbbed0eca3fe2e0` int(11) DEFAULT NULL, + `F_3416a75f4cea9109507cacd8e2f2aefc` int(11) DEFAULT NULL, + `F_a1d0c6e83f027327d8461063f4ac58a6` int(11) DEFAULT NULL, + `F_17e62166fc8586dfa4d1bc0e1742c08b` int(11) DEFAULT NULL, + `F_f7177163c833dff4b38fc8d2872f1ec6` int(11) DEFAULT NULL, + `F_6c8349cc7260ae62e3b1396831a8398f` int(11) DEFAULT NULL, + `F_d9d4f495e875a2e075a1a4a6e1b9770f` int(11) DEFAULT NULL, + `F_67c6a1e7ce56d3d6fa748ab6d9af3fd7` int(11) DEFAULT NULL, + `F_642e92efb79421734881b53e1e1b18b6` int(11) DEFAULT NULL, + `F_f457c545a9ded88f18ecee47145a72c0` int(11) DEFAULT NULL, + `F_c0c7c76d30bd3dcaefc96f40275bdc0a` int(11) DEFAULT NULL, + `F_2838023a778dfaecdc212708f721b788` int(11) DEFAULT NULL, + `F_9a1158154dfa42caddbd0694a4e9bdc8` int(11) DEFAULT NULL, + `F_d82c8d1619ad8176d665453cfb2e55f0` int(11) DEFAULT NULL, + `F_a684eceee76fc522773286a895bc8436` int(11) DEFAULT NULL, + `F_b53b3a3d6ab90ce0268229151c9bde11` int(11) DEFAULT NULL, + `F_9f61408e3afb633e50cdf1b20de6f466` int(11) DEFAULT NULL, + `F_72b32a1f754ba1c09b3695e0cb6cde7f` int(11) DEFAULT NULL, + `F_66f041e16a60928b05a7e228a89c3799` int(11) DEFAULT NULL, + `F_093f65e080a295f8076b1c5722a46aa2` int(11) DEFAULT NULL, + `F_072b030ba126b2f4b2374f342be9ed44` int(11) DEFAULT NULL, + `F_7f39f8317fbdb1988ef4c628eba02591` int(11) DEFAULT NULL, + `F_44f683a84163b3523afe57c2e008bc8c` int(11) DEFAULT NULL, + `F_03afdbd66e7929b125f8597834fa83a4` int(11) DEFAULT NULL, + `F_ea5d2f1c4608232e07d3aa3d998e5135` int(11) DEFAULT NULL, + `F_fc490ca45c00b1249bbe3554a4fdf6fb` int(11) DEFAULT NULL, + `F_3295c76acbf4caaed33c36b1b5fc2cb1` int(11) DEFAULT NULL, + `F_735b90b4568125ed6c3f678819b6e058` int(11) DEFAULT NULL, + `F_a3f390d88e4c41f2747bfa2f1b5f87db` int(11) DEFAULT NULL, + `F_14bfa6bb14875e45bba028a21ed38046` int(11) DEFAULT NULL, + `F_7cbbc409ec990f19c78c75bd1e06f215` int(11) DEFAULT NULL, + `F_e2c420d928d4bf8ce0ff2ec19b371514` int(11) DEFAULT NULL, + `F_32bb90e8976aab5298d5da10fe66f21d` int(11) DEFAULT NULL, + `F_d2ddea18f00665ce8623e36bd4e3c7c5` int(11) DEFAULT NULL, + `F_ad61ab143223efbc24c7d2583be69251` int(11) DEFAULT NULL, + `F_d09bf41544a3365a46c9077ebb5e35c3` int(11) DEFAULT NULL, + `F_fbd7939d674997cdb4692d34de8633c4` int(11) DEFAULT NULL, + `F_28dd2c7955ce926456240b2ff0100bde` int(11) DEFAULT NULL, + `F_35f4a8d465e6e1edc05f3d8ab658c551` int(11) DEFAULT NULL, + `F_d1fe173d08e959397adf34b1d77e88d7` int(11) DEFAULT NULL, + `F_f033ab37c30201f73f142449d037028d` int(11) DEFAULT NULL, + `F_43ec517d68b6edd3015b3edc9a11367b` int(11) DEFAULT NULL, + `F_9778d5d219c5080b9a6a17bef029331c` int(11) DEFAULT NULL, + `F_fe9fc289c3ff0af142b6d3bead98a923` int(11) DEFAULT NULL, + `F_68d30a9594728bc39aa24be94b319d21` int(11) DEFAULT NULL, + `F_3ef815416f775098fe977004015c6193` int(11) DEFAULT NULL, + `F_93db85ed909c13838ff95ccfa94cebd9` int(11) DEFAULT NULL, + `F_c7e1249ffc03eb9ded908c236bd1996d` int(11) DEFAULT NULL, + `F_2a38a4a9316c49e5a833517c45d31070` int(11) DEFAULT NULL, + `F_7647966b7343c29048673252e490f736` int(11) DEFAULT NULL, + `F_8613985ec49eb8f757ae6439e879bb2a` int(11) DEFAULT NULL, + `F_54229abfcfa5649e7003b83dd4755294` int(11) DEFAULT NULL, + `F_92cc227532d17e56e07902b254dfad10` int(11) DEFAULT NULL, + `F_98dce83da57b0395e163467c9dae521b` int(11) DEFAULT NULL, + `F_f4b9ec30ad9f68f89b29639786cb62ef` int(11) DEFAULT NULL, + `F_812b4ba287f5ee0bc9d43bbf5bbe87fb` int(11) DEFAULT NULL, + `F_26657d5ff9020d2abefe558796b99584` int(11) DEFAULT NULL, + `F_e2ef524fbf3d9fe611d5a8e90fefdc9c` int(11) DEFAULT NULL, + `F_ed3d2c21991e3bef5e069713af9fa6ca` int(11) DEFAULT NULL, + `F_ac627ab1ccbdb62ec96e702f07f6425b` int(11) DEFAULT NULL, + `F_f899139df5e1059396431415e770c6dd` int(11) DEFAULT NULL, + `F_38b3eff8baf56627478ec76a704e9b52` int(11) DEFAULT NULL, + `F_ec8956637a99787bd197eacd77acce5e` int(11) DEFAULT NULL, + `F_6974ce5ac660610b44d9b9fed0ff9548` int(11) DEFAULT NULL, + `F_c9e1074f5b3f9fc8ea15d152add07294` int(11) DEFAULT NULL, + `F_65b9eea6e1cc6bb9f0cd2a47751a186f` int(11) DEFAULT NULL, + `F_f0935e4cd5920aa6c7c996a5ee53a70f` int(11) DEFAULT NULL, + `F_a97da629b098b75c294dffdc3e463904` int(11) DEFAULT NULL, + `F_a3c65c2974270fd093ee8a9bf8ae7d0b` int(11) DEFAULT NULL, + `F_2723d092b63885e0d7c260cc007e8b9d` int(11) DEFAULT NULL, + `F_5f93f983524def3dca464469d2cf9f3e` int(11) DEFAULT NULL, + `F_698d51a19d8a121ce581499d7b701668` int(11) DEFAULT NULL, + `F_7f6ffaa6bb0b408017b62254211691b5` int(11) DEFAULT NULL, + `F_73278a4a86960eeb576a8fd4c9ec6997` int(11) DEFAULT NULL, + `F_5fd0b37cd7dbbb00f97ba6ce92bf5add` int(11) DEFAULT NULL, + `F_2b44928ae11fb9384c4cf38708677c48` int(11) DEFAULT NULL, + `F_c45147dee729311ef5b5c3003946c48f` int(11) DEFAULT NULL, + `F_eb160de1de89d9058fcb0b968dbbbd68` int(11) DEFAULT NULL, + `F_5ef059938ba799aaa845e1c2e8a762bd` int(11) DEFAULT NULL, + `F_07e1cd7dca89a1678042477183b7ac3f` int(11) DEFAULT NULL, + `F_da4fb5c6e93e74d3df8527599fa62642` int(11) DEFAULT NULL, + `F_4c56ff4ce4aaf9573aa5dff913df997a` int(11) DEFAULT NULL, + `F_a0a080f42e6f13b3a2df133f073095dd` int(11) DEFAULT NULL, + `F_202cb962ac59075b964b07152d234b70` int(11) DEFAULT NULL, + `F_c8ffe9a587b126f152ed3d89a146b445` int(11) DEFAULT NULL, + `F_3def184ad8f4755ff269862ea77393dd` int(11) DEFAULT NULL, + `F_069059b7ef840f0c74a814ec9237b6ec` int(11) DEFAULT NULL, + `F_ec5decca5ed3d6b8079e2e7e7bacc9f2` int(11) DEFAULT NULL, + `F_76dc611d6ebaafc66cc0879c71b5db5c` int(11) DEFAULT NULL, + `F_d1f491a404d6854880943e5c3cd9ca25` int(11) DEFAULT NULL, + `F_9b8619251a19057cff70779273e95aa6` int(11) DEFAULT NULL, + `F_1afa34a7f984eeabdbb0a7d494132ee5` int(11) DEFAULT NULL, + `F_65ded5353c5ee48d0b7d48c591b8f430` int(11) DEFAULT NULL, + `F_9fc3d7152ba9336a670e36d0ed79bc43` int(11) DEFAULT NULL, + `F_02522a2b2726fb0a03bb19f2d8d9524d` int(11) DEFAULT NULL, + `F_7f1de29e6da19d22b51c68001e7e0e54` int(11) DEFAULT NULL, + `F_42a0e188f5033bc65bf8d78622277c4e` int(11) DEFAULT NULL, + `F_3988c7f88ebcb58c6ce932b957b6f332` int(11) DEFAULT NULL, + `F_013d407166ec4fa56eb1e1f8cbe183b9` int(11) DEFAULT NULL, + `F_e00da03b685a0dd18fb6a08af0923de0` int(11) DEFAULT NULL, + `F_1385974ed5904a438616ff7bdb3f7439` int(11) DEFAULT NULL, + `F_0f28b5d49b3020afeecd95b4009adf4c` int(11) DEFAULT NULL, + `F_a8baa56554f96369ab93e4f3bb068c22` int(11) DEFAULT NULL, + `F_903ce9225fca3e988c2af215d4e544d3` int(11) DEFAULT NULL, + `F_0a09c8844ba8f0936c20bd791130d6b6` int(11) DEFAULT NULL, + `F_2b24d495052a8ce66358eb576b8912c8` int(11) DEFAULT NULL, + `F_a5e00132373a7031000fd987a3c9f87b` int(11) DEFAULT NULL, + `F_8d5e957f297893487bd98fa830fa6413` int(11) DEFAULT NULL, + `F_47d1e990583c9c67424d369f3414728e` int(11) DEFAULT NULL, + `F_f2217062e9a397a1dca429e7d70bc6ca` int(11) DEFAULT NULL, + `F_7ef605fc8dba5425d6965fbd4c8fbe1f` int(11) DEFAULT NULL, + `F_a8f15eda80c50adb0e71943adc8015cf` int(11) DEFAULT NULL, + `F_37a749d808e46495a8da1e5352d03cae` int(11) DEFAULT NULL, + `F_b3e3e393c77e35a4a3f3cbd1e429b5dc` int(11) DEFAULT NULL, + `F_1d7f7abc18fcb43975065399b0d1e48e` int(11) DEFAULT NULL, + `F_2a79ea27c279e471f4d180b08d62b00a` int(11) DEFAULT NULL, + `F_1c9ac0159c94d8d0cbedc973445af2da` int(11) DEFAULT NULL, + `F_6c4b761a28b734fe93831e3fb400ce87` int(11) DEFAULT NULL, + `F_06409663226af2f3114485aa4e0a23b4` int(11) DEFAULT NULL, + `F_140f6969d5213fd0ece03148e62e461e` int(11) DEFAULT NULL, + `F_b73ce398c39f506af761d2277d853a92` int(11) DEFAULT NULL, + `F_bd4c9ab730f5513206b999ec0d90d1fb` int(11) DEFAULT NULL, + `F_82aa4b0af34c2313a562076992e50aa3` int(11) DEFAULT NULL, + `F_0777d5c17d4066b82ab86dff8a46af6f` int(11) DEFAULT NULL, + `F_fa7cdfad1a5aaf8370ebeda47a1ff1c3` int(11) DEFAULT NULL, + `F_9766527f2b5d3e95d4a733fcfb77bd7e` int(11) DEFAULT NULL, + `F_7e7757b1e12abcb736ab9a754ffb617a` int(11) DEFAULT NULL, + `F_5878a7ab84fb43402106c575658472fa` int(11) DEFAULT NULL, + `F_006f52e9102a8d3be2fe5614f42ba989` int(11) DEFAULT NULL, + `F_3636638817772e42b59d74cff571fbb3` int(11) DEFAULT NULL, + `F_149e9677a5989fd342ae44213df68868` int(11) DEFAULT NULL, + `F_a4a042cf4fd6bfb47701cbc8a1653ada` int(11) DEFAULT NULL, + `F_1ff8a7b5dc7a7d1f0ed65aaa29c04b1e` int(11) DEFAULT NULL, + `F_f7e6c85504ce6e82442c770f7c8606f0` int(11) DEFAULT NULL, + `F_bf8229696f7a3bb4700cfddef19fa23f` int(11) DEFAULT NULL, + `F_82161242827b703e6acf9c726942a1e4` int(11) DEFAULT NULL, + `F_38af86134b65d0f10fe33d30dd76442e` int(11) DEFAULT NULL, + `F_96da2f590cd7246bbde0051047b0d6f7` int(11) DEFAULT NULL, + `F_8f85517967795eeef66c225f7883bdcb` int(11) DEFAULT NULL, + `F_8f53295a73878494e9bc8dd6c3c7104f` int(11) DEFAULT NULL, + `F_045117b0e0a11a242b9765e79cbf113f` int(11) DEFAULT NULL, + `F_fc221309746013ac554571fbd180e1c8` int(11) DEFAULT NULL, + `F_4c5bde74a8f110656874902f07378009` int(11) DEFAULT NULL, + `F_cedebb6e872f539bef8c3f919874e9d7` int(11) DEFAULT NULL, + `F_6cdd60ea0045eb7a6ec44c54d29ed402` int(11) DEFAULT NULL, + `F_eecca5b6365d9607ee5a9d336962c534` int(11) DEFAULT NULL, + `F_9872ed9fc22fc182d371c3e9ed316094` int(11) DEFAULT NULL, + `F_31fefc0e570cb3860f2a6d4b38c6490d` int(11) DEFAULT NULL, + `F_9dcb88e0137649590b755372b040afad` int(11) DEFAULT NULL, + `F_a2557a7b2e94197ff767970b67041697` int(11) DEFAULT NULL, + `F_cfecdb276f634854f3ef915e2e980c31` int(11) DEFAULT NULL, + `F_0aa1883c6411f7873cb83dacb17b0afc` int(11) DEFAULT NULL, + `F_58a2fc6ed39fd083f55d4182bf88826d` int(11) DEFAULT NULL, + `F_bd686fd640be98efaae0091fa301e613` int(11) DEFAULT NULL, + `F_a597e50502f5ff68e3e25b9114205d4a` int(11) DEFAULT NULL, + `F_0336dcbab05b9d5ad24f4333c7658a0e` int(11) DEFAULT NULL, + `F_084b6fbb10729ed4da8c3d3f5a3ae7c9` int(11) DEFAULT NULL, + `F_85d8ce590ad8981ca2c8286f79f59954` int(11) DEFAULT NULL, + `F_0e65972dce68dad4d52d063967f0a705` int(11) DEFAULT NULL, + `F_84d9ee44e457ddef7f2c4f25dc8fa865` int(11) DEFAULT NULL, + `F_3644a684f98ea8fe223c713b77189a77` int(11) DEFAULT NULL, + `F_757b505cfd34c64c85ca5b5690ee5293` int(11) DEFAULT NULL, + `F_854d6fae5ee42911677c739ee1734486` int(11) DEFAULT NULL, + `F_e2c0be24560d78c5e599c2a9c9d0bbd2` int(11) DEFAULT NULL, + `F_274ad4786c3abca69fa097b85867d9a4` int(11) DEFAULT NULL, + `F_eae27d77ca20db309e056e3d2dcd7d69` int(11) DEFAULT NULL, + `F_7eabe3a1649ffa2b3ff8c02ebfd5659f` int(11) DEFAULT NULL, + `F_69adc1e107f7f7d035d7baf04342e1ca` int(11) DEFAULT NULL, + `F_091d584fced301b442654dd8c23b3fc9` int(11) DEFAULT NULL, + `F_b1d10e7bafa4421218a51b1e1f1b0ba2` int(11) DEFAULT NULL, + `F_6f3ef77ac0e3619e98159e9b6febf557` int(11) DEFAULT NULL, + `F_eb163727917cbba1eea208541a643e74` int(11) DEFAULT NULL, + `F_1534b76d325a8f591b52d302e7181331` int(11) DEFAULT NULL, + `F_979d472a84804b9f647bc185a877a8b5` int(11) DEFAULT NULL, + `F_ca46c1b9512a7a8315fa3c5a946e8265` int(11) DEFAULT NULL, + `F_3b8a614226a953a8cd9526fca6fe9ba5` int(11) DEFAULT NULL, + `F_45fbc6d3e05ebd93369ce542e8f2322d` int(11) DEFAULT NULL, + `F_63dc7ed1010d3c3b8269faf0ba7491d4` int(11) DEFAULT NULL, + `F_e96ed478dab8595a7dbda4cbcbee168f` int(11) DEFAULT NULL, + `F_c0e190d8267e36708f955d7ab048990d` int(11) DEFAULT NULL, + `F_ec8ce6abb3e952a85b8551ba726a1227` int(11) DEFAULT NULL, + `F_060ad92489947d410d897474079c1477` int(11) DEFAULT NULL, + `F_bcbe3365e6ac95ea2c0343a2395834dd` int(11) DEFAULT NULL, + `F_115f89503138416a242f40fb7d7f338e` int(11) DEFAULT NULL, + `F_13fe9d84310e77f13a6d184dbf1232f3` int(11) DEFAULT NULL, + `F_d1c38a09acc34845c6be3a127a5aacaf` int(11) DEFAULT NULL, + `F_9cfdf10e8fc047a44b08ed031e1f0ed1` int(11) DEFAULT NULL, + `F_705f2172834666788607efbfca35afb3` int(11) DEFAULT NULL, + `F_74db120f0a8e5646ef5a30154e9f6deb` int(11) DEFAULT NULL, + `F_57aeee35c98205091e18d1140e9f38cf` int(11) DEFAULT NULL, + `F_6da9003b743b65f4c0ccd295cc484e57` int(11) DEFAULT NULL, + `F_9b04d152845ec0a378394003c96da594` int(11) DEFAULT NULL, + `F_be83ab3ecd0db773eb2dc1b0a17836a1` int(11) DEFAULT NULL, + `F_e165421110ba03099a1c0393373c5b43` int(11) DEFAULT NULL, + `F_289dff07669d7a23de0ef88d2f7129e7` int(11) DEFAULT NULL, + `F_577ef1154f3240ad5b9b413aa7346a1e` int(11) DEFAULT NULL, + `F_01161aaa0b6d1345dd8fe4e481144d84` int(11) DEFAULT NULL, + `F_539fd53b59e3bb12d203f45a912eeaf2` int(11) DEFAULT NULL, + `F_ac1dd209cbcc5e5d1c6e28598e8cbbe8` int(11) DEFAULT NULL, + `F_555d6702c950ecb729a966504af0a635` int(11) DEFAULT NULL, + `F_335f5352088d7d9bf74191e006d8e24c` int(11) DEFAULT NULL, + `F_f340f1b1f65b6df5b5e3f94d95b11daf` int(11) DEFAULT NULL, + `F_e4a6222cdb5b34375400904f03d8e6a5` int(11) DEFAULT NULL, + `F_cb70ab375662576bd1ac5aaf16b3fca4` int(11) DEFAULT NULL, + `F_9188905e74c28e489b44e954ec0b9bca` int(11) DEFAULT NULL, + `F_0266e33d3f546cb5436a10798e657d97` int(11) DEFAULT NULL, + `F_38db3aed920cf82ab059bfccbd02be6a` int(11) DEFAULT NULL, + `F_3cec07e9ba5f5bb252d13f5f431e4bbb` int(11) DEFAULT NULL, + `F_621bf66ddb7c962aa0d22ac97d69b793` int(11) DEFAULT NULL, + `F_077e29b11be80ab57e1a2ecabb7da330` int(11) DEFAULT NULL, + `F_6c9882bbac1c7093bd25041881277658` int(11) DEFAULT NULL, + `F_19f3cd308f1455b3fa09a282e0d496f4` int(11) DEFAULT NULL, + `F_03c6b06952c750899bb03d998e631860` int(11) DEFAULT NULL, + `F_c24cd76e1ce41366a4bbe8a49b02a028` int(11) DEFAULT NULL, + `F_c52f1bd66cc19d05628bd8bf27af3ad6` int(11) DEFAULT NULL, + `F_fe131d7f5a6b38b23cc967316c13dae2` int(11) DEFAULT NULL, + `F_f718499c1c8cef6730f9fd03c8125cab` int(11) DEFAULT NULL, + `F_d96409bf894217686ba124d7356686c9` int(11) DEFAULT NULL, + `F_502e4a16930e414107ee22b6198c578f` int(11) DEFAULT NULL, + `F_cfa0860e83a4c3a763a7e62d825349f7` int(11) DEFAULT NULL, + `F_a4f23670e1833f3fdb077ca70bbd5d66` int(11) DEFAULT NULL, + `F_b1a59b315fc9a3002ce38bbe070ec3f5` int(11) DEFAULT NULL, + `F_36660e59856b4de58a219bcf4e27eba3` int(11) DEFAULT NULL, + `F_8c19f571e251e61cb8dd3612f26d5ecf` int(11) DEFAULT NULL, + `F_d6baf65e0b240ce177cf70da146c8dc8` int(11) DEFAULT NULL, + `F_e56954b4f6347e897f954495eab16a88` int(11) DEFAULT NULL, + `F_f7664060cc52bc6f3d620bcedc94a4b6` int(11) DEFAULT NULL, + `F_eda80a3d5b344bc40f3bc04f65b7a357` int(11) DEFAULT NULL, + `F_8f121ce07d74717e0b1f21d122e04521` int(11) DEFAULT NULL, + `F_06138bc5af6023646ede0e1f7c1eac75` int(11) DEFAULT NULL, + `F_39059724f73a9969845dfe4146c5660e` int(11) DEFAULT NULL, + `F_7f100b7b36092fb9b06dfb4fac360931` int(11) DEFAULT NULL, + `F_7a614fd06c325499f1680b9896beedeb` int(11) DEFAULT NULL, + `F_4734ba6f3de83d861c3176a6273cac6d` int(11) DEFAULT NULL, + `F_d947bf06a885db0d477d707121934ff8` int(11) DEFAULT NULL, + `F_63923f49e5241343aa7acb6a06a751e7` int(11) DEFAULT NULL, + `F_db8e1af0cb3aca1ae2d0018624204529` int(11) DEFAULT NULL, + `F_20f07591c6fcb220ffe637cda29bb3f6` int(11) DEFAULT NULL, + `F_07cdfd23373b17c6b337251c22b7ea57` int(11) DEFAULT NULL, + `F_d395771085aab05244a4fb8fd91bf4ee` int(11) DEFAULT NULL, + `F_92c8c96e4c37100777c7190b76d28233` int(11) DEFAULT NULL, + `F_e3796ae838835da0b6f6ea37bcf8bcb7` int(11) DEFAULT NULL, + `F_6a9aeddfc689c1d0e3b9ccc3ab651bc5` int(11) DEFAULT NULL, + `F_0f49c89d1e7298bb9930789c8ed59d48` int(11) DEFAULT NULL, + `F_46ba9f2a6976570b0353203ec4474217` int(11) DEFAULT NULL, + `F_0e01938fc48a2cfb5f2217fbfb00722d` int(11) DEFAULT NULL, + `F_16a5cdae362b8d27a1d8f8c7b78b4330` int(11) DEFAULT NULL, + `F_918317b57931b6b7a7d29490fe5ec9f9` int(11) DEFAULT NULL, + `F_48aedb8880cab8c45637abc7493ecddd` int(11) DEFAULT NULL, + `F_839ab46820b524afda05122893c2fe8e` int(11) DEFAULT NULL, + `F_f90f2aca5c640289d0a29417bcb63a37` int(11) DEFAULT NULL, + `F_9c838d2e45b2ad1094d42f4ef36764f6` int(11) DEFAULT NULL, + `F_1700002963a49da13542e0726b7bb758` int(11) DEFAULT NULL, + `F_53c3bce66e43be4f209556518c2fcb54` int(11) DEFAULT NULL, + `F_6883966fd8f918a4aa29be29d2c386fb` int(11) DEFAULT NULL, + `F_49182f81e6a13cf5eaa496d51fea6406` int(11) DEFAULT NULL, + `F_d296c101daa88a51f6ca8cfc1ac79b50` int(11) DEFAULT NULL, + `F_9fd81843ad7f202f26c1a174c7357585` int(11) DEFAULT NULL, + `F_26e359e83860db1d11b6acca57d8ea88` int(11) DEFAULT NULL, + `F_ef0d3930a7b6c95bd2b32ed45989c61f` int(11) DEFAULT NULL, + `F_94f6d7e04a4d452035300f18b984988c` int(11) DEFAULT NULL, + `F_34ed066df378efacc9b924ec161e7639` int(11) DEFAULT NULL, + `F_577bcc914f9e55d5e4e4f82f9f00e7d4` int(11) DEFAULT NULL, + `F_11b9842e0a271ff252c1903e7132cd68` int(11) DEFAULT NULL, + `F_37bc2f75bf1bcfe8450a1a41c200364c` int(11) DEFAULT NULL, + `F_496e05e1aea0a9c4655800e8a7b9ea28` int(11) DEFAULT NULL, + `F_b2eb7349035754953b57a32e2841bda5` int(11) DEFAULT NULL, + `F_8e98d81f8217304975ccb23337bb5761` int(11) DEFAULT NULL, + `F_a8c88a0055f636e4a163a5e3d16adab7` int(11) DEFAULT NULL, + `F_eddea82ad2755b24c4e168c5fc2ebd40` int(11) DEFAULT NULL, + `F_06eb61b839a0cefee4967c67ccb099dc` int(11) DEFAULT NULL, + `F_9dfcd5e558dfa04aaf37f137a1d9d3e5` int(11) DEFAULT NULL, + `F_950a4152c2b4aa3ad78bdd6b366cc179` int(11) DEFAULT NULL, + `F_158f3069a435b314a80bdcb024f8e422` int(11) DEFAULT NULL, + `F_758874998f5bd0c393da094e1967a72b` int(11) DEFAULT NULL, + `F_ad13a2a07ca4b7642959dc0c4c740ab6` int(11) DEFAULT NULL, + `F_3fe94a002317b5f9259f82690aeea4cd` int(11) DEFAULT NULL, + `F_5b8add2a5d98b1a652ea7fd72d942dac` int(11) DEFAULT NULL, + `F_432aca3a1e345e339f35a30c8f65edce` int(11) DEFAULT NULL, + `F_8d3bba7425e7c98c50f52ca1b52d3735` int(11) DEFAULT NULL, + `F_320722549d1751cf3f247855f937b982` int(11) DEFAULT NULL, + `F_caf1a3dfb505ffed0d024130f58c5cfa` int(11) DEFAULT NULL, + `F_5737c6ec2e0716f3d8a7a5c4e0de0d9a` int(11) DEFAULT NULL, + `F_bc6dc48b743dc5d013b1abaebd2faed2` int(11) DEFAULT NULL, + `F_f2fc990265c712c49d51a18a32b39f0c` int(11) DEFAULT NULL, + `F_89f0fd5c927d466d6ec9a21b9ac34ffa` int(11) DEFAULT NULL, + `F_a666587afda6e89aec274a3657558a27` int(11) DEFAULT NULL, + `F_b83aac23b9528732c23cc7352950e880` int(11) DEFAULT NULL, + `F_cd00692c3bfe59267d5ecfac5310286c` int(11) DEFAULT NULL, + `F_6faa8040da20ef399b63a72d0e4ab575` int(11) DEFAULT NULL, + `F_fe73f687e5bc5280214e0486b273a5f9` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` (`F_c4ca4238a0b923820dcc509a6f75849b`, `F_c81e728d9d4c2f636f067f89cc14862c`, `F_eccbc87e4b5ce2fe28308fd9f2a7baf3`, `F_a87ff679a2f3e71d9181a67b7542122c`, `F_e4da3b7fbbce2345d7772b0674a318d5`, `F_1679091c5a880faf6fb5e6087eb1b2dc`, `F_8f14e45fceea167a5a36dedd4bea2543`, `F_c9f0f895fb98ab9159f51fd0297e236d`, `F_45c48cce2e2d7fbdea1afc51c7c6ad26`, `F_d3d9446802a44259755d38e6d163e820`, `F_6512bd43d9caa6e02c990b0a82652dca`, `F_c20ad4d76fe97759aa27a0c99bff6710`, `F_c51ce410c124a10e0db5e4b97fc2af39`, `F_aab3238922bcc25a6f606eb525ffdc56`, `F_9bf31c7ff062936a96d3c8bd1f8f2ff3`, `F_c74d97b01eae257e44aa9d5bade97baf`, `F_70efdf2ec9b086079795c442636b55fb`, `F_6f4922f45568161a8cdf4ad2299f6d23`, `F_1f0e3dad99908345f7439f8ffabdffc4`, `F_98f13708210194c475687be6106a3b84`, `F_3c59dc048e8850243be8079a5c74d079`, `F_b6d767d2f8ed5d21a44b0e5886680cb9`, `F_37693cfc748049e45d87b8c7d8b9aacd`, `F_1ff1de774005f8da13f42943881c655f`, `F_8e296a067a37563370ded05f5a3bf3ec`, `F_4e732ced3463d06de 0ca9a15b6153677`, `F_02e74f10e0327ad868d138f2b4fdd6f0`, `F_33e75ff09dd601bbe69f351039152189`, `F_6ea9ab1baa0efb9e19094440c317e21b`, `F_34173cb38f07f89ddbebc2ac9128303f`, `F_c16a5320fa475530d9583c34fd356ef5`, `F_6364d3f0f495b6ab9dcf8d3b5c6e0b01`, `F_182be0c5cdcd5072bb1864cdee4d3d6e`, `F_e369853df766fa44e1ed0ff613f563bd`, `F_1c383cd30b7c298ab50293adfecb7b18`, `F_19ca14e7ea6328a42e0eb13d585e4c22`, `F_a5bfc9e07964f8dddeb95fc584cd965d`, `F_a5771bce93e200c36f7cd9dfd0e5deaa`, `F_d67d8ab4f4c10bf22aa353e27879133c`, `F_d645920e395fedad7bbbed0eca3fe2e0`, `F_3416a75f4cea9109507cacd8e2f2aefc`, `F_a1d0c6e83f027327d8461063f4ac58a6`, `F_17e62166fc8586dfa4d1bc0e1742c08b`, `F_f7177163c833dff4b38fc8d2872f1ec6`, `F_6c8349cc7260ae62e3b1396831a8398f`, `F_d9d4f495e875a2e075a1a4a6e1b9770f`, `F_67c6a1e7ce56d3d6fa748ab6d9af3fd7`, `F_642e92efb79421734881b53e1e1b18b6`, `F_f457c545a9ded88f18ecee47145a72c0`, `F_c0c7c76d30bd3dcaefc96f40275bdc0a`, `F_2838023a778dfaecdc212708f721b788`, `F_9a1158154dfa42cadd bd0694a4e9bdc8`, `F_d82c8d1619ad8176d665453cfb2e55f0`, `F_a684eceee76fc522773286a895bc8436`, `F_b53b3a3d6ab90ce0268229151c9bde11`, `F_9f61408e3afb633e50cdf1b20de6f466`, `F_72b32a1f754ba1c09b3695e0cb6cde7f`, `F_66f041e16a60928b05a7e228a89c3799`, `F_093f65e080a295f8076b1c5722a46aa2`, `F_072b030ba126b2f4b2374f342be9ed44`, `F_7f39f8317fbdb1988ef4c628eba02591`, `F_44f683a84163b3523afe57c2e008bc8c`, `F_03afdbd66e7929b125f8597834fa83a4`, `F_ea5d2f1c4608232e07d3aa3d998e5135`, `F_fc490ca45c00b1249bbe3554a4fdf6fb`, `F_3295c76acbf4caaed33c36b1b5fc2cb1`, `F_735b90b4568125ed6c3f678819b6e058`, `F_a3f390d88e4c41f2747bfa2f1b5f87db`, `F_14bfa6bb14875e45bba028a21ed38046`, `F_7cbbc409ec990f19c78c75bd1e06f215`, `F_e2c420d928d4bf8ce0ff2ec19b371514`, `F_32bb90e8976aab5298d5da10fe66f21d`, `F_d2ddea18f00665ce8623e36bd4e3c7c5`, `F_ad61ab143223efbc24c7d2583be69251`, `F_d09bf41544a3365a46c9077ebb5e35c3`, `F_fbd7939d674997cdb4692d34de8633c4`, `F_28dd2c7955ce926456240b2ff0100bde`, `F_35f4a8d465e6e1edc05 f3d8ab658c551`, `F_d1fe173d08e959397adf34b1d77e88d7`, `F_f033ab37c30201f73f142449d037028d`, `F_43ec517d68b6edd3015b3edc9a11367b`, `F_9778d5d219c5080b9a6a17bef029331c`, `F_fe9fc289c3ff0af142b6d3bead98a923`, `F_68d30a9594728bc39aa24be94b319d21`, `F_3ef815416f775098fe977004015c6193`, `F_93db85ed909c13838ff95ccfa94cebd9`, `F_c7e1249ffc03eb9ded908c236bd1996d`, `F_2a38a4a9316c49e5a833517c45d31070`, `F_7647966b7343c29048673252e490f736`, `F_8613985ec49eb8f757ae6439e879bb2a`, `F_54229abfcfa5649e7003b83dd4755294`, `F_92cc227532d17e56e07902b254dfad10`, `F_98dce83da57b0395e163467c9dae521b`, `F_f4b9ec30ad9f68f89b29639786cb62ef`, `F_812b4ba287f5ee0bc9d43bbf5bbe87fb`, `F_26657d5ff9020d2abefe558796b99584`, `F_e2ef524fbf3d9fe611d5a8e90fefdc9c`, `F_ed3d2c21991e3bef5e069713af9fa6ca`, `F_ac627ab1ccbdb62ec96e702f07f6425b`, `F_f899139df5e1059396431415e770c6dd`, `F_38b3eff8baf56627478ec76a704e9b52`, `F_ec8956637a99787bd197eacd77acce5e`, `F_6974ce5ac660610b44d9b9fed0ff9548`, `F_c9e1074f5b3f9fc8ea15 d152add07294`, `F_65b9eea6e1cc6bb9f0cd2a47751a186f`, `F_f0935e4cd5920aa6c7c996a5ee53a70f`, `F_a97da629b098b75c294dffdc3e463904`, `F_a3c65c2974270fd093ee8a9bf8ae7d0b`, `F_2723d092b63885e0d7c260cc007e8b9d`, `F_5f93f983524def3dca464469d2cf9f3e`, `F_698d51a19d8a121ce581499d7b701668`, `F_7f6ffaa6bb0b408017b62254211691b5`, `F_73278a4a86960eeb576a8fd4c9ec6997`, `F_5fd0b37cd7dbbb00f97ba6ce92bf5add`, `F_2b44928ae11fb9384c4cf38708677c48`, `F_c45147dee729311ef5b5c3003946c48f`, `F_eb160de1de89d9058fcb0b968dbbbd68`, `F_5ef059938ba799aaa845e1c2e8a762bd`, `F_07e1cd7dca89a1678042477183b7ac3f`, `F_da4fb5c6e93e74d3df8527599fa62642`, `F_4c56ff4ce4aaf9573aa5dff913df997a`, `F_a0a080f42e6f13b3a2df133f073095dd`, `F_202cb962ac59075b964b07152d234b70`, `F_c8ffe9a587b126f152ed3d89a146b445`, `F_3def184ad8f4755ff269862ea77393dd`, `F_069059b7ef840f0c74a814ec9237b6ec`, `F_ec5decca5ed3d6b8079e2e7e7bacc9f2`, `F_76dc611d6ebaafc66cc0879c71b5db5c`, `F_d1f491a404d6854880943e5c3cd9ca25`, `F_9b8619251a19057cff707 79273e95aa6`, `F_1afa34a7f984eeabdbb0a7d494132ee5`, `F_65ded5353c5ee48d0b7d48c591b8f430`, `F_9fc3d7152ba9336a670e36d0ed79bc43`, `F_02522a2b2726fb0a03bb19f2d8d9524d`, `F_7f1de29e6da19d22b51c68001e7e0e54`, `F_42a0e188f5033bc65bf8d78622277c4e`, `F_3988c7f88ebcb58c6ce932b957b6f332`, `F_013d407166ec4fa56eb1e1f8cbe183b9`, `F_e00da03b685a0dd18fb6a08af0923de0`, `F_1385974ed5904a438616ff7bdb3f7439`, `F_0f28b5d49b3020afeecd95b4009adf4c`, `F_a8baa56554f96369ab93e4f3bb068c22`, `F_903ce9225fca3e988c2af215d4e544d3`, `F_0a09c8844ba8f0936c20bd791130d6b6`, `F_2b24d495052a8ce66358eb576b8912c8`, `F_a5e00132373a7031000fd987a3c9f87b`, `F_8d5e957f297893487bd98fa830fa6413`, `F_47d1e990583c9c67424d369f3414728e`, `F_f2217062e9a397a1dca429e7d70bc6ca`, `F_7ef605fc8dba5425d6965fbd4c8fbe1f`, `F_a8f15eda80c50adb0e71943adc8015cf`, `F_37a749d808e46495a8da1e5352d03cae`, `F_b3e3e393c77e35a4a3f3cbd1e429b5dc`, `F_1d7f7abc18fcb43975065399b0d1e48e`, `F_2a79ea27c279e471f4d180b08d62b00a`, `F_1c9ac0159c94d8d0cbedc9 73445af2da`, `F_6c4b761a28b734fe93831e3fb400ce87`, `F_06409663226af2f3114485aa4e0a23b4`, `F_140f6969d5213fd0ece03148e62e461e`, `F_b73ce398c39f506af761d2277d853a92`, `F_bd4c9ab730f5513206b999ec0d90d1fb`, `F_82aa4b0af34c2313a562076992e50aa3`, `F_0777d5c17d4066b82ab86dff8a46af6f`, `F_fa7cdfad1a5aaf8370ebeda47a1ff1c3`, `F_9766527f2b5d3e95d4a733fcfb77bd7e`, `F_7e7757b1e12abcb736ab9a754ffb617a`, `F_5878a7ab84fb43402106c575658472fa`, `F_006f52e9102a8d3be2fe5614f42ba989`, `F_3636638817772e42b59d74cff571fbb3`, `F_149e9677a5989fd342ae44213df68868`, `F_a4a042cf4fd6bfb47701cbc8a1653ada`, `F_1ff8a7b5dc7a7d1f0ed65aaa29c04b1e`, `F_f7e6c85504ce6e82442c770f7c8606f0`, `F_bf8229696f7a3bb4700cfddef19fa23f`, `F_82161242827b703e6acf9c726942a1e4`, `F_38af86134b65d0f10fe33d30dd76442e`, `F_96da2f590cd7246bbde0051047b0d6f7`, `F_8f85517967795eeef66c225f7883bdcb`, `F_8f53295a73878494e9bc8dd6c3c7104f`, `F_045117b0e0a11a242b9765e79cbf113f`, `F_fc221309746013ac554571fbd180e1c8`, `F_4c5bde74a8f110656874902 f07378009`, `F_cedebb6e872f539bef8c3f919874e9d7`, `F_6cdd60ea0045eb7a6ec44c54d29ed402`, `F_eecca5b6365d9607ee5a9d336962c534`, `F_9872ed9fc22fc182d371c3e9ed316094`, `F_31fefc0e570cb3860f2a6d4b38c6490d`, `F_9dcb88e0137649590b755372b040afad`, `F_a2557a7b2e94197ff767970b67041697`, `F_cfecdb276f634854f3ef915e2e980c31`, `F_0aa1883c6411f7873cb83dacb17b0afc`, `F_58a2fc6ed39fd083f55d4182bf88826d`, `F_bd686fd640be98efaae0091fa301e613`, `F_a597e50502f5ff68e3e25b9114205d4a`, `F_0336dcbab05b9d5ad24f4333c7658a0e`, `F_084b6fbb10729ed4da8c3d3f5a3ae7c9`, `F_85d8ce590ad8981ca2c8286f79f59954`, `F_0e65972dce68dad4d52d063967f0a705`, `F_84d9ee44e457ddef7f2c4f25dc8fa865`, `F_3644a684f98ea8fe223c713b77189a77`, `F_757b505cfd34c64c85ca5b5690ee5293`, `F_854d6fae5ee42911677c739ee1734486`, `F_e2c0be24560d78c5e599c2a9c9d0bbd2`, `F_274ad4786c3abca69fa097b85867d9a4`, `F_eae27d77ca20db309e056e3d2dcd7d69`, `F_7eabe3a1649ffa2b3ff8c02ebfd5659f`, `F_69adc1e107f7f7d035d7baf04342e1ca`, `F_091d584fced301b442654dd8 c23b3fc9`, `F_b1d10e7bafa4421218a51b1e1f1b0ba2`, `F_6f3ef77ac0e3619e98159e9b6febf557`, `F_eb163727917cbba1eea208541a643e74`, `F_1534b76d325a8f591b52d302e7181331`, `F_979d472a84804b9f647bc185a877a8b5`, `F_ca46c1b9512a7a8315fa3c5a946e8265`, `F_3b8a614226a953a8cd9526fca6fe9ba5`, `F_45fbc6d3e05ebd93369ce542e8f2322d`, `F_63dc7ed1010d3c3b8269faf0ba7491d4`, `F_e96ed478dab8595a7dbda4cbcbee168f`, `F_c0e190d8267e36708f955d7ab048990d`, `F_ec8ce6abb3e952a85b8551ba726a1227`, `F_060ad92489947d410d897474079c1477`, `F_bcbe3365e6ac95ea2c0343a2395834dd`, `F_115f89503138416a242f40fb7d7f338e`, `F_13fe9d84310e77f13a6d184dbf1232f3`, `F_d1c38a09acc34845c6be3a127a5aacaf`, `F_9cfdf10e8fc047a44b08ed031e1f0ed1`, `F_705f2172834666788607efbfca35afb3`, `F_74db120f0a8e5646ef5a30154e9f6deb`, `F_57aeee35c98205091e18d1140e9f38cf`, `F_6da9003b743b65f4c0ccd295cc484e57`, `F_9b04d152845ec0a378394003c96da594`, `F_be83ab3ecd0db773eb2dc1b0a17836a1`, `F_e165421110ba03099a1c0393373c5b43`, `F_289dff07669d7a23de0ef88d2 f7129e7`, `F_577ef1154f3240ad5b9b413aa7346a1e`, `F_01161aaa0b6d1345dd8fe4e481144d84`, `F_539fd53b59e3bb12d203f45a912eeaf2`, `F_ac1dd209cbcc5e5d1c6e28598e8cbbe8`, `F_555d6702c950ecb729a966504af0a635`, `F_335f5352088d7d9bf74191e006d8e24c`, `F_f340f1b1f65b6df5b5e3f94d95b11daf`, `F_e4a6222cdb5b34375400904f03d8e6a5`, `F_cb70ab375662576bd1ac5aaf16b3fca4`, `F_9188905e74c28e489b44e954ec0b9bca`, `F_0266e33d3f546cb5436a10798e657d97`, `F_38db3aed920cf82ab059bfccbd02be6a`, `F_3cec07e9ba5f5bb252d13f5f431e4bbb`, `F_621bf66ddb7c962aa0d22ac97d69b793`, `F_077e29b11be80ab57e1a2ecabb7da330`, `F_6c9882bbac1c7093bd25041881277658`, `F_19f3cd308f1455b3fa09a282e0d496f4`, `F_03c6b06952c750899bb03d998e631860`, `F_c24cd76e1ce41366a4bbe8a49b02a028`, `F_c52f1bd66cc19d05628bd8bf27af3ad6`, `F_fe131d7f5a6b38b23cc967316c13dae2`, `F_f718499c1c8cef6730f9fd03c8125cab`, `F_d96409bf894217686ba124d7356686c9`, `F_502e4a16930e414107ee22b6198c578f`, `F_cfa0860e83a4c3a763a7e62d825349f7`, `F_a4f23670e1833f3fdb077ca70b bd5d66`, `F_b1a59b315fc9a3002ce38bbe070ec3f5`, `F_36660e59856b4de58a219bcf4e27eba3`, `F_8c19f571e251e61cb8dd3612f26d5ecf`, `F_d6baf65e0b240ce177cf70da146c8dc8`, `F_e56954b4f6347e897f954495eab16a88`, `F_f7664060cc52bc6f3d620bcedc94a4b6`, `F_eda80a3d5b344bc40f3bc04f65b7a357`, `F_8f121ce07d74717e0b1f21d122e04521`, `F_06138bc5af6023646ede0e1f7c1eac75`, `F_39059724f73a9969845dfe4146c5660e`, `F_7f100b7b36092fb9b06dfb4fac360931`, `F_7a614fd06c325499f1680b9896beedeb`, `F_4734ba6f3de83d861c3176a6273cac6d`, `F_d947bf06a885db0d477d707121934ff8`, `F_63923f49e5241343aa7acb6a06a751e7`, `F_db8e1af0cb3aca1ae2d0018624204529`, `F_20f07591c6fcb220ffe637cda29bb3f6`, `F_07cdfd23373b17c6b337251c22b7ea57`, `F_d395771085aab05244a4fb8fd91bf4ee`, `F_92c8c96e4c37100777c7190b76d28233`, `F_e3796ae838835da0b6f6ea37bcf8bcb7`, `F_6a9aeddfc689c1d0e3b9ccc3ab651bc5`, `F_0f49c89d1e7298bb9930789c8ed59d48`, `F_46ba9f2a6976570b0353203ec4474217`, `F_0e01938fc48a2cfb5f2217fbfb00722d`, `F_16a5cdae362b8d27a1d8f8c7b78 b4330`, `F_918317b57931b6b7a7d29490fe5ec9f9`, `F_48aedb8880cab8c45637abc7493ecddd`, `F_839ab46820b524afda05122893c2fe8e`, `F_f90f2aca5c640289d0a29417bcb63a37`, `F_9c838d2e45b2ad1094d42f4ef36764f6`, `F_1700002963a49da13542e0726b7bb758`, `F_53c3bce66e43be4f209556518c2fcb54`, `F_6883966fd8f918a4aa29be29d2c386fb`, `F_49182f81e6a13cf5eaa496d51fea6406`, `F_d296c101daa88a51f6ca8cfc1ac79b50`, `F_9fd81843ad7f202f26c1a174c7357585`, `F_26e359e83860db1d11b6acca57d8ea88`, `F_ef0d3930a7b6c95bd2b32ed45989c61f`, `F_94f6d7e04a4d452035300f18b984988c`, `F_34ed066df378efacc9b924ec161e7639`, `F_577bcc914f9e55d5e4e4f82f9f00e7d4`, `F_11b9842e0a271ff252c1903e7132cd68`, `F_37bc2f75bf1bcfe8450a1a41c200364c`, `F_496e05e1aea0a9c4655800e8a7b9ea28`, `F_b2eb7349035754953b57a32e2841bda5`, `F_8e98d81f8217304975ccb23337bb5761`, `F_a8c88a0055f636e4a163a5e3d16adab7`, `F_eddea82ad2755b24c4e168c5fc2ebd40`, `F_06eb61b839a0cefee4967c67ccb099dc`, `F_9dfcd5e558dfa04aaf37f137a1d9d3e5`, `F_950a4152c2b4aa3ad78bdd6b366c c179`, `F_158f3069a435b314a80bdcb024f8e422`, `F_758874998f5bd0c393da094e1967a72b`, `F_ad13a2a07ca4b7642959dc0c4c740ab6`, `F_3fe94a002317b5f9259f82690aeea4cd`, `F_5b8add2a5d98b1a652ea7fd72d942dac`, `F_432aca3a1e345e339f35a30c8f65edce`, `F_8d3bba7425e7c98c50f52ca1b52d3735`, `F_320722549d1751cf3f247855f937b982`, `F_caf1a3dfb505ffed0d024130f58c5cfa`, `F_5737c6ec2e0716f3d8a7a5c4e0de0d9a`, `F_bc6dc48b743dc5d013b1abaebd2faed2`, `F_f2fc990265c712c49d51a18a32b39f0c`, `F_89f0fd5c927d466d6ec9a21b9ac34ffa`, `F_a666587afda6e89aec274a3657558a27`, `F_b83aac23b9528732c23cc7352950e880`, `F_cd00692c3bfe59267d5ecfac5310286c`, `F_6faa8040da20ef399b63a72d0e4ab575`, `F_fe73f687e5bc5280214e0486b273a5f9`) 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,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,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,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,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,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,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,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,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,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +drop table t1; +# +# Test for --add-drop-database +# +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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +/*!40000 DROP DATABASE IF EXISTS `test`*/; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `test`; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES (1),(2),(3); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TABLE t1; +# +# Bug#9558 mysqldump --no-data db t1 t2 format still dumps data +# +CREATE DATABASE mysqldump_test_db; +USE mysqldump_test_db; +CREATE TABLE t1 ( a INT ); +CREATE TABLE t2 ( a INT ); +INSERT INTO t1 VALUES (1), (2); +INSERT INTO t2 VALUES (1), (2); + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `t2`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `t2`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +<?xml version="1.0"?> +<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +<database name="mysqldump_test_db"> + <table_structure name="t1"> + <field Field="a" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + </table_structure> + <table_structure name="t2"> + <field Field="a" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + </table_structure> +</database> +</mysqldump> +<?xml version="1.0"?> +<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +<database name="mysqldump_test_db"> + <table_structure name="t1"> + <field Field="a" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + </table_structure> + <table_structure name="t2"> + <field Field="a" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + </table_structure> +</database> +</mysqldump> +DROP TABLE t1, t2; +DROP DATABASE mysqldump_test_db; +# +# Testing with tables and databases that don't exists +# or contains illegal characters +# (Bug#9358 mysqldump crashes if tablename starts with \) +# +create database mysqldump_test_db; +use mysqldump_test_db; +create table t1(a varchar(30) primary key, b int not null); +create table t2(a varchar(30) primary key, b int not null); +create table t3(a varchar(30) primary key, b int not null); +test_sequence +------ Testing with illegal table names ------ +mysqldump: Couldn't find table: "\d-2-1.sql" +mysqldump: Couldn't find table: "\t1" +mysqldump: Couldn't find table: "\t1" +mysqldump: Couldn't find table: "\\t1" +mysqldump: Couldn't find table: "t\1" +mysqldump: Couldn't find table: "t\1" +mysqldump: Couldn't find table: "t/1" +mysqldump: Couldn't find table: "T_1" +mysqldump: Couldn't find table: "T%1" +mysqldump: Couldn't find table: "T'1" +mysqldump: Couldn't find table: "T_1" +mysqldump: Couldn't find table: "T_" +test_sequence +------ Testing with illegal database names ------ +mysqldump: Got error: 1049: "Unknown database 'mysqldump_test_d'" when selecting the database +mysqldump: Got error: 1049: "Unknown database 'mysqld\ump_test_db'" when selecting the database +drop table t1, t2, t3; +drop database mysqldump_test_db; +use test; +# +# Bug#9657 mysqldump xml ( -x ) does not format NULL fields correctly +# +create table t1 (a int(10)); +create table t2 (pk int primary key auto_increment, +a int(10), b varchar(30), c datetime, d blob, e text); +insert into t1 values (NULL), (10), (20); +insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thirty"); +<?xml version="1.0"?> +<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +<database name="test"> + <table_data name="t1"> + <row> + <field name="a" xsi:nil="true" /> + </row> + <row> + <field name="a">10</field> + </row> + <row> + <field name="a">20</field> + </row> + </table_data> + <table_data name="t2"> + <row> + <field name="pk">1</field> + <field name="a" xsi:nil="true" /> + <field name="b" xsi:nil="true" /> + <field name="c" xsi:nil="true" /> + <field name="d" xsi:nil="true" /> + <field name="e" xsi:nil="true" /> + </row> + <row> + <field name="pk">2</field> + <field name="a">10</field> + <field name="b" xsi:nil="true" /> + <field name="c" xsi:nil="true" /> + <field name="d" xsi:nil="true" /> + <field name="e" xsi:nil="true" /> + </row> + <row> + <field name="pk">3</field> + <field name="a" xsi:nil="true" /> + <field name="b">twenty</field> + <field name="c" xsi:nil="true" /> + <field name="d" xsi:nil="true" /> + <field name="e" xsi:nil="true" /> + </row> + <row> + <field name="pk">4</field> + <field name="a">30</field> + <field name="b">thirty</field> + <field name="c" xsi:nil="true" /> + <field name="d" xsi:nil="true" /> + <field name="e" xsi:nil="true" /> + </row> + </table_data> +</database> +</mysqldump> + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES (NULL),(10),(20); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; + +LOCK TABLES `t2` WRITE; +/*!40000 ALTER TABLE `t2` DISABLE KEYS */; +INSERT INTO `t2` VALUES (1,NULL,NULL,NULL,NULL,NULL),(2,10,NULL,NULL,NULL,NULL),(3,NULL,'twenty',NULL,NULL,NULL),(4,30,'thirty',NULL,NULL,NULL); +/*!40000 ALTER TABLE `t2` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` int(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES (NULL),(10),(20); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `t2`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t2` ( + `pk` int(11) NOT NULL AUTO_INCREMENT, + `a` int(10) DEFAULT NULL, + `b` varchar(30) DEFAULT NULL, + `c` datetime DEFAULT NULL, + `d` blob DEFAULT NULL, + `e` text DEFAULT NULL, + PRIMARY KEY (`pk`) +) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t2` WRITE; +/*!40000 ALTER TABLE `t2` DISABLE KEYS */; +INSERT INTO `t2` VALUES (1,NULL,NULL,NULL,NULL,NULL),(2,10,NULL,NULL,NULL,NULL),(3,NULL,'twenty',NULL,NULL,NULL),(4,30,'thirty',NULL,NULL,NULL); +/*!40000 ALTER TABLE `t2` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +drop table t1, t2; +# +# Bug#12123 mysqldump --tab results in text file which can't be imported +# +create table t1 (a text character set utf8, b text character set latin1); +insert t1 values (0x4F736E616272C3BC636B, 0x4BF66C6E); +select * from t1; +a b +Osnabr�ck K�ln +test.t1: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0 +select * from t1; +a b +Osnabr�ck K�ln +drop table t1; +# +# Bug#15328 Segmentation fault occurred if my.cnf is invalid for escape sequence +# +--fields-optionally-enclosed-by=" +# +# Bug#19025 mysqldump doesn't correctly dump "auto_increment = [int]" +# +create table `t1` ( +t1_name varchar(255) default null, +t1_id int(10) unsigned not null auto_increment, +key (t1_name), +primary key (t1_id) +) auto_increment = 1000 default charset=latin1; +insert into t1 (t1_name) values('bla'); +insert into t1 (t1_name) values('bla'); +insert into t1 (t1_name) values('bla'); +select * from t1; +t1_name t1_id +bla 1000 +bla 1001 +bla 1002 +show create table `t1`; +Table Create Table +t1 CREATE TABLE `t1` ( + `t1_name` varchar(255) DEFAULT NULL, + `t1_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`t1_id`), + KEY `t1_name` (`t1_name`) +) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1 +DROP TABLE `t1`; +select * from t1; +t1_name t1_id +bla 1000 +bla 1001 +bla 1002 +show create table `t1`; +Table Create Table +t1 CREATE TABLE `t1` ( + `t1_name` varchar(255) DEFAULT NULL, + `t1_id` int(10) unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`t1_id`), + KEY `t1_name` (`t1_name`) +) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1 +drop table `t1`; +# +# Bug#18536 wrong table order +# +create table t1(a int); +create table t2(a int); +create table t3(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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t3`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t3` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `t2`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +drop table t1, t2, t3; +# +# Bug#21288 mysqldump segmentation fault when using --where +# +create table t1 (a int); +mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ `a` FROM `t1` WHERE xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 (1064) +mysqldump: Got error: 1064: "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1" when retrieving data from server + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +drop table t1; +# +# Bug#13926 --order-by-primary fails if PKEY contains quote character +# +DROP TABLE IF EXISTS `t1`; +CREATE TABLE `t1` ( +`a b` INT, +`c"d` INT, +`e``f` INT, +PRIMARY KEY (`a b`, `c"d`, `e``f`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +insert into t1 values (0815, 4711, 2006); +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS "t1"; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE "t1" ( + "a b" int(11) NOT NULL, + "c""d" int(11) NOT NULL, + "e`f" int(11) NOT NULL, + PRIMARY KEY ("a b","c""d","e`f") +); +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES "t1" WRITE; +/*!40000 ALTER TABLE "t1" DISABLE KEYS */; +INSERT INTO "t1" VALUES (815,4711,2006); +/*!40000 ALTER TABLE "t1" ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a b` int(11) NOT NULL, + `c"d` int(11) NOT NULL, + `e``f` int(11) NOT NULL, + PRIMARY KEY (`a b`,`c"d`,`e``f`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES (815,4711,2006); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TABLE `t1`; +End of 4.1 tests +# +# Bug#10213 mysqldump crashes when dumping VIEWs(on MacOS X) +# +create database db1; +use db1; +CREATE TABLE t2 ( +a varchar(30) default NULL, +KEY a (a(5)) +); +INSERT INTO t2 VALUES ('alfred'); +INSERT INTO t2 VALUES ('angie'); +INSERT INTO t2 VALUES ('bingo'); +INSERT INTO t2 VALUES ('waffle'); +INSERT INTO t2 VALUES ('lemon'); +create view v2 as select * from t2 where a like 'a%' with check option; + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t2`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t2` ( + `a` varchar(30) DEFAULT NULL, + KEY `a` (`a`(5)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t2` WRITE; +/*!40000 ALTER TABLE `t2` DISABLE KEYS */; +INSERT INTO `t2` VALUES ('alfred'),('angie'),('bingo'),('waffle'),('lemon'); +/*!40000 ALTER TABLE `t2` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `v2`; +/*!50001 DROP VIEW IF EXISTS `v2`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `v2` ( + `a` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; +/*!50001 DROP TABLE IF EXISTS `v2`*/; +/*!50001 DROP VIEW IF EXISTS `v2`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where `t2`.`a` like 'a%' */ +/*!50002 WITH CASCADED CHECK OPTION */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +drop table t2; +drop view v2; +drop database db1; +use test; +# +# Bug#10713 mysqldump includes database in create view and referenced tables +# +create database db2; +use db2; +create table t1 (a int); +create table t2 (a int, b varchar(10), primary key(a)); +insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg"); +insert into t1 values (289), (298), (234), (456), (789); +create view v1 as select * from t2; +create view v2 as select * from t1; +drop table t1, t2; +drop view v1, v2; +drop database db2; +use test; +create database db1; +use db1; +show tables; +Tables_in_db1 +t1 +t2 +v1 +v2 +select * from t2 order by a; +a b +1 on +2 off +10 pol +12 meg +drop table t1, t2; +drop database db1; +use test; +create table t1(a int); +create view v1 as select * from 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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `v1`; +/*!50001 DROP VIEW IF EXISTS `v1`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `v1` ( + `a` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; +/*!50001 DROP TABLE IF EXISTS `v1`*/; +/*!50001 DROP VIEW IF EXISTS `v1`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v1` AS select `t1`.`a` AS `a` from `t1` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +drop view v1; +drop table t1; +# +# Bug#10213 mysqldump crashes when dumping VIEWs(on MacOS X) +# +create database mysqldump_test_db; +use mysqldump_test_db; +CREATE TABLE t2 ( +a varchar(30) default NULL, +KEY a (a(5)) +); +INSERT INTO t2 VALUES ('alfred'); +INSERT INTO t2 VALUES ('angie'); +INSERT INTO t2 VALUES ('bingo'); +INSERT INTO t2 VALUES ('waffle'); +INSERT INTO t2 VALUES ('lemon'); +create view v2 as select * from t2 where a like 'a%' with check option; + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t2`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t2` ( + `a` varchar(30) DEFAULT NULL, + KEY `a` (`a`(5)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t2` WRITE; +/*!40000 ALTER TABLE `t2` DISABLE KEYS */; +INSERT INTO `t2` VALUES ('alfred'),('angie'),('bingo'),('waffle'),('lemon'); +/*!40000 ALTER TABLE `t2` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `v2`; +/*!50001 DROP VIEW IF EXISTS `v2`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `v2` ( + `a` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; +/*!50001 DROP TABLE IF EXISTS `v2`*/; +/*!50001 DROP VIEW IF EXISTS `v2`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where `t2`.`a` like 'a%' */ +/*!50002 WITH CASCADED CHECK OPTION */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +drop table t2; +drop view v2; +drop database mysqldump_test_db; +use test; +# +# Bug#9756 mysql client failing on dumps containing certain \ sequences +# +CREATE TABLE t1 (a char(10)); +INSERT INTO t1 VALUES ('\''); + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` char(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES ('\''); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TABLE t1; +# +# Bug#10927 mysqldump: Can't reload dump with view that consist of other view +# +create table t1(a int, b int, c varchar(30)); +insert into t1 values(1, 2, "one"), (2, 4, "two"), (3, 6, "three"); +create view v3 as +select * from t1; +create view v1 as +select * from v3 where b in (1, 2, 3, 4, 5, 6, 7); +create view v2 as +select v3.a from v3, v1 where v1.a=v3.a and v3.b=3 limit 1; + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` varchar(30) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES (1,2,'one'),(2,4,'two'),(3,6,'three'); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `v1`; +/*!50001 DROP VIEW IF EXISTS `v1`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `v1` ( + `a` tinyint NOT NULL, + `b` tinyint NOT NULL, + `c` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; +DROP TABLE IF EXISTS `v2`; +/*!50001 DROP VIEW IF EXISTS `v2`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `v2` ( + `a` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; +DROP TABLE IF EXISTS `v3`; +/*!50001 DROP VIEW IF EXISTS `v3`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `v3` ( + `a` tinyint NOT NULL, + `b` tinyint NOT NULL, + `c` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; +/*!50001 DROP TABLE IF EXISTS `v1`*/; +/*!50001 DROP VIEW IF EXISTS `v1`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v1` AS select `v3`.`a` AS `a`,`v3`.`b` AS `b`,`v3`.`c` AS `c` from `v3` where `v3`.`b` in (1,2,3,4,5,6,7) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!50001 DROP TABLE IF EXISTS `v2`*/; +/*!50001 DROP VIEW IF EXISTS `v2`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v2` AS select `v3`.`a` AS `a` from (`v3` join `v1`) where `v1`.`a` = `v3`.`a` and `v3`.`b` = 3 limit 1 */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!50001 DROP TABLE IF EXISTS `v3`*/; +/*!50001 DROP VIEW IF EXISTS `v3`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v3` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b`,`t1`.`c` AS `c` from `t1` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +drop view v1, v2, v3; +drop table t1; +# +# Test for dumping triggers +# +CREATE TABLE t1 (a int, b bigint default NULL); +CREATE TABLE t2 (a int); +create trigger trg1 before insert on t1 for each row +begin +if new.a > 10 then +set new.a := 10; +set new.a := 11; +end if; +end| +create trigger trg2 before update on t1 for each row begin +if old.a % 2 = 0 then set new.b := 12; end if; +end| +set sql_mode="traditional"| +create trigger trg3 after update on t1 for each row +begin +if new.a = -1 then +set @fired:= "Yes"; +end if; +end| +create trigger trg4 before insert on t2 for each row +begin +if new.a > 10 then +set @fired:= "No"; +end if; +end| +set sql_mode=default| +show triggers like "t1"; +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +trg1 INSERT t1 begin +if new.a > 10 then +set new.a := 10; +set new.a := 11; +end if; +end BEFORE 0000-00-00 00:00:00 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +trg2 UPDATE t1 begin +if old.a % 2 = 0 then set new.b := 12; end if; +end BEFORE 0000-00-00 00:00:00 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +trg3 UPDATE t1 begin +if new.a = -1 then +set @fired:= "Yes"; +end if; +end AFTER 0000-00-00 00:00:00 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +INSERT INTO t1 (a) VALUES (1),(2),(3),(22); +update t1 set a = 4 where a=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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `test`; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` bigint(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES (1,NULL),(2,NULL),(4,NULL),(11,NULL); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 trigger trg1 before insert on t1 for each row +begin +if new.a > 10 then +set new.a := 10; +set new.a := 11; +end if; +end */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 trigger trg2 before update on t1 for each row begin +if old.a % 2 = 0 then set new.b := 12; end if; +end */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 trigger trg3 after update on t1 for each row +begin +if new.a = -1 then +set @fired:= "Yes"; +end if; +end */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +DROP TABLE IF EXISTS `t2`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t2` WRITE; +/*!40000 ALTER TABLE `t2` DISABLE KEYS */; +/*!40000 ALTER TABLE `t2` ENABLE KEYS */; +UNLOCK TABLES; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 trigger trg4 before insert on t2 for each row +begin +if new.a > 10 then +set @fired:= "No"; +end if; +end */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `test`; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` bigint(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES (1,NULL),(2,NULL),(4,NULL),(11,NULL); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `t2`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t2` WRITE; +/*!40000 ALTER TABLE `t2` DISABLE KEYS */; +/*!40000 ALTER TABLE `t2` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +drop table t1; +show tables; +Tables_in_test +t1 +t2 +show triggers; +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +trg1 INSERT t1 begin +if new.a > 10 then +set new.a := 10; +set new.a := 11; +end if; +end BEFORE # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +trg2 UPDATE t1 begin +if old.a % 2 = 0 then set new.b := 12; end if; +end BEFORE # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +trg3 UPDATE t1 begin +if new.a = -1 then +set @fired:= "Yes"; +end if; +end AFTER # STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +trg4 INSERT t2 begin +if new.a > 10 then +set @fired:= "No"; +end if; +end BEFORE # STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +DROP TABLE t1, t2; +# +# Bug#9136 my_print_defaults changed behaviour between 4.1.7 and 4.1.10a +# Bug#12917 The --defaults-extra-file option is ignored by the 5.0 client binaries +# (Problems with --defaults-extra-file option) +# +--port=1234 +--port=1234 +# +# Test of fix to Bug#12597 mysqldump dumps triggers wrongly +# +DROP TABLE IF EXISTS `test1`; +Warnings: +Note 1051 Unknown table 'test.test1' +CREATE TABLE `test1` ( +`a1` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +DROP TABLE IF EXISTS `test2`; +Warnings: +Note 1051 Unknown table 'test.test2' +CREATE TABLE `test2` ( +`a2` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +CREATE TRIGGER `testref` BEFORE INSERT ON `test1` FOR EACH ROW BEGIN +INSERT INTO test2 SET a2 = NEW.a1; END // +INSERT INTO `test1` VALUES (1); +SELECT * FROM `test2`; +a2 +1 +SHOW TRIGGERS; +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +testref INSERT test1 BEGIN +INSERT INTO test2 SET a2 = NEW.a1; END BEFORE # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +SELECT * FROM `test1`; +a1 +1 +SELECT * FROM `test2`; +a2 +1 +DROP TRIGGER testref; +DROP TABLE test1; +DROP TABLE test2; +# +# Bug#9056 mysqldump does not dump routines +# +DROP TABLE IF EXISTS t1; +DROP FUNCTION IF EXISTS bug9056_func1; +DROP FUNCTION IF EXISTS bug9056_func2; +DROP PROCEDURE IF EXISTS bug9056_proc1; +DROP PROCEDURE IF EXISTS bug9056_proc2; +DROP PROCEDURE IF EXISTS `a'b`; +CREATE TABLE t1 (id int); +INSERT INTO t1 VALUES(1), (2), (3), (4), (5); +CREATE FUNCTION `bug9056_func1`(a INT, b INT) RETURNS int(11) RETURN a+b // +CREATE PROCEDURE `bug9056_proc1`(IN a INT, IN b INT, OUT c INT) +BEGIN SELECT a+b INTO c; end // +create function bug9056_func2(f1 char binary) returns char +begin +set f1= concat( 'hello', f1 ); +return f1; +end // +CREATE PROCEDURE bug9056_proc2(OUT a INT) +BEGIN +select sum(id) from t1 into a; +END // +set sql_mode='ansi'; +create procedure `a'b` () select 1; +set sql_mode=''; + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `test`; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `id` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES (1),(2),(3),(4),(5); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!50003 DROP FUNCTION IF EXISTS `bug9056_func1` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `bug9056_func1`(a INT, b INT) RETURNS int(11) +RETURN a+b ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP FUNCTION IF EXISTS `bug9056_func2` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `bug9056_func2`(f1 char binary) RETURNS char(1) CHARSET latin1 +begin +set f1= concat( 'hello', f1 ); +return f1; +end ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `a'b` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI' */ ; +DELIMITER ;; +CREATE DEFINER="root"@"localhost" PROCEDURE "a'b"() +select 1 ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `bug9056_proc1` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `bug9056_proc1`(IN a INT, IN b INT, OUT c INT) +BEGIN SELECT a+b INTO c; end ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `bug9056_proc2` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `bug9056_proc2`(OUT a INT) +BEGIN +select sum(id) from t1 into a; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP FUNCTION bug9056_func1; +DROP FUNCTION bug9056_func2; +DROP PROCEDURE bug9056_proc1; +DROP PROCEDURE bug9056_proc2; +DROP PROCEDURE `a'b`; +drop table t1; +# +# Bug#13052 mysqldump timestamp reloads broken +# +drop table if exists t1; +create table t1 (`d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, unique (`d`)); +set time_zone='+00:00'; +insert into t1 values ('2003-10-25 22:00:00'),('2003-10-25 23:00:00'); +select * from t1; +d +2003-10-25 22:00:00 +2003-10-25 23:00:00 +set time_zone='Europe/Moscow'; +select * from t1; +d +2003-10-26 02:00:00 +2003-10-26 02:00:00 +set global time_zone='Europe/Moscow'; + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `test`; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + UNIQUE KEY `d` (`d`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES ('2003-10-25 22:00:00'),('2003-10-25 23:00:00'); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + + +/*!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 utf8mb4 */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `test`; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + UNIQUE KEY `d` (`d`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES ('2003-10-26 02:00:00'),('2003-10-26 02:00:00'); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +drop table t1; +set global time_zone=default; +set time_zone=default; +# +# Test of fix to Bug#13146 ansi quotes break loading of triggers +# +DROP TABLE IF EXISTS `t1 test`; +DROP TABLE IF EXISTS `t2 test`; +CREATE TABLE `t1 test` ( +`a1` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +CREATE TABLE `t2 test` ( +`a2` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +CREATE TRIGGER `test trig` BEFORE INSERT ON `t1 test` FOR EACH ROW BEGIN +INSERT INTO `t2 test` SET a2 = NEW.a1; END // +INSERT INTO `t1 test` VALUES (1); +INSERT INTO `t1 test` VALUES (2); +INSERT INTO `t1 test` VALUES (3); +SELECT * FROM `t2 test`; +a2 +1 +2 +3 +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS "t1 test"; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE "t1 test" ( + "a1" int(11) DEFAULT NULL +); +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES "t1 test" WRITE; +/*!40000 ALTER TABLE "t1 test" DISABLE KEYS */; +INSERT INTO "t1 test" VALUES (1),(2),(3); +/*!40000 ALTER TABLE "t1 test" ENABLE KEYS */; +UNLOCK TABLES; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `test trig` BEFORE INSERT ON `t1 test` FOR EACH ROW BEGIN +INSERT INTO `t2 test` SET a2 = NEW.a1; END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +DROP TABLE IF EXISTS "t2 test"; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE "t2 test" ( + "a2" int(11) DEFAULT NULL +); +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES "t2 test" WRITE; +/*!40000 ALTER TABLE "t2 test" DISABLE KEYS */; +INSERT INTO "t2 test" VALUES (1),(2),(3); +/*!40000 ALTER TABLE "t2 test" ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TRIGGER `test trig`; +DROP TABLE `t1 test`; +DROP TABLE `t2 test`; +# +# Bug#12838 mysqldump -x with views exits with error +# +drop table if exists t1; +create table t1 (a int, b varchar(32), c varchar(32)); +insert into t1 values (1, 'first value', 'xxxx'); +insert into t1 values (2, 'second value', 'tttt'); +insert into t1 values (3, 'third value', 'vvv vvv'); +create view v1 as select * from t1; +create view v0 as select * from v1; +create view v2 as select * from v0; +select * from v2; +a b c +1 first value xxxx +2 second value tttt +3 third value vvv vvv + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `test`; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(32) DEFAULT NULL, + `c` varchar(32) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES (1,'first value','xxxx'),(2,'second value','tttt'),(3,'third value','vvv vvv'); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `v0`; +/*!50001 DROP VIEW IF EXISTS `v0`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `v0` ( + `a` tinyint NOT NULL, + `b` tinyint NOT NULL, + `c` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; +DROP TABLE IF EXISTS `v1`; +/*!50001 DROP VIEW IF EXISTS `v1`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `v1` ( + `a` tinyint NOT NULL, + `b` tinyint NOT NULL, + `c` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; +DROP TABLE IF EXISTS `v2`; +/*!50001 DROP VIEW IF EXISTS `v2`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `v2` ( + `a` tinyint NOT NULL, + `b` tinyint NOT NULL, + `c` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +USE `test`; +/*!50001 DROP TABLE IF EXISTS `v0`*/; +/*!50001 DROP VIEW IF EXISTS `v0`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v0` AS select `v1`.`a` AS `a`,`v1`.`b` AS `b`,`v1`.`c` AS `c` from `v1` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!50001 DROP TABLE IF EXISTS `v1`*/; +/*!50001 DROP VIEW IF EXISTS `v1`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b`,`t1`.`c` AS `c` from `t1` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!50001 DROP TABLE IF EXISTS `v2`*/; +/*!50001 DROP VIEW IF EXISTS `v2`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v2` AS select `v0`.`a` AS `a`,`v0`.`b` AS `b`,`v0`.`c` AS `c` from `v0` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +drop view v2; +drop view v0; +drop view v1; +drop table t1; +# +# Bug#14554 mysqldump does not separate words "ROW" and "BEGIN" +# for tables with trigger created in the IGNORE_SPACE sql mode. +# +SET @old_sql_mode = @@SQL_MODE; +SET SQL_MODE = IGNORE_SPACE; +CREATE TABLE t1 (a INT); +CREATE TRIGGER tr1 BEFORE INSERT ON t1 +FOR EACH ROW +BEGIN +SET new.a = 0; +END| +SET SQL_MODE = @old_sql_mode; + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `test`; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tr1 BEFORE INSERT ON t1 +FOR EACH ROW +BEGIN +SET new.a = 0; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TRIGGER tr1; +DROP TABLE t1; +# +# Bug#13318 Bad result with empty field and --hex-blob +# +create table t1 (a binary(1), b blob); +insert into t1 values ('',''); + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` binary(1) DEFAULT NULL, + `b` blob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES (0x00,''); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` binary(1) DEFAULT NULL, + `b` blob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES (0x00,''); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +drop table t1; +# +# Bug#14871 Invalid view dump output +# +create table t1 (a int); +insert into t1 values (289), (298), (234), (456), (789); +create definer = CURRENT_USER view v1 as select * from t1; +create SQL SECURITY INVOKER view v2 as select * from t1; +create view v3 as select * from t1 with local check option; +create algorithm=merge view v4 as select * from t1 with cascaded check option; +create algorithm =temptable view v5 as select * from t1; +drop table t1; +drop view v1, v2, v3, v4, v5; +show tables; +Tables_in_test +t1 +v1 +v2 +v3 +v4 +v5 +select * from v3 order by a; +a +234 +289 +298 +456 +789 +drop table t1; +drop view v1, v2, v3, v4, v5; +# +# Bug#16878 dump of trigger +# +create table t1 (a int, created datetime); +create table t2 (b int, created datetime); +create trigger tr1 before insert on t1 for each row set +new.created=now(); +create trigger tr2 after insert on t1 +for each row +begin +insert into t2 set b=new.a and created=new.created; +end| +drop trigger tr1; +drop trigger tr2; +drop table t1, t2; +show triggers; +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +tr1 INSERT t1 set +new.created=now() BEFORE # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +tr2 INSERT t1 begin +insert into t2 set b=new.a and created=new.created; +end AFTER # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +drop trigger tr1; +drop trigger tr2; +drop table t1, t2; +# +# Bug#18462 mysqldump does not dump view structures correctly +# +create table t (qty int, price int); +insert into t values(3, 50); +insert into t values(5, 51); +create view v1 as select qty, price, qty*price as value from t; +create view v2 as select qty from v1; +mysqldump { +/*!50001 DROP TABLE IF EXISTS `v1`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v1` AS select `t`.`qty` AS `qty`,`t`.`price` AS `price`,`t`.`qty` * `t`.`price` AS `value` from `t` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +} mysqldump { +/*!50001 DROP TABLE IF EXISTS `v2`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v2` AS select `v1`.`qty` AS `qty` from `v1` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +} mysqldump +drop view v1; +drop view v2; +drop table t; +# +# Bug#14857 Reading dump files with single statement stored routines fails. +# fixed by patch for Bug#16878 +# +/*!50003 CREATE FUNCTION `f`() RETURNS bigint(20) +return 42 */| +/*!50003 CREATE PROCEDURE `p`() +select 42 */| +show create function f; +Function sql_mode Create Function character_set_client collation_connection Database Collation +f CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS bigint(20) +return 42 latin1 latin1_swedish_ci latin1_swedish_ci +show create procedure p; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p CREATE DEFINER=`root`@`localhost` PROCEDURE `p`() +select 42 latin1 latin1_swedish_ci latin1_swedish_ci +drop function f; +drop procedure p; +# +# Bug#17371 Unable to dump a schema with invalid views +# +create table t1 ( id serial ); +create view v1 as select * from t1; +drop table t1; +mysqldump { + +-- failed on view `v1`: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`id` AS `id` from `t1` + +} mysqldump +drop view v1; +# Bug#17201 Spurious 'DROP DATABASE' in output, +# also confusion between tables and views. +# Example code from Markus Popp +create database mysqldump_test_db; +use mysqldump_test_db; +create table t1 (id int); +create view v1 as select * from t1; +insert into t1 values (1232131); +insert into t1 values (4711); +insert into t1 values (3231); +insert into t1 values (0815); + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +/*!40000 DROP DATABASE IF EXISTS `mysqldump_test_db`*/; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_test_db` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `mysqldump_test_db`; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `id` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES (1232131),(4711),(3231),(815); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `v1`; +/*!50001 DROP VIEW IF EXISTS `v1`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `v1` ( + `id` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +USE `mysqldump_test_db`; +/*!50001 DROP TABLE IF EXISTS `v1`*/; +/*!50001 DROP VIEW IF EXISTS `v1`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v1` AS select `t1`.`id` AS `id` from `t1` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +drop view v1; +drop table t1; +drop database mysqldump_test_db; +# +# Bug#21014 Segmentation fault of mysqldump on view +# +create database mysqldump_tables; +use mysqldump_tables; +create table basetable ( id serial, tag varchar(64) ); +create database mysqldump_views; +use mysqldump_views; +create view nasishnasifu as select mysqldump_tables.basetable.id from mysqldump_tables.basetable; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_tables` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `mysqldump_tables`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `basetable` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `tag` varchar(64) DEFAULT NULL, + UNIQUE KEY `id` (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_views` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `mysqldump_views`; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `nasishnasifu` ( + `id` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +USE `mysqldump_tables`; + +USE `mysqldump_views`; +/*!50001 DROP TABLE IF EXISTS `nasishnasifu`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `nasishnasifu` AS select `mysqldump_tables`.`basetable`.`id` AS `id` from `mysqldump_tables`.`basetable` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +drop view nasishnasifu; +drop database mysqldump_views; +drop table mysqldump_tables.basetable; +drop database mysqldump_tables; +# +# Bug#20221 Dumping of multiple databases containing view(s) yields maleformed dumps +# +create database mysqldump_dba; +use mysqldump_dba; +create table t1 (f1 int, f2 int); +insert into t1 values (1,1); +create view v1 as select f1, f2 from t1; +create database mysqldump_dbb; +use mysqldump_dbb; +create table t1 (f1 int, f2 int); +insert into t1 values (2,2); +create view v1 as select f1, f2 from t1; +drop view v1; +drop table t1; +drop database mysqldump_dbb; +use mysqldump_dba; +drop view v1; +drop table t1; +drop database mysqldump_dba; +select * from mysqldump_dba.v1; +f1 f2 +1 1 +select * from mysqldump_dbb.v1; +f1 f2 +2 2 +use mysqldump_dba; +drop view v1; +drop table t1; +drop database mysqldump_dba; +use mysqldump_dbb; +drop view v1; +drop table t1; +drop database mysqldump_dbb; +use test; +# +# Bug#21215 mysqldump creating incomplete backups without warning +# +create user mysqltest_1@localhost; +create table t1(a int, b varchar(34)); +reset master; +mysqldump: Couldn't execute 'FLUSH /*!40101 LOCAL */ TABLES': Access denied; you need (at least one of) the RELOAD privilege(s) for this operation (1227) +mysqldump: Couldn't execute 'FLUSH /*!40101 LOCAL */ TABLES': Access denied; you need (at least one of) the RELOAD privilege(s) for this operation (1227) +grant RELOAD on *.* to mysqltest_1@localhost; +mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need (at least one of) the SUPER, REPLICATION CLIENT privilege(s) for this operation (1227) +mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need (at least one of) the SUPER, REPLICATION CLIENT privilege(s) for this operation (1227) +grant REPLICATION CLIENT on *.* to mysqltest_1@localhost; +drop table t1; +drop user mysqltest_1@localhost; +# +# Bug#21424 mysqldump failing to export/import views +# +connect root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connection root; +create database mysqldump_myDB; +use mysqldump_myDB; +create user myDB_User@localhost; +grant create, create view, select, insert on mysqldump_myDB.* to myDB_User@localhost; +create table t1 (c1 int); +insert into t1 values (3); +connect user1,localhost,myDB_User,,mysqldump_myDB,$MASTER_MYPORT,$MASTER_MYSOCK; +connection user1; +use mysqldump_myDB; +create table u1 (f1 int); +insert into u1 values (4); +create view v1 (c1) as select * from t1; +connection root; +use mysqldump_myDB; +drop view v1; +drop table t1; +drop table u1; +revoke all privileges on mysqldump_myDB.* from myDB_User@localhost; +drop user myDB_User@localhost; +drop database mysqldump_myDB; +flush privileges; +# Bug#21424 continues from here. +# Restore. Flush Privileges test ends. +# +connection user1; +use mysqldump_myDB; +select * from mysqldump_myDB.v1; +c1 +3 +select * from mysqldump_myDB.u1; +f1 +4 +connection root; +disconnect user1; +use mysqldump_myDB; +drop view v1; +drop table t1; +drop table u1; +revoke all privileges on mysqldump_myDB.* from myDB_User@localhost; +drop user myDB_User@localhost; +drop database mysqldump_myDB; +connection default; +disconnect root; +use test; +# +# Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the +# information_schema database. +# +# Bug #33762: mysqldump can not dump INFORMATION_SCHEMA +# +DROP TABLE IF EXISTS `TABLES`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TEMPORARY TABLE `TABLES` ( + `TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '', + `TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '', + `TABLE_NAME` varchar(64) NOT NULL DEFAULT '', + `TABLE_TYPE` varchar(64) NOT NULL DEFAULT '', + `ENGINE` varchar(64) DEFAULT NULL, + `VERSION` bigint(21) unsigned DEFAULT NULL, + `ROW_FORMAT` varchar(10) DEFAULT NULL, + `TABLE_ROWS` bigint(21) unsigned DEFAULT NULL, + `AVG_ROW_LENGTH` bigint(21) unsigned DEFAULT NULL, + `DATA_LENGTH` bigint(21) unsigned DEFAULT NULL, + `MAX_DATA_LENGTH` bigint(21) unsigned DEFAULT NULL, + `INDEX_LENGTH` bigint(21) unsigned DEFAULT NULL, + `DATA_FREE` bigint(21) unsigned DEFAULT NULL, + `AUTO_INCREMENT` bigint(21) unsigned DEFAULT NULL, + `CREATE_TIME` datetime DEFAULT NULL, + `UPDATE_TIME` datetime DEFAULT NULL, + `CHECK_TIME` datetime DEFAULT NULL, + `TABLE_COLLATION` varchar(32) DEFAULT NULL, + `CHECKSUM` bigint(21) unsigned DEFAULT NULL, + `CREATE_OPTIONS` varchar(2048) DEFAULT NULL, + `TABLE_COMMENT` varchar(2048) NOT NULL DEFAULT '', + `MAX_INDEX_LENGTH` bigint(21) unsigned DEFAULT NULL, + `TEMPORARY` varchar(1) DEFAULT NULL +) ENGINE=MEMORY DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +# +# Bug#19745 mysqldump --xml produces invalid xml +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (f1 int(10), data MEDIUMBLOB); +INSERT INTO t1 VALUES(1,0xff00fef0); +<?xml version="1.0"?> +<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +<database name="test"> + <table_structure name="t1"> + <field Field="f1" Type="int(10)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + <field Field="data" Type="mediumblob" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + </table_structure> + <table_data name="t1"> + <row> + <field name="f1">1</field> + <field name="data" xsi:type="xs:hexBinary">FF00FEF0</field> + </row> + </table_data> +</database> +</mysqldump> +DROP TABLE t1; +# +# Bug#26346 stack + buffer overrun in mysqldump +# +CREATE TABLE t1(a int); +INSERT INTO t1 VALUES (1), (2); +mysqldump: Input filename too long: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa +DROP TABLE t1; +CREATE TABLE t2 (a INT) ENGINE=MyISAM; +CREATE TABLE t3 (a INT) ENGINE=MyISAM; +CREATE TABLE t1 (a INT) ENGINE=merge UNION=(t2, t3); + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t2`,`t3`); +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `t2`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t2` WRITE; +/*!40000 ALTER TABLE `t2` DISABLE KEYS */; +/*!40000 ALTER TABLE `t2` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `t3`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t3` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t3` WRITE; +/*!40000 ALTER TABLE `t3` DISABLE KEYS */; +/*!40000 ALTER TABLE `t3` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TABLE t1, t2, t3; +# +# Bug#23491 MySQLDump prefix function call in a view by database name +# +create database bug23491_original; +create database bug23491_restore; +use bug23491_original; +create table t1 (c1 int); +create view v1 as select * from t1; +create procedure p1() select 1; +create function f1() returns int return 1; +create view v2 as select f1(); +create function f2() returns int return f1(); +create view v3 as select bug23491_original.f1(); +use bug23491_restore; +show create view bug23491_restore.v2; +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `f1`() AS `f1()` latin1 latin1_swedish_ci +show create view bug23491_restore.v3; +View Create View character_set_client collation_connection +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `bug23491_original`.`f1`() AS `bug23491_original.f1()` latin1 latin1_swedish_ci +drop database bug23491_original; +drop database bug23491_restore; +use test; +# +# Bug#27293 mysqldump crashes when dumping routines +# defined by a different user +# +# Bug#22761 mysqldump reports no errors when using +# --routines without mysql.proc privileges +# +create database mysqldump_test_db; +grant all privileges on mysqldump_test_db.* to user1; +grant all privileges on mysqldump_test_db.* to user2; +connect user27293,localhost,user1,,mysqldump_test_db,$MASTER_MYPORT,$MASTER_MYSOCK; +connection user27293; +create procedure mysqldump_test_db.sp1() select 'hello'; + +-- insufficient privileges to SHOW CREATE PROCEDURE `sp1` +-- does user2 have permissions on mysql.proc? + +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`user1`@`%` PROCEDURE `sp1`() +select 'hello' ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +drop procedure sp1; +connection default; +disconnect user27293; +drop user user1; +drop user user2; +drop database mysqldump_test_db; +# +# Bug#28522 buffer overrun by '\0' byte using --hex-blob. +# +CREATE TABLE t1 (c1 INT, c2 LONGBLOB); +INSERT INTO t1 SET c1=11, c2=REPEAT('q',509); +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL, + `c2` longblob DEFAULT NULL +); +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `t1` VALUES (11,0x7171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171 717171717171717171717171717171717171717171717171717171717171); +DROP TABLE t1; +# +# Bug#28524 mysqldump --skip-add-drop-table is not +# compatible with views +# +CREATE VIEW v1 AS SELECT 1; +DROP VIEW v1; +SELECT * FROM v1; +1 +1 +DROP VIEW v1; +# +# Bug#29788 mysqldump discards the NO_AUTO_VALUE_ON_ZERO value of +# the SQL_MODE variable after the dumping of triggers. +# +CREATE TABLE t1 (c1 INT); +CREATE TRIGGER t1bd BEFORE DELETE ON t1 FOR EACH ROW BEGIN END; +CREATE TABLE t2 (c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY); +SET @TMP_SQL_MODE = @@SQL_MODE; +SET SQL_MODE = 'NO_AUTO_VALUE_ON_ZERO'; +INSERT INTO t2 VALUES (0), (1), (2); +SET SQL_MODE = @TMP_SQL_MODE; +SELECT * FROM t2; +c1 +0 +1 +2 +SELECT * FROM t2; +c1 +0 +1 +2 +DROP TABLE t1,t2; +# +# Bug#29815 new option for suppressing last line of mysqldump: +# "Dump completed on" +# +# --skip-dump-date: +-- + + + +-- Dump completed +# --dump-date: +-- + + + +-- Dump completed on DATE +# --dump-date (default): +-- + + + +-- Dump completed on DATE +# +# Bug #42635: mysqldump includes views that were excluded using +# the --ignore-table option +# +create database db42635; +use db42635; +create table t1 (id int); +create view db42635.v1 (c) as select * from db42635.t1; +create view db42635.v2 (c) as select * from db42635.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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `id` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `v2`; +/*!50001 DROP VIEW IF EXISTS `v2`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `v2` ( + `c` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; +/*!50001 DROP TABLE IF EXISTS `v2`*/; +/*!50001 DROP VIEW IF EXISTS `v2`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v2` AS select `t1`.`id` AS `c` from `t1` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +use test; +drop database db42635; +# +# Bug#33550 mysqldump 4.0 compatibility broken +# +SET NAMES utf8; +CREATE TABLE `straße` ( f1 INT ); +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `straße`; +CREATE TABLE `straße` ( + `f1` int(11) DEFAULT NULL +) TYPE=MyISAM; + +LOCK TABLES `straße` WRITE; +/*!40000 ALTER TABLE `straße` DISABLE KEYS */; +/*!40000 ALTER TABLE `straße` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `stra�e`; +CREATE TABLE `stra�e` ( + `f1` int(11) DEFAULT NULL +) TYPE=MyISAM; + +LOCK TABLES `stra�e` WRITE; +/*!40000 ALTER TABLE `stra�e` DISABLE KEYS */; +/*!40000 ALTER TABLE `stra�e` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TABLE `straße`; +CREATE TABLE `כדשגכחךלדגכחשךדגחכךלדגכ` ( f1 INT ); +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `כדשגכחךלדגכחשךדגחכךלדגכ`; +CREATE TABLE `כדשגכחךלדגכחשךדגחכךלדגכ` ( + `f1` int(11) DEFAULT NULL +) TYPE=MyISAM; + +LOCK TABLES `כדשגכחךלדגכחשךדגחכךלדגכ` WRITE; +/*!40000 ALTER TABLE `כדשגכחךלדגכחשךדגחכךלדגכ` DISABLE KEYS */; +/*!40000 ALTER TABLE `כדשגכחךלדגכחשךדגחכךלדגכ` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE `כדשגכחךלדגכחשךדגחכךלדגכ`; +SET NAMES latin1; +# +# End of 5.0 tests +# +drop table if exists t1; +CREATE TABLE t1(a int, b int); +INSERT INTO t1 VALUES (1,1); +INSERT INTO t1 VALUES (2,3); +INSERT INTO t1 VALUES (3,4), (4,5); + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +REPLACE INTO `t1` VALUES (1,1),(2,3),(3,4),(4,5); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TABLE t1; +create table t1 (a text , b text); +create table t2 (a text , b text); +insert t1 values ("Duck, Duck", "goose"); +insert t1 values ("Duck, Duck", "pidgeon"); +insert t2 values ("We the people", "in order to perform"); +insert t2 values ("a more perfect", "union"); +select * from t1; +a b +Duck, Duck goose +Duck, Duck pidgeon +select * from t2; +a b +We the people in order to perform +a more perfect union +test.t1: Records: 2 Deleted: 0 Skipped: 0 Warnings: 0 +test.t2: Records: 2 Deleted: 0 Skipped: 0 Warnings: 0 +select * from t1; +a b +Duck, Duck goose +Duck, Duck pidgeon +Duck, Duck goose +Duck, Duck pidgeon +select * from t2; +a b +We the people in order to perform +a more perfect union +We the people in order to perform +a more perfect union +create table words(a varchar(255)); +create table words2(b varchar(255)); +select * from t1; +a b +Duck, Duck goose +Duck, Duck pidgeon +Duck, Duck goose +Duck, Duck pidgeon +Duck, Duck goose +Duck, Duck pidgeon +select * from t2; +a b +We the people in order to perform +a more perfect union +We the people in order to perform +a more perfect union +We the people in order to perform +a more perfect union +select * from words; +a +Aarhus +Aaron +Ababa +aback +abaft +abandon +abandoned +abandoning +abandonment +abandons +Aarhus +Aaron +Ababa +aback +abaft +abandon +abandoned +abandoning +abandonment +abandons +abase +abased +abasement +abasements +abases +abash +abashed +abashes +abashing +abasing +abate +abated +abatement +abatements +abater +abates +abating +Abba +abbe +abbey +abbeys +abbot +abbots +Abbott +abbreviate +abbreviated +abbreviates +abbreviating +abbreviation +abbreviations +Abby +abdomen +abdomens +abdominal +abduct +abducted +abduction +abductions +abductor +abductors +abducts +Abe +abed +Abel +Abelian +Abelson +Aberdeen +Abernathy +aberrant +aberration +select * from words2; +b +abase +abased +abasement +abasements +abases +abash +abashed +abashes +abashing +abasing +abate +abated +abatement +abatements +abater +abates +abating +Abba +abbe +abbey +abbeys +abbot +abbots +Abbott +abbreviate +abbreviated +abbreviates +abbreviating +abbreviation +abbreviations +Abby +abdomen +abdomens +abdominal +abduct +abducted +abduction +abductions +abductor +abductors +abducts +Abe +abed +Abel +Abelian +Abelson +Aberdeen +Abernathy +aberrant +aberration +drop table words; +drop table t1; +drop table t2; +drop table words2; +# +# Bug#16853 mysqldump doesn't show events +# +create database first; +use first; +set time_zone = 'UTC'; +create event ee1 on schedule at '2035-12-31 20:01:23' do set @a=5; ++Warnings: ++Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. +show events; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +first ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +show create event ee1; +Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation +ee1 UTC CREATE DEFINER=`root`@`localhost` EVENT `ee1` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5 latin1 latin1_swedish_ci latin1_swedish_ci +drop database first; +create database second; +use second; +show events; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +show create event ee1; +Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation +ee1 UTC CREATE DEFINER=`root`@`localhost` EVENT `ee1` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5 latin1 latin1_swedish_ci latin1_swedish_ci +create event ee2 on schedule at '2030-12-31 21:01:22' do set @a=5; ++Warnings: ++Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. +create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5; ++Warnings: ++Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. +show events; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +second ee2 root@localhost UTC ONE TIME 2030-12-31 21:01:22 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +second ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +drop database second; +create database third; +use third; +show events; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +third ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +third ee2 root@localhost UTC ONE TIME 2030-12-31 21:01:22 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +third ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +drop database third; +set time_zone = 'SYSTEM'; +use test; +# +# Bug#17201 Spurious 'DROP DATABASE' in output, +# also confusion between tables and views. +# Example code from Markus Popp +# +create database mysqldump_test_db; +use mysqldump_test_db; +create table t1 (id int); +create view v1 as select * from t1; +insert into t1 values (1232131); +insert into t1 values (4711); +insert into t1 values (3231); +insert into t1 values (0815); + +/*!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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +/*!40000 DROP DATABASE IF EXISTS `mysqldump_test_db`*/; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_test_db` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `mysqldump_test_db`; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `id` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES (1232131),(4711),(3231),(815); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +DROP TABLE IF EXISTS `v1`; +/*!50001 DROP VIEW IF EXISTS `v1`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `v1` ( + `id` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +USE `mysqldump_test_db`; +/*!50001 DROP TABLE IF EXISTS `v1`*/; +/*!50001 DROP VIEW IF EXISTS `v1`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v1` AS select `t1`.`id` AS `id` from `t1` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +drop view v1; +drop table t1; +drop database mysqldump_test_db; +# +# Bug#30027 mysqldump does not dump views properly. +# + +# Cleanup. +DROP DATABASE IF EXISTS mysqldump_test_db; + +# Create objects. +CREATE DATABASE mysqldump_test_db; +set names koi8r; +CREATE VIEW mysqldump_test_db.v2 AS SELECT 1 AS �������1; +CREATE VIEW mysqldump_test_db.v1 AS SELECT �������1 FROM mysqldump_test_db.v2; +set names latin1; + +# Dump mysqldump_test_db to bug30027.sql. + +# Drop mysqldump_test_db. +DROP DATABASE mysqldump_test_db; + +# Restore mysqldump_test_db from bug30027.sql. + +# Check the view. +set names utf8; +SHOW CREATE VIEW mysqldump_test_db.v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqldump_test_db`.`v1` AS select `v2`.`колонка1` AS `колонка1` from `mysqldump_test_db`.`v2` koi8r koi8r_general_ci +SHOW CREATE VIEW mysqldump_test_db.v2; +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqldump_test_db`.`v2` AS select 1 AS `колонка1` koi8r koi8r_general_ci +set names latin1; + +# Cleanup. +DROP DATABASE mysqldump_test_db; +# +# Bug#29938 wrong behavior of mysqldump --skip-events +# with --all-databases +# +TRUNCATE mysql.event; +USE test; +CREATE event e29938 ON SCHEDULE AT '2035-12-31 20:01:23' DO SET @bug29938=29938; ++Warnings: ++Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. +SHOW EVENTS; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +test e29938 root@localhost SYSTEM ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +TRUNCATE mysql.event; +SHOW EVENTS; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +# +# MDEV-13336: add ignore-database option +# with --all-databases +# +DROP DATABASE test; +SHOW DATABASES LIKE 'test'; +Database (test) +CREATE DATABASE test; +# +# Bug#31113 mysqldump 5.1 can't handle a dash ("-") in database names +# +create database `test-database`; +use `test-database`; +create table test (a int); +DROP TABLE IF EXISTS `test`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `test` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +LOCK TABLES `test` WRITE; +/*!40000 ALTER TABLE `test` DISABLE KEYS */; +/*!40000 ALTER TABLE `test` ENABLE KEYS */; +UNLOCK TABLES; +drop database `test-database`; +use test; + +# ----------------------------------------------------------------- +# -- Bug#30217 Views: changes in metadata behaviour between 5.0 and 5.1. +# ----------------------------------------------------------------- + +DROP DATABASE IF EXISTS mysqldump_test_db; +CREATE DATABASE mysqldump_test_db; +use mysqldump_test_db; + +CREATE VIEW v1(x, y) AS SELECT 'a', 'a'; + +SELECT view_definition +FROM INFORMATION_SCHEMA.VIEWS +WHERE table_schema = 'mysqldump_test_db' AND table_name = 'v1'; +view_definition +select 'a' AS `x`,'a' AS `y` + +---> Dumping mysqldump_test_db to bug30217.sql + +DROP DATABASE mysqldump_test_db; +use test; + +---> Restoring mysqldump_test_db... + +SELECT view_definition +FROM INFORMATION_SCHEMA.VIEWS +WHERE table_schema = 'mysqldump_test_db' AND table_name = 'v1'; +view_definition +select 'a' AS `x`,'a' AS `y` + +DROP DATABASE mysqldump_test_db; + +# -- End of test case for Bug#32538. + +# +# Bug#37377 Incorrect DROP TABLE statement in dump of a VIEW using --tab +# +create table t1 (a int); +create view v1 as select a from t1; +drop view v1; +drop table t1; +drop view v1; +drop table t1; +# +# Bug#28071 mysqlimport does not quote or escape table name +# +drop table if exists `load`; +create table `load` (a varchar(255)); +test.load: Records: 70 Deleted: 0 Skipped: 0 Warnings: 0 +select count(*) from `load`; +count(*) +70 +drop table `load`; +SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT; + +Bug #34861 - mysqldump with --tab gives weird output for triggers. + +CREATE TABLE t1 (f1 INT); +CREATE TRIGGER tr1 BEFORE UPDATE ON t1 FOR EACH ROW SET @f1 = 1; +CREATE PROCEDURE pr1 () SELECT "Meow"; +CREATE EVENT ev1 ON SCHEDULE AT '2030-01-01 00:00:00' DO SELECT "Meow"; ++Warnings: ++Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. + +SHOW TRIGGERS; +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +tr1 UPDATE t1 SET @f1 = 1 BEFORE # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +SHOW EVENTS; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +test ev1 root@localhost SYSTEM ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +SELECT name,body FROM mysql.proc WHERE NAME = 'pr1'; +name body +pr1 SELECT "Meow" + +dump table; if anything goes to stdout, it ends up here: --------------- + +drop everything +DROP EVENT ev1; +DROP TRIGGER tr1; +DROP TABLE t1; +DROP PROCEDURE pr1; + +reload table; this should restore table and trigger +SHOW TRIGGERS; +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +tr1 UPDATE t1 SET @f1 = 1 BEFORE # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +SHOW EVENTS; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +SELECT name,body FROM mysql.proc WHERE NAME = 'pr1'; +name body + +reload db; this should restore routines and events +SHOW TRIGGERS; +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +tr1 UPDATE t1 SET @f1 = 1 BEFORE # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +SHOW EVENTS; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +test ev1 root@localhost SYSTEM ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +SELECT name,body FROM mysql.proc WHERE NAME = 'pr1'; +name body +pr1 SELECT "Meow" + +cleanup +DROP EVENT IF EXISTS ev1; +DROP PROCEDURE IF EXISTS pr1; +DROP TRIGGER IF EXISTS tr1; +DROP TABLE IF EXISTS t1; +# +# Bug #30946: mysqldump silently ignores --default-character-set +# when used with --tab +# +# Also see outfile_loaddata.test +# +SET NAMES utf8; +CREATE TABLE t1 (a INT, b CHAR(10) CHARSET koi8r, c CHAR(10) CHARSET latin1); +CREATE TABLE t2 LIKE t1; +INSERT INTO t1 VALUES (1, 'ABC-АБВ', 'DEF-ÂÃÄ'), (2, NULL, NULL); +# error on multi-character ENCLOSED/ESCAPED BY +# default '--default-charset' (binary): +################################################## +1 ABC-��� DEF-��� +2 \N \N +################################################## +TRUNCATE t2; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary; +SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c; +a b c +1 ABC-АБВ DEF-ÂÃÄ +2 NULL NULL +# utf8: +################################################## +1 ABC-АБВ DEF-ÂÃÄ +2 \N \N +################################################## +TRUNCATE t2; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET utf8; +SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c; +a b c +1 ABC-АБВ DEF-ÂÃÄ +2 NULL NULL +# latin1 (data corruption is expected): +################################################## +1 ABC-??? DEF-��� +2 \N \N +################################################## +TRUNCATE t2; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET latin1 ; +SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c; +a b c +1 ABC-??? DEF-ÂÃÄ +1 ABC-АБВ DEF-ÂÃÄ +2 NULL NULL +# koi8r (data corruption is expected): +################################################## +1 ABC-��� DEF-??? +2 \N \N +################################################## +TRUNCATE t2; +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET koi8r; +SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c; +a b c +1 ABC-АБВ DEF-??? +1 ABC-АБВ DEF-ÂÃÄ +2 NULL NULL +SET NAMES default; +DROP TABLE t1, t2; +# +# Bug #53088: mysqldump with -T & --default-character-set set +# truncates text/blob to 766 chars +# +# Also see outfile_loaddata.test +# +CREATE TABLE t1 (a BLOB) CHARSET latin1; +CREATE TABLE t2 LIKE t1; +INSERT INTO t1 VALUES (REPEAT('.', 800)); +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET latin1; +# should be 800 +SELECT LENGTH(a) FROM t2; +LENGTH(a) +800 +DROP TABLE t1, t2; +# +# Bug #13618 : mysqldump --xml ommit comment on table field +# +CREATE TABLE `comment_table` (i INT COMMENT 'FIELD COMMENT') COMMENT = 'TABLE COMMENT'; +<?xml version="1.0"?> +<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +<database name="test"> + <table_structure name="comment_table"> + <field Field="i" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="FIELD COMMENT" /> + </table_structure> + <table_data name="comment_table"> + </table_data> +</database> +</mysqldump> +DROP TABLE `comment_table`; +# +# BUG#11766310 : 59398: MYSQLDUMP 5.1 CAN'T HANDLE A DASH ("-") IN +# DATABASE NAMES IN ALTER DATABASE +# +CREATE DATABASE `test-database`; +USE `test-database`; +CREATE TABLE `test` (`c1` VARCHAR(10)) ENGINE=MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +CREATE TRIGGER `trig` BEFORE INSERT ON `test` FOR EACH ROW BEGIN +END | +ALTER DATABASE `test-database` CHARACTER SET latin1 COLLATE latin1_swedish_ci; +ALTER DATABASE `test-database` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `test` ( + `c1` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +ALTER DATABASE `test-database` CHARACTER SET latin1 COLLATE latin1_swedish_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `trig` BEFORE INSERT ON `test` FOR EACH ROW BEGIN +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE `test-database` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +DROP DATABASE `test-database`; +USE test; +# +# BUG#11760384 : 52792: mysqldump in XML mode does not dump routines. +# +CREATE DATABASE BUG52792; +USE BUG52792; +CREATE TABLE t1 (c1 INT, c2 VARCHAR(20)); +CREATE TABLE t2 (c1 INT); +INSERT INTO t1 VALUES (1, 'aaa'), (2, 'bbb'), (3, 'ccc'); +INSERT INTO t2 VALUES (1),(2),(3); +# Stored Procedures. +CREATE PROCEDURE simpleproc1 (OUT param1 INT) +BEGIN +SELECT COUNT(*) INTO param1 FROM t1; +END// +CREATE PROCEDURE simpleproc2 (OUT param1 INT) +BEGIN +SELECT COUNT(*) INTO param1 FROM t2; +END// +# Events. +CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE BUG52792; ++Warnings: ++Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. +CREATE EVENT e2 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE BUG52792; ++Warnings: ++Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. +# Functions. +CREATE FUNCTION `hello1` (s CHAR(20)) +RETURNS CHAR(50) DETERMINISTIC +RETURN CONCAT('Hello, ' ,s ,'!'); +CREATE FUNCTION `hello2` (s CHAR(20)) +RETURNS CHAR(50) DETERMINISTIC +RETURN CONCAT(']]>, ' , s ,'!'); +# Triggers. +CREATE TRIGGER trig1 BEFORE INSERT ON t2 +FOR EACH ROW BEGIN +INSERT INTO t2 VALUES(1); +END; +| +CREATE TRIGGER trig2 AFTER INSERT ON t2 +FOR EACH ROW BEGIN +INSERT INTO t2 VALUES(1, ']]>'); +INSERT INTO t2 VALUES(2, '<![CDATA]]>'); +INSERT INTO t2 VALUES(3, '<![CDATA['); +INSERT INTO t2 VALUES(4, '< > & \ " _'); +END; +| +# Views +CREATE VIEW v1 AS SELECT * FROM t1; +CREATE VIEW v2 AS SELECT * FROM t2; + +# Dumping BUG52792 database in xml format. + +# Running 'replace_regex on timestamp' +<?xml version="1.0"?> +<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +<database name="BUG52792"> + <table_structure name="t1"> + <field Field="c1" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + <field Field="c2" Type="varchar(20)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + <options Name="t1" Engine="MyISAM" Version="10" Row_format="Dynamic" Rows="3" Avg_row_length="20" Data_length="60" Max_data_length="281474976710655" Index_length="1024" Data_free="0" Create_time="--TIME--" Update_time="--TIME--" Collation="latin1_swedish_ci" Create_options="" Comment="" Max_index_length="17179868160" Temporary="N" /> + </table_structure> + <table_data name="t1"> + <row> + <field name="c1">1</field> + <field name="c2">aaa</field> + </row> + <row> + <field name="c1">2</field> + <field name="c2">bbb</field> + </row> + <row> + <field name="c1">3</field> + <field name="c2">ccc</field> + </row> + </table_data> + <table_structure name="t2"> + <field Field="c1" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + <options Name="t2" Engine="MyISAM" Version="10" Row_format="Fixed" Rows="3" Avg_row_length="7" Data_length="21" Max_data_length="1970324836974591" Index_length="1024" Data_free="0" Create_time="--TIME--" Update_time="--TIME--" Collation="latin1_swedish_ci" Create_options="" Comment="" Max_index_length="17179868160" Temporary="N" /> + </table_structure> + <table_data name="t2"> + <row> + <field name="c1">1</field> + </row> + <row> + <field name="c1">2</field> + </row> + <row> + <field name="c1">3</field> + </row> + </table_data> + <triggers name="t2"> + <trigger Trigger="trig1" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci" Created="--TIME--"> +<![CDATA[ +CREATE DEFINER=`root`@`localhost` TRIGGER trig1 BEFORE INSERT ON t2 +FOR EACH ROW BEGIN +INSERT INTO t2 VALUES(1); +END +]]> + </trigger> + <trigger Trigger="trig2" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci" Created="--TIME--"> +<![CDATA[ +CREATE DEFINER=`root`@`localhost` TRIGGER trig2 AFTER INSERT ON t2 +FOR EACH ROW BEGIN +INSERT INTO t2 VALUES(1, ']]]]><![CDATA[>'); +INSERT INTO t2 VALUES(2, '<![CDATA]]]]><![CDATA[>'); +INSERT INTO t2 VALUES(3, '<![CDATA['); +INSERT INTO t2 VALUES(4, '< > & \ " _'); +END +]]> + </trigger> + </triggers> + <table_structure name="v1"> + <field Field="c1" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + <field Field="c2" Type="varchar(20)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + <options Name="v1" Comment="VIEW" /> + </table_structure> + <table_structure name="v2"> + <field Field="c1" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + <options Name="v2" Comment="VIEW" /> + </table_structure> + <events> + <event Event="e1" sql_mode="" time_zone="SYSTEM" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci"> +<![CDATA[ +CREATE DEFINER=`root`@`localhost` EVENT `e1` ON SCHEDULE EVERY 1 SECOND STARTS '--TIME--' ON COMPLETION NOT PRESERVE ENABLE DO DROP DATABASE BUG52792 +]]> + </event> + <event Event="e2" sql_mode="" time_zone="SYSTEM" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci"> +<![CDATA[ +CREATE DEFINER=`root`@`localhost` EVENT `e2` ON SCHEDULE EVERY 1 SECOND STARTS '--TIME--' ON COMPLETION NOT PRESERVE ENABLE DO DROP DATABASE BUG52792 +]]> + </event> + </events> + <routines> + <routine Function="hello1" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci"> +<![CDATA[ +CREATE DEFINER=`root`@`localhost` FUNCTION `hello1`(s CHAR(20)) RETURNS char(50) CHARSET latin1 + DETERMINISTIC +RETURN CONCAT('Hello, ' ,s ,'!') +]]> + </routine> + <routine Function="hello2" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci"> +<![CDATA[ +CREATE DEFINER=`root`@`localhost` FUNCTION `hello2`(s CHAR(20)) RETURNS char(50) CHARSET latin1 + DETERMINISTIC +RETURN CONCAT(']]]]><![CDATA[>, ' , s ,'!') +]]> + </routine> + <routine Procedure="simpleproc1" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci"> +<![CDATA[ +CREATE DEFINER=`root`@`localhost` PROCEDURE `simpleproc1`(OUT param1 INT) +BEGIN +SELECT COUNT(*) INTO param1 FROM t1; +END +]]> + </routine> + <routine Procedure="simpleproc2" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci"> +<![CDATA[ +CREATE DEFINER=`root`@`localhost` PROCEDURE `simpleproc2`(OUT param1 INT) +BEGIN +SELECT COUNT(*) INTO param1 FROM t2; +END +]]> + </routine> + </routines> +</database> +</mysqldump> + +# Dumping BUG52792 database in xml format with comments. + +# Running 'replace_regex on timestamp' +<?xml version="1.0"?> +<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +<database name="BUG52792"> +<!-- +- +- Table structure for table `t1` +- + + --> + <table_structure name="t1"> + <field Field="c1" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + <field Field="c2" Type="varchar(20)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + <options Name="t1" Engine="MyISAM" Version="10" Row_format="Dynamic" Rows="3" Avg_row_length="20" Data_length="60" Max_data_length="281474976710655" Index_length="1024" Data_free="0" Create_time="--TIME--" Update_time="--TIME--" Collation="latin1_swedish_ci" Create_options="" Comment="" Max_index_length="17179868160" Temporary="N" /> + </table_structure> +<!-- +- +- Dumping data for table `t1` +- + --> + <table_data name="t1"> + <row> + <field name="c1">1</field> + <field name="c2">aaa</field> + </row> + <row> + <field name="c1">2</field> + <field name="c2">bbb</field> + </row> + <row> + <field name="c1">3</field> + <field name="c2">ccc</field> + </row> + </table_data> +<!-- +- +- Table structure for table `t2` +- + + --> + <table_structure name="t2"> + <field Field="c1" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + <options Name="t2" Engine="MyISAM" Version="10" Row_format="Fixed" Rows="3" Avg_row_length="7" Data_length="21" Max_data_length="1970324836974591" Index_length="1024" Data_free="0" Create_time="--TIME--" Update_time="--TIME--" Collation="latin1_swedish_ci" Create_options="" Comment="" Max_index_length="17179868160" Temporary="N" /> + </table_structure> +<!-- +- +- Dumping data for table `t2` +- + --> + <table_data name="t2"> + <row> + <field name="c1">1</field> + </row> + <row> + <field name="c1">2</field> + </row> + <row> + <field name="c1">3</field> + </row> + </table_data> + <triggers name="t2"> + <trigger Trigger="trig1" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci" Created="--TIME--"> +<![CDATA[ +CREATE DEFINER=`root`@`localhost` TRIGGER trig1 BEFORE INSERT ON t2 +FOR EACH ROW BEGIN +INSERT INTO t2 VALUES(1); +END +]]> + </trigger> + <trigger Trigger="trig2" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci" Created="--TIME--"> +<![CDATA[ +CREATE DEFINER=`root`@`localhost` TRIGGER trig2 AFTER INSERT ON t2 +FOR EACH ROW BEGIN +INSERT INTO t2 VALUES(1, ']]]]><![CDATA[>'); +INSERT INTO t2 VALUES(2, '<![CDATA]]]]><![CDATA[>'); +INSERT INTO t2 VALUES(3, '<![CDATA['); +INSERT INTO t2 VALUES(4, '< > & \ " _'); +END +]]> + </trigger> + </triggers> +<!-- +- +- Table structure for table `v1` +- + + --> + <table_structure name="v1"> + <field Field="c1" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + <field Field="c2" Type="varchar(20)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + <options Name="v1" Comment="VIEW" /> + </table_structure> +<!-- +- +- Table structure for table `v2` +- + + --> + <table_structure name="v2"> + <field Field="c1" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + <options Name="v2" Comment="VIEW" /> + </table_structure> +<!-- +- +- Dumping events for database 'BUG52792' +- + --> + <events> + <event Event="e1" sql_mode="" time_zone="SYSTEM" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci"> +<![CDATA[ +CREATE DEFINER=`root`@`localhost` EVENT `e1` ON SCHEDULE EVERY 1 SECOND STARTS '--TIME--' ON COMPLETION NOT PRESERVE ENABLE DO DROP DATABASE BUG52792 +]]> + </event> + <event Event="e2" sql_mode="" time_zone="SYSTEM" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci"> +<![CDATA[ +CREATE DEFINER=`root`@`localhost` EVENT `e2` ON SCHEDULE EVERY 1 SECOND STARTS '--TIME--' ON COMPLETION NOT PRESERVE ENABLE DO DROP DATABASE BUG52792 +]]> + </event> + </events> +<!-- +- +- Dumping routines for database 'BUG52792' +- + --> + <routines> + <routine Function="hello1" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci"> +<![CDATA[ +CREATE DEFINER=`root`@`localhost` FUNCTION `hello1`(s CHAR(20)) RETURNS char(50) CHARSET latin1 + DETERMINISTIC +RETURN CONCAT('Hello, ' ,s ,'!') +]]> + </routine> + <routine Function="hello2" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci"> +<![CDATA[ +CREATE DEFINER=`root`@`localhost` FUNCTION `hello2`(s CHAR(20)) RETURNS char(50) CHARSET latin1 + DETERMINISTIC +RETURN CONCAT(']]]]><![CDATA[>, ' , s ,'!') +]]> + </routine> + <routine Procedure="simpleproc1" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci"> +<![CDATA[ +CREATE DEFINER=`root`@`localhost` PROCEDURE `simpleproc1`(OUT param1 INT) +BEGIN +SELECT COUNT(*) INTO param1 FROM t1; +END +]]> + </routine> + <routine Procedure="simpleproc2" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci"> +<![CDATA[ +CREATE DEFINER=`root`@`localhost` PROCEDURE `simpleproc2`(OUT param1 INT) +BEGIN +SELECT COUNT(*) INTO param1 FROM t2; +END +]]> + </routine> + </routines> +</database> +</mysqldump> + +# Test to check 'Insufficient privileges' error. + +GRANT ALL PRIVILEGES ON BUG52792.* TO user1; +connect conn_1, localhost, user1, , BUG52792, $MASTER_MYPORT, $MASTER_MYSOCK; +connection conn_1; +# Running 'replace_regex on timestamp' +<?xml version="1.0"?> +<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +<database name="BUG52792"> + <table_structure name="t1"> + <field Field="c1" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + <field Field="c2" Type="varchar(20)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + <options Name="t1" Engine="MyISAM" Version="10" Row_format="Dynamic" Rows="3" Avg_row_length="20" Data_length="60" Max_data_length="281474976710655" Index_length="1024" Data_free="0" Create_time="--TIME--" Update_time="--TIME--" Collation="latin1_swedish_ci" Create_options="" Comment="" Max_index_length="17179868160" Temporary="N" /> + </table_structure> + <table_data name="t1"> + <row> + <field name="c1">1</field> + <field name="c2">aaa</field> + </row> + <row> + <field name="c1">2</field> + <field name="c2">bbb</field> + </row> + <row> + <field name="c1">3</field> + <field name="c2">ccc</field> + </row> + </table_data> + <table_structure name="t2"> + <field Field="c1" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + <options Name="t2" Engine="MyISAM" Version="10" Row_format="Fixed" Rows="3" Avg_row_length="7" Data_length="21" Max_data_length="1970324836974591" Index_length="1024" Data_free="0" Create_time="--TIME--" Update_time="--TIME--" Collation="latin1_swedish_ci" Create_options="" Comment="" Max_index_length="17179868160" Temporary="N" /> + </table_structure> + <table_data name="t2"> + <row> + <field name="c1">1</field> + </row> + <row> + <field name="c1">2</field> + </row> + <row> + <field name="c1">3</field> + </row> + </table_data> + <triggers name="t2"> + <trigger Trigger="trig1" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci" Created="--TIME--"> +<![CDATA[ +CREATE DEFINER=`root`@`localhost` TRIGGER trig1 BEFORE INSERT ON t2 +FOR EACH ROW BEGIN +INSERT INTO t2 VALUES(1); +END +]]> + </trigger> + <trigger Trigger="trig2" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci" Created="--TIME--"> +<![CDATA[ +CREATE DEFINER=`root`@`localhost` TRIGGER trig2 AFTER INSERT ON t2 +FOR EACH ROW BEGIN +INSERT INTO t2 VALUES(1, ']]]]><![CDATA[>'); +INSERT INTO t2 VALUES(2, '<![CDATA]]]]><![CDATA[>'); +INSERT INTO t2 VALUES(3, '<![CDATA['); +INSERT INTO t2 VALUES(4, '< > & \ " _'); +END +]]> + </trigger> + </triggers> + <table_structure name="v1"> + <field Field="c1" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + <field Field="c2" Type="varchar(20)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + <options Name="v1" Comment="VIEW" /> + </table_structure> + <table_structure name="v2"> + <field Field="c1" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + <options Name="v2" Comment="VIEW" /> + </table_structure> + <events> + <event Event="e1" sql_mode="" time_zone="SYSTEM" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci"> +<![CDATA[ +CREATE DEFINER=`root`@`localhost` EVENT `e1` ON SCHEDULE EVERY 1 SECOND STARTS '--TIME--' ON COMPLETION NOT PRESERVE ENABLE DO DROP DATABASE BUG52792 +]]> + </event> + <event Event="e2" sql_mode="" time_zone="SYSTEM" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci"> +<![CDATA[ +CREATE DEFINER=`root`@`localhost` EVENT `e2` ON SCHEDULE EVERY 1 SECOND STARTS '--TIME--' ON COMPLETION NOT PRESERVE ENABLE DO DROP DATABASE BUG52792 +]]> + </event> + </events> + <routines> +<!-- +- insufficient privileges to SHOW CREATE FUNCTION `hello1` + --> +<!-- - does user1 have permissions on mysql.proc? + + --> +connection default; +disconnect conn_1; +DROP USER user1; +DROP DATABASE BUG52792; +# UTF-8 +CREATE DATABASE BUG52792; +USE BUG52792; +SET NAMES utf8; +CREATE FUNCTION `straße` ( c1 CHAR(20)) +RETURNS CHAR(50) DETERMINISTIC +RETURN CONCAT(']]>, ', s, '!'); +<?xml version="1.0"?> +<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +<database name="BUG52792"> + <routines> + <routine Function="straße" sql_mode="" character_set_client="utf8" collation_connection="utf8_general_ci" Database_Collation="latin1_swedish_ci"> +<![CDATA[ +CREATE DEFINER=`root`@`localhost` FUNCTION `straße`( c1 CHAR(20)) RETURNS char(50) CHARSET latin1 + DETERMINISTIC +RETURN CONCAT(']]]]><![CDATA[>, ', s, '!') +]]> + </routine> + </routines> +</database> +</mysqldump> +DROP DATABASE BUG52792; +USE test; +# +# End of 5.1 tests +# +# +# Verify that two modes can be given in --compatible; +# and are reflected in SET SQL_MODE in the mysqldump output. +# Also verify that a prefix of the mode's name is enough. +# +CREATE TABLE t1 (a INT); +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!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,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +); +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TABLE t1; +# +# Bug#12809202 61854: MYSQLDUMP --SINGLE-TRANSACTION --FLUSH-LOG BREAKS +# CONSISTENCY +# +DROP DATABASE IF EXISTS b12809202_db; +CREATE DATABASE b12809202_db; +CREATE TABLE b12809202_db.t1 (c1 INT); +CREATE TABLE b12809202_db.t2 (c1 INT); +INSERT INTO b12809202_db.t1 VALUES (1), (2), (3); +INSERT INTO b12809202_db.t2 VALUES (1), (2), (3); +# Starting mysqldump with --single-transaction & --flush-logs options.. +# Note : In the following dump the transaction +# should start only after the logs are +# flushed, as 'flush logs' causes implicit +# commit starting 5.5. + +#### Dump starts here #### +-- Connecting to localhost... +-- main : logs flushed successfully! +-- Starting transaction... +-- Setting savepoint... +-- Retrieving table structure for table t1... +-- Sending SELECT query... +-- Retrieving rows... +-- Rolling back to savepoint sp... +-- Retrieving table structure for table t2... +-- Sending SELECT query... +-- Retrieving rows... +-- Rolling back to savepoint sp... +-- Releasing savepoint... +-- Disconnecting from localhost... + +#### Dump ends here #### +DROP TABLE b12809202_db.t1; +DROP TABLE b12809202_db.t2; +DROP DATABASE b12809202_db; +# +# Delete all existing binary logs. +# +RESET MASTER; +# +# Bug#45740 MYSQLDUMP DOESN'T DUMP GENERAL_LOG AND SLOW_QUERY CAUSES RESTORE PROBLEM +# +SET @old_log_output_state= @@global.log_output; +SET @old_general_log_state= @@global.general_log; +SET @old_slow_query_log_state= @@global.slow_query_log; +call mtr.add_suppression("Failed to write to mysql.general_log"); +SET @@global.log_output="TABLE"; +SET @@global.general_log='OFF'; +SET @@global.slow_query_log='OFF'; +DROP DATABASE mysql; +SHOW CREATE TABLE mysql.general_log; +Table Create Table +general_log CREATE TABLE `general_log` ( + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `user_host` mediumtext NOT NULL, + `thread_id` bigint(21) unsigned NOT NULL, + `server_id` int(10) unsigned NOT NULL, + `command_type` varchar(64) NOT NULL, + `argument` mediumtext NOT NULL +) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log' +SHOW CREATE TABLE mysql.slow_log; +Table Create Table +slow_log CREATE TABLE `slow_log` ( + `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `user_host` mediumtext NOT NULL, + `query_time` time(6) NOT NULL, + `lock_time` time(6) NOT NULL, + `rows_sent` int(11) NOT NULL, + `rows_examined` int(11) NOT NULL, + `db` varchar(512) NOT NULL, + `last_insert_id` int(11) NOT NULL, + `insert_id` int(11) NOT NULL, + `server_id` int(10) unsigned NOT NULL, + `sql_text` mediumtext NOT NULL, + `thread_id` bigint(21) unsigned NOT NULL, + `rows_affected` int(11) NOT NULL +) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' +SET @@global.log_output= @old_log_output_state; +SET @@global.slow_query_log= @old_slow_query_log_state; +SET @@global.general_log= @old_general_log_state; +# MDEV-5481 mysqldump fails to dump geometry types properly +create table t1 (g GEOMETRY) CHARSET koi8r; +create table t2 (g GEOMETRY) CHARSET koi8r; +insert into t1 values (point(1,1)), (point(2,2)); +################################################## +\0\0\0\0\0\0\0\0\0\0\0\0\0�?\0\0\0\0\0\0�? +\0\0\0\0\0\0\0\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@ +################################################## +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET koi8r; +select astext(g) from t2; +astext(g) +POINT(1 1) +POINT(2 2) +drop table t1, t2; +# +# End of 5.1 tests +# +# +# Bug #20772273 : MYSQLIMPORT --USE-THREADS DOESN'T USE MULTIPLE THREADS +# +CREATE DATABASE db_20772273; +USE db_20772273; +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES (1), (2); +CREATE TABLE t2(a INT); +INSERT INTO t2 VALUES (3), (4); +SELECT * FROM t1; +a +1 +2 +SELECT * FROM t2; +a +3 +4 +SELECT * FROM t1; +a +1 +2 +SELECT * FROM t2; +a +3 +4 +DROP TABLE t1; +DROP TABLE t2; +DROP DATABASE db_20772273; +USE test; +# +# Bug #25717383: MYSQLDUMP MAY EXECUTE ANY ARBITRARY QUERY +# +CREATE DATABASE bug25717383; +use bug25717383; +CREATE TABLE `tab +one` (a int); +CREATE VIEW `view +one` as SELECT * FROM `tab +one`; +CREATE PROCEDURE `proc +one`() SELECT * from `tab +one`; +CREATE TEMPORARY TABLE `temp +one` (id INT); +CREATE TRIGGER `trig +one` BEFORE INSERT ON `tab +one` FOR EACH ROW SET NEW.a = 1; +CREATE EVENT `event +one` ON SCHEDULE AT '2030-01-01 00:00:00' DO SET @a=5; ++Warnings: ++Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. +SHOW TABLES FROM bug25717383; +Tables_in_bug25717383 +tab +one +view +one +SHOW TRIGGERS FROM bug25717383; +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +trig +one INSERT tab +one SET NEW.a = 1 BEFORE # root@localhost utf8 utf8_general_ci latin1_swedish_ci +SHOW EVENTS FROM bug25717383; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +bug25717383 event +one root@localhost SYSTEM ONE TIME # NULL NULL NULL NULL ENABLED 1 utf8 utf8_general_ci latin1_swedish_ci +SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES +WHERE ROUTINE_SCHEMA='bug25717383' AND ROUTINE_TYPE= 'PROCEDURE' + ORDER BY ROUTINE_NAME; +ROUTINE_NAME +proc +one +SHOW TABLES FROM bug25717383; +Tables_in_bug25717383 +tab +one +view +one +SHOW TRIGGERS FROM bug25717383; +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +trig +one INSERT tab +one SET NEW.a = 1 BEFORE # root@localhost utf8 utf8_general_ci latin1_swedish_ci +SHOW EVENTS FROM bug25717383; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +bug25717383 event +one root@localhost SYSTEM ONE TIME # NULL NULL NULL NULL ENABLED 1 utf8 utf8_general_ci latin1_swedish_ci +SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES +WHERE ROUTINE_SCHEMA='bug25717383' AND ROUTINE_TYPE= 'PROCEDURE' + ORDER BY ROUTINE_NAME; +ROUTINE_NAME +proc +one +DROP DATABASE bug25717383; +Usage: mysqldump [OPTIONS] database [tables] +OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...] +OR mysqldump [OPTIONS] --all-databases [OPTIONS] +For more options, use mysqldump --help +# +# MDEV-9001 - [PATCH] Fix DB name quoting in mysqldump --routine +# +CREATE DATABASE `a\"'``b`; +USE `a\"'``b`; +CREATE PROCEDURE p1() BEGIN END; +ALTER DATABASE `a\"'``b` COLLATE utf8_general_ci; +ALTER DATABASE `a\"'``b` CHARACTER SET latin1 COLLATE latin1_swedish_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() +BEGIN END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE `a\"'``b` CHARACTER SET utf8 COLLATE utf8_general_ci ; +DROP DATABASE `a\"'``b`; +use test; +# +# Test mysqldump with --disable-query-logs +# +create table t1 (a int); +insert into t1 values (1); +drop table t1; +select * from t1; +a +1 +drop table t1; +# +# MDEV-9124 mysqldump does not dump data if table name is same as view earlier on +# +CREATE DATABASE db1 CHARSET=utf8; +CREATE DATABASE db2 CHARSET=utf8; +USE db2; +CREATE TABLE nonunique_table_name (i1 serial) ENGINE=MEMORY; +INSERT INTO nonunique_table_name VALUES (1),(2); +CREATE TABLE nonunique_table_view_name (i2 int) ENGINE=InnoDB; +INSERT INTO nonunique_table_view_name VALUES (3),(4); +use db1; +CREATE TABLE basetable (id smallint) ENGINE=MyISAM; +CREATE TABLE nonunique_table_name (i3 smallint) ENGINE=MERGE UNION (basetable) INSERT_METHOD=LAST; +INSERT INTO nonunique_table_name VALUES (5),(6); +CREATE VIEW nonunique_table_view_name AS SELECT 1; + +################################################## +# --compact --databases db1 db2 + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `db1` /*!40100 DEFAULT CHARACTER SET utf8 */; + +USE `db1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `basetable` ( + `id` smallint(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `basetable` VALUES (5),(6); +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `nonunique_table_name` ( + `i3` smallint(6) DEFAULT NULL +) ENGINE=MRG_MyISAM DEFAULT CHARSET=utf8 INSERT_METHOD=LAST UNION=(`basetable`); +/*!40101 SET character_set_client = @saved_cs_client */; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `nonunique_table_view_name` ( + `1` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `db2` /*!40100 DEFAULT CHARACTER SET utf8 */; + +USE `db2`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `nonunique_table_name` ( + `i1` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + UNIQUE KEY `i1` (`i1`) +) ENGINE=MEMORY AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `nonunique_table_name` VALUES (1),(2); +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `nonunique_table_view_name` ( + `i2` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `nonunique_table_view_name` VALUES (3),(4); + +USE `db1`; +/*!50001 DROP TABLE IF EXISTS `nonunique_table_view_name`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `nonunique_table_view_name` AS select 1 AS `1` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +USE `db2`; + +################################################## +# --compact db2 + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `nonunique_table_name` ( + `i1` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + UNIQUE KEY `i1` (`i1`) +) ENGINE=MEMORY AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `nonunique_table_name` VALUES (1),(2); +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `nonunique_table_view_name` ( + `i2` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `nonunique_table_view_name` VALUES (3),(4); + +################################################## +# --compact --delayed-insert --no-data-med=0 --databases db2 db1 + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `db2` /*!40100 DEFAULT CHARACTER SET utf8 */; + +USE `db2`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `nonunique_table_name` ( + `i1` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + UNIQUE KEY `i1` (`i1`) +) ENGINE=MEMORY AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT DELAYED INTO `nonunique_table_name` VALUES (1),(2); +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `nonunique_table_view_name` ( + `i2` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `nonunique_table_view_name` VALUES (3),(4); + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `db1` /*!40100 DEFAULT CHARACTER SET utf8 */; + +USE `db1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `basetable` ( + `id` smallint(6) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT DELAYED INTO `basetable` VALUES (5),(6); +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `nonunique_table_name` ( + `i3` smallint(6) DEFAULT NULL +) ENGINE=MRG_MyISAM DEFAULT CHARSET=utf8 INSERT_METHOD=LAST UNION=(`basetable`); +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `nonunique_table_name` VALUES (5),(6); +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `nonunique_table_view_name` ( + `1` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +USE `db2`; + +USE `db1`; +/*!50001 DROP TABLE IF EXISTS `nonunique_table_view_name`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `nonunique_table_view_name` AS select 1 AS `1` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +DROP DATABASE db1; +DROP DATABASE db2; +FOUND 1 /Database: mysql/ in bug11505.sql +# +# MDEV-15021: Fix the order in which routines are called +# +use test; +CREATE FUNCTION f() RETURNS INT RETURN 1; +CREATE VIEW v1 AS SELECT f(); +# Running mysqldump -uroot test --routines --tables v1 > **vardir**/test.dmp +DROP VIEW v1; +DROP FUNCTION f; +# Running mysql -uroot test < **vardir**/test.dmp +# +# Cleanup after succesful import. +# +DROP VIEW v1; +DROP FUNCTION f; +# +# Test for --add-drop-trigger +# +use test; +CREATE TABLE t1 (a int, b int); +CREATE TRIGGER tt1_t1 BEFORE INSERT ON t1 FOR EACH ROW +SET NEW.b=NEW.a + 10; +INSERT INTO t1 (a) 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 utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `test`; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +/*!50032 DROP TRIGGER IF EXISTS tt1_t1 */; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tt1_t1 BEFORE INSERT ON t1 FOR EACH ROW +SET NEW.b=NEW.a + 10 */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_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 */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TABLE t1; +# +# Test for Invisible columns +# +create database d; +use d; +# Invisble field table +create table t1(a int , b int invisible); +insert into t1 values(1); +insert into t1(a,b) values(1,2); +# not invisible field table --complete-insert wont be used +create table t2(a int , b int); +insert into t2(a,b) values(1,2); +insert into t2(a,b) values(1,2); +# Invisble field table +create table t3(invisible int , `a b c & $!@#$%^&*( )` int invisible default 4, `ds=~!@ \# $% ^ & * ( ) _ - = +` int invisible default 5); +insert into t3 values(1); +insert into t3 values(5); +insert into t3 values(2); +insert into t3(`invisible`, `a b c & $!@#$%^&*( )`, `ds=~!@ \# $% ^ & * ( ) _ - = +` ) values(1,2,3); +CREATE TABLE t4(ËÏÌÏÎËÁ1 INT); +insert into t4 values(1); +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) INVISIBLE DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `t1` (`a`, `b`) VALUES (1,NULL),(1,2); +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `t2` VALUES (1,2),(1,2); +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t3` ( + `invisible` int(11) DEFAULT NULL, + `a b c & $!@#$%^&*( )` int(11) INVISIBLE DEFAULT 4, + `ds=~!@ \# $% ^ & * ( ) _ - = +` int(11) INVISIBLE DEFAULT 5 +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `t3` (`invisible`, `a b c & $!@#$%^&*( )`, `ds=~!@ \# $% ^ & * ( ) _ - = +`) VALUES (1,4,5),(5,4,5),(2,4,5),(1,2,3); +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t4` ( + `ËÏÌÏÎËÁ1` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `t4` VALUES (1); +#Check side effect on --complete insert +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) INVISIBLE DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `t1` (`a`, `b`) VALUES (1,NULL),(1,2); +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `t2` (`a`, `b`) VALUES (1,2),(1,2); +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t3` ( + `invisible` int(11) DEFAULT NULL, + `a b c & $!@#$%^&*( )` int(11) INVISIBLE DEFAULT 4, + `ds=~!@ \# $% ^ & * ( ) _ - = +` int(11) INVISIBLE DEFAULT 5 +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `t3` (`invisible`, `a b c & $!@#$%^&*( )`, `ds=~!@ \# $% ^ & * ( ) _ - = +`) VALUES (1,4,5),(5,4,5),(2,4,5),(1,2,3); +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t4` ( + `ËÏÌÏÎËÁ1` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +INSERT INTO `t4` (`ËÏÌÏÎËÁ1`) VALUES (1); +#Check xml +<?xml version="1.0"?> +<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +<database name="d"> + <table_structure name="t1"> + <field Field="a" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + <field Field="b" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="INVISIBLE" Comment="" /> + </table_structure> + <table_data name="t1"> + <row> + <field name="a">1</field> + <field name="b" xsi:nil="true" /> + </row> + <row> + <field name="a">1</field> + <field name="b">2</field> + </row> + </table_data> + <table_structure name="t2"> + <field Field="a" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + <field Field="b" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + </table_structure> + <table_data name="t2"> + <row> + <field name="a">1</field> + <field name="b">2</field> + </row> + <row> + <field name="a">1</field> + <field name="b">2</field> + </row> + </table_data> + <table_structure name="t3"> + <field Field="invisible" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + <field Field="a b c & $!@#$%^&*( )" Type="int(11)" Null="YES" Key="" Default="4" Extra="INVISIBLE" Comment="" /> + <field Field="ds=~!@ \# $% ^ & * ( ) _ - = +" Type="int(11)" Null="YES" Key="" Default="5" Extra="INVISIBLE" Comment="" /> + </table_structure> + <table_data name="t3"> + <row> + <field name="invisible">1</field> + <field name="a b c & $!@#$%^&*( )">4</field> + <field name="ds=~!@ \# $% ^ & * ( ) _ - = +">5</field> + </row> + <row> + <field name="invisible">5</field> + <field name="a b c & $!@#$%^&*( )">4</field> + <field name="ds=~!@ \# $% ^ & * ( ) _ - = +">5</field> + </row> + <row> + <field name="invisible">2</field> + <field name="a b c & $!@#$%^&*( )">4</field> + <field name="ds=~!@ \# $% ^ & * ( ) _ - = +">5</field> + </row> + <row> + <field name="invisible">1</field> + <field name="a b c & $!@#$%^&*( )">2</field> + <field name="ds=~!@ \# $% ^ & * ( ) _ - = +">3</field> + </row> + </table_data> + <table_structure name="t4"> + <field Field="ËÏÌÏÎËÁ1" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" /> + </table_structure> + <table_data name="t4"> + <row> + <field name="ËÏÌÏÎËÁ1">1</field> + </row> + </table_data> +</database> +</mysqldump> +DROP table t1,t2,t3; +select * from t1; +a +1 +1 +select a,b from t1; +a b +1 NULL +1 2 +select * from t2; +a b +1 2 +1 2 +select * from t3; +invisible +1 +5 +2 +1 +desc t3; +Field Type Null Key Default Extra +invisible int(11) YES NULL +a b c & $!@#$%^&*( ) int(11) YES 4 INVISIBLE +ds=~!@ \# $% ^ & * ( ) _ - = + int(11) YES 5 INVISIBLE +drop database d; diff --cc mysql-test/main/partition_innodb.result index cdfe619cb29,00000000000..f3d24347ff9 mode 100644,000000..100644 --- a/mysql-test/main/partition_innodb.result +++ b/mysql-test/main/partition_innodb.result @@@ -1,990 -1,0 +1,1032 @@@ +call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction"); +set global default_storage_engine='innodb'; +set session default_storage_engine='innodb'; +drop table if exists t1, t2; +# +# Bug#13694811: THE OPTIMIZER WRONGLY USES THE FIRST +# INNODB PARTITION STATISTICS +# +CREATE TABLE t1 +(a INT, +b varchar(64), +PRIMARY KEY (a), +KEY (b)) +ENGINE = InnoDB +PARTITION BY RANGE (a) +SUBPARTITION BY HASH (a) SUBPARTITIONS 10 +(PARTITION pNeg VALUES LESS THAN (0), +PARTITION p0 VALUES LESS THAN (1000), +PARTITION pMAX VALUES LESS THAN MAXVALUE); +# Only one row in the first 10 subpartitions +INSERT INTO t1 VALUES (-1, 'Only negative pk value'); +INSERT INTO t1 VALUES (0, 'Mod Zero'), (1, 'One'), (2, 'Two'), (3, 'Three'), +(10, 'Zero'), (11, 'Mod One'), (12, 'Mod Two'), (13, 'Mod Three'), +(20, '0'), (21, '1'), (22, '2'), (23, '3'), +(4, '4'), (5, '5'), (6, '6'), (7, '7'), (8, '8'), (9, '9'); +INSERT INTO t1 SELECT a + 30, b FROM t1 WHERE a >= 0; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +EXPLAIN SELECT b FROM t1 WHERE b between 'L' and 'N' AND a > -100; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range PRIMARY,b b 67 NULL 34 Using where; Using index +DROP TABLE t1; +# +# Bug#13007154: Crash in keys_to_use_for_scanning with ORDER BY +# and PARTITIONING +# +CREATE TABLE t1 (a INT, KEY(a)) +ENGINE = InnoDB +PARTITION BY KEY (a) PARTITIONS 1; +SELECT 1 FROM t1 WHERE a > (SELECT LAST_INSERT_ID() FROM t1 LIMIT 0) +ORDER BY a; +1 +DROP TABLE t1; +# +# Bug#56287: crash when using Partition datetime in sub in query +# +CREATE TABLE t1 +(c1 bigint(20) unsigned NOT NULL AUTO_INCREMENT, +c2 varchar(40) not null default '', +c3 datetime not NULL, +PRIMARY KEY (c1,c3), +KEY partidx(c3)) +ENGINE=InnoDB +PARTITION BY RANGE (TO_DAYS(c3)) +(PARTITION p200912 VALUES LESS THAN (to_days('2010-01-01')), +PARTITION p201103 VALUES LESS THAN (to_days('2011-04-01')), +PARTITION p201912 VALUES LESS THAN MAXVALUE); +insert into t1(c2,c3) values ("Test row",'2010-01-01 00:00:00'); +SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test'; +PARTITION_NAME TABLE_ROWS +p200912 0 +p201103 1 +p201912 0 +SELECT count(*) FROM t1 p where c3 in +(select c3 from t1 t where t.c3 < timestamp '2011-04-26 19:19:44' + and t.c3 > timestamp '2011-04-26 19:18:44') ; +count(*) +0 +DROP TABLE t1; +# +# Bug#54747: Deadlock between REORGANIZE PARTITION and +# SELECT is not detected +# +SET @old_innodb_thread_concurrency := @@innodb_thread_concurrency; +SET @old_innodb_thread_sleep_delay := @@innodb_thread_sleep_delay; +SET GLOBAL innodb_thread_concurrency = 1; +CREATE TABLE t1 +(user_num BIGINT, +hours SMALLINT, +KEY user_num (user_num)) +ENGINE = InnoDB +PARTITION BY RANGE COLUMNS (hours) +(PARTITION hour_003 VALUES LESS THAN (3), +PARTITION hour_004 VALUES LESS THAN (4), +PARTITION hour_005 VALUES LESS THAN (5), +PARTITION hour_last VALUES LESS THAN (MAXVALUE)); +INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); +BEGIN; +SELECT COUNT(*) FROM t1; +COUNT(*) +5 +connect con1,localhost,root,,; +# SEND a ALTER PARTITION which waits on the ongoing transaction. +ALTER TABLE t1 +REORGANIZE PARTITION hour_003, hour_004 INTO +(PARTITION oldest VALUES LESS THAN (4)); +# Connection default wait until the ALTER is in 'waiting for table...' +# state and then continue the transaction by trying a SELECT +connection default; +SELECT COUNT(*) FROM t1; +COUNT(*) +5 +COMMIT; +# reaping ALTER. +connection con1; +# Cleaning up. +disconnect con1; +connection default; +SET GLOBAL innodb_thread_concurrency = @old_innodb_thread_concurrency; +SET GLOBAL innodb_thread_sleep_delay = @old_innodb_thread_sleep_delay; +DROP TABLE t1; +# +# Bug#50418: DROP PARTITION does not interact with transactions +# +CREATE TABLE t1 ( +id INT AUTO_INCREMENT NOT NULL, +name CHAR(50) NOT NULL, +myDate DATE NOT NULL, +PRIMARY KEY (id, myDate), +INDEX idx_date (myDate) +) ENGINE=InnoDB +PARTITION BY RANGE ( TO_DAYS(myDate) ) ( +PARTITION p0 VALUES LESS THAN (734028), +PARTITION p1 VALUES LESS THAN (734029), +PARTITION p2 VALUES LESS THAN (734030), +PARTITION p3 VALUES LESS THAN MAXVALUE +) ; +INSERT INTO t1 VALUES +(NULL, 'Lachlan', '2009-09-13'), +(NULL, 'Clint', '2009-09-13'), +(NULL, 'John', '2009-09-14'), +(NULL, 'Dave', '2009-09-14'), +(NULL, 'Jeremy', '2009-09-15'), +(NULL, 'Scott', '2009-09-15'), +(NULL, 'Jeff', '2009-09-16'), +(NULL, 'Joe', '2009-09-16'); +SET AUTOCOMMIT=0; +SELECT * FROM t1 FOR UPDATE; +id name myDate +1 Lachlan 2009-09-13 +2 Clint 2009-09-13 +3 John 2009-09-14 +4 Dave 2009-09-14 +5 Jeremy 2009-09-15 +6 Scott 2009-09-15 +7 Jeff 2009-09-16 +8 Joe 2009-09-16 +UPDATE t1 SET name = 'Mattias' WHERE id = 7; +SELECT * FROM t1 WHERE id = 7; +id name myDate +7 Mattias 2009-09-16 +connect con1, localhost, root,,; +SET lock_wait_timeout = 1; +# After the patch it will wait and fail on timeout. +ALTER TABLE t1 DROP PARTITION p3; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SHOW WARNINGS; +Level Code Message +Error 1205 Lock wait timeout exceeded; try restarting transaction +disconnect con1; +connection default; +SELECT * FROM t1; +id name myDate +1 Lachlan 2009-09-13 +2 Clint 2009-09-13 +3 John 2009-09-14 +4 Dave 2009-09-14 +5 Jeremy 2009-09-15 +6 Scott 2009-09-15 +7 Mattias 2009-09-16 +8 Joe 2009-09-16 +# No changes. +COMMIT; +DROP TABLE t1; +# +# Bug#51830: Incorrect partition pruning on range partition (regression) +# +CREATE TABLE t1 (a INT NOT NULL) +ENGINE = InnoDB +PARTITION BY RANGE(a) +(PARTITION p10 VALUES LESS THAN (10), +PARTITION p30 VALUES LESS THAN (30), +PARTITION p50 VALUES LESS THAN (50), +PARTITION p70 VALUES LESS THAN (70), +PARTITION p90 VALUES LESS THAN (90)); +INSERT INTO t1 VALUES (10),(30),(50); +INSERT INTO t1 VALUES (70); +INSERT INTO t1 VALUES (80); +INSERT INTO t1 VALUES (89); +INSERT INTO t1 VALUES (90); +ERROR HY000: Table has no partition for value 90 +INSERT INTO t1 VALUES (100); +ERROR HY000: Table has no partition for value 100 +insert INTO t1 VALUES (110); +ERROR HY000: Table has no partition for value 110 +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 90; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 90; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 90; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 89; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p90 ALL NULL NULL NULL NULL 3 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 89; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p90 ALL NULL NULL NULL NULL 3 Using where +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 89; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 100; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 100; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 100; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +DROP TABLE t1; +# +# Bug#50104: Partitioned table with just 1 partion works with fk +# +CREATE TABLE t2 ( +id INT, +PRIMARY KEY (id) +) ENGINE=InnoDB ; +CREATE TABLE t1 ( +id INT NOT NULL AUTO_INCREMENT, +parent_id INT DEFAULT NULL, +PRIMARY KEY (id), +KEY parent_id (parent_id) +) ENGINE=InnoDB; +ALTER TABLE t1 PARTITION BY HASH (id) PARTITIONS 1; +ALTER TABLE t1 ADD CONSTRAINT test_ibfk_1 FOREIGN KEY (parent_id) REFERENCES t2 (id); +ERROR HY000: Foreign key clause is not yet supported in conjunction with partitioning +ALTER TABLE t1 PARTITION BY HASH (id) PARTITIONS 2; +ALTER TABLE t1 ADD CONSTRAINT test_ibfk_1 FOREIGN KEY (parent_id) REFERENCES t2 (id); +ERROR HY000: Foreign key clause is not yet supported in conjunction with partitioning +DROP TABLE t1, t2; +create table t1 (a varchar(5), b int signed, c varchar(10), d datetime) +partition by range columns(b,c) +subpartition by hash(to_seconds(d)) +( partition p0 values less than (2, 'b'), +partition p1 values less than (4, 'd'), +partition p2 values less than (10, 'za')); +insert into t1 values ('a', 3, 'w', '2001-10-27 04:34:00'); +insert into t1 values ('r', 7, 'w', '2001-10-27 05:34:00'); +insert into t1 values ('g', 10, 'w', '2001-10-27 06:34:00'); +update t1 set a = 'c' where a > 'f'; +drop table t1; +create table t1 (a varchar(5)) +engine=memory +partition by range columns(a) +( partition p0 values less than ('m'), +partition p1 values less than ('za')); +insert into t1 values ('j'); +update t1 set a = 'z' where (a >= 'j'); +drop table t1; +create table t1 (a varchar(5)) +engine=myisam +partition by range columns(a) +( partition p0 values less than ('m'), +partition p1 values less than ('za')); +insert into t1 values ('j'); +update t1 set a = 'z' where (a >= 'j'); +drop table t1; +create table t1 (a varchar(5)) +engine=innodb +partition by range columns(a) +( partition p0 values less than ('m'), +partition p1 values less than ('za')); +insert into t1 values ('j'); +update t1 set a = 'z' where (a >= 'j'); +drop table t1; +create table t1 (a int not null, +b datetime not null, +primary key (a,b)) +engine=innodb +partition by range (to_days(b)) +subpartition by hash (a) +subpartitions 2 +( partition p0 values less than (to_days('2009-01-01')), +partition p1 values less than (to_days('2009-02-01')), +partition p2 values less than (to_days('2009-03-01')), +partition p3 values less than maxvalue); +alter table t1 reorganize partition p1,p2 into +( partition p2 values less than (to_days('2009-03-01'))); +drop table t1; +CREATE TABLE t1 (id INT PRIMARY KEY, data INT) ENGINE = InnoDB +PARTITION BY RANGE(id) ( +PARTITION p0 VALUES LESS THAN (5), +PARTITION p1 VALUES LESS THAN (10), +PARTITION p2 VALUES LESS THAN MAXVALUE +); +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); +SET @old_tx_isolation := @@session.tx_isolation; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +SET autocommit = 0; +UPDATE t1 SET DATA = data*2 WHERE id = 3; +UPDATE t1 SET data = data*2 WHERE data = 2; +SET @@session.tx_isolation = @old_tx_isolation; +DROP TABLE t1; +# Bug#37721, test of ORDER BY on PK and WHERE on INDEX +CREATE TABLE t1 ( +a INT, +b INT, +PRIMARY KEY (a), +INDEX (b)) +ENGINE InnoDB +PARTITION BY HASH(a) +PARTITIONS 3; +INSERT INTO t1 VALUES (0,0),(4,0),(2,0); +SELECT a FROM t1 WHERE b = 0 ORDER BY a ASC; +a +0 +2 +4 +SELECT a FROM t1 WHERE b = 0 ORDER BY a DESC; +a +4 +2 +0 +ALTER TABLE t1 DROP INDEX b; +SELECT a FROM t1 WHERE b = 0 ORDER BY a ASC; +a +0 +2 +4 +SELECT a FROM t1 WHERE b = 0 ORDER BY a DESC; +a +4 +2 +0 +DROP TABLE t1; +CREATE TABLE t1 ( +a VARCHAR(600), +b VARCHAR(600), +PRIMARY KEY (a), +INDEX (b)) +ENGINE InnoDB +PARTITION BY KEY(a) +PARTITIONS 3; +INSERT INTO t1 VALUES (concat(repeat('MySQL',100),'1'),repeat('0',257)); +INSERT INTO t1 VALUES (concat(repeat('MySQL',100),'3'),repeat('0',257)); +INSERT INTO t1 VALUES (concat(repeat('MySQL',100),'2'),repeat('0',257)); +SELECT right(a,1) FROM t1 WHERE b = repeat('0',257) ORDER BY a ASC; +right(a,1) +1 +2 +3 +SELECT right(a,1) FROM t1 WHERE b = repeat('0',257) ORDER BY a DESC; +right(a,1) +3 +2 +1 +ALTER TABLE t1 DROP INDEX b; +SELECT right(a,1) FROM t1 WHERE b = repeat('0',257) ORDER BY a ASC; +right(a,1) +1 +2 +3 +SELECT right(a,1) FROM t1 WHERE b = repeat('0',257) ORDER BY a DESC; +right(a,1) +3 +2 +1 +DROP TABLE t1; +# Bug#32948 +CREATE TABLE t1 (c1 INT, PRIMARY KEY (c1)) ENGINE=INNODB; +CREATE TABLE t2 (c1 INT, PRIMARY KEY (c1), +FOREIGN KEY (c1) REFERENCES t1 (c1) +ON DELETE CASCADE) +ENGINE=INNODB; +ALTER TABLE t1 PARTITION BY HASH(c1) PARTITIONS 5; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails +ALTER TABLE t1 ENGINE=MyISAM; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails +DROP TABLE t2; +DROP TABLE t1; +create table t1 (a int) engine=innodb partition by hash(a) ; +show table status 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 Max_index_length Temporary +t1 InnoDB 10 Dynamic 2 8192 16384 0 0 # NULL # NULL NULL latin1_swedish_ci NULL partitioned 0 N +drop table t1; +create table t1 (a int) +engine = innodb +partition by key (a); +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 Max_index_length Temporary +t1 InnoDB 10 Dynamic 2 8192 16384 0 0 # NULL # NULL NULL latin1_swedish_ci NULL partitioned 0 N +insert into t1 values (0), (1), (2), (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 Max_index_length Temporary +t1 InnoDB 10 Dynamic 4 4096 16384 0 0 # NULL # NULL NULL latin1_swedish_ci NULL partitioned 0 N +drop table t1; +create table t1 (a int auto_increment primary key) +engine = innodb +partition by key (a); +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 Max_index_length Temporary +t1 InnoDB 10 Dynamic 2 8192 16384 0 0 # 1 # NULL NULL latin1_swedish_ci NULL partitioned 0 N +insert into t1 values (NULL), (NULL), (NULL), (NULL); +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 Max_index_length Temporary +t1 InnoDB 10 Dynamic 4 4096 16384 0 0 # 5 # NULL NULL latin1_swedish_ci NULL partitioned 0 N +insert into t1 values (NULL), (NULL), (NULL), (NULL); +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 Max_index_length Temporary +t1 InnoDB 10 Dynamic 8 2048 16384 0 0 # 9 # NULL NULL latin1_swedish_ci NULL partitioned 0 N +drop table t1; +create table t1 (a int) +partition by key (a) +(partition p1 engine = innodb); +alter table t1 rebuild partition p1; +alter table t1 rebuild partition p1; +alter table t1 rebuild partition p1; +alter table t1 rebuild partition p1; +alter table t1 rebuild partition p1; +alter table t1 rebuild partition p1; +alter table t1 rebuild partition p1; +drop table t1; +create table t1 (a date) +engine = innodb +partition by range (year(a)) +(partition p0 values less than (2006), +partition p1 values less than (2007)); +explain partitions select * from t1 +where a between '2006-01-01' and '2007-06-01'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 Using where +drop table t1; +SET SQL_MODE=""; +create table t1 (a int) +engine = x +partition by key (a); +Warnings: +Warning 1286 Unknown storage engine 'x' +Warning 1266 Using storage engine InnoDB for table 't1' +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 + PARTITION BY KEY (`a`) +drop table t1; +create table t1 (a int) +engine = innodb +partition by list (a) +(partition p0 values in (0)); +alter table t1 engine = x; +Warnings: +Warning 1286 Unknown storage engine 'x' +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 + PARTITION BY LIST (`a`) +(PARTITION `p0` VALUES IN (0) ENGINE = InnoDB) +drop table t1; +SET SQL_MODE=default; +create table t1 +( +id int unsigned auto_increment, +time datetime not null, +first_name varchar(40), +last_name varchar(50), +primary key (id, time), +index first_index (first_name), +index last_index (last_name) +) engine=Innodb partition by range (to_days(time)) ( +partition p1 values less than (to_days('2007-02-07')), +partition p2 values less than (to_days('2007-02-08')), +partition p3 values less than MAXVALUE +); +insert into t1 (time, first_name, last_name) values ('2007-02-07', 'Q', 'Robert'), +('2007-02-07', 'Mark', 'Nate'), ('2007-02-07', 'Nate', 'Oscar'), +('2007-02-07', 'Zack', 'Alice'), ('2007-02-07', 'Jack', 'Kathy'), +('2007-02-06', 'Alice', 'Alice'), ('2007-02-06', 'Brian', 'Charles'), +('2007-02-06', 'Charles', 'David'), ('2007-02-06', 'David', 'Eric'), +('2007-02-07', 'Hector', 'Isaac'), ('2007-02-07', 'Oscar', 'Patricia'), +('2007-02-07', 'Patricia', 'Q'), ('2007-02-07', 'X', 'Yuri'), +('2007-02-07', 'Robert', 'Shawn'), ('2007-02-07', 'Kathy', 'Lois'), +('2007-02-07', 'Eric', 'Francis'), ('2007-02-06', 'Shawn', 'Theron'), +('2007-02-06', 'U', 'Vincent'), ('2007-02-06', 'Francis', 'George'), +('2007-02-06', 'George', 'Hector'), ('2007-02-06', 'Vincent', 'Walter'), +('2007-02-06', 'Walter', 'X'), ('2007-02-07', 'Lois', 'Mark'), +('2007-02-07', 'Yuri', 'Zack'), ('2007-02-07', 'Isaac', 'Jack'), +('2007-02-07', 'Sharon', 'Mark'), ('2007-02-07', 'Michael', 'Michelle'), +('2007-02-07', 'Derick', 'Nathan'), ('2007-02-07', 'Peter', 'Xavier'), +('2007-02-07', 'Fred', 'Harold'), ('2007-02-07', 'Katherine', 'Lisa'), +('2007-02-07', 'Tom', 'Rina'), ('2007-02-07', 'Jerry', 'Victor'), +('2007-02-07', 'Alexander', 'Terry'), ('2007-02-07', 'Justin', 'John'), +('2007-02-07', 'Greg', 'Ernest'), ('2007-02-07', 'Robert', 'Q'), +('2007-02-07', 'Nate', 'Mark'), ('2007-02-07', 'Oscar', 'Nate'), +('2007-02-07', 'Alice', 'Zack'), ('2007-02-07', 'Kathy', 'Jack'), +('2007-02-06', 'Alice', 'Alice'), ('2007-02-06', 'Charles', 'Brian'), +('2007-02-06', 'David', 'Charles'), ('2007-02-06', 'Eric', 'David'), +('2007-02-07', 'Isaac', 'Hector'), ('2007-02-07', 'Patricia', 'Oscar'), +('2007-02-07', 'Q', 'Patricia'), ('2007-02-07', 'Yuri', 'X'), +('2007-02-07', 'Shawn', 'Robert'), ('2007-02-07', 'Lois', 'Kathy'), +('2007-02-07', 'Francis', 'Eric'), ('2007-02-06', 'Theron', 'Shawn'), +('2007-02-06', 'Vincent', 'U'), ('2007-02-06', 'George', 'Francis'), +('2007-02-06', 'Hector', 'George'), ('2007-02-06', 'Walter', 'Vincent'), +('2007-02-06', 'X', 'Walter'), ('2007-02-07', 'Mark', 'Lois'), +('2007-02-07', 'Zack', 'Yuri'), ('2007-02-07', 'Jack', 'Isaac'), +('2007-02-07', 'Mark', 'Sharon'), ('2007-02-07', 'Michelle', 'Michael'), +('2007-02-07', 'Nathan', 'Derick'), ('2007-02-07', 'Xavier', 'Peter'), +('2007-02-07', 'Harold', 'Fred'), ('2007-02-07', 'Lisa', 'Katherine'), +('2007-02-07', 'Rina', 'Tom'), ('2007-02-07', 'Victor', 'Jerry'), +('2007-02-07', 'Terry', 'Alexander'), ('2007-02-07', 'John', 'Justin'), +('2007-02-07', 'Ernest', 'Greg'); +SELECT * FROM t1 WHERE first_name='Andy' OR last_name='Jake'; +id time first_name last_name +drop table t1; +CREATE TABLE t1 (a DOUBLE NOT NULL, KEY(a)) ENGINE=InnoDB +PARTITION BY KEY(a) PARTITIONS 10; +INSERT INTO t1 VALUES(1),(2); +SELECT COUNT(*) FROM t1; +COUNT(*) +2 +DROP TABLE t1; +create table t1 (int_column int, char_column char(5)) +PARTITION BY RANGE (int_column) subpartition by key (char_column) subpartitions 2 +(PARTITION p1 VALUES LESS THAN (5) ENGINE = InnoDB); +alter table t1 +ENGINE = MyISAM +PARTITION BY RANGE (int_column) +subpartition by key (char_column) subpartitions 2 +(PARTITION p1 VALUES LESS THAN (5)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `int_column` int(11) DEFAULT NULL, + `char_column` char(5) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + PARTITION BY RANGE (`int_column`) +SUBPARTITION BY KEY (`char_column`) +SUBPARTITIONS 2 +(PARTITION `p1` VALUES LESS THAN (5) ENGINE = MyISAM) +drop table t1; +CREATE TABLE t1 (a INT) ENGINE=InnoDB +PARTITION BY list(a) (PARTITION p1 VALUES IN (1)); +CREATE INDEX i1 ON t1 (a); +DROP TABLE t1; +# +# Bug#54783: optimize table crashes with invalid timestamp default value and NO_ZERO_DATE +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a INT, b TIMESTAMP DEFAULT '0000-00-00 00:00:00') +ENGINE=INNODB PARTITION BY LINEAR HASH (a) PARTITIONS 1; +SET @old_mode = @@sql_mode; +SET SESSION sql_mode = 'NO_ZERO_DATE'; +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize note Table does not support optimize, doing recreate + analyze instead +test.t1 optimize error Invalid default value for 'b' +test.t1 optimize status Operation failed +Warnings: +Warning 1265 Data truncated for column 'b' at row 1 +Error 1067 Invalid default value for 'b' +SET SESSION sql_mode = @old_mode; +DROP TABLE t1; +# +# Bug#57985 "ONLINE/FAST ALTER PARTITION can fail and leave the +# table unusable". +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a bigint not null, b int not null, PRIMARY KEY (a)) +ENGINE = InnoDB PARTITION BY KEY(a) PARTITIONS 2; +INSERT INTO t1 values (0,1), (1,2); +# The below ALTER should fail. It should leave the +# table in its original, non-corrupted, usable state. +ALTER TABLE t1 ADD UNIQUE KEY (b); +ERROR HY000: A UNIQUE INDEX must include all columns in the table's partitioning function +# The below statements should succeed, as ALTER should +# have left table intact. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) NOT NULL, + `b` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 + PARTITION BY KEY (`a`) +PARTITIONS 2 +SELECT * FROM t1; +a b +1 2 +0 1 +DROP TABLE t1; +# +# Bug #17299181 CREATE_TIME AND UPDATE_TIME ARE +# WRONG FOR PARTITIONED TABLES +# +CREATE TABLE t1 (a int, PRIMARY KEY (a)) ENGINE=InnoDB +PARTITION BY HASH (a) PARTITIONS 2; +SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE +CREATE_TIME IS NOT NULL AND TABLE_NAME='t1'; +COUNT(*) +1 +DROP TABLE t1; +# +# BUG#12912171 - ASSERTION FAILED: QUICK->HEAD->READ_SET == +# SAVE_READ_SET +# +CREATE TABLE t1 ( +a INT, +b INT, +c INT, +PRIMARY KEY (c,a), KEY (a),KEY (a) +) ENGINE=INNODB PARTITION BY KEY () PARTITIONS 2; +Warnings: +Note 1831 Duplicate index `a_2`. This is deprecated and will be disallowed in a future release +INSERT INTO t1 VALUES (1,5,1),(2,4,1),(3,3,1),(4,2,1),(5,1,1); +UPDATE t1 SET b = 0, c=1 WHERE a <=>0; +SELECT * FROM t1; +a b c +1 5 1 +2 4 1 +3 3 1 +4 2 1 +5 1 1 +DROP TABLE t1; +# +# MDEV-5102 : MySQL Bug 69851 +# +CREATE TABLE t1 ( +`col1` bigint(20) unsigned NOT NULL , +`col2` bigint(20) unsigned NOT NULL , +`col3` datetime NOT NULL , +PRIMARY KEY (`col3`), +KEY (`col1`), +KEY (`col2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +PARTITION BY RANGE (TO_DAYS(col3)) +( +PARTITION p_20130310 VALUES LESS THAN (735303) ENGINE = InnoDB, +PARTITION p_20130311 VALUES LESS THAN (735304) ENGINE = InnoDB, +PARTITION p_20130312 VALUES LESS THAN (735305) ENGINE = InnoDB +); +INSERT INTO `t1` VALUES (2,96,'2013-03-08 16:28:05'); +INSERT INTO `t1` VALUES (1,2,'2013-03-08 16:47:39'); +INSERT INTO `t1` VALUES (1,2,'2013-03-08 16:50:27'); +INSERT INTO `t1` VALUES (1,2,'2013-03-11 16:33:04'); +INSERT INTO `t1` VALUES (1,2,'2013-03-11 16:33:24'); +INSERT INTO `t1` VALUES (2,2,'2013-03-12 10:11:48'); +SELECT * FROM t1 WHERE col1 = 1 AND col2 = 2 +AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00' +GROUP BY 1, 2, 3; +col1 col2 col3 +1 2 2013-03-08 16:47:39 +1 2 2013-03-08 16:50:27 +1 2 2013-03-11 16:33:04 +1 2 2013-03-11 16:33:24 +EXPLAIN SELECT * FROM t1 WHERE col1 = 1 AND col2 = 2 +AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00' +GROUP BY 1, 2, 3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range PRIMARY,col1,col2 PRIMARY 5 NULL # Using where; Using filesort +SELECT * FROM t1 USE INDEX () WHERE col1 = 1 AND col2 = 2 +AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00' +GROUP BY 1, 2, 3; +col1 col2 col3 +1 2 2013-03-08 16:47:39 +1 2 2013-03-08 16:50:27 +1 2 2013-03-11 16:33:04 +1 2 2013-03-11 16:33:24 +DROP TABLE t1; +# +# MDEV-5177: ha_partition and innodb index intersection produce fewer rows (MySQL Bug#70703) +# +create table t1 ( +a int not null, +b int not null, +pk int not null, +primary key (pk), +key(a), +key(b) +) engine=innodb partition by hash(pk) partitions 10; +insert into t1 values (1,2,4); +insert into t1 values (1,0,17); +insert into t1 values (1,2,25); +insert into t1 values (10,20,122); +insert into t1 values (10,20,123); +create table t2 (a int); +insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +insert into t1 select 1,2, 200 + A.a + 10*B.a + 100*C.a from t2 A, t2 B, t2 C; +insert into t1 select 10+A.a + 10*B.a + 100*C.a + 1000*D.a, +10+A.a + 10*B.a + 100*C.a + 1000*D.a, +2000 + A.a + 10*B.a + 100*C.a + 1000*D.a +from t2 A, t2 B, t2 C ,t2 D; +explain select * from t1 where a=1 and b=2 and pk between 1 and 999999 ; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge PRIMARY,a,b b,a 4,4 NULL # Using intersect(b,a); Using where; Using index +create temporary table t3 as +select * from t1 where a=1 and b=2 and pk between 1 and 999 ; +select count(*) from t3; +count(*) +802 +drop table t3; +create temporary table t3 as +select * from t1 ignore index(a,b) where a=1 and b=2 and pk between 1 and 999 ; +select count(*) from t3; +count(*) +802 +drop table t3; +drop table t1,t2; +# +# MySQL Bug#71095: Wrong results with PARTITION BY LIST COLUMNS() +# +create table t1(c1 int, c2 int, c3 int, c4 int, +primary key(c1,c2)) engine=InnoDB +partition by list columns(c2) +(partition p1 values in (1,2) engine=InnoDB, +partition p2 values in (3,4) engine=InnoDB); +insert into t1 values (1,1,1,1),(2,3,1,1); +select * from t1 where c1=2 and c2=3; +c1 c2 c3 c4 +2 3 1 1 +drop table t1; +# +# MySQL Bug#72803: Wrong "Impossible where" with LIST partitioning +# also MDEV-6240: Wrong "Impossible where" with LIST partitioning +# +CREATE TABLE t1 ( d DATE) ENGINE = InnoDB +PARTITION BY LIST COLUMNS (d) +( +PARTITION p0 VALUES IN ('1990-01-01','1991-01-01'), +PARTITION p1 VALUES IN ('1981-01-01') +); +INSERT INTO t1 (d) VALUES ('1991-01-01'); +SELECT * FROM t1 WHERE d = '1991-01-01'; +d +1991-01-01 +DROP TABLE t1; +set global default_storage_engine=default; +# +# MDEV-9455: [ERROR] mysqld got signal 11 +# +CREATE TABLE `t1` ( +`DIARY_TOTAL_DAY_SEQ` bigint(20) unsigned NOT NULL AUTO_INCREMENT, +`IMORY_ID` bigint(20) NOT NULL, +`NAME` varchar(75) DEFAULT NULL, +`DATETIME` varchar(10) NOT NULL DEFAULT '', +`DAILY_CALL_CNT` int(11) DEFAULT NULL, +`DAILY_SMS_CNT` int(11) DEFAULT NULL, +`NUMBER` varchar(64) DEFAULT NULL, +`DURATION` varchar(16) DEFAULT NULL, +PRIMARY KEY (`DIARY_TOTAL_DAY_SEQ`,`DATETIME`), +KEY `IDX_t1_01` (`IMORY_ID`,`DATETIME`) +) AUTO_INCREMENT=328702514 DEFAULT CHARSET=utf8mb4 +PARTITION BY RANGE COLUMNS(`DATETIME`) +(PARTITION p0 VALUES LESS THAN ('2015-10-01') ENGINE = InnoDB, +PARTITION p1 VALUES LESS THAN ('2015-11-01') ENGINE = InnoDB, +PARTITION p2 VALUES LESS THAN ('2015-12-01') ENGINE = InnoDB, +PARTITION p3 VALUES LESS THAN ('2016-01-01') ENGINE = InnoDB, +PARTITION p4 VALUES LESS THAN ('2016-02-01') ENGINE = InnoDB, +PARTITION p5 VALUES LESS THAN ('2016-03-01') ENGINE = InnoDB, +PARTITION p6 VALUES LESS THAN ('2016-04-01') ENGINE = InnoDB, +PARTITION p7 VALUES LESS THAN ('2016-05-01') ENGINE = InnoDB, +PARTITION p8 VALUES LESS THAN ('2016-06-01') ENGINE = InnoDB, +PARTITION p9 VALUES LESS THAN ('2016-07-01') ENGINE = InnoDB, +PARTITION p10 VALUES LESS THAN ('2016-08-01') ENGINE = InnoDB) +; +CREATE TABLE `t2` ( +`DIARY_SEQ` bigint(20) unsigned NOT NULL AUTO_INCREMENT, +`IMORY_ID` bigint(20) NOT NULL, +`CALL_TYPE` varchar(1) DEFAULT NULL, +`DATA_TYPE` varchar(1) DEFAULT NULL, +`FEATURES` varchar(1) DEFAULT NULL, +`NAME` varchar(75) DEFAULT NULL, +`NUMBER` varchar(64) DEFAULT NULL, +`DATETIME` datetime NOT NULL, +`REG_DATE` datetime NOT NULL, +`TITLE` varchar(50) DEFAULT NULL, +`BODY` varchar(4200) DEFAULT NULL, +`MIME_TYPE` varchar(32) DEFAULT NULL, +`DURATION` varchar(16) DEFAULT NULL, +`DEVICE_ID` varchar(64) DEFAULT NULL, +`DEVICE_NAME` varchar(32) DEFAULT NULL, +PRIMARY KEY (`DIARY_SEQ`,`DATETIME`,`REG_DATE`), +KEY `IDX_TB_DIARY_01` (`IMORY_ID`,`DATETIME`,`CALL_TYPE`,`NUMBER`), +KEY `IDX_TB_DIARY_02` (`REG_DATE`) +) AUTO_INCREMENT=688799006 DEFAULT CHARSET=utf8mb4 +PARTITION BY RANGE COLUMNS(REG_DATE) +(PARTITION p0 VALUES LESS THAN ('2015-10-01') ENGINE = InnoDB, +PARTITION p1 VALUES LESS THAN ('2015-11-01') ENGINE = InnoDB, +PARTITION p2 VALUES LESS THAN ('2015-12-01') ENGINE = InnoDB, +PARTITION p3 VALUES LESS THAN ('2016-01-01') ENGINE = InnoDB, +PARTITION p4 VALUES LESS THAN ('2016-02-01') ENGINE = InnoDB, +PARTITION p5 VALUES LESS THAN ('2016-03-01') ENGINE = InnoDB, +PARTITION p6 VALUES LESS THAN ('2016-04-01') ENGINE = InnoDB, +PARTITION p7 VALUES LESS THAN ('2016-05-01') ENGINE = InnoDB, +PARTITION p8 VALUES LESS THAN ('2016-06-01') ENGINE = InnoDB, +PARTITION p9 VALUES LESS THAN ('2016-07-01') ENGINE = InnoDB, +PARTITION p10 VALUES LESS THAN ('2016-08-01') ENGINE = InnoDB) +; +SELECT +A.IMORY_ID, +A.NUMBER, +A.NAME, +DATE_FORMAT(A.DATETIME, '%Y-%m-%d') AS TARGET_DATE, +SUM( CASE WHEN A.DATA_TYPE='1' THEN 1 ELSE 0 END) AS CALL_CNT, +SUM( CASE WHEN A.DATA_TYPE IN ('2', '3') THEN 1 ELSE 0 END) AS SMS_CNT, +SUM(CAST(A.DURATION AS INT)) AS DURATION, +( SELECT COUNT(*) +FROM t1 +WHERE IMORY_ID=A.IMORY_ID +AND NUMBER=A.NUMBER +AND NAME=A.NAME +AND DATETIME = DATE_FORMAT(A.DATETIME, '%Y-%m-%d') +) STATS_COUNT +FROM t2 A +WHERE A.IMORY_ID = 55094102 +AND A.DATETIME LIKE ( +SELECT CONCAT (DATE_FORMAT(DATETIME, '%Y-%m-%d') ,'%') +FROM t2 +WHERE IMORY_ID=55094102 +AND DIARY_SEQ IN ( 608351221, 608351225, 608351229 ) +group by DATE_FORMAT(DATETIME, '%Y-%m-%d') +) +GROUP BY A.IMORY_ID, A.NUMBER, A.NAME, DATE_FORMAT(A.DATETIME, '%Y-%m-%d') +; +IMORY_ID NUMBER NAME TARGET_DATE CALL_CNT SMS_CNT DURATION STATS_COUNT +drop table t2, t1; +set global default_storage_engine='innodb'; +# +# MDEV-5963: InnoDB: Assertion failure in file row0sel.cc line 2503, +# Failing assertion: 0 with "key ptr now exceeds key end by 762 bytes" +# (independent testcase for Oracle Bug#13947868) +# +CREATE TABLE t1 (f1 VARCHAR(512) CHARACTER SET utf8) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('j'); +CREATE TABLE t2 ( +f2 VARCHAR(5) CHARACTER SET latin1, +f3 VARCHAR(5) CHARACTER SET utf8, +f4 INT, +f5 VARCHAR(512) CHARACTER SET utf8, +f6 VARCHAR(256) CHARACTER SET utf8, +key (f2), +key (f3), +key (f5) +) ENGINE=InnoDB PARTITION BY LIST COLUMNS (f4) +SUBPARTITION BY KEY(f6) SUBPARTITIONS 4 ( +PARTITION p0 VALUES IN (1,3,9,null), +PARTITION p1 VALUES IN (2,4,0) +); +INSERT INTO t2 VALUES +('k','s',3,'b','j'),('a','b',NULL,'v','j'),('c','m',9,'t',NULL), +('b','l',9,'b',NULL),('i','y',3,'o','w'),('c','m',NULL,'a','m'), +('f','o',9,'m','w'),('f','q',NULL,'o','a'); +CREATE TABLE t3 LIKE t2; +SELECT * FROM t1 INNER JOIN t2 ON ( f5 = f1 ); +f1 f2 f3 f4 f5 f6 +INSERT INTO t3 SELECT * FROM t2 WHERE f3 = 'm' AND f2 ='c'; +DROP TABLE t1,t2,t3; +set global default_storage_engine=default; +# +# Bug#13737949: CRASH IN HA_PARTITION::INDEX_INIT +# Bug#18694052: SERVER CRASH IN HA_PARTITION::INIT_RECORD_PRIORITY_QUEUE +# +CREATE TABLE t1 +(a INT, +b INT, +PRIMARY KEY (a)) +ENGINE = InnoDB +PARTITION BY HASH (a) PARTITIONS 3; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connect con1, localhost, root,,; +ALTER TABLE t1 ADD INDEX idx1 (b); +connection default; +SELECT b FROM t1 WHERE b = 0; +ERROR HY000: Table definition has changed, please retry transaction +SELECT b FROM t1 WHERE b = 0; +ERROR HY000: Table definition has changed, please retry transaction +disconnect con1; +DROP TABLE t1; +# Same test without partitioning +CREATE TABLE t1 +(a INT, +b INT, +PRIMARY KEY (a)) +ENGINE = InnoDB; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connect con1, localhost, root,,; +ALTER TABLE t1 ADD INDEX idx1 (b); +connection default; +SELECT b FROM t1 WHERE b = 0; +ERROR HY000: Table definition has changed, please retry transaction +SELECT b FROM t1 WHERE b = 0; +ERROR HY000: Table definition has changed, please retry transaction +disconnect con1; +DROP TABLE t1; +# +# MDEV-11167: InnoDB: Warning: using a partial-field key prefix +# in search, results in assertion failure or "Can't find record" error +# +set @save_sql_mode = @@sql_mode; +set sql_mode=""; +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +CREATE TABLE t2 (b INT, c INT, KEY(b)) ENGINE=InnoDB PARTITION BY HASH(c) PARTITIONS 2; +CREATE ALGORITHM = MERGE VIEW v AS SELECT a, b FROM t1 STRAIGHT_JOIN t2 WHERE b = 'foo' WITH CHECK OPTION; +INSERT INTO t1 VALUES (1),(2); +INSERT IGNORE INTO t2 VALUES (2,2),('three',3),(4,4); +Warnings: +Warning 1366 Incorrect integer value: 'three' for column `test`.`t2`.`b` at row 2 +UPDATE v SET a = NULL; +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'foo' +DROP view v; +DROP TABLE t1, t2; +SET @save_isp=@@innodb_stats_persistent; +SET GLOBAL innodb_stats_persistent= ON; +CREATE TABLE t (f1 INT, f2 INT, KEY(f2)) ENGINE=InnoDB PARTITION BY HASH (f1) PARTITIONS 2; +INSERT IGNORE INTO t VALUES (NULL,0),(NULL,0),(0,21),(4,0),(1,8),(5,66); +CREATE ALGORITHM=MERGE VIEW v AS SELECT t1.* FROM t t1 JOIN t t2 WHERE t1.f1 < t2.f2 WITH LOCAL CHECK OPTION; +UPDATE v SET f2 = NULL; +ERROR 44000: CHECK OPTION failed `test`.`v` +SET GLOBAL innodb_stats_persistent= @save_isp; +DROP view v; +DROP TABLE t; +set sql_mode= @save_sql_mode; +# ++# Bug#28573894 ALTER PARTITIONED TABLE ADD AUTO_INCREMENT DIFF RESULT ++# ++CREATE TABLE t (a VARCHAR(10) NOT NULL,b INT,PRIMARY KEY (b)) ENGINE=INNODB ++PARTITION BY RANGE (b) ++(PARTITION pa VALUES LESS THAN (2), ++PARTITION pb VALUES LESS THAN (20), ++PARTITION pc VALUES LESS THAN (30), ++PARTITION pd VALUES LESS THAN (40)); ++INSERT INTO t ++VALUES('A',0),('B',1),('C',2),('D',3),('E',4),('F',5),('G',25),('H',35); ++CREATE TABLE t_copy LIKE t; ++INSERT INTO t_copy SELECT * FROM t; ++ALTER TABLE t ADD COLUMN r INT UNSIGNED NOT NULL AUTO_INCREMENT, ++ADD UNIQUE KEY (r,b); ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 ++ALTER TABLE t_copy ADD COLUMN r INT UNSIGNED NOT NULL AUTO_INCREMENT, ++ADD UNIQUE KEY (r,b), ALGORITHM=COPY; ++affected rows: 8 ++info: Records: 8 Duplicates: 0 Warnings: 0 ++SELECT * FROM t; ++a b r ++A 0 1 ++B 1 2 ++C 2 3 ++D 3 4 ++E 4 5 ++F 5 6 ++G 25 7 ++H 35 8 ++SELECT * FROM t_copy; ++a b r ++A 0 1 ++B 1 2 ++C 2 3 ++D 3 4 ++E 4 5 ++F 5 6 ++G 25 7 ++H 35 8 ++DROP TABLE t,t_copy; ++# +# Bug#26390658 RENAMING A PARTITIONED TABLE DOES NOT UPDATE +# MYSQL.INNODB_TABLE_STATS +# +CREATE DATABASE test_jfg; +CREATE TABLE test_jfg.test_jfg1 (id int(10) unsigned NOT NULL,PRIMARY +KEY (id)) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=1; +CREATE TABLE test_jfg.test_jfg2 (id int(10) unsigned NOT NULL,PRIMARY +KEY (id)) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=1 +PARTITION BY RANGE ( id ) (PARTITION p1000 VALUES LESS THAN (1000) +ENGINE = InnoDB,PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = +InnoDB); +SELECT database_name, table_name FROM mysql.innodb_table_stats WHERE +database_name = 'test_jfg'; +database_name table_name +test_jfg test_jfg1 +test_jfg test_jfg2#P#p1000 +test_jfg test_jfg2#P#pmax +RENAME TABLE test_jfg.test_jfg1 TO test_jfg.test_jfg11; +RENAME TABLE test_jfg.test_jfg2 TO test_jfg.test_jfg12; +SELECT database_name, table_name FROM mysql.innodb_table_stats WHERE +database_name = 'test_jfg'; +database_name table_name +test_jfg test_jfg11 +test_jfg test_jfg12#P#p1000 +test_jfg test_jfg12#P#pmax +DROP DATABASE test_jfg; +create table t1 (a int) engine=innodb; +create table t2 ( +b int, +c int, +d bit not null default 0, +v bit as (d) virtual, +key (b,v) +) engine=innodb partition by hash (b); +insert into t1 values (1),(2); +insert into t2 (b,c,d) values (1,1,0),(2,2,0); +explain select t1.* from t1 join t2 on (v = a); +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 index NULL b 7 NULL 2 Using where; Using index; Using join buffer (flat, BNL join) +select t1.* from t1 join t2 on (v = a); +a +drop table t1, t2; +# +# End of 10.2 tests +# +# +# MDEV-16241 Assertion `inited==RND' failed in handler::ha_rnd_end() +# +CREATE TABLE t1 (pk INT PRIMARY KEY, x INT, y INT, z INT, KEY (x), KEY (y, z)) +WITH SYSTEM VERSIONING +PARTITION BY SYSTEM_TIME (PARTITION p1 HISTORY, PARTITION pn CURRENT); +INSERT INTO t1 VALUES (1, 7, 8, 9), (2, NULL, NULL, NULL), (3, NULL, NULL, NULL); +SELECT COUNT(*) FROM t1 WHERE x IS NULL AND y IS NULL AND z IS NULL; +COUNT(*) +2 +DROP TABLE t1; +# +# End of 10.3 tests +# diff --cc mysql-test/main/partition_innodb.test index 57d644d293d,00000000000..f1a25b91c5b mode 100644,000000..100644 --- a/mysql-test/main/partition_innodb.test +++ b/mysql-test/main/partition_innodb.test @@@ -1,1084 -1,0 +1,1109 @@@ +--source include/not_embedded.inc +--source include/have_partition.inc +--source include/have_innodb.inc + +call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction"); + +set global default_storage_engine='innodb'; +set session default_storage_engine='innodb'; + +--disable_warnings +drop table if exists t1, t2; +--enable_warnings + +let $MYSQLD_DATADIR= `SELECT @@datadir`; + +--echo # +--echo # Bug#13694811: THE OPTIMIZER WRONGLY USES THE FIRST +--echo # INNODB PARTITION STATISTICS +--echo # + +CREATE TABLE t1 +(a INT, + b varchar(64), + PRIMARY KEY (a), + KEY (b)) +ENGINE = InnoDB +PARTITION BY RANGE (a) +SUBPARTITION BY HASH (a) SUBPARTITIONS 10 +(PARTITION pNeg VALUES LESS THAN (0), + PARTITION p0 VALUES LESS THAN (1000), + PARTITION pMAX VALUES LESS THAN MAXVALUE); + +--echo # Only one row in the first 10 subpartitions +INSERT INTO t1 VALUES (-1, 'Only negative pk value'); + +INSERT INTO t1 VALUES (0, 'Mod Zero'), (1, 'One'), (2, 'Two'), (3, 'Three'), +(10, 'Zero'), (11, 'Mod One'), (12, 'Mod Two'), (13, 'Mod Three'), +(20, '0'), (21, '1'), (22, '2'), (23, '3'), +(4, '4'), (5, '5'), (6, '6'), (7, '7'), (8, '8'), (9, '9'); +INSERT INTO t1 SELECT a + 30, b FROM t1 WHERE a >= 0; +ANALYZE TABLE t1; +EXPLAIN SELECT b FROM t1 WHERE b between 'L' and 'N' AND a > -100; +DROP TABLE t1; + +--echo # +--echo # Bug#13007154: Crash in keys_to_use_for_scanning with ORDER BY +--echo # and PARTITIONING +--echo # +CREATE TABLE t1 (a INT, KEY(a)) +ENGINE = InnoDB +PARTITION BY KEY (a) PARTITIONS 1; +SELECT 1 FROM t1 WHERE a > (SELECT LAST_INSERT_ID() FROM t1 LIMIT 0) +ORDER BY a; +DROP TABLE t1; + +--echo # +--echo # Bug#56287: crash when using Partition datetime in sub in query +--echo # + +CREATE TABLE t1 +(c1 bigint(20) unsigned NOT NULL AUTO_INCREMENT, + c2 varchar(40) not null default '', + c3 datetime not NULL, + PRIMARY KEY (c1,c3), + KEY partidx(c3)) +ENGINE=InnoDB +PARTITION BY RANGE (TO_DAYS(c3)) +(PARTITION p200912 VALUES LESS THAN (to_days('2010-01-01')), + PARTITION p201103 VALUES LESS THAN (to_days('2011-04-01')), + PARTITION p201912 VALUES LESS THAN MAXVALUE); + +insert into t1(c2,c3) values ("Test row",'2010-01-01 00:00:00'); + +SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test'; +SELECT count(*) FROM t1 p where c3 in +(select c3 from t1 t where t.c3 < timestamp '2011-04-26 19:19:44' + and t.c3 > timestamp '2011-04-26 19:18:44') ; + +DROP TABLE t1; + + +--echo # +--echo # Bug#54747: Deadlock between REORGANIZE PARTITION and +--echo # SELECT is not detected +--echo # + +SET @old_innodb_thread_concurrency := @@innodb_thread_concurrency; +SET @old_innodb_thread_sleep_delay := @@innodb_thread_sleep_delay; +SET GLOBAL innodb_thread_concurrency = 1; + +CREATE TABLE t1 +(user_num BIGINT, + hours SMALLINT, + KEY user_num (user_num)) +ENGINE = InnoDB +PARTITION BY RANGE COLUMNS (hours) +(PARTITION hour_003 VALUES LESS THAN (3), + PARTITION hour_004 VALUES LESS THAN (4), + PARTITION hour_005 VALUES LESS THAN (5), + PARTITION hour_last VALUES LESS THAN (MAXVALUE)); + +INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); + +BEGIN; +SELECT COUNT(*) FROM t1; + +--connect (con1,localhost,root,,) +--echo # SEND a ALTER PARTITION which waits on the ongoing transaction. +--send +ALTER TABLE t1 +REORGANIZE PARTITION hour_003, hour_004 INTO +(PARTITION oldest VALUES LESS THAN (4)); + +--echo # Connection default wait until the ALTER is in 'waiting for table...' +--echo # state and then continue the transaction by trying a SELECT +--connection default +let $wait_condition = +SELECT COUNT(*) = 1 +FROM information_schema.processlist +WHERE INFO like 'ALTER TABLE t1%REORGANIZE PARTITION hour_003, hour_004%' +AND STATE = 'Waiting for table metadata lock'; +--source include/wait_condition.inc +SELECT COUNT(*) FROM t1; +COMMIT; + +--echo # reaping ALTER. +--connection con1 +--reap + +--echo # Cleaning up. +--disconnect con1 + +--connection default + +SET GLOBAL innodb_thread_concurrency = @old_innodb_thread_concurrency; +SET GLOBAL innodb_thread_sleep_delay = @old_innodb_thread_sleep_delay; +DROP TABLE t1; + + +--echo # +--echo # Bug#50418: DROP PARTITION does not interact with transactions +--echo # +CREATE TABLE t1 ( + id INT AUTO_INCREMENT NOT NULL, + name CHAR(50) NOT NULL, + myDate DATE NOT NULL, + PRIMARY KEY (id, myDate), + INDEX idx_date (myDate) + ) ENGINE=InnoDB +PARTITION BY RANGE ( TO_DAYS(myDate) ) ( + PARTITION p0 VALUES LESS THAN (734028), + PARTITION p1 VALUES LESS THAN (734029), + PARTITION p2 VALUES LESS THAN (734030), + PARTITION p3 VALUES LESS THAN MAXVALUE + ) ; +INSERT INTO t1 VALUES +(NULL, 'Lachlan', '2009-09-13'), + (NULL, 'Clint', '2009-09-13'), + (NULL, 'John', '2009-09-14'), + (NULL, 'Dave', '2009-09-14'), + (NULL, 'Jeremy', '2009-09-15'), + (NULL, 'Scott', '2009-09-15'), + (NULL, 'Jeff', '2009-09-16'), + (NULL, 'Joe', '2009-09-16'); +SET AUTOCOMMIT=0; +SELECT * FROM t1 FOR UPDATE; +UPDATE t1 SET name = 'Mattias' WHERE id = 7; +SELECT * FROM t1 WHERE id = 7; +--connect (con1, localhost, root,,) +SET lock_wait_timeout = 1; +--echo # After the patch it will wait and fail on timeout. +--error ER_LOCK_WAIT_TIMEOUT +ALTER TABLE t1 DROP PARTITION p3; +SHOW WARNINGS; +--disconnect con1 +--connection default +SELECT * FROM t1; +--echo # No changes. +COMMIT; +DROP TABLE t1; + + +--echo # +--echo # Bug#51830: Incorrect partition pruning on range partition (regression) +--echo # +CREATE TABLE t1 (a INT NOT NULL) +ENGINE = InnoDB +PARTITION BY RANGE(a) +(PARTITION p10 VALUES LESS THAN (10), + PARTITION p30 VALUES LESS THAN (30), + PARTITION p50 VALUES LESS THAN (50), + PARTITION p70 VALUES LESS THAN (70), + PARTITION p90 VALUES LESS THAN (90)); +INSERT INTO t1 VALUES (10),(30),(50); +INSERT INTO t1 VALUES (70); +INSERT INTO t1 VALUES (80); +INSERT INTO t1 VALUES (89); +--error ER_NO_PARTITION_FOR_GIVEN_VALUE +INSERT INTO t1 VALUES (90); +--error ER_NO_PARTITION_FOR_GIVEN_VALUE +INSERT INTO t1 VALUES (100); +--error ER_NO_PARTITION_FOR_GIVEN_VALUE +insert INTO t1 VALUES (110); +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 90; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 90; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 90; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 89; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 89; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 89; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 100; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 100; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 100; +DROP TABLE t1; + +--echo # +--echo # Bug#50104: Partitioned table with just 1 partion works with fk +--echo # +CREATE TABLE t2 ( + id INT, + PRIMARY KEY (id) +) ENGINE=InnoDB ; + +CREATE TABLE t1 ( + id INT NOT NULL AUTO_INCREMENT, + parent_id INT DEFAULT NULL, + PRIMARY KEY (id), + KEY parent_id (parent_id) +) ENGINE=InnoDB; + +ALTER TABLE t1 PARTITION BY HASH (id) PARTITIONS 1; + +--error ER_FOREIGN_KEY_ON_PARTITIONED +ALTER TABLE t1 ADD CONSTRAINT test_ibfk_1 FOREIGN KEY (parent_id) REFERENCES t2 (id); + +ALTER TABLE t1 PARTITION BY HASH (id) PARTITIONS 2; + +--error ER_FOREIGN_KEY_ON_PARTITIONED +ALTER TABLE t1 ADD CONSTRAINT test_ibfk_1 FOREIGN KEY (parent_id) REFERENCES t2 (id); + +DROP TABLE t1, t2; + +# +# BUG#47774, Assertion failure in InnoDB using column list partitioning +# +create table t1 (a varchar(5), b int signed, c varchar(10), d datetime) +partition by range columns(b,c) +subpartition by hash(to_seconds(d)) +( partition p0 values less than (2, 'b'), + partition p1 values less than (4, 'd'), + partition p2 values less than (10, 'za')); +insert into t1 values ('a', 3, 'w', '2001-10-27 04:34:00'); +insert into t1 values ('r', 7, 'w', '2001-10-27 05:34:00'); +insert into t1 values ('g', 10, 'w', '2001-10-27 06:34:00'); +update t1 set a = 'c' where a > 'f'; +drop table t1; + +# +# BUG#47776, Failed to update for MEMORY engine, crash for InnoDB and success for MyISAM +# +create table t1 (a varchar(5)) +engine=memory +partition by range columns(a) +( partition p0 values less than ('m'), + partition p1 values less than ('za')); +insert into t1 values ('j'); +update t1 set a = 'z' where (a >= 'j'); +drop table t1; + +create table t1 (a varchar(5)) +engine=myisam +partition by range columns(a) +( partition p0 values less than ('m'), + partition p1 values less than ('za')); +insert into t1 values ('j'); +update t1 set a = 'z' where (a >= 'j'); +drop table t1; + +create table t1 (a varchar(5)) +engine=innodb +partition by range columns(a) +( partition p0 values less than ('m'), + partition p1 values less than ('za')); +insert into t1 values ('j'); +update t1 set a = 'z' where (a >= 'j'); +drop table t1; + +# +# Bug#47029: Crash when reorganize partition with subpartition +# +create table t1 (a int not null, + b datetime not null, + primary key (a,b)) +engine=innodb +partition by range (to_days(b)) +subpartition by hash (a) +subpartitions 2 +( partition p0 values less than (to_days('2009-01-01')), + partition p1 values less than (to_days('2009-02-01')), + partition p2 values less than (to_days('2009-03-01')), + partition p3 values less than maxvalue); +alter table t1 reorganize partition p1,p2 into +( partition p2 values less than (to_days('2009-03-01'))); +drop table t1; +# +# Bug#40595: Non-matching rows not released with READ-COMMITTED on tables +# with partitions +CREATE TABLE t1 (id INT PRIMARY KEY, data INT) ENGINE = InnoDB +PARTITION BY RANGE(id) ( + PARTITION p0 VALUES LESS THAN (5), + PARTITION p1 VALUES LESS THAN (10), + PARTITION p2 VALUES LESS THAN MAXVALUE +); + +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); + +SET @old_tx_isolation := @@session.tx_isolation; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; + +SET autocommit = 0; + +UPDATE t1 SET DATA = data*2 WHERE id = 3; + +# SHOW ENGINE InnoDB STATUS does not show transaction info in +# PERFORMANCE-VERSION +# grouping/referencing in replace_regex is very slow on long strings, +# removing all before/after the interesting row before grouping/referencing +#--replace_regex /.*---TRANSACTION [0-9]+ [0-9]+, .*, OS thread id [0-9]+// /MySQL thread id [0-9]+, query id [0-9]+ .*// /.*([0-9]+) lock struct\(s\), heap size [0-9]+, ([0-9]+) row lock\(s\).*/\1 lock struct(s) \2 row lock(s)/ +#SHOW ENGINE InnoDB STATUS; + +UPDATE t1 SET data = data*2 WHERE data = 2; + +# SHOW ENGINE InnoDB STATUS does not show transaction info in +# PERFORMANCE-VERSION +# grouping/referencing in replace_regex is very slow on long strings, +# removing all before/after the interesting row before grouping/referencing +#--replace_regex /.*---TRANSACTION [0-9]+ [0-9]+, .*, OS thread id [0-9]+// /MySQL thread id [0-9]+, query id [0-9]+ .*// /.*([0-9]+ lock struct\(s\)), heap size [0-9]+, ([0-9]+ row lock\(s\)).*/\1 \2/ +#SHOW ENGINE InnoDB STATUS; + +SET @@session.tx_isolation = @old_tx_isolation; + +DROP TABLE t1; + +# +# Bug37721: ORDER BY when WHERE contains non-partitioned index column +# wrong order since it did not use pk as second compare +--echo # Bug#37721, test of ORDER BY on PK and WHERE on INDEX +CREATE TABLE t1 ( + a INT, + b INT, + PRIMARY KEY (a), + INDEX (b)) +ENGINE InnoDB +PARTITION BY HASH(a) +PARTITIONS 3; +# This will give the middle partition the highest value +INSERT INTO t1 VALUES (0,0),(4,0),(2,0); +SELECT a FROM t1 WHERE b = 0 ORDER BY a ASC; +SELECT a FROM t1 WHERE b = 0 ORDER BY a DESC; +ALTER TABLE t1 DROP INDEX b; +SELECT a FROM t1 WHERE b = 0 ORDER BY a ASC; +SELECT a FROM t1 WHERE b = 0 ORDER BY a DESC; +DROP TABLE t1; +CREATE TABLE t1 ( + a VARCHAR(600), + b VARCHAR(600), + PRIMARY KEY (a), + INDEX (b)) +ENGINE InnoDB +PARTITION BY KEY(a) +PARTITIONS 3; +# This will give the middle partition the highest value +INSERT INTO t1 VALUES (concat(repeat('MySQL',100),'1'),repeat('0',257)); +INSERT INTO t1 VALUES (concat(repeat('MySQL',100),'3'),repeat('0',257)); +INSERT INTO t1 VALUES (concat(repeat('MySQL',100),'2'),repeat('0',257)); +SELECT right(a,1) FROM t1 WHERE b = repeat('0',257) ORDER BY a ASC; +SELECT right(a,1) FROM t1 WHERE b = repeat('0',257) ORDER BY a DESC; +ALTER TABLE t1 DROP INDEX b; +SELECT right(a,1) FROM t1 WHERE b = repeat('0',257) ORDER BY a ASC; +SELECT right(a,1) FROM t1 WHERE b = repeat('0',257) ORDER BY a DESC; +DROP TABLE t1; + +# +# Bug#32948 - FKs allowed to reference partitioned table +# +-- echo # Bug#32948 +CREATE TABLE t1 (c1 INT, PRIMARY KEY (c1)) ENGINE=INNODB; +CREATE TABLE t2 (c1 INT, PRIMARY KEY (c1), + FOREIGN KEY (c1) REFERENCES t1 (c1) + ON DELETE CASCADE) +ENGINE=INNODB; +--error ER_ROW_IS_REFERENCED +ALTER TABLE t1 PARTITION BY HASH(c1) PARTITIONS 5; +--error ER_ROW_IS_REFERENCED +ALTER TABLE t1 ENGINE=MyISAM; +DROP TABLE t2; +DROP TABLE t1; + +# +# Bug #14673: Wrong InnoDB default row format +# +create table t1 (a int) engine=innodb partition by hash(a) ; +# Data_free for InnoDB tablespace varies depending on which +# tests have been run before this one +--replace_column 10 # 12 # +show table status like 't1'; +drop table t1; + +# +# Bug 21173: SHOW TABLE STATUS crashes server in InnoDB +# +create table t1 (a int) +engine = innodb +partition by key (a); +# Data_free for InnoDB tablespace varies depending on which +# tests have been run before this one +--replace_column 10 # 12 # +show table status; +insert into t1 values (0), (1), (2), (3); +# Data_free for InnoDB tablespace varies depending on which +# tests have been run before this one +--replace_column 10 # 12 # +show table status; +drop table t1; + +create table t1 (a int auto_increment primary key) +engine = innodb +partition by key (a); +# Data_free for InnoDB tablespace varies depending on which +# tests have been run before this one +--replace_column 10 # 12 # +show table status; +insert into t1 values (NULL), (NULL), (NULL), (NULL); +# Data_free for InnoDB tablespace varies depending on which +# tests have been run before this one +--replace_column 10 # 12 # +show table status; +insert into t1 values (NULL), (NULL), (NULL), (NULL); +# Data_free for InnoDB tablespace varies depending on which +# tests have been run before this one +--replace_column 10 # 12 # +show table status; +drop table t1; + +# +# BUG 19122 Crash after ALTER TABLE t1 REBUILD PARTITION p1 +# +create table t1 (a int) +partition by key (a) +(partition p1 engine = innodb); + +alter table t1 rebuild partition p1; +alter table t1 rebuild partition p1; +alter table t1 rebuild partition p1; +alter table t1 rebuild partition p1; +alter table t1 rebuild partition p1; +alter table t1 rebuild partition p1; +alter table t1 rebuild partition p1; +drop table t1; + +# +# Bug 21339: Crash in Explain Partitions +# +create table t1 (a date) +engine = innodb +partition by range (year(a)) +(partition p0 values less than (2006), + partition p1 values less than (2007)); +explain partitions select * from t1 +where a between '2006-01-01' and '2007-06-01'; +drop table t1; + +# +# Bug 20397: Partitions: Crash when using non-existing engine +# +SET SQL_MODE=""; +create table t1 (a int) +engine = x +partition by key (a); +show create table t1; +drop table t1; + +create table t1 (a int) +engine = innodb +partition by list (a) +(partition p0 values in (0)); + +alter table t1 engine = x; +show create table t1; +drop table t1; +SET SQL_MODE=default; + +# BUG#26117: index_merge sort-union over partitioned table crashes + +create table t1 +( + id int unsigned auto_increment, + time datetime not null, + first_name varchar(40), + last_name varchar(50), + primary key (id, time), + index first_index (first_name), + index last_index (last_name) +) engine=Innodb partition by range (to_days(time)) ( + partition p1 values less than (to_days('2007-02-07')), + partition p2 values less than (to_days('2007-02-08')), + partition p3 values less than MAXVALUE +); + +insert into t1 (time, first_name, last_name) values ('2007-02-07', 'Q', 'Robert'), +('2007-02-07', 'Mark', 'Nate'), ('2007-02-07', 'Nate', 'Oscar'), +('2007-02-07', 'Zack', 'Alice'), ('2007-02-07', 'Jack', 'Kathy'), +('2007-02-06', 'Alice', 'Alice'), ('2007-02-06', 'Brian', 'Charles'), +('2007-02-06', 'Charles', 'David'), ('2007-02-06', 'David', 'Eric'), +('2007-02-07', 'Hector', 'Isaac'), ('2007-02-07', 'Oscar', 'Patricia'), +('2007-02-07', 'Patricia', 'Q'), ('2007-02-07', 'X', 'Yuri'), +('2007-02-07', 'Robert', 'Shawn'), ('2007-02-07', 'Kathy', 'Lois'), +('2007-02-07', 'Eric', 'Francis'), ('2007-02-06', 'Shawn', 'Theron'), +('2007-02-06', 'U', 'Vincent'), ('2007-02-06', 'Francis', 'George'), +('2007-02-06', 'George', 'Hector'), ('2007-02-06', 'Vincent', 'Walter'), +('2007-02-06', 'Walter', 'X'), ('2007-02-07', 'Lois', 'Mark'), +('2007-02-07', 'Yuri', 'Zack'), ('2007-02-07', 'Isaac', 'Jack'), +('2007-02-07', 'Sharon', 'Mark'), ('2007-02-07', 'Michael', 'Michelle'), +('2007-02-07', 'Derick', 'Nathan'), ('2007-02-07', 'Peter', 'Xavier'), +('2007-02-07', 'Fred', 'Harold'), ('2007-02-07', 'Katherine', 'Lisa'), +('2007-02-07', 'Tom', 'Rina'), ('2007-02-07', 'Jerry', 'Victor'), +('2007-02-07', 'Alexander', 'Terry'), ('2007-02-07', 'Justin', 'John'), +('2007-02-07', 'Greg', 'Ernest'), ('2007-02-07', 'Robert', 'Q'), +('2007-02-07', 'Nate', 'Mark'), ('2007-02-07', 'Oscar', 'Nate'), +('2007-02-07', 'Alice', 'Zack'), ('2007-02-07', 'Kathy', 'Jack'), +('2007-02-06', 'Alice', 'Alice'), ('2007-02-06', 'Charles', 'Brian'), +('2007-02-06', 'David', 'Charles'), ('2007-02-06', 'Eric', 'David'), +('2007-02-07', 'Isaac', 'Hector'), ('2007-02-07', 'Patricia', 'Oscar'), +('2007-02-07', 'Q', 'Patricia'), ('2007-02-07', 'Yuri', 'X'), +('2007-02-07', 'Shawn', 'Robert'), ('2007-02-07', 'Lois', 'Kathy'), +('2007-02-07', 'Francis', 'Eric'), ('2007-02-06', 'Theron', 'Shawn'), +('2007-02-06', 'Vincent', 'U'), ('2007-02-06', 'George', 'Francis'), +('2007-02-06', 'Hector', 'George'), ('2007-02-06', 'Walter', 'Vincent'), +('2007-02-06', 'X', 'Walter'), ('2007-02-07', 'Mark', 'Lois'), +('2007-02-07', 'Zack', 'Yuri'), ('2007-02-07', 'Jack', 'Isaac'), +('2007-02-07', 'Mark', 'Sharon'), ('2007-02-07', 'Michelle', 'Michael'), +('2007-02-07', 'Nathan', 'Derick'), ('2007-02-07', 'Xavier', 'Peter'), +('2007-02-07', 'Harold', 'Fred'), ('2007-02-07', 'Lisa', 'Katherine'), +('2007-02-07', 'Rina', 'Tom'), ('2007-02-07', 'Victor', 'Jerry'), +('2007-02-07', 'Terry', 'Alexander'), ('2007-02-07', 'John', 'Justin'), +('2007-02-07', 'Ernest', 'Greg'); + +SELECT * FROM t1 WHERE first_name='Andy' OR last_name='Jake'; + +drop table t1; + +# +# BUG#30583 - Partition on DOUBLE key + INNODB + count(*) == crash +# +CREATE TABLE t1 (a DOUBLE NOT NULL, KEY(a)) ENGINE=InnoDB +PARTITION BY KEY(a) PARTITIONS 10; +INSERT INTO t1 VALUES(1),(2); +SELECT COUNT(*) FROM t1; +DROP TABLE t1; + +# +# Bug #31893 Partitions: crash if subpartitions and engine change +# +create table t1 (int_column int, char_column char(5)) + PARTITION BY RANGE (int_column) subpartition by key (char_column) subpartitions 2 + (PARTITION p1 VALUES LESS THAN (5) ENGINE = InnoDB); +alter table t1 +ENGINE = MyISAM +PARTITION BY RANGE (int_column) + subpartition by key (char_column) subpartitions 2 + (PARTITION p1 VALUES LESS THAN (5)); +show create table t1; +drop table t1; + +# +# BUG#46483 - drop table of partitioned table may leave extraneous file +# Note: was only repeatable with InnoDB plugin +# +CREATE TABLE t1 (a INT) ENGINE=InnoDB + PARTITION BY list(a) (PARTITION p1 VALUES IN (1)); +CREATE INDEX i1 ON t1 (a); +DROP TABLE t1; + +# Before the fix it should show extra file like #sql-2405_2.par +--list_files $MYSQLD_DATADIR/test/ *.par + +--disable_parsing +--echo # +--echo # Bug#47343: InnoDB fails to clean-up after lock wait timeout on +--echo # REORGANIZE PARTITION +--echo # +CREATE TABLE t1 ( + a INT, + b DATE NOT NULL, + PRIMARY KEY (a, b) +) ENGINE=InnoDB +PARTITION BY RANGE (a) ( + PARTITION pMAX VALUES LESS THAN MAXVALUE +) ; + +INSERT INTO t1 VALUES (1, '2001-01-01'), (2, '2002-02-02'), (3, '2003-03-03'); + +START TRANSACTION; +SELECT * FROM t1 FOR UPDATE; + +connect (con1, localhost, root,,); +--error ER_LOCK_WAIT_TIMEOUT +ALTER TABLE t1 REORGANIZE PARTITION pMAX INTO +(PARTITION p3 VALUES LESS THAN (3), + PARTITION pMAX VALUES LESS THAN MAXVALUE); +SHOW WARNINGS; +--error ER_LOCK_WAIT_TIMEOUT +ALTER TABLE t1 REORGANIZE PARTITION pMAX INTO +(PARTITION p3 VALUES LESS THAN (3), + PARTITION pMAX VALUES LESS THAN MAXVALUE); +SHOW WARNINGS; + +#Contents of the 'test' database directory: +--list_files $MYSQLD_DATADIR/test/ *.par + +disconnect con1; +connection default; +SELECT * FROM t1; +COMMIT; +DROP TABLE t1; + +# +# Bug #55146 Assertion `m_part_spec.start_part == m_part_spec.end_part' in index_read_idx_map +# + +CREATE TABLE t1 (i1 int NOT NULL primary key, f1 int) ENGINE = InnoDB + PARTITION BY HASH(i1) PARTITIONS 2; + +INSERT INTO t1 VALUES (1,1), (2,2); + +SELECT * FROM t1 WHERE i1 = ( SELECT i1 FROM t1 WHERE f1=0 LIMIT 1 ); + +DROP TABLE t1; + +--enable_parsing + +--echo # +--echo # Bug#54783: optimize table crashes with invalid timestamp default value and NO_ZERO_DATE +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (a INT, b TIMESTAMP DEFAULT '0000-00-00 00:00:00') + ENGINE=INNODB PARTITION BY LINEAR HASH (a) PARTITIONS 1; +SET @old_mode = @@sql_mode; +SET SESSION sql_mode = 'NO_ZERO_DATE'; +OPTIMIZE TABLE t1; +SET SESSION sql_mode = @old_mode; +DROP TABLE t1; + +--echo # +--echo # Bug#57985 "ONLINE/FAST ALTER PARTITION can fail and leave the +--echo # table unusable". +--echo # +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +CREATE TABLE t1 (a bigint not null, b int not null, PRIMARY KEY (a)) + ENGINE = InnoDB PARTITION BY KEY(a) PARTITIONS 2; +INSERT INTO t1 values (0,1), (1,2); +--echo # The below ALTER should fail. It should leave the +--echo # table in its original, non-corrupted, usable state. +--error ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF +ALTER TABLE t1 ADD UNIQUE KEY (b); +--echo # The below statements should succeed, as ALTER should +--echo # have left table intact. +SHOW CREATE TABLE t1; +SELECT * FROM t1; +DROP TABLE t1; +--echo # +--echo # Bug #17299181 CREATE_TIME AND UPDATE_TIME ARE +--echo # WRONG FOR PARTITIONED TABLES +--echo # + +CREATE TABLE t1 (a int, PRIMARY KEY (a)) ENGINE=InnoDB +PARTITION BY HASH (a) PARTITIONS 2; + +SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE +CREATE_TIME IS NOT NULL AND TABLE_NAME='t1'; + +DROP TABLE t1; + +--echo # +--echo # BUG#12912171 - ASSERTION FAILED: QUICK->HEAD->READ_SET == +--echo # SAVE_READ_SET +--echo # +CREATE TABLE t1 ( + a INT, + b INT, + c INT, + PRIMARY KEY (c,a), KEY (a),KEY (a) +) ENGINE=INNODB PARTITION BY KEY () PARTITIONS 2; +INSERT INTO t1 VALUES (1,5,1),(2,4,1),(3,3,1),(4,2,1),(5,1,1); +UPDATE t1 SET b = 0, c=1 WHERE a <=>0; +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # MDEV-5102 : MySQL Bug 69851 +--echo # +CREATE TABLE t1 ( + `col1` bigint(20) unsigned NOT NULL , + `col2` bigint(20) unsigned NOT NULL , + `col3` datetime NOT NULL , + PRIMARY KEY (`col3`), + KEY (`col1`), + KEY (`col2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 + PARTITION BY RANGE (TO_DAYS(col3)) +( + PARTITION p_20130310 VALUES LESS THAN (735303) ENGINE = InnoDB, + PARTITION p_20130311 VALUES LESS THAN (735304) ENGINE = InnoDB, + PARTITION p_20130312 VALUES LESS THAN (735305) ENGINE = InnoDB +); +INSERT INTO `t1` VALUES (2,96,'2013-03-08 16:28:05'); +INSERT INTO `t1` VALUES (1,2,'2013-03-08 16:47:39'); +INSERT INTO `t1` VALUES (1,2,'2013-03-08 16:50:27'); +INSERT INTO `t1` VALUES (1,2,'2013-03-11 16:33:04'); +INSERT INTO `t1` VALUES (1,2,'2013-03-11 16:33:24'); +INSERT INTO `t1` VALUES (2,2,'2013-03-12 10:11:48'); + +SELECT * FROM t1 WHERE col1 = 1 AND col2 = 2 + AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00' +GROUP BY 1, 2, 3; +--replace_column 9 # +EXPLAIN SELECT * FROM t1 WHERE col1 = 1 AND col2 = 2 + AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00' +GROUP BY 1, 2, 3; + +SELECT * FROM t1 USE INDEX () WHERE col1 = 1 AND col2 = 2 + AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00' +GROUP BY 1, 2, 3; + +DROP TABLE t1; + +--echo # +--echo # MDEV-5177: ha_partition and innodb index intersection produce fewer rows (MySQL Bug#70703) +--echo # +create table t1 ( + a int not null, + b int not null, + pk int not null, + primary key (pk), + key(a), + key(b) +) engine=innodb partition by hash(pk) partitions 10; + +insert into t1 values (1,2,4); # both +insert into t1 values (1,0,17); # left +insert into t1 values (1,2,25); # both + +insert into t1 values (10,20,122); +insert into t1 values (10,20,123); + +# Now, fill in some data so that the optimizer choses index_merge +create table t2 (a int); +insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +insert into t1 select 1,2, 200 + A.a + 10*B.a + 100*C.a from t2 A, t2 B, t2 C; + +insert into t1 select 10+A.a + 10*B.a + 100*C.a + 1000*D.a, + 10+A.a + 10*B.a + 100*C.a + 1000*D.a, + 2000 + A.a + 10*B.a + 100*C.a + 1000*D.a + from t2 A, t2 B, t2 C ,t2 D; + +# This should show index_merge, using intersect +--replace_column 9 # +explain select * from t1 where a=1 and b=2 and pk between 1 and 999999 ; +# 794 rows in output +create temporary table t3 as +select * from t1 where a=1 and b=2 and pk between 1 and 999 ; +select count(*) from t3; +drop table t3; + +# 802 rows in output +create temporary table t3 as +select * from t1 ignore index(a,b) where a=1 and b=2 and pk between 1 and 999 ; +select count(*) from t3; +drop table t3; + +drop table t1,t2; + +--echo # +--echo # MySQL Bug#71095: Wrong results with PARTITION BY LIST COLUMNS() +--echo # +create table t1(c1 int, c2 int, c3 int, c4 int, +primary key(c1,c2)) engine=InnoDB +partition by list columns(c2) +(partition p1 values in (1,2) engine=InnoDB, +partition p2 values in (3,4) engine=InnoDB); + +insert into t1 values (1,1,1,1),(2,3,1,1); +select * from t1 where c1=2 and c2=3; +drop table t1; + +--echo # +--echo # MySQL Bug#72803: Wrong "Impossible where" with LIST partitioning +--echo # also MDEV-6240: Wrong "Impossible where" with LIST partitioning +--echo # +CREATE TABLE t1 ( d DATE) ENGINE = InnoDB +PARTITION BY LIST COLUMNS (d) +( + PARTITION p0 VALUES IN ('1990-01-01','1991-01-01'), + PARTITION p1 VALUES IN ('1981-01-01') +); + +INSERT INTO t1 (d) VALUES ('1991-01-01'); +SELECT * FROM t1 WHERE d = '1991-01-01'; +DROP TABLE t1; + +set global default_storage_engine=default; + +--echo # +--echo # MDEV-9455: [ERROR] mysqld got signal 11 +--echo # + +CREATE TABLE `t1` ( + `DIARY_TOTAL_DAY_SEQ` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `IMORY_ID` bigint(20) NOT NULL, + `NAME` varchar(75) DEFAULT NULL, + `DATETIME` varchar(10) NOT NULL DEFAULT '', + `DAILY_CALL_CNT` int(11) DEFAULT NULL, + `DAILY_SMS_CNT` int(11) DEFAULT NULL, + `NUMBER` varchar(64) DEFAULT NULL, + `DURATION` varchar(16) DEFAULT NULL, + PRIMARY KEY (`DIARY_TOTAL_DAY_SEQ`,`DATETIME`), + KEY `IDX_t1_01` (`IMORY_ID`,`DATETIME`) +) AUTO_INCREMENT=328702514 DEFAULT CHARSET=utf8mb4 +PARTITION BY RANGE COLUMNS(`DATETIME`) +(PARTITION p0 VALUES LESS THAN ('2015-10-01') ENGINE = InnoDB, + PARTITION p1 VALUES LESS THAN ('2015-11-01') ENGINE = InnoDB, + PARTITION p2 VALUES LESS THAN ('2015-12-01') ENGINE = InnoDB, + PARTITION p3 VALUES LESS THAN ('2016-01-01') ENGINE = InnoDB, + PARTITION p4 VALUES LESS THAN ('2016-02-01') ENGINE = InnoDB, + PARTITION p5 VALUES LESS THAN ('2016-03-01') ENGINE = InnoDB, + PARTITION p6 VALUES LESS THAN ('2016-04-01') ENGINE = InnoDB, + PARTITION p7 VALUES LESS THAN ('2016-05-01') ENGINE = InnoDB, + PARTITION p8 VALUES LESS THAN ('2016-06-01') ENGINE = InnoDB, + PARTITION p9 VALUES LESS THAN ('2016-07-01') ENGINE = InnoDB, + PARTITION p10 VALUES LESS THAN ('2016-08-01') ENGINE = InnoDB) +; + +CREATE TABLE `t2` ( + `DIARY_SEQ` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `IMORY_ID` bigint(20) NOT NULL, + `CALL_TYPE` varchar(1) DEFAULT NULL, + `DATA_TYPE` varchar(1) DEFAULT NULL, + `FEATURES` varchar(1) DEFAULT NULL, + `NAME` varchar(75) DEFAULT NULL, + `NUMBER` varchar(64) DEFAULT NULL, + `DATETIME` datetime NOT NULL, + `REG_DATE` datetime NOT NULL, + `TITLE` varchar(50) DEFAULT NULL, + `BODY` varchar(4200) DEFAULT NULL, + `MIME_TYPE` varchar(32) DEFAULT NULL, + `DURATION` varchar(16) DEFAULT NULL, + `DEVICE_ID` varchar(64) DEFAULT NULL, + `DEVICE_NAME` varchar(32) DEFAULT NULL, + PRIMARY KEY (`DIARY_SEQ`,`DATETIME`,`REG_DATE`), + KEY `IDX_TB_DIARY_01` (`IMORY_ID`,`DATETIME`,`CALL_TYPE`,`NUMBER`), + KEY `IDX_TB_DIARY_02` (`REG_DATE`) +) AUTO_INCREMENT=688799006 DEFAULT CHARSET=utf8mb4 +PARTITION BY RANGE COLUMNS(REG_DATE) +(PARTITION p0 VALUES LESS THAN ('2015-10-01') ENGINE = InnoDB, + PARTITION p1 VALUES LESS THAN ('2015-11-01') ENGINE = InnoDB, + PARTITION p2 VALUES LESS THAN ('2015-12-01') ENGINE = InnoDB, + PARTITION p3 VALUES LESS THAN ('2016-01-01') ENGINE = InnoDB, + PARTITION p4 VALUES LESS THAN ('2016-02-01') ENGINE = InnoDB, + PARTITION p5 VALUES LESS THAN ('2016-03-01') ENGINE = InnoDB, + PARTITION p6 VALUES LESS THAN ('2016-04-01') ENGINE = InnoDB, + PARTITION p7 VALUES LESS THAN ('2016-05-01') ENGINE = InnoDB, + PARTITION p8 VALUES LESS THAN ('2016-06-01') ENGINE = InnoDB, + PARTITION p9 VALUES LESS THAN ('2016-07-01') ENGINE = InnoDB, + PARTITION p10 VALUES LESS THAN ('2016-08-01') ENGINE = InnoDB) +; + +SELECT + A.IMORY_ID, + A.NUMBER, + A.NAME, + DATE_FORMAT(A.DATETIME, '%Y-%m-%d') AS TARGET_DATE, + SUM( CASE WHEN A.DATA_TYPE='1' THEN 1 ELSE 0 END) AS CALL_CNT, + SUM( CASE WHEN A.DATA_TYPE IN ('2', '3') THEN 1 ELSE 0 END) AS SMS_CNT, + SUM(CAST(A.DURATION AS INT)) AS DURATION, + ( SELECT COUNT(*) + FROM t1 + WHERE IMORY_ID=A.IMORY_ID + AND NUMBER=A.NUMBER + AND NAME=A.NAME + AND DATETIME = DATE_FORMAT(A.DATETIME, '%Y-%m-%d') + ) STATS_COUNT +FROM t2 A +WHERE A.IMORY_ID = 55094102 + AND A.DATETIME LIKE ( + SELECT CONCAT (DATE_FORMAT(DATETIME, '%Y-%m-%d') ,'%') + FROM t2 + WHERE IMORY_ID=55094102 + AND DIARY_SEQ IN ( 608351221, 608351225, 608351229 ) + group by DATE_FORMAT(DATETIME, '%Y-%m-%d') + ) +GROUP BY A.IMORY_ID, A.NUMBER, A.NAME, DATE_FORMAT(A.DATETIME, '%Y-%m-%d') +; + +drop table t2, t1; + + +set global default_storage_engine='innodb'; + +--echo # +--echo # MDEV-5963: InnoDB: Assertion failure in file row0sel.cc line 2503, +--echo # Failing assertion: 0 with "key ptr now exceeds key end by 762 bytes" +--echo # (independent testcase for Oracle Bug#13947868) +--echo # +CREATE TABLE t1 (f1 VARCHAR(512) CHARACTER SET utf8) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('j'); + +CREATE TABLE t2 ( + f2 VARCHAR(5) CHARACTER SET latin1, + f3 VARCHAR(5) CHARACTER SET utf8, + f4 INT, + f5 VARCHAR(512) CHARACTER SET utf8, + f6 VARCHAR(256) CHARACTER SET utf8, + key (f2), + key (f3), + key (f5) +) ENGINE=InnoDB PARTITION BY LIST COLUMNS (f4) + SUBPARTITION BY KEY(f6) SUBPARTITIONS 4 ( + PARTITION p0 VALUES IN (1,3,9,null), + PARTITION p1 VALUES IN (2,4,0) +); + +INSERT INTO t2 VALUES + ('k','s',3,'b','j'),('a','b',NULL,'v','j'),('c','m',9,'t',NULL), + ('b','l',9,'b',NULL),('i','y',3,'o','w'),('c','m',NULL,'a','m'), + ('f','o',9,'m','w'),('f','q',NULL,'o','a'); + +CREATE TABLE t3 LIKE t2; + +SELECT * FROM t1 INNER JOIN t2 ON ( f5 = f1 ); +INSERT INTO t3 SELECT * FROM t2 WHERE f3 = 'm' AND f2 ='c'; + +DROP TABLE t1,t2,t3; + +set global default_storage_engine=default; + +--echo # +--echo # Bug#13737949: CRASH IN HA_PARTITION::INDEX_INIT +--echo # Bug#18694052: SERVER CRASH IN HA_PARTITION::INIT_RECORD_PRIORITY_QUEUE +--echo # +CREATE TABLE t1 +(a INT, + b INT, + PRIMARY KEY (a)) + ENGINE = InnoDB + PARTITION BY HASH (a) PARTITIONS 3; + START TRANSACTION WITH CONSISTENT SNAPSHOT; + --connect (con1, localhost, root,,) + ALTER TABLE t1 ADD INDEX idx1 (b); + --connection default + --error ER_TABLE_DEF_CHANGED + SELECT b FROM t1 WHERE b = 0; + --error ER_TABLE_DEF_CHANGED + SELECT b FROM t1 WHERE b = 0; + --disconnect con1 + DROP TABLE t1; + +--echo # Same test without partitioning +CREATE TABLE t1 +(a INT, + b INT, + PRIMARY KEY (a)) + ENGINE = InnoDB; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +--connect (con1, localhost, root,,) +ALTER TABLE t1 ADD INDEX idx1 (b); +--connection default +--error ER_TABLE_DEF_CHANGED +SELECT b FROM t1 WHERE b = 0; +--error ER_TABLE_DEF_CHANGED +SELECT b FROM t1 WHERE b = 0; +--disconnect con1 +DROP TABLE t1; + +--echo # +--echo # MDEV-11167: InnoDB: Warning: using a partial-field key prefix +--echo # in search, results in assertion failure or "Can't find record" error +--echo # + +set @save_sql_mode = @@sql_mode; +set sql_mode=""; +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +CREATE TABLE t2 (b INT, c INT, KEY(b)) ENGINE=InnoDB PARTITION BY HASH(c) PARTITIONS 2; +CREATE ALGORITHM = MERGE VIEW v AS SELECT a, b FROM t1 STRAIGHT_JOIN t2 WHERE b = 'foo' WITH CHECK OPTION; + +INSERT INTO t1 VALUES (1),(2); +INSERT IGNORE INTO t2 VALUES (2,2),('three',3),(4,4); +UPDATE v SET a = NULL; + +DROP view v; +DROP TABLE t1, t2; + +SET @save_isp=@@innodb_stats_persistent; +SET GLOBAL innodb_stats_persistent= ON; + +CREATE TABLE t (f1 INT, f2 INT, KEY(f2)) ENGINE=InnoDB PARTITION BY HASH (f1) PARTITIONS 2; +INSERT IGNORE INTO t VALUES (NULL,0),(NULL,0),(0,21),(4,0),(1,8),(5,66); +CREATE ALGORITHM=MERGE VIEW v AS SELECT t1.* FROM t t1 JOIN t t2 WHERE t1.f1 < t2.f2 WITH LOCAL CHECK OPTION; +--error ER_VIEW_CHECK_FAILED +UPDATE v SET f2 = NULL; + +SET GLOBAL innodb_stats_persistent= @save_isp; +DROP view v; +DROP TABLE t; +set sql_mode= @save_sql_mode; + ++--echo # ++--echo # Bug#28573894 ALTER PARTITIONED TABLE ADD AUTO_INCREMENT DIFF RESULT ++--echo # ++CREATE TABLE t (a VARCHAR(10) NOT NULL,b INT,PRIMARY KEY (b)) ENGINE=INNODB ++PARTITION BY RANGE (b) ++(PARTITION pa VALUES LESS THAN (2), ++ PARTITION pb VALUES LESS THAN (20), ++ PARTITION pc VALUES LESS THAN (30), ++ PARTITION pd VALUES LESS THAN (40)); ++ ++INSERT INTO t ++VALUES('A',0),('B',1),('C',2),('D',3),('E',4),('F',5),('G',25),('H',35); ++CREATE TABLE t_copy LIKE t; ++INSERT INTO t_copy SELECT * FROM t; ++ ++--enable_info ++ALTER TABLE t ADD COLUMN r INT UNSIGNED NOT NULL AUTO_INCREMENT, ++ADD UNIQUE KEY (r,b); ++ALTER TABLE t_copy ADD COLUMN r INT UNSIGNED NOT NULL AUTO_INCREMENT, ++ADD UNIQUE KEY (r,b), ALGORITHM=COPY; ++--disable_info ++SELECT * FROM t; ++SELECT * FROM t_copy; ++DROP TABLE t,t_copy; ++ +--echo # +--echo # Bug#26390658 RENAMING A PARTITIONED TABLE DOES NOT UPDATE +--echo # MYSQL.INNODB_TABLE_STATS +--echo # + +CREATE DATABASE test_jfg; + +CREATE TABLE test_jfg.test_jfg1 (id int(10) unsigned NOT NULL,PRIMARY +KEY (id)) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=1; +CREATE TABLE test_jfg.test_jfg2 (id int(10) unsigned NOT NULL,PRIMARY +KEY (id)) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=1 +PARTITION BY RANGE ( id ) (PARTITION p1000 VALUES LESS THAN (1000) +ENGINE = InnoDB,PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = +InnoDB); + +--replace_result #p# #P# +SELECT database_name, table_name FROM mysql.innodb_table_stats WHERE +database_name = 'test_jfg'; + +RENAME TABLE test_jfg.test_jfg1 TO test_jfg.test_jfg11; +RENAME TABLE test_jfg.test_jfg2 TO test_jfg.test_jfg12; + +--replace_result #p# #P# +SELECT database_name, table_name FROM mysql.innodb_table_stats WHERE +database_name = 'test_jfg'; + +DROP DATABASE test_jfg; + +# +# MDEV-17755 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))' failed in Field_bit::val_int upon SELECT with JOIN, partitions, indexed virtual column +# +create table t1 (a int) engine=innodb; +create table t2 ( + b int, + c int, + d bit not null default 0, + v bit as (d) virtual, + key (b,v) +) engine=innodb partition by hash (b); +insert into t1 values (1),(2); +insert into t2 (b,c,d) values (1,1,0),(2,2,0); +explain select t1.* from t1 join t2 on (v = a); +select t1.* from t1 join t2 on (v = a); +drop table t1, t2; + +--echo # +--echo # End of 10.2 tests +--echo # + +--echo # +--echo # MDEV-16241 Assertion `inited==RND' failed in handler::ha_rnd_end() +--echo # +CREATE TABLE t1 (pk INT PRIMARY KEY, x INT, y INT, z INT, KEY (x), KEY (y, z)) +WITH SYSTEM VERSIONING +PARTITION BY SYSTEM_TIME (PARTITION p1 HISTORY, PARTITION pn CURRENT); +INSERT INTO t1 VALUES (1, 7, 8, 9), (2, NULL, NULL, NULL), (3, NULL, NULL, NULL); +SELECT COUNT(*) FROM t1 WHERE x IS NULL AND y IS NULL AND z IS NULL; +DROP TABLE t1; + +--echo # +--echo # End of 10.3 tests +--echo # diff --cc mysql-test/main/ps.result index b0c7c7d9847,00000000000..5145a50d273 mode 100644,000000..100644 --- a/mysql-test/main/ps.result +++ b/mysql-test/main/ps.result @@@ -1,5368 -1,0 +1,5391 @@@ +call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.'); +drop table if exists t1,t2,t3,t4; +drop database if exists mysqltest1; +drop database if exists client_test_db; +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 HY000: This command is not supported in the prepared statement protocol yet +prepare stmt2 from 'execute stmt1'; +ERROR HY000: This command is not supported in the prepared statement protocol yet +prepare stmt2 from 'deallocate prepare z'; +ERROR HY000: This command is not supported in the prepared statement protocol yet +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 'test.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 MariaDB 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 MariaDB 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 MariaDB 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 MariaDB 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 MariaDB 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 MariaDB server version for the right syntax to use near '123.4567' at line 1 +drop table t1,t2; +deallocate prepare stmt3; +deallocate prepare stmt4; +deallocate prepare stmt5; +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() +1 +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, 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 @save_optimizer_switch=@@optimizer_switch; +set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=off"; +set @tmp_optimizer_switch=@@optimizer_switch; +set optimizer_switch='derived_merge=off,derived_with_keys=off'; +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 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +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 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +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 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +4 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +deallocate prepare stmt1; +set optimizer_switch=@tmp_optimizer_switch; +drop tables t1,t2; +set @@optimizer_switch=@save_optimizer_switch; +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 Max_index_length Temporary +t1 MyISAM 10 Dynamic 0 0 0 4294967295 1024 0 NULL # # # latin1_swedish_ci NULL 288230376151710720 N +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 Max_index_length Temporary +t1 MyISAM 10 Dynamic 0 0 0 4294967295 1024 0 NULL # # # latin1_swedish_ci NULL 288230376151710720 N +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 '<MYSQLTEST_VARDIR>/tmp/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 +deallocate prepare `ü`; +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) from t1; +rand() cast(rand(10)*@precision as unsigned integer) +- 6570515220 +- 1282061302 +- 6698761160 +- 9647622201 +prepare stmt from +"select rand(), + cast(rand(10)*@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(?)*@precision as unsigned integer) +- 6570515220 - +- 1282061302 - +- 6698761160 - +- 9647622201 - +set @var=2; +execute stmt using @var; +rand() cast(rand(10)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer) +- 6570515220 6555866465 +- 1282061302 1223466193 +- 6698761160 6449731874 +- 9647622201 8578261098 +set @var=3; +execute stmt using @var; +rand() cast(rand(10)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer) +- 6570515220 9057697560 +- 1282061302 3730790581 +- 6698761160 1480860535 +- 9647622201 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; +drop table if exists t1; +create temporary table if not exists t1 (a1 int); +prepare stmt from "delete t1 from t1 where (cast(a1/3 as unsigned) * 3) = a1"; +drop temporary table t1; +create temporary table if not exists t1 (a1 int); +execute stmt; +drop temporary table t1; +create temporary table if not exists t1 (a1 int); +execute stmt; +drop temporary table t1; +create temporary table if not exists t1 (a1 int); +execute stmt; +drop temporary table t1; +deallocate prepare stmt; +create table t1 (a varchar(20)); +insert into t1 values ('foo'); +prepare stmt FROM 'SELECT char_length (a) FROM t1'; +prepare stmt2 FROM 'SELECT not_a_function (a) FROM t1'; +ERROR 42000: FUNCTION test.not_a_function does not exist +drop table t1; +prepare stmt from "SELECT SQL_CALC_FOUND_ROWS 'foo' UNION SELECT 'bar' LIMIT 0"; +execute stmt; +foo +SELECT FOUND_ROWS(); +FOUND_ROWS() +2 +execute stmt; +foo +SELECT FOUND_ROWS(); +FOUND_ROWS() +2 +deallocate prepare stmt; +drop table if exists t1; +Warnings: +Note 1051 Unknown table 'test.t1' +create table t1 (c1 int(11) not null, c2 int(11) not null, +primary key (c1,c2), key c2 (c2), key c1 (c1)); +insert into t1 values (200887, 860); +insert into t1 values (200887, 200887); +select * from t1 where (c1=200887 and c2=200887) or c2=860; +c1 c2 +200887 860 +200887 200887 +prepare stmt from +"select * from t1 where (c1=200887 and c2=200887) or c2=860"; +execute stmt; +c1 c2 +200887 860 +200887 200887 +prepare stmt from +"select * from t1 where (c1=200887 and c2=?) or c2=?"; +set @a=200887, @b=860; +execute stmt using @a, @b; +c1 c2 +200887 860 +200887 200887 +deallocate prepare stmt; +drop table t1; +create table t1 ( +id bigint(20) not null auto_increment, +code varchar(20) character set utf8 collate utf8_bin not null default '', +company_name varchar(250) character set utf8 collate utf8_bin default null, +setup_mode tinyint(4) default null, +start_date datetime default null, +primary key (id), unique key code (code) +); +create table t2 ( +id bigint(20) not null auto_increment, +email varchar(250) character set utf8 collate utf8_bin default null, +name varchar(250) character set utf8 collate utf8_bin default null, +t1_id bigint(20) default null, +password varchar(250) character set utf8 collate utf8_bin default null, +primary_contact tinyint(4) not null default '0', +email_opt_in tinyint(4) not null default '1', +primary key (id), unique key email (email), key t1_id (t1_id), +constraint t2_fk1 foreign key (t1_id) references t1 (id) +); +insert into t1 values +(1, 'demo', 'demo s', 0, current_date()), +(2, 'code2', 'name 2', 0, current_date()), +(3, 'code3', 'name 3', 0, current_date()); +insert into t2 values +(2, 'email1', 'name1', 3, 'password1', 0, 0), +(3, 'email2', 'name1', 1, 'password2', 1, 0), +(5, 'email3', 'name3', 2, 'password3', 0, 0); +prepare stmt from 'select t2.id from t2, t1 where (t1.id=? and t2.t1_id=t1.id)'; +set @a=1; +execute stmt using @a; +id +3 +select t2.id from t2, t1 where (t1.id=1 and t2.t1_id=t1.id); +id +3 +deallocate prepare stmt; +drop table t1, t2; +create table t1 (id int); +prepare stmt from "insert into t1 (id) select id from t1 union select id from t1"; +execute stmt; +execute stmt; +deallocate prepare stmt; +drop table t1; +create table t1 ( +id int(11) unsigned not null primary key auto_increment, +partner_id varchar(35) not null, +t1_status_id int(10) unsigned +); +insert into t1 values ("1", "partner1", "10"), ("2", "partner2", "10"), +("3", "partner3", "10"), ("4", "partner4", "10"); +create table t2 ( +id int(11) unsigned not null default '0', +t1_line_id int(11) unsigned not null default '0', +article_id varchar(20), +sequence int(11) not null default '0', +primary key (id,t1_line_id) +); +insert into t2 values ("1", "1", "sup", "0"), ("2", "1", "sup", "1"), +("2", "2", "sup", "2"), ("2", "3", "sup", "3"), +("2", "4", "imp", "4"), ("3", "1", "sup", "0"), +("4", "1", "sup", "0"); +create table t3 ( +id int(11) not null default '0', +preceding_id int(11) not null default '0', +primary key (id,preceding_id) +); +create table t4 ( +user_id varchar(50) not null, +article_id varchar(20) not null, +primary key (user_id,article_id) +); +insert into t4 values("nicke", "imp"); +prepare stmt from +'select distinct t1.partner_id +from t1 left join t3 on t1.id = t3.id + left join t1 pp on pp.id = t3.preceding_id +where + exists ( + select * + from t2 as pl_inner + where pl_inner.id = t1.id + and pl_inner.sequence <= ( + select min(sequence) from t2 pl_seqnr + where pl_seqnr.id = t1.id + ) + and exists ( + select * from t4 + where t4.article_id = pl_inner.article_id + and t4.user_id = ? + ) + ) + and t1.id = ? +group by t1.id +having count(pp.id) = 0'; +set @user_id = 'nicke'; +set @id = '2'; +execute stmt using @user_id, @id; +partner_id +execute stmt using @user_id, @id; +partner_id +deallocate prepare stmt; +drop table t1, t2, t3, t4; +prepare stmt from 'select ?=?'; +set @a='CHRISTINE '; +set @b='CHRISTINE'; +execute stmt using @a, @b; +?=? +1 +execute stmt using @a, @b; +?=? +1 +set @a=1, @b=2; +execute stmt using @a, @b; +?=? +0 +set @a='CHRISTINE '; +set @b='CHRISTINE'; +execute stmt using @a, @b; +?=? +1 +deallocate prepare stmt; +create table t1 (a int); +prepare stmt from "select ??"; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '?' at line 1 +prepare stmt from "select ?FROM t1"; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '?FROM t1' at line 1 +prepare stmt from "select FROM t1 WHERE?=1"; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM t1 WHERE?=1' at line 1 +prepare stmt from "update t1 set a=a+?WHERE 1"; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '?WHERE 1' at line 1 +select ?; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '?' at line 1 +select ??; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '??' at line 1 +select ? from t1; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '? from t1' at line 1 +drop table t1; +prepare stmt from "select @@time_zone"; +execute stmt; +@@time_zone +SYSTEM +set @@time_zone:='Japan'; +execute stmt; +@@time_zone +Japan +prepare stmt from "select @@tx_isolation"; +execute stmt; +@@tx_isolation +REPEATABLE-READ +set transaction isolation level read committed; +execute stmt; +@@tx_isolation +REPEATABLE-READ +set transaction isolation level serializable; +execute stmt; +@@tx_isolation +REPEATABLE-READ +set @@tx_isolation=default; +execute stmt; +@@tx_isolation +REPEATABLE-READ +deallocate prepare stmt; +prepare stmt from "create temporary table t1 (letter enum('','a','b','c') +not null)"; +execute stmt; +drop table t1; +execute stmt; +drop table t1; +execute stmt; +drop table t1; +set names latin1; +prepare stmt from "create table t1 (a enum('test') default 'test') + character set utf8"; +execute stmt; +drop table t1; +execute stmt; +drop table t1; +execute stmt; +drop table t1; +set names default; +deallocate prepare stmt; +create table t1 ( +word_id mediumint(8) unsigned not null default '0', +formatted varchar(20) not null default '' +); +insert into t1 values +(80,'pendant'), (475,'pretendants'), (989,'tendances'), +(1019,'cependant'),(1022,'abondance'),(1205,'independants'), +(13,'lessiver'),(25,'lambiner'),(46,'situer'),(71,'terminer'), +(82,'decrocher'); +select count(*) from t1 where formatted like '%NDAN%'; +count(*) +6 +select count(*) from t1 where formatted like '%ER'; +count(*) +5 +prepare stmt from "select count(*) from t1 where formatted like ?"; +set @like="%NDAN%"; +execute stmt using @like; +count(*) +6 +set @like="%ER"; +execute stmt using @like; +count(*) +5 +set @like="%NDAN%"; +execute stmt using @like; +count(*) +6 +set @like="%ER"; +execute stmt using @like; +count(*) +5 +deallocate prepare stmt; +drop table t1; +prepare stmt from 'create table t1 (a varchar(10) character set utf8)'; +execute stmt; +insert ignore into t1 (a) values (repeat('a', 20)); +select length(a) from t1; +length(a) +10 +drop table t1; +execute stmt; +insert ignore into t1 (a) values (repeat('a', 20)); +select length(a) from t1; +length(a) +10 +drop table t1; +deallocate prepare stmt; +create table t1 (col1 integer, col2 integer); +insert into t1 values(100,100),(101,101),(102,102),(103,103); +prepare stmt from 'select col1, col2 from t1 where (col1, col2) in ((?,?))'; +set @a=100, @b=100; +execute stmt using @a,@b; +col1 col2 +100 100 +set @a=101, @b=101; +execute stmt using @a,@b; +col1 col2 +101 101 +set @a=102, @b=102; +execute stmt using @a,@b; +col1 col2 +102 102 +set @a=102, @b=103; +execute stmt using @a,@b; +col1 col2 +deallocate prepare stmt; +drop table t1; +set @old_max_prepared_stmt_count= @@max_prepared_stmt_count; +show variables like 'max_prepared_stmt_count'; +Variable_name Value +max_prepared_stmt_count 16382 +show status like 'prepared_stmt_count'; +Variable_name Value +Prepared_stmt_count 0 +select @@max_prepared_stmt_count; +@@max_prepared_stmt_count +16382 +set global max_prepared_stmt_count=-1; +Warnings: +Warning 1292 Truncated incorrect max_prepared_stmt_count value: '-1' +select @@max_prepared_stmt_count; +@@max_prepared_stmt_count +0 +set global max_prepared_stmt_count=10000000000000000; +Warnings: +Warning 1292 Truncated incorrect max_prepared_stmt_count value: '10000000000000000' +select @@max_prepared_stmt_count; +@@max_prepared_stmt_count +4294967295 +set global max_prepared_stmt_count=default; +select @@max_prepared_stmt_count; +@@max_prepared_stmt_count +16382 +set @@max_prepared_stmt_count=1; +ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL +set max_prepared_stmt_count=1; +ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL +set local max_prepared_stmt_count=1; +ERROR HY000: Variable 'max_prepared_stmt_count' is a GLOBAL variable and should be set with SET GLOBAL +set global max_prepared_stmt_count=1; +select @@max_prepared_stmt_count; +@@max_prepared_stmt_count +1 +set global max_prepared_stmt_count=0; +select @@max_prepared_stmt_count; +@@max_prepared_stmt_count +0 +show status like 'prepared_stmt_count'; +Variable_name Value +Prepared_stmt_count 0 +prepare stmt from "select 1"; +ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 0) +show status like 'prepared_stmt_count'; +Variable_name Value +Prepared_stmt_count 0 +set global max_prepared_stmt_count=1; +prepare stmt from "select 1"; +show status like 'prepared_stmt_count'; +Variable_name Value +Prepared_stmt_count 1 +prepare stmt1 from "select 1"; +ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 1) +show status like 'prepared_stmt_count'; +Variable_name Value +Prepared_stmt_count 1 +deallocate prepare stmt; +show status like 'prepared_stmt_count'; +Variable_name Value +Prepared_stmt_count 0 +prepare stmt from "select 1"; +show status like 'prepared_stmt_count'; +Variable_name Value +Prepared_stmt_count 1 +prepare stmt from "select 2"; +show status like 'prepared_stmt_count'; +Variable_name Value +Prepared_stmt_count 1 +show status like 'prepared_stmt_count'; +Variable_name Value +Prepared_stmt_count 1 +select @@max_prepared_stmt_count; +@@max_prepared_stmt_count +1 +set global max_prepared_stmt_count=0; +prepare stmt from "select 1"; +ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 0) +execute stmt; +ERROR HY000: Unknown prepared statement handler (stmt) given to EXECUTE +show status like 'prepared_stmt_count'; +Variable_name Value +Prepared_stmt_count 0 +prepare stmt from "select 1"; +ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 0) +show status like 'prepared_stmt_count'; +Variable_name Value +Prepared_stmt_count 0 +set global max_prepared_stmt_count=3; +select @@max_prepared_stmt_count; +@@max_prepared_stmt_count +3 +show status like 'prepared_stmt_count'; +Variable_name Value +Prepared_stmt_count 0 +prepare stmt from "select 1"; +connect con1,localhost,root,,; +connection con1; +prepare stmt from "select 2"; +prepare stmt1 from "select 3"; +prepare stmt2 from "select 4"; +ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 3) +connection default; +prepare stmt2 from "select 4"; +ERROR 42000: Can't create more than max_prepared_stmt_count statements (current value: 3) +select @@max_prepared_stmt_count; +@@max_prepared_stmt_count +3 +show status like 'prepared_stmt_count'; +Variable_name Value +Prepared_stmt_count 3 +disconnect con1; +connection default; +deallocate prepare stmt; +select @@max_prepared_stmt_count; +@@max_prepared_stmt_count +3 +show status like 'prepared_stmt_count'; +Variable_name Value +Prepared_stmt_count 0 +set global max_prepared_stmt_count= @old_max_prepared_stmt_count; +drop table if exists t1; +create temporary table if not exists t1 (a1 int); +prepare stmt from "delete t1 from t1 where (cast(a1/3 as unsigned) * 3) = a1"; +drop temporary table t1; +create temporary table if not exists t1 (a1 int); +execute stmt; +drop temporary table t1; +create temporary table if not exists t1 (a1 int); +execute stmt; +drop temporary table t1; +create temporary table if not exists t1 (a1 int); +execute stmt; +drop temporary table t1; +deallocate prepare stmt; +CREATE TABLE t1( +ID int(10) unsigned NOT NULL auto_increment, +Member_ID varchar(15) NOT NULL default '', +Action varchar(12) NOT NULL, +Action_Date datetime NOT NULL, +Track varchar(15) default NULL, +User varchar(12) default NULL, +Date_Updated timestamp NOT NULL default CURRENT_TIMESTAMP on update +CURRENT_TIMESTAMP, +PRIMARY KEY (ID), +KEY Action (Action), +KEY Action_Date (Action_Date) +); +INSERT INTO t1(Member_ID, Action, Action_Date, Track) VALUES +('111111', 'Disenrolled', '2006-03-01', 'CAD' ), +('111111', 'Enrolled', '2006-03-01', 'CAD' ), +('111111', 'Disenrolled', '2006-07-03', 'CAD' ), +('222222', 'Enrolled', '2006-03-07', 'CAD' ), +('222222', 'Enrolled', '2006-03-07', 'CHF' ), +('222222', 'Disenrolled', '2006-08-02', 'CHF' ), +('333333', 'Enrolled', '2006-03-01', 'CAD' ), +('333333', 'Disenrolled', '2006-03-01', 'CAD' ), +('444444', 'Enrolled', '2006-03-01', 'CAD' ), +('555555', 'Disenrolled', '2006-03-01', 'CAD' ), +('555555', 'Enrolled', '2006-07-21', 'CAD' ), +('555555', 'Disenrolled', '2006-03-01', 'CHF' ), +('666666', 'Enrolled', '2006-02-09', 'CAD' ), +('666666', 'Enrolled', '2006-05-12', 'CHF' ), +('666666', 'Disenrolled', '2006-06-01', 'CAD' ); +PREPARE STMT FROM +"SELECT GROUP_CONCAT(Track SEPARATOR ', ') FROM t1 + WHERE Member_ID=? AND Action='Enrolled' AND + (Track,Action_Date) IN (SELECT Track, MAX(Action_Date) FROM t1 + WHERE Member_ID=? + GROUP BY Track + HAVING Track>='CAD' AND + MAX(Action_Date)>'2006-03-01')"; +SET @id='111111'; +EXECUTE STMT USING @id,@id; +GROUP_CONCAT(Track SEPARATOR ', ') +NULL +SET @id='222222'; +EXECUTE STMT USING @id,@id; +GROUP_CONCAT(Track SEPARATOR ', ') +CAD +DEALLOCATE PREPARE STMT; +DROP TABLE t1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (i INT, INDEX(i)); +INSERT INTO t1 VALUES (1); +PREPARE stmt FROM "SELECT (COUNT(i) = 1), COUNT(i) FROM t1 WHERE i = ?"; +SET @a = 0; +EXECUTE stmt USING @a; +(COUNT(i) = 1) COUNT(i) +0 0 +SET @a = 1; +EXECUTE stmt USING @a; +(COUNT(i) = 1) COUNT(i) +1 1 +SET @a = 0; +EXECUTE stmt USING @a; +(COUNT(i) = 1) COUNT(i) +0 0 +PREPARE stmt FROM "SELECT (AVG(i) = 1), AVG(i) FROM t1 WHERE i = ?"; +SET @a = 0; +EXECUTE stmt USING @a; +(AVG(i) = 1) AVG(i) +NULL NULL +SET @a = 1; +EXECUTE stmt USING @a; +(AVG(i) = 1) AVG(i) +1 1.0000 +SET @a = 0; +EXECUTE stmt USING @a; +(AVG(i) = 1) AVG(i) +NULL NULL +PREPARE stmt FROM "SELECT (VARIANCE(i) = 1), VARIANCE(i) FROM t1 WHERE i = ?"; +SET @a = 0; +EXECUTE stmt USING @a; +(VARIANCE(i) = 1) VARIANCE(i) +NULL NULL +SET @a = 1; +EXECUTE stmt USING @a; +(VARIANCE(i) = 1) VARIANCE(i) +0 0.0000 +SET @a = 0; +EXECUTE stmt USING @a; +(VARIANCE(i) = 1) VARIANCE(i) +NULL NULL +PREPARE stmt FROM "SELECT (STDDEV(i) = 1), STDDEV(i) FROM t1 WHERE i = ?"; +SET @a = 0; +EXECUTE stmt USING @a; +(STDDEV(i) = 1) STDDEV(i) +NULL NULL +SET @a = 1; +EXECUTE stmt USING @a; +(STDDEV(i) = 1) STDDEV(i) +0 0.0000 +SET @a = 0; +EXECUTE stmt USING @a; +(STDDEV(i) = 1) STDDEV(i) +NULL NULL +PREPARE stmt FROM "SELECT (BIT_OR(i) = 1), BIT_OR(i) FROM t1 WHERE i = ?"; +SET @a = 0; +EXECUTE stmt USING @a; +(BIT_OR(i) = 1) BIT_OR(i) +0 0 +SET @a = 1; +EXECUTE stmt USING @a; +(BIT_OR(i) = 1) BIT_OR(i) +1 1 +SET @a = 0; +EXECUTE stmt USING @a; +(BIT_OR(i) = 1) BIT_OR(i) +0 0 +PREPARE stmt FROM "SELECT (BIT_AND(i) = 1), BIT_AND(i) FROM t1 WHERE i = ?"; +SET @a = 0; +EXECUTE stmt USING @a; +(BIT_AND(i) = 1) BIT_AND(i) +0 18446744073709551615 +SET @a = 1; +EXECUTE stmt USING @a; +(BIT_AND(i) = 1) BIT_AND(i) +1 1 +SET @a = 0; +EXECUTE stmt USING @a; +(BIT_AND(i) = 1) BIT_AND(i) +0 18446744073709551615 +PREPARE stmt FROM "SELECT (BIT_XOR(i) = 1), BIT_XOR(i) FROM t1 WHERE i = ?"; +SET @a = 0; +EXECUTE stmt USING @a; +(BIT_XOR(i) = 1) BIT_XOR(i) +0 0 +SET @a = 1; +EXECUTE stmt USING @a; +(BIT_XOR(i) = 1) BIT_XOR(i) +1 1 +SET @a = 0; +EXECUTE stmt USING @a; +(BIT_XOR(i) = 1) BIT_XOR(i) +0 0 +DEALLOCATE PREPARE stmt; +DROP TABLE t1; +DROP TABLE IF EXISTS t1, t2; +CREATE TABLE t1 (i INT); +PREPARE st_19182 +FROM "CREATE TABLE t2 (i INT, j INT, KEY (i), KEY(j)) SELECT i FROM t1"; +EXECUTE st_19182; +DESC t2; +Field Type Null Key Default Extra +j int(11) YES MUL NULL +i int(11) YES MUL NULL +DROP TABLE t2; +EXECUTE st_19182; +DESC t2; +Field Type Null Key Default Extra +j int(11) YES MUL NULL +i int(11) YES MUL NULL +DEALLOCATE PREPARE st_19182; +DROP TABLE t2, t1; +drop database if exists mysqltest; +drop table if exists t1, t2; +create database mysqltest character set utf8; +prepare stmt1 from "create table mysqltest.t1 (c char(10))"; +prepare stmt2 from "create table mysqltest.t2 select 'test'"; +execute stmt1; +execute stmt2; +show create table mysqltest.t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +show create table mysqltest.t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `test` varchar(4) CHARACTER SET latin1 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 +drop table mysqltest.t1; +drop table mysqltest.t2; +alter database mysqltest character set latin1; +execute stmt1; +execute stmt2; +show create table mysqltest.t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +show create table mysqltest.t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `test` varchar(4) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop database mysqltest; +deallocate prepare stmt1; +deallocate prepare stmt2; +execute stmt; +show create table t1; +drop table t1; +execute stmt; +show create table t1; +drop table t1; +deallocate prepare stmt; +CREATE TABLE t1(a int); +INSERT INTO t1 VALUES (2), (3), (1); +PREPARE st1 FROM +'(SELECT a FROM t1) UNION (SELECT a+10 FROM t1) ORDER BY RAND()*0+a'; +EXECUTE st1; +a +1 +2 +3 +11 +12 +13 +EXECUTE st1; +a +1 +2 +3 +11 +12 +13 +DEALLOCATE PREPARE st1; +DROP TABLE t1; +create table t1 (a int, b tinyint); +prepare st1 from 'update t1 set b= (str_to_date(a, a))'; +execute st1; +deallocate prepare st1; +drop table t1; +End of 4.1 tests. +create table t1 (a varchar(20)); +insert into t1 values ('foo'); +prepare stmt FROM 'SELECT char_length (a) FROM t1'; +prepare stmt2 FROM 'SELECT not_a_function (a) FROM t1'; +ERROR 42000: FUNCTION test.not_a_function does not exist +drop table t1; +create table t1 (a char(3) not null, b char(3) not null, +c char(3) not null, primary key (a, b, c)); +create table t2 like t1; +prepare stmt from +"select t1.a from (t1 left outer join t2 on t2.a=1 and t1.b=t2.b) + where t1.a=1"; +execute stmt; +a +execute stmt; +a +execute stmt; +a +prepare stmt from +"select t1.a, t1.b, t1.c, t2.a, t2.b, t2.c from +(t1 left outer join t2 on t2.a=? and t1.b=t2.b) +left outer join t2 t3 on t3.a=? where t1.a=?"; +set @a:=1, @b:=1, @c:=1; +execute stmt using @a, @b, @c; +a b c a b c +execute stmt using @a, @b, @c; +a b c a b c +execute stmt using @a, @b, @c; +a b c a b c +deallocate prepare stmt; +drop table t1,t2; +SET @aux= "SELECT COUNT(*) + FROM INFORMATION_SCHEMA.COLUMNS A, + INFORMATION_SCHEMA.COLUMNS B + WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA + AND A.TABLE_NAME = B.TABLE_NAME + AND A.COLUMN_NAME = B.COLUMN_NAME AND + A.TABLE_NAME = 'user'"; +prepare my_stmt from @aux; +execute my_stmt; +COUNT(*) +47 +Warnings: +Warning 1286 Unknown storage engine 'InnoDB' +Warning 1286 Unknown storage engine 'InnoDB' +Warning 1286 Unknown storage engine 'InnoDB' +execute my_stmt; +COUNT(*) +47 +Warnings: +Warning 1286 Unknown storage engine 'InnoDB' +Warning 1286 Unknown storage engine 'InnoDB' +Warning 1286 Unknown storage engine 'InnoDB' +execute my_stmt; +COUNT(*) +47 +Warnings: +Warning 1286 Unknown storage engine 'InnoDB' +Warning 1286 Unknown storage engine 'InnoDB' +Warning 1286 Unknown storage engine 'InnoDB' +deallocate prepare my_stmt; +drop procedure if exists p1| +drop table if exists t1| +create table t1 (id int)| +insert into t1 values(1)| +create procedure p1(a int, b int) +begin +declare c int; +select max(id)+1 into c from t1; +insert into t1 select a+b; +insert into t1 select a-b; +insert into t1 select a-c; +end| +set @a= 3, @b= 4| +prepare stmt from "call p1(?, ?)"| +execute stmt using @a, @b| +execute stmt using @a, @b| +select * from t1| +id +1 +7 +-1 +1 +7 +-1 +-5 +deallocate prepare stmt| +drop procedure p1| +drop table t1| +create table t1 (a int); +insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +prepare stmt from "select * from t1 limit ?, ?"; +set @offset=0, @limit=1; +execute stmt using @offset, @limit; +a +1 +select * from t1 limit 0, 1; +a +1 +set @offset=3, @limit=2; +execute stmt using @offset, @limit; +a +4 +5 +select * from t1 limit 3, 2; +a +4 +5 +prepare stmt from "select * from t1 limit ?"; +execute stmt using @limit; +a +1 +2 +prepare stmt from "select * from t1 where a in (select a from t1 limit ?)"; +ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' +prepare stmt from "select * from t1 union all select * from t1 limit ?, ?"; +set @offset=9; +set @limit=2; +execute stmt using @offset, @limit; +a +10 +1 +prepare stmt from "(select * from t1 limit ?, ?) union all + (select * from t1 limit ?, ?) order by a limit ?"; +execute stmt using @offset, @limit, @offset, @limit, @limit; +a +10 +10 +drop table t1; +deallocate prepare stmt; +CREATE TABLE b12651_T1(a int) ENGINE=MYISAM; +CREATE TABLE b12651_T2(b int) ENGINE=MYISAM; +CREATE VIEW b12651_V1 as SELECT b FROM b12651_T2; +PREPARE b12651 FROM 'SELECT 1 FROM b12651_T1 WHERE a IN (SELECT b FROM b12651_V1)'; +EXECUTE b12651; +1 +DROP VIEW b12651_V1; +DROP TABLE b12651_T1, b12651_T2; +DEALLOCATE PREPARE b12651; +create table t1 (id int); +prepare ins_call from "insert into t1 (id) values (1)"; +execute ins_call; +select row_count(); +row_count() +1 +drop table t1; +create table t1 (a int, b int); +insert into t1 (a,b) values (2,8),(1,9),(3,7); +prepare stmt from "select * from t1 order by ?"; +set @a=NULL; +execute stmt using @a; +a b +2 8 +1 9 +3 7 +set @a=1; +execute stmt using @a; +a b +1 9 +2 8 +3 7 +set @a=2; +execute stmt using @a; +a b +3 7 +2 8 +1 9 +deallocate prepare stmt; +select * from t1 order by 1; +a b +1 9 +2 8 +3 7 +prepare stmt from "select * from t1 order by ?+1"; +set @a=0; +execute stmt using @a; +a b +2 8 +1 9 +3 7 +set @a=1; +execute stmt using @a; +a b +2 8 +1 9 +3 7 +deallocate prepare stmt; +select * from t1 order by 1+1; +a b +2 8 +1 9 +3 7 +drop table t1; +create table t1 (a int); +create table t2 like t1; +create table t3 like t2; +prepare stmt from "repair table t1"; +execute stmt; +Table Op Msg_type Msg_text +test.t1 repair status OK +execute stmt; +Table Op Msg_type Msg_text +test.t1 repair status OK +prepare stmt from "optimize table t1"; +execute stmt; +Table Op Msg_type Msg_text +test.t1 optimize status OK +execute stmt; +Table Op Msg_type Msg_text +test.t1 optimize status Table is already up to date +prepare stmt from "analyze table t1"; +execute stmt; +Table Op Msg_type Msg_text +test.t1 analyze status Table is already up to date +execute stmt; +Table Op Msg_type Msg_text +test.t1 analyze status Table is already up to date +prepare stmt from "repair table t1, t2, t3"; +execute stmt; +Table Op Msg_type Msg_text +test.t1 repair status OK +test.t2 repair status OK +test.t3 repair status OK +execute stmt; +Table Op Msg_type Msg_text +test.t1 repair status OK +test.t2 repair status OK +test.t3 repair status OK +prepare stmt from "optimize table t1, t2, t3"; +execute stmt; +Table Op Msg_type Msg_text +test.t1 optimize status OK +test.t2 optimize status OK +test.t3 optimize status OK +execute stmt; +Table Op Msg_type Msg_text +test.t1 optimize status Table is already up to date +test.t2 optimize status Table is already up to date +test.t3 optimize status Table is already up to date +prepare stmt from "analyze table t1, t2, t3"; +execute stmt; +Table Op Msg_type Msg_text +test.t1 analyze status Table is already up to date +test.t2 analyze status Table is already up to date +test.t3 analyze status Table is already up to date +execute stmt; +Table Op Msg_type Msg_text +test.t1 analyze status Table is already up to date +test.t2 analyze status Table is already up to date +test.t3 analyze status Table is already up to date +prepare stmt from "repair table t1, t4, t3"; +execute stmt; +Table Op Msg_type Msg_text +test.t1 repair status OK +test.t4 repair Error Table 'test.t4' doesn't exist +test.t4 repair status Operation failed +test.t3 repair status OK +execute stmt; +Table Op Msg_type Msg_text +test.t1 repair status OK +test.t4 repair Error Table 'test.t4' doesn't exist +test.t4 repair status Operation failed +test.t3 repair status OK +prepare stmt from "optimize table t1, t3, t4"; +execute stmt; +Table Op Msg_type Msg_text +test.t1 optimize status OK +test.t3 optimize status OK +test.t4 optimize Error Table 'test.t4' doesn't exist +test.t4 optimize status Operation failed +execute stmt; +Table Op Msg_type Msg_text +test.t1 optimize status Table is already up to date +test.t3 optimize status Table is already up to date +test.t4 optimize Error Table 'test.t4' doesn't exist +test.t4 optimize status Operation failed +prepare stmt from "analyze table t4, t1"; +execute stmt; +Table Op Msg_type Msg_text +test.t4 analyze Error Table 'test.t4' doesn't exist +test.t4 analyze status Operation failed +test.t1 analyze status Table is already up to date +execute stmt; +Table Op Msg_type Msg_text +test.t4 analyze Error Table 'test.t4' doesn't exist +test.t4 analyze status Operation failed +test.t1 analyze status Table is already up to date +deallocate prepare stmt; +drop table t1, t2, t3; +create database mysqltest_long_database_name_to_thrash_heap; +use test; +create table t1 (i int); +prepare stmt from "alter table test.t1 rename t1"; +use mysqltest_long_database_name_to_thrash_heap; +execute stmt; +show tables like 't1'; +Tables_in_mysqltest_long_database_name_to_thrash_heap (t1) +prepare stmt from "alter table test.t1 rename t1"; +use test; +execute stmt; +show tables like 't1'; +Tables_in_test (t1) +use mysqltest_long_database_name_to_thrash_heap; +show tables like 't1'; +Tables_in_mysqltest_long_database_name_to_thrash_heap (t1) +t1 +deallocate prepare stmt; +use mysqltest_long_database_name_to_thrash_heap; +prepare stmt_create from "create table t1 (i int)"; +prepare stmt_insert from "insert into t1 (i) values (1)"; +prepare stmt_update from "update t1 set i=2"; +prepare stmt_delete from "delete from t1 where i=2"; +prepare stmt_select from "select * from t1"; +prepare stmt_alter from "alter table t1 add column (b int)"; +prepare stmt_alter1 from "alter table t1 drop column b"; +prepare stmt_analyze from "analyze table t1"; +prepare stmt_optimize from "optimize table t1"; +prepare stmt_show from "show tables like 't1'"; +prepare stmt_truncate from "truncate table t1"; +prepare stmt_drop from "drop table t1"; +drop table t1; +use test; +execute stmt_create; +show tables like 't1'; +Tables_in_test (t1) +use mysqltest_long_database_name_to_thrash_heap; +show tables like 't1'; +Tables_in_mysqltest_long_database_name_to_thrash_heap (t1) +t1 +use test; +execute stmt_insert; +select * from mysqltest_long_database_name_to_thrash_heap.t1; +i +1 +execute stmt_update; +select * from mysqltest_long_database_name_to_thrash_heap.t1; +i +2 +execute stmt_delete; +execute stmt_select; +i +execute stmt_alter; +show columns from mysqltest_long_database_name_to_thrash_heap.t1; +Field Type Null Key Default Extra +i int(11) YES NULL +b int(11) YES NULL +execute stmt_alter1; +show columns from mysqltest_long_database_name_to_thrash_heap.t1; +Field Type Null Key Default Extra +i int(11) YES NULL +execute stmt_analyze; +Table Op Msg_type Msg_text +mysqltest_long_database_name_to_thrash_heap.t1 analyze status Table is already up to date +execute stmt_optimize; +Table Op Msg_type Msg_text +mysqltest_long_database_name_to_thrash_heap.t1 optimize status Table is already up to date +execute stmt_show; +Tables_in_mysqltest_long_database_name_to_thrash_heap (t1) +t1 +execute stmt_truncate; +execute stmt_drop; +show tables like 't1'; +Tables_in_test (t1) +use mysqltest_long_database_name_to_thrash_heap; +show tables like 't1'; +Tables_in_mysqltest_long_database_name_to_thrash_heap (t1) +drop database mysqltest_long_database_name_to_thrash_heap; +prepare stmt_create from "create table t1 (i int)"; +ERROR 3D000: No database selected +prepare stmt_insert from "insert into t1 (i) values (1)"; +ERROR 3D000: No database selected +prepare stmt_update from "update t1 set i=2"; +ERROR 3D000: No database selected +prepare stmt_delete from "delete from t1 where i=2"; +ERROR 3D000: No database selected +prepare stmt_select from "select * from t1"; +ERROR 3D000: No database selected +prepare stmt_alter from "alter table t1 add column (b int)"; +ERROR 3D000: No database selected +prepare stmt_alter1 from "alter table t1 drop column b"; +ERROR 3D000: No database selected +prepare stmt_analyze from "analyze table t1"; +ERROR 3D000: No database selected +prepare stmt_optimize from "optimize table t1"; +ERROR 3D000: No database selected +prepare stmt_show from "show tables like 't1'"; +ERROR 3D000: No database selected +prepare stmt_truncate from "truncate table t1"; +ERROR 3D000: No database selected +prepare stmt_drop from "drop table t1"; +ERROR 3D000: No database selected +create temporary table t1 (i int); +ERROR 3D000: No database selected +use test; +DROP TABLE IF EXISTS t1, t2, t3; +CREATE TABLE t1 (i BIGINT, j BIGINT); +CREATE TABLE t2 (i BIGINT); +CREATE TABLE t3 (i BIGINT, j BIGINT); +PREPARE stmt FROM "SELECT * FROM t1 JOIN t2 ON (t2.i = t1.i) + LEFT JOIN t3 ON ((t3.i, t3.j) = (t1.i, t1.j)) + WHERE t1.i = ?"; +SET @a= 1; +EXECUTE stmt USING @a; +i j i i j +EXECUTE stmt USING @a; +i j i i j +DEALLOCATE PREPARE stmt; +DROP TABLE IF EXISTS t1, t2, t3; +DROP TABLE IF EXISTS t1, t2; +CREATE TABLE t1 (i INT KEY); +CREATE TABLE t2 (i INT); +INSERT INTO t1 VALUES (1), (2); +INSERT INTO t2 VALUES (1); +PREPARE stmt FROM "SELECT t2.i FROM t1 LEFT JOIN t2 ON t2.i = t1.i + WHERE t1.i = ?"; +SET @arg= 1; +EXECUTE stmt USING @arg; +i +1 +SET @arg= 2; +EXECUTE stmt USING @arg; +i +NULL +SET @arg= 1; +EXECUTE stmt USING @arg; +i +1 +DEALLOCATE PREPARE stmt; +DROP TABLE t1, t2; +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (1), (2); +SELECT t1.i FROM t1 JOIN v1 ON t1.i = v1.i +WHERE EXISTS (SELECT * FROM t1 WHERE v1.i = 1); +i +1 +PREPARE stmt FROM "SELECT t1.i FROM t1 JOIN v1 ON t1.i = v1.i +WHERE EXISTS (SELECT * FROM t1 WHERE v1.i = 1)"; +EXECUTE stmt; +i +1 +EXECUTE stmt; +i +1 +DEALLOCATE PREPARE stmt; +DROP VIEW v1; +DROP TABLE t1; +DROP PROCEDURE IF EXISTS p1; +flush status; +prepare sq from 'show status like "slow_queries"'; +execute sq; +Variable_name Value +Slow_queries 0 +prepare no_index from 'select 1 from information_schema.tables limit 1'; +execute sq; +Variable_name Value +Slow_queries 0 +execute no_index; +1 +1 +execute sq; +Variable_name Value +Slow_queries 1 +deallocate prepare no_index; +deallocate prepare sq; +CREATE TABLE t1 (a int); +INSERT INTO t1 VALUES (1), (2); +CREATE TABLE t2 (b int); +INSERT INTO t2 VALUES (NULL); +SELECT a FROM t1 WHERE (SELECT b FROM t2) IS NULL; +a +1 +2 +PREPARE stmt FROM 'SELECT a FROM t1 WHERE (SELECT b FROM t2) IS NULL'; +EXECUTE stmt; +a +1 +2 +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM 'SELECT a FROM t1 WHERE (SELECT b FROM t2 limit ?) IS NULL'; +SET @arg=1; +EXECUTE stmt USING @arg; +a +1 +2 +DEALLOCATE PREPARE stmt; +DROP TABLE t1,t2; +drop table if exists t1; +create table t1 (s1 char(20)); +prepare stmt from "alter table t1 modify s1 int"; +execute stmt; +execute stmt; +drop table t1; +deallocate prepare stmt; +drop table if exists t1; +create table t1 (a int, b int); +prepare s_6895 from "alter table t1 drop column b"; +execute s_6895; +show columns from t1; +Field Type Null Key Default Extra +a int(11) YES NULL +drop table t1; +create table t1 (a int, b int); +execute s_6895; +show columns from t1; +Field Type Null Key Default Extra +a int(11) YES NULL +drop table t1; +create table t1 (a int, b int); +execute s_6895; +show columns from t1; +Field Type Null Key Default Extra +a int(11) YES NULL +deallocate prepare s_6895; +drop table t1; +create table t1 (i int primary key auto_increment) comment='comment for table t1'; +create table t2 (i int, j int, k int); +prepare stmt from "alter table t1 auto_increment=100"; +execute stmt; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`i`) +) ENGINE=MyISAM AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 COMMENT='comment for table t1' +flush tables; +select * from t2; +i j k +execute stmt; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`i`) +) ENGINE=MyISAM AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 COMMENT='comment for table t1' +deallocate prepare stmt; +drop table t1, t2; +set @old_character_set_server= @@character_set_server; +set @@character_set_server= latin1; +prepare stmt from "create database mysqltest_1"; +execute stmt; +show create database mysqltest_1; +Database Create Database +mysqltest_1 CREATE DATABASE `mysqltest_1` /*!40100 DEFAULT CHARACTER SET latin1 */ +drop database mysqltest_1; +set @@character_set_server= utf8; +execute stmt; +show create database mysqltest_1; +Database Create Database +mysqltest_1 CREATE DATABASE `mysqltest_1` /*!40100 DEFAULT CHARACTER SET utf8 */ +drop database mysqltest_1; +deallocate prepare stmt; +set @@character_set_server= @old_character_set_server; +drop tables if exists t1; +create table t1 (id int primary key auto_increment, value varchar(10)); +insert into t1 (id, value) values (1, 'FIRST'), (2, 'SECOND'), (3, 'THIRD'); +prepare stmt from "insert into t1 (id, value) select * from (select 4 as i, 'FOURTH' as v) as y on duplicate key update v = 'DUP'"; +execute stmt; +ERROR 42S22: Unknown column 'v' in 'field list' +execute stmt; +ERROR 42S22: Unknown column 'v' in 'field list' +deallocate prepare stmt; +prepare stmt from "insert into t1 (id, value) select * from (select 4 as id, 'FOURTH' as value) as y on duplicate key update y.value = 'DUP'"; +execute stmt; +ERROR 42S22: Unknown column 'y.value' in 'field list' +execute stmt; +ERROR 42S22: Unknown column 'y.value' in 'field list' +deallocate prepare stmt; +drop tables t1; +prepare stmt from "create table t1 select ?"; +set @a=1.0; +execute stmt using @a; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `?` decimal(2,1) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +drop table if exists t1; +create table t1 (a bigint unsigned, b bigint(20) unsigned); +prepare stmt from "insert into t1 values (?,?)"; +set @a= 9999999999999999; +set @b= 14632475938453979136; +insert into t1 values (@a, @b); +select * from t1 where a = @a and b = @b; +a b +9999999999999999 14632475938453979136 +execute stmt using @a, @b; +select * from t1 where a = @a and b = @b; +a b +9999999999999999 14632475938453979136 +9999999999999999 14632475938453979136 +deallocate prepare stmt; +drop table t1; +drop view if exists v1; +drop table if exists t1; +create table t1 (a int, b int); +insert into t1 values (1,1), (2,2), (3,3); +insert into t1 values (3,1), (1,2), (2,3); +prepare stmt from "create view v1 as select * from t1"; +execute stmt; +drop table t1; +create table t1 (a int, b int); +drop view v1; +execute stmt; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` latin1 latin1_swedish_ci +drop view v1; +prepare stmt from "create view v1 (c,d) as select a,b from t1"; +execute stmt; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d` from `t1` latin1 latin1_swedish_ci +select * from v1; +c d +drop view v1; +execute stmt; +deallocate prepare stmt; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d` from `t1` latin1 latin1_swedish_ci +select * from v1; +c d +drop view v1; +prepare stmt from "create view v1 (c) as select b+1 from t1"; +execute stmt; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`b` + 1 AS `c` from `t1` latin1 latin1_swedish_ci +select * from v1; +c +drop view v1; +execute stmt; +deallocate prepare stmt; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`b` + 1 AS `c` from `t1` latin1 latin1_swedish_ci +select * from v1; +c +drop view v1; +prepare stmt from "create view v1 (c,d,e,f) as select a,b,a in (select a+2 from t1), a = all (select a from t1) from t1"; +execute stmt; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d`,`t1`.`a` in (select `t1`.`a` + 2 from `t1`) AS `e`,`t1`.`a` = all (select `t1`.`a` from `t1`) AS `f` from `t1` latin1 latin1_swedish_ci +select * from v1; +c d e f +drop view v1; +execute stmt; +deallocate prepare stmt; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `c`,`t1`.`b` AS `d`,`t1`.`a` in (select `t1`.`a` + 2 from `t1`) AS `e`,`t1`.`a` = all (select `t1`.`a` from `t1`) AS `f` from `t1` latin1 latin1_swedish_ci +select * from v1; +c d e f +drop view v1; +prepare stmt from "create or replace view v1 as select 1"; +execute stmt; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1` latin1 latin1_swedish_ci +select * from v1; +1 +1 +execute stmt; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1` latin1 latin1_swedish_ci +deallocate prepare stmt; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1` latin1 latin1_swedish_ci +select * from v1; +1 +1 +drop view v1; +prepare stmt from "create view v1 as select 1, 1"; +execute stmt; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1`,1 AS `My_exp_1` latin1 latin1_swedish_ci +select * from v1; +1 My_exp_1 +1 1 +drop view v1; +execute stmt; +deallocate prepare stmt; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1`,1 AS `My_exp_1` latin1 latin1_swedish_ci +select * from v1; +1 My_exp_1 +1 1 +drop view v1; +prepare stmt from "create view v1 (x) as select a from t1 where a > 1"; +execute stmt; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `x` from `t1` where `t1`.`a` > 1 latin1 latin1_swedish_ci +select * from v1; +x +drop view v1; +execute stmt; +deallocate prepare stmt; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `x` from `t1` where `t1`.`a` > 1 latin1 latin1_swedish_ci +select * from v1; +x +drop view v1; +prepare stmt from "create view v1 as select * from `t1` `b`"; +execute stmt; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `b`.`a` AS `a`,`b`.`b` AS `b` from `t1` `b` latin1 latin1_swedish_ci +select * from v1; +a b +drop view v1; +execute stmt; +deallocate prepare stmt; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `b`.`a` AS `a`,`b`.`b` AS `b` from `t1` `b` latin1 latin1_swedish_ci +select * from v1; +a b +drop view v1; +prepare stmt from "create view v1 (a,b,c) as select * from t1"; +execute stmt; +ERROR HY000: View's SELECT and view's field list have different column counts +execute stmt; +ERROR HY000: View's SELECT and view's field list have different column counts +deallocate prepare stmt; +drop table t1; +create temporary table t1 (a int, b int); +prepare stmt from "create view v1 as select * from t1"; +execute stmt; +ERROR HY000: View's SELECT refers to a temporary table 't1' +execute stmt; +ERROR HY000: View's SELECT refers to a temporary table 't1' +deallocate prepare stmt; +drop table t1; +prepare stmt from "create view v1 as select * from t1"; +ERROR 42S02: Table 'test.t1' doesn't exist +prepare stmt from "create view v1 as select * from `t1` `b`"; +ERROR 42S02: Table 'test.t1' doesn't exist +prepare stmt from "select ?"; +set @arg= 123456789.987654321; +select @arg; +@arg +123456789.987654321 +execute stmt using @arg; +? +123456789.987654321 +set @arg= "string"; +select @arg; +@arg +string +execute stmt using @arg; +? +string +set @arg= 123456; +select @arg; +@arg +123456 +execute stmt using @arg; +? +123456 +set @arg= cast(-12345.54321 as decimal(20, 10)); +select @arg; +@arg +-12345.5432100000 +execute stmt using @arg; +? +-12345.5432100000 +deallocate prepare stmt; +# +# Bug#48508: Crash on prepared statement re-execution. +# +create table t1(b int); +insert into t1 values (0); +create view v1 AS select 1 as a from t1 where b; +prepare stmt from "select * from v1 where a"; +execute stmt; +a +execute stmt; +a +deallocate prepare stmt; +drop table t1; +drop view v1; +create table t1(a bigint); +create table t2(b tinyint); +insert into t2 values (null); +prepare stmt from "select 1 from t1 join t2 on a xor b where b > 1 and a =1"; +execute stmt; +1 +execute stmt; +1 +deallocate prepare stmt; +drop table t1,t2; +# +# +# Bug #49570: Assertion failed: !(order->used & map) +# on re-execution of prepared statement +# +CREATE TABLE t1(a INT PRIMARY KEY); +INSERT INTO t1 VALUES(0), (1); +PREPARE stmt FROM +"SELECT 1 FROM t1 JOIN t1 t2 USING(a) GROUP BY t2.a, t1.a"; +EXECUTE stmt; +1 +1 +1 +EXECUTE stmt; +1 +1 +1 +EXECUTE stmt; +1 +1 +1 +DEALLOCATE PREPARE stmt; +DROP TABLE t1; +End of 5.0 tests. +create procedure proc_1() reset query cache; +call proc_1(); +call proc_1(); +call proc_1(); +create function func_1() returns int deterministic begin reset query cache; return 1; end| +ERROR 0A000: RESET is not allowed in stored function or trigger +create function func_1() returns int deterministic begin call proc_1(); return 1; end| +select func_1(), func_1(), func_1() from dual; +ERROR 0A000: RESET is not allowed in stored function or trigger +drop function func_1; +drop procedure proc_1; +prepare abc from "reset query cache"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +create procedure proc_1() reset master; +create function func_1() returns int begin reset master; return 1; end| +ERROR 0A000: RESET is not allowed in stored function or trigger +create function func_1() returns int begin call proc_1(); return 1; end| +select func_1(), func_1(), func_1() from dual; +ERROR 0A000: RESET is not allowed in stored function or trigger +drop function func_1; +drop procedure proc_1; +prepare abc from "reset master"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +create procedure proc_1() reset slave; +call proc_1(); +call proc_1(); +call proc_1(); +create function func_1() returns int begin reset slave; return 1; end| +ERROR 0A000: RESET is not allowed in stored function or trigger +create function func_1() returns int begin call proc_1(); return 1; end| +select func_1(), func_1(), func_1() from dual; +ERROR 0A000: RESET is not allowed in stored function or trigger +drop function func_1; +drop procedure proc_1; +prepare abc from "reset slave"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +create procedure proc_1(a integer) kill a; +call proc_1(0); +ERROR HY000: Unknown thread id: 0 +call proc_1(0); +ERROR HY000: Unknown thread id: 0 +call proc_1(0); +ERROR HY000: Unknown thread id: 0 +drop procedure proc_1; +create function func_1() returns int begin kill 0; return 1; end| +select func_1() from dual; +ERROR HY000: Unknown thread id: 0 +select func_1() from dual; +ERROR HY000: Unknown thread id: 0 +select func_1() from dual; +ERROR HY000: Unknown thread id: 0 +drop function func_1; +prepare abc from "kill 0"; +execute abc; +ERROR HY000: Unknown thread id: 0 +execute abc; +ERROR HY000: Unknown thread id: 0 +execute abc; +ERROR HY000: Unknown thread id: 0 +deallocate prepare abc; +create procedure proc_1() flush hosts; +call proc_1(); +call proc_1(); +call proc_1(); +call proc_1(); +create function func_1() returns int begin flush hosts; return 1; end| +ERROR 0A000: FLUSH is not allowed in stored function or trigger +create function func_1() returns int begin call proc_1(); return 1; end| +select func_1(), func_1(), func_1() from dual; +ERROR 0A000: FLUSH is not allowed in stored function or trigger +drop function func_1; +drop procedure proc_1; +prepare abc from "flush hosts"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +create procedure proc_1() flush privileges; +call proc_1(); +call proc_1(); +call proc_1(); +create function func_1() returns int begin flush privileges; return 1; end| +ERROR 0A000: FLUSH is not allowed in stored function or trigger +create function func_1() returns int begin call proc_1(); return 1; end| +select func_1(), func_1(), func_1() from dual; +ERROR 0A000: FLUSH is not allowed in stored function or trigger +drop function func_1; +drop procedure proc_1; +prepare abc from "flush privileges"; +deallocate prepare abc; +create procedure proc_1() flush tables with read lock; +call proc_1(); +unlock tables; +call proc_1(); +unlock tables; +call proc_1(); +unlock tables; +create function func_1() returns int begin flush tables with read lock; return 1; end| +ERROR 0A000: FLUSH is not allowed in stored function or trigger +create function func_1() returns int begin call proc_1(); return 1; end| +select func_1(), func_1(), func_1() from dual; +ERROR 0A000: FLUSH is not allowed in stored function or trigger +drop function func_1; +drop procedure proc_1; +prepare abc from "flush tables with read lock"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +unlock tables; +create procedure proc_1() flush tables; +call proc_1(); +call proc_1(); +call proc_1(); +create function func_1() returns int begin flush tables; return 1; end| +ERROR 0A000: FLUSH is not allowed in stored function or trigger +create function func_1() returns int begin call proc_1(); return 1; end| +select func_1(), func_1(), func_1() from dual; +ERROR 0A000: FLUSH is not allowed in stored function or trigger +drop function func_1; +drop procedure proc_1; +prepare abc from "flush tables"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +create procedure proc_1() flush tables; +flush tables; +show open tables from mysql; +Database Table In_use Name_locked +mysql general_log 0 0 +select Host, User from mysql.user limit 0; +Host User +select Host, Db from mysql.host limit 0; +Host Db +show open tables from mysql; +Database Table In_use Name_locked +mysql general_log 0 0 +mysql host 0 0 +mysql user 0 0 +call proc_1(); +show open tables from mysql; +Database Table In_use Name_locked +mysql general_log 0 0 +select Host, User from mysql.user limit 0; +Host User +select Host, Db from mysql.host limit 0; +Host Db +show open tables from mysql; +Database Table In_use Name_locked +mysql general_log 0 0 +mysql host 0 0 +mysql user 0 0 +call proc_1(); +show open tables from mysql; +Database Table In_use Name_locked +mysql general_log 0 0 +select Host, User from mysql.user limit 0; +Host User +select Host, Db from mysql.host limit 0; +Host Db +show open tables from mysql; +Database Table In_use Name_locked +mysql general_log 0 0 +mysql host 0 0 +mysql user 0 0 +call proc_1(); +show open tables from mysql; +Database Table In_use Name_locked +mysql general_log 0 0 +select Host, User from mysql.user limit 0; +Host User +select Host, Db from mysql.host limit 0; +Host Db +show open tables from mysql; +Database Table In_use Name_locked +mysql general_log 0 0 +mysql host 0 0 +mysql user 0 0 +flush tables; +create function func_1() returns int begin flush tables; return 1; end| +ERROR 0A000: FLUSH is not allowed in stored function or trigger +create function func_1() returns int begin call proc_1(); return 1; end| +select func_1(), func_1(), func_1() from dual; +ERROR 0A000: FLUSH is not allowed in stored function or trigger +drop function func_1; +drop procedure proc_1; +flush tables; +select Host, User from mysql.user limit 0; +Host User +select Host, Db from mysql.host limit 0; +Host Db +show open tables from mysql; +Database Table In_use Name_locked +mysql general_log 0 0 +mysql host 0 0 +mysql user 0 0 +prepare abc from "flush tables"; +execute abc; +show open tables from mysql; +Database Table In_use Name_locked +mysql general_log 0 0 +select Host, User from mysql.user limit 0; +Host User +select Host, Db from mysql.host limit 0; +Host Db +show open tables from mysql; +Database Table In_use Name_locked +mysql general_log 0 0 +mysql host 0 0 +mysql user 0 0 +execute abc; +show open tables from mysql; +Database Table In_use Name_locked +mysql general_log 0 0 +select Host, User from mysql.user limit 0; +Host User +select Host, Db from mysql.host limit 0; +Host Db +show open tables from mysql; +Database Table In_use Name_locked +mysql general_log 0 0 +mysql host 0 0 +mysql user 0 0 +execute abc; +show open tables from mysql; +Database Table In_use Name_locked +mysql general_log 0 0 +select Host, User from mysql.user limit 0; +Host User +select Host, Db from mysql.host limit 0; +Host Db +show open tables from mysql; +Database Table In_use Name_locked +mysql general_log 0 0 +mysql host 0 0 +mysql user 0 0 +flush tables; +deallocate prepare abc; +create procedure proc_1() flush logs; +call proc_1(); +call proc_1(); +call proc_1(); +create function func_1() returns int begin flush logs; return 1; end| +ERROR 0A000: FLUSH is not allowed in stored function or trigger +create function func_1() returns int begin call proc_1(); return 1; end| +select func_1(), func_1(), func_1() from dual; +ERROR 0A000: FLUSH is not allowed in stored function or trigger +drop function func_1; +drop procedure proc_1; +prepare abc from "flush logs"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +create procedure proc_1() flush status; +call proc_1(); +call proc_1(); +call proc_1(); +create function func_1() returns int begin flush status; return 1; end| +ERROR 0A000: FLUSH is not allowed in stored function or trigger +create function func_1() returns int begin call proc_1(); return 1; end| +select func_1(), func_1(), func_1() from dual; +ERROR 0A000: FLUSH is not allowed in stored function or trigger +drop function func_1; +drop procedure proc_1; +prepare abc from "flush status"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +create procedure proc_1() flush slave; +call proc_1(); +call proc_1(); +call proc_1(); +create function func_1() returns int begin flush slave; return 1; end| +ERROR 0A000: FLUSH is not allowed in stored function or trigger +create function func_1() returns int begin call proc_1(); return 1; end| +select func_1(), func_1(), func_1() from dual; +ERROR 0A000: FLUSH is not allowed in stored function or trigger +drop function func_1; +drop procedure proc_1; +prepare abc from "flush slave"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +create procedure proc_1() flush master; +create function func_1() returns int begin flush master; return 1; end| +ERROR 0A000: FLUSH is not allowed in stored function or trigger +create function func_1() returns int begin call proc_1(); return 1; end| +select func_1(), func_1(), func_1() from dual; +ERROR 0A000: FLUSH is not allowed in stored function or trigger +drop function func_1; +drop procedure proc_1; +prepare abc from "flush master"; +deallocate prepare abc; +create procedure proc_1() flush des_key_file; +call proc_1(); +call proc_1(); +call proc_1(); +create function func_1() returns int begin flush des_key_file; return 1; end| +ERROR 0A000: FLUSH is not allowed in stored function or trigger +create function func_1() returns int begin call proc_1(); return 1; end| +select func_1(), func_1(), func_1() from dual; +ERROR 0A000: FLUSH is not allowed in stored function or trigger +drop function func_1; +drop procedure proc_1; +prepare abc from "flush des_key_file"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +create procedure proc_1() flush user_resources; +call proc_1(); +call proc_1(); +call proc_1(); +create function func_1() returns int begin flush user_resources; return 1; end| +ERROR 0A000: FLUSH is not allowed in stored function or trigger +create function func_1() returns int begin call proc_1(); return 1; end| +select func_1(), func_1(), func_1() from dual; +ERROR 0A000: FLUSH is not allowed in stored function or trigger +drop function func_1; +drop procedure proc_1; +prepare abc from "flush user_resources"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +create procedure proc_1() start slave; +drop procedure proc_1; +create function func_1() returns int begin start slave; return 1; end| +drop function func_1; +prepare abc from "start slave"; +deallocate prepare abc; +create procedure proc_1() stop slave; +drop procedure proc_1; +create function func_1() returns int begin stop slave; return 1; end| +drop function func_1; +prepare abc from "stop slave"; +deallocate prepare abc; +create procedure proc_1() show binlog events; +drop procedure proc_1; +create function func_1() returns int begin show binlog events; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "show binlog events"; +deallocate prepare abc; +create procedure proc_1() show slave status; +drop procedure proc_1; +create function func_1() returns int begin show slave status; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "show slave status"; +deallocate prepare abc; +create procedure proc_1() show master status; +drop procedure proc_1; +create function func_1() returns int begin show master status; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "show master status"; +deallocate prepare abc; +create procedure proc_1() show master logs; +drop procedure proc_1; +create function func_1() returns int begin show master logs; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "show master logs"; +deallocate prepare abc; +create procedure proc_1() show events; +call proc_1(); +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +call proc_1(); +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +call proc_1(); +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +drop procedure proc_1; +create function func_1() returns int begin show events; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "show events"; +execute abc; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +execute abc; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +execute abc; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +deallocate prepare abc; +drop procedure if exists a; +create procedure a() select 42; +create procedure proc_1(a char(2)) show create procedure a; +call proc_1("bb"); +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +a STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() +select 42 latin1 latin1_swedish_ci latin1_swedish_ci +call proc_1("bb"); +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +a STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() +select 42 latin1 latin1_swedish_ci latin1_swedish_ci +call proc_1("bb"); +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +a STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() +select 42 latin1 latin1_swedish_ci latin1_swedish_ci +drop procedure proc_1; +create function func_1() returns int begin show create procedure a; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "show create procedure a"; +execute abc; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +a STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() +select 42 latin1 latin1_swedish_ci latin1_swedish_ci +execute abc; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +a STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() +select 42 latin1 latin1_swedish_ci latin1_swedish_ci +execute abc; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +a STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() +select 42 latin1 latin1_swedish_ci latin1_swedish_ci +deallocate prepare abc; +drop procedure a; +drop function if exists a; +create function a() returns int return 42+13; +create procedure proc_1(a char(2)) show create function a; +call proc_1("bb"); +Function sql_mode Create Function character_set_client collation_connection Database Collation +a STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) +return 42+13 latin1 latin1_swedish_ci latin1_swedish_ci +call proc_1("bb"); +Function sql_mode Create Function character_set_client collation_connection Database Collation +a STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) +return 42+13 latin1 latin1_swedish_ci latin1_swedish_ci +call proc_1("bb"); +Function sql_mode Create Function character_set_client collation_connection Database Collation +a STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) +return 42+13 latin1 latin1_swedish_ci latin1_swedish_ci +drop procedure proc_1; +create function func_1() returns int begin show create function a; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "show create function a"; +execute abc; +Function sql_mode Create Function character_set_client collation_connection Database Collation +a STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) +return 42+13 latin1 latin1_swedish_ci latin1_swedish_ci +execute abc; +Function sql_mode Create Function character_set_client collation_connection Database Collation +a STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) +return 42+13 latin1 latin1_swedish_ci latin1_swedish_ci +execute abc; +Function sql_mode Create Function character_set_client collation_connection Database Collation +a STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) +return 42+13 latin1 latin1_swedish_ci latin1_swedish_ci +deallocate prepare abc; +drop function a; +drop table if exists tab1; +create table tab1(a int, b char(1), primary key(a,b)); +create procedure proc_1() show create table tab1; +call proc_1(); +Table Create Table +tab1 CREATE TABLE `tab1` ( + `a` int(11) NOT NULL, + `b` char(1) NOT NULL, + PRIMARY KEY (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +call proc_1(); +Table Create Table +tab1 CREATE TABLE `tab1` ( + `a` int(11) NOT NULL, + `b` char(1) NOT NULL, + PRIMARY KEY (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +call proc_1(); +Table Create Table +tab1 CREATE TABLE `tab1` ( + `a` int(11) NOT NULL, + `b` char(1) NOT NULL, + PRIMARY KEY (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop procedure proc_1; +create function func_1() returns int begin show create table tab1; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "show create table tab1"; +execute abc; +Table Create Table +tab1 CREATE TABLE `tab1` ( + `a` int(11) NOT NULL, + `b` char(1) NOT NULL, + PRIMARY KEY (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +execute abc; +Table Create Table +tab1 CREATE TABLE `tab1` ( + `a` int(11) NOT NULL, + `b` char(1) NOT NULL, + PRIMARY KEY (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +execute abc; +Table Create Table +tab1 CREATE TABLE `tab1` ( + `a` int(11) NOT NULL, + `b` char(1) NOT NULL, + PRIMARY KEY (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +deallocate prepare abc; +drop table tab1; +drop view if exists v1; +drop table if exists t1; +create table t1(a int, b char(5)); +insert into t1 values (1, "one"), (1, "edno"), (2, "two"), (2, "dve"); +create view v1 as +(select a, count(*) from t1 group by a) +union all +(select b, count(*) from t1 group by b); +create procedure proc_1() show create view v1; +call proc_1(); +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`) latin1 latin1_swedish_ci +call proc_1(); +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`) latin1 latin1_swedish_ci +call proc_1(); +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`) latin1 latin1_swedish_ci +drop procedure proc_1; +create function func_1() returns int begin show create view v1; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "show create view v1"; +execute abc; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`) latin1 latin1_swedish_ci +execute abc; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`) latin1 latin1_swedish_ci +execute abc; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`) latin1 latin1_swedish_ci +deallocate prepare abc; +drop view v1; +drop table t1; +create procedure proc_1() install plugin my_plug soname 'some_plugin.so'; +call proc_1(); +Got one of the listed errors +call proc_1(); +Got one of the listed errors +call proc_1(); +Got one of the listed errors +drop procedure proc_1; +create function func_1() returns int begin install plugin my_plug soname '/tmp/plugin'; return 1; end| +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "install plugin my_plug soname 'some_plugin.so'"; +deallocate prepare abc; +create procedure proc_1() uninstall plugin my_plug; +call proc_1(); +ERROR 42000: PLUGIN my_plug does not exist +call proc_1(); +ERROR 42000: PLUGIN my_plug does not exist +call proc_1(); +ERROR 42000: PLUGIN my_plug does not exist +drop procedure proc_1; +create function func_1() returns int begin uninstall plugin my_plug; return 1; end| +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "uninstall plugin my_plug"; +execute abc; +ERROR 42000: PLUGIN my_plug does not exist +execute abc; +ERROR 42000: PLUGIN my_plug does not exist +execute abc; +ERROR 42000: PLUGIN my_plug does not exist +deallocate prepare abc; +drop database if exists mysqltest_xyz; +create procedure proc_1() create database mysqltest_xyz; +call proc_1(); +drop database if exists mysqltest_xyz; +call proc_1(); +call proc_1(); +ERROR HY000: Can't create database 'mysqltest_xyz'; database exists +drop database if exists mysqltest_xyz; +call proc_1(); +drop database if exists mysqltest_xyz; +drop procedure proc_1; +create function func_1() returns int begin create database mysqltest_xyz; return 1; end| +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "create database mysqltest_xyz"; +execute abc; +drop database if exists mysqltest_xyz; +execute abc; +execute abc; +ERROR HY000: Can't create database 'mysqltest_xyz'; database exists +drop database if exists mysqltest_xyz; +execute abc; +drop database if exists mysqltest_xyz; +deallocate prepare abc; +drop table if exists t1; +create table t1 (a int, b char(5)); +insert into t1 values (1, "one"), (2, "two"), (3, "three"); +create procedure proc_1() checksum table xyz; +call proc_1(); +Table Checksum +test.xyz NULL +Warnings: +Error 1146 Table 'test.xyz' doesn't exist +call proc_1(); +Table Checksum +test.xyz NULL +Warnings: +Error 1146 Table 'test.xyz' doesn't exist +call proc_1(); +Table Checksum +test.xyz NULL +Warnings: +Error 1146 Table 'test.xyz' doesn't exist +drop procedure proc_1; +create function func_1() returns int begin checksum table t1; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "checksum table t1"; +execute abc; +Table Checksum +test.t1 645809265 +execute abc; +Table Checksum +test.t1 645809265 +execute abc; +Table Checksum +test.t1 645809265 +deallocate prepare abc; +create procedure proc_1() create user pstest_xyz@localhost; +call proc_1(); +drop user pstest_xyz@localhost; +call proc_1(); +call proc_1(); +ERROR HY000: Operation CREATE USER failed for 'pstest_xyz'@'localhost' +drop user pstest_xyz@localhost; +call proc_1(); +drop user pstest_xyz@localhost; +drop procedure proc_1; +create function func_1() returns int begin create user pstest_xyz@localhost; return 1; end| +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "create user pstest_xyz@localhost"; +execute abc; +drop user pstest_xyz@localhost; +execute abc; +execute abc; +ERROR HY000: Operation CREATE USER failed for 'pstest_xyz'@'localhost' +drop user pstest_xyz@localhost; +execute abc; +drop user pstest_xyz@localhost; +deallocate prepare abc; +drop event if exists xyz; +create function func_1() returns int begin create event xyz on schedule at now() do select 123; return 1; end| +ERROR HY000: Recursion of EVENT DDL statements is forbidden when body is present +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "create event xyz on schedule at now() do select 123"; +ERROR HY000: This command is not supported in the prepared statement protocol yet +deallocate prepare abc; +ERROR HY000: Unknown prepared statement handler (abc) given to DEALLOCATE PREPARE +drop event if exists xyz; +create event xyz on schedule every 5 minute disable do select 123; +create procedure proc_1() alter event xyz comment 'xyz'; +call proc_1(); +drop event xyz; +create event xyz on schedule every 5 minute disable do select 123; ++Warnings: ++Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. +call proc_1(); +drop event xyz; +create event xyz on schedule every 5 minute disable do select 123; ++Warnings: ++Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. +call proc_1(); +drop event xyz; +drop procedure proc_1; +create function func_1() returns int begin alter event xyz comment 'xyz'; return 1; end| +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger +prepare abc from "alter event xyz comment 'xyz'"; +ERROR HY000: This command is not supported in the prepared statement protocol yet +deallocate prepare abc; +ERROR HY000: Unknown prepared statement handler (abc) given to DEALLOCATE PREPARE +drop event if exists xyz; +create event xyz on schedule every 5 minute disable do select 123; +create procedure proc_1() drop event xyz; +call proc_1(); +create event xyz on schedule every 5 minute disable do select 123; ++Warnings: ++Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. +call proc_1(); +call proc_1(); +ERROR HY000: Unknown event 'xyz' +drop procedure proc_1; +create function func_1() returns int begin drop event xyz; return 1; end| +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger +prepare abc from "drop event xyz"; +ERROR HY000: This command is not supported in the prepared statement protocol yet +deallocate prepare abc; +ERROR HY000: Unknown prepared statement handler (abc) given to DEALLOCATE PREPARE +drop table if exists t1; +create table t1 (a int, b char(5)) engine=myisam; +insert into t1 values (1, "one"), (2, "two"), (3, "three"); +SET GLOBAL new_cache.key_buffer_size=128*1024; +create procedure proc_1() cache index t1 in new_cache; +call proc_1(); +Table Op Msg_type Msg_text +test.t1 assign_to_keycache status OK +call proc_1(); +Table Op Msg_type Msg_text +test.t1 assign_to_keycache status OK +call proc_1(); +Table Op Msg_type Msg_text +test.t1 assign_to_keycache status OK +drop procedure proc_1; +SET GLOBAL second_cache.key_buffer_size=128*1024; +prepare abc from "cache index t1 in second_cache"; +execute abc; +Table Op Msg_type Msg_text +test.t1 assign_to_keycache status OK +execute abc; +Table Op Msg_type Msg_text +test.t1 assign_to_keycache status OK +execute abc; +Table Op Msg_type Msg_text +test.t1 assign_to_keycache status OK +deallocate prepare abc; +drop table t1; +drop table if exists t1; +drop table if exists t2; +create table t1 (a int, b char(5)) engine=myisam; +insert into t1 values (1, "one"), (2, "two"), (3, "three"); +create table t2 (a int, b char(5)) engine=myisam; +insert into t2 values (1, "one"), (2, "two"), (3, "three"); +create procedure proc_1() load index into cache t1 ignore leaves; +call proc_1(); +Table Op Msg_type Msg_text +test.t1 preload_keys status OK +call proc_1(); +Table Op Msg_type Msg_text +test.t1 preload_keys status OK +call proc_1(); +Table Op Msg_type Msg_text +test.t1 preload_keys status OK +drop procedure proc_1; +create function func_1() returns int begin load index into cache t1 ignore leaves; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +prepare abc from "load index into cache t2 ignore leaves"; +execute abc; +Table Op Msg_type Msg_text +test.t2 preload_keys status OK +execute abc; +Table Op Msg_type Msg_text +test.t2 preload_keys status OK +execute abc; +Table Op Msg_type Msg_text +test.t2 preload_keys status OK +deallocate prepare abc; +drop table t1, t2; +create procedure proc_1() show errors; +call proc_1(); +Level Code Message +call proc_1(); +Level Code Message +call proc_1(); +Level Code Message +drop procedure proc_1; +create function func_1() returns int begin show errors; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +prepare abc from "show errors"; +deallocate prepare abc; +drop table if exists t1; +drop table if exists t2; +create procedure proc_1() show warnings; +drop table if exists t1; +Warnings: +Note 1051 Unknown table 'test.t1' +call proc_1(); +Level Code Message +Note 1051 Unknown table 'test.t1' +drop table if exists t2; +Warnings: +Note 1051 Unknown table 'test.t2' +call proc_1(); +Level Code Message +Note 1051 Unknown table 'test.t2' +drop table if exists t1, t2; +Warnings: +Note 1051 Unknown table 'test.t1' +Note 1051 Unknown table 'test.t2' +call proc_1(); +Level Code Message +Note 1051 Unknown table 'test.t1' +Note 1051 Unknown table 'test.t2' +drop procedure proc_1; +create function func_1() returns int begin show warnings; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +prepare abc from "show warnings"; +drop table if exists t1; +Warnings: +Note 1051 Unknown table 'test.t1' +execute abc; +Level Code Message +Note 1051 Unknown table 'test.t1' +drop table if exists t2; +Warnings: +Note 1051 Unknown table 'test.t2' +execute abc; +Level Code Message +Note 1051 Unknown table 'test.t2' +drop table if exists t1, t2; +Warnings: +Note 1051 Unknown table 'test.t1' +Note 1051 Unknown table 'test.t2' +execute abc; +Level Code Message +Note 1051 Unknown table 'test.t1' +Note 1051 Unknown table 'test.t2' +deallocate prepare abc; +set @my_password="password"; +set @my_data="clear text to encode"; +prepare stmt1 from 'select decode(encode(?, ?), ?)'; +execute stmt1 using @my_data, @my_password, @my_password; +decode(encode(?, ?), ?) +clear text to encode +set @my_data="more text to encode"; +execute stmt1 using @my_data, @my_password, @my_password; +decode(encode(?, ?), ?) +more text to encode +set @my_password="new password"; +execute stmt1 using @my_data, @my_password, @my_password; +decode(encode(?, ?), ?) +more text to encode +deallocate prepare stmt1; +set @to_format="123456789.123456789"; +set @dec=0; +prepare stmt2 from 'select format(?, ?)'; +execute stmt2 using @to_format, @dec; +format(?, ?) +123,456,789 +set @dec=4; +execute stmt2 using @to_format, @dec; +format(?, ?) +123,456,789.1235 +set @dec=6; +execute stmt2 using @to_format, @dec; +format(?, ?) +123,456,789.123457 +set @dec=2; +execute stmt2 using @to_format, @dec; +format(?, ?) +123,456,789.12 +set @to_format="100"; +execute stmt2 using @to_format, @dec; +format(?, ?) +100.00 +set @to_format="1000000"; +execute stmt2 using @to_format, @dec; +format(?, ?) +1,000,000.00 +set @to_format="10000"; +execute stmt2 using @to_format, @dec; +format(?, ?) +10,000.00 +deallocate prepare stmt2; +DROP TABLE IF EXISTS t1, t2; +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 (i INT); +INSERT INTO t2 VALUES (2); +LOCK TABLE t1 READ, t2 WRITE; +connect conn1, localhost, root, , ; +PREPARE stmt1 FROM "SELECT i FROM t1"; +PREPARE stmt2 FROM "INSERT INTO t2 (i) VALUES (3)"; +EXECUTE stmt1; +i +1 +EXECUTE stmt2; +connection default; +SELECT * FROM t2; +i +2 +UNLOCK TABLES; +SELECT * FROM t2; +i +2 +3 +ALTER TABLE t1 ADD COLUMN j INT; +ALTER TABLE t2 ADD COLUMN j INT; +INSERT INTO t1 VALUES (4, 5); +INSERT INTO t2 VALUES (4, 5); +connection conn1; +EXECUTE stmt1; +i +1 +4 +EXECUTE stmt2; +SELECT * FROM t2; +i j +2 NULL +3 NULL +4 5 +3 NULL +disconnect conn1; +connection default; +DROP TABLE t1, t2; +drop table if exists t1; +Warnings: +Note 1051 Unknown table 'test.t1' +prepare stmt +from "create table t1 (c char(100) character set utf8, key (c(10)))"; +execute stmt; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(100) CHARACTER SET utf8 DEFAULT NULL, + KEY `c` (`c`(10)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +execute stmt; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c` char(100) CHARACTER SET utf8 DEFAULT NULL, + KEY `c` (`c`(10)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +drop table if exists t1, t2; +create table t1 (a int, b int); +create table t2 like t1; +insert into t1 (a, b) values (1,1), (1,2), (1,3), (1,4), (1,5), +(2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6); +insert into t2 select a, max(b) from t1 group by a; +prepare stmt from "delete from t2 where (select (select max(b) from t1 group +by a having a < 2) x from t1) > 10000"; +delete from t2 where (select (select max(b) from t1 group +by a having a < 2) x from t1) > 10000; +ERROR 21000: Subquery returns more than 1 row +execute stmt; +ERROR 21000: Subquery returns more than 1 row +execute stmt; +ERROR 21000: Subquery returns more than 1 row +deallocate prepare stmt; +drop table t1, t2; +# +# Bug#27430 Crash in subquery code when in PS and table DDL changed +# after PREPARE +# +# This part of the test doesn't work in embedded server, this is +# why it's here. For the main test see ps_ddl*.test + +drop table if exists t1; +create table t1 (a int); +prepare stmt from "show events where (1) in (select * from t1)"; +execute stmt; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +drop table t1; +create table t1 (x int); +execute stmt; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +drop table t1; +deallocate prepare stmt; +# +# Bug#49141: Encode function is significantly slower in 5.1 compared to 5.0 +# +prepare encode from "select encode(?, ?) into @ciphertext"; +prepare decode from "select decode(?, ?) into @plaintext"; +set @str="abc", @key="cba"; +execute encode using @str, @key; +execute decode using @ciphertext, @key; +select @plaintext; +@plaintext +abc +set @str="bcd", @key="dcb"; +execute encode using @str, @key; +execute decode using @ciphertext, @key; +select @plaintext; +@plaintext +bcd +deallocate prepare encode; +deallocate prepare decode; +# +# Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings +# +CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT); +INSERT INTO t1 VALUES (0, 0),(0, 0); +PREPARE stmt FROM "SELECT 1 FROM t1 WHERE +ROW(a, b) >= ROW('1', (SELECT 1 FROM t1 WHERE a > 1234))"; +EXECUTE stmt; +1 +EXECUTE stmt; +1 +DEALLOCATE PREPARE stmt; +DROP TABLE t1; +# +# Bug#54494 crash with explain extended and prepared statements +# +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES (1),(2); +SET @save_optimizer_switch=@@optimizer_switch; +SET optimizer_switch='outer_join_with_cache=off'; +PREPARE stmt FROM 'EXPLAIN EXTENDED SELECT 1 FROM t1 RIGHT JOIN t1 t2 ON 1'; +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select 1 AS `1` from `test`.`t1` `t2` left join `test`.`t1` on(1) where 1 +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select 1 AS `1` from `test`.`t1` `t2` left join `test`.`t1` on(1) where 1 +DEALLOCATE PREPARE stmt; +SET optimizer_switch=@save_optimizer_switch; +DROP TABLE t1; +# +# Bug#54488 crash when using explain and prepared statements with subqueries +# +CREATE TABLE t1(f1 INT); +INSERT INTO t1 VALUES (1),(1); +PREPARE stmt FROM 'EXPLAIN SELECT 1 FROM t1 WHERE (SELECT (SELECT 1 FROM t1 GROUP BY f1))'; +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +3 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +DEALLOCATE PREPARE stmt; +DROP TABLE t1; + +End of 5.1 tests. +# +# lp:1001500 Crash on the second execution of the PS for +# a query with degenerated conjunctive condition +# (see also mysql bug#12582849) +# +CREATE TABLE t1 ( +pk INTEGER AUTO_INCREMENT, +col_int_nokey INTEGER, +col_int_key INTEGER, +col_varchar_key VARCHAR(1), +col_varchar_nokey VARCHAR(1), +PRIMARY KEY (pk), +KEY (col_int_key), +KEY (col_varchar_key, col_int_key) +); +INSERT INTO t1 ( +col_int_key, col_int_nokey, +col_varchar_key, col_varchar_nokey +) VALUES +(4, 2, 'v', 'v'), +(62, 150, 'v', 'v'); +CREATE TABLE t2 ( +pk INTEGER AUTO_INCREMENT, +col_int_nokey INTEGER, +col_int_key INTEGER, +col_varchar_key VARCHAR(1), +col_varchar_nokey VARCHAR(1), +PRIMARY KEY (pk), +KEY (col_int_key), +KEY (col_varchar_key, col_int_key) +); +INSERT INTO t2 ( +col_int_key, col_int_nokey, +col_varchar_key, col_varchar_nokey +) VALUES +(8, NULL, 'x', 'x'), +(7, 8, 'd', 'd'); +PREPARE stmt FROM ' +SELECT + ( SELECT MAX( SQ1_alias2 .col_int_nokey ) AS SQ1_field1 + FROM ( t2 AS SQ1_alias1 RIGHT JOIN t1 AS SQ1_alias2 + ON ( SQ1_alias2.col_varchar_key = SQ1_alias1.col_varchar_nokey ) + ) + WHERE SQ1_alias2.pk < alias1.col_int_nokey OR alias1.pk + ) AS field1 +FROM ( t1 AS alias1 JOIN t2 AS alias2 ON alias2.pk ) +GROUP BY field1 +'; +EXECUTE stmt; +field1 +150 +EXECUTE stmt; +field1 +150 +DEALLOCATE PREPARE stmt; +DROP TABLE t1, t2; + +# +# WL#4435: Support OUT-parameters in prepared statements. +# + +DROP PROCEDURE IF EXISTS p_string; +DROP PROCEDURE IF EXISTS p_double; +DROP PROCEDURE IF EXISTS p_int; +DROP PROCEDURE IF EXISTS p_decimal; + +CREATE PROCEDURE p_string( +IN v0 INT, +OUT v1 CHAR(32), +IN v2 CHAR(32), +INOUT v3 CHAR(32)) +BEGIN +SET v0 = -1; +SET v1 = 'test_v1'; +SET v2 = 'n/a'; +SET v3 = 'test_v3'; +END| + +CREATE PROCEDURE p_double( +IN v0 INT, +OUT v1 DOUBLE(4, 2), +IN v2 DOUBLE(4, 2), +INOUT v3 DOUBLE(4, 2)) +BEGIN +SET v0 = -1; +SET v1 = 12.34; +SET v2 = 98.67; +SET v3 = 56.78; +END| + +CREATE PROCEDURE p_int( +IN v0 CHAR(10), +OUT v1 INT, +IN v2 INT, +INOUT v3 INT) +BEGIN +SET v0 = 'n/a'; +SET v1 = 1234; +SET v2 = 9876; +SET v3 = 5678; +END| + +CREATE PROCEDURE p_decimal( +IN v0 INT, +OUT v1 DECIMAL(4, 2), +IN v2 DECIMAL(4, 2), +INOUT v3 DECIMAL(4, 2)) +BEGIN +SET v0 = -1; +SET v1 = 12.34; +SET v2 = 98.67; +SET v3 = 56.78; +END| + +PREPARE stmt_str FROM 'CALL p_string(?, ?, ?, ?)'; +PREPARE stmt_dbl FROM 'CALL p_double(?, ?, ?, ?)'; +PREPARE stmt_int FROM 'CALL p_int(?, ?, ?, ?)'; +PREPARE stmt_dec FROM 'CALL p_decimal(?, ?, ?, ?)'; + +SET @x_str_1 = NULL; +SET @x_str_2 = NULL; +SET @x_str_3 = NULL; +SET @x_dbl_1 = NULL; +SET @x_dbl_2 = NULL; +SET @x_dbl_3 = NULL; +SET @x_int_1 = NULL; +SET @x_int_2 = NULL; +SET @x_int_3 = NULL; +SET @x_dec_1 = NULL; +SET @x_dec_2 = NULL; +SET @x_dec_3 = NULL; + +-- Testing strings... + +EXECUTE stmt_str USING @x_int_1, @x_str_1, @x_str_2, @x_str_3; +SELECT @x_int_1, @x_str_1, @x_str_2, @x_str_3; +@x_int_1 @x_str_1 @x_str_2 @x_str_3 +NULL test_v1 NULL test_v3 + +EXECUTE stmt_str USING @x_int_1, @x_str_1, @x_str_2, @x_str_3; +SELECT @x_int_1, @x_str_1, @x_str_2, @x_str_3; +@x_int_1 @x_str_1 @x_str_2 @x_str_3 +NULL test_v1 NULL test_v3 + +-- Testing doubles... + +EXECUTE stmt_dbl USING @x_int_1, @x_dbl_1, @x_dbl_2, @x_dbl_3; +SELECT @x_int_1, @x_dbl_1, @x_dbl_2, @x_dbl_3; +@x_int_1 @x_dbl_1 @x_dbl_2 @x_dbl_3 +NULL 12.34 NULL 56.78 + +EXECUTE stmt_dbl USING @x_int_1, @x_dbl_1, @x_dbl_2, @x_dbl_3; +SELECT @x_int_1, @x_dbl_1, @x_dbl_2, @x_dbl_3; +@x_int_1 @x_dbl_1 @x_dbl_2 @x_dbl_3 +NULL 12.34 NULL 56.78 + +-- Testing ints... + +EXECUTE stmt_int USING @x_str_1, @x_int_1, @x_int_2, @x_int_3; +SELECT @x_str_1, @x_int_1, @x_int_2, @x_int_3; +@x_str_1 @x_int_1 @x_int_2 @x_int_3 +test_v1 1234 NULL 5678 + +EXECUTE stmt_int USING @x_str_1, @x_int_1, @x_int_2, @x_int_3; +SELECT @x_str_1, @x_int_1, @x_int_2, @x_int_3; +@x_str_1 @x_int_1 @x_int_2 @x_int_3 +test_v1 1234 NULL 5678 + +-- Testing decs... + +EXECUTE stmt_dec USING @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; +SELECT @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; +@x_int_1 @x_dec_1 @x_dec_2 @x_dec_3 +1234 12.34 NULL 56.78 + +EXECUTE stmt_dec USING @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; +SELECT @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; +@x_int_1 @x_dec_1 @x_dec_2 @x_dec_3 +1234 12.34 NULL 56.78 + +DEALLOCATE PREPARE stmt_str; +DEALLOCATE PREPARE stmt_dbl; +DEALLOCATE PREPARE stmt_int; +DEALLOCATE PREPARE stmt_dec; + +DROP PROCEDURE p_string; +DROP PROCEDURE p_double; +DROP PROCEDURE p_int; +DROP PROCEDURE p_decimal; + +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS p2; + +CREATE PROCEDURE p1(OUT v1 CHAR(10)) +SET v1 = 'test1'; + +CREATE PROCEDURE p2(OUT v2 CHAR(10)) +BEGIN +SET @query = 'CALL p1(?)'; +PREPARE stmt1 FROM @query; +EXECUTE stmt1 USING @u1; +DEALLOCATE PREPARE stmt1; +SET v2 = @u1; +END| + +CALL p2(@a); +SELECT @a; +@a +test1 + +DROP PROCEDURE p1; +DROP PROCEDURE p2; + +TINYINT + +CREATE PROCEDURE p1(OUT v TINYINT) +SET v = 127; +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` bigint(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = 127; +@a @a = 127 +127 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +SMALLINT + +CREATE PROCEDURE p1(OUT v SMALLINT) +SET v = 32767; +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` bigint(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = 32767; +@a @a = 32767 +32767 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +MEDIUMINT + +CREATE PROCEDURE p1(OUT v MEDIUMINT) +SET v = 8388607; +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` bigint(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = 8388607; +@a @a = 8388607 +8388607 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +INT + +CREATE PROCEDURE p1(OUT v INT) +SET v = 2147483647; +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` bigint(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = 2147483647; +@a @a = 2147483647 +2147483647 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +BIGINT + +CREATE PROCEDURE p1(OUT v BIGINT) +SET v = 9223372036854775807; +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` bigint(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = 9223372036854775807; +@a @a = 9223372036854775807 +9223372036854775807 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +BIT(11) + +CREATE PROCEDURE p1(OUT v BIT(11)) +SET v = b'10100100101'; +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` bigint(20) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = b'10100100101'; +@a @a = b'10100100101' +1317 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +TIMESTAMP + +CREATE PROCEDURE p1(OUT v TIMESTAMP) +SET v = '2007-11-18 15:01:02'; +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = '2007-11-18 15:01:02'; +@a @a = '2007-11-18 15:01:02' +2007-11-18 15:01:02 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +DATETIME + +CREATE PROCEDURE p1(OUT v DATETIME) +SET v = '1234-11-12 12:34:59'; +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = '1234-11-12 12:34:59'; +@a @a = '1234-11-12 12:34:59' +1234-11-12 12:34:59 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +TIME + +CREATE PROCEDURE p1(OUT v TIME) +SET v = '123:45:01'; +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = '123:45:01'; +@a @a = '123:45:01' +123:45:01 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +DATE + +CREATE PROCEDURE p1(OUT v DATE) +SET v = '1234-11-12'; +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = '1234-11-12'; +@a @a = '1234-11-12' +1234-11-12 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +YEAR + +CREATE PROCEDURE p1(OUT v YEAR) +SET v = 2010; +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` bigint(20) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = 2010; +@a @a = 2010 +2010 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +FLOAT(7, 4) + +CREATE PROCEDURE p1(OUT v FLOAT(7, 4)) +SET v = 123.4567; +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` double DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a - 123.4567 < 0.00001; +@a @a - 123.4567 < 0.00001 +123.45670318603516 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +DOUBLE(8, 5) + +CREATE PROCEDURE p1(OUT v DOUBLE(8, 5)) +SET v = 123.45678; +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` double DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a - 123.45678 < 0.000001; +@a @a - 123.45678 < 0.000001 +123.45678 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +DECIMAL(9, 6) + +CREATE PROCEDURE p1(OUT v DECIMAL(9, 6)) +SET v = 123.456789; +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` decimal(65,38) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = 123.456789; +@a @a = 123.456789 +123.456789 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +CHAR(32) + +CREATE PROCEDURE p1(OUT v CHAR(32)) +SET v = REPEAT('a', 16); +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` longtext DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = REPEAT('a', 16); +@a @a = REPEAT('a', 16) +aaaaaaaaaaaaaaaa 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +VARCHAR(32) + +CREATE PROCEDURE p1(OUT v VARCHAR(32)) +SET v = REPEAT('b', 16); +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` longtext DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = REPEAT('b', 16); +@a @a = REPEAT('b', 16) +bbbbbbbbbbbbbbbb 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +TINYTEXT + +CREATE PROCEDURE p1(OUT v TINYTEXT) +SET v = REPEAT('c', 16); +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` longtext DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = REPEAT('c', 16); +@a @a = REPEAT('c', 16) +cccccccccccccccc 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +TEXT + +CREATE PROCEDURE p1(OUT v TEXT) +SET v = REPEAT('d', 16); +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` longtext DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = REPEAT('d', 16); +@a @a = REPEAT('d', 16) +dddddddddddddddd 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +MEDIUMTEXT + +CREATE PROCEDURE p1(OUT v MEDIUMTEXT) +SET v = REPEAT('e', 16); +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` longtext DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = REPEAT('e', 16); +@a @a = REPEAT('e', 16) +eeeeeeeeeeeeeeee 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +LONGTEXT + +CREATE PROCEDURE p1(OUT v LONGTEXT) +SET v = REPEAT('f', 16); +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` longtext DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = REPEAT('f', 16); +@a @a = REPEAT('f', 16) +ffffffffffffffff 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +BINARY(32) + +CREATE PROCEDURE p1(OUT v BINARY(32)) +SET v = REPEAT('g', 32); +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = REPEAT('g', 32); +@a @a = REPEAT('g', 32) +gggggggggggggggggggggggggggggggg 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +VARBINARY(32) + +CREATE PROCEDURE p1(OUT v VARBINARY(32)) +SET v = REPEAT('h', 16); +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = REPEAT('h', 16); +@a @a = REPEAT('h', 16) +hhhhhhhhhhhhhhhh 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +TINYBLOB + +CREATE PROCEDURE p1(OUT v TINYBLOB) +SET v = REPEAT('i', 16); +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = REPEAT('i', 16); +@a @a = REPEAT('i', 16) +iiiiiiiiiiiiiiii 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +BLOB + +CREATE PROCEDURE p1(OUT v BLOB) +SET v = REPEAT('j', 16); +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = REPEAT('j', 16); +@a @a = REPEAT('j', 16) +jjjjjjjjjjjjjjjj 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +MEDIUMBLOB + +CREATE PROCEDURE p1(OUT v MEDIUMBLOB) +SET v = REPEAT('k', 16); +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = REPEAT('k', 16); +@a @a = REPEAT('k', 16) +kkkkkkkkkkkkkkkk 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +LONGBLOB + +CREATE PROCEDURE p1(OUT v LONGBLOB) +SET v = REPEAT('l', 16); +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` longblob DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = REPEAT('l', 16); +@a @a = REPEAT('l', 16) +llllllllllllllll 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +SET('aaa', 'bbb') + +CREATE PROCEDURE p1(OUT v SET('aaa', 'bbb')) +SET v = 'aaa'; +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` longtext DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = 'aaa'; +@a @a = 'aaa' +aaa 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +ENUM('aaa', 'bbb') + +CREATE PROCEDURE p1(OUT v ENUM('aaa', 'bbb')) +SET v = 'aaa'; +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; +SHOW CREATE TABLE tmp1; +Table Create Table +tmp1 CREATE TEMPORARY TABLE `tmp1` ( + `c1` longtext DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT @a, @a = 'aaa'; +@a @a = 'aaa' +aaa 1 +DROP TEMPORARY TABLE tmp1; +DROP PROCEDURE p1; + +# End of WL#4435. +# +# WL#4284: Transactional DDL locking +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a INT); +BEGIN; +SELECT * FROM t1; +a +# Test that preparing a CREATE TABLE does not take a exclusive metdata lock. +PREPARE stmt1 FROM "CREATE TABLE t1 AS SELECT 1"; +EXECUTE stmt1; +ERROR 42S01: Table 't1' already exists +DEALLOCATE PREPARE stmt1; +DROP TABLE t1; +# +# WL#4284: Transactional DDL locking +# +# Test that metadata locks taken during prepare are released. +# +connect con1,localhost,root,,; +connection default; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a INT); +connection con1; +BEGIN; +PREPARE stmt1 FROM "SELECT * FROM t1"; +connection default; +DROP TABLE t1; +disconnect con1; + +# +# Bug#56115: invalid memory reads when PS selecting from +# information_schema tables +# Bug#58701: crash in Field::make_field, cursor-protocol +# +# NOTE: MTR should be run both with --ps-protocol and --cursor-protocol. +# + +SELECT * +FROM (SELECT 1 UNION SELECT 2) t; +1 +1 +2 + +# Bug#13805127: Stored program cache produces wrong result in same THD + +PREPARE s1 FROM +" +SELECT c1, t2.c2, count(c3) +FROM + ( + SELECT 3 as c2 FROM dual WHERE @x = 1 + UNION + SELECT 2 FROM dual WHERE @x = 1 OR @x = 2 + ) AS t1, + ( + SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual + UNION + SELECT '2012-03-01 02:00:00', 3, 2 FROM dual + UNION + SELECT '2012-03-01 01:00:00', 2, 1 FROM dual + ) AS t2 +WHERE t2.c2 = t1.c2 +GROUP BY c1, c2 +"; + +SET @x = 1; +SELECT c1, t2.c2, count(c3) +FROM +( +SELECT 3 as c2 FROM dual WHERE @x = 1 +UNION +SELECT 2 FROM dual WHERE @x = 1 OR @x = 2 +) AS t1, +( +SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual +UNION +SELECT '2012-03-01 02:00:00', 3, 2 FROM dual +UNION +SELECT '2012-03-01 01:00:00', 2, 1 FROM dual +) AS t2 +WHERE t2.c2 = t1.c2 +GROUP BY c1, c2; +c1 c2 count(c3) +2012-03-01 01:00:00 2 1 +2012-03-01 01:00:00 3 1 +2012-03-01 02:00:00 3 1 + +EXECUTE s1; +c1 c2 count(c3) +2012-03-01 01:00:00 2 1 +2012-03-01 01:00:00 3 1 +2012-03-01 02:00:00 3 1 + +SET @x = 2; +SELECT c1, t2.c2, count(c3) +FROM +( +SELECT 3 as c2 FROM dual WHERE @x = 1 +UNION +SELECT 2 FROM dual WHERE @x = 1 OR @x = 2 +) AS t1, +( +SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual +UNION +SELECT '2012-03-01 02:00:00', 3, 2 FROM dual +UNION +SELECT '2012-03-01 01:00:00', 2, 1 FROM dual +) AS t2 +WHERE t2.c2 = t1.c2 +GROUP BY c1, c2; +c1 c2 count(c3) +2012-03-01 01:00:00 2 1 + +EXECUTE s1; +c1 c2 count(c3) +2012-03-01 01:00:00 2 1 + +SET @x = 1; +SELECT c1, t2.c2, count(c3) +FROM +( +SELECT 3 as c2 FROM dual WHERE @x = 1 +UNION +SELECT 2 FROM dual WHERE @x = 1 OR @x = 2 +) AS t1, +( +SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual +UNION +SELECT '2012-03-01 02:00:00', 3, 2 FROM dual +UNION +SELECT '2012-03-01 01:00:00', 2, 1 FROM dual +) AS t2 +WHERE t2.c2 = t1.c2 +GROUP BY c1, c2; +c1 c2 count(c3) +2012-03-01 01:00:00 2 1 +2012-03-01 01:00:00 3 1 +2012-03-01 02:00:00 3 1 + +EXECUTE s1; +c1 c2 count(c3) +2012-03-01 01:00:00 2 1 +2012-03-01 01:00:00 3 1 +2012-03-01 02:00:00 3 1 +DEALLOCATE PREPARE s1; +prepare stmt from "select date('2010-10-10') between '2010-09-09' and ?"; +set @a='2010-11-11'; +execute stmt using @a; +date('2010-10-10') between '2010-09-09' and ? +1 +execute stmt using @a; +date('2010-10-10') between '2010-09-09' and ? +1 +set @a='2010-08-08'; +execute stmt using @a; +date('2010-10-10') between '2010-09-09' and ? +0 +execute stmt using @a; +date('2010-10-10') between '2010-09-09' and ? +0 +# +# Bug #892725: look-up is changed for a full scan when executing PS +# +create table t1 (a int primary key, b int); +insert into t1 values +(7,70), (3,40), (4,40), (8,70), (1,70), (9,50), (2,70); +prepare st from 'select * from t1 where a=8'; +flush status; +execute st; +a b +8 70 +show status like '%Handler_read%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 1 +Handler_read_last 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_retry 0 +Handler_read_rnd 0 +Handler_read_rnd_deleted 0 +Handler_read_rnd_next 0 +flush status; +execute st; +a b +8 70 +show status like '%Handler_read%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 1 +Handler_read_last 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_retry 0 +Handler_read_rnd 0 +Handler_read_rnd_deleted 0 +Handler_read_rnd_next 0 +flush status; +select * from t1 use index() where a=3; +a b +3 40 +show status like '%Handler_read%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 0 +Handler_read_last 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_retry 0 +Handler_read_rnd 0 +Handler_read_rnd_deleted 0 +Handler_read_rnd_next 8 +flush status; +execute st; +a b +8 70 +show status like '%Handler_read%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 1 +Handler_read_last 0 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_retry 0 +Handler_read_rnd 0 +Handler_read_rnd_deleted 0 +Handler_read_rnd_next 0 +deallocate prepare st; +drop table t1; +# +# Bug mdev-5410: crash at the execution of PS with subselect +# formed by UNION with global ORDER BY +# +CREATE TABLE t1 (a int DEFAULT NULL); +INSERT INTO t1 VALUES (2), (4); +CREATE TABLE t2 (b int DEFAULT NULL); +INSERT INTO t2 VALUES (1), (3); +PREPARE stmt FROM " +SELECT c1 FROM (SELECT (SELECT a FROM t1 WHERE t1.a <= t2.b + UNION ALL + SELECT a FROM t1 WHERE t1.a+3<= t2.b + ORDER BY a DESC) AS c1 FROM t2) t3; +"; +EXECUTE stmt; +c1 +NULL +2 +EXECUTE stmt; +c1 +NULL +2 +DROP TABLE t1,t2; +# +# MDEV-5369: Wrong result (0 instead of NULL) on 2nd execution of +# PS with LEFT JOIN, TEMPTABLE view +# +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (0),(8); +CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=MyISAM; +CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; +SELECT SUM(pk) FROM t1 LEFT JOIN v2 ON a = pk; +SUM(pk) +NULL +PREPARE stmt FROM "SELECT SUM(pk) FROM t1 LEFT JOIN v2 ON a = pk"; +EXECUTE stmt; +SUM(pk) +NULL +EXECUTE stmt; +SUM(pk) +NULL +DEALLOCATE PREPARE stmt; +DROP VIEW v2; +DROP TABLE t1, t2; +# End of 5.3 tests +# +# MDEV-5505: Assertion `! is_set()' fails on PREPARE SELECT +# with out of range in GROUP BY +# +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1"; +ERROR 22003: BIGINT UNSIGNED value is out of range in '18446744073709551615 + 1' +SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1; +ERROR 22003: BIGINT UNSIGNED value is out of range in '18446744073709551615 + 1' +drop table t1; +# End of 5.3 tests +# +# MDEV-8756: MariaDB 10.0.21 crashes during PREPARE +# +CREATE TABLE t1 ( id INT(10), value INT(10) ); +CREATE TABLE t2 ( id INT(10) ); +SET @save_sql_mode= @@sql_mode; +SET SESSION sql_mode = 'ONLY_FULL_GROUP_BY'; +PREPARE stmt FROM 'UPDATE t1 t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id)'; +execute stmt; +insert into t1 values (1,10),(2,10),(3,10); +insert into t2 values (1),(2); +execute stmt; +select * from t1; +id value +1 1 +2 1 +3 NULL +deallocate prepare stmt; +SET SESSION sql_mode = @save_sql_mode; +DROP TABLE t1,t2; +# +# MDEV-8833: Crash of server on prepared statement with +# conversion to semi-join +# +CREATE TABLE t1 (column1 INT); +INSERT INTO t1 VALUES (3),(9); +CREATE TABLE t2 (column2 INT); +INSERT INTO t2 VALUES (1),(4); +CREATE TABLE t3 (column3 INT); +INSERT INTO t3 VALUES (6),(8); +CREATE TABLE t4 (column4 INT); +INSERT INTO t4 VALUES (2),(5); +PREPARE stmt FROM "SELECT ( SELECT MAX( table1.column1 ) AS field1 +FROM t1 AS table1 +WHERE table3.column3 IN ( SELECT table2.column2 AS field2 FROM t2 AS table2 ) +) AS sq +FROM t3 AS table3, t4 AS table4"; +EXECUTE stmt; +sq +NULL +NULL +NULL +NULL +EXECUTE stmt; +sq +NULL +NULL +NULL +NULL +deallocate prepare stmt; +drop table t1,t2,t3,t4; +# +# MDEV-11859: the plans for the first and the second executions +# of PS are not the same +# +create table t1 (id int, c varchar(3), key idx(c))engine=myisam; +insert into t1 values (3,'bar'), (1,'xxx'), (2,'foo'), (5,'yyy'); +prepare stmt1 from +"explain extended + select * from t1 where (1, 2) in ( select 3, 4 ) or c = 'foo'"; +execute stmt1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ref idx idx 6 const 1 100.00 Using index condition +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where `test`.`t1`.`c` = 'foo' +execute stmt1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ref idx idx 6 const 1 100.00 Using index condition +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where `test`.`t1`.`c` = 'foo' +deallocate prepare stmt1; +prepare stmt1 from +"select * from t1 where (1, 2) in ( select 3, 4 ) or c = 'foo'"; +flush status; +execute stmt1; +id c +2 foo +show status like '%Handler_read%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 1 +Handler_read_last 0 +Handler_read_next 1 +Handler_read_prev 0 +Handler_read_retry 0 +Handler_read_rnd 0 +Handler_read_rnd_deleted 0 +Handler_read_rnd_next 0 +flush status; +execute stmt1; +id c +2 foo +show status like '%Handler_read%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 1 +Handler_read_last 0 +Handler_read_next 1 +Handler_read_prev 0 +Handler_read_retry 0 +Handler_read_rnd 0 +Handler_read_rnd_deleted 0 +Handler_read_rnd_next 0 +deallocate prepare stmt1; +prepare stmt2 from +"explain extended + select * from t1 where (1, 2) in ( select 3, 4 )"; +execute stmt2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where 0 +execute stmt2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`c` AS `c` from `test`.`t1` where 0 +deallocate prepare stmt2; +drop table t1; +# +# MDEV-9208: Function->Function->View = Mysqld segfault +# (Server crashes in Dependency_marker::visit_field on 2nd +# execution with merged subquery) +# +CREATE TABLE t1 (i1 INT); +insert into t1 values(1),(2); +CREATE TABLE t2 (i2 INT); +insert into t2 values(1),(2); +prepare stmt from " + select 1 from ( + select + if (i1<0, 0, 0) as f1, + (select f1) as f2 + from t1, t2 + ) sq +"; +execute stmt; +1 +1 +1 +1 +1 +execute stmt; +1 +1 +1 +1 +1 +drop table t1,t2; +# +# MDEV-9619: Assertion `null_ref_table' failed in virtual +# table_map Item_direct_view_ref::used_tables() const on 2nd +# execution of PS +# +CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE=MyISAM; +CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES ('a'),('b'); +CREATE TABLE t2 (f2 VARCHAR(10)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('c'),('d'); +PREPARE stmt FROM "SELECT * FROM v1 WHERE f1 = SOME ( SELECT f2 FROM t2 )"; +EXECUTE stmt; +f1 +EXECUTE stmt; +f1 +insert into t1 values ('c'); +EXECUTE stmt; +f1 +c +EXECUTE stmt; +f1 +c +deallocate prepare stmt; +drop view v1; +drop table t1,t2; +CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE=MyISAM; +CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES ('a'),('b'); +CREATE TABLE t2 (f2 VARCHAR(10)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('c'),('d'); +PREPARE stmt FROM "SELECT * FROM v1 WHERE (f1,f1) = SOME ( SELECT f2,f2 FROM t2 )"; +EXECUTE stmt; +f1 +EXECUTE stmt; +f1 +insert into t1 values ('c'); +EXECUTE stmt; +f1 +c +EXECUTE stmt; +f1 +c +deallocate prepare stmt; +drop view v1; +drop table t1,t2; +CREATE TABLE t1 (column1 INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (3),(9); +CREATE TABLE t2 (column2 INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1),(4); +CREATE TABLE t3 (column3 INT) ENGINE=MyISAM; +INSERT INTO t3 VALUES (6),(8); +CREATE TABLE t4 (column4 INT) ENGINE=MyISAM; +INSERT INTO t4 VALUES (2),(5); +PREPARE stmt FROM " +SELECT ( + SELECT MAX( table1.column1 ) AS field1 + FROM t1 AS table1 + WHERE (111,table3.column3) IN ( SELECT 111,table2.column2 AS field2 FROM t2 AS table2 ) +) AS sq +FROM t3 AS table3, t4 AS table4 GROUP BY sq +"; +EXECUTE stmt; +sq +NULL +EXECUTE stmt; +sq +NULL +deallocate prepare stmt; +drop table t1,t2,t3,t4; +create table t1 (a int, b int, c int); +create table t2 (x int, y int, z int); +create table t3 as select * from t1; +insert into t1 values (1,2,3),(4,5,6),(100,200,300),(400,500,600); +insert into t2 values (1,2,3),(7,8,9),(100,200,300),(400,500,600); +insert into t3 values (1,2,3),(11,12,13),(100,0,0),(400,500,600); +set @optimizer_switch_save=@@optimizer_switch; +set @join_cache_level_save=@@join_cache_level; +set optimizer_switch='materialization=off'; +set join_cache_level=0; +select * from t1 where (select a,b from t3 where t3.c=t1.c) in (select x,y from t2 where t1.c= t2.z); +a b c +1 2 3 +400 500 600 +prepare stmt from "select * from t1 where (select a,b from t3 where t3.c=t1.c) in (select x,y from t2 where t1.c= t2.z)"; +EXECUTE stmt; +a b c +1 2 3 +400 500 600 +EXECUTE stmt; +a b c +1 2 3 +400 500 600 +create view v1 as select * from t1; +create view v2 as select * from t2; +create view v3 as select * from t3; +select * from v1 where (select a,b from v3 where v3.c=v1.c) in (select x,y from v2 where v1.c= v2.z); +a b c +1 2 3 +400 500 600 +prepare stmt from "select * from v1 where (select a,b from v3 where v3.c=v1.c) in (select x,y from v2 where v1.c= v2.z)"; +EXECUTE stmt; +a b c +1 2 3 +400 500 600 +EXECUTE stmt; +a b c +1 2 3 +400 500 600 +set optimizer_switch=@optimizer_switch_save; +set join_cache_level=@join_cache_level_save; +deallocate prepare stmt; +drop view v1,v2,v3; +drop table t1,t2,t3; +# +# MDEV-10657: incorrect result returned with binary protocol +# (prepared statements) +# +create table t1 (code varchar(10) primary key); +INSERT INTO t1(code) VALUES ('LINE1'), ('LINE2'), ('LINE3'); +SELECT X.* +FROM +(SELECT CODE, RN +FROM +(SELECT A.CODE, @cnt := @cnt + 1 AS RN +FROM t1 A, (SELECT @cnt := 0) C) T +) X; +CODE RN +LINE1 1 +LINE2 2 +LINE3 3 +drop table t1; +# End of 5.5 tests +# +# End of 10.0 tests +# +# +# MDEV-12060 Crash in EXECUTE IMMEDIATE with an expression returning a GRANT command +# (the 10.1 part) +# +CREATE PROCEDURE p2 () +BEGIN +SET STATEMENT join_cache_level=CAST(CONCAT(_utf8'6',_latin1'') AS INT) FOR PREPARE stmt FROM 'SELECT 1'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +END; +/ +CALL p2(); +1 +1 +DROP PROCEDURE p2; +BEGIN NOT ATOMIC +SET STATEMENT join_cache_level=CAST(CONCAT(_utf8'6',_latin1'') AS INT) FOR PREPARE stmt FROM 'SELECT 1'; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +END; +/ +1 +1 +BEGIN NOT ATOMIC +SET STATEMENT join_cache_level=CAST(CONCAT(_utf8'6',_latin1'') AS INT) FOR PREPARE stmt FROM 'SELECT 1'; +DEALLOCATE PREPARE stmt; +END; +/ +BEGIN NOT ATOMIC +PREPARE stmt FROM 'SELECT 1'; +SET STATEMENT join_cache_level=CAST(CONCAT(_utf8'6',_latin1'') AS INT) FOR EXECUTE stmt; +DEALLOCATE PREPARE stmt; +END; +/ +1 +1 +# ++# MDEV-14572: Assertion `! is_set()' failed in ++# Diagnostics_area::set_eof_status upon EXPLAIN UPDATE in PS ++# ++CREATE TABLE t1 (a INT); ++CREATE TABLE t2 (b INT); ++PREPARE stmt FROM 'EXPLAIN UPDATE t1, t2 SET a = 1'; ++EXECUTE stmt; ++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 ++1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found ++EXECUTE stmt; ++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 ++1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found ++deallocate prepare stmt; ++DROP TABLE t1, t2; ++# +# End of 10.1 tests +# +# +# MDEV-10709 Expressions as parameters to Dynamic SQL +# +# +# Using a simple expressions as an EXECUTE parameter +# +PREPARE stmt FROM 'SELECT ? FROM DUAL'; +EXECUTE stmt USING 10; +? +10 +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM 'SELECT ? FROM DUAL'; +EXECUTE stmt USING TO_BASE64('xxx'); +? +eHh4 +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM 'SELECT ?+? FROM DUAL'; +EXECUTE stmt USING 10, 10 + 10; +?+? +30 +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM 'SELECT CONCAT(?,?) FROM DUAL'; +EXECUTE stmt USING 'xxx', CONCAT('yyy','zzz'); +CONCAT(?,?) +xxxyyyzzz +DEALLOCATE PREPARE stmt; +# +# Testing disallowed expressions in USING +# +PREPARE stmt FROM 'SELECT ? FROM DUAL'; +EXECUTE stmt USING (SELECT 1); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1)' at line 1 +DEALLOCATE PREPARE stmt; +CREATE FUNCTION f1() RETURNS VARCHAR(10) RETURN 'test'; +PREPARE stmt FROM 'SELECT ? FROM DUAL'; +EXECUTE stmt USING f1(); +ERROR 42000: EXECUTE..USING does not support subqueries or stored functions +DEALLOCATE PREPARE stmt; +DROP FUNCTION f1; +# +# Testing erroneous expressions in USING +# +PREPARE stmt FROM 'SELECT ?'; +EXECUTE stmt USING _latin1'a'=_latin2'a'; +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation '=' +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM 'SELECT ?'; +EXECUTE stmt USING ROW(1,2); +ERROR 21000: Operand should contain 1 column(s) +DEALLOCATE PREPARE stmt; +# +# Creating tables from EXECUTE parameters +# +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ? AS c1 FROM DUAL'; +EXECUTE stmt USING 10; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(2) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE stmt USING 10.123; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` decimal(5,3) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE stmt USING 10.123e0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` double NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE stmt USING CURRENT_DATE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` date NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE stmt USING CURRENT_TIMESTAMP; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` datetime NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE stmt USING CURRENT_TIMESTAMP(3); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` datetime(3) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE stmt USING CURRENT_TIMESTAMP(6); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` datetime(6) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE stmt USING CURRENT_TIME; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` time NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE stmt USING CURRENT_TIME(3); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` time(3) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE stmt USING CURRENT_TIME(6); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` time(6) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +DEALLOCATE PREPARE stmt; +# +# Using a user variable as an EXECUTE..USING out parameter +# +CREATE PROCEDURE p1(OUT a INT) +BEGIN +SET a:= 10; +END; +/ +SET @a=1; +CALL p1(@a); +SELECT @a; +@a +10 +SET @a=2; +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING @a; +SELECT @a; +@a +10 +DROP PROCEDURE p1; +# +# Using an SP variable as an EXECUTE..USING out parameter +# +CREATE PROCEDURE p1 (OUT a INT) +BEGIN +SET a=10; +END; +/ +CREATE PROCEDURE p2 (OUT a INT) +BEGIN +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING a; +END; +/ +SET @a= 1; +CALL p2(@a); +SELECT @a; +@a +10 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +# +# Testing re-prepare on a table metadata update between PREPARE and EXECUTE +# +CREATE TABLE t1 (a INT); +CREATE PROCEDURE p1(a INT) +BEGIN +INSERT INTO t1 VALUES (a); +END; +/ +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING 10; +SELECT * FROM t1; +a +10 +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=NEW.a+1; +EXECUTE stmt USING 20; +SELECT * FROM t1; +a +10 +21 +DEALLOCATE PREPARE stmt; +DROP PROCEDURE p1; +DROP TABLE t1; +# +# End of MDEV-10709 Expressions as parameters to Dynamic SQL +# +# +# MDEV-10585 EXECUTE IMMEDIATE statement +# +EXECUTE IMMEDIATE 'SELECT 1 AS a'; +a +1 +SET @a=10; +EXECUTE IMMEDIATE 'SELECT ? AS a' USING @a; +a +10 +EXECUTE IMMEDIATE 'SELECT ? AS a' USING 20; +a +20 +# +# Erroneous queries +# +EXECUTE IMMEDIATE 'xxx'; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'xxx' at line 1 +EXECUTE IMMEDIATE 'SELECT 1' USING @a; +ERROR HY000: Incorrect arguments to EXECUTE +EXECUTE IMMEDIATE 'SELECT ?'; +ERROR HY000: Incorrect arguments to EXECUTE +EXECUTE IMMEDIATE 'EXECUTE IMMEDIATE "SELECT 1"'; +ERROR HY000: This command is not supported in the prepared statement protocol yet +EXECUTE IMMEDIATE 'PREPARE stmt FROM "SELECT 1"'; +ERROR HY000: This command is not supported in the prepared statement protocol yet +EXECUTE IMMEDIATE 'EXECUTE stmt'; +ERROR HY000: This command is not supported in the prepared statement protocol yet +EXECUTE IMMEDIATE 'DEALLOCATE PREPARE stmt'; +ERROR HY000: This command is not supported in the prepared statement protocol yet +EXECUTE IMMEDIATE 'SELECT ?' USING _latin1'a'=_latin2'a'; +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation '=' +EXECUTE IMMEDIATE 'SELECT ?' USING ROW(1,2); +ERROR 21000: Operand should contain 1 column(s) +# +# Testing disallowed expressions in USING +# +EXECUTE IMMEDIATE 'SELECT ? FROM DUAL' USING (SELECT 1); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1)' at line 1 +CREATE FUNCTION f1() RETURNS VARCHAR(10) RETURN 'test'; +EXECUTE IMMEDIATE 'SELECT ? FROM DUAL' USING f1(); +ERROR 42000: EXECUTE..USING does not support subqueries or stored functions +DROP FUNCTION f1; +# +# DDL +# +EXECUTE IMMEDIATE 'CREATE TABLE t1 (a INT)'; +EXECUTE IMMEDIATE 'SHOW CREATE TABLE t1'; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +EXECUTE IMMEDIATE 'DROP TABLE t1'; +SET @stmt= 'CREATE TABLE t1 (a INT)'; +EXECUTE IMMEDIATE @stmt; +SET @stmt= 'SHOW CREATE TABLE t1'; +EXECUTE IMMEDIATE @stmt; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SET @stmt= 'DROP TABLE t1'; +EXECUTE IMMEDIATE @stmt; +# +# DDL with parameters +# +SET @a= 10, @b= 10.1, @c= 10e0, @d='str'; +EXECUTE IMMEDIATE +'CREATE TABLE t1 AS SELECT ? AS a,? AS b,? AS c,? AS d' + USING @a,@b,@c,@d; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) NOT NULL, + `b` decimal(3,1) NOT NULL, + `c` double NOT NULL, + `d` tinytext NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE IMMEDIATE +'CREATE TABLE t1 AS SELECT ? AS a,? AS b,? AS c,? AS d' + USING 10, 10.1, 10e0, 'str'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(2) NOT NULL, + `b` decimal(3,1) NOT NULL, + `c` double NOT NULL, + `d` varchar(3) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE IMMEDIATE +'CREATE TABLE t1 AS SELECT ? AS t1,? AS t2, ? AS d1,? AS dt1, ? AS dt2' + USING TIME'10:20:30', +TIME'10:20:30.123', +DATE'2001-01-01', +TIMESTAMP'2001-01-01 10:20:30', +TIMESTAMP'2001-01-01 10:20:30.123'; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `t1` time NOT NULL, + `t2` time(3) NOT NULL, + `d1` date NOT NULL, + `dt1` datetime NOT NULL, + `dt2` datetime(3) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# Using a user variable as an EXECUTE IMMEDIATE..USING out parameter +# +CREATE PROCEDURE p1(OUT a INT) +BEGIN +SET a:= 10; +END; +/ +SET @a=1; +CALL p1(@a); +SELECT @a; +@a +10 +SET @a=2; +EXECUTE IMMEDIATE 'CALL p1(?)' USING @a; +SELECT @a; +@a +10 +DROP PROCEDURE p1; +# +# Using an SP variable as an EXECUTE IMMEDIATE..USING out parameter +# +CREATE PROCEDURE p1 (OUT a INT) +BEGIN +SET a=10; +END; +/ +CREATE PROCEDURE p2 (OUT a INT) +BEGIN +EXECUTE IMMEDIATE 'CALL p1(?)' USING a; +END; +/ +SET @a= 1; +CALL p2(@a); +SELECT @a; +@a +10 +DROP PROCEDURE p2; +DROP PROCEDURE p1; +# +# Changing user variables +# +SET @a=10; +EXECUTE IMMEDIATE 'SET @a=@a+1'; +SELECT @a; +@a +11 +# +# SET STATEMENT +# +SET @@max_sort_length=1024; +EXECUTE IMMEDIATE 'SET STATEMENT max_sort_length=1025 FOR SELECT @@max_sort_length'; +@@max_sort_length +1025 +SELECT @@max_sort_length; +@@max_sort_length +1024 +SET @@max_sort_length=DEFAULT; +# +# Similar to prepared EXECUTE, IMMEDIATE is not allowed in stored functions +# +CREATE FUNCTION f1() RETURNS INT +BEGIN +EXECUTE IMMEDIATE 'DO 1'; +RETURN 1; +END; +$$ +ERROR 0A000: Dynamic SQL is not allowed in stored function or trigger +# +# Status variables +# +CREATE FUNCTION get_status_var(name TEXT) RETURNS INT +RETURN (SELECT CAST(VARIABLE_VALUE AS INT) +FROM INFORMATION_SCHEMA.SESSION_STATUS +WHERE VARIABLE_NAME=name); +CREATE PROCEDURE test_status_var(name TEXT) +BEGIN +SET @cnt0=get_status_var(name); +EXECUTE IMMEDIATE 'DO 1'; +SET @cnt1=get_status_var(name); +SELECT @cnt1-@cnt0 AS increment; +END; +$$ +# Note, EXECUTE IMMEDIATE does not increment COM_EXECUTE_SQL +# It increments COM_EXECUTE_IMMEDIATE instead. +CALL test_status_var('COM_EXECUTE_SQL'); +increment +0 +CALL test_status_var('COM_EXECUTE_IMMEDIATE'); +increment +1 +CALL test_status_var('COM_STMT_PREPARE'); +increment +1 +CALL test_status_var('COM_STMT_EXECUTE'); +increment +1 +CALL test_status_var('COM_STMT_CLOSE'); +increment +1 +DROP PROCEDURE test_status_var; +DROP FUNCTION get_status_var; +# +# End of MDEV-10585 EXECUTE IMMEDIATE statement +# +# +# MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions +# +# +# Testing erroneous and diallowed prepare source +# +EXECUTE IMMEDIATE CONCAT(_latin1'SELECT 1 AS c FROM ', _latin2 'DUAL'); +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'concat' +PREPARE stmt FROM CONCAT(_latin1'SELECT 1 AS c FROM ', _latin2 'DUAL'); +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'concat' +EXECUTE IMMEDIATE (SELECT 'SELECT 1'); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 'SELECT 1')' at line 1 +PREPARE stmt FROM (SELECT 'SELECT 1'); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 'SELECT 1')' at line 1 +EXECUTE IMMEDIATE a; +ERROR 42S22: Unknown column 'a' in 'field list' +PREPARE stmt FROM a; +ERROR 42S22: Unknown column 'a' in 'field list' +EXECUTE IMMEDIATE NULL; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL' at line 1 +PREPARE stmt FROM NULL; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL' at line 1 +EXECUTE IMMEDIATE CONCAT(NULL); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL' at line 1 +PREPARE stmt FROM CONCAT(NULL); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL' at line 1 +EXECUTE IMMEDIATE ? USING 'SELECT 1'; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '? USING 'SELECT 1'' at line 1 +EXECUTE IMMEDIATE 10; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '10' at line 1 +EXECUTE IMMEDIATE TIME'10:20:30'; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '10:20:30' at line 1 +EXECUTE IMMEDIATE ROW('SELECT 1','SELECT 2'); +ERROR 21000: Operand should contain 1 column(s) +EXECUTE IMMEDIATE MAX('SELECT 1 AS c'); +ERROR HY000: Invalid use of group function +EXECUTE IMMEDIATE DEFAULT(a); +ERROR 42S22: Unknown column 'a' in 'field list' +EXECUTE IMMEDIATE VALUE(a); +ERROR 42S22: Unknown column 'a' in 'field list' +CREATE FUNCTION f1() RETURNS VARCHAR(64) RETURN 't1'; +EXECUTE IMMEDIATE f1(); +ERROR 42000: EXECUTE IMMEDIATE does not support subqueries or stored functions +PREPARE stmt FROM f1(); +ERROR 42000: PREPARE..FROM does not support subqueries or stored functions +DROP FUNCTION f1; +EXECUTE IMMEDIATE non_existent(); +ERROR 42000: EXECUTE IMMEDIATE does not support subqueries or stored functions +# +# Testing literals in prepare source +# +EXECUTE IMMEDIATE N'SELECT 1 AS c'; +c +1 +EXECUTE IMMEDIATE _latin1'SELECT 1 AS c'; +c +1 +EXECUTE IMMEDIATE 'SELECT ' '1' ' AS c' ' FROM ' 'DUAL'; +c +1 +EXECUTE IMMEDIATE 0x53454C4543542031 /*This is 'SELECT 1'*/; +1 +1 +# +# Testing user variables in prepare source +# +SET @stmt='SELECT 1 AS c FROM DUAL'; +EXECUTE IMMEDIATE @stmt; +c +1 +PREPARE stmt FROM @stmt; +EXECUTE stmt; +c +1 +DEALLOCATE PREPARE stmt; +SET @table_name='DUAL'; +EXECUTE IMMEDIATE CONCAT('SELECT 1 AS a FROM ', @table_name); +a +1 +PREPARE stmt FROM CONCAT('SELECT 1 AS a FROM ', @table_name); +EXECUTE stmt; +a +1 +DEALLOCATE PREPARE stmt; +# +# Testing SP parameters and variables in prepare source +# +CREATE PROCEDURE p1(table_name VARCHAR(64)) +BEGIN +EXECUTE IMMEDIATE CONCAT('SELECT 1 AS c FROM ', table_name); +END; +$$ +CALL p1('DUAL'); +c +1 +DROP PROCEDURE p1; +CREATE PROCEDURE p1() +BEGIN +DECLARE table_name VARCHAR(64) DEFAULT 'DUAL'; +EXECUTE IMMEDIATE CONCAT('SELECT 1 AS c FROM ', table_name); +END; +$$ +CALL p1(); +c +1 +DROP PROCEDURE p1; +# +# Testing complex expressions +# +EXECUTE IMMEDIATE CONVERT('SELECT 1 AS c' USING utf8); +c +1 +EXECUTE IMMEDIATE CAST('SELECT 1 AS c' AS CHAR); +c +1 +EXECUTE IMMEDIATE _latin1'SELECT 1 AS c' COLLATE latin1_bin; +c +1 +EXECUTE IMMEDIATE (((('SELECT 1 AS c')))); +c +1 +EXECUTE IMMEDIATE CASE WHEN 1>2 THEN 'SELECT 1 AS c' ELSE 'SELECT 2 AS c' END; +c +2 +EXECUTE IMMEDIATE TRIM('SELECT 1 AS c'); +c +1 +EXECUTE IMMEDIATE SUBSTRING('SELECT 1 AS c' FROM 1); +c +1 +EXECUTE IMMEDIATE COALESCE(NULL, 'SELECT 1 AS c'); +c +1 +# +# Testing SET STATEMENT and system variables +# +CREATE TABLE t1 (a INT); +SET STATEMENT max_sort_length=1025 FOR EXECUTE IMMEDIATE CONCAT('INSERT INTO t1 VALUES (', @@max_sort_length, ')'); +SELECT * FROM t1; +a +1025 +DROP TABLE t1; +# +# End of MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions +# +# +# MDEV-11360 Dynamic SQL: DEFAULT as a bind parameter +# +CREATE TABLE t1 (a INT DEFAULT 10, b INT DEFAULT NULL); +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?,?)' USING DEFAULT, DEFAULT; +SELECT * FROM t1; +a b +10 NULL +UPDATE t1 SET a=20, b=30; +SELECT * FROM t1; +a b +20 30 +EXECUTE IMMEDIATE 'UPDATE t1 SET a=?,b=?' USING DEFAULT, DEFAULT; +SELECT * FROM t1; +a b +10 NULL +DROP TABLE t1; +CREATE TABLE t1 (a INT DEFAULT 10); +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?+1)' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (CONCAT(?,?))' USING DEFAULT, 'test'; +ERROR HY000: Default/ignore value is not supported for such parameter usage +DROP TABLE t1; +CREATE TABLE t1 (a INT DEFAULT 10); +INSERT INTO t1 VALUES (20); +EXECUTE IMMEDIATE 'UPDATE t1 SET a=?+1' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'UPDATE t1 SET a=CONCAT(?,?)' USING DEFAULT, 'test'; +ERROR HY000: Default/ignore value is not supported for such parameter usage +DROP TABLE t1; +EXECUTE IMMEDIATE 'SELECT CAST(? AS SIGNED)' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT CAST(? AS DOUBLE)' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT CAST(? AS CHAR)' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT CAST(? AS DECIMAL(10,1))' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT CAST(? AS TIME)' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT CAST(? AS DATE)' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT CAST(? AS DATETIME)' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT ?+1' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT CONCAT(?,?)' USING DEFAULT,'test'; +ERROR HY000: Default/ignore value is not supported for such parameter usage +EXECUTE IMMEDIATE 'SELECT 1 LIMIT ?' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +CREATE TABLE t1 (a INT DEFAULT 10); +INSERT INTO t1 VALUES (1),(2),(3); +EXECUTE IMMEDIATE 'SELECT * FROM t1 LIMIT ?' USING DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +DROP TABLE t1; +# The output of this query in 'Note' is a syntactically incorrect query. +# But as it's never logged, it's ok. It should be human readable only. +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT ?' USING DEFAULT; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select default AS `?` +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>?+a' USING DEFAULT,DEFAULT; +ERROR HY000: Default/ignore value is not supported for such parameter usage +DROP TABLE t1; +# +# MDEV-11780 Crash with PREPARE + SP out parameter + literal +# +CREATE OR REPLACE PROCEDURE p1(OUT a INT) +BEGIN +SET a=10; +END; +$$ +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING 10; +ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NEW pseudo-variable in BEFORE trigger +EXECUTE stmt USING DEFAULT; +ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NEW pseudo-variable in BEFORE trigger +EXECUTE stmt USING IGNORE; +ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NEW pseudo-variable in BEFORE trigger +DEALLOCATE PREPARE stmt; +EXECUTE IMMEDIATE 'CALL p1(?)' USING 10; +ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NEW pseudo-variable in BEFORE trigger +EXECUTE IMMEDIATE 'CALL p1(?)' USING DEFAULT; +ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NEW pseudo-variable in BEFORE trigger +EXECUTE IMMEDIATE 'CALL p1(?)' USING IGNORE; +ERROR 42000: OUT or INOUT argument 1 for routine test.p1 is not a variable or NEW pseudo-variable in BEFORE trigger +DROP PROCEDURE p1; +# +# MDEV-14434 Wrong result for CHARSET(CONCAT(?,const)) +# +SET NAMES utf8; +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(5,_latin1'a'))"; +CHARSET(CONCAT(5,_latin1'a')) +latin1 +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5; +CHARSET(CONCAT(?,_latin1'a')) +latin1 +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5.5; +CHARSET(CONCAT(?,_latin1'a')) +latin1 +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5.5e0; +CHARSET(CONCAT(?,_latin1'a')) +latin1 +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING TIME'10:20:30'; +CHARSET(CONCAT(?,_latin1'a')) +latin1 +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING TIMESTAMP'2001-01-01 10:20:30'; +CHARSET(CONCAT(?,_latin1'a')) +latin1 +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5; +COERCIBILITY(?) +5 +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5; +COERCIBILITY(?) +5 +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5e0; +COERCIBILITY(?) +5 +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIME'10:20:30'; +COERCIBILITY(?) +5 +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIMESTAMP'2001-01-01 10:20:30'; +COERCIBILITY(?) +5 +# +# MDEV-14435 Different UNSIGNED flag of out user variable for YEAR parameter for direct vs prepared CALL +# +CREATE PROCEDURE p1(OUT v INT UNSIGNED) SET v = 2010; +CALL p1(@a); +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING @b; +DEALLOCATE PREPARE stmt; +CREATE TABLE t1 AS SELECT @a AS a, @b AS b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) unsigned DEFAULT NULL, + `b` bigint(20) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT v YEAR) SET v = 2010; +CALL p1(@a); +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING @b; +DEALLOCATE PREPARE stmt; +CREATE TABLE t1 AS SELECT @a AS a, @b AS b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) unsigned DEFAULT NULL, + `b` bigint(20) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +DROP PROCEDURE p1; +CREATE PROCEDURE p1(OUT v BIT(16)) SET v = 2010; +CALL p1(@a); +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING @b; +DEALLOCATE PREPARE stmt; +CREATE TABLE t1 AS SELECT @a AS a, @b AS b; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(20) unsigned DEFAULT NULL, + `b` bigint(20) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +DROP PROCEDURE p1; +# +# MDEV-14426 Assertion in Diagnostics_area::set_error_status when using a bad datetime with PS and SP +# +CREATE PROCEDURE p1(OUT a VARCHAR(20)) +BEGIN +SET a=10; +END; +$$ +BEGIN NOT ATOMIC +DECLARE a DATETIME; +CALL p1(a); +END; +$$ +ERROR 22007: Incorrect datetime value: '10' for column ``.``.`a` at row 1 +BEGIN NOT ATOMIC +DECLARE a DATETIME; +EXECUTE IMMEDIATE 'CALL p1(?)' USING a; +END; +$$ +ERROR 22007: Incorrect datetime value: '10' for column ``.``.`a` at row 1 +BEGIN NOT ATOMIC +DECLARE a DATETIME; +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING a; +DEALLOCATE PREPARE stmt; +END; +$$ +ERROR 22007: Incorrect datetime value: '10' for column ``.``.`a` at row 1 +DROP PROCEDURE p1; +# +# MDEV-14454 Binary protocol returns wrong collation ID for SP OUT parameters +# +CREATE PROCEDURE p1(OUT v CHAR(32) CHARACTER SET utf8) SET v='aaa'; +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TABLE t1 AS SELECT @a AS c1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` longtext CHARACTER SET utf8 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +DROP PROCEDURE p1; +# +# MDEV-14467 Item_param: replace {INT|DECIMAL|REAL|STRING|TIME}_VALUE with Type_handler +# +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select 1 AS `1` limit 10 +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10.1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select 1 AS `1` limit 10 +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10.1e0; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select 1 AS `1` limit 10 +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING '10'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select 1 AS `1` limit 10 +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING TIME'10:10:10'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select 1 AS `1` limit 101010 +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 1 AS a,? AS b' USING 1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(1) NOT NULL, + `b` int(1) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 10 AS a,? AS b' USING 10; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(2) NOT NULL, + `b` int(2) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 999999999 AS a,? AS b' USING 999999999; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(9) NOT NULL, + `b` int(9) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 2147483647 AS a,? AS b' USING 2147483647; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bigint(10) NOT NULL, + `b` bigint(10) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# MDEV-14603 signal 11 with short stacktrace +# +SET NAMES utf8; +CREATE TABLE t1(i INT); +CREATE PROCEDURE p1(tn VARCHAR(32)) +EXECUTE IMMEDIATE CONCAT('ANALYZE TABLE ',tn); +CALL p1('t1'); +Table Op Msg_type Msg_text +test.t1 analyze status Table is already up to date +DROP PROCEDURE p1; +DROP TABLE t1; +SET NAMES utf8; +CREATE PROCEDURE p1() +EXECUTE IMMEDIATE CONCAT('SELECT ',CONVERT(RAND() USING latin1)); +CALL p1(); +DROP PROCEDURE p1; +SET NAMES utf8; +CREATE PROCEDURE p1() +BEGIN +PREPARE stmt FROM CONCAT('SELECT ',CONVERT(RAND() USING latin1)); +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +END; +$$ +CALL p1(); +DROP PROCEDURE p1; +SET NAMES utf8; +CREATE PROCEDURE p1(a VARCHAR(10) CHARACTER SET utf8) +EXECUTE IMMEDIATE 'SELECT ?' USING CONCAT(a, CONVERT(RAND() USING latin1)); +CALL p1('x'); +DROP PROCEDURE p1; +SET NAMES utf8; +CREATE PROCEDURE p1(a VARCHAR(10) CHARACTER SET utf8) +BEGIN +PREPARE stmt FROM 'SELECT ?'; +EXECUTE stmt USING CONCAT(a, CONVERT(RAND() USING latin1)); +DEALLOCATE PREPARE stmt; +END; +$$ +CALL p1('x'); +DROP PROCEDURE p1; +create table t1 (b blob default ''); +prepare stmt from "alter table t1 force"; +execute stmt; +execute stmt; +execute stmt; +set names latin1; +prepare stmt from "alter table t1 modify b text character set utf8 default 'a'"; +execute stmt; +execute stmt; +execute stmt; +drop table t1; +# +# MDEV-12060 Crash in EXECUTE IMMEDIATE with an expression returning a GRANT command +# +CREATE ROLE testrole; +CREATE OR REPLACE PROCEDURE p1() +BEGIN +END; +/ +CREATE PROCEDURE p2 (wgrp VARCHAR(10)) +BEGIN +EXECUTE IMMEDIATE concat('GRANT EXECUTE ON PROCEDURE p1 TO ',wgrp); +END; +/ +CALL p2('testrole'); +DROP PROCEDURE p2; +CREATE PROCEDURE p2 () +BEGIN +EXECUTE IMMEDIATE concat(_utf8'GRANT EXECUTE ON PROCEDURE p1 TO ',_latin1'testrole'); +END; +/ +CALL p2(); +DROP PROCEDURE p2; +CREATE PROCEDURE p2 () +BEGIN +PREPARE stmt FROM concat(_utf8'GRANT EXECUTE ON PROCEDURE p1 TO ',_latin1' testrole'); +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +END; +/ +CALL p2(); +DROP PROCEDURE p2; +DROP PROCEDURE p1; +DROP ROLE testrole; +# +# MDEV-16992: prepare of CREATE TABLE, CREATE VIEW, DO, SET, CALL +# statements with CTE containing materialized derived +# (the bug is reproducible on 10.4) +# +prepare stmt from +"CREATE TABLE t1 AS + WITH cte(a) AS (SELECT * FROM (SELECT 1) AS t) SELECT * FROM cte;"; +execute stmt; +select * from t1; +a +1 +prepare stmt from +"CREATE VIEW v1 AS + WITH cte(a) AS (SELECT * FROM (SELECT 1) AS t) SELECT * FROM cte;"; +execute stmt; +select * from v1; +a +1 +prepare stmt from +"DO (SELECT 1 + FROM (WITH cte AS (SELECT * FROM (SELECT 1) AS t) + SELECT * FROM cte) AS tt);"; +execute stmt; +prepare stmt from +"SET @a = (SELECT 1 + FROM (WITH cte AS (SELECT * FROM (SELECT 1) AS t) + SELECT * FROM cte) AS t);"; +execute stmt; +create procedure p (i int) insert into t1 values(i); +prepare stmt from +"CALL p + ((SELECT 1 + FROM (WITH cte AS (SELECT * FROM (SELECT 1) AS t) + SELECT * FROM cte) AS tt));"; +execute stmt; +select * from t1; +a +1 +1 +drop procedure p; +drop view v1; +drop table t1; +# +# End of 10.2 tests +# diff --cc mysql-test/main/ps.test index 2b8a05094a6,00000000000..685d528ecb9 mode 100644,000000..100644 --- a/mysql-test/main/ps.test +++ b/mysql-test/main/ps.test @@@ -1,4835 -1,0 +1,4851 @@@ +-- source include/not_embedded.inc +-- source include/have_log_bin.inc + +call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.'); +# +# SQL Syntax for Prepared Statements test +# +--disable_warnings +drop table if exists t1,t2,t3,t4; + +drop database if exists mysqltest1; +# Avoid wrong warnings if mysql_client_test fails +drop database if exists client_test_db; +--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 ER_UNSUPPORTED_PS +prepare stmt2 from 'prepare nested_stmt from "select 1"'; + +--error ER_UNSUPPORTED_PS +prepare stmt2 from 'execute stmt1'; + +--error ER_UNSUPPORTED_PS +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; +deallocate prepare stmt3; +deallocate prepare stmt4; +deallocate prepare stmt5; + +# +# 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, 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 @save_optimizer_switch=@@optimizer_switch; +set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=off"; + +set @tmp_optimizer_switch=@@optimizer_switch; +set optimizer_switch='derived_merge=off,derived_with_keys=off'; + +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; + +set optimizer_switch=@tmp_optimizer_switch; + +drop tables t1,t2; + +set @@optimizer_switch=@save_optimizer_switch; + +# +# 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 +# + +--let $outfile=$MYSQLTEST_VARDIR/tmp/f1.txt +--error 0,1 +--remove_file $outfile + +prepare stmt1 from "select 1 into @var"; +execute stmt1; +execute stmt1; +prepare stmt1 from "create table t1 select 1 as i"; +--disable_warnings ONCE +execute stmt1; +drop table t1; +--disable_warnings ONCE +execute stmt1; +prepare stmt1 from "insert into t1 select i from t1"; +execute stmt1; +execute stmt1; +--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR> +eval prepare stmt1 from "select * from t1 into outfile '$outfile'"; +execute stmt1; +deallocate prepare stmt1; +drop table t1; + +--remove_file $outfile + +# +# 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 `ü`; +deallocate prepare `ü`; +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 + ?"; +set @v=5; +--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - +execute stmt using @v; +set @v=0; +--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - +execute stmt using @v; +set @v=5; +--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - +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) from t1; +prepare stmt from +"select rand(), + cast(rand(10)*@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; +--disable_warnings +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; +--enable_warnings +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; + +# +# +# Bug#19399 "Stored Procedures 'Lost Connection' when dropping/creating +# tables" +# Check that multi-delete tables are also cleaned up before re-execution. +# +--disable_warnings +drop table if exists t1; +create temporary table if not exists t1 (a1 int); +--enable_warnings +# exact delete syntax is essential +prepare stmt from "delete t1 from t1 where (cast(a1/3 as unsigned) * 3) = a1"; +drop temporary table t1; +create temporary table if not exists t1 (a1 int); +# the server crashed on the next statement without the fix +execute stmt; +drop temporary table t1; +create temporary table if not exists t1 (a1 int); +# the problem was in memory corruption: repeat the test just in case +execute stmt; +drop temporary table t1; +create temporary table if not exists t1 (a1 int); +execute stmt; +drop temporary table t1; +deallocate prepare stmt; + +# Bug#6102 "Server crash with prepared statement and blank after +# function name" +# ensure that stored functions are cached when preparing a statement +# before we open tables +# +create table t1 (a varchar(20)); +insert into t1 values ('foo'); +prepare stmt FROM 'SELECT char_length (a) FROM t1'; +-- error ER_SP_DOES_NOT_EXIST +prepare stmt2 FROM 'SELECT not_a_function (a) FROM t1'; +drop table t1; + +# +# Bug #6089: FOUND_ROWS returns wrong values when no table/view is used +# + +prepare stmt from "SELECT SQL_CALC_FOUND_ROWS 'foo' UNION SELECT 'bar' LIMIT 0"; +execute stmt; +SELECT FOUND_ROWS(); +execute stmt; +SELECT FOUND_ROWS(); +deallocate prepare stmt; + +# +# Bug#9096 "select doesn't return all matched records if prepared statements +# is used" +# The bug was is bad co-operation of the optimizer's algorithm which determines +# which keys can be used to execute a query, constants propagation +# part of the optimizer and parameter markers used by prepared statements. + +drop table if exists t1; +create table t1 (c1 int(11) not null, c2 int(11) not null, + primary key (c1,c2), key c2 (c2), key c1 (c1)); + +insert into t1 values (200887, 860); +insert into t1 values (200887, 200887); + +select * from t1 where (c1=200887 and c2=200887) or c2=860; + +prepare stmt from +"select * from t1 where (c1=200887 and c2=200887) or c2=860"; +execute stmt; +prepare stmt from +"select * from t1 where (c1=200887 and c2=?) or c2=?"; +set @a=200887, @b=860; +# this query did not return all matching rows +execute stmt using @a, @b; +deallocate prepare stmt; + +drop table t1; + +# +# Bug#9777 - another occurrence of the problem stated in Bug#9096: +# we can not compare basic constants by their names, because a placeholder +# is a basic constant while his name is always '?' +# + +create table t1 ( + id bigint(20) not null auto_increment, + code varchar(20) character set utf8 collate utf8_bin not null default '', + company_name varchar(250) character set utf8 collate utf8_bin default null, + setup_mode tinyint(4) default null, + start_date datetime default null, + primary key (id), unique key code (code) +); + +create table t2 ( + id bigint(20) not null auto_increment, + email varchar(250) character set utf8 collate utf8_bin default null, + name varchar(250) character set utf8 collate utf8_bin default null, + t1_id bigint(20) default null, + password varchar(250) character set utf8 collate utf8_bin default null, + primary_contact tinyint(4) not null default '0', + email_opt_in tinyint(4) not null default '1', + primary key (id), unique key email (email), key t1_id (t1_id), + constraint t2_fk1 foreign key (t1_id) references t1 (id) +); + +insert into t1 values +(1, 'demo', 'demo s', 0, current_date()), +(2, 'code2', 'name 2', 0, current_date()), +(3, 'code3', 'name 3', 0, current_date()); + +insert into t2 values +(2, 'email1', 'name1', 3, 'password1', 0, 0), +(3, 'email2', 'name1', 1, 'password2', 1, 0), +(5, 'email3', 'name3', 2, 'password3', 0, 0); + +prepare stmt from 'select t2.id from t2, t1 where (t1.id=? and t2.t1_id=t1.id)'; +set @a=1; +execute stmt using @a; + +select t2.id from t2, t1 where (t1.id=1 and t2.t1_id=t1.id); + +deallocate prepare stmt; +drop table t1, t2; + +# +# Bug#11060 "Server crashes on calling stored procedure with INSERT SELECT +# UNION SELECT" aka "Server crashes on re-execution of prepared INSERT ... +# SELECT with UNION". +# +create table t1 (id int); +prepare stmt from "insert into t1 (id) select id from t1 union select id from t1"; +execute stmt; +execute stmt; +deallocate prepare stmt; +drop table t1; +# +# Bug#11458 "Prepared statement with subselects return random data": +# drop PARAM_TABLE_BIT from the list of tables used by a subquery +# +create table t1 ( + id int(11) unsigned not null primary key auto_increment, + partner_id varchar(35) not null, + t1_status_id int(10) unsigned +); + +insert into t1 values ("1", "partner1", "10"), ("2", "partner2", "10"), + ("3", "partner3", "10"), ("4", "partner4", "10"); + +create table t2 ( + id int(11) unsigned not null default '0', + t1_line_id int(11) unsigned not null default '0', + article_id varchar(20), + sequence int(11) not null default '0', + primary key (id,t1_line_id) +); + +insert into t2 values ("1", "1", "sup", "0"), ("2", "1", "sup", "1"), + ("2", "2", "sup", "2"), ("2", "3", "sup", "3"), + ("2", "4", "imp", "4"), ("3", "1", "sup", "0"), + ("4", "1", "sup", "0"); + +create table t3 ( + id int(11) not null default '0', + preceding_id int(11) not null default '0', + primary key (id,preceding_id) +); + +create table t4 ( + user_id varchar(50) not null, + article_id varchar(20) not null, + primary key (user_id,article_id) +); + +insert into t4 values("nicke", "imp"); + +prepare stmt from +'select distinct t1.partner_id +from t1 left join t3 on t1.id = t3.id + left join t1 pp on pp.id = t3.preceding_id +where + exists ( + select * + from t2 as pl_inner + where pl_inner.id = t1.id + and pl_inner.sequence <= ( + select min(sequence) from t2 pl_seqnr + where pl_seqnr.id = t1.id + ) + and exists ( + select * from t4 + where t4.article_id = pl_inner.article_id + and t4.user_id = ? + ) + ) + and t1.id = ? +group by t1.id +having count(pp.id) = 0'; +set @user_id = 'nicke'; +set @id = '2'; +execute stmt using @user_id, @id; +execute stmt using @user_id, @id; +deallocate prepare stmt; +drop table t1, t2, t3, t4; +# +# Bug#9379: make sure that Item::collation is reset when one sets +# a parameter marker from a string variable. +# +prepare stmt from 'select ?=?'; +set @a='CHRISTINE '; +set @b='CHRISTINE'; +execute stmt using @a, @b; +execute stmt using @a, @b; +set @a=1, @b=2; +execute stmt using @a, @b; +set @a='CHRISTINE '; +set @b='CHRISTINE'; +execute stmt using @a, @b; +deallocate prepare stmt; +# +# Bug#11299 "prepared statement makes wrong SQL syntax in binlog which stops +# replication": check that errouneous queries with placeholders are not +# allowed +# +create table t1 (a int); +--error 1064 +prepare stmt from "select ??"; +--error 1064 +prepare stmt from "select ?FROM t1"; +--error 1064 +prepare stmt from "select FROM t1 WHERE?=1"; +--error 1064 +prepare stmt from "update t1 set a=a+?WHERE 1"; +--disable_ps_protocol +--error 1064 +select ?; +--error 1064 +select ??; +--error 1064 +select ? from t1; +--enable_ps_protocol +drop table t1; +# +# Bug#9359 "Prepared statements take snapshot of system vars at PREPARE +# time" +# +prepare stmt from "select @@time_zone"; +execute stmt; +set @@time_zone:='Japan'; +execute stmt; +prepare stmt from "select @@tx_isolation"; +execute stmt; +set transaction isolation level read committed; +execute stmt; +set transaction isolation level serializable; +execute stmt; +set @@tx_isolation=default; +execute stmt; +deallocate prepare stmt; + +# +# Bug#14410 "Crash in Enum or Set type in CREATE TABLE and PS/SP" +# +# Part I. Make sure the typelib for ENUM is created in the statement memory +# root. +prepare stmt from "create temporary table t1 (letter enum('','a','b','c') +not null)"; +execute stmt; +drop table t1; +execute stmt; +drop table t1; +execute stmt; +drop table t1; +# Part II. Make sure that when the default value is converted to UTF-8, +# the new item is # created in the statement memory root. +set names latin1; +prepare stmt from "create table t1 (a enum('test') default 'test') + character set utf8"; +execute stmt; +drop table t1; +execute stmt; +drop table t1; +execute stmt; +drop table t1; +# Cleanup +set names default; +deallocate prepare stmt; + +# +# A test case for Bug#12734 "prepared statement may return incorrect result +# set for a select SQL request": test that canDoTurboBM is reset for each +# execute of a prepared statement. +# +create table t1 ( + word_id mediumint(8) unsigned not null default '0', + formatted varchar(20) not null default '' +); + +insert into t1 values + (80,'pendant'), (475,'pretendants'), (989,'tendances'), + (1019,'cependant'),(1022,'abondance'),(1205,'independants'), + (13,'lessiver'),(25,'lambiner'),(46,'situer'),(71,'terminer'), + (82,'decrocher'); + +select count(*) from t1 where formatted like '%NDAN%'; +select count(*) from t1 where formatted like '%ER'; +prepare stmt from "select count(*) from t1 where formatted like ?"; +set @like="%NDAN%"; +execute stmt using @like; +set @like="%ER"; +execute stmt using @like; +set @like="%NDAN%"; +execute stmt using @like; +set @like="%ER"; +execute stmt using @like; +deallocate prepare stmt; +drop table t1; + +# +# Bug#13134 "Length of VARCHAR() utf8 column is increasing when table is +# recreated with PS/SP" +# + +prepare stmt from 'create table t1 (a varchar(10) character set utf8)'; +execute stmt; +--disable_warnings +insert ignore into t1 (a) values (repeat('a', 20)); +--enable_warnings +select length(a) from t1; +drop table t1; +execute stmt; +--disable_warnings +insert ignore into t1 (a) values (repeat('a', 20)); +--enable_warnings +# Check that the data is truncated to the same length +select length(a) from t1; +drop table t1; +deallocate prepare stmt; + +# +# Bug#16248 "WHERE (col1,col2) IN ((?,?)) gives wrong results": +# check that ROW implementation is reexecution-friendly. +# +create table t1 (col1 integer, col2 integer); +insert into t1 values(100,100),(101,101),(102,102),(103,103); +prepare stmt from 'select col1, col2 from t1 where (col1, col2) in ((?,?))'; +set @a=100, @b=100; +execute stmt using @a,@b; +set @a=101, @b=101; +execute stmt using @a,@b; +set @a=102, @b=102; +execute stmt using @a,@b; +set @a=102, @b=103; +execute stmt using @a,@b; +deallocate prepare stmt; +drop table t1; + +# +# Bug#16365 Prepared Statements: DoS with too many open statements +# Check that the limit @@max_prpeared_stmt_count works. +# +# This is also the test for bug#23159 prepared_stmt_count should be +# status variable. +# +# Save the old value +set @old_max_prepared_stmt_count= @@max_prepared_stmt_count; +# +# Disable prepared statement protocol: in this test we set +# @@max_prepared_stmt_count to 0 or 1 and would like to test the limit +# manually. +# +--disable_ps_protocol +# +# A. Check that the new variables are present in SHOW VARIABLES and +# SHOW STATUS lists. +# +show variables like 'max_prepared_stmt_count'; +show status like 'prepared_stmt_count'; +# +# B. Check that the new system variable is selectable. +# +select @@max_prepared_stmt_count; +# +# C. Check that max_prepared_stmt_count is settable (global only). +# +set global max_prepared_stmt_count=-1; +select @@max_prepared_stmt_count; +set global max_prepared_stmt_count=10000000000000000; +select @@max_prepared_stmt_count; +set global max_prepared_stmt_count=default; +select @@max_prepared_stmt_count; +--error ER_GLOBAL_VARIABLE +set @@max_prepared_stmt_count=1; +--error ER_GLOBAL_VARIABLE +set max_prepared_stmt_count=1; +--error ER_GLOBAL_VARIABLE +set local max_prepared_stmt_count=1; +# set to a reasonable limit works +set global max_prepared_stmt_count=1; +select @@max_prepared_stmt_count; +# +# D. Check that the variables actually work. +# +set global max_prepared_stmt_count=0; +select @@max_prepared_stmt_count; +show status like 'prepared_stmt_count'; +--error ER_MAX_PREPARED_STMT_COUNT_REACHED +prepare stmt from "select 1"; +show status like 'prepared_stmt_count'; +set global max_prepared_stmt_count=1; +prepare stmt from "select 1"; +show status like 'prepared_stmt_count'; +--error ER_MAX_PREPARED_STMT_COUNT_REACHED +prepare stmt1 from "select 1"; +show status like 'prepared_stmt_count'; +deallocate prepare stmt; +show status like 'prepared_stmt_count'; +# +# E. Check that we can prepare a statement with the same name +# successfully, without hitting the limit. +# +prepare stmt from "select 1"; +show status like 'prepared_stmt_count'; +prepare stmt from "select 2"; +show status like 'prepared_stmt_count'; +# +# F. We can set the max below the current count. In this case no new +# statements should be allowed to prepare. +# +show status like 'prepared_stmt_count'; +select @@max_prepared_stmt_count; +set global max_prepared_stmt_count=0; +--error ER_MAX_PREPARED_STMT_COUNT_REACHED +prepare stmt from "select 1"; +# Result: the old statement is deallocated, the new is not created. +--error ER_UNKNOWN_STMT_HANDLER +execute stmt; +show status like 'prepared_stmt_count'; +--error ER_MAX_PREPARED_STMT_COUNT_REACHED +prepare stmt from "select 1"; +show status like 'prepared_stmt_count'; +# +# G. Show that the variables are up to date even after a connection with all +# statements in it was terminated. +# +set global max_prepared_stmt_count=3; +select @@max_prepared_stmt_count; +show status like 'prepared_stmt_count'; +prepare stmt from "select 1"; + +connect (con1,localhost,root,,); + +# Switch to connection con1 +connection con1; +let $con1_id=`SELECT CONNECTION_ID()`; + +prepare stmt from "select 2"; +prepare stmt1 from "select 3"; +--error ER_MAX_PREPARED_STMT_COUNT_REACHED +prepare stmt2 from "select 4"; +connection default; +--error ER_MAX_PREPARED_STMT_COUNT_REACHED +prepare stmt2 from "select 4"; +select @@max_prepared_stmt_count; +show status like 'prepared_stmt_count'; + +# Disconnect connection con1 and switch to default connection +disconnect con1; +connection default; + +# Wait for the connection con1 to die +let $wait_condition=SELECT COUNT(*)=0 FROM information_schema.processlist WHERE id=$con1_id; +--source include/wait_condition.inc + +deallocate prepare stmt; + +select @@max_prepared_stmt_count; +show status like 'prepared_stmt_count'; +# +# Restore the old value. +# +set global max_prepared_stmt_count= @old_max_prepared_stmt_count; +--enable_ps_protocol + + +# +# Bug#19399 "Stored Procedures 'Lost Connection' when dropping/creating +# tables" +# Check that multi-delete tables are also cleaned up before re-execution. +# +--disable_warnings +drop table if exists t1; +create temporary table if not exists t1 (a1 int); +--enable_warnings +# exact delete syntax is essential +prepare stmt from "delete t1 from t1 where (cast(a1/3 as unsigned) * 3) = a1"; +drop temporary table t1; +create temporary table if not exists t1 (a1 int); +# the server crashed on the next statement without the fix +execute stmt; +drop temporary table t1; +create temporary table if not exists t1 (a1 int); +# the problem was in memory corruption: repeat the test just in case +execute stmt; +drop temporary table t1; +create temporary table if not exists t1 (a1 int); +execute stmt; +drop temporary table t1; +deallocate prepare stmt; + + +# +# BUG#22085: Crash on the execution of a prepared statement that +# uses an IN subquery with aggregate functions in HAVING +# + +CREATE TABLE t1( + ID int(10) unsigned NOT NULL auto_increment, + Member_ID varchar(15) NOT NULL default '', + Action varchar(12) NOT NULL, + Action_Date datetime NOT NULL, + Track varchar(15) default NULL, + User varchar(12) default NULL, + Date_Updated timestamp NOT NULL default CURRENT_TIMESTAMP on update + CURRENT_TIMESTAMP, + PRIMARY KEY (ID), + KEY Action (Action), + KEY Action_Date (Action_Date) +); + +INSERT INTO t1(Member_ID, Action, Action_Date, Track) VALUES + ('111111', 'Disenrolled', '2006-03-01', 'CAD' ), + ('111111', 'Enrolled', '2006-03-01', 'CAD' ), + ('111111', 'Disenrolled', '2006-07-03', 'CAD' ), + ('222222', 'Enrolled', '2006-03-07', 'CAD' ), + ('222222', 'Enrolled', '2006-03-07', 'CHF' ), + ('222222', 'Disenrolled', '2006-08-02', 'CHF' ), + ('333333', 'Enrolled', '2006-03-01', 'CAD' ), + ('333333', 'Disenrolled', '2006-03-01', 'CAD' ), + ('444444', 'Enrolled', '2006-03-01', 'CAD' ), + ('555555', 'Disenrolled', '2006-03-01', 'CAD' ), + ('555555', 'Enrolled', '2006-07-21', 'CAD' ), + ('555555', 'Disenrolled', '2006-03-01', 'CHF' ), + ('666666', 'Enrolled', '2006-02-09', 'CAD' ), + ('666666', 'Enrolled', '2006-05-12', 'CHF' ), + ('666666', 'Disenrolled', '2006-06-01', 'CAD' ); + +PREPARE STMT FROM +"SELECT GROUP_CONCAT(Track SEPARATOR ', ') FROM t1 + WHERE Member_ID=? AND Action='Enrolled' AND + (Track,Action_Date) IN (SELECT Track, MAX(Action_Date) FROM t1 + WHERE Member_ID=? + GROUP BY Track + HAVING Track>='CAD' AND + MAX(Action_Date)>'2006-03-01')"; +SET @id='111111'; +EXECUTE STMT USING @id,@id; +SET @id='222222'; +EXECUTE STMT USING @id,@id; + +DEALLOCATE PREPARE STMT; +DROP TABLE t1; + +# +# BUG#21354: (COUNT(*) = 1) not working in SELECT inside prepared +# statement +# +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (i INT, INDEX(i)); +INSERT INTO t1 VALUES (1); + +PREPARE stmt FROM "SELECT (COUNT(i) = 1), COUNT(i) FROM t1 WHERE i = ?"; +SET @a = 0; +EXECUTE stmt USING @a; +SET @a = 1; +EXECUTE stmt USING @a; +SET @a = 0; +EXECUTE stmt USING @a; + +PREPARE stmt FROM "SELECT (AVG(i) = 1), AVG(i) FROM t1 WHERE i = ?"; +SET @a = 0; +EXECUTE stmt USING @a; +SET @a = 1; +EXECUTE stmt USING @a; +SET @a = 0; +EXECUTE stmt USING @a; + +PREPARE stmt FROM "SELECT (VARIANCE(i) = 1), VARIANCE(i) FROM t1 WHERE i = ?"; +SET @a = 0; +EXECUTE stmt USING @a; +SET @a = 1; +EXECUTE stmt USING @a; +SET @a = 0; +EXECUTE stmt USING @a; + +PREPARE stmt FROM "SELECT (STDDEV(i) = 1), STDDEV(i) FROM t1 WHERE i = ?"; +SET @a = 0; +EXECUTE stmt USING @a; +SET @a = 1; +EXECUTE stmt USING @a; +SET @a = 0; +EXECUTE stmt USING @a; + +PREPARE stmt FROM "SELECT (BIT_OR(i) = 1), BIT_OR(i) FROM t1 WHERE i = ?"; +SET @a = 0; +EXECUTE stmt USING @a; +SET @a = 1; +EXECUTE stmt USING @a; +SET @a = 0; +EXECUTE stmt USING @a; + +PREPARE stmt FROM "SELECT (BIT_AND(i) = 1), BIT_AND(i) FROM t1 WHERE i = ?"; +SET @a = 0; +EXECUTE stmt USING @a; +SET @a = 1; +EXECUTE stmt USING @a; +SET @a = 0; +EXECUTE stmt USING @a; + +PREPARE stmt FROM "SELECT (BIT_XOR(i) = 1), BIT_XOR(i) FROM t1 WHERE i = ?"; +SET @a = 0; +EXECUTE stmt USING @a; +SET @a = 1; +EXECUTE stmt USING @a; +SET @a = 0; +EXECUTE stmt USING @a; + +DEALLOCATE PREPARE stmt; +DROP TABLE t1; + +# +# Bug#19182: CREATE TABLE bar (m INT) SELECT n FROM foo; doesn't work +# from stored procedure. +# +# The cause of a bug was that cached LEX::create_list was modified, +# and then together with LEX::key_list was reset. +# +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings + +CREATE TABLE t1 (i INT); + +PREPARE st_19182 +FROM "CREATE TABLE t2 (i INT, j INT, KEY (i), KEY(j)) SELECT i FROM t1"; + +EXECUTE st_19182; +DESC t2; + +DROP TABLE t2; + +# Check that on second execution we don't loose 'j' column and the keys +# on 'i' and 'j' columns. +EXECUTE st_19182; +DESC t2; + +DEALLOCATE PREPARE st_19182; +DROP TABLE t2, t1; + +# +# Bug #22060 "ALTER TABLE x AUTO_INCREMENT=y in SP crashes server" +# +# Code which implemented CREATE/ALTER TABLE and CREATE DATABASE +# statement modified HA_CREATE_INFO structure in LEX, making these +# statements PS/SP-unsafe (their re-execution might have resulted +# in incorrect results). +# +--disable_warnings +drop database if exists mysqltest; +drop table if exists t1, t2; +--enable_warnings +# CREATE TABLE and CREATE TABLE ... SELECT +create database mysqltest character set utf8; +prepare stmt1 from "create table mysqltest.t1 (c char(10))"; +prepare stmt2 from "create table mysqltest.t2 select 'test'"; +execute stmt1; +--disable_warnings ONCE +execute stmt2; +show create table mysqltest.t1; +show create table mysqltest.t2; +drop table mysqltest.t1; +drop table mysqltest.t2; +alter database mysqltest character set latin1; +execute stmt1; +--disable_warnings ONCE +execute stmt2; +show create table mysqltest.t1; +show create table mysqltest.t2; +drop database mysqltest; +deallocate prepare stmt1; +deallocate prepare stmt2; +# +# CREATE TABLE with DATA DIRECTORY option +# +--disable_warnings +--disable_query_log +eval prepare stmt from "create table t1 (c char(10)) data directory='$MYSQLTEST_VARDIR/tmp'"; +--enable_query_log +execute stmt; +# +# DATA DIRECTORY option does not always work: if the operating +# system does not support symlinks, have_symlinks option is automatically +# disabled. +# In this case DATA DIRECTORY is silently ignored when +# creating a table, and is not output by SHOW CREATE TABLE. +# +--disable_result_log +show create table t1; +--enable_result_log +drop table t1; +execute stmt; +--disable_result_log +show create table t1; +--enable_result_log +--enable_warnings +drop table t1; +deallocate prepare stmt; +# + +# +# Bug #27937: crash on the second execution for prepared statement +# from UNION with ORDER BY an expression containing RAND() +# + +CREATE TABLE t1(a int); +INSERT INTO t1 VALUES (2), (3), (1); + +PREPARE st1 FROM + '(SELECT a FROM t1) UNION (SELECT a+10 FROM t1) ORDER BY RAND()*0+a'; + +EXECUTE st1; +EXECUTE st1; + +DEALLOCATE PREPARE st1; +DROP TABLE t1; + + +# +# Bug #32137: prepared statement crash with str_to_date in update clause +# +create table t1 (a int, b tinyint); +prepare st1 from 'update t1 set b= (str_to_date(a, a))'; +execute st1; +deallocate prepare st1; +drop table t1; + +--echo End of 4.1 tests. + +############################# 5.0 tests start ################################ +# +# +# Bug#6102 "Server crash with prepared statement and blank after +# function name" +# ensure that stored functions are cached when preparing a statement +# before we open tables +# +create table t1 (a varchar(20)); +insert into t1 values ('foo'); +prepare stmt FROM 'SELECT char_length (a) FROM t1'; +-- error ER_SP_DOES_NOT_EXIST +prepare stmt2 FROM 'SELECT not_a_function (a) FROM t1'; +drop table t1; + +# +# Bug#8115: equality propagation and prepared statements +# + +create table t1 (a char(3) not null, b char(3) not null, + c char(3) not null, primary key (a, b, c)); +create table t2 like t1; + +# reduced query +prepare stmt from + "select t1.a from (t1 left outer join t2 on t2.a=1 and t1.b=t2.b) + where t1.a=1"; +execute stmt; +execute stmt; +execute stmt; + +# original query +prepare stmt from +"select t1.a, t1.b, t1.c, t2.a, t2.b, t2.c from +(t1 left outer join t2 on t2.a=? and t1.b=t2.b) +left outer join t2 t3 on t3.a=? where t1.a=?"; + +set @a:=1, @b:=1, @c:=1; + +execute stmt using @a, @b, @c; +execute stmt using @a, @b, @c; +execute stmt using @a, @b, @c; + +deallocate prepare stmt; + +drop table t1,t2; + + +# +# Bug#9383: INFORMATION_SCHEMA.COLUMNS, JOIN, Crash, prepared statement +# + +eval SET @aux= "SELECT COUNT(*) + FROM INFORMATION_SCHEMA.COLUMNS A, + INFORMATION_SCHEMA.COLUMNS B + WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA + AND A.TABLE_NAME = B.TABLE_NAME + AND A.COLUMN_NAME = B.COLUMN_NAME AND + A.TABLE_NAME = 'user'"; + +let $exec_loop_count= 3; +eval prepare my_stmt from @aux; +while ($exec_loop_count) +{ + eval execute my_stmt; + dec $exec_loop_count; +} +deallocate prepare my_stmt; + +# Test CALL in prepared mode +delimiter |; +--disable_warnings +drop procedure if exists p1| +drop table if exists t1| +--enable_warnings +create table t1 (id int)| +insert into t1 values(1)| +create procedure p1(a int, b int) +begin + declare c int; + select max(id)+1 into c from t1; + insert into t1 select a+b; + insert into t1 select a-b; + insert into t1 select a-c; +end| +set @a= 3, @b= 4| +prepare stmt from "call p1(?, ?)"| +execute stmt using @a, @b| +execute stmt using @a, @b| +select * from t1| +deallocate prepare stmt| +drop procedure p1| +drop table t1| +delimiter ;| + + +# +# Bug#7306 LIMIT ?, ? and also WL#1785 " Prepared statements: implement +# support for placeholders in LIMIT clause." +# Add basic test coverage for the feature. +# +create table t1 (a int); +insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +prepare stmt from "select * from t1 limit ?, ?"; +set @offset=0, @limit=1; +execute stmt using @offset, @limit; +select * from t1 limit 0, 1; +set @offset=3, @limit=2; +execute stmt using @offset, @limit; +select * from t1 limit 3, 2; +prepare stmt from "select * from t1 limit ?"; +execute stmt using @limit; +--error 1235 +prepare stmt from "select * from t1 where a in (select a from t1 limit ?)"; +prepare stmt from "select * from t1 union all select * from t1 limit ?, ?"; +set @offset=9; +set @limit=2; +execute stmt using @offset, @limit; +prepare stmt from "(select * from t1 limit ?, ?) union all + (select * from t1 limit ?, ?) order by a limit ?"; +execute stmt using @offset, @limit, @offset, @limit, @limit; + +drop table t1; +deallocate prepare stmt; + +# +# Bug#12651 +# (Crash on a PS including a subquery which is a select from a simple view) +# +CREATE TABLE b12651_T1(a int) ENGINE=MYISAM; +CREATE TABLE b12651_T2(b int) ENGINE=MYISAM; +CREATE VIEW b12651_V1 as SELECT b FROM b12651_T2; + +PREPARE b12651 FROM 'SELECT 1 FROM b12651_T1 WHERE a IN (SELECT b FROM b12651_V1)'; +EXECUTE b12651; + +DROP VIEW b12651_V1; +DROP TABLE b12651_T1, b12651_T2; +DEALLOCATE PREPARE b12651; + + + +# +# Bug #14956: ROW_COUNT() returns incorrect result after EXECUTE of prepared +# statement +# +create table t1 (id int); +prepare ins_call from "insert into t1 (id) values (1)"; +execute ins_call; +select row_count(); +drop table t1; + +# +# BUG#16474: SP crashed MySQL +# (when using "order by localvar", where 'localvar' is just that. +# The actual bug test is in sp.test, this is just testing that we get the +# expected result for prepared statements too, i.e. place holders work as +# textual substitution. If it's a single integer, it works as the (deprecated) +# "order by column#", otherwise it's an expression. +# +create table t1 (a int, b int); +insert into t1 (a,b) values (2,8),(1,9),(3,7); + +# Will order by index +prepare stmt from "select * from t1 order by ?"; +set @a=NULL; +execute stmt using @a; +set @a=1; +execute stmt using @a; +set @a=2; +execute stmt using @a; +deallocate prepare stmt; +# For reference: +select * from t1 order by 1; + +# Will not order by index. +prepare stmt from "select * from t1 order by ?+1"; +set @a=0; +execute stmt using @a; +set @a=1; +execute stmt using @a; +deallocate prepare stmt; +# For reference: +select * from t1 order by 1+1; + +drop table t1; + +# +# Bug#19308 "REPAIR/OPTIMIZE/ANALYZE supported in SP but not in PS". +# Add test coverage for the added commands. +# +create table t1 (a int); +create table t2 like t1; +create table t3 like t2; +prepare stmt from "repair table t1"; +execute stmt; +execute stmt; +prepare stmt from "optimize table t1"; +execute stmt; +execute stmt; +prepare stmt from "analyze table t1"; +execute stmt; +execute stmt; +prepare stmt from "repair table t1, t2, t3"; +execute stmt; +execute stmt; +prepare stmt from "optimize table t1, t2, t3"; +execute stmt; +execute stmt; +prepare stmt from "analyze table t1, t2, t3"; +execute stmt; +execute stmt; +prepare stmt from "repair table t1, t4, t3"; +execute stmt; +execute stmt; +prepare stmt from "optimize table t1, t3, t4"; +execute stmt; +execute stmt; +prepare stmt from "analyze table t4, t1"; +execute stmt; +execute stmt; +deallocate prepare stmt; +drop table t1, t2, t3; + +# +# Bug#17199 "Table not found" error occurs if the query contains a call +# to a function from another database. +# Test prepared statements- related behaviour. +# +# +# ALTER TABLE RENAME and Prepared Statements: wrong DB name buffer was used +# in ALTER ... RENAME which caused memory corruption in prepared statements. +# No need to fix this problem in 4.1 as ALTER TABLE is not allowed in +# Prepared Statements in 4.1. +# +create database mysqltest_long_database_name_to_thrash_heap; +use test; +create table t1 (i int); +prepare stmt from "alter table test.t1 rename t1"; +use mysqltest_long_database_name_to_thrash_heap; +execute stmt; +show tables like 't1'; +prepare stmt from "alter table test.t1 rename t1"; +use test; +execute stmt; +show tables like 't1'; +use mysqltest_long_database_name_to_thrash_heap; +show tables like 't1'; +deallocate prepare stmt; +# +# Check that a prepared statement initializes its current database at +# PREPARE, and then works correctly even if the current database has been +# changed. +# +use mysqltest_long_database_name_to_thrash_heap; +# Necessary for preparation of INSERT/UPDATE/DELETE to succeed +prepare stmt_create from "create table t1 (i int)"; +prepare stmt_insert from "insert into t1 (i) values (1)"; +prepare stmt_update from "update t1 set i=2"; +prepare stmt_delete from "delete from t1 where i=2"; +prepare stmt_select from "select * from t1"; +prepare stmt_alter from "alter table t1 add column (b int)"; +prepare stmt_alter1 from "alter table t1 drop column b"; +prepare stmt_analyze from "analyze table t1"; +prepare stmt_optimize from "optimize table t1"; +prepare stmt_show from "show tables like 't1'"; +prepare stmt_truncate from "truncate table t1"; +prepare stmt_drop from "drop table t1"; +# Drop the table that was used to prepare INSERT/UPDATE/DELETE: we will +# create a new one by executing stmt_create +drop table t1; +# Switch the current database +use test; +# Check that all prepared statements operate on the database that was +# active at PREPARE +execute stmt_create; +# should return empty set +show tables like 't1'; +use mysqltest_long_database_name_to_thrash_heap; +show tables like 't1'; +use test; +execute stmt_insert; +select * from mysqltest_long_database_name_to_thrash_heap.t1; +execute stmt_update; +select * from mysqltest_long_database_name_to_thrash_heap.t1; +execute stmt_delete; +execute stmt_select; +execute stmt_alter; +show columns from mysqltest_long_database_name_to_thrash_heap.t1; +execute stmt_alter1; +show columns from mysqltest_long_database_name_to_thrash_heap.t1; +execute stmt_analyze; +execute stmt_optimize; +execute stmt_show; +execute stmt_truncate; +execute stmt_drop; +show tables like 't1'; +use mysqltest_long_database_name_to_thrash_heap; +show tables like 't1'; +# +# Attempt a statement PREPARE when there is no current database: +# is expected to return an error. +# +drop database mysqltest_long_database_name_to_thrash_heap; +--error ER_NO_DB_ERROR +prepare stmt_create from "create table t1 (i int)"; +--error ER_NO_DB_ERROR +prepare stmt_insert from "insert into t1 (i) values (1)"; +--error ER_NO_DB_ERROR +prepare stmt_update from "update t1 set i=2"; +--error ER_NO_DB_ERROR +prepare stmt_delete from "delete from t1 where i=2"; +--error ER_NO_DB_ERROR +prepare stmt_select from "select * from t1"; +--error ER_NO_DB_ERROR +prepare stmt_alter from "alter table t1 add column (b int)"; +--error ER_NO_DB_ERROR +prepare stmt_alter1 from "alter table t1 drop column b"; +--error ER_NO_DB_ERROR +prepare stmt_analyze from "analyze table t1"; +--error ER_NO_DB_ERROR +prepare stmt_optimize from "optimize table t1"; +--error ER_NO_DB_ERROR +prepare stmt_show from "show tables like 't1'"; +--error ER_NO_DB_ERROR +prepare stmt_truncate from "truncate table t1"; +--error ER_NO_DB_ERROR +prepare stmt_drop from "drop table t1"; +# +# The above has automatically deallocated all our statements. +# +# Attempt to CREATE a temporary table when no DB used: it should fail +# This proves that no table can be used without explicit specification of +# its database if there is no current database. +# +--error ER_NO_DB_ERROR +create temporary table t1 (i int); +# +# Restore the old environemnt +# +use test; + + +# +# BUG#21166: Prepared statement causes signal 11 on second execution +# +# Changes in an item tree done by optimizer weren't properly +# registered and went unnoticed, which resulted in preliminary freeing +# of used memory. +# +--disable_warnings +DROP TABLE IF EXISTS t1, t2, t3; +--enable_warnings + +CREATE TABLE t1 (i BIGINT, j BIGINT); +CREATE TABLE t2 (i BIGINT); +CREATE TABLE t3 (i BIGINT, j BIGINT); + +PREPARE stmt FROM "SELECT * FROM t1 JOIN t2 ON (t2.i = t1.i) + LEFT JOIN t3 ON ((t3.i, t3.j) = (t1.i, t1.j)) + WHERE t1.i = ?"; + +SET @a= 1; +EXECUTE stmt USING @a; +EXECUTE stmt USING @a; + +DEALLOCATE PREPARE stmt; +DROP TABLE IF EXISTS t1, t2, t3; + + +# +# BUG#21081: SELECT inside stored procedure returns wrong results +# +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings + +CREATE TABLE t1 (i INT KEY); +CREATE TABLE t2 (i INT); + +INSERT INTO t1 VALUES (1), (2); +INSERT INTO t2 VALUES (1); + +PREPARE stmt FROM "SELECT t2.i FROM t1 LEFT JOIN t2 ON t2.i = t1.i + WHERE t1.i = ?"; + +SET @arg= 1; +EXECUTE stmt USING @arg; +SET @arg= 2; +EXECUTE stmt USING @arg; +SET @arg= 1; +EXECUTE stmt USING @arg; + +DEALLOCATE PREPARE stmt; +DROP TABLE t1, t2; + + +# +# BUG#20327: Marking of a wrong field leads to a wrong result on select with +# view, prepared statement and subquery. +# +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT * FROM t1; + +INSERT INTO t1 VALUES (1), (2); + +let $query = SELECT t1.i FROM t1 JOIN v1 ON t1.i = v1.i + WHERE EXISTS (SELECT * FROM t1 WHERE v1.i = 1); +eval $query; +eval PREPARE stmt FROM "$query"; +# Statement execution should return '1'. +EXECUTE stmt; +# Check re-execution. +EXECUTE stmt; + +DEALLOCATE PREPARE stmt; +DROP VIEW v1; +DROP TABLE t1; + + +# +# BUG#21856: Prepared Statments: crash if bad create +# +--disable_warnings +DROP PROCEDURE IF EXISTS p1; +--enable_warnings + +let $iterations= 100; +--disable_query_log +--disable_result_log +while ($iterations) +{ + --error ER_PARSE_ERROR + PREPARE stmt FROM "CREATE PROCEDURE p1()"; + dec $iterations; +} +--enable_query_log +--enable_result_log + +# +# Bug 19764: SHOW commands end up in the slow log as table scans +# + +flush status; +prepare sq from 'show status like "slow_queries"'; +execute sq; +prepare no_index from 'select 1 from information_schema.tables limit 1'; +execute sq; +execute no_index; +execute sq; +deallocate prepare no_index; +deallocate prepare sq; + + +# +# Bug 25027: query with a single-row non-correlated subquery +# and IS NULL predicate +# + +CREATE TABLE t1 (a int); +INSERT INTO t1 VALUES (1), (2); +CREATE TABLE t2 (b int); +INSERT INTO t2 VALUES (NULL); + +SELECT a FROM t1 WHERE (SELECT b FROM t2) IS NULL; +PREPARE stmt FROM 'SELECT a FROM t1 WHERE (SELECT b FROM t2) IS NULL'; + +EXECUTE stmt; +DEALLOCATE PREPARE stmt; + +PREPARE stmt FROM 'SELECT a FROM t1 WHERE (SELECT b FROM t2 limit ?) IS NULL'; +SET @arg=1; +EXECUTE stmt USING @arg; +DEALLOCATE PREPARE stmt; + +DROP TABLE t1,t2; +# +# Bug#4968 "Stored procedure crash if cursor opened on altered table" +# The bug is not repeatable any more after the fix for +# Bug#15217 "Bug #15217 Using a SP cursor on a table created with PREPARE +# fails with weird error", however ALTER TABLE is not re-execution friendly +# and that caused a valgrind warning. Check that the warning is gone. +# +--disable_warnings +drop table if exists t1; +--enable_warnings +create table t1 (s1 char(20)); +prepare stmt from "alter table t1 modify s1 int"; +execute stmt; +execute stmt; +drop table t1; +deallocate prepare stmt; + +# +# Bug#6895 "Prepared Statements: ALTER TABLE DROP COLUMN does nothing" +# +--disable_warnings +drop table if exists t1; +--enable_warnings +create table t1 (a int, b int); +prepare s_6895 from "alter table t1 drop column b"; +execute s_6895; +show columns from t1; +drop table t1; +create table t1 (a int, b int); +execute s_6895; +show columns from t1; +drop table t1; +create table t1 (a int, b int); +execute s_6895; +show columns from t1; +deallocate prepare s_6895; +drop table t1; + +# +# Bug #22060 "ALTER TABLE x AUTO_INCREMENT=y in SP crashes server" +# +# 5.0 part of the test. +# + +# ALTER TABLE +create table t1 (i int primary key auto_increment) comment='comment for table t1'; +create table t2 (i int, j int, k int); +prepare stmt from "alter table t1 auto_increment=100"; +execute stmt; +show create table t1; +# Let us trash table-cache's memory +flush tables; +select * from t2; +execute stmt; +show create table t1; +deallocate prepare stmt; +drop table t1, t2; +# 5.1 part of the test. +# CREATE DATABASE +set @old_character_set_server= @@character_set_server; +set @@character_set_server= latin1; +prepare stmt from "create database mysqltest_1"; +execute stmt; +show create database mysqltest_1; +drop database mysqltest_1; +set @@character_set_server= utf8; +execute stmt; +show create database mysqltest_1; +drop database mysqltest_1; +deallocate prepare stmt; +set @@character_set_server= @old_character_set_server; + + +# +# BUG#24491 "using alias from source table in insert ... on duplicate key" +# +--disable_warnings +drop tables if exists t1; +--enable_warnings +create table t1 (id int primary key auto_increment, value varchar(10)); +insert into t1 (id, value) values (1, 'FIRST'), (2, 'SECOND'), (3, 'THIRD'); +# Let us prepare INSERT ... SELECT ... ON DUPLICATE KEY UPDATE statement +# which in its ON DUPLICATE KEY clause erroneously tries to assign value +# to a column which is mentioned only in SELECT part. +prepare stmt from "insert into t1 (id, value) select * from (select 4 as i, 'FOURTH' as v) as y on duplicate key update v = 'DUP'"; +# Both first and second attempts to execute it should fail +--error ER_BAD_FIELD_ERROR +execute stmt; +--error ER_BAD_FIELD_ERROR +execute stmt; +deallocate prepare stmt; +# And now the same test for more complex case which is more close +# to the one that was reported originally. +prepare stmt from "insert into t1 (id, value) select * from (select 4 as id, 'FOURTH' as value) as y on duplicate key update y.value = 'DUP'"; +--error ER_BAD_FIELD_ERROR +execute stmt; +--error ER_BAD_FIELD_ERROR +execute stmt; +deallocate prepare stmt; +drop tables t1; + +# +# Bug #28509: strange behaviour: passing a decimal value to PS +# +prepare stmt from "create table t1 select ?"; +set @a=1.0; +execute stmt using @a; +show create table t1; +drop table t1; + +# +# Bug#33798: prepared statements improperly handle large unsigned ints +# +--disable_warnings +drop table if exists t1; +--enable_warnings +create table t1 (a bigint unsigned, b bigint(20) unsigned); +prepare stmt from "insert into t1 values (?,?)"; +set @a= 9999999999999999; +set @b= 14632475938453979136; +insert into t1 values (@a, @b); +select * from t1 where a = @a and b = @b; +execute stmt using @a, @b; +select * from t1 where a = @a and b = @b; +deallocate prepare stmt; +drop table t1; + +# +# Bug#32890 Crash after repeated create and drop of tables and views +# + +--disable_warnings +drop view if exists v1; +drop table if exists t1; +--enable_warnings + +create table t1 (a int, b int); +insert into t1 values (1,1), (2,2), (3,3); +insert into t1 values (3,1), (1,2), (2,3); + +prepare stmt from "create view v1 as select * from t1"; +execute stmt; +drop table t1; +create table t1 (a int, b int); +drop view v1; +execute stmt; +show create view v1; +drop view v1; + +prepare stmt from "create view v1 (c,d) as select a,b from t1"; +execute stmt; +show create view v1; +select * from v1; +drop view v1; +execute stmt; +deallocate prepare stmt; +show create view v1; +select * from v1; +drop view v1; + +prepare stmt from "create view v1 (c) as select b+1 from t1"; +execute stmt; +show create view v1; +select * from v1; +drop view v1; +execute stmt; +deallocate prepare stmt; +show create view v1; +select * from v1; +drop view v1; + +prepare stmt from "create view v1 (c,d,e,f) as select a,b,a in (select a+2 from t1), a = all (select a from t1) from t1"; +execute stmt; +show create view v1; +select * from v1; +drop view v1; +execute stmt; +deallocate prepare stmt; +show create view v1; +select * from v1; +drop view v1; + +prepare stmt from "create or replace view v1 as select 1"; +execute stmt; +show create view v1; +select * from v1; +execute stmt; +show create view v1; +deallocate prepare stmt; +show create view v1; +select * from v1; +drop view v1; + +prepare stmt from "create view v1 as select 1, 1"; +execute stmt; +show create view v1; +select * from v1; +drop view v1; +execute stmt; +deallocate prepare stmt; +show create view v1; +select * from v1; +drop view v1; + +prepare stmt from "create view v1 (x) as select a from t1 where a > 1"; +execute stmt; +show create view v1; +select * from v1; +drop view v1; +execute stmt; +deallocate prepare stmt; +show create view v1; +select * from v1; +drop view v1; + +prepare stmt from "create view v1 as select * from `t1` `b`"; +execute stmt; +show create view v1; +select * from v1; +drop view v1; +execute stmt; +deallocate prepare stmt; +show create view v1; +select * from v1; +drop view v1; + +prepare stmt from "create view v1 (a,b,c) as select * from t1"; +--error ER_VIEW_WRONG_LIST +execute stmt; +--error ER_VIEW_WRONG_LIST +execute stmt; +deallocate prepare stmt; + +drop table t1; +create temporary table t1 (a int, b int); + +prepare stmt from "create view v1 as select * from t1"; +--error ER_VIEW_SELECT_TMPTABLE +execute stmt; +--error ER_VIEW_SELECT_TMPTABLE +execute stmt; +deallocate prepare stmt; + +drop table t1; + +--error ER_NO_SUCH_TABLE +prepare stmt from "create view v1 as select * from t1"; +--error ER_NO_SUCH_TABLE +prepare stmt from "create view v1 as select * from `t1` `b`"; + +# +# Bug#33851: Passing UNSIGNED param to EXECUTE returns ERROR 1210 +# + +prepare stmt from "select ?"; +set @arg= 123456789.987654321; +select @arg; +execute stmt using @arg; +set @arg= "string"; +select @arg; +execute stmt using @arg; +set @arg= 123456; +select @arg; +execute stmt using @arg; +set @arg= cast(-12345.54321 as decimal(20, 10)); +select @arg; +execute stmt using @arg; +deallocate prepare stmt; + +--echo # +--echo # Bug#48508: Crash on prepared statement re-execution. +--echo # +create table t1(b int); +insert into t1 values (0); +create view v1 AS select 1 as a from t1 where b; +prepare stmt from "select * from v1 where a"; +execute stmt; +execute stmt; +deallocate prepare stmt; +drop table t1; +drop view v1; + +create table t1(a bigint); +create table t2(b tinyint); +insert into t2 values (null); +prepare stmt from "select 1 from t1 join t2 on a xor b where b > 1 and a =1"; +execute stmt; +execute stmt; +deallocate prepare stmt; +drop table t1,t2; +--echo # + + +--echo # +--echo # Bug #49570: Assertion failed: !(order->used & map) +--echo # on re-execution of prepared statement +--echo # +CREATE TABLE t1(a INT PRIMARY KEY); +INSERT INTO t1 VALUES(0), (1); +PREPARE stmt FROM + "SELECT 1 FROM t1 JOIN t1 t2 USING(a) GROUP BY t2.a, t1.a"; +EXECUTE stmt; +EXECUTE stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP TABLE t1; + + +--echo End of 5.0 tests. + +# +# Bug #20665: All commands supported in Stored Procedures should work in +# Prepared Statements +# +create procedure proc_1() reset query cache; +call proc_1(); +call proc_1(); +call proc_1(); +delimiter |; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int deterministic begin reset query cache; return 1; end| +create function func_1() returns int deterministic begin call proc_1(); return 1; end| +delimiter ;| +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +select func_1(), func_1(), func_1() from dual; +drop function func_1; +drop procedure proc_1; +prepare abc from "reset query cache"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; + + +create procedure proc_1() reset master; +delimiter |; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin reset master; return 1; end| +create function func_1() returns int begin call proc_1(); return 1; end| +delimiter ;| +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +select func_1(), func_1(), func_1() from dual; +drop function func_1; +drop procedure proc_1; +prepare abc from "reset master"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; + + +create procedure proc_1() reset slave; +call proc_1(); +call proc_1(); +call proc_1(); +delimiter |; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin reset slave; return 1; end| +create function func_1() returns int begin call proc_1(); return 1; end| +delimiter ;| +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +select func_1(), func_1(), func_1() from dual; +drop function func_1; +drop procedure proc_1; +prepare abc from "reset slave"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; + + +create procedure proc_1(a integer) kill a; +--error ER_NO_SUCH_THREAD +call proc_1(0); +--error ER_NO_SUCH_THREAD +call proc_1(0); +--error ER_NO_SUCH_THREAD +call proc_1(0); +drop procedure proc_1; +delimiter |; +create function func_1() returns int begin kill 0; return 1; end| +delimiter ;| +--error ER_NO_SUCH_THREAD +select func_1() from dual; +--error ER_NO_SUCH_THREAD +select func_1() from dual; +--error ER_NO_SUCH_THREAD +select func_1() from dual; +drop function func_1; +prepare abc from "kill 0"; +--error ER_NO_SUCH_THREAD +execute abc; +--error ER_NO_SUCH_THREAD +execute abc; +--error ER_NO_SUCH_THREAD +execute abc; +deallocate prepare abc; + + +create procedure proc_1() flush hosts; +call proc_1(); +call proc_1(); +call proc_1(); +call proc_1(); +delimiter |; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin flush hosts; return 1; end| +create function func_1() returns int begin call proc_1(); return 1; end| +delimiter ;| +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +select func_1(), func_1(), func_1() from dual; +drop function func_1; +drop procedure proc_1; +prepare abc from "flush hosts"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; + + +create procedure proc_1() flush privileges; +call proc_1(); +call proc_1(); +call proc_1(); +delimiter |; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin flush privileges; return 1; end| +create function func_1() returns int begin call proc_1(); return 1; end| +delimiter ;| +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +select func_1(), func_1(), func_1() from dual; +drop function func_1; +drop procedure proc_1; +prepare abc from "flush privileges"; +deallocate prepare abc; + + +create procedure proc_1() flush tables with read lock; +call proc_1(); +unlock tables; +call proc_1(); +unlock tables; +call proc_1(); +unlock tables; +delimiter |; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin flush tables with read lock; return 1; end| +create function func_1() returns int begin call proc_1(); return 1; end| +delimiter ;| +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +select func_1(), func_1(), func_1() from dual; +drop function func_1; +drop procedure proc_1; +prepare abc from "flush tables with read lock"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +unlock tables; + + +create procedure proc_1() flush tables; +call proc_1(); +call proc_1(); +call proc_1(); +delimiter |; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin flush tables; return 1; end| +create function func_1() returns int begin call proc_1(); return 1; end| +delimiter ;| +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +select func_1(), func_1(), func_1() from dual; +drop function func_1; +drop procedure proc_1; +prepare abc from "flush tables"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; + + +create procedure proc_1() flush tables; +flush tables; +--sorted_result +show open tables from mysql; +select Host, User from mysql.user limit 0; +select Host, Db from mysql.host limit 0; +--sorted_result +show open tables from mysql; +call proc_1(); +--sorted_result +show open tables from mysql; +select Host, User from mysql.user limit 0; +select Host, Db from mysql.host limit 0; +--sorted_result +show open tables from mysql; +call proc_1(); +--sorted_result +show open tables from mysql; +select Host, User from mysql.user limit 0; +select Host, Db from mysql.host limit 0; +--sorted_result +show open tables from mysql; +call proc_1(); +--sorted_result +show open tables from mysql; +select Host, User from mysql.user limit 0; +select Host, Db from mysql.host limit 0; +--sorted_result +show open tables from mysql; +flush tables; +delimiter |; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin flush tables; return 1; end| +create function func_1() returns int begin call proc_1(); return 1; end| +delimiter ;| +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +select func_1(), func_1(), func_1() from dual; +drop function func_1; +drop procedure proc_1; + +# make the output deterministic: +# the order used in SHOW OPEN TABLES +# is too much implementation dependent +--disable_ps_protocol +flush tables; +select Host, User from mysql.user limit 0; +select Host, Db from mysql.host limit 0; +--sorted_result +show open tables from mysql; +--enable_ps_protocol + +prepare abc from "flush tables"; +execute abc; +--sorted_result +show open tables from mysql; +select Host, User from mysql.user limit 0; +select Host, Db from mysql.host limit 0; +--sorted_result +show open tables from mysql; +execute abc; +--sorted_result +show open tables from mysql; +select Host, User from mysql.user limit 0; +select Host, Db from mysql.host limit 0; +--sorted_result +show open tables from mysql; +execute abc; +--sorted_result +show open tables from mysql; +select Host, User from mysql.user limit 0; +select Host, Db from mysql.host limit 0; +--sorted_result +show open tables from mysql; +flush tables; +deallocate prepare abc; + + +create procedure proc_1() flush logs; +call proc_1(); +call proc_1(); +call proc_1(); +delimiter |; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin flush logs; return 1; end| +create function func_1() returns int begin call proc_1(); return 1; end| +delimiter ;| +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +select func_1(), func_1(), func_1() from dual; +drop function func_1; +drop procedure proc_1; +prepare abc from "flush logs"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; + + +create procedure proc_1() flush status; +call proc_1(); +call proc_1(); +call proc_1(); +delimiter |; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin flush status; return 1; end| +create function func_1() returns int begin call proc_1(); return 1; end| +delimiter ;| +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +select func_1(), func_1(), func_1() from dual; +drop function func_1; +drop procedure proc_1; +prepare abc from "flush status"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; + + +create procedure proc_1() flush slave; +call proc_1(); +call proc_1(); +call proc_1(); +delimiter |; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin flush slave; return 1; end| +create function func_1() returns int begin call proc_1(); return 1; end| +delimiter ;| +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +select func_1(), func_1(), func_1() from dual; +drop function func_1; +drop procedure proc_1; +prepare abc from "flush slave"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; + + +create procedure proc_1() flush master; +delimiter |; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin flush master; return 1; end| +create function func_1() returns int begin call proc_1(); return 1; end| +delimiter ;| +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +select func_1(), func_1(), func_1() from dual; +drop function func_1; +drop procedure proc_1; +prepare abc from "flush master"; +deallocate prepare abc; + + +create procedure proc_1() flush des_key_file; +call proc_1(); +call proc_1(); +call proc_1(); +delimiter |; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin flush des_key_file; return 1; end| +create function func_1() returns int begin call proc_1(); return 1; end| +delimiter ;| +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +select func_1(), func_1(), func_1() from dual; +drop function func_1; +drop procedure proc_1; +prepare abc from "flush des_key_file"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; + + +create procedure proc_1() flush user_resources; +call proc_1(); +call proc_1(); +call proc_1(); +delimiter |; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin flush user_resources; return 1; end| +create function func_1() returns int begin call proc_1(); return 1; end| +delimiter ;| +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +select func_1(), func_1(), func_1() from dual; +drop function func_1; +drop procedure proc_1; +prepare abc from "flush user_resources"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; + + +create procedure proc_1() start slave; +drop procedure proc_1; +delimiter |; +create function func_1() returns int begin start slave; return 1; end| +delimiter ;| +drop function func_1; +prepare abc from "start slave"; +deallocate prepare abc; + + +create procedure proc_1() stop slave; +drop procedure proc_1; +delimiter |; +create function func_1() returns int begin stop slave; return 1; end| +delimiter ;| +drop function func_1; +prepare abc from "stop slave"; +deallocate prepare abc; + + +create procedure proc_1() show binlog events; +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin show binlog events; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "show binlog events"; +deallocate prepare abc; + + +create procedure proc_1() show slave status; +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin show slave status; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "show slave status"; +deallocate prepare abc; + + +create procedure proc_1() show master status; +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin show master status; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "show master status"; +deallocate prepare abc; + + +create procedure proc_1() show master logs; +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin show master logs; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "show master logs"; +deallocate prepare abc; + + +create procedure proc_1() show events; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin show events; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "show events"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; + + +--disable_warnings +drop procedure if exists a; +--enable_warnings +create procedure a() select 42; +create procedure proc_1(a char(2)) show create procedure a; +call proc_1("bb"); +call proc_1("bb"); +call proc_1("bb"); +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin show create procedure a; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "show create procedure a"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +drop procedure a; + + +--disable_warnings +drop function if exists a; +--enable_warnings +create function a() returns int return 42+13; +create procedure proc_1(a char(2)) show create function a; +call proc_1("bb"); +call proc_1("bb"); +call proc_1("bb"); +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin show create function a; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "show create function a"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +drop function a; + + +--disable_warnings +drop table if exists tab1; +--enable_warnings +create table tab1(a int, b char(1), primary key(a,b)); +create procedure proc_1() show create table tab1; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin show create table tab1; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "show create table tab1"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +drop table tab1; + + +--disable_warnings +drop view if exists v1; +drop table if exists t1; +--enable_warnings +create table t1(a int, b char(5)); +insert into t1 values (1, "one"), (1, "edno"), (2, "two"), (2, "dve"); +create view v1 as + (select a, count(*) from t1 group by a) + union all + (select b, count(*) from t1 group by b); +create procedure proc_1() show create view v1; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin show create view v1; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "show create view v1"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +drop view v1; +drop table t1; + + +create procedure proc_1() install plugin my_plug soname 'some_plugin.so'; +--error ER_CANT_OPEN_LIBRARY,ER_FEATURE_DISABLED +call proc_1(); +--error ER_CANT_OPEN_LIBRARY,ER_FEATURE_DISABLED +call proc_1(); +--error ER_CANT_OPEN_LIBRARY,ER_FEATURE_DISABLED +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin install plugin my_plug soname '/tmp/plugin'; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "install plugin my_plug soname 'some_plugin.so'"; +deallocate prepare abc; + + +create procedure proc_1() uninstall plugin my_plug; +--error ER_SP_DOES_NOT_EXIST +call proc_1(); +--error ER_SP_DOES_NOT_EXIST +call proc_1(); +--error ER_SP_DOES_NOT_EXIST +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin uninstall plugin my_plug; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "uninstall plugin my_plug"; +--error ER_SP_DOES_NOT_EXIST +execute abc; +--error ER_SP_DOES_NOT_EXIST +execute abc; +--error ER_SP_DOES_NOT_EXIST +execute abc; +deallocate prepare abc; + + +--disable_warnings +drop database if exists mysqltest_xyz; +--enable_warnings +create procedure proc_1() create database mysqltest_xyz; +call proc_1(); +drop database if exists mysqltest_xyz; +call proc_1(); +--error ER_DB_CREATE_EXISTS +call proc_1(); +drop database if exists mysqltest_xyz; +call proc_1(); +drop database if exists mysqltest_xyz; +drop procedure proc_1; +delimiter |; +--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin create database mysqltest_xyz; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "create database mysqltest_xyz"; +execute abc; +drop database if exists mysqltest_xyz; +execute abc; +--error ER_DB_CREATE_EXISTS +execute abc; +drop database if exists mysqltest_xyz; +execute abc; +drop database if exists mysqltest_xyz; +deallocate prepare abc; + + +--disable_warnings +drop table if exists t1; +--enable_warnings +create table t1 (a int, b char(5)); +insert into t1 values (1, "one"), (2, "two"), (3, "three"); +create procedure proc_1() checksum table xyz; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin checksum table t1; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "checksum table t1"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; + + +create procedure proc_1() create user pstest_xyz@localhost; +call proc_1(); +drop user pstest_xyz@localhost; +call proc_1(); +--error ER_CANNOT_USER +call proc_1(); +drop user pstest_xyz@localhost; +call proc_1(); +drop user pstest_xyz@localhost; +drop procedure proc_1; +delimiter |; +--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin create user pstest_xyz@localhost; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "create user pstest_xyz@localhost"; +execute abc; +drop user pstest_xyz@localhost; +execute abc; +--error ER_CANNOT_USER +execute abc; +drop user pstest_xyz@localhost; +execute abc; +drop user pstest_xyz@localhost; +deallocate prepare abc; + + +--disable_warnings +drop event if exists xyz; +--enable_warnings +#create procedure proc_1() create event xyz on schedule every 5 minute disable do select 123; +#call proc_1(); +#drop event xyz; +#call proc_1(); +#--error ER_EVENT_ALREADY_EXISTS +#call proc_1(); +#drop event xyz; +#call proc_1(); +#drop event xyz; +#drop procedure proc_1; +delimiter |; +--error ER_EVENT_RECURSION_FORBIDDEN +create function func_1() returns int begin create event xyz on schedule at now() do select 123; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +--error ER_UNSUPPORTED_PS +prepare abc from "create event xyz on schedule at now() do select 123"; +--error ER_UNKNOWN_STMT_HANDLER +deallocate prepare abc; + + +--disable_warnings +drop event if exists xyz; +create event xyz on schedule every 5 minute disable do select 123; +--enable_warnings +create procedure proc_1() alter event xyz comment 'xyz'; +call proc_1(); +drop event xyz; +create event xyz on schedule every 5 minute disable do select 123; +call proc_1(); +drop event xyz; +create event xyz on schedule every 5 minute disable do select 123; +call proc_1(); +drop event xyz; +drop procedure proc_1; +delimiter |; +--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin alter event xyz comment 'xyz'; return 1; end| +delimiter ;| +--error ER_UNSUPPORTED_PS +prepare abc from "alter event xyz comment 'xyz'"; +--error ER_UNKNOWN_STMT_HANDLER +deallocate prepare abc; + + +--disable_warnings +drop event if exists xyz; +create event xyz on schedule every 5 minute disable do select 123; +--enable_warnings +create procedure proc_1() drop event xyz; +call proc_1(); +create event xyz on schedule every 5 minute disable do select 123; +call proc_1(); +--error ER_EVENT_DOES_NOT_EXIST +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin drop event xyz; return 1; end| +delimiter ;| +--error ER_UNSUPPORTED_PS +prepare abc from "drop event xyz"; +--error ER_UNKNOWN_STMT_HANDLER +deallocate prepare abc; + + +--disable_warnings +drop table if exists t1; +create table t1 (a int, b char(5)) engine=myisam; +insert into t1 values (1, "one"), (2, "two"), (3, "three"); +--enable_warnings +SET GLOBAL new_cache.key_buffer_size=128*1024; +create procedure proc_1() cache index t1 in new_cache; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +SET GLOBAL second_cache.key_buffer_size=128*1024; +prepare abc from "cache index t1 in second_cache"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +drop table t1; + +--disable_warnings +drop table if exists t1; +drop table if exists t2; +create table t1 (a int, b char(5)) engine=myisam; +insert into t1 values (1, "one"), (2, "two"), (3, "three"); +create table t2 (a int, b char(5)) engine=myisam; +insert into t2 values (1, "one"), (2, "two"), (3, "three"); +--enable_warnings +create procedure proc_1() load index into cache t1 ignore leaves; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin load index into cache t1 ignore leaves; return 1; end| +delimiter ;| +prepare abc from "load index into cache t2 ignore leaves"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +drop table t1, t2; + +# +# Bug #21422: GRANT/REVOKE possible inside stored function, probably in a trigger +# This is disabled for now till it is resolved in 5.0 +# + +#create procedure proc_1() grant all on *.* to abc@host; +#drop procedure proc_1; +#delimiter |; +#--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +#create function func_1() returns int begin grant all on *.* to abc@host; return 1; end| +#delimiter ;| +#prepare abc from "grant all on *.* to abc@host"; +# +#create procedure proc_1() revoke all on *.* from abc@host; +#drop procedure proc_1; +#delimiter |;#--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +#create function func_1() returns int begin revoke all on *.* from abc@host; return 1; end| +#delimiter ;| +#prepare abc from "revoke all on *.* from abc@host"; + +create procedure proc_1() show errors; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin show errors; return 1; end| +delimiter ;| +prepare abc from "show errors"; +deallocate prepare abc; + +--disable_warnings +drop table if exists t1; +drop table if exists t2; +--enable_warnings +create procedure proc_1() show warnings; +drop table if exists t1; +call proc_1(); +drop table if exists t2; +call proc_1(); +drop table if exists t1, t2; +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin show warnings; return 1; end| +delimiter ;| +prepare abc from "show warnings"; +drop table if exists t1; +execute abc; +drop table if exists t2; +execute abc; +drop table if exists t1, t2; +execute abc; +deallocate prepare abc; + +# +# Bug#22684: The Functions ENCODE, DECODE and FORMAT are not real functions +# + +set @my_password="password"; +set @my_data="clear text to encode"; + +prepare stmt1 from 'select decode(encode(?, ?), ?)'; +execute stmt1 using @my_data, @my_password, @my_password; +set @my_data="more text to encode"; +execute stmt1 using @my_data, @my_password, @my_password; +set @my_password="new password"; +execute stmt1 using @my_data, @my_password, @my_password; +deallocate prepare stmt1; + +set @to_format="123456789.123456789"; +set @dec=0; + +prepare stmt2 from 'select format(?, ?)'; +execute stmt2 using @to_format, @dec; +set @dec=4; +execute stmt2 using @to_format, @dec; +set @dec=6; +execute stmt2 using @to_format, @dec; +set @dec=2; +execute stmt2 using @to_format, @dec; +set @to_format="100"; +execute stmt2 using @to_format, @dec; +set @to_format="1000000"; +execute stmt2 using @to_format, @dec; +set @to_format="10000"; +execute stmt2 using @to_format, @dec; +deallocate prepare stmt2; + + +# +# BUG#18326: Do not lock table for writing during prepare of statement +# +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings + +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 (i INT); +INSERT INTO t2 VALUES (2); + +LOCK TABLE t1 READ, t2 WRITE; + +connect (conn1, localhost, root, , ); + +# Prepare never acquires the lock, and thus should not block. +PREPARE stmt1 FROM "SELECT i FROM t1"; +PREPARE stmt2 FROM "INSERT INTO t2 (i) VALUES (3)"; + +# This should not block because READ lock on t1 is shared. +EXECUTE stmt1; + +# This should block because WRITE lock on t2 is exclusive. +send EXECUTE stmt2; + +connection default; + +SELECT * FROM t2; +UNLOCK TABLES; +let $wait_condition= SELECT COUNT(*) = 2 FROM t2; +--source include/wait_condition.inc +SELECT * FROM t2; + +# DDL and DML works even if some client have a prepared statement +# referencing the table. +ALTER TABLE t1 ADD COLUMN j INT; +ALTER TABLE t2 ADD COLUMN j INT; +INSERT INTO t1 VALUES (4, 5); +INSERT INTO t2 VALUES (4, 5); + +connection conn1; + +reap; +EXECUTE stmt1; +EXECUTE stmt2; +SELECT * FROM t2; + +disconnect conn1; + +connection default; + +DROP TABLE t1, t2; + +# +# Bug #24879 Prepared Statements: CREATE TABLE (UTF8 KEY) produces a growing +# key length +# +# Test that parse information is not altered by subsequent executions of a +# prepared statement +# +drop table if exists t1; +prepare stmt +from "create table t1 (c char(100) character set utf8, key (c(10)))"; +execute stmt; +show create table t1; +drop table t1; +execute stmt; +show create table t1; +drop table t1; + +# +# Bug #32030 DELETE does not return an error and deletes rows if error +# evaluating WHERE +# +# Test that there is an error for prepared delete just like for the normal +# one. +# +--disable_warnings +drop table if exists t1, t2; +--enable_warnings +create table t1 (a int, b int); +create table t2 like t1; + +insert into t1 (a, b) values (1,1), (1,2), (1,3), (1,4), (1,5), + (2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6); + +insert into t2 select a, max(b) from t1 group by a; + +prepare stmt from "delete from t2 where (select (select max(b) from t1 group +by a having a < 2) x from t1) > 10000"; + +--error ER_SUBQUERY_NO_1_ROW +delete from t2 where (select (select max(b) from t1 group +by a having a < 2) x from t1) > 10000; +--error ER_SUBQUERY_NO_1_ROW +execute stmt; +--error ER_SUBQUERY_NO_1_ROW +execute stmt; + +deallocate prepare stmt; +drop table t1, t2; + +--echo # +--echo # Bug#27430 Crash in subquery code when in PS and table DDL changed +--echo # after PREPARE +--echo # +--echo # This part of the test doesn't work in embedded server, this is +--echo # why it's here. For the main test see ps_ddl*.test +--echo +--disable_warnings +drop table if exists t1; +--enable_warnings +create table t1 (a int); +prepare stmt from "show events where (1) in (select * from t1)"; +execute stmt; +drop table t1; +create table t1 (x int); +execute stmt; +drop table t1; +deallocate prepare stmt; + +--echo # +--echo # Bug#49141: Encode function is significantly slower in 5.1 compared to 5.0 +--echo # + +prepare encode from "select encode(?, ?) into @ciphertext"; +prepare decode from "select decode(?, ?) into @plaintext"; +set @str="abc", @key="cba"; +execute encode using @str, @key; +execute decode using @ciphertext, @key; +select @plaintext; +set @str="bcd", @key="dcb"; +execute encode using @str, @key; +execute decode using @ciphertext, @key; +select @plaintext; +deallocate prepare encode; +deallocate prepare decode; + +--echo # +--echo # Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings +--echo # +CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT); +INSERT INTO t1 VALUES (0, 0),(0, 0); +PREPARE stmt FROM "SELECT 1 FROM t1 WHERE +ROW(a, b) >= ROW('1', (SELECT 1 FROM t1 WHERE a > 1234))"; +--disable_warnings +EXECUTE stmt; +EXECUTE stmt; +--enable_warnings +DEALLOCATE PREPARE stmt; +DROP TABLE t1; + +########################################################################### + +--echo # +--echo # Bug#54494 crash with explain extended and prepared statements +--echo # +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES (1),(2); +SET @save_optimizer_switch=@@optimizer_switch; +SET optimizer_switch='outer_join_with_cache=off'; +PREPARE stmt FROM 'EXPLAIN EXTENDED SELECT 1 FROM t1 RIGHT JOIN t1 t2 ON 1'; +EXECUTE stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +SET optimizer_switch=@save_optimizer_switch; +DROP TABLE t1; + +--echo # +--echo # Bug#54488 crash when using explain and prepared statements with subqueries +--echo # +CREATE TABLE t1(f1 INT); +INSERT INTO t1 VALUES (1),(1); +PREPARE stmt FROM 'EXPLAIN SELECT 1 FROM t1 WHERE (SELECT (SELECT 1 FROM t1 GROUP BY f1))'; +EXECUTE stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP TABLE t1; + +--echo +--echo End of 5.1 tests. + +--echo # +--echo # lp:1001500 Crash on the second execution of the PS for +--echo # a query with degenerated conjunctive condition +--echo # (see also mysql bug#12582849) +--echo # + +CREATE TABLE t1 ( + pk INTEGER AUTO_INCREMENT, + col_int_nokey INTEGER, + col_int_key INTEGER, + + col_varchar_key VARCHAR(1), + col_varchar_nokey VARCHAR(1), + + PRIMARY KEY (pk), + KEY (col_int_key), + KEY (col_varchar_key, col_int_key) +); + +INSERT INTO t1 ( + col_int_key, col_int_nokey, + col_varchar_key, col_varchar_nokey +) VALUES +(4, 2, 'v', 'v'), +(62, 150, 'v', 'v'); + +CREATE TABLE t2 ( + pk INTEGER AUTO_INCREMENT, + col_int_nokey INTEGER, + col_int_key INTEGER, + + col_varchar_key VARCHAR(1), + col_varchar_nokey VARCHAR(1), + + PRIMARY KEY (pk), + KEY (col_int_key), + KEY (col_varchar_key, col_int_key) +); + +INSERT INTO t2 ( + col_int_key, col_int_nokey, + col_varchar_key, col_varchar_nokey +) VALUES +(8, NULL, 'x', 'x'), +(7, 8, 'd', 'd'); + +PREPARE stmt FROM ' +SELECT + ( SELECT MAX( SQ1_alias2 .col_int_nokey ) AS SQ1_field1 + FROM ( t2 AS SQ1_alias1 RIGHT JOIN t1 AS SQ1_alias2 + ON ( SQ1_alias2.col_varchar_key = SQ1_alias1.col_varchar_nokey ) + ) + WHERE SQ1_alias2.pk < alias1.col_int_nokey OR alias1.pk + ) AS field1 +FROM ( t1 AS alias1 JOIN t2 AS alias2 ON alias2.pk ) +GROUP BY field1 +'; + +EXECUTE stmt; +EXECUTE stmt; + +DEALLOCATE PREPARE stmt; + +DROP TABLE t1, t2; + +########################################################################### + +--echo +--echo # +--echo # WL#4435: Support OUT-parameters in prepared statements. +--echo # +--echo + +# The idea of this test case is to check that +# - OUT-parameters of four allowed types (string, double, int, decimal) work +# properly; +# - INOUT and OUT parameters work properly; +# - A mix of IN and OUT parameters work properly; + +--disable_warnings +DROP PROCEDURE IF EXISTS p_string; +DROP PROCEDURE IF EXISTS p_double; +DROP PROCEDURE IF EXISTS p_int; +DROP PROCEDURE IF EXISTS p_decimal; +--enable_warnings + +delimiter |; + +--echo +CREATE PROCEDURE p_string( + IN v0 INT, + OUT v1 CHAR(32), + IN v2 CHAR(32), + INOUT v3 CHAR(32)) +BEGIN + SET v0 = -1; + SET v1 = 'test_v1'; + SET v2 = 'n/a'; + SET v3 = 'test_v3'; +END| + +--echo +CREATE PROCEDURE p_double( + IN v0 INT, + OUT v1 DOUBLE(4, 2), + IN v2 DOUBLE(4, 2), + INOUT v3 DOUBLE(4, 2)) +BEGIN + SET v0 = -1; + SET v1 = 12.34; + SET v2 = 98.67; + SET v3 = 56.78; +END| + +--echo +CREATE PROCEDURE p_int( + IN v0 CHAR(10), + OUT v1 INT, + IN v2 INT, + INOUT v3 INT) +BEGIN + SET v0 = 'n/a'; + SET v1 = 1234; + SET v2 = 9876; + SET v3 = 5678; +END| + +--echo +CREATE PROCEDURE p_decimal( + IN v0 INT, + OUT v1 DECIMAL(4, 2), + IN v2 DECIMAL(4, 2), + INOUT v3 DECIMAL(4, 2)) +BEGIN + SET v0 = -1; + SET v1 = 12.34; + SET v2 = 98.67; + SET v3 = 56.78; +END| + +delimiter ;| + +--echo +PREPARE stmt_str FROM 'CALL p_string(?, ?, ?, ?)'; +PREPARE stmt_dbl FROM 'CALL p_double(?, ?, ?, ?)'; +PREPARE stmt_int FROM 'CALL p_int(?, ?, ?, ?)'; +PREPARE stmt_dec FROM 'CALL p_decimal(?, ?, ?, ?)'; + +--echo +SET @x_str_1 = NULL; +SET @x_str_2 = NULL; +SET @x_str_3 = NULL; +SET @x_dbl_1 = NULL; +SET @x_dbl_2 = NULL; +SET @x_dbl_3 = NULL; +SET @x_int_1 = NULL; +SET @x_int_2 = NULL; +SET @x_int_3 = NULL; +SET @x_dec_1 = NULL; +SET @x_dec_2 = NULL; +SET @x_dec_3 = NULL; + +--echo +--echo -- Testing strings... + +--echo +EXECUTE stmt_str USING @x_int_1, @x_str_1, @x_str_2, @x_str_3; +SELECT @x_int_1, @x_str_1, @x_str_2, @x_str_3; + +--echo +EXECUTE stmt_str USING @x_int_1, @x_str_1, @x_str_2, @x_str_3; +SELECT @x_int_1, @x_str_1, @x_str_2, @x_str_3; + +--echo +--echo -- Testing doubles... + +--echo +EXECUTE stmt_dbl USING @x_int_1, @x_dbl_1, @x_dbl_2, @x_dbl_3; +SELECT @x_int_1, @x_dbl_1, @x_dbl_2, @x_dbl_3; + +--echo +EXECUTE stmt_dbl USING @x_int_1, @x_dbl_1, @x_dbl_2, @x_dbl_3; +SELECT @x_int_1, @x_dbl_1, @x_dbl_2, @x_dbl_3; + +--echo +--echo -- Testing ints... + +--echo +EXECUTE stmt_int USING @x_str_1, @x_int_1, @x_int_2, @x_int_3; +SELECT @x_str_1, @x_int_1, @x_int_2, @x_int_3; + +--echo +EXECUTE stmt_int USING @x_str_1, @x_int_1, @x_int_2, @x_int_3; +SELECT @x_str_1, @x_int_1, @x_int_2, @x_int_3; + +--echo +--echo -- Testing decs... + +--echo +EXECUTE stmt_dec USING @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; +SELECT @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; + +--echo +EXECUTE stmt_dec USING @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; +SELECT @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; + +--echo +DEALLOCATE PREPARE stmt_str; +DEALLOCATE PREPARE stmt_dbl; +DEALLOCATE PREPARE stmt_int; +DEALLOCATE PREPARE stmt_dec; + +--echo +DROP PROCEDURE p_string; +DROP PROCEDURE p_double; +DROP PROCEDURE p_int; +DROP PROCEDURE p_decimal; + +# +# Another test case for WL#4435: check out parameters in Dynamic SQL. +# + +--echo +--disable_warnings +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS p2; +--enable_warnings + +--echo + +CREATE PROCEDURE p1(OUT v1 CHAR(10)) + SET v1 = 'test1'; + +--echo + +delimiter |; +CREATE PROCEDURE p2(OUT v2 CHAR(10)) +BEGIN + SET @query = 'CALL p1(?)'; + PREPARE stmt1 FROM @query; + EXECUTE stmt1 USING @u1; + DEALLOCATE PREPARE stmt1; + + SET v2 = @u1; +END| +delimiter ;| + +--echo + +CALL p2(@a); +SELECT @a; + +--echo + +DROP PROCEDURE p1; +DROP PROCEDURE p2; + +########################################################################### + +--source wl4435_generated.inc + +########################################################################### + +--echo +--echo # End of WL#4435. + +########################################################################### + + +--echo # +--echo # WL#4284: Transactional DDL locking +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +CREATE TABLE t1 (a INT); +BEGIN; +SELECT * FROM t1; +--echo # Test that preparing a CREATE TABLE does not take a exclusive metdata lock. +PREPARE stmt1 FROM "CREATE TABLE t1 AS SELECT 1"; +--error ER_TABLE_EXISTS_ERROR +EXECUTE stmt1; +DEALLOCATE PREPARE stmt1; +DROP TABLE t1; + +--echo # +--echo # WL#4284: Transactional DDL locking +--echo # +--echo # Test that metadata locks taken during prepare are released. +--echo # + +connect(con1,localhost,root,,); +connection default; +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +CREATE TABLE t1 (a INT); +connection con1; +BEGIN; +PREPARE stmt1 FROM "SELECT * FROM t1"; +connection default; +DROP TABLE t1; +disconnect con1; + +--echo +--echo # +--echo # Bug#56115: invalid memory reads when PS selecting from +--echo # information_schema tables +--echo # Bug#58701: crash in Field::make_field, cursor-protocol +--echo # +--echo # NOTE: MTR should be run both with --ps-protocol and --cursor-protocol. +--echo # +--echo + +SELECT * +FROM (SELECT 1 UNION SELECT 2) t; + +--echo +--echo # Bug#13805127: Stored program cache produces wrong result in same THD +--echo + +PREPARE s1 FROM +" +SELECT c1, t2.c2, count(c3) +FROM + ( + SELECT 3 as c2 FROM dual WHERE @x = 1 + UNION + SELECT 2 FROM dual WHERE @x = 1 OR @x = 2 + ) AS t1, + ( + SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual + UNION + SELECT '2012-03-01 02:00:00', 3, 2 FROM dual + UNION + SELECT '2012-03-01 01:00:00', 2, 1 FROM dual + ) AS t2 +WHERE t2.c2 = t1.c2 +GROUP BY c1, c2 +"; + +--echo +SET @x = 1; +SELECT c1, t2.c2, count(c3) +FROM + ( + SELECT 3 as c2 FROM dual WHERE @x = 1 + UNION + SELECT 2 FROM dual WHERE @x = 1 OR @x = 2 + ) AS t1, + ( + SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual + UNION + SELECT '2012-03-01 02:00:00', 3, 2 FROM dual + UNION + SELECT '2012-03-01 01:00:00', 2, 1 FROM dual + ) AS t2 +WHERE t2.c2 = t1.c2 +GROUP BY c1, c2; +--echo +EXECUTE s1; + +--echo +SET @x = 2; +SELECT c1, t2.c2, count(c3) +FROM + ( + SELECT 3 as c2 FROM dual WHERE @x = 1 + UNION + SELECT 2 FROM dual WHERE @x = 1 OR @x = 2 + ) AS t1, + ( + SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual + UNION + SELECT '2012-03-01 02:00:00', 3, 2 FROM dual + UNION + SELECT '2012-03-01 01:00:00', 2, 1 FROM dual + ) AS t2 +WHERE t2.c2 = t1.c2 +GROUP BY c1, c2; +--echo +EXECUTE s1; + +--echo +SET @x = 1; +SELECT c1, t2.c2, count(c3) +FROM + ( + SELECT 3 as c2 FROM dual WHERE @x = 1 + UNION + SELECT 2 FROM dual WHERE @x = 1 OR @x = 2 + ) AS t1, + ( + SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual + UNION + SELECT '2012-03-01 02:00:00', 3, 2 FROM dual + UNION + SELECT '2012-03-01 01:00:00', 2, 1 FROM dual + ) AS t2 +WHERE t2.c2 = t1.c2 +GROUP BY c1, c2; +--echo +EXECUTE s1; + +DEALLOCATE PREPARE s1; + +########################################################################### +# +# restoring of the Item tree in BETWEEN with dates +# +prepare stmt from "select date('2010-10-10') between '2010-09-09' and ?"; +set @a='2010-11-11'; +execute stmt using @a; +execute stmt using @a; +set @a='2010-08-08'; +execute stmt using @a; +execute stmt using @a; + +--echo # +--echo # Bug #892725: look-up is changed for a full scan when executing PS +--echo # + +create table t1 (a int primary key, b int); +insert into t1 values + (7,70), (3,40), (4,40), (8,70), (1,70), (9,50), (2,70); + +prepare st from 'select * from t1 where a=8'; + +flush status; +execute st; +show status like '%Handler_read%'; +flush status; +execute st; +show status like '%Handler_read%'; +flush status; +select * from t1 use index() where a=3; +show status like '%Handler_read%'; +flush status; +execute st; +show status like '%Handler_read%'; + +deallocate prepare st; +drop table t1; + +--echo # +--echo # Bug mdev-5410: crash at the execution of PS with subselect +--echo # formed by UNION with global ORDER BY +--echo # + +CREATE TABLE t1 (a int DEFAULT NULL); +INSERT INTO t1 VALUES (2), (4); +CREATE TABLE t2 (b int DEFAULT NULL); +INSERT INTO t2 VALUES (1), (3); + +PREPARE stmt FROM " +SELECT c1 FROM (SELECT (SELECT a FROM t1 WHERE t1.a <= t2.b + UNION ALL + SELECT a FROM t1 WHERE t1.a+3<= t2.b + ORDER BY a DESC) AS c1 FROM t2) t3; +"; + +EXECUTE stmt; +EXECUTE stmt; + +DROP TABLE t1,t2; + + +--echo # +--echo # MDEV-5369: Wrong result (0 instead of NULL) on 2nd execution of +--echo # PS with LEFT JOIN, TEMPTABLE view +--echo # + + +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (0),(8); + +CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=MyISAM; +CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; + +SELECT SUM(pk) FROM t1 LEFT JOIN v2 ON a = pk; + +PREPARE stmt FROM "SELECT SUM(pk) FROM t1 LEFT JOIN v2 ON a = pk"; +EXECUTE stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; + +DROP VIEW v2; +DROP TABLE t1, t2; + +--echo # End of 5.3 tests + +--echo # +--echo # MDEV-5505: Assertion `! is_set()' fails on PREPARE SELECT +--echo # with out of range in GROUP BY +--echo # +CREATE TABLE t1 (a INT); + +--error ER_DATA_OUT_OF_RANGE +PREPARE stmt FROM "SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1"; +--error ER_DATA_OUT_OF_RANGE +SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1; + +drop table t1; + +--echo # End of 5.3 tests + +--echo # +--echo # MDEV-8756: MariaDB 10.0.21 crashes during PREPARE +--echo # + +CREATE TABLE t1 ( id INT(10), value INT(10) ); +CREATE TABLE t2 ( id INT(10) ); +SET @save_sql_mode= @@sql_mode; +SET SESSION sql_mode = 'ONLY_FULL_GROUP_BY'; + +PREPARE stmt FROM 'UPDATE t1 t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id)'; +execute stmt; +insert into t1 values (1,10),(2,10),(3,10); +insert into t2 values (1),(2); +execute stmt; +select * from t1; +deallocate prepare stmt; +SET SESSION sql_mode = @save_sql_mode; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-8833: Crash of server on prepared statement with +--echo # conversion to semi-join +--echo # + +CREATE TABLE t1 (column1 INT); +INSERT INTO t1 VALUES (3),(9); + +CREATE TABLE t2 (column2 INT); +INSERT INTO t2 VALUES (1),(4); + +CREATE TABLE t3 (column3 INT); +INSERT INTO t3 VALUES (6),(8); + +CREATE TABLE t4 (column4 INT); +INSERT INTO t4 VALUES (2),(5); + +PREPARE stmt FROM "SELECT ( SELECT MAX( table1.column1 ) AS field1 +FROM t1 AS table1 +WHERE table3.column3 IN ( SELECT table2.column2 AS field2 FROM t2 AS table2 ) +) AS sq +FROM t3 AS table3, t4 AS table4"; +EXECUTE stmt; +EXECUTE stmt; +deallocate prepare stmt; +drop table t1,t2,t3,t4; + +--echo # +--echo # MDEV-11859: the plans for the first and the second executions +--echo # of PS are not the same +--echo # + +create table t1 (id int, c varchar(3), key idx(c))engine=myisam; +insert into t1 values (3,'bar'), (1,'xxx'), (2,'foo'), (5,'yyy'); + +prepare stmt1 from +"explain extended + select * from t1 where (1, 2) in ( select 3, 4 ) or c = 'foo'"; +execute stmt1; +execute stmt1; +deallocate prepare stmt1; + +prepare stmt1 from +"select * from t1 where (1, 2) in ( select 3, 4 ) or c = 'foo'"; +flush status; +execute stmt1; +show status like '%Handler_read%'; +flush status; +execute stmt1; +show status like '%Handler_read%'; +deallocate prepare stmt1; + +prepare stmt2 from +"explain extended + select * from t1 where (1, 2) in ( select 3, 4 )"; +execute stmt2; +execute stmt2; +deallocate prepare stmt2; + +drop table t1; + +--echo # +--echo # MDEV-9208: Function->Function->View = Mysqld segfault +--echo # (Server crashes in Dependency_marker::visit_field on 2nd +--echo # execution with merged subquery) +--echo # + +CREATE TABLE t1 (i1 INT); +insert into t1 values(1),(2); + +CREATE TABLE t2 (i2 INT); +insert into t2 values(1),(2); + +prepare stmt from " + select 1 from ( + select + if (i1<0, 0, 0) as f1, + (select f1) as f2 + from t1, t2 + ) sq +"; + +execute stmt; +execute stmt; + +drop table t1,t2; + +--echo # +--echo # MDEV-9619: Assertion `null_ref_table' failed in virtual +--echo # table_map Item_direct_view_ref::used_tables() const on 2nd +--echo # execution of PS +--echo # + +CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE=MyISAM; +CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES ('a'),('b'); + +CREATE TABLE t2 (f2 VARCHAR(10)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('c'),('d'); + +PREPARE stmt FROM "SELECT * FROM v1 WHERE f1 = SOME ( SELECT f2 FROM t2 )"; +EXECUTE stmt; +EXECUTE stmt; +insert into t1 values ('c'); +EXECUTE stmt; +EXECUTE stmt; + +deallocate prepare stmt; +drop view v1; +drop table t1,t2; + +CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE=MyISAM; +CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES ('a'),('b'); + +CREATE TABLE t2 (f2 VARCHAR(10)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('c'),('d'); + +PREPARE stmt FROM "SELECT * FROM v1 WHERE (f1,f1) = SOME ( SELECT f2,f2 FROM t2 )"; +EXECUTE stmt; +EXECUTE stmt; +insert into t1 values ('c'); +EXECUTE stmt; +EXECUTE stmt; + +deallocate prepare stmt; +drop view v1; +drop table t1,t2; + + + +CREATE TABLE t1 (column1 INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (3),(9); + +CREATE TABLE t2 (column2 INT) ENGINE=MyISAM; + +INSERT INTO t2 VALUES (1),(4); + +CREATE TABLE t3 (column3 INT) ENGINE=MyISAM; +INSERT INTO t3 VALUES (6),(8); + +CREATE TABLE t4 (column4 INT) ENGINE=MyISAM; +INSERT INTO t4 VALUES (2),(5); + +PREPARE stmt FROM " +SELECT ( + SELECT MAX( table1.column1 ) AS field1 + FROM t1 AS table1 + WHERE (111,table3.column3) IN ( SELECT 111,table2.column2 AS field2 FROM t2 AS table2 ) +) AS sq +FROM t3 AS table3, t4 AS table4 GROUP BY sq +"; + +EXECUTE stmt; +EXECUTE stmt; + +deallocate prepare stmt; +drop table t1,t2,t3,t4; + +create table t1 (a int, b int, c int); +create table t2 (x int, y int, z int); +create table t3 as select * from t1; +insert into t1 values (1,2,3),(4,5,6),(100,200,300),(400,500,600); +insert into t2 values (1,2,3),(7,8,9),(100,200,300),(400,500,600); +insert into t3 values (1,2,3),(11,12,13),(100,0,0),(400,500,600); + + +set @optimizer_switch_save=@@optimizer_switch; +set @join_cache_level_save=@@join_cache_level; +set optimizer_switch='materialization=off'; +set join_cache_level=0; +select * from t1 where (select a,b from t3 where t3.c=t1.c) in (select x,y from t2 where t1.c= t2.z); +prepare stmt from "select * from t1 where (select a,b from t3 where t3.c=t1.c) in (select x,y from t2 where t1.c= t2.z)"; +EXECUTE stmt; +EXECUTE stmt; + +create view v1 as select * from t1; +create view v2 as select * from t2; +create view v3 as select * from t3; +select * from v1 where (select a,b from v3 where v3.c=v1.c) in (select x,y from v2 where v1.c= v2.z); +prepare stmt from "select * from v1 where (select a,b from v3 where v3.c=v1.c) in (select x,y from v2 where v1.c= v2.z)"; +EXECUTE stmt; +EXECUTE stmt; +set optimizer_switch=@optimizer_switch_save; +set join_cache_level=@join_cache_level_save; + +deallocate prepare stmt; +drop view v1,v2,v3; +drop table t1,t2,t3; + +--echo # +--echo # MDEV-10657: incorrect result returned with binary protocol +--echo # (prepared statements) +--echo # + +create table t1 (code varchar(10) primary key); +INSERT INTO t1(code) VALUES ('LINE1'), ('LINE2'), ('LINE3'); +SELECT X.* +FROM + (SELECT CODE, RN + FROM + (SELECT A.CODE, @cnt := @cnt + 1 AS RN + FROM t1 A, (SELECT @cnt := 0) C) T + ) X; +drop table t1; +--echo # End of 5.5 tests + +--echo # +--echo # End of 10.0 tests +--echo # + +--echo # +--echo # MDEV-12060 Crash in EXECUTE IMMEDIATE with an expression returning a GRANT command +--echo # (the 10.1 part) +--echo # + +DELIMITER /; +CREATE PROCEDURE p2 () +BEGIN + SET STATEMENT join_cache_level=CAST(CONCAT(_utf8'6',_latin1'') AS INT) FOR PREPARE stmt FROM 'SELECT 1'; + EXECUTE stmt; + DEALLOCATE PREPARE stmt; +END; +/ +DELIMITER ;/ +CALL p2(); +DROP PROCEDURE p2; + + +DELIMITER /; +BEGIN NOT ATOMIC + SET STATEMENT join_cache_level=CAST(CONCAT(_utf8'6',_latin1'') AS INT) FOR PREPARE stmt FROM 'SELECT 1'; + EXECUTE stmt; + DEALLOCATE PREPARE stmt; +END; +/ +DELIMITER ;/ + + +DELIMITER /; +BEGIN NOT ATOMIC + SET STATEMENT join_cache_level=CAST(CONCAT(_utf8'6',_latin1'') AS INT) FOR PREPARE stmt FROM 'SELECT 1'; + DEALLOCATE PREPARE stmt; +END; +/ +DELIMITER ;/ + + +DELIMITER /; +BEGIN NOT ATOMIC + PREPARE stmt FROM 'SELECT 1'; + SET STATEMENT join_cache_level=CAST(CONCAT(_utf8'6',_latin1'') AS INT) FOR EXECUTE stmt; + DEALLOCATE PREPARE stmt; +END; +/ +DELIMITER ;/ + ++--echo # ++--echo # MDEV-14572: Assertion `! is_set()' failed in ++--echo # Diagnostics_area::set_eof_status upon EXPLAIN UPDATE in PS ++--echo # ++ ++CREATE TABLE t1 (a INT); ++CREATE TABLE t2 (b INT); ++ ++#EXPLAIN UPDATE t1, t2 SET a = 1; ++PREPARE stmt FROM 'EXPLAIN UPDATE t1, t2 SET a = 1'; ++EXECUTE stmt; ++EXECUTE stmt; ++deallocate prepare stmt; ++ ++# Cleanup ++DROP TABLE t1, t2; + +--echo # +--echo # End of 10.1 tests +--echo # + +--echo # +--echo # MDEV-10709 Expressions as parameters to Dynamic SQL +--echo # + +--echo # +--echo # Using a simple expressions as an EXECUTE parameter +--echo # + +PREPARE stmt FROM 'SELECT ? FROM DUAL'; +EXECUTE stmt USING 10; +DEALLOCATE PREPARE stmt; + +PREPARE stmt FROM 'SELECT ? FROM DUAL'; +EXECUTE stmt USING TO_BASE64('xxx'); +DEALLOCATE PREPARE stmt; + +PREPARE stmt FROM 'SELECT ?+? FROM DUAL'; +EXECUTE stmt USING 10, 10 + 10; +DEALLOCATE PREPARE stmt; + +PREPARE stmt FROM 'SELECT CONCAT(?,?) FROM DUAL'; +EXECUTE stmt USING 'xxx', CONCAT('yyy','zzz'); +DEALLOCATE PREPARE stmt; + +--echo # +--echo # Testing disallowed expressions in USING +--echo # + +PREPARE stmt FROM 'SELECT ? FROM DUAL'; +--error ER_PARSE_ERROR +EXECUTE stmt USING (SELECT 1); +DEALLOCATE PREPARE stmt; + +CREATE FUNCTION f1() RETURNS VARCHAR(10) RETURN 'test'; +PREPARE stmt FROM 'SELECT ? FROM DUAL'; +--error ER_SUBQUERIES_NOT_SUPPORTED +EXECUTE stmt USING f1(); +DEALLOCATE PREPARE stmt; +DROP FUNCTION f1; + +--echo # +--echo # Testing erroneous expressions in USING +--echo # + +PREPARE stmt FROM 'SELECT ?'; +--error ER_CANT_AGGREGATE_2COLLATIONS +EXECUTE stmt USING _latin1'a'=_latin2'a'; +DEALLOCATE PREPARE stmt; + +PREPARE stmt FROM 'SELECT ?'; +--error ER_OPERAND_COLUMNS +EXECUTE stmt USING ROW(1,2); +DEALLOCATE PREPARE stmt; + +--echo # +--echo # Creating tables from EXECUTE parameters +--echo # + +PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ? AS c1 FROM DUAL'; +EXECUTE stmt USING 10; +SHOW CREATE TABLE t1; +DROP TABLE t1; +EXECUTE stmt USING 10.123; +SHOW CREATE TABLE t1; +DROP TABLE t1; +EXECUTE stmt USING 10.123e0; +SHOW CREATE TABLE t1; +DROP TABLE t1; +EXECUTE stmt USING CURRENT_DATE; +SHOW CREATE TABLE t1; +DROP TABLE t1; +EXECUTE stmt USING CURRENT_TIMESTAMP; +SHOW CREATE TABLE t1; +DROP TABLE t1; +EXECUTE stmt USING CURRENT_TIMESTAMP(3); +SHOW CREATE TABLE t1; +DROP TABLE t1; +EXECUTE stmt USING CURRENT_TIMESTAMP(6); +SHOW CREATE TABLE t1; +DROP TABLE t1; +EXECUTE stmt USING CURRENT_TIME; +SHOW CREATE TABLE t1; +DROP TABLE t1; +EXECUTE stmt USING CURRENT_TIME(3); +SHOW CREATE TABLE t1; +DROP TABLE t1; +EXECUTE stmt USING CURRENT_TIME(6); +SHOW CREATE TABLE t1; +DROP TABLE t1; +DEALLOCATE PREPARE stmt; + + +--echo # +--echo # Using a user variable as an EXECUTE..USING out parameter +--echo # + +DELIMITER /; +CREATE PROCEDURE p1(OUT a INT) +BEGIN + SET a:= 10; +END; +/ +DELIMITER ;/ +SET @a=1; +CALL p1(@a); +SELECT @a; +SET @a=2; +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING @a; +SELECT @a; +DROP PROCEDURE p1; + + +--echo # +--echo # Using an SP variable as an EXECUTE..USING out parameter +--echo # + +DELIMITER /; +CREATE PROCEDURE p1 (OUT a INT) +BEGIN + SET a=10; +END; +/ +CREATE PROCEDURE p2 (OUT a INT) +BEGIN + PREPARE stmt FROM 'CALL p1(?)'; + EXECUTE stmt USING a; +END; +/ +DELIMITER ;/ +SET @a= 1; +CALL p2(@a); +SELECT @a; +DROP PROCEDURE p2; +DROP PROCEDURE p1; + + +--echo # +--echo # Testing re-prepare on a table metadata update between PREPARE and EXECUTE +--echo # + +CREATE TABLE t1 (a INT); +DELIMITER /; +CREATE PROCEDURE p1(a INT) +BEGIN + INSERT INTO t1 VALUES (a); +END; +/ +DELIMITER ;/ +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING 10; +SELECT * FROM t1; +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=NEW.a+1; +EXECUTE stmt USING 20; +SELECT * FROM t1; +DEALLOCATE PREPARE stmt; +DROP PROCEDURE p1; +DROP TABLE t1; + +--echo # +--echo # End of MDEV-10709 Expressions as parameters to Dynamic SQL +--echo # + +--echo # +--echo # MDEV-10585 EXECUTE IMMEDIATE statement +--echo # + +EXECUTE IMMEDIATE 'SELECT 1 AS a'; +SET @a=10; +EXECUTE IMMEDIATE 'SELECT ? AS a' USING @a; +EXECUTE IMMEDIATE 'SELECT ? AS a' USING 20; + + +--echo # +--echo # Erroneous queries +--echo # + +--error ER_PARSE_ERROR +EXECUTE IMMEDIATE 'xxx'; + +--error ER_WRONG_ARGUMENTS +EXECUTE IMMEDIATE 'SELECT 1' USING @a; + +--error ER_WRONG_ARGUMENTS +EXECUTE IMMEDIATE 'SELECT ?'; + +--error ER_UNSUPPORTED_PS +EXECUTE IMMEDIATE 'EXECUTE IMMEDIATE "SELECT 1"'; + +--error ER_UNSUPPORTED_PS +EXECUTE IMMEDIATE 'PREPARE stmt FROM "SELECT 1"'; + +--error ER_UNSUPPORTED_PS +EXECUTE IMMEDIATE 'EXECUTE stmt'; + +--error ER_UNSUPPORTED_PS +EXECUTE IMMEDIATE 'DEALLOCATE PREPARE stmt'; + +--error ER_CANT_AGGREGATE_2COLLATIONS +EXECUTE IMMEDIATE 'SELECT ?' USING _latin1'a'=_latin2'a'; + +--error ER_OPERAND_COLUMNS +EXECUTE IMMEDIATE 'SELECT ?' USING ROW(1,2); + +--echo # +--echo # Testing disallowed expressions in USING +--echo # + +--error ER_PARSE_ERROR +EXECUTE IMMEDIATE 'SELECT ? FROM DUAL' USING (SELECT 1); + +CREATE FUNCTION f1() RETURNS VARCHAR(10) RETURN 'test'; +--error ER_SUBQUERIES_NOT_SUPPORTED +EXECUTE IMMEDIATE 'SELECT ? FROM DUAL' USING f1(); +DROP FUNCTION f1; + +--echo # +--echo # DDL +--echo # + +EXECUTE IMMEDIATE 'CREATE TABLE t1 (a INT)'; +EXECUTE IMMEDIATE 'SHOW CREATE TABLE t1'; +EXECUTE IMMEDIATE 'DROP TABLE t1'; + +SET @stmt= 'CREATE TABLE t1 (a INT)'; +EXECUTE IMMEDIATE @stmt; +SET @stmt= 'SHOW CREATE TABLE t1'; +EXECUTE IMMEDIATE @stmt; +SET @stmt= 'DROP TABLE t1'; +EXECUTE IMMEDIATE @stmt; + + +--echo # +--echo # DDL with parameters +--echo # + +SET @a= 10, @b= 10.1, @c= 10e0, @d='str'; +EXECUTE IMMEDIATE + 'CREATE TABLE t1 AS SELECT ? AS a,? AS b,? AS c,? AS d' + USING @a,@b,@c,@d; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +EXECUTE IMMEDIATE + 'CREATE TABLE t1 AS SELECT ? AS a,? AS b,? AS c,? AS d' + USING 10, 10.1, 10e0, 'str'; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +EXECUTE IMMEDIATE + 'CREATE TABLE t1 AS SELECT ? AS t1,? AS t2, ? AS d1,? AS dt1, ? AS dt2' + USING TIME'10:20:30', + TIME'10:20:30.123', + DATE'2001-01-01', + TIMESTAMP'2001-01-01 10:20:30', + TIMESTAMP'2001-01-01 10:20:30.123'; +SHOW CREATE TABLE t1; +DROP TABLE t1; + + +--echo # +--echo # Using a user variable as an EXECUTE IMMEDIATE..USING out parameter +--echo # + +DELIMITER /; +CREATE PROCEDURE p1(OUT a INT) +BEGIN + SET a:= 10; +END; +/ +DELIMITER ;/ +SET @a=1; +CALL p1(@a); +SELECT @a; +SET @a=2; +EXECUTE IMMEDIATE 'CALL p1(?)' USING @a; +SELECT @a; +DROP PROCEDURE p1; + + +--echo # +--echo # Using an SP variable as an EXECUTE IMMEDIATE..USING out parameter +--echo # + +DELIMITER /; +CREATE PROCEDURE p1 (OUT a INT) +BEGIN + SET a=10; +END; +/ +CREATE PROCEDURE p2 (OUT a INT) +BEGIN + EXECUTE IMMEDIATE 'CALL p1(?)' USING a; +END; +/ +DELIMITER ;/ +SET @a= 1; +CALL p2(@a); +SELECT @a; +DROP PROCEDURE p2; +DROP PROCEDURE p1; + + +--echo # +--echo # Changing user variables +--echo # + +SET @a=10; +EXECUTE IMMEDIATE 'SET @a=@a+1'; +SELECT @a; + + +--echo # +--echo # SET STATEMENT +--echo # + +SET @@max_sort_length=1024; +EXECUTE IMMEDIATE 'SET STATEMENT max_sort_length=1025 FOR SELECT @@max_sort_length'; +SELECT @@max_sort_length; +SET @@max_sort_length=DEFAULT; + + +--echo # +--echo # Similar to prepared EXECUTE, IMMEDIATE is not allowed in stored functions +--echo # +DELIMITER $$; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +CREATE FUNCTION f1() RETURNS INT +BEGIN + EXECUTE IMMEDIATE 'DO 1'; + RETURN 1; +END; +$$ +DELIMITER ;$$ + + +--echo # +--echo # Status variables +--echo # +CREATE FUNCTION get_status_var(name TEXT) RETURNS INT + RETURN (SELECT CAST(VARIABLE_VALUE AS INT) + FROM INFORMATION_SCHEMA.SESSION_STATUS + WHERE VARIABLE_NAME=name); +DELIMITER $$; +CREATE PROCEDURE test_status_var(name TEXT) +BEGIN + SET @cnt0=get_status_var(name); + EXECUTE IMMEDIATE 'DO 1'; + SET @cnt1=get_status_var(name); + SELECT @cnt1-@cnt0 AS increment; +END; +$$ +DELIMITER ;$$ +--echo # Note, EXECUTE IMMEDIATE does not increment COM_EXECUTE_SQL +--echo # It increments COM_EXECUTE_IMMEDIATE instead. +CALL test_status_var('COM_EXECUTE_SQL'); +CALL test_status_var('COM_EXECUTE_IMMEDIATE'); +CALL test_status_var('COM_STMT_PREPARE'); +CALL test_status_var('COM_STMT_EXECUTE'); +CALL test_status_var('COM_STMT_CLOSE'); + +DROP PROCEDURE test_status_var; +DROP FUNCTION get_status_var; + +--echo # +--echo # End of MDEV-10585 EXECUTE IMMEDIATE statement +--echo # + +--echo # +--echo # MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions +--echo # + +--echo # +--echo # Testing erroneous and diallowed prepare source +--echo # + +--error ER_CANT_AGGREGATE_2COLLATIONS +EXECUTE IMMEDIATE CONCAT(_latin1'SELECT 1 AS c FROM ', _latin2 'DUAL'); +--error ER_CANT_AGGREGATE_2COLLATIONS +PREPARE stmt FROM CONCAT(_latin1'SELECT 1 AS c FROM ', _latin2 'DUAL'); + +--error ER_PARSE_ERROR +EXECUTE IMMEDIATE (SELECT 'SELECT 1'); +--error ER_PARSE_ERROR +PREPARE stmt FROM (SELECT 'SELECT 1'); + +--error ER_BAD_FIELD_ERROR +EXECUTE IMMEDIATE a; +--error ER_BAD_FIELD_ERROR +PREPARE stmt FROM a; + +--error ER_PARSE_ERROR +EXECUTE IMMEDIATE NULL; +--error ER_PARSE_ERROR +PREPARE stmt FROM NULL; + +--error ER_PARSE_ERROR +EXECUTE IMMEDIATE CONCAT(NULL); +--error ER_PARSE_ERROR +PREPARE stmt FROM CONCAT(NULL); + +--error ER_PARSE_ERROR +EXECUTE IMMEDIATE ? USING 'SELECT 1'; + +--error ER_PARSE_ERROR +EXECUTE IMMEDIATE 10; + +--error ER_PARSE_ERROR +EXECUTE IMMEDIATE TIME'10:20:30'; + +--error ER_OPERAND_COLUMNS +EXECUTE IMMEDIATE ROW('SELECT 1','SELECT 2'); + +--error ER_INVALID_GROUP_FUNC_USE +EXECUTE IMMEDIATE MAX('SELECT 1 AS c'); + +--error ER_BAD_FIELD_ERROR +EXECUTE IMMEDIATE DEFAULT(a); + +--error ER_BAD_FIELD_ERROR +EXECUTE IMMEDIATE VALUE(a); + + +CREATE FUNCTION f1() RETURNS VARCHAR(64) RETURN 't1'; +--error ER_SUBQUERIES_NOT_SUPPORTED +EXECUTE IMMEDIATE f1(); +--error ER_SUBQUERIES_NOT_SUPPORTED +PREPARE stmt FROM f1(); +DROP FUNCTION f1; + +--error ER_SUBQUERIES_NOT_SUPPORTED +EXECUTE IMMEDIATE non_existent(); + + +--echo # +--echo # Testing literals in prepare source +--echo # +EXECUTE IMMEDIATE N'SELECT 1 AS c'; +EXECUTE IMMEDIATE _latin1'SELECT 1 AS c'; +EXECUTE IMMEDIATE 'SELECT ' '1' ' AS c' ' FROM ' 'DUAL'; +EXECUTE IMMEDIATE 0x53454C4543542031 /*This is 'SELECT 1'*/; + +--echo # +--echo # Testing user variables in prepare source +--echo # + +SET @stmt='SELECT 1 AS c FROM DUAL'; +EXECUTE IMMEDIATE @stmt; +PREPARE stmt FROM @stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; + +SET @table_name='DUAL'; +EXECUTE IMMEDIATE CONCAT('SELECT 1 AS a FROM ', @table_name); +PREPARE stmt FROM CONCAT('SELECT 1 AS a FROM ', @table_name); +EXECUTE stmt; +DEALLOCATE PREPARE stmt; + +--echo # +--echo # Testing SP parameters and variables in prepare source +--echo # + +DELIMITER $$; +CREATE PROCEDURE p1(table_name VARCHAR(64)) +BEGIN + EXECUTE IMMEDIATE CONCAT('SELECT 1 AS c FROM ', table_name); +END; +$$ +DELIMITER ;$$ +CALL p1('DUAL'); +DROP PROCEDURE p1; + +DELIMITER $$; +CREATE PROCEDURE p1() +BEGIN + DECLARE table_name VARCHAR(64) DEFAULT 'DUAL'; + EXECUTE IMMEDIATE CONCAT('SELECT 1 AS c FROM ', table_name); +END; +$$ +DELIMITER ;$$ +CALL p1(); +DROP PROCEDURE p1; + + +--echo # +--echo # Testing complex expressions +--echo # +EXECUTE IMMEDIATE CONVERT('SELECT 1 AS c' USING utf8); +EXECUTE IMMEDIATE CAST('SELECT 1 AS c' AS CHAR); +EXECUTE IMMEDIATE _latin1'SELECT 1 AS c' COLLATE latin1_bin; +EXECUTE IMMEDIATE (((('SELECT 1 AS c')))); +EXECUTE IMMEDIATE CASE WHEN 1>2 THEN 'SELECT 1 AS c' ELSE 'SELECT 2 AS c' END; +EXECUTE IMMEDIATE TRIM('SELECT 1 AS c'); +EXECUTE IMMEDIATE SUBSTRING('SELECT 1 AS c' FROM 1); +EXECUTE IMMEDIATE COALESCE(NULL, 'SELECT 1 AS c'); + +--echo # +--echo # Testing SET STATEMENT and system variables +--echo # +CREATE TABLE t1 (a INT); +SET STATEMENT max_sort_length=1025 FOR EXECUTE IMMEDIATE CONCAT('INSERT INTO t1 VALUES (', @@max_sort_length, ')'); +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # End of MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions +--echo # + + + +--echo # +--echo # MDEV-11360 Dynamic SQL: DEFAULT as a bind parameter +--echo # + +# Correct usage +CREATE TABLE t1 (a INT DEFAULT 10, b INT DEFAULT NULL); +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?,?)' USING DEFAULT, DEFAULT; +SELECT * FROM t1; +UPDATE t1 SET a=20, b=30; +SELECT * FROM t1; +EXECUTE IMMEDIATE 'UPDATE t1 SET a=?,b=?' USING DEFAULT, DEFAULT; +SELECT * FROM t1; +DROP TABLE t1; + +# Incorrect usage in a expression in INSERT..VALUES +CREATE TABLE t1 (a INT DEFAULT 10); +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?+1)' USING DEFAULT; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (CONCAT(?,?))' USING DEFAULT, 'test'; +DROP TABLE t1; + +# Incorrect usage in UPDATE..SET +CREATE TABLE t1 (a INT DEFAULT 10); +INSERT INTO t1 VALUES (20); +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'UPDATE t1 SET a=?+1' USING DEFAULT; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'UPDATE t1 SET a=CONCAT(?,?)' USING DEFAULT, 'test'; +DROP TABLE t1; + +# Incorrect usage in not an UPDATE/INSERT query at all +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT CAST(? AS SIGNED)' USING DEFAULT; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT CAST(? AS DOUBLE)' USING DEFAULT; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT CAST(? AS CHAR)' USING DEFAULT; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT CAST(? AS DECIMAL(10,1))' USING DEFAULT; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT CAST(? AS TIME)' USING DEFAULT; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT CAST(? AS DATE)' USING DEFAULT; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT CAST(? AS DATETIME)' USING DEFAULT; + +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT ?+1' USING DEFAULT; +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT CONCAT(?,?)' USING DEFAULT,'test'; + +# Incorrect usage in the LIMIT clause +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT 1 LIMIT ?' USING DEFAULT; +CREATE TABLE t1 (a INT DEFAULT 10); +INSERT INTO t1 VALUES (1),(2),(3); +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'SELECT * FROM t1 LIMIT ?' USING DEFAULT; +DROP TABLE t1; + +--echo # The output of this query in 'Note' is a syntactically incorrect query. +--echo # But as it's never logged, it's ok. It should be human readable only. +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT ?' USING DEFAULT; + +# This tests Item_param::eq() for DEFAULT as a bound value +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +--error ER_INVALID_DEFAULT_PARAM +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>?+a' USING DEFAULT,DEFAULT; +DROP TABLE t1; + +--echo # +--echo # MDEV-11780 Crash with PREPARE + SP out parameter + literal +--echo # + +DELIMITER $$; +CREATE OR REPLACE PROCEDURE p1(OUT a INT) +BEGIN + SET a=10; +END; +$$ +DELIMITER ;$$ + +PREPARE stmt FROM 'CALL p1(?)'; +--error ER_SP_NOT_VAR_ARG +EXECUTE stmt USING 10; +--error ER_SP_NOT_VAR_ARG +EXECUTE stmt USING DEFAULT; +--error ER_SP_NOT_VAR_ARG +EXECUTE stmt USING IGNORE; +DEALLOCATE PREPARE stmt; + +--error ER_SP_NOT_VAR_ARG +EXECUTE IMMEDIATE 'CALL p1(?)' USING 10; +--error ER_SP_NOT_VAR_ARG +EXECUTE IMMEDIATE 'CALL p1(?)' USING DEFAULT; +--error ER_SP_NOT_VAR_ARG +EXECUTE IMMEDIATE 'CALL p1(?)' USING IGNORE; +DROP PROCEDURE p1; + + +--echo # +--echo # MDEV-14434 Wrong result for CHARSET(CONCAT(?,const)) +--echo # + +SET NAMES utf8; +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(5,_latin1'a'))"; +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5; +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5.5; +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5.5e0; +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING TIME'10:20:30'; +EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING TIMESTAMP'2001-01-01 10:20:30'; + +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5; +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5; +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5e0; +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIME'10:20:30'; +EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIMESTAMP'2001-01-01 10:20:30'; + +--echo # +--echo # MDEV-14435 Different UNSIGNED flag of out user variable for YEAR parameter for direct vs prepared CALL +--echo # + +CREATE PROCEDURE p1(OUT v INT UNSIGNED) SET v = 2010; +CALL p1(@a); +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING @b; +DEALLOCATE PREPARE stmt; +CREATE TABLE t1 AS SELECT @a AS a, @b AS b; +SHOW CREATE TABLE t1; +DROP TABLE t1; +DROP PROCEDURE p1; + +CREATE PROCEDURE p1(OUT v YEAR) SET v = 2010; +CALL p1(@a); +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING @b; +DEALLOCATE PREPARE stmt; +CREATE TABLE t1 AS SELECT @a AS a, @b AS b; +SHOW CREATE TABLE t1; +DROP TABLE t1; +DROP PROCEDURE p1; + +CREATE PROCEDURE p1(OUT v BIT(16)) SET v = 2010; +CALL p1(@a); +PREPARE stmt FROM 'CALL p1(?)'; +EXECUTE stmt USING @b; +DEALLOCATE PREPARE stmt; +CREATE TABLE t1 AS SELECT @a AS a, @b AS b; +SHOW CREATE TABLE t1; +DROP TABLE t1; +DROP PROCEDURE p1; + +--echo # +--echo # MDEV-14426 Assertion in Diagnostics_area::set_error_status when using a bad datetime with PS and SP +--echo # + +DELIMITER $$; +CREATE PROCEDURE p1(OUT a VARCHAR(20)) +BEGIN + SET a=10; +END; +$$ +--error ER_TRUNCATED_WRONG_VALUE +BEGIN NOT ATOMIC + DECLARE a DATETIME; + CALL p1(a); +END; +$$ +--error ER_TRUNCATED_WRONG_VALUE +BEGIN NOT ATOMIC + DECLARE a DATETIME; + EXECUTE IMMEDIATE 'CALL p1(?)' USING a; +END; +$$ +--error ER_TRUNCATED_WRONG_VALUE +BEGIN NOT ATOMIC + DECLARE a DATETIME; + PREPARE stmt FROM 'CALL p1(?)'; + EXECUTE stmt USING a; + DEALLOCATE PREPARE stmt; +END; +$$ +DELIMITER ;$$ +DROP PROCEDURE p1; + +--echo # +--echo # MDEV-14454 Binary protocol returns wrong collation ID for SP OUT parameters +--echo # + +CREATE PROCEDURE p1(OUT v CHAR(32) CHARACTER SET utf8) SET v='aaa'; +PREPARE stmt1 FROM 'CALL p1(?)'; +EXECUTE stmt1 USING @a; +CREATE TABLE t1 AS SELECT @a AS c1; +SHOW CREATE TABLE t1; +DROP TABLE t1; +DROP PROCEDURE p1; + +--echo # +--echo # MDEV-14467 Item_param: replace {INT|DECIMAL|REAL|STRING|TIME}_VALUE with Type_handler +--echo # + +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10; +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10.1; +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10.1e0; +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING '10'; +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING TIME'10:10:10'; + +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 1 AS a,? AS b' USING 1; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 10 AS a,? AS b' USING 10; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 999999999 AS a,? AS b' USING 999999999; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 2147483647 AS a,? AS b' USING 2147483647; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +--echo # +--echo # MDEV-14603 signal 11 with short stacktrace +--echo # + +SET NAMES utf8; +CREATE TABLE t1(i INT); +CREATE PROCEDURE p1(tn VARCHAR(32)) + EXECUTE IMMEDIATE CONCAT('ANALYZE TABLE ',tn); +CALL p1('t1'); +DROP PROCEDURE p1; +DROP TABLE t1; + +SET NAMES utf8; +CREATE PROCEDURE p1() + EXECUTE IMMEDIATE CONCAT('SELECT ',CONVERT(RAND() USING latin1)); +--disable_result_log +CALL p1(); +--enable_result_log +DROP PROCEDURE p1; + +SET NAMES utf8; +DELIMITER $$; +CREATE PROCEDURE p1() +BEGIN + PREPARE stmt FROM CONCAT('SELECT ',CONVERT(RAND() USING latin1)); + EXECUTE stmt; + DEALLOCATE PREPARE stmt; +END; +$$ +DELIMITER ;$$ +--disable_result_log +CALL p1(); +--enable_result_log +DROP PROCEDURE p1; + +SET NAMES utf8; +CREATE PROCEDURE p1(a VARCHAR(10) CHARACTER SET utf8) + EXECUTE IMMEDIATE 'SELECT ?' USING CONCAT(a, CONVERT(RAND() USING latin1)); +--disable_result_log +CALL p1('x'); +--enable_result_log +DROP PROCEDURE p1; + +SET NAMES utf8; +DELIMITER $$; +CREATE PROCEDURE p1(a VARCHAR(10) CHARACTER SET utf8) +BEGIN + PREPARE stmt FROM 'SELECT ?'; + EXECUTE stmt USING CONCAT(a, CONVERT(RAND() USING latin1)); + DEALLOCATE PREPARE stmt; +END; +$$ +DELIMITER ;$$ +--disable_result_log +CALL p1('x'); +DROP PROCEDURE p1; + +# +# MDEV-15746 ASAN heap-use-after-free in Item_change_list::rollback_item_tree_changes on ALTER executed as PS +# +create table t1 (b blob default ''); +prepare stmt from "alter table t1 force"; +execute stmt; +execute stmt; +execute stmt; +set names latin1; +prepare stmt from "alter table t1 modify b text character set utf8 default 'a'"; +execute stmt; +execute stmt; +execute stmt; +drop table t1; + + +--echo # +--echo # MDEV-12060 Crash in EXECUTE IMMEDIATE with an expression returning a GRANT command +--echo # + +CREATE ROLE testrole; +DELIMITER /; +CREATE OR REPLACE PROCEDURE p1() +BEGIN +END; +/ +DELIMITER ;/ + +DELIMITER /; +CREATE PROCEDURE p2 (wgrp VARCHAR(10)) +BEGIN + EXECUTE IMMEDIATE concat('GRANT EXECUTE ON PROCEDURE p1 TO ',wgrp); +END; +/ +DELIMITER ;/ +CALL p2('testrole'); +DROP PROCEDURE p2; + +DELIMITER /; +CREATE PROCEDURE p2 () +BEGIN + EXECUTE IMMEDIATE concat(_utf8'GRANT EXECUTE ON PROCEDURE p1 TO ',_latin1'testrole'); +END; +/ +DELIMITER ;/ +CALL p2(); +DROP PROCEDURE p2; + +DELIMITER /; +CREATE PROCEDURE p2 () +BEGIN + PREPARE stmt FROM concat(_utf8'GRANT EXECUTE ON PROCEDURE p1 TO ',_latin1' testrole'); + EXECUTE stmt; + DEALLOCATE PREPARE stmt; +END; +/ +DELIMITER ;/ +CALL p2(); +DROP PROCEDURE p2; + +DROP PROCEDURE p1; +DROP ROLE testrole; + +--echo # +--echo # MDEV-16992: prepare of CREATE TABLE, CREATE VIEW, DO, SET, CALL +--echo # statements with CTE containing materialized derived +--echo # (the bug is reproducible on 10.4) +--echo # + +--enable_result_log + +prepare stmt from +"CREATE TABLE t1 AS + WITH cte(a) AS (SELECT * FROM (SELECT 1) AS t) SELECT * FROM cte;"; +execute stmt; +select * from t1; + +prepare stmt from +"CREATE VIEW v1 AS + WITH cte(a) AS (SELECT * FROM (SELECT 1) AS t) SELECT * FROM cte;"; +execute stmt; +select * from v1; + +prepare stmt from +"DO (SELECT 1 + FROM (WITH cte AS (SELECT * FROM (SELECT 1) AS t) + SELECT * FROM cte) AS tt);"; +execute stmt; + +prepare stmt from +"SET @a = (SELECT 1 + FROM (WITH cte AS (SELECT * FROM (SELECT 1) AS t) + SELECT * FROM cte) AS t);"; +execute stmt; + +create procedure p (i int) insert into t1 values(i); + +prepare stmt from +"CALL p + ((SELECT 1 + FROM (WITH cte AS (SELECT * FROM (SELECT 1) AS t) + SELECT * FROM cte) AS tt));"; +execute stmt; +select * from t1; + +drop procedure p; +drop view v1; +drop table t1; + +--echo # +--echo # End of 10.2 tests +--echo # diff --cc mysql-test/main/show_check.result index 6a7afb80fae,00000000000..1b9c1950668 mode 100644,000000..100644 --- a/mysql-test/main/show_check.result +++ b/mysql-test/main/show_check.result @@@ -1,1577 -1,0 +1,1581 @@@ +drop table if exists t1,t2; +drop table if exists t1aa,t2aa; +drop database if exists mysqltest; +drop database if exists mysqltest1; +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); +-- Here we enable metadata just to check that the collation of the +-- resultset is non-binary for string type. This should be changed +-- after Bug#29394 is implemented. +check table t1 fast; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 128 7 Y 0 39 8 +def Op 253 10 5 Y 0 39 8 +def Msg_type 253 10 6 Y 0 39 8 +def Msg_text 250 393216 27 Y 0 39 8 +Table Op Msg_type Msg_text +test.t1 check status Table is already up to date +check table t1 fast; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 128 7 Y 0 39 8 +def Op 253 10 5 Y 0 39 8 +def Msg_type 253 10 6 Y 0 39 8 +def Msg_text 250 393216 27 Y 0 39 8 +Table Op Msg_type Msg_text +test.t1 check status Table is already up to date +check table t1 changed; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 128 7 Y 0 39 8 +def Op 253 10 5 Y 0 39 8 +def Msg_type 253 10 6 Y 0 39 8 +def Msg_text 250 393216 2 Y 0 39 8 +Table Op Msg_type Msg_text +test.t1 check status OK +insert into t1 values (5,5,5); +check table t1 changed; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 128 7 Y 0 39 8 +def Op 253 10 5 Y 0 39 8 +def Msg_type 253 10 6 Y 0 39 8 +def Msg_text 250 393216 2 Y 0 39 8 +Table Op Msg_type Msg_text +test.t1 check status OK +check table t1 medium; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 128 7 Y 0 39 8 +def Op 253 10 5 Y 0 39 8 +def Msg_type 253 10 6 Y 0 39 8 +def Msg_text 250 393216 2 Y 0 39 8 +Table Op Msg_type Msg_text +test.t1 check status OK +check table t1 extended; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 128 7 Y 0 39 8 +def Op 253 10 5 Y 0 39 8 +def Msg_type 253 10 6 Y 0 39 8 +def Msg_text 250 393216 2 Y 0 39 8 +Table Op Msg_type Msg_text +test.t1 check status OK +show index from t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def information_schema STATISTICS STATISTICS TABLE_NAME Table 253 64 2 N 1 0 8 +def information_schema STATISTICS STATISTICS NON_UNIQUE Non_unique 8 1 1 N 32769 0 63 +def information_schema STATISTICS STATISTICS INDEX_NAME Key_name 253 64 7 N 1 0 8 +def information_schema STATISTICS STATISTICS SEQ_IN_INDEX Seq_in_index 8 2 1 N 32769 0 63 +def information_schema STATISTICS STATISTICS COLUMN_NAME Column_name 253 64 1 N 1 0 8 +def information_schema STATISTICS STATISTICS COLLATION Collation 253 1 1 Y 0 0 8 +def information_schema STATISTICS STATISTICS CARDINALITY Cardinality 8 21 1 Y 32768 0 63 +def information_schema STATISTICS STATISTICS SUB_PART Sub_part 8 3 0 Y 32768 0 63 +def information_schema STATISTICS STATISTICS PACKED Packed 253 10 0 Y 0 0 8 +def information_schema STATISTICS STATISTICS NULLABLE Null 253 3 0 N 1 0 8 +def information_schema STATISTICS STATISTICS INDEX_TYPE Index_type 253 16 5 N 1 0 8 +def information_schema STATISTICS STATISTICS COMMENT Comment 253 16 0 Y 0 0 8 +def information_schema STATISTICS STATISTICS INDEX_COMMENT Index_comment 253 1024 0 N 1 0 8 +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +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); +ERROR 23000: Duplicate entry '5' for key 'PRIMARY' +-- Here we enable metadata just to check that the collation of the +-- resultset is non-binary for string type. This should be changed +-- after Bug#29394 is implemented. +optimize table t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 128 7 Y 0 39 8 +def Op 253 10 8 Y 0 39 8 +def Msg_type 253 10 6 Y 0 39 8 +def Msg_text 250 393216 2 Y 0 39 8 +Table Op Msg_type Msg_text +test.t1 optimize status OK +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status Table is already up to date +drop table t1; +-- Here we enable metadata just to check that the collation of the +-- resultset is non-binary for string type. This should be changed +-- after Bug#29394 is implemented. +show variables like "wait_timeout%"; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 2048 5 N 1 0 8 +Variable_name Value +wait_timeout 28800 +show variables like "WAIT_timeout%"; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 2048 5 N 1 0 8 +Variable_name Value +wait_timeout 28800 +show variables like "this_doesn't_exists%"; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 253 64 0 N 1 0 8 +def information_schema SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 253 2048 0 N 1 0 8 +Variable_name Value +show table status from test like "this_doesn't_exists%"; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def information_schema TABLES TABLES TABLE_NAME Name 253 64 0 N 1 0 8 +def information_schema TABLES TABLES ENGINE Engine 253 64 0 Y 0 0 8 +def information_schema TABLES TABLES VERSION Version 8 21 0 Y 32800 0 63 +def information_schema TABLES TABLES ROW_FORMAT Row_format 253 10 0 Y 0 0 8 +def information_schema TABLES TABLES TABLE_ROWS Rows 8 21 0 Y 32800 0 63 +def information_schema TABLES TABLES AVG_ROW_LENGTH Avg_row_length 8 21 0 Y 32800 0 63 +def information_schema TABLES TABLES DATA_LENGTH Data_length 8 21 0 Y 32800 0 63 +def information_schema TABLES TABLES MAX_DATA_LENGTH Max_data_length 8 21 0 Y 32800 0 63 +def information_schema TABLES TABLES INDEX_LENGTH Index_length 8 21 0 Y 32800 0 63 +def information_schema TABLES TABLES DATA_FREE Data_free 8 21 0 Y 32800 0 63 +def information_schema TABLES TABLES AUTO_INCREMENT Auto_increment 8 21 0 Y 32800 0 63 +def information_schema TABLES TABLES CREATE_TIME Create_time 12 19 0 Y 128 0 63 +def information_schema TABLES TABLES UPDATE_TIME Update_time 12 19 0 Y 128 0 63 +def information_schema TABLES TABLES CHECK_TIME Check_time 12 19 0 Y 128 0 63 +def information_schema TABLES TABLES TABLE_COLLATION Collation 253 32 0 Y 0 0 8 +def information_schema TABLES TABLES CHECKSUM Checksum 8 21 0 Y 32800 0 63 +def information_schema TABLES TABLES CREATE_OPTIONS Create_options 253 2048 0 Y 0 0 8 +def information_schema TABLES TABLES TABLE_COMMENT Comment 253 2048 0 N 1 0 8 +def information_schema TABLES TABLES MAX_INDEX_LENGTH Max_index_length 8 21 0 Y 32800 0 63 +def information_schema TABLES TABLES TEMPORARY Temporary 253 1 0 Y 0 0 8 +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 Max_index_length Temporary +show databases; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def information_schema SCHEMATA SCHEMATA SCHEMA_NAME Database 253 64 18 N 1 0 8 +Database +information_schema +mtr +mysql +performance_schema +test +show databases like "test%"; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def information_schema SCHEMATA SCHEMATA SCHEMA_NAME Database (test%) 253 64 4 N 1 0 8 +Database (test%) +test +create table t1 (f1 int not null, f2 int not null, f3 int not null, f4 int not null, primary key(f1,f2,f3,f4)); +insert into t1 values (1,1,1,0),(1,1,2,0),(1,1,3,0),(1,2,1,0),(1,2,2,0),(1,2,3,0),(1,3,1,0),(1,3,2,0),(1,3,3,0),(1,1,1,1),(1,1,2,1),(1,1,3,1),(1,2,1,1),(1,2,2,1),(1,2,3,1),(1,3,1,1),(1,3,2,1),(1,3,3,1); +-- Here we enable metadata just to check that the collation of the +-- resultset is non-binary for string type. This should be changed +-- after Bug#29394 is implemented. +analyze table t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 128 7 Y 0 39 8 +def Op 253 10 7 Y 0 39 8 +def Msg_type 253 10 6 Y 0 39 8 +def Msg_text 250 393216 2 Y 0 39 8 +Table Op Msg_type Msg_text +test.t1 analyze status OK +show index from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +t1 0 PRIMARY 1 f1 A 1 NULL NULL BTREE +t1 0 PRIMARY 2 f2 A 3 NULL NULL BTREE +t1 0 PRIMARY 3 f3 A 9 NULL NULL BTREE +t1 0 PRIMARY 4 f4 A 18 NULL NULL BTREE +-- Here we enable metadata just to check that the collation of the +-- resultset is non-binary for string type. This should be changed +-- after Bug#29394 is implemented. +repair table t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 128 7 Y 0 39 8 +def Op 253 10 6 Y 0 39 8 +def Msg_type 253 10 6 Y 0 39 8 +def Msg_text 250 393216 2 Y 0 39 8 +Table Op Msg_type Msg_text +test.t1 repair status OK +show index from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +t1 0 PRIMARY 1 f1 A 1 NULL NULL BTREE +t1 0 PRIMARY 2 f2 A 3 NULL NULL BTREE +t1 0 PRIMARY 3 f3 A 9 NULL NULL BTREE +t1 0 PRIMARY 4 f4 A 18 NULL NULL BTREE +drop table t1; +create temporary table t1 (a int not null); +show create table t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `a` int(11) NOT NULL +) 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 +) 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' 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; +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 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 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 NO 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 NO NULL 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; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + UNIQUE KEY `aa` (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 (a int not null, primary key (a)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +flush tables; +show open tables; +Database Table In_use Name_locked +mysql general_log 0 0 +create table t1(n int); +insert into t1 values (1); +show open tables; +Database Table In_use Name_locked +mysql general_log 0 0 +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" 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, + `b` varchar(10) DEFAULT NULL, + KEY `b` (`b`) +) 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 +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` varchar(10) DEFAULT NULL, + KEY `b` (`b`) +) 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 +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` varchar(10) DEFAULT NULL, + KEY `b` (`b`) +) 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; +Field Type Null Key Default Extra +a decimal(9,2) YES NULL +b decimal(9,0) YES NULL +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 default 0, +type_tiny tinyint not null auto_increment primary key, +type_short smallint(3), +type_mediumint mediumint, +type_bigint bigint, +type_decimal decimal(5,2), +type_numeric numeric(5,2), +empty_char char(0), +type_char char(2), +type_varchar varchar(10), +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', +type_year year, +type_enum enum ('red', 'green', 'blue'), +type_set enum ('red', 'green', 'blue'), +type_tinyblob tinyblob, +type_blob blob, +type_medium_blob mediumblob, +type_long_blob longblob, +index(type_short) +) 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` ( + `type_bool` tinyint(1) NOT NULL DEFAULT 0, + `type_tiny` tinyint(4) NOT NULL AUTO_INCREMENT, + `type_short` smallint(3) DEFAULT NULL, + `type_mediumint` mediumint(9) DEFAULT NULL, + `type_bigint` bigint(20) DEFAULT NULL, + `type_decimal` decimal(5,2) DEFAULT NULL, + `type_numeric` decimal(5,2) DEFAULT NULL, + `empty_char` char(0) DEFAULT NULL, + `type_char` char(2) DEFAULT NULL, + `type_varchar` varchar(10) DEFAULT 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', + `type_year` year(4) DEFAULT NULL, + `type_enum` enum('red','green','blue') DEFAULT NULL, + `type_set` enum('red','green','blue') DEFAULT NULL, + `type_tinyblob` tinyblob DEFAULT NULL, + `type_blob` blob DEFAULT NULL, + `type_medium_blob` mediumblob DEFAULT NULL, + `type_long_blob` longblob DEFAULT NULL, + PRIMARY KEY (`type_tiny`), + KEY `type_short` (`type_short`) +) 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 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; +show columns from t2; +Field Type Null Key Default Extra +max(a) int(11) YES NULL +drop table t1,t2; +create table t1 (c decimal, d double, f float, r real); +show columns from t1; +Field Type Null Key Default Extra +c decimal(10,0) YES NULL +d double YES NULL +f float YES NULL +r double YES NULL +drop table t1; +create table t1 (c decimal(3,3), d double(3,3), f float(3,3)); +show columns from t1; +Field Type Null Key Default Extra +c decimal(3,3) YES NULL +d double(3,3) YES NULL +f float(3,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 ```ab``cd``` (i INT); +SHOW CREATE TABLE ```ab``cd```; +Table Create Table +`ab`cd` CREATE TABLE ```ab``cd``` ( + i int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE ```ab``cd```; +CREATE TABLE ```ab````cd``` (i INT); +SHOW CREATE TABLE ```ab````cd```; +Table Create Table +`ab``cd` CREATE TABLE ```ab````cd``` ( + i int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE ```ab````cd```; +CREATE TABLE ```a` (i INT); +SHOW CREATE TABLE ```a`; +Table Create Table +`a CREATE TABLE ```a` ( + i int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE ```a`; +CREATE TABLE `a.1` (i INT); +SHOW CREATE TABLE `a.1`; +Table Create Table +a.1 CREATE TABLE `a.1` ( + i int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE `a.1`; +SET sql_mode= 'ANSI_QUOTES'; +CREATE TABLE """a" (i INT); +SHOW CREATE TABLE """a"; +Table Create Table +"a CREATE TABLE """a" ( + i int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE """a"; +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 +1048576 +CREATE TABLE t1 ( +a int(11) default NULL, +KEY a USING 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 USING 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 Max_index_length Temporary +t1 MEMORY 10 Fixed 2 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL 0 N +t2 MEMORY 10 Fixed 2 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL 0 N +t3 MEMORY 10 Fixed 2 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL 0 N +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 Max_index_length Temporary +t1 MEMORY 10 Fixed 4 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL 0 N +t2 MEMORY 10 Fixed 4 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL 0 N +t3 MEMORY 10 Fixed 4 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL 0 N +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 Max_index_length Temporary +t1 MEMORY 10 Fixed 5 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL 0 N +t2 MEMORY 10 Fixed 5 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL 0 N +t3 MEMORY 10 Fixed 5 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL 0 N +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 Max_index_length Temporary +t1 MEMORY 10 Fixed 4 # # # # # NULL # NULL NULL latin1_swedish_ci NULL 0 N +t2 MEMORY 10 Fixed 4 # # # # # NULL # NULL NULL latin1_swedish_ci NULL 0 N +t3 MEMORY 10 Fixed 4 # # # # # NULL # NULL NULL latin1_swedish_ci NULL 0 N +truncate table t1; +truncate table t2; +truncate table 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 Max_index_length Temporary +t1 MEMORY 10 Fixed 0 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL 0 N +t2 MEMORY 10 Fixed 0 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL 0 N +t3 MEMORY 10 Fixed 0 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL 0 N +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 Max_index_length Temporary +t1 MEMORY 10 Fixed 1 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL 0 N +t2 MEMORY 10 Fixed 1 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL 0 N +t3 MEMORY 10 Fixed 1 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL 0 N +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 Max_index_length Temporary +t1 MEMORY 10 Fixed 0 # # # # # NULL # NULL NULL latin1_swedish_ci NULL 0 N +t2 MEMORY 10 Fixed 0 # # # # # NULL # NULL NULL latin1_swedish_ci NULL 0 N +t3 MEMORY 10 Fixed 0 # # # # # NULL # NULL NULL latin1_swedish_ci NULL 0 N +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); +create user mysqltest_1@localhost; +grant select on `mysqltest`.* to mysqltest_1@localhost; +create user mysqltest_2@localhost; +grant usage on `mysqltest`.* to mysqltest_2@localhost; +create user mysqltest_3@localhost; +grant drop on `mysqltest`.* to mysqltest_3@localhost; +connect con1,localhost,mysqltest_1,,mysqltest; +connection con1; +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: DROP command denied to user 'mysqltest_1'@'localhost' for table 't1' +drop database mysqltest; +ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest' +disconnect con1; +connect con2,localhost,mysqltest_2,,test; +connection con2; +select * from mysqltest.t1; +ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table 't1' +show create database mysqltest; +ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest' +drop table mysqltest.t1; +ERROR 42000: DROP command denied to user 'mysqltest_2'@'localhost' for table 't1' +drop database mysqltest; +ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest' +disconnect con2; +connect con3,localhost,mysqltest_3,,test; +connection con3; +select * from mysqltest.t1; +ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't1' +show create database mysqltest; +Database Create Database +mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */ +drop table mysqltest.t1; +drop database mysqltest; +disconnect con3; +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; +CREATE TABLE t1 (i int, KEY (i)) ENGINE=MEMORY; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) DEFAULT NULL, + KEY `i` (`i`) +) ENGINE=MEMORY DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (i int, KEY USING HASH (i)) ENGINE=MEMORY; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) DEFAULT NULL, + KEY `i` (`i`) USING HASH +) ENGINE=MEMORY DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MEMORY; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) DEFAULT NULL, + KEY `i` (`i`) USING BTREE +) ENGINE=MEMORY DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) DEFAULT NULL, + KEY `i` (`i`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) DEFAULT NULL, + KEY `i` (`i`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) DEFAULT NULL, + KEY `i` (`i`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +ALTER TABLE t1 ENGINE=MEMORY; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) DEFAULT NULL, + KEY `i` (`i`) +) ENGINE=MEMORY DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) DEFAULT NULL, + KEY `i` (`i`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +ALTER TABLE t1 ENGINE=MEMORY; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) DEFAULT NULL, + KEY `i` (`i`) USING BTREE +) ENGINE=MEMORY DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t1( +field1 text NOT NULL, +PRIMARY KEY(field1(1000)) +); +show index from t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def information_schema STATISTICS STATISTICS TABLE_NAME Table 253 64 2 N 1 0 63 +def information_schema STATISTICS STATISTICS NON_UNIQUE Non_unique 8 1 1 N 32769 0 63 +def information_schema STATISTICS STATISTICS INDEX_NAME Key_name 253 64 7 N 1 0 63 +def information_schema STATISTICS STATISTICS SEQ_IN_INDEX Seq_in_index 8 2 1 N 32769 0 63 +def information_schema STATISTICS STATISTICS COLUMN_NAME Column_name 253 64 6 N 1 0 63 +def information_schema STATISTICS STATISTICS COLLATION Collation 253 1 1 Y 0 0 63 +def information_schema STATISTICS STATISTICS CARDINALITY Cardinality 8 21 1 Y 32768 0 63 +def information_schema STATISTICS STATISTICS SUB_PART Sub_part 8 3 4 Y 32768 0 63 +def information_schema STATISTICS STATISTICS PACKED Packed 253 10 0 Y 0 0 63 +def information_schema STATISTICS STATISTICS NULLABLE Null 253 3 0 N 1 0 63 +def information_schema STATISTICS STATISTICS INDEX_TYPE Index_type 253 16 5 N 1 0 63 +def information_schema STATISTICS STATISTICS COMMENT Comment 253 16 0 Y 0 0 63 +def information_schema STATISTICS STATISTICS INDEX_COMMENT Index_comment 253 1024 0 N 1 0 63 +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +t1 0 PRIMARY 1 field1 A 0 1000 NULL BTREE +drop table t1; +create table t1 ( +c1 int NOT NULL, +c2 int NOT NULL, +PRIMARY KEY USING HASH (c1), +INDEX USING BTREE(c2) +); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) NOT NULL, + PRIMARY KEY (`c1`) USING HASH, + KEY `c2` (`c2`) USING BTREE +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +flush tables; +SHOW TABLE STATUS 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 Max_index_length Temporary +t1 NULL NULL NULL NULL # # # # NULL NULL # NULL NULL NULL NULL NULL Incorrect information in file: './test/t1.frm' NULL NULL +Warnings: +Warning 1033 Incorrect information in file: './test/t1.frm' +show create table t1; +ERROR HY000: Incorrect information in file: './test/t1.frm' +drop table if exists t1; + +# Bug#12183 SHOW OPEN TABLES behavior doesn't match grammar. + +DROP DATABASE IF EXISTS mysqltest1; +CREATE DATABASE mysqltest1; +use mysqltest1; + +CREATE TABLE t1(a INT); +CREATE TABLE t2(a INT); + +FLUSH TABLES; + +SELECT 1 FROM t1; +1 +SELECT 1 FROM t2; +1 + +SHOW OPEN TABLES FROM mysqltest1; +Database Table In_use Name_locked +mysqltest1 t1 0 0 +mysqltest1 t2 0 0 + +SHOW OPEN TABLES FROM mysqltest1 LIKE 'z%'; +Database Table In_use Name_locked + +SHOW OPEN TABLES FROM mysqltest1 LIKE 't1%'; +Database Table In_use Name_locked +mysqltest1 t1 0 0 + +SHOW OPEN TABLES FROM mysqltest1 LIKE '%1%'; +Database Table In_use Name_locked +mysqltest1 t1 0 0 + +FLUSH TABLES; + +DROP DATABASE mysqltest1; +use test; + +SHOW TABLES FROM non_existing_database; +ERROR 42000: Unknown database 'non_existing_database' +End of 4.1 tests +DROP VIEW IF EXISTS v1; +DROP PROCEDURE IF EXISTS p1; +CREATE VIEW v1 AS SELECT 1; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1` binary binary +DROP VIEW v1; +CREATE VIEW v1 AS SELECT SQL_CACHE 1; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_cache 1 AS `1` binary binary +DROP VIEW v1; +CREATE VIEW v1 AS SELECT SQL_NO_CACHE 1; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache 1 AS `1` binary binary +DROP VIEW v1; +CREATE VIEW v1 AS SELECT NOW(); +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select current_timestamp() AS `NOW()` binary binary +DROP VIEW v1; +CREATE VIEW v1 AS SELECT SQL_CACHE NOW(); +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_cache current_timestamp() AS `NOW()` binary binary +DROP VIEW v1; +CREATE VIEW v1 AS SELECT SQL_NO_CACHE NOW(); +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache current_timestamp() AS `NOW()` binary binary +DROP VIEW v1; +CREATE VIEW v1 AS SELECT SQL_CACHE SQL_NO_CACHE NOW(); +ERROR HY000: Incorrect usage of SQL_CACHE and SQL_NO_CACHE +CREATE VIEW v1 AS SELECT SQL_NO_CACHE SQL_CACHE NOW(); +ERROR HY000: Incorrect usage of SQL_NO_CACHE and SQL_CACHE +CREATE VIEW v1 AS SELECT SQL_CACHE SQL_NO_CACHE SQL_CACHE NOW(); +ERROR HY000: Incorrect usage of SQL_CACHE and SQL_NO_CACHE +CREATE PROCEDURE p1() +BEGIN +SET @s= 'CREATE VIEW v1 AS SELECT SQL_CACHE 1'; +PREPARE stmt FROM @s; +EXECUTE stmt; +DROP PREPARE stmt; +END | +CALL p1(); +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_cache 1 AS `1` binary binary +DROP PROCEDURE p1; +DROP VIEW v1; +SHOW TABLES FROM no_such_database; +ERROR 42000: Unknown database 'no_such_database' +SHOW COLUMNS FROM no_such_table; +ERROR 42S02: Table 'test.no_such_table' doesn't exist +flush status; +show status like 'slow_queries'; +Variable_name Value +Slow_queries 0 +show tables; +Tables_in_test +show status like 'slow_queries'; +Variable_name Value +Slow_queries 0 +select 1 from information_schema.tables limit 1; +1 +1 +show status like 'slow_queries'; +Variable_name Value +Slow_queries 1 +create table t1 (a int); +create trigger tr1 before insert on t1 for each row +begin +end; +create view v1 as select a from t1; +create procedure p1() +begin +end; +create function f1() +returns int +return 0; +create event e1 on schedule every 1 year starts now() +ends date_add(now(), interval 5 hour) do +begin +end; ++Warnings: ++Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. +flush status; +show databases; +show tables; +show events; +show table status; +show open tables; +show plugins; +show columns in t1; +show slave hosts; +show keys in t1; +show storage engines; +show authors; +show contributors; +show privileges; +show count(*) warnings; +show count(*) errors; +show warnings; +show status; +show processlist; +show variables; +show charset; +show collation; +show grants; +show create database test; +show create table t1; +show create view v1; +show master status; +show slave status; +show create procedure p1; +show create function f1; +show create trigger tr1; +show procedure status; +show create event e1; +show status like 'slow_queries'; +Variable_name Value +Slow_queries 0 +drop view v1; +drop table t1; +drop procedure p1; +drop function f1; +drop event e1; +DROP DATABASE IF EXISTS mysqltest1; +DROP TABLE IF EXISTS t1; +DROP VIEW IF EXISTS v1; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +CREATE DATABASE mysqltest1; +CREATE TABLE t1(c INT NOT NULL PRIMARY KEY); +CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1; +CREATE VIEW v1 AS SELECT 1; +CREATE PROCEDURE p1() SELECT 1; +CREATE FUNCTION f1() RETURNS INT RETURN 1; +set names utf8; +-- Here we enable metadata just to check that the collation of the +-- resultset is non-binary for string type. This should be changed +-- after Bug#29394 is implemented. +---------------------------------------------------------------- +SHOW CHARACTER SET LIKE 'utf8'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def information_schema CHARACTER_SETS CHARACTER_SETS CHARACTER_SET_NAME Charset 253 96 4 N 1 0 33 +def information_schema CHARACTER_SETS CHARACTER_SETS DESCRIPTION Description 253 180 13 N 1 0 33 +def information_schema CHARACTER_SETS CHARACTER_SETS DEFAULT_COLLATE_NAME Default collation 253 96 15 N 1 0 33 +def information_schema CHARACTER_SETS CHARACTER_SETS MAXLEN Maxlen 8 3 1 N 32769 0 63 +Charset Description Default collation Maxlen +utf8 UTF-8 Unicode utf8_general_ci 3 +---------------------------------------------------------------- +SHOW COLLATION LIKE 'latin1_bin'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def information_schema COLLATIONS COLLATIONS COLLATION_NAME Collation 253 96 10 N 1 0 33 +def information_schema COLLATIONS COLLATIONS CHARACTER_SET_NAME Charset 253 96 6 N 1 0 33 +def information_schema COLLATIONS COLLATIONS ID Id 8 11 2 N 32769 0 63 +def information_schema COLLATIONS COLLATIONS IS_DEFAULT Default 253 9 0 N 1 0 33 +def information_schema COLLATIONS COLLATIONS IS_COMPILED Compiled 253 9 3 N 1 0 33 +def information_schema COLLATIONS COLLATIONS SORTLEN Sortlen 8 3 1 N 32769 0 63 +Collation Charset Id Default Compiled Sortlen +latin1_bin latin1 47 Yes 1 +---------------------------------------------------------------- +SHOW CREATE DATABASE mysqltest1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Database 253 192 10 N 1 39 33 +def Create Database 253 3072 69 N 1 39 33 +Database Create Database +mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 */ +---------------------------------------------------------------- +SHOW DATABASES LIKE 'mysqltest1'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def information_schema SCHEMATA SCHEMATA SCHEMA_NAME Database (mysqltest1) 253 192 10 N 1 0 33 +Database (mysqltest1) +mysqltest1 +---------------------------------------------------------------- +SHOW CREATE TABLE t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 192 2 N 1 39 33 +def Create Table 253 3072 102 N 1 39 33 +Table Create Table +t1 CREATE TABLE `t1` ( + `c` int(11) NOT NULL, + PRIMARY KEY (`c`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +---------------------------------------------------------------- +SHOW INDEX FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def information_schema STATISTICS STATISTICS TABLE_NAME Table 253 192 2 N 1 0 33 +def information_schema STATISTICS STATISTICS NON_UNIQUE Non_unique 8 1 1 N 32769 0 63 +def information_schema STATISTICS STATISTICS INDEX_NAME Key_name 253 192 7 N 1 0 33 +def information_schema STATISTICS STATISTICS SEQ_IN_INDEX Seq_in_index 8 2 1 N 32769 0 63 +def information_schema STATISTICS STATISTICS COLUMN_NAME Column_name 253 192 1 N 1 0 33 +def information_schema STATISTICS STATISTICS COLLATION Collation 253 3 1 Y 0 0 33 +def information_schema STATISTICS STATISTICS CARDINALITY Cardinality 8 21 1 Y 32768 0 63 +def information_schema STATISTICS STATISTICS SUB_PART Sub_part 8 3 0 Y 32768 0 63 +def information_schema STATISTICS STATISTICS PACKED Packed 253 30 0 Y 0 0 33 +def information_schema STATISTICS STATISTICS NULLABLE Null 253 9 0 N 1 0 33 +def information_schema STATISTICS STATISTICS INDEX_TYPE Index_type 253 48 5 N 1 0 33 +def information_schema STATISTICS STATISTICS COMMENT Comment 253 48 0 Y 0 0 33 +def information_schema STATISTICS STATISTICS INDEX_COMMENT Index_comment 253 3072 0 N 1 0 33 +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +t1 0 PRIMARY 1 c A 0 NULL NULL BTREE +---------------------------------------------------------------- +SELECT +TABLE_CATALOG, +TABLE_SCHEMA, +TABLE_NAME, +TABLE_TYPE, +ENGINE, +ROW_FORMAT, +TABLE_COLLATION, +CREATE_OPTIONS, +TABLE_COMMENT +FROM INFORMATION_SCHEMA.TABLES +WHERE table_name = 't1'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def information_schema TABLES TABLES TABLE_CATALOG TABLE_CATALOG 253 1536 3 N 1 0 33 +def information_schema TABLES TABLES TABLE_SCHEMA TABLE_SCHEMA 253 192 4 N 1 0 33 +def information_schema TABLES TABLES TABLE_NAME TABLE_NAME 253 192 2 N 1 0 33 +def information_schema TABLES TABLES TABLE_TYPE TABLE_TYPE 253 192 10 N 1 0 33 +def information_schema TABLES TABLES ENGINE ENGINE 253 192 6 Y 0 0 33 +def information_schema TABLES TABLES ROW_FORMAT ROW_FORMAT 253 30 5 Y 0 0 33 +def information_schema TABLES TABLES TABLE_COLLATION TABLE_COLLATION 253 96 17 Y 0 0 33 +def information_schema TABLES TABLES CREATE_OPTIONS CREATE_OPTIONS 253 6144 0 Y 0 0 33 +def information_schema TABLES TABLES TABLE_COMMENT TABLE_COMMENT 253 6144 0 N 1 0 33 +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE ROW_FORMAT TABLE_COLLATION CREATE_OPTIONS TABLE_COMMENT +def test t1 BASE TABLE MyISAM Fixed latin1_swedish_ci +---------------------------------------------------------------- +SELECT +TABLE_CATALOG, +TABLE_SCHEMA, +TABLE_NAME, +COLUMN_NAME, +COLUMN_DEFAULT, +IS_NULLABLE, +DATA_TYPE, +CHARACTER_SET_NAME, +COLLATION_NAME, +COLUMN_TYPE, +COLUMN_KEY, +EXTRA, +PRIVILEGES, +COLUMN_COMMENT +FROM INFORMATION_SCHEMA.COLUMNS +WHERE table_name = 't1'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def information_schema COLUMNS COLUMNS TABLE_CATALOG TABLE_CATALOG 253 1536 3 N 1 0 33 +def information_schema COLUMNS COLUMNS TABLE_SCHEMA TABLE_SCHEMA 253 192 4 N 1 0 33 +def information_schema COLUMNS COLUMNS TABLE_NAME TABLE_NAME 253 192 2 N 1 0 33 +def information_schema COLUMNS COLUMNS COLUMN_NAME COLUMN_NAME 253 192 1 N 1 0 33 +def information_schema COLUMNS COLUMNS COLUMN_DEFAULT COLUMN_DEFAULT 252 589788 0 Y 16 0 33 +def information_schema COLUMNS COLUMNS IS_NULLABLE IS_NULLABLE 253 9 2 N 1 0 33 +def information_schema COLUMNS COLUMNS DATA_TYPE DATA_TYPE 253 192 3 N 1 0 33 +def information_schema COLUMNS COLUMNS CHARACTER_SET_NAME CHARACTER_SET_NAME 253 96 0 Y 0 0 33 +def information_schema COLUMNS COLUMNS COLLATION_NAME COLLATION_NAME 253 96 0 Y 0 0 33 +def information_schema COLUMNS COLUMNS COLUMN_TYPE COLUMN_TYPE 252 589815 7 N 17 0 33 +def information_schema COLUMNS COLUMNS COLUMN_KEY COLUMN_KEY 253 9 3 N 1 0 33 +def information_schema COLUMNS COLUMNS EXTRA EXTRA 253 90 0 N 1 0 33 +def information_schema COLUMNS COLUMNS PRIVILEGES PRIVILEGES 253 240 31 N 1 0 33 +def information_schema COLUMNS COLUMNS COLUMN_COMMENT COLUMN_COMMENT 253 3072 0 N 1 0 33 +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT +def test t1 c NULL NO int NULL NULL int(11) PRI select,insert,update,references +---------------------------------------------------------------- +SHOW TABLES LIKE 't1'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def information_schema TABLE_NAMES TABLE_NAMES TABLE_NAME Tables_in_test (t1) 253 219 2 N 1 0 33 +Tables_in_test (t1) +t1 +---------------------------------------------------------------- +SHOW COLUMNS FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def information_schema COLUMNS COLUMNS COLUMN_NAME Field 253 192 1 N 1 0 33 +def information_schema COLUMNS COLUMNS COLUMN_TYPE Type 252 589815 7 N 17 0 33 +def information_schema COLUMNS COLUMNS IS_NULLABLE Null 253 9 2 N 1 0 33 +def information_schema COLUMNS COLUMNS COLUMN_KEY Key 253 9 3 N 1 0 33 +def information_schema COLUMNS COLUMNS COLUMN_DEFAULT Default 252 589788 0 Y 16 0 33 +def information_schema COLUMNS COLUMNS EXTRA Extra 253 90 0 N 1 0 33 +Field Type Null Key Default Extra +c int(11) NO PRI NULL +---------------------------------------------------------------- +SHOW TRIGGERS LIKE 't1'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def information_schema TRIGGERS TRIGGERS TRIGGER_NAME Trigger 253 192 5 N 1 0 33 +def information_schema TRIGGERS TRIGGERS EVENT_MANIPULATION Event 253 18 6 N 1 0 33 +def information_schema TRIGGERS TRIGGERS EVENT_OBJECT_TABLE Table 253 192 2 N 1 0 33 +def information_schema TRIGGERS TRIGGERS ACTION_STATEMENT Statement 252 589815 10 N 17 0 33 +def information_schema TRIGGERS TRIGGERS ACTION_TIMING Timing 253 18 6 N 1 0 33 +def information_schema TRIGGERS TRIGGERS CREATED Created 12 22 22 Y 128 2 63 +def information_schema TRIGGERS TRIGGERS SQL_MODE sql_mode 253 24576 89 N 1 0 33 +def information_schema TRIGGERS TRIGGERS DEFINER Definer 253 567 14 N 1 0 33 +def information_schema TRIGGERS TRIGGERS CHARACTER_SET_CLIENT character_set_client 253 96 6 N 1 0 33 +def information_schema TRIGGERS TRIGGERS COLLATION_CONNECTION collation_connection 253 96 6 N 1 0 33 +def information_schema TRIGGERS TRIGGERS DATABASE_COLLATION Database Collation 253 96 17 N 1 0 33 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +t1_bi INSERT t1 SET @a = 1 BEFORE # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost binary binary latin1_swedish_ci +---------------------------------------------------------------- +SELECT +TRIGGER_CATALOG, +TRIGGER_SCHEMA, +TRIGGER_NAME, +EVENT_MANIPULATION, +EVENT_OBJECT_CATALOG, +EVENT_OBJECT_SCHEMA, +EVENT_OBJECT_TABLE, +ACTION_CONDITION, +ACTION_STATEMENT, +ACTION_ORIENTATION, +ACTION_TIMING, +ACTION_REFERENCE_OLD_TABLE, +ACTION_REFERENCE_NEW_TABLE, +ACTION_REFERENCE_OLD_ROW, +ACTION_REFERENCE_NEW_ROW, +SQL_MODE, +DEFINER +FROM INFORMATION_SCHEMA.TRIGGERS +WHERE trigger_name = 't1_bi'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def information_schema TRIGGERS TRIGGERS TRIGGER_CATALOG TRIGGER_CATALOG 253 1536 3 N 1 0 33 +def information_schema TRIGGERS TRIGGERS TRIGGER_SCHEMA TRIGGER_SCHEMA 253 192 4 N 1 0 33 +def information_schema TRIGGERS TRIGGERS TRIGGER_NAME TRIGGER_NAME 253 192 5 N 1 0 33 +def information_schema TRIGGERS TRIGGERS EVENT_MANIPULATION EVENT_MANIPULATION 253 18 6 N 1 0 33 +def information_schema TRIGGERS TRIGGERS EVENT_OBJECT_CATALOG EVENT_OBJECT_CATALOG 253 1536 3 N 1 0 33 +def information_schema TRIGGERS TRIGGERS EVENT_OBJECT_SCHEMA EVENT_OBJECT_SCHEMA 253 192 4 N 1 0 33 +def information_schema TRIGGERS TRIGGERS EVENT_OBJECT_TABLE EVENT_OBJECT_TABLE 253 192 2 N 1 0 33 +def information_schema TRIGGERS TRIGGERS ACTION_CONDITION ACTION_CONDITION 252 589815 0 Y 16 0 33 +def information_schema TRIGGERS TRIGGERS ACTION_STATEMENT ACTION_STATEMENT 252 589815 10 N 17 0 33 +def information_schema TRIGGERS TRIGGERS ACTION_ORIENTATION ACTION_ORIENTATION 253 27 3 N 1 0 33 +def information_schema TRIGGERS TRIGGERS ACTION_TIMING ACTION_TIMING 253 18 6 N 1 0 33 +def information_schema TRIGGERS TRIGGERS ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_OLD_TABLE 253 192 0 Y 0 0 33 +def information_schema TRIGGERS TRIGGERS ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_NEW_TABLE 253 192 0 Y 0 0 33 +def information_schema TRIGGERS TRIGGERS ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_OLD_ROW 253 9 3 N 1 0 33 +def information_schema TRIGGERS TRIGGERS ACTION_REFERENCE_NEW_ROW ACTION_REFERENCE_NEW_ROW 253 9 3 N 1 0 33 +def information_schema TRIGGERS TRIGGERS SQL_MODE SQL_MODE 253 24576 89 N 1 0 33 +def information_schema TRIGGERS TRIGGERS DEFINER DEFINER 253 567 14 N 1 0 33 +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW SQL_MODE DEFINER +def test t1_bi INSERT def test t1 NULL SET @a = 1 ROW BEFORE NULL NULL OLD NEW STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost +SELECT CREATED FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name='t1_bi'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def information_schema TRIGGERS TRIGGERS CREATED CREATED 12 22 22 Y 128 2 63 +CREATED +# +---------------------------------------------------------------- +SHOW CREATE VIEW v1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def View 253 192 2 N 1 39 33 +def Create View 253 3072 103 N 1 39 33 +def character_set_client 253 96 6 N 1 39 33 +def collation_connection 253 96 6 N 1 39 33 +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1` binary binary +---------------------------------------------------------------- +SELECT * +FROM INFORMATION_SCHEMA.VIEWS +WHERE table_name = 'v1'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def information_schema VIEWS VIEWS TABLE_CATALOG TABLE_CATALOG 253 1536 3 N 1 0 33 +def information_schema VIEWS VIEWS TABLE_SCHEMA TABLE_SCHEMA 253 192 4 N 1 0 33 +def information_schema VIEWS VIEWS TABLE_NAME TABLE_NAME 253 192 2 N 1 0 33 +def information_schema VIEWS VIEWS VIEW_DEFINITION VIEW_DEFINITION 252 589815 15 N 17 0 33 +def information_schema VIEWS VIEWS CHECK_OPTION CHECK_OPTION 253 24 4 N 1 0 33 +def information_schema VIEWS VIEWS IS_UPDATABLE IS_UPDATABLE 253 9 2 N 1 0 33 +def information_schema VIEWS VIEWS DEFINER DEFINER 253 567 14 N 1 0 33 +def information_schema VIEWS VIEWS SECURITY_TYPE SECURITY_TYPE 253 21 7 N 1 0 33 +def information_schema VIEWS VIEWS CHARACTER_SET_CLIENT CHARACTER_SET_CLIENT 253 96 6 N 1 0 33 +def information_schema VIEWS VIEWS COLLATION_CONNECTION COLLATION_CONNECTION 253 96 6 N 1 0 33 +def information_schema VIEWS VIEWS ALGORITHM ALGORITHM 253 30 9 N 1 0 33 +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM +def test v1 select 1 AS `1` NONE NO root@localhost DEFINER binary binary UNDEFINED +---------------------------------------------------------------- +SHOW CREATE PROCEDURE p1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Procedure 253 192 2 N 1 39 33 +def sql_mode 253 267 89 N 1 39 33 +def Create Procedure 253 3072 59 Y 0 39 33 +def character_set_client 253 96 6 N 1 39 33 +def collation_connection 253 96 6 N 1 39 33 +def Database Collation 253 96 17 N 1 39 33 +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() +SELECT 1 binary binary latin1_swedish_ci +---------------------------------------------------------------- +SELECT +SPECIFIC_NAME, +ROUTINE_CATALOG, +ROUTINE_SCHEMA, +ROUTINE_NAME, +ROUTINE_TYPE, +DTD_IDENTIFIER, +ROUTINE_BODY, +ROUTINE_DEFINITION, +EXTERNAL_NAME, +EXTERNAL_LANGUAGE, +PARAMETER_STYLE, +IS_DETERMINISTIC, +SQL_DATA_ACCESS, +SQL_PATH, +SECURITY_TYPE, +SQL_MODE, +ROUTINE_COMMENT, +DEFINER +FROM INFORMATION_SCHEMA.ROUTINES +WHERE routine_name = 'p1'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def information_schema ROUTINES ROUTINES SPECIFIC_NAME SPECIFIC_NAME 253 192 2 N 1 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_CATALOG ROUTINE_CATALOG 253 1536 3 N 1 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_SCHEMA ROUTINE_SCHEMA 253 192 4 N 1 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_NAME ROUTINE_NAME 253 192 2 N 1 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_TYPE ROUTINE_TYPE 253 39 9 N 1 0 33 +def information_schema ROUTINES ROUTINES DTD_IDENTIFIER DTD_IDENTIFIER 252 589815 0 Y 16 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_BODY ROUTINE_BODY 253 24 3 N 1 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_DEFINITION ROUTINE_DEFINITION 252 589815 8 Y 16 0 33 +def information_schema ROUTINES ROUTINES EXTERNAL_NAME EXTERNAL_NAME 253 192 0 Y 0 0 33 +def information_schema ROUTINES ROUTINES EXTERNAL_LANGUAGE EXTERNAL_LANGUAGE 253 192 0 Y 0 0 33 +def information_schema ROUTINES ROUTINES PARAMETER_STYLE PARAMETER_STYLE 253 24 3 N 1 0 33 +def information_schema ROUTINES ROUTINES IS_DETERMINISTIC IS_DETERMINISTIC 253 9 2 N 1 0 33 +def information_schema ROUTINES ROUTINES SQL_DATA_ACCESS SQL_DATA_ACCESS 253 192 12 N 1 0 33 +def information_schema ROUTINES ROUTINES SQL_PATH SQL_PATH 253 192 0 Y 0 0 33 +def information_schema ROUTINES ROUTINES SECURITY_TYPE SECURITY_TYPE 253 21 7 N 1 0 33 +def information_schema ROUTINES ROUTINES SQL_MODE SQL_MODE 253 24576 89 N 1 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_COMMENT ROUTINE_COMMENT 252 589815 0 N 17 0 33 +def information_schema ROUTINES ROUTINES DEFINER DEFINER 253 567 14 N 1 0 33 +SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE SQL_MODE ROUTINE_COMMENT DEFINER +p1 def test p1 PROCEDURE NULL SQL SELECT 1 NULL NULL SQL NO CONTAINS SQL NULL DEFINER STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost +---------------------------------------------------------------- +SHOW CREATE FUNCTION f1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Function 253 192 2 N 1 39 33 +def sql_mode 253 267 89 N 1 39 33 +def Create Function 253 3072 74 Y 0 39 33 +def character_set_client 253 96 6 N 1 39 33 +def collation_connection 253 96 6 N 1 39 33 +def Database Collation 253 96 17 N 1 39 33 +Function sql_mode Create Function character_set_client collation_connection Database Collation +f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) +RETURN 1 binary binary latin1_swedish_ci +---------------------------------------------------------------- +SELECT +SPECIFIC_NAME, +ROUTINE_CATALOG, +ROUTINE_SCHEMA, +ROUTINE_NAME, +ROUTINE_TYPE, +DTD_IDENTIFIER, +ROUTINE_BODY, +ROUTINE_DEFINITION, +EXTERNAL_NAME, +EXTERNAL_LANGUAGE, +PARAMETER_STYLE, +IS_DETERMINISTIC, +SQL_DATA_ACCESS, +SQL_PATH, +SECURITY_TYPE, +SQL_MODE, +ROUTINE_COMMENT, +DEFINER +FROM INFORMATION_SCHEMA.ROUTINES +WHERE routine_name = 'f1'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def information_schema ROUTINES ROUTINES SPECIFIC_NAME SPECIFIC_NAME 253 192 2 N 1 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_CATALOG ROUTINE_CATALOG 253 1536 3 N 1 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_SCHEMA ROUTINE_SCHEMA 253 192 4 N 1 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_NAME ROUTINE_NAME 253 192 2 N 1 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_TYPE ROUTINE_TYPE 253 39 8 N 1 0 33 +def information_schema ROUTINES ROUTINES DTD_IDENTIFIER DTD_IDENTIFIER 252 589815 7 Y 16 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_BODY ROUTINE_BODY 253 24 3 N 1 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_DEFINITION ROUTINE_DEFINITION 252 589815 8 Y 16 0 33 +def information_schema ROUTINES ROUTINES EXTERNAL_NAME EXTERNAL_NAME 253 192 0 Y 0 0 33 +def information_schema ROUTINES ROUTINES EXTERNAL_LANGUAGE EXTERNAL_LANGUAGE 253 192 0 Y 0 0 33 +def information_schema ROUTINES ROUTINES PARAMETER_STYLE PARAMETER_STYLE 253 24 3 N 1 0 33 +def information_schema ROUTINES ROUTINES IS_DETERMINISTIC IS_DETERMINISTIC 253 9 2 N 1 0 33 +def information_schema ROUTINES ROUTINES SQL_DATA_ACCESS SQL_DATA_ACCESS 253 192 12 N 1 0 33 +def information_schema ROUTINES ROUTINES SQL_PATH SQL_PATH 253 192 0 Y 0 0 33 +def information_schema ROUTINES ROUTINES SECURITY_TYPE SECURITY_TYPE 253 21 7 N 1 0 33 +def information_schema ROUTINES ROUTINES SQL_MODE SQL_MODE 253 24576 89 N 1 0 33 +def information_schema ROUTINES ROUTINES ROUTINE_COMMENT ROUTINE_COMMENT 252 589815 0 N 17 0 33 +def information_schema ROUTINES ROUTINES DEFINER DEFINER 253 567 14 N 1 0 33 +SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE SQL_MODE ROUTINE_COMMENT DEFINER +f1 def test f1 FUNCTION int(11) SQL RETURN 1 NULL NULL SQL NO CONTAINS SQL NULL DEFINER STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost +---------------------------------------------------------------- +DROP DATABASE mysqltest1; +DROP TABLE t1; +DROP VIEW v1; +DROP PROCEDURE p1; +DROP FUNCTION f1; +flush status; +show variables like "log_queries_not_using_indexes"; +Variable_name Value +log_queries_not_using_indexes ON +select 1 from information_schema.tables limit 1; +1 +1 +show status like 'slow_queries'; +Variable_name Value +Slow_queries 1 +set session log_queries_not_using_indexes=OFF; +show variables like "log_queries_not_using_indexes"; +Variable_name Value +log_queries_not_using_indexes OFF +select 1 from information_schema.tables limit 1; +1 +1 +show status like 'slow_queries'; +Variable_name Value +Slow_queries 1 +set session log_queries_not_using_indexes=ON; +show variables like "log_queries_not_using_indexes"; +Variable_name Value +log_queries_not_using_indexes ON +select 1 from information_schema.tables limit 1; +1 +1 +show status like 'slow_queries'; +Variable_name Value +Slow_queries 2 +show variables like 'myisam_recover_options'; +Variable_name Value +myisam_recover_options OFF +CREATE TABLE t1 ( +Codigo int(10) unsigned NOT NULL auto_increment, +Nombre varchar(255) default NULL, +Telefono varchar(255) default NULL, +Observaciones longtext, +Direccion varchar(255) default NULL, +Dni varchar(255) default NULL, +CP int(11) default NULL, +Provincia varchar(255) default NULL, +Poblacion varchar(255) default NULL, +PRIMARY KEY (Codigo) +) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; +show create table t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 192 2 N 1 39 33 +def Create Table 253 3072 458 N 1 39 33 +Table Create Table +t1 CREATE TABLE `t1` ( + `Codigo` int(10) unsigned NOT NULL AUTO_INCREMENT, + `Nombre` varchar(255) DEFAULT NULL, + `Telefono` varchar(255) DEFAULT NULL, + `Observaciones` longtext DEFAULT NULL, + `Direccion` varchar(255) DEFAULT NULL, + `Dni` varchar(255) DEFAULT NULL, + `CP` int(11) DEFAULT NULL, + `Provincia` varchar(255) DEFAULT NULL, + `Poblacion` varchar(255) DEFAULT NULL, + PRIMARY KEY (`Codigo`) +) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 +drop table t1; +End of 5.0 tests +SHOW AUTHORS; +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); +create user mysqltest_4@localhost; +grant select on `mysqltest`.`t1` to mysqltest_4@localhost; +connect con4,localhost,mysqltest_4,,mysqltest; +connection con4; +show create database mysqltest; +Database Create Database +mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */ +disconnect con4; +connection default; +delete from mysql.user where user='mysqltest_4'; +delete from mysql.db where user='mysqltest_4'; +delete from mysql.tables_priv where user='mysqltest_4'; +flush privileges; +drop database mysqltest; +show plugins; +create database `mysqlttest\1`; +create table `mysqlttest\1`.`a\b` (a int); +show tables from `mysqlttest\1`; +Tables_in_mysqlttest\1 +a\b +show fields from `mysqlttest\1`.`a\b`; +Field Type Null Key Default Extra +a int(11) YES NULL +show columns from `a\b` from `mysqlttest\1`; +Field Type Null Key Default Extra +a int(11) YES NULL +show keys from `mysqlttest\1`.`a\b`; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +drop table `mysqlttest\1`.`a\b`; +drop database `mysqlttest\1`; +show engine foobar status; +ERROR 42000: Unknown storage engine 'foobar' +show engine foobar logs; +ERROR 42000: Unknown storage engine 'foobar' +show engine foobar mutex; +ERROR 42000: Unknown storage engine 'foobar' +show engine mutex status; +ERROR 42000: Unknown storage engine 'mutex' +show engine csv status; +Type Name Status +show engine csv logs; +Type Name Status +show engine csv mutex; +Type Name Status +set names utf8; +drop table if exists `été`; +create table `été` (field1 int); +show full tables; +Tables_in_test Table_type +été BASE TABLE +drop table `été`; +set names latin1; +# +# Bug#4374 SHOW TABLE STATUS FROM ignores collation_connection +# Character set: Latin-1 (ISO-8859-1) +# +SET NAMES latin1; +CREATE DATABASE `�`; +CREATE TABLE `�`.`�` (a int) ENGINE=Memory; +SHOW TABLE STATUS FROM `�` LIKE '�'; +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 Max_index_length Temporary +� MEMORY 10 Fixed 0 # # # # 0 NULL # NULL NULL latin1_swedish_ci NULL 0 N +DROP DATABASE `�`; +show columns from `#mysql50#????????`; +Got one of the listed errors +call mtr.add_suppression("Can.t find file: '.\\\\test\\\\\\?{8}.frm'"); +DROP TABLE IF EXISTS t1; +DROP PROCEDURE IF EXISTS p1; +CREATE TABLE t1(c1 INT); +CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1; +SHOW CREATE TRIGGER t1_bi; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created +t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci # +CREATE PROCEDURE p1() SHOW CREATE TRIGGER t1_bi; +CALL p1(); +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created +t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci # +CALL p1(); +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created +t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci # +CALL p1(); +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created +t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci # +CALL p1(); +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created +t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci # +CALL p1(); +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created +t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci # +CALL p1(); +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created +t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci # +CALL p1(); +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created +t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci # +CALL p1(); +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created +t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci # +CALL p1(); +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created +t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci # +CALL p1(); +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created +t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci # +PREPARE stmt1 FROM 'SHOW CREATE TRIGGER t1_bi'; +EXECUTE stmt1; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created +t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci # +EXECUTE stmt1; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created +t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci # +EXECUTE stmt1; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created +t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci # +EXECUTE stmt1; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created +t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci # +EXECUTE stmt1; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created +t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci # +EXECUTE stmt1; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created +t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci # +EXECUTE stmt1; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created +t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci # +EXECUTE stmt1; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created +t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci # +EXECUTE stmt1; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created +t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci # +EXECUTE stmt1; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created +t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci # +DROP TABLE t1; +DROP PROCEDURE p1; +DEALLOCATE PREPARE stmt1; +set names koi8r; +DROP VIEW IF EXISTS v1; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +DROP TABLE IF EXISTS t1; +DROP EVENT IF EXISTS ev1; +CREATE VIEW v1 AS SELECT '����' AS test; +CREATE PROCEDURE p1() SELECT '����' AS test; +CREATE FUNCTION f1() RETURNS CHAR(10) RETURN '����'; +CREATE TABLE t1(c1 CHAR(10)); +CREATE TRIGGER t1_bi BEFORE INSERT ON t1 +FOR EACH ROW +SET NEW.c1 = '����'; +CREATE EVENT ev1 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO SELECT '����' AS test; ++Warnings: ++Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. +set names utf8; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'тест' AS `test` koi8r koi8r_general_ci +SHOW CREATE PROCEDURE p1; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() +SELECT 'тест' AS test koi8r koi8r_general_ci latin1_swedish_ci +SHOW CREATE FUNCTION f1; +Function sql_mode Create Function character_set_client collation_connection Database Collation +f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS char(10) CHARSET latin1 +RETURN 'тест' koi8r koi8r_general_ci latin1_swedish_ci +SHOW CREATE TRIGGER t1_bi; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created +t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 +FOR EACH ROW +SET NEW.c1 = 'тест' koi8r koi8r_general_ci latin1_swedish_ci # +SHOW CREATE EVENT ev1; +Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation +ev1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev1` ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO SELECT 'тест' AS test koi8r koi8r_general_ci latin1_swedish_ci +DROP VIEW v1; +DROP PROCEDURE p1; +DROP FUNCTION f1; +DROP TABLE t1; +DROP EVENT ev1; +SHOW STORAGE ENGINES; +CREATE USER test_u@localhost; +GRANT PROCESS ON *.* TO test_u@localhost; +connect conn1, localhost, test_u,,; +SHOW ENGINE MYISAM MUTEX; +SHOW ENGINE MYISAM STATUS; +disconnect conn1; +connection default; +DROP USER test_u@localhost; +End of 5.1 tests +# +# Bug#52593 SHOW CREATE TABLE is blocked if table is locked +# for write by another connection +DROP TABLE IF EXISTS t1; +connect con1, localhost,root; +connection default; +CREATE TABLE t1 (i INT PRIMARY KEY); +LOCK TABLE t1 WRITE; +connection con1; +# This statement used to be blocked. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `i` int(11) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +disconnect con1; +connection default; +UNLOCK TABLES; +DROP TABLE t1; +# +# Bug#54905 Connection with WRITE lock cannot ALTER table due to +# concurrent SHOW CREATE +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1(a INT); +connect con1,localhost,root; +LOCK TABLE t1 WRITE; +connection default; +START TRANSACTION; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +connection con1; +ALTER TABLE t1 CHARACTER SET = utf8; +UNLOCK TABLES; +connection default; +COMMIT; +disconnect con1; +DROP TABLE t1; +# +# Bug#55498 SHOW CREATE TRIGGER takes wrong type of metadata lock. +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a INT); +CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a = 1; +# Test 1: SHOW CREATE TRIGGER with WRITE locked table. +connect con1, localhost, root; +LOCK TABLE t1 WRITE; +connection default; +SHOW CREATE TRIGGER t1_bi; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created +t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a = 1 utf8 utf8_general_ci latin1_swedish_ci # +connection con1; +UNLOCK TABLES; +# Test 2: ALTER TABLE with SHOW CREATE TRIGGER in transaction +connection default; +START TRANSACTION; +SHOW CREATE TRIGGER t1_bi; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created +t1_bi STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a = 1 utf8 utf8_general_ci latin1_swedish_ci # +connection con1; +ALTER TABLE t1 CHARACTER SET = utf8; +disconnect con1; +connection default; +COMMIT; +DROP TRIGGER t1_bi; +DROP TABLE t1; +# +# Bug#57306 SHOW PROCESSLIST does not display string literals well. +# +SET NAMES latin1; +SELECT GET_LOCK('t', 1000); +GET_LOCK('t', 1000) +1 +connect con1,localhost,root,,; +connection con1; +SET NAMES latin1; +SELECT GET_LOCK('t',1000) AS 'óóóó';; +connection default; +SHOW PROCESSLIST; +Id User Host db Command Time State Info Progress +### root ### test Query ### ### SHOW PROCESSLIST 0.000 +### root ### test Query ### ### SELECT GET_LOCK('t',1000) AS 'óóóó' 0.000 +SET NAMES utf8; +SHOW PROCESSLIST; +Id User Host db Command Time State Info Progress +### root ### test Query ### ### SHOW PROCESSLIST 0.000 +### root ### test Query ### ### SELECT GET_LOCK('t',1000) AS 'óóóó' 0.000 +SELECT RELEASE_LOCK('t'); +RELEASE_LOCK('t') +1 +connection con1; +óóóó +1 +disconnect con1; +connection default; +SET NAMES latin1; +# +# Test SHOW AUTHORS and SHOW CONTRIBUTORS +# +SHOW AUTHORS; +SHOW WARNINGS; +Level Code Message +SHOW CONTRIBUTORS; +SHOW WARNINGS; +Level Code Message diff --cc mysql-test/main/ssl_verify_ip.opt index 00000000000,7b1c308e46b..7b1c308e46b mode 000000,100644..100644 --- a/mysql-test/main/ssl_verify_ip.opt +++ b/mysql-test/main/ssl_verify_ip.opt diff --cc mysql-test/main/ssl_verify_ip.result index 00000000000,98fb6a68656..98fb6a68656 mode 000000,100644..100644 --- a/mysql-test/main/ssl_verify_ip.result +++ b/mysql-test/main/ssl_verify_ip.result diff --cc mysql-test/main/ssl_verify_ip.test index 00000000000,2a2e780ecfc..2a2e780ecfc mode 000000,100644..100644 --- a/mysql-test/main/ssl_verify_ip.test +++ b/mysql-test/main/ssl_verify_ip.test diff --cc mysql-test/main/stat_tables.result index 7fd0b5902ec,00000000000..d224286056f mode 100644,000000..100644 --- a/mysql-test/main/stat_tables.result +++ b/mysql-test/main/stat_tables.result @@@ -1,754 -1,0 +1,772 @@@ +select @@global.use_stat_tables; +@@global.use_stat_tables +COMPLEMENTARY +select @@session.use_stat_tables; +@@session.use_stat_tables +COMPLEMENTARY +set @save_use_stat_tables=@@use_stat_tables; +set use_stat_tables='preferably'; +DROP DATABASE IF EXISTS dbt3_s001; +CREATE DATABASE dbt3_s001; +use dbt3_s001; +set @save_optimizer_switch=@@optimizer_switch; +set optimizer_switch='extended_keys=off'; +select * from mysql.table_stats; +db_name table_name cardinality +dbt3_s001 customer 150 +dbt3_s001 lineitem 6005 +dbt3_s001 nation 25 +dbt3_s001 orders 1500 +dbt3_s001 part 200 +dbt3_s001 partsupp 700 +dbt3_s001 region 5 +dbt3_s001 supplier 10 +select * from mysql.index_stats; +db_name table_name index_name prefix_arity avg_frequency +dbt3_s001 customer PRIMARY 1 1.0000 +dbt3_s001 customer i_c_nationkey 1 6.0000 +dbt3_s001 lineitem PRIMARY 1 4.0033 +dbt3_s001 lineitem PRIMARY 2 1.0000 +dbt3_s001 lineitem i_l_shipdate 1 2.6500 +dbt3_s001 lineitem i_l_suppkey_partkey 1 30.0250 +dbt3_s001 lineitem i_l_suppkey_partkey 2 8.5786 +dbt3_s001 lineitem i_l_partkey 1 30.0250 +dbt3_s001 lineitem i_l_suppkey 1 600.5000 +dbt3_s001 lineitem i_l_receiptdate 1 2.6477 +dbt3_s001 lineitem i_l_orderkey 1 4.0033 +dbt3_s001 lineitem i_l_orderkey_quantity 1 4.0033 +dbt3_s001 lineitem i_l_orderkey_quantity 2 1.0404 +dbt3_s001 lineitem i_l_commitdate 1 2.7160 +dbt3_s001 nation PRIMARY 1 1.0000 +dbt3_s001 nation i_n_regionkey 1 5.0000 +dbt3_s001 orders PRIMARY 1 1.0000 +dbt3_s001 orders i_o_orderdate 1 1.3321 +dbt3_s001 orders i_o_custkey 1 15.0000 +dbt3_s001 part PRIMARY 1 1.0000 +dbt3_s001 part i_p_retailprice 1 1.0000 +dbt3_s001 partsupp PRIMARY 1 3.5000 +dbt3_s001 partsupp PRIMARY 2 1.0000 +dbt3_s001 partsupp i_ps_partkey 1 3.5000 +dbt3_s001 partsupp i_ps_suppkey 1 70.0000 +dbt3_s001 region PRIMARY 1 1.0000 +dbt3_s001 supplier PRIMARY 1 1.0000 +dbt3_s001 supplier i_s_nationkey 1 1.1111 +set optimizer_switch=@save_optimizer_switch; +set @save_optimizer_switch=@@optimizer_switch; +set optimizer_switch='index_condition_pushdown=off'; +EXPLAIN select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue +from customer, orders, lineitem, supplier, nation, region +where c_custkey = o_custkey and l_orderkey = o_orderkey +and l_suppkey = s_suppkey and c_nationkey = s_nationkey +and s_nationkey = n_nationkey and n_regionkey = r_regionkey +and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01' + and o_orderdate < date '1995-01-01' + interval '1' year +group by n_name +order by revenue desc; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_custkey i_o_orderdate 4 NULL 179 Using where; Using temporary; Using filesort +1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where +1 SIMPLE nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1 +1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where +1 SIMPLE supplier eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.lineitem.l_suppkey 1 Using where +select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue +from customer, orders, lineitem, supplier, nation, region +where c_custkey = o_custkey and l_orderkey = o_orderkey +and l_suppkey = s_suppkey and c_nationkey = s_nationkey +and s_nationkey = n_nationkey and n_regionkey = r_regionkey +and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01' + and o_orderdate < date '1995-01-01' + interval '1' year +group by n_name +order by revenue desc; +n_name revenue +PERU 321915.8715 +ARGENTINA 69817.1451 +set optimizer_switch=@save_optimizer_switch; +delete from mysql.index_stats; +select * from mysql.table_stats; +db_name table_name cardinality +dbt3_s001 customer 150 +dbt3_s001 lineitem 6005 +dbt3_s001 nation 25 +dbt3_s001 orders 1500 +dbt3_s001 part 200 +dbt3_s001 partsupp 700 +dbt3_s001 region 5 +dbt3_s001 supplier 10 +select * from mysql.index_stats; +db_name table_name index_name prefix_arity avg_frequency +dbt3_s001 customer PRIMARY 1 1.0000 +dbt3_s001 customer i_c_nationkey 1 6.0000 +dbt3_s001 lineitem PRIMARY 1 4.0033 +dbt3_s001 lineitem PRIMARY 2 1.0000 +dbt3_s001 lineitem i_l_shipdate 1 2.6500 +dbt3_s001 lineitem i_l_suppkey_partkey 1 30.0250 +dbt3_s001 lineitem i_l_suppkey_partkey 2 8.5786 +dbt3_s001 lineitem i_l_partkey 1 30.0250 +dbt3_s001 lineitem i_l_suppkey 1 600.5000 +dbt3_s001 lineitem i_l_receiptdate 1 2.6477 +dbt3_s001 lineitem i_l_orderkey 1 4.0033 +dbt3_s001 lineitem i_l_orderkey_quantity 1 4.0033 +dbt3_s001 lineitem i_l_orderkey_quantity 2 1.0404 +dbt3_s001 lineitem i_l_commitdate 1 2.7160 +dbt3_s001 nation PRIMARY 1 1.0000 +dbt3_s001 nation i_n_regionkey 1 5.0000 +dbt3_s001 orders PRIMARY 1 1.0000 +dbt3_s001 orders i_o_orderdate 1 1.3321 +dbt3_s001 orders i_o_custkey 1 15.0000 +dbt3_s001 part PRIMARY 1 1.0000 +dbt3_s001 part i_p_retailprice 1 1.0000 +dbt3_s001 partsupp PRIMARY 1 3.5000 +dbt3_s001 partsupp PRIMARY 2 1.0000 +dbt3_s001 partsupp i_ps_partkey 1 3.5000 +dbt3_s001 partsupp i_ps_suppkey 1 70.0000 +dbt3_s001 region PRIMARY 1 1.0000 +dbt3_s001 supplier PRIMARY 1 1.0000 +dbt3_s001 supplier i_s_nationkey 1 1.1111 +select * from mysql.table_stats where table_name='orders'; +db_name table_name cardinality +dbt3_s001 orders 1500 +select * from mysql.index_stats where table_name='orders'; +db_name table_name index_name prefix_arity avg_frequency +dbt3_s001 orders PRIMARY 1 1.0000 +dbt3_s001 orders i_o_orderdate 1 1.3321 +dbt3_s001 orders i_o_custkey 1 15.0000 +select (select cardinality from mysql.table_stats where table_name='orders') / +(select avg_frequency from mysql.index_stats +where index_name='i_o_orderdate' and prefix_arity=1) as n_distinct; +n_distinct +1126.0416 +select count(distinct o_orderdate) from orders; +count(distinct o_orderdate) +1126 +select (select cardinality from mysql.table_stats where table_name='orders') / +(select avg_frequency from mysql.index_stats +where index_name='i_o_custkey' and prefix_arity=1) as n_distinct; +n_distinct +100.0000 +select count(distinct o_custkey) from orders; +count(distinct o_custkey) +100 +show index from orders; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +orders 0 PRIMARY 1 o_orderkey A 1500 NULL NULL BTREE +orders 1 i_o_orderdate 1 o_orderDATE A 1126 NULL NULL YES BTREE +orders 1 i_o_custkey 1 o_custkey A 100 NULL NULL YES BTREE +select index_name, column_name, cardinality from information_schema.statistics +where table_name='orders'; +index_name column_name cardinality +PRIMARY o_orderkey 1500 +i_o_orderdate o_orderDATE 1126 +i_o_custkey o_custkey 100 +set @save_optimizer_switch=@@optimizer_switch; +set optimizer_switch='index_condition_pushdown=off'; +EXPLAIN select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue +from customer, orders, lineitem, supplier, nation, region +where c_custkey = o_custkey and l_orderkey = o_orderkey +and l_suppkey = s_suppkey and c_nationkey = s_nationkey +and s_nationkey = n_nationkey and n_regionkey = r_regionkey +and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01' + and o_orderdate < date '1995-01-01' + interval '1' year +group by n_name +order by revenue desc; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_custkey i_o_orderdate 4 NULL 179 Using where; Using temporary; Using filesort +1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where +1 SIMPLE nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1 +1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where +1 SIMPLE supplier eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.lineitem.l_suppkey 1 Using where +select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue +from customer, orders, lineitem, supplier, nation, region +where c_custkey = o_custkey and l_orderkey = o_orderkey +and l_suppkey = s_suppkey and c_nationkey = s_nationkey +and s_nationkey = n_nationkey and n_regionkey = r_regionkey +and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01' + and o_orderdate < date '1995-01-01' + interval '1' year +group by n_name +order by revenue desc; +n_name revenue +PERU 321915.8715 +ARGENTINA 69817.1451 +set optimizer_switch=@save_optimizer_switch; +EXPLAIN select o_year, +sum(case when nation = 'UNITED STATES' then volume else 0 end) / +sum(volume) as mkt_share +from (select extract(year from o_orderdate) as o_year, +l_extendedprice * (1-l_discount) as volume, +n2.n_name as nation +from part, supplier, lineitem, orders, customer, +nation n1, nation n2, region +where p_partkey = l_partkey and s_suppkey = l_suppkey +and l_orderkey = o_orderkey and o_custkey = c_custkey +and c_nationkey = n1.n_nationkey and n1.n_regionkey = r_regionkey +and r_name = 'AMERICA' and s_nationkey = n2.n_nationkey +and o_orderdate between date '1995-01-01' and date '1996-12-31' + and p_type = 'STANDARD BRUSHED STEEL' ) as all_nations +group by o_year +order by o_year; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE orders ALL PRIMARY,i_o_orderdate,i_o_custkey NULL NULL NULL 1500 Using where; Using temporary; Using filesort +1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where +1 SIMPLE n1 eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1 +1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +1 SIMPLE lineitem ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where +1 SIMPLE part eq_ref PRIMARY PRIMARY 4 dbt3_s001.lineitem.l_partkey 1 Using where +1 SIMPLE supplier eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.lineitem.l_suppkey 1 Using where +1 SIMPLE n2 eq_ref PRIMARY PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 +select o_year, +sum(case when nation = 'UNITED STATES' then volume else 0 end) / +sum(volume) as mkt_share +from (select extract(year from o_orderdate) as o_year, +l_extendedprice * (1-l_discount) as volume, +n2.n_name as nation +from part, supplier, lineitem, orders, customer, +nation n1, nation n2, region +where p_partkey = l_partkey and s_suppkey = l_suppkey +and l_orderkey = o_orderkey and o_custkey = c_custkey +and c_nationkey = n1.n_nationkey and n1.n_regionkey = r_regionkey +and r_name = 'AMERICA' and s_nationkey = n2.n_nationkey +and o_orderdate between date '1995-01-01' and date '1996-12-31' + and p_type = 'STANDARD BRUSHED STEEL' ) as all_nations +group by o_year +order by o_year; +o_year mkt_share +1995 0.4495521838895718 +1996 0.024585468215352495 +EXPLAIN select nation, o_year, sum(amount) as sum_profit +from (select n_name as nation, +extract(year from o_orderdate) as o_year, +l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount +from part, supplier, lineitem, partsupp, orders, nation +where s_suppkey = l_suppkey and ps_suppkey = l_suppkey +and ps_partkey = l_partkey and p_partkey = l_partkey +and o_orderkey = l_orderkey and s_nationkey = n_nationkey +and p_name like '%green%') as profit +group by nation, o_year +order by nation, o_year desc; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE supplier ALL PRIMARY,i_s_nationkey NULL NULL NULL 10 Using where; Using temporary; Using filesort +1 SIMPLE nation eq_ref PRIMARY PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 +1 SIMPLE partsupp ref PRIMARY,i_ps_partkey,i_ps_suppkey i_ps_suppkey 4 dbt3_s001.supplier.s_suppkey 70 +1 SIMPLE part eq_ref PRIMARY PRIMARY 4 dbt3_s001.partsupp.ps_partkey 1 Using where +1 SIMPLE lineitem ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.supplier.s_suppkey 8 +1 SIMPLE orders eq_ref PRIMARY PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 +select nation, o_year, sum(amount) as sum_profit +from (select n_name as nation, +extract(year from o_orderdate) as o_year, +l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount +from part, supplier, lineitem, partsupp, orders, nation +where s_suppkey = l_suppkey and ps_suppkey = l_suppkey +and ps_partkey = l_partkey and p_partkey = l_partkey +and o_orderkey = l_orderkey and s_nationkey = n_nationkey +and p_name like '%green%') as profit +group by nation, o_year +order by nation, o_year desc; +nation o_year sum_profit +ARGENTINA 1997 18247.873399999993 +ARGENTINA 1996 7731.089399999995 +ARGENTINA 1995 134490.5697 +ARGENTINA 1994 36767.101500000004 +ARGENTINA 1993 35857.08 +ARGENTINA 1992 35740 +ETHIOPIA 1998 2758.7801999999992 +ETHIOPIA 1997 19419.294599999997 +ETHIOPIA 1995 51231.87439999999 +ETHIOPIA 1994 3578.9478999999974 +ETHIOPIA 1992 1525.8234999999986 +IRAN 1998 37817.229600000006 +IRAN 1997 52643.77359999999 +IRAN 1996 70143.7761 +IRAN 1995 84094.58260000001 +IRAN 1994 18140.925599999995 +IRAN 1993 78655.1676 +IRAN 1992 87142.23960000002 +IRAQ 1998 22860.8082 +IRAQ 1997 93676.24359999999 +IRAQ 1996 45103.3242 +IRAQ 1994 36010.728599999995 +IRAQ 1993 33221.9399 +IRAQ 1992 47755.05900000001 +KENYA 1998 44194.831999999995 +KENYA 1997 57578.36259999999 +KENYA 1996 59195.90210000001 +KENYA 1995 79262.6278 +KENYA 1994 102360.66609999999 +KENYA 1993 128422.0196 +KENYA 1992 181517.2089 +MOROCCO 1998 41797.823199999984 +MOROCCO 1997 23685.801799999994 +MOROCCO 1996 62115.19579999998 +MOROCCO 1995 42442.64300000001 +MOROCCO 1994 48655.878000000004 +MOROCCO 1993 22926.744400000003 +MOROCCO 1992 32239.8088 +PERU 1998 86999.36459999997 +PERU 1997 121110.41070000001 +PERU 1996 177040.40759999995 +PERU 1995 122247.94520000002 +PERU 1994 88046.25329999998 +PERU 1993 49379.813799999996 +PERU 1992 80646.86050000001 +UNITED KINGDOM 1998 50577.25560000001 +UNITED KINGDOM 1997 114288.8605 +UNITED KINGDOM 1996 147684.46480000002 +UNITED KINGDOM 1995 225267.65759999998 +UNITED KINGDOM 1994 140595.5864 +UNITED KINGDOM 1993 322548.49210000003 +UNITED KINGDOM 1992 67747.88279999999 +UNITED STATES 1998 3957.0431999999996 +UNITED STATES 1997 94729.5704 +UNITED STATES 1996 79297.85670000002 +UNITED STATES 1995 62201.23360000001 +UNITED STATES 1994 43075.629899999985 +UNITED STATES 1993 27168.486199999996 +UNITED STATES 1992 34092.366 +set @save_optimizer_switch=@@optimizer_switch; +set optimizer_switch='extended_keys=on'; +EXPLAIN select o_orderkey, p_partkey +from part, lineitem, orders +where p_retailprice > 1100 and o_orderdate='1997-01-01' +and o_orderkey=l_orderkey and p_partkey=l_partkey; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE orders ref PRIMARY,i_o_orderdate i_o_orderdate 4 const 1 +1 SIMPLE lineitem ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where +1 SIMPLE part eq_ref PRIMARY,i_p_retailprice PRIMARY 4 dbt3_s001.lineitem.l_partkey 1 Using where +select o_orderkey, p_partkey +from part, lineitem, orders +where p_retailprice > 1100 and o_orderdate='1997-01-01' +and o_orderkey=l_orderkey and p_partkey=l_partkey; +o_orderkey p_partkey +5895 200 +set optimizer_switch=@save_optimizer_switch; +DROP DATABASE dbt3_s001; +use test; +# +# Bug mdev-473: ANALYZE table locked for write +# +set use_stat_tables='complementary'; +create table t1 (i int); +lock table t1 write; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status Table is already up to date +alter table t1 add column a varchar(8); +drop table t1; +# +# Bug mdev-487: memory leak in ANALYZE with stat tables +# +SET use_stat_tables = 'preferably'; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +DELETE FROM t1 WHERE a=1; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +DROP TABLE t1; +# +# Bug mdev-518: corrupted/missing statistical tables +# +CREATE TABLE t1 (i int) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +FLUSH TABLE t1; +SET use_stat_tables='never'; +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 +FLUSH TABLES; +SET use_stat_tables='preferably'; +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 +DROP TABLE t1; +set use_stat_tables=@save_use_stat_tables; +# +# Bug mdev-5204: invalid impossible where after reading const tables +# when use_stat_tables = 'preferably' +# +set use_stat_tables = 'preferably'; +CREATE TABLE t1 (id int PRIMARY KEY) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +CREATE TABLE t2 (name char(3)) ENGINE=MyISAM; +ANALYZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status Table is already up to date +INSERT INTO t2 VALUES ('USA'),('AUS'); +SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 1; +id name +1 AUS +EXPLAIN +SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 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 +1 SIMPLE t2 ALL NULL NULL NULL NULL 0 Using where +ANALYZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK +SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 1; +id name +1 AUS +EXPLAIN +SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 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 +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where +DROP TABLE t1,t2; +# +# MDEV-7370: Server deadlocks on renaming a table for which persistent statistics exists +# +drop database if exists db1; +drop database if exists db1; +create database db1; +create database db2; +use db1; +# +# First, run the original testcase: +# +create table t1 (i int); +insert into t1 values (10),(20); +analyze table t1 persistent for all; +Table Op Msg_type Msg_text +db1.t1 analyze status Engine-independent statistics collected +db1.t1 analyze status OK +rename table t1 to db2.t1; +# Verify that stats in the old database are gone: +select * from mysql.column_stats where db_name='db1' and table_name='t1'; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +select * from mysql.table_stats where db_name='db1' and table_name='t1'; +db_name table_name cardinality +# Verify that stats are present in the new database: +select * from mysql.column_stats where db_name='db2' and table_name='t1'; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +db2 t1 i 10 20 0.0000 4.0000 1.0000 0 NULL NULL +select * from mysql.table_stats where db_name='db2' and table_name='t1'; +db_name table_name cardinality +db2 t1 2 +# +# Now, try with more than one column and with indexes: +# +use test; +create table t1(a int primary key); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +use db1; +create table t2 (a int, b int, c int, key IDX1(a), key IDX2(a,b)); +insert into t2 select a/10, a/2, a from test.t1; +analyze table t2 persistent for all; +Table Op Msg_type Msg_text +db1.t2 analyze status Engine-independent statistics collected +db1.t2 analyze status Table is already up to date +alter table t2 rename db2.t2; +# Verify that stats in the old database are gone: +select * from mysql.table_stats where db_name='db1' and table_name='t2'; +db_name table_name cardinality +select * from mysql.column_stats where db_name='db1' and table_name='t2'; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +select * from mysql.index_stats where db_name='db1' and table_name='t2'; +db_name table_name index_name prefix_arity avg_frequency +# Verify that stats are present in the new database: +select * from mysql.table_stats where db_name='db2' and table_name='t2'; +db_name table_name cardinality +db2 t2 10 +select * from mysql.column_stats where db_name='db2' and table_name='t2'; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +db2 t2 a 0 1 0.0000 4.0000 5.0000 0 NULL NULL +db2 t2 b 0 5 0.0000 4.0000 1.6667 0 NULL NULL +db2 t2 c 0 9 0.0000 4.0000 1.0000 0 NULL NULL +select * from mysql.index_stats where db_name='db2' and table_name='t2'; +db_name table_name index_name prefix_arity avg_frequency +db2 t2 IDX1 1 5.0000 +db2 t2 IDX2 1 5.0000 +db2 t2 IDX2 2 1.6667 +use db2; +# +# Now, rename within the same database and verify: +# +rename table t2 to t3; +# No stats under old name: +select * from mysql.table_stats where db_name='db2' and table_name='t2'; +db_name table_name cardinality +select * from mysql.column_stats where db_name='db2' and table_name='t2'; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +select * from mysql.index_stats where db_name='db2' and table_name='t2'; +db_name table_name index_name prefix_arity avg_frequency +# Stats under the new name: +select * from mysql.table_stats where db_name='db2' and table_name='t3'; +db_name table_name cardinality +db2 t3 10 +select * from mysql.column_stats where db_name='db2' and table_name='t3'; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +db2 t3 a 0 1 0.0000 4.0000 5.0000 0 NULL NULL +db2 t3 b 0 5 0.0000 4.0000 1.6667 0 NULL NULL +db2 t3 c 0 9 0.0000 4.0000 1.0000 0 NULL NULL +select * from mysql.index_stats where db_name='db2' and table_name='t3'; +db_name table_name index_name prefix_arity avg_frequency +db2 t3 IDX1 1 5.0000 +db2 t3 IDX2 1 5.0000 +db2 t3 IDX2 2 1.6667 +use test; +drop database db1; +drop database db2; +drop table t1; +# +# MDEV-16552: [10.0] ASAN global-buffer-overflow in is_stat_table / statistics_for_tables_is_needed +# +SET use_stat_tables = PREFERABLY; +SELECT CONVERT_TZ( '1991-09-20 10:11:02', '+00:00', 'GMT' ); +CONVERT_TZ( '1991-09-20 10:11:02', '+00:00', 'GMT' ) +NULL +set use_stat_tables=@save_use_stat_tables; +# +# MDEV-16757: manual addition of min/max statistics for BLOB +# +SET use_stat_tables= PREFERABLY; +CREATE TABLE t1 (pk INT PRIMARY KEY, t TEXT); +INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze Warning Engine-independent statistics are not collected for column 't' +test.t1 analyze status OK +SELECT * FROM mysql.column_stats; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL +DELETE FROM mysql.column_stats +WHERE db_name='test' AND table_name='t1' AND column_name='t'; +INSERT INTO mysql.column_stats VALUES +('test','t1','t','bar','foo', 0.0, 3.0, 1.0, 0, NULL, NULL); +SELECT * FROM mysql.column_stats; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL +test t1 t bar foo 0.0000 3.0000 1.0000 0 NULL NULL +SELECT pk FROM t1; +pk +1 +2 +DROP TABLE t1; +set use_stat_tables=@save_use_stat_tables; +# +# MDEV-16760: CREATE OR REPLACE TABLE after ANALYZE TABLE +# +SET use_stat_tables= PREFERABLY; +CREATE TABLE t1 (pk int PRIMARY KEY, c varchar(32)); +INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +SELECT * FROM t1; +pk c +1 foo +2 bar +SELECT * FROM mysql.column_stats; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL +test t1 c bar foo 0.0000 3.0000 1.0000 0 NULL NULL +CREATE OR REPLACE TABLE t1 (pk int PRIMARY KEY, a char(7)); +SELECT * FROM t1; +pk a +SELECT * FROM mysql.column_stats; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +DROP TABLE t1; +set use_stat_tables=@save_use_stat_tables; +# +# MDEV-17023: Crash during read_histogram_for_table with optimizer_use_condition_selectivity set to 4 +# +set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity; +set @@optimizer_use_condition_selectivity=4; +set @@use_stat_tables= PREFERABLY; +explain +SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE PROFILING ALL NULL NULL NULL NULL NULL +1 SIMPLE user ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) +set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +set use_stat_tables=@save_use_stat_tables; +# +# MDEV-17734: AddressSanitizer: use-after-poison in create_key_parts_for_pseudo_indexes +# +set @@use_stat_tables= PREFERABLY; +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @@optimizer_use_condition_selectivity=4; +set @save_use_stat_tables= @@use_stat_tables; +create table t1 (a int, b int); +insert into t1(a,b) values (1,2),(1,3),(1,4),(1,5),(2,6),(2,7),(3,8),(3,9),(3,9),(4,10); +analyze table t1 persistent for columns (a) indexes (); +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +select * from t1 where a=1 and b=3; +a b +1 3 +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +set use_stat_tables=@save_use_stat_tables; +drop table t1; +# +# MDEV-16711:CREATE OR REPLACE TABLE introducing BLOB column +# +SET use_stat_tables= PREFERABLY; +CREATE TABLE t1 (pk INT PRIMARY KEY, t CHAR(60)); +INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +CREATE OR REPLACE TABLE t1 (pk INT PRIMARY KEY, t TEXT); +SELECT MAX(pk) FROM t1; +MAX(pk) +NULL +DROP TABLE t1; +# +# MDEV-17605: SHOW INDEXES with use_stat_tables='preferably' +# +set use_stat_tables='preferably'; +CREATE DATABASE dbt3_s001; +use dbt3_s001; +set @save_optimizer_switch=@@optimizer_switch; +set optimizer_switch='extended_keys=off'; +select * from mysql.table_stats; +db_name table_name cardinality +dbt3_s001 lineitem 6005 +select * from mysql.index_stats; +db_name table_name index_name prefix_arity avg_frequency +dbt3_s001 lineitem PRIMARY 1 4.0033 +dbt3_s001 lineitem PRIMARY 2 1.0000 +dbt3_s001 lineitem i_l_shipdate 1 2.6500 +dbt3_s001 lineitem i_l_suppkey_partkey 1 30.0250 +dbt3_s001 lineitem i_l_suppkey_partkey 2 8.5786 +dbt3_s001 lineitem i_l_partkey 1 30.0250 +dbt3_s001 lineitem i_l_suppkey 1 600.5000 +dbt3_s001 lineitem i_l_receiptdate 1 2.6477 +dbt3_s001 lineitem i_l_orderkey 1 4.0033 +dbt3_s001 lineitem i_l_orderkey_quantity 1 4.0033 +dbt3_s001 lineitem i_l_orderkey_quantity 2 1.0404 +dbt3_s001 lineitem i_l_commitdate 1 2.7160 +SHOW INDEXES FROM lineitem; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +lineitem 0 PRIMARY 1 l_orderkey A 1500 NULL NULL BTREE +lineitem 0 PRIMARY 2 l_linenumber A 6005 NULL NULL BTREE +lineitem 1 i_l_shipdate 1 l_shipDATE A 2266 NULL NULL YES BTREE +lineitem 1 i_l_suppkey_partkey 1 l_partkey A 200 NULL NULL YES BTREE +lineitem 1 i_l_suppkey_partkey 2 l_suppkey A 699 NULL NULL YES BTREE +lineitem 1 i_l_partkey 1 l_partkey A 200 NULL NULL YES BTREE +lineitem 1 i_l_suppkey 1 l_suppkey A 10 NULL NULL YES BTREE +lineitem 1 i_l_receiptdate 1 l_receiptDATE A 2268 NULL NULL YES BTREE +lineitem 1 i_l_orderkey 1 l_orderkey A 1500 NULL NULL BTREE +lineitem 1 i_l_orderkey_quantity 1 l_orderkey A 1500 NULL NULL BTREE +lineitem 1 i_l_orderkey_quantity 2 l_quantity A 5771 NULL NULL YES BTREE +lineitem 1 i_l_commitdate 1 l_commitDATE A 2210 NULL NULL YES BTREE +SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE table_name='lineitem'; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT +def dbt3_s001 lineitem 0 dbt3_s001 PRIMARY 1 l_orderkey A 1500 NULL NULL BTREE +def dbt3_s001 lineitem 0 dbt3_s001 PRIMARY 2 l_linenumber A 6005 NULL NULL BTREE +def dbt3_s001 lineitem 1 dbt3_s001 i_l_shipdate 1 l_shipDATE A 2266 NULL NULL YES BTREE +def dbt3_s001 lineitem 1 dbt3_s001 i_l_suppkey_partkey 1 l_partkey A 200 NULL NULL YES BTREE +def dbt3_s001 lineitem 1 dbt3_s001 i_l_suppkey_partkey 2 l_suppkey A 699 NULL NULL YES BTREE +def dbt3_s001 lineitem 1 dbt3_s001 i_l_partkey 1 l_partkey A 200 NULL NULL YES BTREE +def dbt3_s001 lineitem 1 dbt3_s001 i_l_suppkey 1 l_suppkey A 10 NULL NULL YES BTREE +def dbt3_s001 lineitem 1 dbt3_s001 i_l_receiptdate 1 l_receiptDATE A 2268 NULL NULL YES BTREE +def dbt3_s001 lineitem 1 dbt3_s001 i_l_orderkey 1 l_orderkey A 1500 NULL NULL BTREE +def dbt3_s001 lineitem 1 dbt3_s001 i_l_orderkey_quantity 1 l_orderkey A 1500 NULL NULL BTREE +def dbt3_s001 lineitem 1 dbt3_s001 i_l_orderkey_quantity 2 l_quantity A 5771 NULL NULL YES BTREE +def dbt3_s001 lineitem 1 dbt3_s001 i_l_commitdate 1 l_commitDATE A 2210 NULL NULL YES BTREE +SELECT +COUNT(DISTINCT l_orderkey), COUNT(DISTINCT l_orderkey,l_linenumber), +COUNT(DISTINCT l_shipDATE), +COUNT(DISTINCT l_partkey), COUNT(DISTINCT l_partkey,l_suppkey), +COUNT(DISTINCT l_suppkey), COUNT(DISTINCT l_receiptDATE), +COUNT(DISTINCT l_orderkey, l_quantity), COUNT(DISTINCT l_commitDATE) +FROM lineitem; +COUNT(DISTINCT l_orderkey) COUNT(DISTINCT l_orderkey,l_linenumber) COUNT(DISTINCT l_shipDATE) COUNT(DISTINCT l_partkey) COUNT(DISTINCT l_partkey,l_suppkey) COUNT(DISTINCT l_suppkey) COUNT(DISTINCT l_receiptDATE) COUNT(DISTINCT l_orderkey, l_quantity) COUNT(DISTINCT l_commitDATE) +1500 6005 2266 200 700 10 2268 5772 2211 +set optimizer_switch=@save_optimizer_switch; +DROP DATABASE dbt3_s001; +USE test; +delete from mysql.table_stats; +delete from mysql.column_stats; +delete from mysql.index_stats; ++# ++# MDEV-19352: Server crash in alloc_histograms_for_table_share upon query from information schema ++# ++use test; ++set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; ++set @@optimizer_use_condition_selectivity= 4; ++set use_stat_tables='preferably'; ++CREATE TABLE t1 (a INT); ++CREATE TABLE t2 (b INT); ++CREATE VIEW v AS SELECT * FROM t1 JOIN t2; ++INSERT INTO t2 SELECT * FROM x; ++ERROR 42S02: Table 'test.x' doesn't exist ++select * from information_schema.tables where table_name='v'; ++TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT MAX_INDEX_LENGTH TEMPORARY ++def test v VIEW NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL VIEW NULL NULL ++drop table t1,t2; ++drop view v; ++set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +set @save_optimizer_switch=@@optimizer_switch; +set use_stat_tables=@save_use_stat_tables; +# +# MDEV-18899: Server crashes in Field::set_warning_truncated_wrong_value +# +set names utf8; +set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity; +set optimizer_use_condition_selectivity=4; +set use_stat_tables=preferably; +set @save_histogram_size= @@histogram_size; +set histogram_size=255; +create table t1 ( a varchar(255) character set utf8); +insert into t1 values (REPEAT('ӥ',255)), (REPEAT('ç',255)); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +select HEX(RIGHT(min_value, 1)), length(min_value) from mysql.column_stats where db_name='test' and table_name='t1'; +HEX(RIGHT(min_value, 1)) length(min_value) +A7 254 +select HEX(RIGHT(max_value, 1)), length(max_value) from mysql.column_stats where db_name='test' and table_name='t1'; +HEX(RIGHT(max_value, 1)) length(max_value) +A5 254 +analyze select * from t1 where a >= 'ӥ'; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 2.00 50.00 50.00 Using where +set @save_sql_mode= @@sql_mode; +set sql_mode='ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; +update mysql.column_stats set min_value= REPEAT('ӥ',255) where db_name='test' and table_name='t1'; +Warnings: +Warning 1265 Data truncated for column 'min_value' at row 1 +select HEX(RIGHT(min_value, 1)), length(min_value) from mysql.column_stats where db_name='test' and table_name='t1'; +HEX(RIGHT(min_value, 1)) length(min_value) +D3 255 +analyze select * from t1 where a >= 'ӥ'; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 2.00 50.00 50.00 Using where +set names latin1; +drop table t1; +CREATE TABLE t1 (col1 date); +INSERT INTO t1 VALUES('2004-01-01'),('2004-02-29'); +INSERT INTO t1 VALUES('0000-10-31'); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +update mysql.column_stats set min_value='2004-0-31123' where db_name='test' and table_name='t1'; +select min_value from mysql.column_stats where db_name='test' and table_name='t1'; +min_value +2004-0-31123 +select * from t1; +col1 +2004-01-01 +2004-02-29 +0000-10-31 +drop table t1; +set @@sql_mode= @save_sql_mode; +set use_stat_tables=@save_use_stat_tables; +set @@histogram_size= @save_histogram_size; +set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; diff --cc mysql-test/main/stat_tables_innodb.result index 2bc69c24104,00000000000..1d7e1b8f1b6 mode 100644,000000..100644 --- a/mysql-test/main/stat_tables_innodb.result +++ b/mysql-test/main/stat_tables_innodb.result @@@ -1,783 -1,0 +1,801 @@@ +SET SESSION STORAGE_ENGINE='InnoDB'; +set @save_optimizer_switch_for_stat_tables_test=@@optimizer_switch; +set optimizer_switch='extended_keys=on'; +select @@global.use_stat_tables; +@@global.use_stat_tables +COMPLEMENTARY +select @@session.use_stat_tables; +@@session.use_stat_tables +COMPLEMENTARY +set @save_use_stat_tables=@@use_stat_tables; +set use_stat_tables='preferably'; +DROP DATABASE IF EXISTS dbt3_s001; +CREATE DATABASE dbt3_s001; +use dbt3_s001; +set @save_optimizer_switch=@@optimizer_switch; +set optimizer_switch='extended_keys=off'; +select * from mysql.table_stats; +db_name table_name cardinality +dbt3_s001 customer 150 +dbt3_s001 lineitem 6005 +dbt3_s001 nation 25 +dbt3_s001 orders 1500 +dbt3_s001 part 200 +dbt3_s001 partsupp 700 +dbt3_s001 region 5 +dbt3_s001 supplier 10 +select * from mysql.index_stats; +db_name table_name index_name prefix_arity avg_frequency +dbt3_s001 customer PRIMARY 1 1.0000 +dbt3_s001 customer i_c_nationkey 1 6.0000 +dbt3_s001 lineitem PRIMARY 1 4.0033 +dbt3_s001 lineitem PRIMARY 2 1.0000 +dbt3_s001 lineitem i_l_shipdate 1 2.6500 +dbt3_s001 lineitem i_l_suppkey_partkey 1 30.0250 +dbt3_s001 lineitem i_l_suppkey_partkey 2 8.5786 +dbt3_s001 lineitem i_l_partkey 1 30.0250 +dbt3_s001 lineitem i_l_suppkey 1 600.5000 +dbt3_s001 lineitem i_l_receiptdate 1 2.6477 +dbt3_s001 lineitem i_l_orderkey 1 4.0033 +dbt3_s001 lineitem i_l_orderkey_quantity 1 4.0033 +dbt3_s001 lineitem i_l_orderkey_quantity 2 1.0404 +dbt3_s001 lineitem i_l_commitdate 1 2.7160 +dbt3_s001 nation PRIMARY 1 1.0000 +dbt3_s001 nation i_n_regionkey 1 5.0000 +dbt3_s001 orders PRIMARY 1 1.0000 +dbt3_s001 orders i_o_orderdate 1 1.3321 +dbt3_s001 orders i_o_custkey 1 15.0000 +dbt3_s001 part PRIMARY 1 1.0000 +dbt3_s001 part i_p_retailprice 1 1.0000 +dbt3_s001 partsupp PRIMARY 1 3.5000 +dbt3_s001 partsupp PRIMARY 2 1.0000 +dbt3_s001 partsupp i_ps_partkey 1 3.5000 +dbt3_s001 partsupp i_ps_suppkey 1 70.0000 +dbt3_s001 region PRIMARY 1 1.0000 +dbt3_s001 supplier PRIMARY 1 1.0000 +dbt3_s001 supplier i_s_nationkey 1 1.1111 +set optimizer_switch=@save_optimizer_switch; +set @save_optimizer_switch=@@optimizer_switch; +set optimizer_switch='index_condition_pushdown=off'; +EXPLAIN select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue +from customer, orders, lineitem, supplier, nation, region +where c_custkey = o_custkey and l_orderkey = o_orderkey +and l_suppkey = s_suppkey and c_nationkey = s_nationkey +and s_nationkey = n_nationkey and n_regionkey = r_regionkey +and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01' + and o_orderdate < date '1995-01-01' + interval '1' year +group by n_name +order by revenue desc; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_custkey i_o_orderdate 4 NULL 213 Using where; Using temporary; Using filesort +1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where +1 SIMPLE nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1 +1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.customer.c_nationkey 1 Using index +1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where +select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue +from customer, orders, lineitem, supplier, nation, region +where c_custkey = o_custkey and l_orderkey = o_orderkey +and l_suppkey = s_suppkey and c_nationkey = s_nationkey +and s_nationkey = n_nationkey and n_regionkey = r_regionkey +and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01' + and o_orderdate < date '1995-01-01' + interval '1' year +group by n_name +order by revenue desc; +n_name revenue +PERU 321915.8715 +ARGENTINA 69817.1451 +set optimizer_switch=@save_optimizer_switch; +delete from mysql.index_stats; +select * from mysql.table_stats; +db_name table_name cardinality +dbt3_s001 customer 150 +dbt3_s001 lineitem 6005 +dbt3_s001 nation 25 +dbt3_s001 orders 1500 +dbt3_s001 part 200 +dbt3_s001 partsupp 700 +dbt3_s001 region 5 +dbt3_s001 supplier 10 +select * from mysql.index_stats; +db_name table_name index_name prefix_arity avg_frequency +dbt3_s001 customer PRIMARY 1 1.0000 +dbt3_s001 customer i_c_nationkey 1 6.0000 +dbt3_s001 customer i_c_nationkey 2 1.0000 +dbt3_s001 lineitem PRIMARY 1 4.0033 +dbt3_s001 lineitem PRIMARY 2 1.0000 +dbt3_s001 lineitem i_l_shipdate 1 2.6500 +dbt3_s001 lineitem i_l_shipdate 2 1.0149 +dbt3_s001 lineitem i_l_shipdate 3 1.0000 +dbt3_s001 lineitem i_l_suppkey_partkey 1 30.0250 +dbt3_s001 lineitem i_l_suppkey_partkey 2 8.5786 +dbt3_s001 lineitem i_l_suppkey_partkey 3 1.0030 +dbt3_s001 lineitem i_l_suppkey_partkey 4 1.0000 +dbt3_s001 lineitem i_l_partkey 1 30.0250 +dbt3_s001 lineitem i_l_partkey 2 1.0089 +dbt3_s001 lineitem i_l_partkey 3 1.0000 +dbt3_s001 lineitem i_l_suppkey 1 600.5000 +dbt3_s001 lineitem i_l_suppkey 2 1.2073 +dbt3_s001 lineitem i_l_suppkey 3 1.0000 +dbt3_s001 lineitem i_l_receiptdate 1 2.6477 +dbt3_s001 lineitem i_l_receiptdate 2 1.0152 +dbt3_s001 lineitem i_l_receiptdate 3 1.0000 +dbt3_s001 lineitem i_l_orderkey 1 4.0033 +dbt3_s001 lineitem i_l_orderkey 2 1.0000 +dbt3_s001 lineitem i_l_orderkey_quantity 1 4.0033 +dbt3_s001 lineitem i_l_orderkey_quantity 2 1.0404 +dbt3_s001 lineitem i_l_orderkey_quantity 3 1.0000 +dbt3_s001 lineitem i_l_commitdate 1 2.7160 +dbt3_s001 lineitem i_l_commitdate 2 1.0364 +dbt3_s001 lineitem i_l_commitdate 3 1.0000 +dbt3_s001 nation PRIMARY 1 1.0000 +dbt3_s001 nation i_n_regionkey 1 5.0000 +dbt3_s001 nation i_n_regionkey 2 1.0000 +dbt3_s001 orders PRIMARY 1 1.0000 +dbt3_s001 orders i_o_orderdate 1 1.3321 +dbt3_s001 orders i_o_orderdate 2 1.0000 +dbt3_s001 orders i_o_custkey 1 15.0000 +dbt3_s001 orders i_o_custkey 2 1.0000 +dbt3_s001 part PRIMARY 1 1.0000 +dbt3_s001 part i_p_retailprice 1 1.0000 +dbt3_s001 part i_p_retailprice 2 1.0000 +dbt3_s001 partsupp PRIMARY 1 3.5000 +dbt3_s001 partsupp PRIMARY 2 1.0000 +dbt3_s001 partsupp i_ps_partkey 1 3.5000 +dbt3_s001 partsupp i_ps_partkey 2 1.0000 +dbt3_s001 partsupp i_ps_suppkey 1 70.0000 +dbt3_s001 partsupp i_ps_suppkey 2 1.0000 +dbt3_s001 region PRIMARY 1 1.0000 +dbt3_s001 supplier PRIMARY 1 1.0000 +dbt3_s001 supplier i_s_nationkey 1 1.1111 +dbt3_s001 supplier i_s_nationkey 2 1.0000 +select * from mysql.table_stats where table_name='orders'; +db_name table_name cardinality +dbt3_s001 orders 1500 +select * from mysql.index_stats where table_name='orders'; +db_name table_name index_name prefix_arity avg_frequency +dbt3_s001 orders PRIMARY 1 1.0000 +dbt3_s001 orders i_o_orderdate 1 1.3321 +dbt3_s001 orders i_o_orderdate 2 1.0000 +dbt3_s001 orders i_o_custkey 1 15.0000 +dbt3_s001 orders i_o_custkey 2 1.0000 +select (select cardinality from mysql.table_stats where table_name='orders') / +(select avg_frequency from mysql.index_stats +where index_name='i_o_orderdate' and prefix_arity=1) as n_distinct; +n_distinct +1126.0416 +select count(distinct o_orderdate) from orders; +count(distinct o_orderdate) +1126 +select (select cardinality from mysql.table_stats where table_name='orders') / +(select avg_frequency from mysql.index_stats +where index_name='i_o_custkey' and prefix_arity=1) as n_distinct; +n_distinct +100.0000 +select count(distinct o_custkey) from orders; +count(distinct o_custkey) +100 +show index from orders; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +orders 0 PRIMARY 1 o_orderkey A 1500 NULL NULL BTREE +orders 1 i_o_orderdate 1 o_orderDATE A 1126 NULL NULL YES BTREE +orders 1 i_o_custkey 1 o_custkey A 100 NULL NULL YES BTREE +select index_name, column_name, cardinality from information_schema.statistics +where table_name='orders'; +index_name column_name cardinality +PRIMARY o_orderkey 1500 +i_o_orderdate o_orderDATE 1126 +i_o_custkey o_custkey 100 +set @save_optimizer_switch=@@optimizer_switch; +set optimizer_switch='index_condition_pushdown=off'; +EXPLAIN select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue +from customer, orders, lineitem, supplier, nation, region +where c_custkey = o_custkey and l_orderkey = o_orderkey +and l_suppkey = s_suppkey and c_nationkey = s_nationkey +and s_nationkey = n_nationkey and n_regionkey = r_regionkey +and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01' + and o_orderdate < date '1995-01-01' + interval '1' year +group by n_name +order by revenue desc; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_custkey i_o_orderdate 4 NULL 213 Using where; Using temporary; Using filesort +1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where +1 SIMPLE nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1 +1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.customer.c_nationkey 1 Using index +1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where +select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue +from customer, orders, lineitem, supplier, nation, region +where c_custkey = o_custkey and l_orderkey = o_orderkey +and l_suppkey = s_suppkey and c_nationkey = s_nationkey +and s_nationkey = n_nationkey and n_regionkey = r_regionkey +and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01' + and o_orderdate < date '1995-01-01' + interval '1' year +group by n_name +order by revenue desc; +n_name revenue +PERU 321915.8715 +ARGENTINA 69817.1451 +set optimizer_switch=@save_optimizer_switch; +EXPLAIN select o_year, +sum(case when nation = 'UNITED STATES' then volume else 0 end) / +sum(volume) as mkt_share +from (select extract(year from o_orderdate) as o_year, +l_extendedprice * (1-l_discount) as volume, +n2.n_name as nation +from part, supplier, lineitem, orders, customer, +nation n1, nation n2, region +where p_partkey = l_partkey and s_suppkey = l_suppkey +and l_orderkey = o_orderkey and o_custkey = c_custkey +and c_nationkey = n1.n_nationkey and n1.n_regionkey = r_regionkey +and r_name = 'AMERICA' and s_nationkey = n2.n_nationkey +and o_orderdate between date '1995-01-01' and date '1996-12-31' + and p_type = 'STANDARD BRUSHED STEEL' ) as all_nations +group by o_year +order by o_year; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE orders ALL PRIMARY,i_o_orderdate,i_o_custkey NULL NULL NULL 1500 Using where; Using temporary; Using filesort +1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where +1 SIMPLE n1 eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1 +1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +1 SIMPLE lineitem ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where +1 SIMPLE part eq_ref PRIMARY PRIMARY 4 dbt3_s001.lineitem.l_partkey 1 Using where +1 SIMPLE supplier eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.lineitem.l_suppkey 1 Using where +1 SIMPLE n2 eq_ref PRIMARY PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 +select o_year, +sum(case when nation = 'UNITED STATES' then volume else 0 end) / +sum(volume) as mkt_share +from (select extract(year from o_orderdate) as o_year, +l_extendedprice * (1-l_discount) as volume, +n2.n_name as nation +from part, supplier, lineitem, orders, customer, +nation n1, nation n2, region +where p_partkey = l_partkey and s_suppkey = l_suppkey +and l_orderkey = o_orderkey and o_custkey = c_custkey +and c_nationkey = n1.n_nationkey and n1.n_regionkey = r_regionkey +and r_name = 'AMERICA' and s_nationkey = n2.n_nationkey +and o_orderdate between date '1995-01-01' and date '1996-12-31' + and p_type = 'STANDARD BRUSHED STEEL' ) as all_nations +group by o_year +order by o_year; +o_year mkt_share +1995 0.4495521838895718 +1996 0.024585468215352495 +EXPLAIN select nation, o_year, sum(amount) as sum_profit +from (select n_name as nation, +extract(year from o_orderdate) as o_year, +l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount +from part, supplier, lineitem, partsupp, orders, nation +where s_suppkey = l_suppkey and ps_suppkey = l_suppkey +and ps_partkey = l_partkey and p_partkey = l_partkey +and o_orderkey = l_orderkey and s_nationkey = n_nationkey +and p_name like '%green%') as profit +group by nation, o_year +order by nation, o_year desc; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE supplier index PRIMARY,i_s_nationkey i_s_nationkey 5 NULL 10 Using where; Using index; Using temporary; Using filesort +1 SIMPLE nation eq_ref PRIMARY PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 +1 SIMPLE partsupp ref PRIMARY,i_ps_partkey,i_ps_suppkey i_ps_suppkey 4 dbt3_s001.supplier.s_suppkey 70 +1 SIMPLE part eq_ref PRIMARY PRIMARY 4 dbt3_s001.partsupp.ps_partkey 1 Using where +1 SIMPLE lineitem ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_suppkey_partkey 10 dbt3_s001.partsupp.ps_partkey,dbt3_s001.supplier.s_suppkey 8 +1 SIMPLE orders eq_ref PRIMARY PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 +select nation, o_year, sum(amount) as sum_profit +from (select n_name as nation, +extract(year from o_orderdate) as o_year, +l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount +from part, supplier, lineitem, partsupp, orders, nation +where s_suppkey = l_suppkey and ps_suppkey = l_suppkey +and ps_partkey = l_partkey and p_partkey = l_partkey +and o_orderkey = l_orderkey and s_nationkey = n_nationkey +and p_name like '%green%') as profit +group by nation, o_year +order by nation, o_year desc; +nation o_year sum_profit +ARGENTINA 1997 18247.873399999993 +ARGENTINA 1996 7731.089399999995 +ARGENTINA 1995 134490.5697 +ARGENTINA 1994 36767.101500000004 +ARGENTINA 1993 35857.08 +ARGENTINA 1992 35740 +ETHIOPIA 1998 2758.7801999999992 +ETHIOPIA 1997 19419.294599999997 +ETHIOPIA 1995 51231.87439999999 +ETHIOPIA 1994 3578.9478999999974 +ETHIOPIA 1992 1525.8234999999986 +IRAN 1998 37817.229600000006 +IRAN 1997 52643.77359999999 +IRAN 1996 70143.7761 +IRAN 1995 84094.58260000001 +IRAN 1994 18140.925599999995 +IRAN 1993 78655.1676 +IRAN 1992 87142.23960000002 +IRAQ 1998 22860.8082 +IRAQ 1997 93676.24359999999 +IRAQ 1996 45103.3242 +IRAQ 1994 36010.728599999995 +IRAQ 1993 33221.9399 +IRAQ 1992 47755.05900000001 +KENYA 1998 44194.831999999995 +KENYA 1997 57578.36259999999 +KENYA 1996 59195.90210000001 +KENYA 1995 79262.6278 +KENYA 1994 102360.66609999999 +KENYA 1993 128422.0196 +KENYA 1992 181517.2089 +MOROCCO 1998 41797.823199999984 +MOROCCO 1997 23685.801799999994 +MOROCCO 1996 62115.19579999998 +MOROCCO 1995 42442.64300000001 +MOROCCO 1994 48655.878000000004 +MOROCCO 1993 22926.744400000003 +MOROCCO 1992 32239.8088 +PERU 1998 86999.36459999997 +PERU 1997 121110.41070000001 +PERU 1996 177040.40759999995 +PERU 1995 122247.94520000002 +PERU 1994 88046.25329999998 +PERU 1993 49379.813799999996 +PERU 1992 80646.86050000001 +UNITED KINGDOM 1998 50577.25560000001 +UNITED KINGDOM 1997 114288.8605 +UNITED KINGDOM 1996 147684.46480000002 +UNITED KINGDOM 1995 225267.65759999998 +UNITED KINGDOM 1994 140595.5864 +UNITED KINGDOM 1993 322548.49210000003 +UNITED KINGDOM 1992 67747.88279999999 +UNITED STATES 1998 3957.0431999999996 +UNITED STATES 1997 94729.5704 +UNITED STATES 1996 79297.85670000002 +UNITED STATES 1995 62201.23360000001 +UNITED STATES 1994 43075.629899999985 +UNITED STATES 1993 27168.486199999996 +UNITED STATES 1992 34092.366 +set @save_optimizer_switch=@@optimizer_switch; +set optimizer_switch='extended_keys=on'; +EXPLAIN select o_orderkey, p_partkey +from part, lineitem, orders +where p_retailprice > 1100 and o_orderdate='1997-01-01' +and o_orderkey=l_orderkey and p_partkey=l_partkey; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE part range PRIMARY,i_p_retailprice i_p_retailprice 9 NULL 1 Using where; Using index +1 SIMPLE orders ref PRIMARY,i_o_orderdate i_o_orderdate 4 const 1 Using index +1 SIMPLE lineitem ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_orderkey,i_l_orderkey_quantity i_l_partkey 9 dbt3_s001.part.p_partkey,dbt3_s001.orders.o_orderkey 1 Using index +select o_orderkey, p_partkey +from part, lineitem, orders +where p_retailprice > 1100 and o_orderdate='1997-01-01' +and o_orderkey=l_orderkey and p_partkey=l_partkey; +o_orderkey p_partkey +5895 200 +set optimizer_switch=@save_optimizer_switch; +DROP DATABASE dbt3_s001; +use test; +# +# Bug mdev-473: ANALYZE table locked for write +# +set use_stat_tables='complementary'; +create table t1 (i int); +lock table t1 write; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +alter table t1 add column a varchar(8); +drop table t1; +# +# Bug mdev-487: memory leak in ANALYZE with stat tables +# +SET use_stat_tables = 'preferably'; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +DELETE FROM t1 WHERE a=1; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +DROP TABLE t1; +# +# Bug mdev-518: corrupted/missing statistical tables +# +CREATE TABLE t1 (i int) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +FLUSH TABLE t1; +SET use_stat_tables='never'; +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 +FLUSH TABLES; +SET use_stat_tables='preferably'; +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 +DROP TABLE t1; +set use_stat_tables=@save_use_stat_tables; +# +# Bug mdev-5204: invalid impossible where after reading const tables +# when use_stat_tables = 'preferably' +# +set use_stat_tables = 'preferably'; +CREATE TABLE t1 (id int PRIMARY KEY) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +CREATE TABLE t2 (name char(3)) ENGINE=MyISAM; +ANALYZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status Table is already up to date +INSERT INTO t2 VALUES ('USA'),('AUS'); +SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 1; +id name +1 AUS +EXPLAIN +SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 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 +1 SIMPLE t2 ALL NULL NULL NULL NULL 0 Using where +ANALYZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK +SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 1; +id name +1 AUS +EXPLAIN +SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 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 +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where +DROP TABLE t1,t2; +# +# MDEV-7370: Server deadlocks on renaming a table for which persistent statistics exists +# +drop database if exists db1; +drop database if exists db1; +create database db1; +create database db2; +use db1; +# +# First, run the original testcase: +# +create table t1 (i int); +insert into t1 values (10),(20); +analyze table t1 persistent for all; +Table Op Msg_type Msg_text +db1.t1 analyze status Engine-independent statistics collected +db1.t1 analyze status OK +rename table t1 to db2.t1; +# Verify that stats in the old database are gone: +select * from mysql.column_stats where db_name='db1' and table_name='t1'; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +select * from mysql.table_stats where db_name='db1' and table_name='t1'; +db_name table_name cardinality +# Verify that stats are present in the new database: +select * from mysql.column_stats where db_name='db2' and table_name='t1'; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +db2 t1 i 10 20 0.0000 4.0000 1.0000 0 NULL NULL +select * from mysql.table_stats where db_name='db2' and table_name='t1'; +db_name table_name cardinality +db2 t1 2 +# +# Now, try with more than one column and with indexes: +# +use test; +create table t1(a int primary key); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +use db1; +create table t2 (a int, b int, c int, key IDX1(a), key IDX2(a,b)); +insert into t2 select a/10, a/2, a from test.t1; +analyze table t2 persistent for all; +Table Op Msg_type Msg_text +db1.t2 analyze status Engine-independent statistics collected +db1.t2 analyze status OK +alter table t2 rename db2.t2; +# Verify that stats in the old database are gone: +select * from mysql.table_stats where db_name='db1' and table_name='t2'; +db_name table_name cardinality +select * from mysql.column_stats where db_name='db1' and table_name='t2'; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +select * from mysql.index_stats where db_name='db1' and table_name='t2'; +db_name table_name index_name prefix_arity avg_frequency +# Verify that stats are present in the new database: +select * from mysql.table_stats where db_name='db2' and table_name='t2'; +db_name table_name cardinality +db2 t2 10 +select * from mysql.column_stats where db_name='db2' and table_name='t2'; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +db2 t2 a 0 1 0.0000 4.0000 5.0000 0 NULL NULL +db2 t2 b 0 5 0.0000 4.0000 1.6667 0 NULL NULL +db2 t2 c 0 9 0.0000 4.0000 1.0000 0 NULL NULL +select * from mysql.index_stats where db_name='db2' and table_name='t2'; +db_name table_name index_name prefix_arity avg_frequency +db2 t2 IDX1 1 5.0000 +db2 t2 IDX2 1 5.0000 +db2 t2 IDX2 2 1.6667 +use db2; +# +# Now, rename within the same database and verify: +# +rename table t2 to t3; +# No stats under old name: +select * from mysql.table_stats where db_name='db2' and table_name='t2'; +db_name table_name cardinality +select * from mysql.column_stats where db_name='db2' and table_name='t2'; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +select * from mysql.index_stats where db_name='db2' and table_name='t2'; +db_name table_name index_name prefix_arity avg_frequency +# Stats under the new name: +select * from mysql.table_stats where db_name='db2' and table_name='t3'; +db_name table_name cardinality +db2 t3 10 +select * from mysql.column_stats where db_name='db2' and table_name='t3'; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +db2 t3 a 0 1 0.0000 4.0000 5.0000 0 NULL NULL +db2 t3 b 0 5 0.0000 4.0000 1.6667 0 NULL NULL +db2 t3 c 0 9 0.0000 4.0000 1.0000 0 NULL NULL +select * from mysql.index_stats where db_name='db2' and table_name='t3'; +db_name table_name index_name prefix_arity avg_frequency +db2 t3 IDX1 1 5.0000 +db2 t3 IDX2 1 5.0000 +db2 t3 IDX2 2 1.6667 +use test; +drop database db1; +drop database db2; +drop table t1; +# +# MDEV-16552: [10.0] ASAN global-buffer-overflow in is_stat_table / statistics_for_tables_is_needed +# +SET use_stat_tables = PREFERABLY; +SELECT CONVERT_TZ( '1991-09-20 10:11:02', '+00:00', 'GMT' ); +CONVERT_TZ( '1991-09-20 10:11:02', '+00:00', 'GMT' ) +NULL +set use_stat_tables=@save_use_stat_tables; +# +# MDEV-16757: manual addition of min/max statistics for BLOB +# +SET use_stat_tables= PREFERABLY; +CREATE TABLE t1 (pk INT PRIMARY KEY, t TEXT); +INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze Warning Engine-independent statistics are not collected for column 't' +test.t1 analyze status OK +SELECT * FROM mysql.column_stats; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL +DELETE FROM mysql.column_stats +WHERE db_name='test' AND table_name='t1' AND column_name='t'; +INSERT INTO mysql.column_stats VALUES +('test','t1','t','bar','foo', 0.0, 3.0, 1.0, 0, NULL, NULL); +SELECT * FROM mysql.column_stats; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL +test t1 t bar foo 0.0000 3.0000 1.0000 0 NULL NULL +SELECT pk FROM t1; +pk +1 +2 +DROP TABLE t1; +set use_stat_tables=@save_use_stat_tables; +# +# MDEV-16760: CREATE OR REPLACE TABLE after ANALYZE TABLE +# +SET use_stat_tables= PREFERABLY; +CREATE TABLE t1 (pk int PRIMARY KEY, c varchar(32)); +INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +SELECT * FROM t1; +pk c +1 foo +2 bar +SELECT * FROM mysql.column_stats; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL +test t1 c bar foo 0.0000 3.0000 1.0000 0 NULL NULL +CREATE OR REPLACE TABLE t1 (pk int PRIMARY KEY, a char(7)); +SELECT * FROM t1; +pk a +SELECT * FROM mysql.column_stats; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +DROP TABLE t1; +set use_stat_tables=@save_use_stat_tables; +# +# MDEV-17023: Crash during read_histogram_for_table with optimizer_use_condition_selectivity set to 4 +# +set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity; +set @@optimizer_use_condition_selectivity=4; +set @@use_stat_tables= PREFERABLY; +explain +SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE PROFILING ALL NULL NULL NULL NULL NULL +1 SIMPLE user ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) +set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +set use_stat_tables=@save_use_stat_tables; +# +# MDEV-17734: AddressSanitizer: use-after-poison in create_key_parts_for_pseudo_indexes +# +set @@use_stat_tables= PREFERABLY; +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @@optimizer_use_condition_selectivity=4; +set @save_use_stat_tables= @@use_stat_tables; +create table t1 (a int, b int); +insert into t1(a,b) values (1,2),(1,3),(1,4),(1,5),(2,6),(2,7),(3,8),(3,9),(3,9),(4,10); +analyze table t1 persistent for columns (a) indexes (); +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +select * from t1 where a=1 and b=3; +a b +1 3 +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +set use_stat_tables=@save_use_stat_tables; +drop table t1; +# +# MDEV-16711:CREATE OR REPLACE TABLE introducing BLOB column +# +SET use_stat_tables= PREFERABLY; +CREATE TABLE t1 (pk INT PRIMARY KEY, t CHAR(60)); +INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +CREATE OR REPLACE TABLE t1 (pk INT PRIMARY KEY, t TEXT); +SELECT MAX(pk) FROM t1; +MAX(pk) +NULL +DROP TABLE t1; +# +# MDEV-17605: SHOW INDEXES with use_stat_tables='preferably' +# +set use_stat_tables='preferably'; +CREATE DATABASE dbt3_s001; +use dbt3_s001; +set @save_optimizer_switch=@@optimizer_switch; +set optimizer_switch='extended_keys=off'; +select * from mysql.table_stats; +db_name table_name cardinality +dbt3_s001 lineitem 6005 +select * from mysql.index_stats; +db_name table_name index_name prefix_arity avg_frequency +dbt3_s001 lineitem PRIMARY 1 4.0033 +dbt3_s001 lineitem PRIMARY 2 1.0000 +dbt3_s001 lineitem i_l_shipdate 1 2.6500 +dbt3_s001 lineitem i_l_suppkey_partkey 1 30.0250 +dbt3_s001 lineitem i_l_suppkey_partkey 2 8.5786 +dbt3_s001 lineitem i_l_partkey 1 30.0250 +dbt3_s001 lineitem i_l_suppkey 1 600.5000 +dbt3_s001 lineitem i_l_receiptdate 1 2.6477 +dbt3_s001 lineitem i_l_orderkey 1 4.0033 +dbt3_s001 lineitem i_l_orderkey_quantity 1 4.0033 +dbt3_s001 lineitem i_l_orderkey_quantity 2 1.0404 +dbt3_s001 lineitem i_l_commitdate 1 2.7160 +SHOW INDEXES FROM lineitem; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +lineitem 0 PRIMARY 1 l_orderkey A 1500 NULL NULL BTREE +lineitem 0 PRIMARY 2 l_linenumber A 6005 NULL NULL BTREE +lineitem 1 i_l_shipdate 1 l_shipDATE A 2266 NULL NULL YES BTREE +lineitem 1 i_l_suppkey_partkey 1 l_partkey A 200 NULL NULL YES BTREE +lineitem 1 i_l_suppkey_partkey 2 l_suppkey A 699 NULL NULL YES BTREE +lineitem 1 i_l_partkey 1 l_partkey A 200 NULL NULL YES BTREE +lineitem 1 i_l_suppkey 1 l_suppkey A 10 NULL NULL YES BTREE +lineitem 1 i_l_receiptdate 1 l_receiptDATE A 2268 NULL NULL YES BTREE +lineitem 1 i_l_orderkey 1 l_orderkey A 1500 NULL NULL BTREE +lineitem 1 i_l_orderkey_quantity 1 l_orderkey A 1500 NULL NULL BTREE +lineitem 1 i_l_orderkey_quantity 2 l_quantity A 5771 NULL NULL YES BTREE +lineitem 1 i_l_commitdate 1 l_commitDATE A 2210 NULL NULL YES BTREE +SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE table_name='lineitem'; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT +def dbt3_s001 lineitem 0 dbt3_s001 PRIMARY 1 l_orderkey A 1500 NULL NULL BTREE +def dbt3_s001 lineitem 0 dbt3_s001 PRIMARY 2 l_linenumber A 6005 NULL NULL BTREE +def dbt3_s001 lineitem 1 dbt3_s001 i_l_shipdate 1 l_shipDATE A 2266 NULL NULL YES BTREE +def dbt3_s001 lineitem 1 dbt3_s001 i_l_suppkey_partkey 1 l_partkey A 200 NULL NULL YES BTREE +def dbt3_s001 lineitem 1 dbt3_s001 i_l_suppkey_partkey 2 l_suppkey A 699 NULL NULL YES BTREE +def dbt3_s001 lineitem 1 dbt3_s001 i_l_partkey 1 l_partkey A 200 NULL NULL YES BTREE +def dbt3_s001 lineitem 1 dbt3_s001 i_l_suppkey 1 l_suppkey A 10 NULL NULL YES BTREE +def dbt3_s001 lineitem 1 dbt3_s001 i_l_receiptdate 1 l_receiptDATE A 2268 NULL NULL YES BTREE +def dbt3_s001 lineitem 1 dbt3_s001 i_l_orderkey 1 l_orderkey A 1500 NULL NULL BTREE +def dbt3_s001 lineitem 1 dbt3_s001 i_l_orderkey_quantity 1 l_orderkey A 1500 NULL NULL BTREE +def dbt3_s001 lineitem 1 dbt3_s001 i_l_orderkey_quantity 2 l_quantity A 5771 NULL NULL YES BTREE +def dbt3_s001 lineitem 1 dbt3_s001 i_l_commitdate 1 l_commitDATE A 2210 NULL NULL YES BTREE +SELECT +COUNT(DISTINCT l_orderkey), COUNT(DISTINCT l_orderkey,l_linenumber), +COUNT(DISTINCT l_shipDATE), +COUNT(DISTINCT l_partkey), COUNT(DISTINCT l_partkey,l_suppkey), +COUNT(DISTINCT l_suppkey), COUNT(DISTINCT l_receiptDATE), +COUNT(DISTINCT l_orderkey, l_quantity), COUNT(DISTINCT l_commitDATE) +FROM lineitem; +COUNT(DISTINCT l_orderkey) COUNT(DISTINCT l_orderkey,l_linenumber) COUNT(DISTINCT l_shipDATE) COUNT(DISTINCT l_partkey) COUNT(DISTINCT l_partkey,l_suppkey) COUNT(DISTINCT l_suppkey) COUNT(DISTINCT l_receiptDATE) COUNT(DISTINCT l_orderkey, l_quantity) COUNT(DISTINCT l_commitDATE) +1500 6005 2266 200 700 10 2268 5772 2211 +set optimizer_switch=@save_optimizer_switch; +DROP DATABASE dbt3_s001; +USE test; +delete from mysql.table_stats; +delete from mysql.column_stats; +delete from mysql.index_stats; ++# ++# MDEV-19352: Server crash in alloc_histograms_for_table_share upon query from information schema ++# ++use test; ++set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; ++set @@optimizer_use_condition_selectivity= 4; ++set use_stat_tables='preferably'; ++CREATE TABLE t1 (a INT); ++CREATE TABLE t2 (b INT); ++CREATE VIEW v AS SELECT * FROM t1 JOIN t2; ++INSERT INTO t2 SELECT * FROM x; ++ERROR 42S02: Table 'test.x' doesn't exist ++select * from information_schema.tables where table_name='v'; ++TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT MAX_INDEX_LENGTH TEMPORARY ++def test v VIEW NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL VIEW NULL NULL ++drop table t1,t2; ++drop view v; ++set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +set @save_optimizer_switch=@@optimizer_switch; +set use_stat_tables=@save_use_stat_tables; +# +# MDEV-18899: Server crashes in Field::set_warning_truncated_wrong_value +# +set names utf8; +set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity; +set optimizer_use_condition_selectivity=4; +set use_stat_tables=preferably; +set @save_histogram_size= @@histogram_size; +set histogram_size=255; +create table t1 ( a varchar(255) character set utf8); +insert into t1 values (REPEAT('ӥ',255)), (REPEAT('ç',255)); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +select HEX(RIGHT(min_value, 1)), length(min_value) from mysql.column_stats where db_name='test' and table_name='t1'; +HEX(RIGHT(min_value, 1)) length(min_value) +A7 254 +select HEX(RIGHT(max_value, 1)), length(max_value) from mysql.column_stats where db_name='test' and table_name='t1'; +HEX(RIGHT(max_value, 1)) length(max_value) +A5 254 +analyze select * from t1 where a >= 'ӥ'; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 2.00 50.00 50.00 Using where +set @save_sql_mode= @@sql_mode; +set sql_mode='ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; +update mysql.column_stats set min_value= REPEAT('ӥ',255) where db_name='test' and table_name='t1'; +Warnings: +Warning 1265 Data truncated for column 'min_value' at row 1 +select HEX(RIGHT(min_value, 1)), length(min_value) from mysql.column_stats where db_name='test' and table_name='t1'; +HEX(RIGHT(min_value, 1)) length(min_value) +D3 255 +analyze select * from t1 where a >= 'ӥ'; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 2.00 50.00 50.00 Using where +set names latin1; +drop table t1; +CREATE TABLE t1 (col1 date); +INSERT INTO t1 VALUES('2004-01-01'),('2004-02-29'); +INSERT INTO t1 VALUES('0000-10-31'); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +update mysql.column_stats set min_value='2004-0-31123' where db_name='test' and table_name='t1'; +select min_value from mysql.column_stats where db_name='test' and table_name='t1'; +min_value +2004-0-31123 +select * from t1; +col1 +2004-01-01 +2004-02-29 +0000-10-31 +drop table t1; +set @@sql_mode= @save_sql_mode; +set use_stat_tables=@save_use_stat_tables; +set @@histogram_size= @save_histogram_size; +set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +set optimizer_switch=@save_optimizer_switch_for_stat_tables_test; +SET SESSION STORAGE_ENGINE=DEFAULT; diff --cc mysql-test/main/view_grant.result index 82594128d85,00000000000..6d22f93fd49 mode 100644,000000..100644 --- a/mysql-test/main/view_grant.result +++ b/mysql-test/main/view_grant.result @@@ -1,1937 -1,0 +1,1941 @@@ +drop database if exists mysqltest; +drop view if exists v1,v2,v3; +create user test@localhost; +grant create view on test.* to test@localhost; +show grants for test@localhost; +Grants for test@localhost +GRANT USAGE ON *.* TO 'test'@'localhost' +GRANT CREATE VIEW ON `test`.* TO 'test'@'localhost' +revoke create view on test.* from test@localhost; +show grants for test@localhost; +Grants for test@localhost +GRANT USAGE ON *.* TO 'test'@'localhost' +drop user test@localhost; +connect root,localhost,root,,test; +connection root; +create database mysqltest; +create table mysqltest.t1 (a int, b int); +create table mysqltest.t2 (a int, b int); +create user mysqltest_1@localhost; +grant select on mysqltest.t1 to mysqltest_1@localhost; +grant create view,select on test.* to mysqltest_1@localhost; +connect user1,localhost,mysqltest_1,,test; +connection user1; +create definer=root@localhost view v1 as select * from mysqltest.t1; +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation +create view v1 as select * from mysqltest.t1; +alter view v1 as select * from mysqltest.t1; +ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 'v1' +create or replace view v1 as select * from mysqltest.t1; +ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 'v1' +create view mysqltest.v2 as select * from mysqltest.t1; +ERROR 42000: CREATE VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v2' +create view v2 as select * from mysqltest.t2; +ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table 't2' +connection root; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1` latin1 latin1_swedish_ci +grant create view,drop,select on test.* to mysqltest_1@localhost; +connection user1; +use test; +alter view v1 as select * from mysqltest.t1; +create or replace view v1 as select * from mysqltest.t1; +connection root; +revoke all privileges on mysqltest.t1 from mysqltest_1@localhost; +revoke all privileges on test.* from mysqltest_1@localhost; +drop database mysqltest; +drop view test.v1; +create database mysqltest; +create table mysqltest.t1 (a int, b int); +create view mysqltest.v1 (c,d) as select a+1,b+1 from mysqltest.t1; +grant select (c) on mysqltest.v1 to mysqltest_1@localhost; +connection user1; +select c from mysqltest.v1; +c +select d from mysqltest.v1; +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'd' in table 'v1' +connection root; +revoke all privileges on mysqltest.v1 from mysqltest_1@localhost; +drop user mysqltest_1@localhost; +drop database mysqltest; +create database mysqltest; +create table mysqltest.t1 (a int, b int); +create algorithm=temptable view mysqltest.v1 (c,d) as select a+1,b+1 from mysqltest.t1; +create user mysqltest_1@localhost; +grant select (c) on mysqltest.v1 to mysqltest_1@localhost; +connection user1; +select c from mysqltest.v1; +c +select d from mysqltest.v1; +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'd' in table 'v1' +connection root; +revoke all privileges on mysqltest.v1 from mysqltest_1@localhost; +drop user mysqltest_1@localhost; +drop database mysqltest; +connection root; +create database mysqltest; +create table mysqltest.t1 (a int, b int); +create table mysqltest.t2 (a int, b int); +create view mysqltest.v1 (c,d) as select a+1,b+1 from mysqltest.t1; +create algorithm=temptable view mysqltest.v2 (c,d) as select a+1,b+1 from mysqltest.t1; +create view mysqltest.v3 (c,d) as select a+1,b+1 from mysqltest.t2; +create algorithm=temptable view mysqltest.v4 (c,d) as select a+1,b+1 from mysqltest.t2; +create view mysqltest.v5 (c,d) as select a+1,b+1 from mysqltest.t1; +create user mysqltest_1@localhost; +grant select on mysqltest.v1 to mysqltest_1@localhost; +grant select on mysqltest.v2 to mysqltest_1@localhost; +grant select on mysqltest.v3 to mysqltest_1@localhost; +grant select on mysqltest.v4 to mysqltest_1@localhost; +grant show view on mysqltest.v5 to mysqltest_1@localhost; +connection user1; +select c from mysqltest.v1; +c +select c from mysqltest.v2; +c +select c from mysqltest.v3; +c +select c from mysqltest.v4; +c +select c from mysqltest.v5; +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v5' +show columns from mysqltest.v1; +Field Type Null Key Default Extra +c bigint(12) YES NULL +d bigint(12) YES NULL +show columns from mysqltest.v2; +Field Type Null Key Default Extra +c bigint(12) YES NULL +d bigint(12) YES NULL +explain select c from mysqltest.v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +show create view mysqltest.v1; +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v1' +explain select c from mysqltest.v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +show create view mysqltest.v2; +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v2' +explain select c from mysqltest.v3; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +show create view mysqltest.v3; +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v3' +explain select c from mysqltest.v4; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +show create view mysqltest.v4; +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v4' +explain select c from mysqltest.v5; +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v5' +show create view mysqltest.v5; +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v5' +connection root; +grant select on mysqltest.v5 to mysqltest_1@localhost; +connection user1; +show create view mysqltest.v5; +View Create View character_set_client collation_connection +v5 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v5` AS select `mysqltest`.`t1`.`a` + 1 AS `c`,`mysqltest`.`t1`.`b` + 1 AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci +explain select c from mysqltest.v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +show create view mysqltest.v1; +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v1' +connection root; +grant show view on mysqltest.v1 to mysqltest_1@localhost; +grant select on mysqltest.t1 to mysqltest_1@localhost; +revoke select on mysqltest.v5 from mysqltest_1@localhost; +connection user1; +explain select c from mysqltest.v1; +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 +show create view mysqltest.v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v1` AS select `mysqltest`.`t1`.`a` + 1 AS `c`,`mysqltest`.`t1`.`b` + 1 AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci +explain select c from mysqltest.v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +show create view mysqltest.v2; +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v2' +explain select c from mysqltest.v3; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +show create view mysqltest.v3; +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v3' +explain select c from mysqltest.v4; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +show create view mysqltest.v4; +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v4' +explain select c from mysqltest.v5; +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v5' +connection root; +grant show view on mysqltest.* to mysqltest_1@localhost; +connection user1; +explain select c from mysqltest.v1; +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 +show create view mysqltest.v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v1` AS select `mysqltest`.`t1`.`a` + 1 AS `c`,`mysqltest`.`t1`.`b` + 1 AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci +explain select c from mysqltest.v2; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> system NULL NULL NULL NULL 0 Const row not found +2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table +show create view mysqltest.v2; +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v2` AS select `mysqltest`.`t1`.`a` + 1 AS `c`,`mysqltest`.`t1`.`b` + 1 AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci +explain select c from mysqltest.v3; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +show create view mysqltest.v3; +View Create View character_set_client collation_connection +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v3` AS select `mysqltest`.`t2`.`a` + 1 AS `c`,`mysqltest`.`t2`.`b` + 1 AS `d` from `mysqltest`.`t2` latin1 latin1_swedish_ci +explain select c from mysqltest.v4; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +show create view mysqltest.v4; +View Create View character_set_client collation_connection +v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v4` AS select `mysqltest`.`t2`.`a` + 1 AS `c`,`mysqltest`.`t2`.`b` + 1 AS `d` from `mysqltest`.`t2` latin1 latin1_swedish_ci +connection root; +revoke all privileges on mysqltest.* from mysqltest_1@localhost; +drop user mysqltest_1@localhost; +drop database mysqltest; +connection root; +create database mysqltest; +create table mysqltest.t1 (a int, b int, primary key(a)); +insert into mysqltest.t1 values (10,2), (20,3), (30,4), (40,5), (50,10); +create table mysqltest.t2 (x int); +insert into mysqltest.t2 values (3), (4), (5), (6); ++create table mysqltest.t3 (x int); ++insert into mysqltest.t3 values (3), (4), (5), (6); +create view mysqltest.v1 (a,c) as select a, b+1 from mysqltest.t1; +create view mysqltest.v2 (a,c) as select a, b from mysqltest.t1; +create view mysqltest.v3 (a,c) as select a, b+1 from mysqltest.t1; +create user mysqltest_1@localhost; +grant update (a) on mysqltest.v2 to mysqltest_1@localhost; +grant update on mysqltest.v1 to mysqltest_1@localhost; ++grant update on mysqltest.t3 to mysqltest_1@localhost; +grant select on mysqltest.* to mysqltest_1@localhost; +connection user1; +use mysqltest; +update t2,v1 set v1.a=v1.a+v1.c where t2.x=v1.c; +select * from t1; +a b +13 2 +24 3 +35 4 +46 5 +50 10 +update v1 set a=a+c; +select * from t1; +a b +16 2 +28 3 +40 4 +52 5 +61 10 +update t2,v2 set v2.a=v2.a+v2.c where t2.x=v2.c; +select * from t1; +a b +16 2 +31 3 +44 4 +57 5 +61 10 +update v2 set a=a+c; +select * from t1; +a b +18 2 +34 3 +48 4 +62 5 +71 10 ++update t3,v3 set t3.x=t3.x+v3.c where t3.x=v3.c; +update t2,v2 set v2.c=v2.a+v2.c where t2.x=v2.c; +ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for column 'c' in table 'v2' +update v2 set c=a+c; +ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for column 'c' in table 'v2' +update t2,v3 set v3.a=v3.a+v3.c where t2.x=v3.c; +ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table 'v3' +update v3 set a=a+c; +ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table 'v3' +use test; +connection root; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; +drop user mysqltest_1@localhost; +drop database mysqltest; +connection root; +create database mysqltest; +create table mysqltest.t1 (a int, b int, primary key(a)); +insert into mysqltest.t1 values (1,2), (2,3), (3,4), (4,5), (5,10); +create table mysqltest.t2 (x int); +insert into mysqltest.t2 values (3), (4), (5), (6); +create view mysqltest.v1 (a,c) as select a, b+1 from mysqltest.t1; +create view mysqltest.v2 (a,c) as select a, b+1 from mysqltest.t1; +create user mysqltest_1@localhost; +grant delete on mysqltest.v1 to mysqltest_1@localhost; +grant select on mysqltest.* to mysqltest_1@localhost; +connection user1; +use mysqltest; +delete from v1 where c < 4; +select * from t1; +a b +2 3 +3 4 +4 5 +5 10 +delete v1 from t2,v1 where t2.x=v1.c; +select * from t1; +a b +5 10 +delete v2 from t2,v2 where t2.x=v2.c; +ERROR 42000: DELETE command denied to user 'mysqltest_1'@'localhost' for table 'v2' +delete from v2 where c < 4; +ERROR 42000: DELETE command denied to user 'mysqltest_1'@'localhost' for table 'v2' +use test; +connection root; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; +drop user mysqltest_1@localhost; +drop database mysqltest; +connection root; +create database mysqltest; +create table mysqltest.t1 (a int, b int, primary key(a)); +insert into mysqltest.t1 values (1,2), (2,3); +create table mysqltest.t2 (x int, y int); +insert into mysqltest.t2 values (3,4); +create view mysqltest.v1 (a,c) as select a, b from mysqltest.t1; +create view mysqltest.v2 (a,c) as select a, b from mysqltest.t1; +create user mysqltest_1@localhost; +grant insert on mysqltest.v1 to mysqltest_1@localhost; +grant select on mysqltest.* to mysqltest_1@localhost; +connection user1; +use mysqltest; +insert into v1 values (5,6); +select * from t1; +a b +1 2 +2 3 +5 6 +insert into v1 select x,y from t2; +select * from t1; +a b +1 2 +2 3 +5 6 +3 4 +insert into v2 values (5,6); +ERROR 42000: INSERT command denied to user 'mysqltest_1'@'localhost' for table 'v2' +insert into v2 select x,y from t2; +ERROR 42000: INSERT command denied to user 'mysqltest_1'@'localhost' for table 'v2' +use test; +connection root; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; +drop user mysqltest_1@localhost; +drop database mysqltest; +connection root; +create database mysqltest; +create table mysqltest.t1 (a int, b int); +create table mysqltest.t2 (a int, b int); +create user mysqltest_1@localhost; +grant update on mysqltest.t1 to mysqltest_1@localhost; +grant update(b) on mysqltest.t2 to mysqltest_1@localhost; +grant create view,update on test.* to mysqltest_1@localhost; +connection user1; +create view v1 as select * from mysqltest.t1; +create view v2 as select b from mysqltest.t2; +create view mysqltest.v1 as select * from mysqltest.t1; +ERROR 42000: CREATE VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v1' +create view v3 as select a from mysqltest.t2; +ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for column 'a' in table 't2' +connection root; +create table mysqltest.v3 (b int); +grant create view on mysqltest.v3 to mysqltest_1@localhost; +drop table mysqltest.v3; +connection user1; +create view mysqltest.v3 as select b from mysqltest.t2; +connection root; +grant create view, update on mysqltest.v3 to mysqltest_1@localhost; +drop view mysqltest.v3; +connection user1; +create view mysqltest.v3 as select b from mysqltest.t2; +create view v4 as select b+1 from mysqltest.t2; +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 't2' +connection root; +grant create view,update,select on test.* to mysqltest_1@localhost; +connection user1; +create view v4 as select b+1 from mysqltest.t2; +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 't2' +connection root; +grant update,select(b) on mysqltest.t2 to mysqltest_1@localhost; +connection user1; +create view v4 as select b+1 from mysqltest.t2; +connection root; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; +drop user mysqltest_1@localhost; +drop database mysqltest; +drop view v1,v2,v4; +connection root; +create database mysqltest; +create table mysqltest.t1 (a int); +create user mysqltest_1@localhost; +grant all privileges on mysqltest.* to mysqltest_1@localhost; +connection user1; +use mysqltest; +create view v1 as select * from t1; +use test; +connection root; +revoke all privileges on mysqltest.* from mysqltest_1@localhost; +drop user mysqltest_1@localhost; +drop database mysqltest; +connection root; +create database mysqltest; +create table mysqltest.t1 (a int, b int); +create user mysqltest_1@localhost; +grant select on mysqltest.t1 to mysqltest_1@localhost; +grant create view,select on test.* to mysqltest_1@localhost; +connection user1; +create view v1 as select * from mysqltest.t1; +connection root; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1` latin1 latin1_swedish_ci +revoke select on mysqltest.t1 from mysqltest_1@localhost; +select * from v1; +ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +grant select on mysqltest.t1 to mysqltest_1@localhost; +select * from v1; +a b +REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; +drop user mysqltest_1@localhost; +drop view v1; +drop database mysqltest; +connection root; +create database mysqltest; +use mysqltest; +create table t1 (a int); +insert into t1 values (1); +create table t2 (s1 int); +drop function if exists f2; +create function f2 () returns int begin declare v int; select s1 from t2 +into v; return v; end// +create algorithm=TEMPTABLE view v1 as select f2() from t1; +create algorithm=MERGE view v2 as select f2() from t1; +create algorithm=TEMPTABLE SQL SECURITY INVOKER view v3 as select f2() from t1; +create algorithm=MERGE SQL SECURITY INVOKER view v4 as select f2() from t1; +create SQL SECURITY INVOKER view v5 as select * from v4; +create user mysqltest_1@localhost; +grant select on v1 to mysqltest_1@localhost; +grant select on v2 to mysqltest_1@localhost; +grant select on v3 to mysqltest_1@localhost; +grant select on v4 to mysqltest_1@localhost; +grant select on v5 to mysqltest_1@localhost; +connection user1; +use mysqltest; +select * from v1; +f2() +NULL +select * from v2; +f2() +NULL +select * from v3; +ERROR HY000: View 'mysqltest.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +select * from v4; +ERROR HY000: View 'mysqltest.v4' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +select * from v5; +ERROR HY000: View 'mysqltest.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +use test; +connection root; +drop view v1, v2, v3, v4, v5; +drop function f2; +drop table t1, t2; +use test; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; +drop user mysqltest_1@localhost; +drop database mysqltest; +connection root; +create database mysqltest; +use mysqltest; +create table t1 (a int); +insert into t1 values (1); +create table t2 (s1 int); +drop function if exists f2; +create function f2 () returns int begin declare v int; select s1 from t2 +into v; return v; end// +create user mysqltest_1@localhost; +grant select on t1 to mysqltest_1@localhost; +grant execute on function f2 to mysqltest_1@localhost; +grant create view on mysqltest.* to mysqltest_1@localhost; +connection user1; +use mysqltest; +create algorithm=TEMPTABLE view v1 as select f2() from t1; +create algorithm=MERGE view v2 as select f2() from t1; +create algorithm=TEMPTABLE SQL SECURITY INVOKER view v3 as select f2() from t1; +create algorithm=MERGE SQL SECURITY INVOKER view v4 as select f2() from t1; +use test; +connection root; +create view v5 as select * from v1; +revoke execute on function f2 from mysqltest_1@localhost; +select * from v1; +ERROR HY000: View 'mysqltest.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +select * from v2; +ERROR HY000: View 'mysqltest.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +select * from v3; +f2() +NULL +select * from v4; +f2() +NULL +select * from v5; +ERROR HY000: View 'mysqltest.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +drop view v1, v2, v3, v4, v5; +drop function f2; +drop table t1, t2; +use test; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; +drop user mysqltest_1@localhost; +drop database mysqltest; +connection root; +create database mysqltest; +use mysqltest; +create table t1 (a int); +create table v1 (a int); +insert into t1 values (1); +create user mysqltest_1@localhost; +grant select on t1 to mysqltest_1@localhost; +grant select on v1 to mysqltest_1@localhost; +grant create view on mysqltest.* to mysqltest_1@localhost; +drop table v1; +connection user1; +use mysqltest; +create algorithm=TEMPTABLE view v1 as select *, a as b from t1; +create algorithm=MERGE view v2 as select *, a as b from t1; +create algorithm=TEMPTABLE SQL SECURITY INVOKER view v3 as select *, a as b from t1; +create algorithm=MERGE SQL SECURITY INVOKER view v4 as select *, a as b from t1; +create view v5 as select * from v1; +use test; +connection root; +revoke select on t1 from mysqltest_1@localhost; +select * from v1; +ERROR HY000: View 'mysqltest.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +select * from v2; +ERROR HY000: View 'mysqltest.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +select * from v3; +a b +1 1 +select * from v4; +a b +1 1 +select * from v5; +ERROR HY000: View 'mysqltest.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +drop table t1; +use test; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; +drop user mysqltest_1@localhost; +drop database mysqltest; +connection root; +create database mysqltest; +use mysqltest; +create table t1 (a int); +insert into t1 values (1); +create algorithm=TEMPTABLE view v1 as select *, a as b from t1; +create algorithm=MERGE view v2 as select *, a as b from t1; +create algorithm=TEMPTABLE SQL SECURITY INVOKER view v3 as select *, a as b from t1; +create algorithm=MERGE SQL SECURITY INVOKER view v4 as select *, a as b from t1; +create SQL SECURITY INVOKER view v5 as select * from v4; +create user mysqltest_1@localhost; +grant select on v1 to mysqltest_1@localhost; +grant select on v2 to mysqltest_1@localhost; +grant select on v3 to mysqltest_1@localhost; +grant select on v4 to mysqltest_1@localhost; +grant select on v5 to mysqltest_1@localhost; +connection user1; +use mysqltest; +select * from v1; +a b +1 1 +select * from v2; +a b +1 1 +select * from v3; +ERROR HY000: View 'mysqltest.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +select * from v4; +ERROR HY000: View 'mysqltest.v4' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +select * from v5; +ERROR HY000: View 'mysqltest.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +use test; +connection root; +drop view v1, v2, v3, v4, v5; +drop table t1; +use test; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; +drop user mysqltest_1@localhost; +drop database mysqltest; +drop view if exists v1; +drop table if exists t1; +create table t1 as select * from mysql.user where user=''; +delete from mysql.user where user=''; +flush privileges; +create user 'test14256'@'%'; +grant all on test.* to 'test14256'@'%'; +connect test14256,localhost,test14256,,test; +connection test14256; +use test; +create view v1 as select 42; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`test14256`@`%` SQL SECURITY DEFINER VIEW `v1` AS select 42 AS `42` latin1 latin1_swedish_ci +select definer into @v1def1 from information_schema.views +where table_schema = 'test' and table_name='v1'; +drop view v1; +create definer=`test14256`@`%` view v1 as select 42; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`test14256`@`%` SQL SECURITY DEFINER VIEW `v1` AS select 42 AS `42` latin1 latin1_swedish_ci +select definer into @v1def2 from information_schema.views +where table_schema = 'test' and table_name='v1'; +drop view v1; +select @v1def1, @v1def2, @v1def1=@v1def2; +@v1def1 @v1def2 @v1def1=@v1def2 +test14256@% test14256@% 1 +connection root; +disconnect test14256; +drop user test14256; +insert into mysql.user select * from t1; +flush privileges; +drop table t1; +connection root; +create database mysqltest; +use mysqltest; +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT * FROM t1; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci +create user mysqltest_1@localhost; +GRANT SELECT, LOCK TABLES ON mysqltest.* TO mysqltest_1@localhost; +connection user1; +use mysqltest; +LOCK TABLES v1 READ; +SHOW CREATE TABLE v1; +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v1' +UNLOCK TABLES; +use test; +connection root; +use test; +drop user mysqltest_1@localhost; +drop database mysqltest; +disconnect user1; +disconnect root; +connection default; +create definer=some_user@`` sql security invoker view v1 as select 1; +Warnings: +Note 1449 The user specified as a definer ('some_user'@'%') does not exist +create definer=some_user@localhost sql security invoker view v2 as select 1; +Warnings: +Note 1449 The user specified as a definer ('some_user'@'localhost') does not exist +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`some_user`@`%` SQL SECURITY INVOKER VIEW `v1` AS select 1 AS `1` latin1 latin1_swedish_ci +show create view v2; +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`some_user`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select 1 AS `1` latin1 latin1_swedish_ci +drop view v1; +drop view v2; +CREATE DATABASE mysqltest1; +CREATE USER readonly@localhost; +CREATE TABLE mysqltest1.t1 (x INT); +INSERT INTO mysqltest1.t1 VALUES (1), (2); +CREATE SQL SECURITY INVOKER VIEW mysqltest1.v_t1 AS SELECT * FROM mysqltest1.t1; +CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_ts AS SELECT * FROM mysqltest1.t1; +CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_ti AS SELECT * FROM mysqltest1.t1; +CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tu AS SELECT * FROM mysqltest1.t1; +CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tus AS SELECT * FROM mysqltest1.t1; +CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_td AS SELECT * FROM mysqltest1.t1; +CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tds AS SELECT * FROM mysqltest1.t1; +GRANT SELECT, INSERT, UPDATE, DELETE ON mysqltest1.v_t1 TO readonly@localhost; +GRANT SELECT ON mysqltest1.v_ts TO readonly@localhost; +GRANT INSERT ON mysqltest1.v_ti TO readonly@localhost; +GRANT UPDATE ON mysqltest1.v_tu TO readonly@localhost; +GRANT UPDATE,SELECT ON mysqltest1.v_tus TO readonly@localhost; +GRANT DELETE ON mysqltest1.v_td TO readonly@localhost; +GRANT DELETE,SELECT ON mysqltest1.v_tds TO readonly@localhost; +connect n1,localhost,readonly,,; +connection n1; +SELECT * FROM mysqltest1.v_t1; +ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +INSERT INTO mysqltest1.v_t1 VALUES(4); +ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +DELETE FROM mysqltest1.v_t1 WHERE x = 1; +ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +UPDATE mysqltest1.v_t1 SET x = 3 WHERE x = 2; +ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +UPDATE mysqltest1.v_t1 SET x = 3; +ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +DELETE FROM mysqltest1.v_t1; +ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +SELECT 1 FROM mysqltest1.v_t1; +ERROR HY000: View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +SELECT * FROM mysqltest1.t1; +ERROR 42000: SELECT command denied to user 'readonly'@'localhost' for table 't1' +SELECT * FROM mysqltest1.v_ts; +x +1 +2 +SELECT * FROM mysqltest1.v_ts, mysqltest1.t1 WHERE mysqltest1.t1.x = mysqltest1.v_ts.x; +ERROR 42000: SELECT command denied to user 'readonly'@'localhost' for table 't1' +SELECT * FROM mysqltest1.v_ti; +ERROR 42000: SELECT command denied to user 'readonly'@'localhost' for table 'v_ti' +INSERT INTO mysqltest1.v_ts VALUES (100); +ERROR 42000: INSERT command denied to user 'readonly'@'localhost' for table 'v_ts' +INSERT INTO mysqltest1.v_ti VALUES (100); +UPDATE mysqltest1.v_ts SET x= 200 WHERE x = 100; +ERROR 42000: UPDATE command denied to user 'readonly'@'localhost' for table 'v_ts' +UPDATE mysqltest1.v_ts SET x= 200; +ERROR 42000: UPDATE command denied to user 'readonly'@'localhost' for table 'v_ts' +UPDATE mysqltest1.v_tu SET x= 200 WHERE x = 100; +UPDATE mysqltest1.v_tus SET x= 200 WHERE x = 100; +UPDATE mysqltest1.v_tu SET x= 200; +DELETE FROM mysqltest1.v_ts WHERE x= 200; +ERROR 42000: DELETE command denied to user 'readonly'@'localhost' for table 'v_ts' +DELETE FROM mysqltest1.v_ts; +ERROR 42000: DELETE command denied to user 'readonly'@'localhost' for table 'v_ts' +DELETE FROM mysqltest1.v_td WHERE x= 200; +ERROR 42000: SELECT command denied to user 'readonly'@'localhost' for column 'x' in table 'v_td' +DELETE FROM mysqltest1.v_tds WHERE x= 200; +DELETE FROM mysqltest1.v_td; +connection default; +disconnect n1; +DROP VIEW mysqltest1.v_tds; +DROP VIEW mysqltest1.v_td; +DROP VIEW mysqltest1.v_tus; +DROP VIEW mysqltest1.v_tu; +DROP VIEW mysqltest1.v_ti; +DROP VIEW mysqltest1.v_ts; +DROP VIEW mysqltest1.v_t1; +DROP TABLE mysqltest1.t1; +DROP USER readonly@localhost; +DROP DATABASE mysqltest1; +CREATE TABLE t1 (a INT PRIMARY KEY); +INSERT INTO t1 VALUES (1), (2), (3); +CREATE DEFINER = 'no-such-user'@localhost VIEW v AS SELECT a from t1; +Warnings: +Note 1449 The user specified as a definer ('no-such-user'@'localhost') does not exist +SHOW CREATE VIEW v; +View Create View character_set_client collation_connection +v CREATE ALGORITHM=UNDEFINED DEFINER=`no-such-user`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `test`.`t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci +Warnings: +Note 1449 The user specified as a definer ('no-such-user'@'localhost') does not exist +SELECT * FROM v; +ERROR HY000: The user specified as a definer ('no-such-user'@'localhost') does not exist +DROP VIEW v; +DROP TABLE t1; +USE test; +CREATE USER mysqltest_db1@localhost identified by 'PWD'; +GRANT ALL ON mysqltest_db1.* TO mysqltest_db1@localhost WITH GRANT OPTION; +connect session1,localhost,mysqltest_db1,PWD,test; +CREATE SCHEMA mysqltest_db1 ; +USE mysqltest_db1 ; +CREATE TABLE t1 (f1 INTEGER); +CREATE VIEW view1 AS +SELECT * FROM t1; +SHOW CREATE VIEW view1; +View Create View character_set_client collation_connection +view1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_db1`@`localhost` SQL SECURITY DEFINER VIEW `view1` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci +CREATE VIEW view2 AS +SELECT * FROM view1; +# Here comes a suspicious warning +SHOW CREATE VIEW view2; +View Create View character_set_client collation_connection +view2 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_db1`@`localhost` SQL SECURITY DEFINER VIEW `view2` AS select `view1`.`f1` AS `f1` from `view1` latin1 latin1_swedish_ci +# But the view view2 is usable +SELECT * FROM view2; +f1 +CREATE VIEW view3 AS +SELECT * FROM view2; +SELECT * from view3; +f1 +connection default; +disconnect session1; +DROP VIEW mysqltest_db1.view3; +DROP VIEW mysqltest_db1.view2; +DROP VIEW mysqltest_db1.view1; +DROP TABLE mysqltest_db1.t1; +DROP SCHEMA mysqltest_db1; +DROP USER mysqltest_db1@localhost; +CREATE DATABASE test1; +CREATE DATABASE test2; +CREATE TABLE test1.t0 (a VARCHAR(20)); +CREATE TABLE test2.t1 (a VARCHAR(20)); +CREATE VIEW test2.t3 AS SELECT * FROM test1.t0; +CREATE OR REPLACE VIEW test.v1 AS +SELECT ta.a AS col1, tb.a AS col2 FROM test2.t3 ta, test2.t1 tb; +DROP VIEW test.v1; +DROP VIEW test2.t3; +DROP TABLE test2.t1, test1.t0; +DROP DATABASE test2; +DROP DATABASE test1; +DROP VIEW IF EXISTS v1; +DROP VIEW IF EXISTS v2; +DROP VIEW IF EXISTS v3; +DROP FUNCTION IF EXISTS f1; +DROP FUNCTION IF EXISTS f2; +DROP PROCEDURE IF EXISTS p1; +CREATE SQL SECURITY DEFINER VIEW v1 AS SELECT CURRENT_USER() AS cu; +CREATE FUNCTION f1() RETURNS VARCHAR(77) SQL SECURITY INVOKER +RETURN CURRENT_USER(); +CREATE SQL SECURITY DEFINER VIEW v2 AS SELECT f1() AS cu; +CREATE PROCEDURE p1(OUT cu VARCHAR(77)) SQL SECURITY INVOKER +SET cu= CURRENT_USER(); +CREATE FUNCTION f2() RETURNS VARCHAR(77) SQL SECURITY INVOKER +BEGIN +DECLARE cu VARCHAR(77); +CALL p1(cu); +RETURN cu; +END| +CREATE SQL SECURITY DEFINER VIEW v3 AS SELECT f2() AS cu; +CREATE USER mysqltest_u1@localhost; +GRANT ALL ON test.* TO mysqltest_u1@localhost; +connect conn1, localhost, mysqltest_u1,,; + +The following tests should all return 1. + +SELECT CURRENT_USER() = 'mysqltest_u1@localhost'; +CURRENT_USER() = 'mysqltest_u1@localhost' +1 +SELECT f1() = 'mysqltest_u1@localhost'; +f1() = 'mysqltest_u1@localhost' +1 +CALL p1(@cu); +SELECT @cu = 'mysqltest_u1@localhost'; +@cu = 'mysqltest_u1@localhost' +1 +SELECT f2() = 'mysqltest_u1@localhost'; +f2() = 'mysqltest_u1@localhost' +1 +SELECT cu = 'root@localhost' FROM v1; +cu = 'root@localhost' +1 +SELECT cu = 'root@localhost' FROM v2; +cu = 'root@localhost' +1 +SELECT cu = 'root@localhost' FROM v3; +cu = 'root@localhost' +1 +disconnect conn1; +connection default; +DROP VIEW v3; +DROP FUNCTION f2; +DROP PROCEDURE p1; +DROP FUNCTION f1; +DROP VIEW v2; +DROP VIEW v1; +DROP USER mysqltest_u1@localhost; +connect root,localhost,root,,; +connection root; +CREATE DATABASE db17254; +USE db17254; +CREATE TABLE t1 (f1 INT); +INSERT INTO t1 VALUES (10),(20); +CREATE USER def_17254@localhost; +GRANT SELECT ON db17254.* TO def_17254@localhost; +CREATE USER inv_17254@localhost; +GRANT SELECT ON db17254.t1 TO inv_17254@localhost; +GRANT CREATE VIEW ON db17254.* TO def_17254@localhost; +connect def,localhost,def_17254,,db17254; +connection def; +CREATE VIEW v1 AS SELECT * FROM t1; +connection root; +DROP USER def_17254@localhost; +connect inv,localhost,inv_17254,,db17254; +connection inv; +for a user +SELECT * FROM v1; +ERROR 42000: SELECT command denied to user 'inv_17254'@'localhost' for table 'v1' +connection root; +for a superuser +SELECT * FROM v1; +ERROR HY000: The user specified as a definer ('def_17254'@'localhost') does not exist +DROP USER inv_17254@localhost; +DROP DATABASE db17254; +disconnect def; +disconnect inv; +DROP DATABASE IF EXISTS mysqltest_db1; +DROP DATABASE IF EXISTS mysqltest_db2; +DROP USER mysqltest_u1; +DROP USER mysqltest_u2; +CREATE USER mysqltest_u1@localhost; +CREATE USER mysqltest_u2@localhost; +CREATE DATABASE mysqltest_db1; +CREATE DATABASE mysqltest_db2; +GRANT ALL ON mysqltest_db1.* TO mysqltest_u1@localhost WITH GRANT OPTION; +GRANT ALL ON mysqltest_db2.* TO mysqltest_u2@localhost; +connect conn1, localhost, mysqltest_u1, , mysqltest_db1; +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1); +CREATE VIEW v1 AS SELECT i FROM t1 WHERE 1 IN (SELECT * FROM t1); +CREATE TABLE t2 (s CHAR(7)); +INSERT INTO t2 VALUES ('public'); +GRANT SELECT ON v1 TO mysqltest_u2@localhost; +GRANT SELECT ON t2 TO mysqltest_u2@localhost; +connect conn2, localhost, mysqltest_u2, , mysqltest_db2; +SELECT * FROM mysqltest_db1.v1, mysqltest_db1.t2; +i s +1 public +PREPARE stmt1 FROM "SELECT * FROM mysqltest_db1.t2"; +EXECUTE stmt1; +s +public +PREPARE stmt2 FROM "SELECT * FROM mysqltest_db1.v1, mysqltest_db1.t2"; +EXECUTE stmt2; +i s +1 public +connection conn1; +REVOKE SELECT ON t2 FROM mysqltest_u2@localhost; +UPDATE t2 SET s = 'private' WHERE s = 'public'; +connection conn2; +SELECT * FROM mysqltest_db1.v1, mysqltest_db1.t2; +ERROR 42000: SELECT command denied to user 'mysqltest_u2'@'localhost' for table 't2' +EXECUTE stmt1; +ERROR 42000: SELECT command denied to user 'mysqltest_u2'@'localhost' for table 't2' +EXECUTE stmt2; +ERROR 42000: SELECT command denied to user 'mysqltest_u2'@'localhost' for table 't2' +disconnect conn2; +disconnect conn1; +connection default; +REVOKE ALL ON mysqltest_db1.* FROM mysqltest_u1@localhost; +REVOKE ALL ON mysqltest_db2.* FROM mysqltest_u2@localhost; +DROP DATABASE mysqltest_db1; +DROP DATABASE mysqltest_db2; +DROP USER mysqltest_u1@localhost; +DROP USER mysqltest_u2@localhost; +connection root; +CREATE DATABASE db26813; +USE db26813; +CREATE TABLE t1(f1 INT, f2 INT); +CREATE VIEW v1 AS SELECT f1 FROM t1; +CREATE VIEW v2 AS SELECT f1 FROM t1; +CREATE VIEW v3 AS SELECT f1 FROM t1; +CREATE USER u26813@localhost; +GRANT DROP ON db26813.v1 TO u26813@localhost; +GRANT CREATE VIEW ON db26813.v2 TO u26813@localhost; +GRANT DROP, CREATE VIEW ON db26813.v3 TO u26813@localhost; +GRANT SELECT ON db26813.t1 TO u26813@localhost; +connect u1,localhost,u26813,,db26813; +connection u1; +ALTER VIEW v1 AS SELECT f2 FROM t1; +ERROR 42000: CREATE VIEW command denied to user 'u26813'@'localhost' for table 'v1' +ALTER VIEW v2 AS SELECT f2 FROM t1; +ERROR 42000: DROP command denied to user 'u26813'@'localhost' for table 'v2' +ALTER VIEW v3 AS SELECT f2 FROM t1; +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation +connection root; +SHOW CREATE VIEW v3; +View Create View character_set_client collation_connection +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci +DROP USER u26813@localhost; +DROP DATABASE db26813; +disconnect u1; +# +# Bug#29908 A user can gain additional access through the ALTER VIEW. +# +connection root; +CREATE DATABASE mysqltest_29908; +USE mysqltest_29908; +CREATE TABLE t1(f1 INT, f2 INT); +CREATE USER u29908_1@localhost; +CREATE DEFINER = u29908_1@localhost VIEW v1 AS SELECT f1 FROM t1; +CREATE DEFINER = u29908_1@localhost SQL SECURITY INVOKER VIEW v2 AS +SELECT f1 FROM t1; +GRANT SELECT, DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v1 TO u29908_1@localhost; +GRANT SELECT, DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_1@localhost; +GRANT SELECT ON mysqltest_29908.t1 TO u29908_1@localhost; +CREATE USER u29908_2@localhost; +GRANT SELECT, DROP, CREATE VIEW ON mysqltest_29908.v1 TO u29908_2@localhost; +GRANT SELECT, DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_2@localhost; +GRANT SELECT ON mysqltest_29908.t1 TO u29908_2@localhost; +connect u2,localhost,u29908_2,,mysqltest_29908; +ALTER VIEW v1 AS SELECT f2 FROM t1; +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation +ALTER VIEW v2 AS SELECT f2 FROM t1; +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation +SHOW CREATE VIEW v2; +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci +connect u1,localhost,u29908_1,,mysqltest_29908; +ALTER VIEW v1 AS SELECT f2 FROM t1; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f2` AS `f2` from `t1` latin1 latin1_swedish_ci +ALTER VIEW v2 AS SELECT f2 FROM t1; +SHOW CREATE VIEW v2; +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f2` AS `f2` from `t1` latin1 latin1_swedish_ci +connection root; +ALTER VIEW v1 AS SELECT f1 FROM t1; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci +ALTER VIEW v2 AS SELECT f1 FROM t1; +SHOW CREATE VIEW v2; +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci +DROP USER u29908_1@localhost; +DROP USER u29908_2@localhost; +DROP DATABASE mysqltest_29908; +disconnect u1; +disconnect u2; +####################################################################### +DROP DATABASE IF EXISTS mysqltest1; +DROP DATABASE IF EXISTS mysqltest2; +CREATE DATABASE mysqltest1; +CREATE DATABASE mysqltest2; +CREATE TABLE mysqltest1.t1(c1 INT); +CREATE TABLE mysqltest1.t2(c2 INT); +CREATE TABLE mysqltest1.t3(c3 INT); +CREATE TABLE mysqltest1.t4(c4 INT); +INSERT INTO mysqltest1.t1 VALUES (11), (12), (13), (14); +INSERT INTO mysqltest1.t2 VALUES (21), (22), (23), (24); +INSERT INTO mysqltest1.t3 VALUES (31), (32), (33), (34); +INSERT INTO mysqltest1.t4 VALUES (41), (42), (43), (44); +CREATE USER mysqltest_u1@localhost; +GRANT SELECT ON mysqltest1.t1 TO mysqltest_u1@localhost; +GRANT INSERT ON mysqltest1.t2 TO mysqltest_u1@localhost; +GRANT SELECT, UPDATE ON mysqltest1.t3 TO mysqltest_u1@localhost; +GRANT SELECT, DELETE ON mysqltest1.t4 TO mysqltest_u1@localhost; +GRANT ALL PRIVILEGES ON mysqltest2.* TO mysqltest_u1@localhost; +connect bug24040_con,localhost,mysqltest_u1,,mysqltest2; +SELECT * FROM mysqltest1.t1; +c1 +11 +12 +13 +14 +INSERT INTO mysqltest1.t2 VALUES(25); +UPDATE mysqltest1.t3 SET c3 = 331 WHERE c3 = 31; +DELETE FROM mysqltest1.t4 WHERE c4 = 44; +CREATE VIEW v1 AS SELECT * FROM mysqltest1.t1; +CREATE VIEW v2 AS SELECT * FROM mysqltest1.t2; +CREATE VIEW v3 AS SELECT * FROM mysqltest1.t3; +CREATE VIEW v4 AS SELECT * FROM mysqltest1.t4; +SELECT * FROM v1; +c1 +11 +12 +13 +14 +INSERT INTO v2 VALUES(26); +UPDATE v3 SET c3 = 332 WHERE c3 = 32; +DELETE FROM v4 WHERE c4 = 43; +CREATE VIEW v12 AS SELECT c1, c2 FROM mysqltest1.t1, mysqltest1.t2; +ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c2' in table 'v12' +CREATE VIEW v13 AS SELECT c1, c3 FROM mysqltest1.t1, mysqltest1.t3; +CREATE VIEW v14 AS SELECT c1, c4 FROM mysqltest1.t1, mysqltest1.t4; +CREATE VIEW v21 AS SELECT c2, c1 FROM mysqltest1.t2, mysqltest1.t1; +ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c1' in table 'v21' +CREATE VIEW v23 AS SELECT c2, c3 FROM mysqltest1.t2, mysqltest1.t3; +ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c3' in table 'v23' +CREATE VIEW v24 AS SELECT c2, c4 FROM mysqltest1.t2, mysqltest1.t4; +ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c4' in table 'v24' +CREATE VIEW v31 AS SELECT c3, c1 FROM mysqltest1.t3, mysqltest1.t1; +CREATE VIEW v32 AS SELECT c3, c2 FROM mysqltest1.t3, mysqltest1.t2; +ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c2' in table 'v32' +CREATE VIEW v34 AS SELECT c3, c4 FROM mysqltest1.t3, mysqltest1.t4; +CREATE VIEW v41 AS SELECT c4, c1 FROM mysqltest1.t4, mysqltest1.t1; +CREATE VIEW v42 AS SELECT c4, c2 FROM mysqltest1.t4, mysqltest1.t2; +ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c2' in table 'v42' +CREATE VIEW v43 AS SELECT c4, c3 FROM mysqltest1.t4, mysqltest1.t3; +connection default; +SELECT * FROM mysqltest1.t1; +c1 +11 +12 +13 +14 +SELECT * FROM mysqltest1.t2; +c2 +21 +22 +23 +24 +25 +26 +SELECT * FROM mysqltest1.t3; +c3 +331 +332 +33 +34 +SELECT * FROM mysqltest1.t4; +c4 +41 +42 +disconnect bug24040_con; +DROP DATABASE mysqltest1; +DROP DATABASE mysqltest2; +DROP USER mysqltest_u1@localhost; +CREATE DATABASE db1; +USE db1; +CREATE TABLE t1(f1 INT, f2 INT); +CREATE VIEW v1 AS SELECT f1, f2 FROM t1; +CREATE USER foo; +GRANT SELECT (f1) ON t1 TO foo; +GRANT SELECT (f1) ON v1 TO foo; +connect addconfoo, localhost, foo,,; +connection addconfoo; +USE db1; +SELECT f1 FROM t1; +f1 +SELECT f2 FROM t1; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'f2' in table 't1' +SELECT * FROM t1; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1' +SELECT f1 FROM v1; +f1 +SELECT f2 FROM v1; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'f2' in table 'v1' +SELECT * FROM v1; +ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 'v1' +connection default; +disconnect root; +disconnect addconfoo; +USE test; +REVOKE SELECT (f1) ON db1.t1 FROM foo; +REVOKE SELECT (f1) ON db1.v1 FROM foo; +DROP USER foo; +DROP VIEW db1.v1; +DROP TABLE db1.t1; +DROP DATABASE db1; +connection default; +Bug #11765687/#58677: +No privilege on table/view, but can know #rows / underlying table's name +connect root,localhost,root,,test; +connection root; +create database mysqltest1; +create table mysqltest1.t1 (i int); +create table mysqltest1.t2 (j int); +create table mysqltest1.t3 (k int, secret int); +create user alice@localhost; +create user bob@localhost; +create user cecil@localhost; +create user dan@localhost; +create user eugene@localhost; +create user fiona@localhost; +create user greg@localhost; +create user han@localhost; +create user inga@localhost; +create user jamie@localhost; +create user karl@localhost; +create user lena@localhost; +create user mhairi@localhost; +create user noam@localhost; +create user olga@localhost; +create user pjotr@localhost; +create user quintessa@localhost; +grant all privileges on mysqltest1.* to alice@localhost with grant option; +... as alice +connect test11765687,localhost,alice,,mysqltest1; +connection test11765687; +create view v1 as select * from t1; +create view v2 as select * from v1, t2; +create view v3 as select k from t3; +grant select on mysqltest1.v1 to bob@localhost; +grant show view on mysqltest1.v1 to cecil@localhost; +grant select, show view on mysqltest1.v1 to dan@localhost; +grant select on mysqltest1.t1 to dan@localhost; +grant select on mysqltest1.* to eugene@localhost; +grant select, show view on mysqltest1.v2 to fiona@localhost; +grant select, show view on mysqltest1.v2 to greg@localhost; +grant show view on mysqltest1.v1 to greg@localhost; +grant select(k) on mysqltest1.t3 to han@localhost; +grant select, show view on mysqltest1.v3 to han@localhost; +grant select on mysqltest1.t1 to inga@localhost; +grant select on mysqltest1.t2 to inga@localhost; +grant select on mysqltest1.v1 to inga@localhost; +grant select, show view on mysqltest1.v2 to inga@localhost; +grant select on mysqltest1.t1 to jamie@localhost; +grant select on mysqltest1.t2 to jamie@localhost; +grant show view on mysqltest1.v1 to jamie@localhost; +grant select, show view on mysqltest1.v2 to jamie@localhost; +grant select on mysqltest1.t1 to karl@localhost; +grant select on mysqltest1.t2 to karl@localhost; +grant select, show view on mysqltest1.v1 to karl@localhost; +grant select on mysqltest1.v2 to karl@localhost; +grant select on mysqltest1.t1 to lena@localhost; +grant select on mysqltest1.t2 to lena@localhost; +grant select, show view on mysqltest1.v1 to lena@localhost; +grant show view on mysqltest1.v2 to lena@localhost; +grant select on mysqltest1.t1 to mhairi@localhost; +grant select on mysqltest1.t2 to mhairi@localhost; +grant select, show view on mysqltest1.v1 to mhairi@localhost; +grant select, show view on mysqltest1.v2 to mhairi@localhost; +grant select on mysqltest1.t1 to noam@localhost; +grant select, show view on mysqltest1.v1 to noam@localhost; +grant select, show view on mysqltest1.v2 to noam@localhost; +grant select on mysqltest1.t2 to olga@localhost; +grant select, show view on mysqltest1.v1 to olga@localhost; +grant select, show view on mysqltest1.v2 to olga@localhost; +grant select on mysqltest1.t1 to pjotr@localhost; +grant select on mysqltest1.t2 to pjotr@localhost; +grant select, show view on mysqltest1.v2 to pjotr@localhost; +grant select, show view on mysqltest1.v1 to quintessa@localhost; +disconnect test11765687; +... as bob +connect test11765687,localhost,bob,,mysqltest1; +connection test11765687; +select * from v1; +i +explain select * from v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +disconnect test11765687; +... as cecil +connect test11765687,localhost,cecil,,mysqltest1; +connection test11765687; +select * from v1; +ERROR 42000: SELECT command denied to user 'cecil'@'localhost' for table 'v1' +explain select * from v1; +ERROR 42000: SELECT command denied to user 'cecil'@'localhost' for table 'v1' +disconnect test11765687; +... as dan +connect test11765687,localhost,dan,,mysqltest1; +connection test11765687; +select * from v1; +i +explain select * from v1; +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 +disconnect test11765687; +... as eugene +connect test11765687,localhost,eugene,,mysqltest1; +connection test11765687; +select * from v1; +i +explain select * from v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +disconnect test11765687; +... as fiona +connect test11765687,localhost,fiona,,mysqltest1; +connection test11765687; +select * from v2; +i j +show create view v2; +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`alice`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `v1`.`i` AS `i`,`t2`.`j` AS `j` from (`v1` join `t2`) latin1 latin1_swedish_ci +explain select * from t1; +ERROR 42000: SELECT command denied to user 'fiona'@'localhost' for table 't1' +explain select * from v1; +ERROR 42000: SELECT command denied to user 'fiona'@'localhost' for table 'v1' +explain select * from t2; +ERROR 42000: SELECT command denied to user 'fiona'@'localhost' for table 't2' +explain select * from v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +disconnect test11765687; +... as greg +connect test11765687,localhost,greg,,mysqltest1; +connection test11765687; +select * from v2; +i j +explain select * from v1; +ERROR 42000: SELECT command denied to user 'greg'@'localhost' for table 'v1' +explain select * from v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +disconnect test11765687; +... as han +connect test11765687,localhost,han,,mysqltest1; +connection test11765687; +select * from t3; +ERROR 42000: SELECT command denied to user 'han'@'localhost' for table 't3' +explain select * from t3; +ERROR 42000: SELECT command denied to user 'han'@'localhost' for table 't3' +select k from t3; +k +explain select k from t3; +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 +select * from v3; +k +explain select * from v3; +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 +disconnect test11765687; +... as inga +connect test11765687,localhost,inga,,mysqltest1; +connection test11765687; +select * from v2; +i j +explain select * from v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +disconnect test11765687; +... as jamie +connect test11765687,localhost,jamie,,mysqltest1; +connection test11765687; +select * from v2; +i j +explain select * from v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +disconnect test11765687; +... as karl +connect test11765687,localhost,karl,,mysqltest1; +connection test11765687; +select * from v2; +i j +explain select * from v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +disconnect test11765687; +... as lena +connect test11765687,localhost,lena,,mysqltest1; +connection test11765687; +select * from v2; +ERROR 42000: SELECT command denied to user 'lena'@'localhost' for table 'v2' +explain select * from v2; +ERROR 42000: SELECT command denied to user 'lena'@'localhost' for table 'v2' +disconnect test11765687; +... as mhairi +connect test11765687,localhost,mhairi,,mysqltest1; +connection test11765687; +select * from v2; +i j +explain select * from v2; +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 +1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found +disconnect test11765687; +... as noam +connect test11765687,localhost,noam,,mysqltest1; +connection test11765687; +select * from v2; +i j +explain select * from v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +disconnect test11765687; +... as olga +connect test11765687,localhost,olga,,mysqltest1; +connection test11765687; +select * from v2; +i j +explain select * from v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +disconnect test11765687; +... as pjotr +connect test11765687,localhost,pjotr,,mysqltest1; +connection test11765687; +select * from v2; +i j +explain select * from v2; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +disconnect test11765687; +... as quintessa +connect test11765687,localhost,quintessa,,mysqltest1; +connection test11765687; +select * from v1; +i +explain select * from v1; +ERROR HY000: ANALYZE/EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +disconnect test11765687; +... as root again at last: clean-up time! +connection root; +drop user alice@localhost; +drop user bob@localhost; +drop user cecil@localhost; +drop user dan@localhost; +drop user eugene@localhost; +drop user fiona@localhost; +drop user greg@localhost; +drop user han@localhost; +drop user inga@localhost; +drop user jamie@localhost; +drop user karl@localhost; +drop user lena@localhost; +drop user mhairi@localhost; +drop user noam@localhost; +drop user olga@localhost; +drop user pjotr@localhost; +drop user quintessa@localhost; +drop database mysqltest1; +disconnect root; +connection default; +select * from information_schema.table_privileges; +GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE +End of 5.0 tests. +connection default; +DROP VIEW IF EXISTS v1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT * FROM t1; +ALTER VIEW v1 AS SELECT * FROM t1; +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci +ALTER DEFINER=no_such@user_1 VIEW v1 AS SELECT * FROM t1; +Warnings: +Note 1449 The user specified as a definer ('no_such'@'user_1') does not exist +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci +Warnings: +Note 1449 The user specified as a definer ('no_such'@'user_1') does not exist +ALTER ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1; +Warnings: +Note 1449 The user specified as a definer ('no_such'@'user_1') does not exist +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=MERGE DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci +Warnings: +Note 1449 The user specified as a definer ('no_such'@'user_1') does not exist +ALTER ALGORITHM=TEMPTABLE DEFINER=no_such@user_2 VIEW v1 AS SELECT * FROM t1; +Warnings: +Note 1449 The user specified as a definer ('no_such'@'user_2') does not exist +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`no_such`@`user_2` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci +Warnings: +Note 1449 The user specified as a definer ('no_such'@'user_2') does not exist +DROP VIEW v1; +DROP TABLE t1; +CREATE USER mysqluser1@localhost; +CREATE DATABASE mysqltest1; +USE mysqltest1; +CREATE TABLE t1 ( a INT ); +CREATE TABLE t2 ( b INT ); +INSERT INTO t1 VALUES (1), (2); +INSERT INTO t2 VALUES (1), (2); +GRANT CREATE VIEW ON mysqltest1.* TO mysqluser1@localhost; +GRANT SELECT ON t1 TO mysqluser1@localhost; +GRANT INSERT ON t2 TO mysqluser1@localhost; +connect connection1, localhost, mysqluser1, , mysqltest1; +This would lead to failed assertion. +CREATE VIEW v1 AS SELECT a, b FROM t1, t2; +SELECT * FROM v1; +ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 'v1' +SELECT b FROM v1; +ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 'v1' +disconnect connection1; +connection default; +DROP TABLE t1, t2; +DROP VIEW v1; +DROP DATABASE mysqltest1; +DROP USER mysqluser1@localhost; +USE test; +End of 5.1 tests. +CREATE USER mysqluser1@localhost; +CREATE DATABASE mysqltest1; +USE mysqltest1; +CREATE TABLE t1 ( a INT, b INT ); +CREATE TABLE t2 ( a INT, b INT ); +CREATE VIEW v1 AS SELECT a, b FROM t1; +GRANT SELECT( a ) ON v1 TO mysqluser1@localhost; +GRANT UPDATE( b ) ON t2 TO mysqluser1@localhost; +connect connection1, localhost, mysqluser1, , test; +SELECT * FROM mysqltest1.v1; +ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 'v1' +CREATE VIEW v1 AS SELECT * FROM mysqltest1.t2; +ERROR 42000: ANY command denied to user 'mysqluser1'@'localhost' for table 't2' +disconnect connection1; +connection default; +DROP TABLE t1, t2; +DROP VIEW v1; +DROP DATABASE mysqltest1; +DROP USER mysqluser1@localhost; +CREATE USER mysqluser1@localhost; +CREATE DATABASE mysqltest1; +USE mysqltest1; +CREATE VIEW v1 AS SELECT * FROM information_schema.tables LIMIT 1; +CREATE ALGORITHM = TEMPTABLE VIEW v2 AS SELECT 1 AS A; +CREATE VIEW test.v3 AS SELECT 1 AS a; +connection default; +GRANT SELECT ON mysqltest1.* to mysqluser1@localhost; +GRANT ALL ON test.* TO mysqluser1@localhost; +connect connection1, localhost, mysqluser1, , test; +PREPARE stmt_v1 FROM "SELECT * FROM mysqltest1.v1"; +PREPARE stmt_v2 FROM "SELECT * FROM mysqltest1.v2"; +connection default; +REVOKE SELECT ON mysqltest1.* FROM mysqluser1@localhost; +connection connection1; +EXECUTE stmt_v1; +ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 'v1' +EXECUTE stmt_v2; +ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 'v2' +disconnect connection1; +connect connection2, localhost, mysqluser1,,; +PREPARE stmt FROM "SELECT a FROM v3"; +EXECUTE stmt; +a +1 +disconnect connection2; +connection default; +DROP VIEW v1, v2; +DROP DATABASE mysqltest1; +DROP VIEW test.v3; +DROP USER mysqluser1@localhost; +USE test; +# +# Bug#35996: SELECT + SHOW VIEW should be enough to display view +# definition +# +CREATE USER mysqluser1@localhost; +CREATE DATABASE mysqltest1; +CREATE DATABASE mysqltest2; +GRANT USAGE, SELECT, CREATE VIEW, SHOW VIEW +ON mysqltest2.* TO mysqluser1@localhost; +USE mysqltest1; +CREATE TABLE t1( a INT ); +CREATE TABLE t2( a INT, b INT ); +CREATE FUNCTION f1() RETURNS INT RETURN 1; +CREATE VIEW v1 AS SELECT 1 AS a; +CREATE VIEW v2 AS SELECT 1 AS a, 2 AS b; +GRANT SELECT ON TABLE t1 TO mysqluser1@localhost; +GRANT SELECT (a, b) ON TABLE t2 TO mysqluser1@localhost; +GRANT EXECUTE ON FUNCTION f1 TO mysqluser1@localhost; +GRANT SELECT ON TABLE v1 TO mysqluser1@localhost; +GRANT SELECT (a, b) ON TABLE v2 TO mysqluser1@localhost; +CREATE VIEW v_t1 AS SELECT * FROM t1; +CREATE VIEW v_t2 AS SELECT * FROM t2; +CREATE VIEW v_f1 AS SELECT f1() AS a; +CREATE VIEW v_v1 AS SELECT * FROM v1; +CREATE VIEW v_v2 AS SELECT * FROM v2; +GRANT SELECT, SHOW VIEW ON v_t1 TO mysqluser1@localhost; +GRANT SELECT, SHOW VIEW ON v_t2 TO mysqluser1@localhost; +GRANT SELECT, SHOW VIEW ON v_f1 TO mysqluser1@localhost; +GRANT SELECT, SHOW VIEW ON v_v1 TO mysqluser1@localhost; +GRANT SELECT, SHOW VIEW ON v_v2 TO mysqluser1@localhost; +connect connection1, localhost, mysqluser1,, mysqltest2; +CREATE VIEW v_mysqluser1_t1 AS SELECT * FROM mysqltest1.t1; +CREATE VIEW v_mysqluser1_t2 AS SELECT * FROM mysqltest1.t2; +CREATE VIEW v_mysqluser1_f1 AS SELECT mysqltest1.f1() AS a; +CREATE VIEW v_mysqluser1_v1 AS SELECT * FROM mysqltest1.v1; +CREATE VIEW v_mysqluser1_v2 AS SELECT * FROM mysqltest1.v2; +SHOW CREATE VIEW mysqltest1.v_t1; +View Create View character_set_client collation_connection +v_t1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_t1` AS select `mysqltest1`.`t1`.`a` AS `a` from `mysqltest1`.`t1` latin1 latin1_swedish_ci +SHOW CREATE VIEW mysqltest1.v_t2; +View Create View character_set_client collation_connection +v_t2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_t2` AS select `mysqltest1`.`t2`.`a` AS `a`,`mysqltest1`.`t2`.`b` AS `b` from `mysqltest1`.`t2` latin1 latin1_swedish_ci +SHOW CREATE VIEW mysqltest1.v_f1; +View Create View character_set_client collation_connection +v_f1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_f1` AS select `f1`() AS `a` latin1 latin1_swedish_ci +SHOW CREATE VIEW mysqltest1.v_v1; +View Create View character_set_client collation_connection +v_v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_v1` AS select `v1`.`a` AS `a` from `mysqltest1`.`v1` latin1 latin1_swedish_ci +SHOW CREATE VIEW mysqltest1.v_v2; +View Create View character_set_client collation_connection +v_v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_v2` AS select `v2`.`a` AS `a`,`v2`.`b` AS `b` from `mysqltest1`.`v2` latin1 latin1_swedish_ci +SHOW CREATE VIEW v_mysqluser1_t1; +View Create View character_set_client collation_connection +v_mysqluser1_t1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_t1` AS select `mysqltest1`.`t1`.`a` AS `a` from `mysqltest1`.`t1` latin1 latin1_swedish_ci +SHOW CREATE VIEW v_mysqluser1_t2; +View Create View character_set_client collation_connection +v_mysqluser1_t2 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_t2` AS select `mysqltest1`.`t2`.`a` AS `a`,`mysqltest1`.`t2`.`b` AS `b` from `mysqltest1`.`t2` latin1 latin1_swedish_ci +SHOW CREATE VIEW v_mysqluser1_f1; +View Create View character_set_client collation_connection +v_mysqluser1_f1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_f1` AS select `mysqltest1`.`f1`() AS `a` latin1 latin1_swedish_ci +SHOW CREATE VIEW v_mysqluser1_v1; +View Create View character_set_client collation_connection +v_mysqluser1_v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_v1` AS select `v1`.`a` AS `a` from `mysqltest1`.`v1` latin1 latin1_swedish_ci +SHOW CREATE VIEW v_mysqluser1_v2; +View Create View character_set_client collation_connection +v_mysqluser1_v2 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_v2` AS select `v2`.`a` AS `a`,`v2`.`b` AS `b` from `mysqltest1`.`v2` latin1 latin1_swedish_ci +connection default; +REVOKE SELECT ON TABLE t1 FROM mysqluser1@localhost; +REVOKE SELECT (a) ON TABLE t2 FROM mysqluser1@localhost; +REVOKE EXECUTE ON FUNCTION f1 FROM mysqluser1@localhost; +REVOKE SELECT ON TABLE v1 FROM mysqluser1@localhost; +connection connection1; +SHOW CREATE VIEW mysqltest1.v_t1; +View Create View character_set_client collation_connection +v_t1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_t1` AS select `mysqltest1`.`t1`.`a` AS `a` from `mysqltest1`.`t1` latin1 latin1_swedish_ci +SHOW CREATE VIEW mysqltest1.v_t2; +View Create View character_set_client collation_connection +v_t2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_t2` AS select `mysqltest1`.`t2`.`a` AS `a`,`mysqltest1`.`t2`.`b` AS `b` from `mysqltest1`.`t2` latin1 latin1_swedish_ci +SHOW CREATE VIEW mysqltest1.v_f1; +View Create View character_set_client collation_connection +v_f1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_f1` AS select `f1`() AS `a` latin1 latin1_swedish_ci +SHOW CREATE VIEW mysqltest1.v_v1; +View Create View character_set_client collation_connection +v_v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_v1` AS select `v1`.`a` AS `a` from `mysqltest1`.`v1` latin1 latin1_swedish_ci +SHOW CREATE VIEW mysqltest1.v_v2; +View Create View character_set_client collation_connection +v_v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_v2` AS select `v2`.`a` AS `a`,`v2`.`b` AS `b` from `mysqltest1`.`v2` latin1 latin1_swedish_ci +SHOW CREATE VIEW v_mysqluser1_t1; +View Create View character_set_client collation_connection +v_mysqluser1_t1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_t1` AS select `mysqltest1`.`t1`.`a` AS `a` from `mysqltest1`.`t1` latin1 latin1_swedish_ci +SHOW CREATE VIEW v_mysqluser1_t2; +View Create View character_set_client collation_connection +v_mysqluser1_t2 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_t2` AS select `mysqltest1`.`t2`.`a` AS `a`,`mysqltest1`.`t2`.`b` AS `b` from `mysqltest1`.`t2` latin1 latin1_swedish_ci +SHOW CREATE VIEW v_mysqluser1_f1; +View Create View character_set_client collation_connection +v_mysqluser1_f1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_f1` AS select `mysqltest1`.`f1`() AS `a` latin1 latin1_swedish_ci +SHOW CREATE VIEW v_mysqluser1_v1; +View Create View character_set_client collation_connection +v_mysqluser1_v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_v1` AS select `v1`.`a` AS `a` from `mysqltest1`.`v1` latin1 latin1_swedish_ci +SHOW CREATE VIEW v_mysqluser1_v2; +View Create View character_set_client collation_connection +v_mysqluser1_v2 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_v2` AS select `v2`.`a` AS `a`,`v2`.`b` AS `b` from `mysqltest1`.`v2` latin1 latin1_swedish_ci +connection default; +# Testing the case when the views reference missing objects. +# Obviously, there are no privileges to check for, so we +# need only each object type once. +DROP TABLE t1; +DROP FUNCTION f1; +DROP VIEW v1; +connection connection1; +SHOW CREATE VIEW mysqltest1.v_t1; +View Create View character_set_client collation_connection +v_t1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_t1` AS select `mysqltest1`.`t1`.`a` AS `a` from `mysqltest1`.`t1` latin1 latin1_swedish_ci +Warnings: +Warning 1356 View 'mysqltest1.v_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +SHOW CREATE VIEW mysqltest1.v_f1; +View Create View character_set_client collation_connection +v_f1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_f1` AS select `f1`() AS `a` latin1 latin1_swedish_ci +Warnings: +Warning 1356 View 'mysqltest1.v_f1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +SHOW CREATE VIEW mysqltest1.v_v1; +View Create View character_set_client collation_connection +v_v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest1`.`v_v1` AS select `v1`.`a` AS `a` from `mysqltest1`.`v1` latin1 latin1_swedish_ci +Warnings: +Warning 1356 View 'mysqltest1.v_v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +SHOW CREATE VIEW v_mysqluser1_t1; +View Create View character_set_client collation_connection +v_mysqluser1_t1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_t1` AS select `mysqltest1`.`t1`.`a` AS `a` from `mysqltest1`.`t1` latin1 latin1_swedish_ci +Warnings: +Warning 1356 View 'mysqltest2.v_mysqluser1_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +SHOW CREATE VIEW v_mysqluser1_f1; +View Create View character_set_client collation_connection +v_mysqluser1_f1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_f1` AS select `mysqltest1`.`f1`() AS `a` latin1 latin1_swedish_ci +Warnings: +Warning 1356 View 'mysqltest2.v_mysqluser1_f1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +SHOW CREATE VIEW v_mysqluser1_v1; +View Create View character_set_client collation_connection +v_mysqluser1_v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_v1` AS select `v1`.`a` AS `a` from `mysqltest1`.`v1` latin1 latin1_swedish_ci +Warnings: +Warning 1356 View 'mysqltest2.v_mysqluser1_v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +connection default; +REVOKE SHOW VIEW ON v_t1 FROM mysqluser1@localhost; +REVOKE SHOW VIEW ON v_f1 FROM mysqluser1@localhost; +REVOKE SHOW VIEW ON v_v1 FROM mysqluser1@localhost; +connection connection1; +SHOW CREATE VIEW mysqltest1.v_t1; +ERROR 42000: SHOW VIEW command denied to user 'mysqluser1'@'localhost' for table 'v_t1' +SHOW CREATE VIEW mysqltest1.v_f1; +ERROR 42000: SHOW VIEW command denied to user 'mysqluser1'@'localhost' for table 'v_f1' +SHOW CREATE VIEW mysqltest1.v_v1; +ERROR 42000: SHOW VIEW command denied to user 'mysqluser1'@'localhost' for table 'v_v1' +SHOW CREATE VIEW v_mysqluser1_t1; +View Create View character_set_client collation_connection +v_mysqluser1_t1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_t1` AS select `mysqltest1`.`t1`.`a` AS `a` from `mysqltest1`.`t1` latin1 latin1_swedish_ci +Warnings: +Warning 1356 View 'mysqltest2.v_mysqluser1_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +SHOW CREATE VIEW v_mysqluser1_f1; +View Create View character_set_client collation_connection +v_mysqluser1_f1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_f1` AS select `mysqltest1`.`f1`() AS `a` latin1 latin1_swedish_ci +Warnings: +Warning 1356 View 'mysqltest2.v_mysqluser1_f1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +SHOW CREATE VIEW v_mysqluser1_v1; +View Create View character_set_client collation_connection +v_mysqluser1_v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqluser1`@`localhost` SQL SECURITY DEFINER VIEW `v_mysqluser1_v1` AS select `v1`.`a` AS `a` from `mysqltest1`.`v1` latin1 latin1_swedish_ci +Warnings: +Warning 1356 View 'mysqltest2.v_mysqluser1_v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +disconnect connection1; +connection default; +DROP USER mysqluser1@localhost; +DROP DATABASE mysqltest1; +DROP DATABASE mysqltest2; +USE test; +CREATE TABLE t1( a INT ); +CREATE DEFINER = no_such_user@no_such_host VIEW v1 AS SELECT * FROM t1; +Warnings: +Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci +Warnings: +Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist +DROP TABLE t1; +DROP VIEW v1; +# +# Bug #46019: ERROR 1356 When selecting from within another +# view that has Group By +# +CREATE DATABASE mysqltest1; +USE mysqltest1; +CREATE TABLE t1 (a INT); +CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT a FROM t1 GROUP BY a; +CREATE SQL SECURITY INVOKER VIEW v2 AS SELECT a FROM v1; +CREATE USER mysqluser1; +GRANT SELECT ON TABLE t1 TO mysqluser1; +GRANT SELECT, SHOW VIEW ON TABLE v1 TO mysqluser1; +GRANT SELECT, SHOW VIEW ON TABLE v2 TO mysqluser1; +connect mysqluser1, localhost, mysqluser1,,mysqltest1; +SELECT a FROM v1; +a +SELECT a FROM v2; +a +connection default; +disconnect mysqluser1; +DROP USER mysqluser1; +DROP DATABASE mysqltest1; +USE test; +# +# Bug#47734: Assertion failed: ! is_set() when locking a view with non-existing definer +# +DROP VIEW IF EXISTS v1; +CREATE DEFINER=`unknown`@`unknown` SQL SECURITY DEFINER VIEW v1 AS SELECT 1; +Warnings: +Note 1449 The user specified as a definer ('unknown'@'unknown') does not exist +LOCK TABLES v1 READ; +ERROR HY000: The user specified as a definer ('unknown'@'unknown') does not exist +DROP VIEW v1; +# +# Bug #58499 "DEFINER-security view selecting from INVOKER-security view +# access check wrong". +# +# Check that we correctly handle privileges for various combinations +# of INVOKER and DEFINER-security views using each other. +DROP DATABASE IF EXISTS mysqltest1; +CREATE DATABASE mysqltest1; +USE mysqltest1; +CREATE TABLE t1 (i INT); +CREATE TABLE t2 (j INT); +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (2); +# +# 1) DEFINER-security view uses INVOKER-security view (covers +# scenario originally described in the bug report). +CREATE SQL SECURITY INVOKER VIEW v1_uses_t1 AS SELECT * FROM t1; +CREATE SQL SECURITY INVOKER VIEW v1_uses_t2 AS SELECT * FROM t2; +CREATE USER 'mysqluser1'@'%'; +GRANT CREATE VIEW ON mysqltest1.* TO 'mysqluser1'@'%'; +GRANT SELECT ON t1 TO 'mysqluser1'@'%'; +# To be able create 'v2_uses_t2' we also need select on t2. +GRANT SELECT ON t2 TO 'mysqluser1'@'%'; +GRANT SELECT ON v1_uses_t1 TO 'mysqluser1'@'%'; +GRANT SELECT ON v1_uses_t2 TO 'mysqluser1'@'%'; +connect mysqluser1, localhost, mysqluser1,,mysqltest1; +CREATE SQL SECURITY DEFINER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1; +CREATE SQL SECURITY DEFINER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2; +connection default; +CREATE USER 'mysqluser2'@'%'; +GRANT SELECT ON v2_uses_t1 TO 'mysqluser2'@'%'; +GRANT SELECT ON v2_uses_t2 TO 'mysqluser2'@'%'; +GRANT SELECT ON t2 TO 'mysqluser2'@'%'; +GRANT CREATE VIEW ON mysqltest1.* TO 'mysqluser2'@'%'; +# Make 'mysqluser1' unable to access t2. +REVOKE SELECT ON t2 FROM 'mysqluser1'@'%'; +connect mysqluser2, localhost, mysqluser2,,mysqltest1; +# The below statement should succeed thanks to suid nature of v2_uses_t1. +SELECT * FROM v2_uses_t1; +i +1 +# The below statement should fail due to suid nature of v2_uses_t2. +SELECT * FROM v2_uses_t2; +ERROR HY000: View 'mysqltest1.v2_uses_t2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +# +# 2) INVOKER-security view uses INVOKER-security view. +connection default; +DROP VIEW v2_uses_t1, v2_uses_t2; +CREATE SQL SECURITY INVOKER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1; +CREATE SQL SECURITY INVOKER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2; +GRANT SELECT ON v2_uses_t1 TO 'mysqluser1'@'%'; +GRANT SELECT ON v2_uses_t2 TO 'mysqluser1'@'%'; +GRANT SELECT ON v1_uses_t1 TO 'mysqluser2'@'%'; +GRANT SELECT ON v1_uses_t2 TO 'mysqluser2'@'%'; +connection mysqluser1; +# For both versions of 'v2' 'mysqluser1' privileges should be used. +SELECT * FROM v2_uses_t1; +i +1 +SELECT * FROM v2_uses_t2; +ERROR HY000: View 'mysqltest1.v2_uses_t2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +connection mysqluser2; +# And now for both versions of 'v2' 'mysqluser2' privileges should +# be used. +SELECT * FROM v2_uses_t1; +ERROR HY000: View 'mysqltest1.v2_uses_t1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +SELECT * FROM v2_uses_t2; +j +2 +# +# 3) INVOKER-security view uses DEFINER-security view. +connection default; +DROP VIEW v1_uses_t1, v1_uses_t2; +# To be able create 'v1_uses_t2' we also need select on t2. +GRANT SELECT ON t2 TO 'mysqluser1'@'%'; +connection mysqluser1; +CREATE SQL SECURITY DEFINER VIEW v1_uses_t1 AS SELECT * FROM t1; +CREATE SQL SECURITY DEFINER VIEW v1_uses_t2 AS SELECT * FROM t2; +connection default; +# Make 'mysqluser1' unable to access t2. +REVOKE SELECT ON t2 FROM 'mysqluser1'@'%'; +connection mysqluser2; +# Due to suid nature of v1_uses_t1 and v1_uses_t2 the first +# select should succeed and the second select should fail. +SELECT * FROM v2_uses_t1; +i +1 +SELECT * FROM v2_uses_t2; +ERROR HY000: View 'mysqltest1.v2_uses_t2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +# +# 4) DEFINER-security view uses DEFINER-security view. +connection default; +DROP VIEW v2_uses_t1, v2_uses_t2; +# To be able create 'v2_uses_t2' we also need select on t2. +GRANT SELECT ON t2 TO 'mysqluser1'@'%'; +connection mysqluser2; +CREATE SQL SECURITY DEFINER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1; +CREATE SQL SECURITY DEFINER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2; +connection default; +# Make 'mysqluser1' unable to access t2. +REVOKE SELECT ON t2 FROM 'mysqluser1'@'%'; +connection mysqluser2; +# Again privileges of creator of innermost views should apply. +SELECT * FROM v2_uses_t1; +i +1 +SELECT * FROM v2_uses_t2; +ERROR HY000: View 'mysqltest1.v2_uses_t2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +disconnect mysqluser1; +disconnect mysqluser2; +connection default; +USE test; +DROP DATABASE mysqltest1; +DROP USER 'mysqluser1'@'%'; +DROP USER 'mysqluser2'@'%'; +# +# Test for bug #11766767 - "59957: VIEW USING MERGE PERMISSIONS +# IN MULTI-TABLE UPDATE". +# +drop database if exists mysqltest1; +drop database if exists mysqltest2; +# +# Prepare playground. +create database mysqltest1; +create database mysqltest2; +create user user_11766767; +grant select on mysqltest1.* to user_11766767; +grant all on mysqltest2.* to user_11766767; +use mysqltest1; +create table t1 (id int primary key, val varchar(20)); +insert into t1 values (1, 'test1'); +create table t11 (id int primary key); +insert into t11 values (1); +create algorithm=temptable view v1_temp as select * from t1; +create algorithm=merge view v1_merge as select * from t1; +create algorithm=temptable view v11_temp as +select t1.id as id, t1.val as val from t1, t11 where t1.id= t11.id; +create algorithm=merge view v11_merge as +select t1.id as id, t1.val as val from t1, t11 where t1.id= t11.id; +use mysqltest2; +create table t2 (id int primary key, val varchar(20)); +insert into t2 values (1, 'test2'); +create table t21 (id int primary key); +insert into t21 values (1); +create algorithm=temptable view v2_temp as select * from t2; +create algorithm=merge view v2_merge as select * from t2; +create algorithm=temptable view v21_temp as +select t2.id as id, t2.val as val from t2, t21 where t2.id= t21.id; +create algorithm=merge view v21_merge as +select t2.id as id, t2.val as val from t2, t21 where t2.id= t21.id; +create algorithm=temptable sql security invoker view v3_temp as +select t1.id as id, t1.val as val from mysqltest1.t1 as t1, mysqltest1.t11 as t11 +where t1.id = t11.id; +create algorithm=merge sql security invoker view v3_merge as +select t1.id as id, t1.val as val from mysqltest1.t1 as t1, mysqltest1.t11 as t11 +where t1.id = t11.id; +create sql security invoker view v31 as +select t2.id as id, t2.val as val from mysqltest2.t2 as t2, mysqltest1.t11 as t11 +where t2.id = t11.id; +create sql security invoker view v4 as +select t2.id as id, t2.val as val from mysqltest2.t2 as t2, mysqltest1.v1_merge as v1 +where t2.id = v1.id; +create sql security invoker view v41 as +select v1.id as id, v1.val as val from mysqltest2.t2 as t2, mysqltest1.v1_merge as v1 +where t2.id = v1.id; +create sql security invoker view v42 as +select v2.id as id, v2.val as val from mysqltest2.t2 as t2, mysqltest2.v2_merge as v2 +where t2.id = v2.id; +connect conn_11766767, localhost, user_11766767,,; +# +# A) Check how we handle privilege checking in multi-update for +# directly used views. +# +# A.1) Originally reported problem, view is used in read-only mode. +# This should work with only SELECT privilege for both mergeable +# and temptable algorithms. +update mysqltest2.t2 as t2, mysqltest1.v1_merge as v1 set t2.val= 'test3' + where t2.id= v1.id; +update mysqltest2.t2 as t2, mysqltest1.v1_temp as v1 set t2.val= 'test4' + where t2.id= v1.id; +# +# A.2) If view is updated an UPDATE privilege on it is required. +# Temptable views can't be updated. +update mysqltest2.t2 as t2, mysqltest1.v1_merge as v1 set v1.val= 'test5' + where t2.id= v1.id; +ERROR 42000: UPDATE command denied to user 'user_11766767'@'localhost' for table 'v1_merge' +update mysqltest1.t1 as t1, mysqltest2.v2_merge as v2 set v2.val= 'test6' + where t1.id= v2.id; +# +# Note that the below error is OK even though user lacks UPDATE +# privilege on v1_temp since he/she still has SELECT privilege on +# this view. +update mysqltest2.t2 as t2, mysqltest1.v1_temp as v1 set v1.val= 'test7' + where t2.id= v1.id; +ERROR HY000: The target table v1 of the UPDATE is not updatable +update mysqltest1.t1 as t1, mysqltest2.v2_temp as v2 set v2.val= 'test8' + where t1.id= v2.id; +ERROR HY000: The target table v2 of the UPDATE is not updatable +# +# A.3) This also works for correctly for multi-table views. +# When usage is read-only SELECT is enough. +update mysqltest2.t2 as t2, mysqltest1.v11_merge as v11 set t2.val= 'test9' + where t2.id= v11.id; +update mysqltest2.t2 as t2, mysqltest1.v11_temp as v11 set t2.val= 'test10' + where t2.id= v11.id; +# When one of view's tables is updated, UPDATE is required +# on a view. +update mysqltest2.t2 as t2, mysqltest1.v11_merge as v11 set v11.val= 'test11' + where t2.id= v11.id; +ERROR 42000: UPDATE command denied to user 'user_11766767'@'localhost' for table 'v11_merge' +update mysqltest1.t1 as t1, mysqltest2.v21_merge as v21 set v21.val= 'test12' + where t1.id= v21.id; +# As before, temptable views are not updateable. +update mysqltest2.t2 as t2, mysqltest1.v11_temp as v11 set v11.val= 'test13' + where t2.id= v11.id; +ERROR HY000: The target table v11 of the UPDATE is not updatable +update mysqltest1.t1 as t1, mysqltest2.v21_temp as v21 set v21.val= 'test14' + where t1.id= v21.id; +ERROR HY000: The target table v21 of the UPDATE is not updatable +# +# B) Now check that correct privileges are required on underlying +# tables. To simplify this part of test we will use SECURITY +# INVOKER views in it. +# +# B.1) In case when view is used for read only it is enough to have +# SELECT on its underlying tables. +update mysqltest2.t2 as t2, mysqltest2.v3_merge as v3 set t2.val= 'test15' + where t2.id= v3.id; +update mysqltest2.t2 as t2, mysqltest2.v3_temp as v3 set t2.val= 'test16' + where t2.id= v3.id; +# +# B.2) If view is updated, UPDATE privilege on the table being updated +# is required (since we already checked that temptable views are +# not updateable we don't test them here). +update mysqltest2.t2 as t2, mysqltest2.v3_merge as v3 set v3.val= 'test17' + where t2.id= v3.id; +ERROR HY000: View 'mysqltest2.v3_merge' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +update mysqltest1.t11 as t11, mysqltest2.v31 as v31 set v31.val= 'test18' + where t11.id= v31.id; +# +# C) Finally, check how we handle privilege checking in case when +# view is used through another view. Again we will use SECURITY +# INVOKER views for simplicity. +# +# C.1) As usual, when a view used by another view is going to be used +# in read-only fashion, only SELECT privilege is necessary. +update mysqltest1.t11 as t11, mysqltest2.v4 as v4 set v4.val= 'test19' + where t11.id= v4.id; +# +# C.2) If one of underlying tables of the view is updated then +# UPDATE on a view is necessary. +update mysqltest1.t11 as t11, mysqltest2.v41 as v4 set v4.val= 'test20' + where t11.id= v4.id; +ERROR HY000: View 'mysqltest2.v41' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +update mysqltest1.t11 as t11, mysqltest2.v42 as v4 set v4.val= 'test20' + where t11.id= v4.id; +# +# Clean-up. +# +disconnect conn_11766767; +connection default; +drop user user_11766767; +drop database mysqltest1; +drop database mysqltest2; diff --cc mysql-test/main/win.result index 917fccaef21,00000000000..b872e058c6c mode 100644,000000..100644 --- a/mysql-test/main/win.result +++ b/mysql-test/main/win.result @@@ -1,3542 -1,0 +1,3631 @@@ +drop table if exists t1,t2; +drop view if exists v1; +# ######################################################################## +# # Parser tests +# ######################################################################## +# +# Check what happens when one attempts to use window function without OVER clause +create table t1 (a int, b int); +insert into t1 values (1,1),(2,2); +select row_number() from t1; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'from t1' at line 1 +select rank() from t1; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'from t1' at line 1 +# Attempt to use window function in the WHERE clause +select * from t1 where 1=rank() over (order by a); +ERROR HY000: Window function is allowed only in SELECT list and ORDER BY clause +select * from t1 where 1>row_number() over (partition by b order by a); +ERROR HY000: Window function is allowed only in SELECT list and ORDER BY clause +drop table t1; +# ######################################################################## +# # Functionality tests +# ######################################################################## +# +# Check if ROW_NUMBER() works in basic cases +create table t1(a int, b int, x char(32)); +insert into t1 values (2, 10, 'xx'); +insert into t1 values (2, 10, 'zz'); +insert into t1 values (2, 20, 'yy'); +insert into t1 values (3, 10, 'xxx'); +insert into t1 values (3, 20, 'vvv'); +select a, row_number() over (partition by a order by b) from t1; +a row_number() over (partition by a order by b) +2 1 +2 2 +2 3 +3 1 +3 2 +select a, b, x, row_number() over (partition by a order by x) from t1; +a b x row_number() over (partition by a order by x) +2 10 xx 1 +2 20 yy 2 +2 10 zz 3 +3 20 vvv 1 +3 10 xxx 2 +drop table t1; +create table t1 (pk int primary key, a int, b int); +insert into t1 values +(1, 10, 22), +(2, 11, 21), +(3, 12, 20), +(4, 13, 19), +(5, 14, 18); +select +pk, a, b, +row_number() over (order by a), +row_number() over (order by b) +from t1 +order by b; +pk a b row_number() over (order by a) row_number() over (order by b) +5 14 18 5 1 +4 13 19 4 2 +3 12 20 3 3 +2 11 21 2 4 +1 10 22 1 5 +drop table t1; +# +# Try RANK() function +# +create table t2 ( +pk int primary key, +a int +); +insert into t2 values +( 1 , 0), +( 2 , 0), +( 3 , 1), +( 4 , 1), +( 8 , 2), +( 5 , 2), +( 6 , 2), +( 7 , 2), +( 9 , 4), +(10 , 4); +select pk, a, rank() over (order by a) from t2; +pk a rank() over (order by a) +1 0 1 +10 4 9 +2 0 1 +3 1 3 +4 1 3 +5 2 5 +6 2 5 +7 2 5 +8 2 5 +9 4 9 +select pk, a, rank() over (order by a desc) from t2; +pk a rank() over (order by a desc) +1 0 9 +10 4 1 +2 0 9 +3 1 7 +4 1 7 +5 2 3 +6 2 3 +7 2 3 +8 2 3 +9 4 1 +drop table t2; +# +# Try Aggregates as window functions. With frames. +# +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (pk int, c int); +insert into t1 select a+1,1 from t0; +update t1 set c=2 where pk not in (1,2,3,4); +select * from t1; +pk c +1 1 +2 1 +3 1 +4 1 +5 2 +6 2 +7 2 +8 2 +9 2 +10 2 +select +pk, c, +count(*) over (partition by c order by pk +rows between 2 preceding and 2 following) as CNT +from t1; +pk c CNT +1 1 3 +2 1 4 +3 1 4 +4 1 3 +5 2 3 +6 2 4 +7 2 5 +8 2 5 +9 2 4 +10 2 3 +select +pk, c, +count(*) over (partition by c order by pk +rows between 1 preceding and 2 following) as CNT +from t1; +pk c CNT +1 1 3 +2 1 4 +3 1 3 +4 1 2 +5 2 3 +6 2 4 +7 2 4 +8 2 4 +9 2 3 +10 2 2 +select +pk, c, +count(*) over (partition by c order by pk +rows between 2 preceding and current row) as CNT +from t1; +pk c CNT +1 1 1 +2 1 2 +3 1 3 +4 1 3 +5 2 1 +6 2 2 +7 2 3 +8 2 3 +9 2 3 +10 2 3 +select +pk,c, +count(*) over (partition by c order by pk rows +between 1 following and 2 following) as CNT +from t1; +pk c CNT +1 1 2 +2 1 2 +3 1 1 +4 1 0 +5 2 2 +6 2 2 +7 2 2 +8 2 2 +9 2 1 +10 2 0 +select +pk,c, +count(*) over (partition by c order by pk rows +between 2 preceding and 1 preceding) as CNT +from t1; +pk c CNT +1 1 0 +2 1 1 +3 1 2 +4 1 2 +5 2 0 +6 2 1 +7 2 2 +8 2 2 +9 2 2 +10 2 2 +select +pk, c, +count(*) over (partition by c order by pk +rows between current row and 1 following) as CNT +from t1; +pk c CNT +1 1 2 +2 1 2 +3 1 2 +4 1 1 +5 2 2 +6 2 2 +7 2 2 +8 2 2 +9 2 2 +10 2 1 +# Check ORDER BY DESC +select +pk, c, +count(*) over (partition by c order by pk desc +rows between 2 preceding and 2 following) as CNT +from t1; +pk c CNT +4 1 3 +3 1 4 +2 1 4 +1 1 3 +10 2 3 +9 2 4 +8 2 5 +7 2 5 +6 2 4 +5 2 3 +drop table t0,t1; +# +# Resolution of window names +# +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (pk int, c int); +insert into t1 select a+1,1 from t0; +update t1 set c=2 where pk not in (1,2,3,4); +select * from t1; +pk c +1 1 +2 1 +3 1 +4 1 +5 2 +6 2 +7 2 +8 2 +9 2 +10 2 +select +pk, c, +count(*) over w1 as CNT +from t1 +window w1 as (partition by c order by pk +rows between 2 preceding and 2 following); +pk c CNT +1 1 3 +2 1 4 +3 1 4 +4 1 3 +5 2 3 +6 2 4 +7 2 5 +8 2 5 +9 2 4 +10 2 3 +select +pk, c, +count(*) over (w1 rows between 2 preceding and 2 following) as CNT +from t1 +window w1 as (partition by c order by pk); +pk c CNT +1 1 3 +2 1 4 +3 1 4 +4 1 3 +5 2 3 +6 2 4 +7 2 5 +8 2 5 +9 2 4 +10 2 3 +select +pk, c, +count(*) over (w1 order by pk rows between 2 preceding and 2 following) as CNT +from t1 +window w1 as (partition by c); +pk c CNT +1 1 3 +2 1 4 +3 1 4 +4 1 3 +5 2 3 +6 2 4 +7 2 5 +8 2 5 +9 2 4 +10 2 3 +select +pk, c, +count(*) over (w2 rows between 2 preceding and 2 following) as CNT +from t1 +window w1 as (partition by c), w2 as (w1 order by pk); +pk c CNT +1 1 3 +2 1 4 +3 1 4 +4 1 3 +5 2 3 +6 2 4 +7 2 5 +8 2 5 +9 2 4 +10 2 3 +select +pk, c, +count(*) over w3 as CNT +from t1 +window +w1 as (partition by c), +w2 as (w1 order by pk), +w3 as (w2 rows between 2 preceding and 2 following); +pk c CNT +1 1 3 +2 1 4 +3 1 4 +4 1 3 +5 2 3 +6 2 4 +7 2 5 +8 2 5 +9 2 4 +10 2 3 +select +pk, c, +count(*) over w as CNT +from t1 +window w1 as (partition by c order by pk +rows between 2 preceding and 2 following); +ERROR HY000: Window specification with name 'w' is not defined +select +pk, c, +count(*) over (w2 rows between 2 preceding and 2 following) as CNT +from t1 +window w1 as (partition by c), w1 as (order by pk); +ERROR HY000: Multiple window specifications with the same name 'w1' +select +pk, c, +count(*) over (w2 rows between 2 preceding and 2 following) as CNT +from t1 +window w1 as (partition by c), w2 as (w partition by c order by pk); +ERROR HY000: Window specification with name 'w' is not defined +select +pk, c, +count(*) over (w2 rows between 2 preceding and 2 following) as CNT +from t1 +window w1 as (partition by c), w2 as (w1 partition by c order by pk); +ERROR HY000: Window specification referencing another one 'w1' cannot contain partition list +select +pk, c, +count(*) over (w2 rows between 2 preceding and 2 following) as CNT +from t1 +window w1 as (partition by c order by pk), w2 as (w1 order by pk); +ERROR HY000: Referenced window specification 'w1' already contains order list +select +pk, c, +count(*) over w3 as CNT +from t1 +window +w1 as (partition by c), +w2 as (w1 order by pk rows between 3 preceding and 2 following), +w3 as (w2 rows between 2 preceding and 2 following); +ERROR HY000: Referenced window specification 'w2' cannot contain window frame +select +pk, c, +count(*) over w1 as CNT +from t1 +window w1 as (partition by c order by pk +rows between unbounded following and 2 following); +ERROR HY000: Unacceptable combination of window frame bound specifications +select +pk, c, +count(*) over (w1 rows between 2 preceding and unbounded preceding) as CNT +from t1 +window w1 as (partition by c order by pk); +ERROR HY000: Unacceptable combination of window frame bound specifications +select +pk, c, +count(*) over (w1 order by pk rows between current row and 2 preceding) as CNT +from t1 +window w1 as (partition by c); +ERROR HY000: Unacceptable combination of window frame bound specifications +select +pk, c, +count(*) over (w2 rows between 2 following and current row) as CNT +from t1 +window w1 as (partition by c), w2 as (w1 order by pk); +ERROR HY000: Unacceptable combination of window frame bound specifications +select +pk, c +from t1 where rank() over w1 > 2 +window w1 as (partition by c order by pk); +ERROR HY000: Window function is allowed only in SELECT list and ORDER BY clause +select +c, max(pk) as m +from t1 +group by c + rank() over w1 +window w1 as (order by m); +ERROR HY000: Window function is allowed only in SELECT list and ORDER BY clause +select +c, max(pk) as m, rank() over w1 as r +from t1 +group by c+r +window w1 as (order by m); +ERROR HY000: Window function is allowed only in SELECT list and ORDER BY clause +select +c, max(pk) as m, rank() over w1 as r +from t1 +group by c having c+r > 3 +window w1 as (order by m); +ERROR HY000: Window function is allowed only in SELECT list and ORDER BY clause +select +c, max(pk) as m, rank() over w1 as r, +rank() over (partition by r+1 order by m) +from t1 +group by c +window w1 as (order by m); +ERROR HY000: Window function is not allowed in window specification +select +c, max(pk) as m, rank() over w1 as r, +rank() over (partition by m order by r) +from t1 +group by c +window w1 as (order by m); +ERROR HY000: Window function is not allowed in window specification +select +c, max(pk) as m, rank() over w1 as r, dense_rank() over w2 as dr +from t1 +group by c +window w1 as (order by m), w2 as (partition by r order by m); +ERROR HY000: Window function is not allowed in window specification +select +pk, c, +row_number() over (partition by c order by pk +range between unbounded preceding and current row) as r +from t1; +ERROR HY000: Window frame is not allowed with 'row_number' +select +pk, c, +rank() over w1 as r +from t1 +window w1 as (partition by c order by pk +rows between 2 preceding and 2 following); +ERROR HY000: Window frame is not allowed with 'rank' +select +pk, c, +dense_rank() over (partition by c order by pk +rows between 1 preceding and 1 following) as r +from t1; +ERROR HY000: Window frame is not allowed with 'dense_rank' +select +pk, c, +rank() over w1 as r +from t1 +window w1 as (partition by c); +ERROR HY000: No order list in window specification for 'rank' +select +pk, c, +dense_rank() over (partition by c) as r +from t1; +ERROR HY000: No order list in window specification for 'dense_rank' +drop table t0,t1; +# +# MDEV-9634: Window function produces incorrect value +# +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (part_id int, pk int, a int); +insert into t2 select +if(a<5, 0, 1), a, if(a<5, NULL, 1) from t0; +select * from t2; +part_id pk a +0 0 NULL +0 1 NULL +0 2 NULL +0 3 NULL +0 4 NULL +1 5 1 +1 6 1 +1 7 1 +1 8 1 +1 9 1 +select +part_id, pk, a, +count(a) over (partition by part_id order by pk +rows between 1 preceding and 1 following) as CNT +from t2; +part_id pk a CNT +0 0 NULL 0 +0 1 NULL 0 +0 2 NULL 0 +0 3 NULL 0 +0 4 NULL 0 +1 5 1 2 +1 6 1 3 +1 7 1 3 +1 8 1 3 +1 9 1 2 +drop table t0, t2; +# +# RANGE-type bounds +# +create table t3 ( +pk int, +val int +); +insert into t3 values +(0, 1), +(1, 1), +(2, 1), +(3, 2), +(4, 2), +(5, 2), +(6, 2); +select +val, +count(val) over (order by val +range between current row and +current row) +as CNT +from t3; +val CNT +1 3 +1 3 +1 3 +2 4 +2 4 +2 4 +2 4 +insert into t3 values +(7, 3), +(8, 3); +select +val, +count(val) over (order by val +range between current row and +current row) +as CNT +from t3; +val CNT +1 3 +1 3 +1 3 +2 4 +2 4 +2 4 +2 4 +3 2 +3 2 +drop table t3; +# Now, check with PARTITION BY +create table t4 ( +part_id int, +pk int, +val int +); +insert into t4 values +(1234, 100, 1), +(1234, 101, 1), +(1234, 102, 1), +(1234, 103, 2), +(1234, 104, 2), +(1234, 105, 2), +(1234, 106, 2), +(1234, 107, 3), +(1234, 108, 3), +(5678, 200, 1), +(5678, 201, 1), +(5678, 202, 1), +(5678, 203, 2), +(5678, 204, 2), +(5678, 205, 2), +(5678, 206, 2), +(5678, 207, 3), +(5678, 208, 3); +select +part_id, +val, +count(val) over (partition by part_id +order by val +range between current row and +current row) +as CNT +from t4; +part_id val CNT +1234 1 3 +1234 1 3 +1234 1 3 +1234 2 4 +1234 2 4 +1234 2 4 +1234 2 4 +1234 3 2 +1234 3 2 +5678 1 3 +5678 1 3 +5678 1 3 +5678 2 4 +5678 2 4 +5678 2 4 +5678 2 4 +5678 3 2 +5678 3 2 +# +# Try RANGE UNBOUNDED PRECEDING | FOLLOWING +# +select +part_id, +val, +count(val) over (partition by part_id +order by val +range between unbounded preceding and +current row) +as CNT +from t4; +part_id val CNT +1234 1 3 +1234 1 3 +1234 1 3 +1234 2 7 +1234 2 7 +1234 2 7 +1234 2 7 +1234 3 9 +1234 3 9 +5678 1 3 +5678 1 3 +5678 1 3 +5678 2 7 +5678 2 7 +5678 2 7 +5678 2 7 +5678 3 9 +5678 3 9 +select +part_id, +val, +count(val) over (partition by part_id +order by val +range between current row and +unbounded following) +as CNT +from t4; +part_id val CNT +1234 1 9 +1234 1 9 +1234 1 9 +1234 2 6 +1234 2 6 +1234 2 6 +1234 2 6 +1234 3 2 +1234 3 2 +5678 1 9 +5678 1 9 +5678 1 9 +5678 2 6 +5678 2 6 +5678 2 6 +5678 2 6 +5678 3 2 +5678 3 2 +select +part_id, +val, +count(val) over (partition by part_id +order by val +range between unbounded preceding and +unbounded following) +as CNT +from t4; +part_id val CNT +1234 1 9 +1234 1 9 +1234 1 9 +1234 2 9 +1234 2 9 +1234 2 9 +1234 2 9 +1234 3 9 +1234 3 9 +5678 1 9 +5678 1 9 +5678 1 9 +5678 2 9 +5678 2 9 +5678 2 9 +5678 2 9 +5678 3 9 +5678 3 9 +drop table t4; +# +# MDEV-9695: Wrong window frame when using RANGE BETWEEN N FOLLOWING AND PRECEDING +# +create table t1 (pk int, a int, b int); +insert into t1 values +( 1 , 0, 1), +( 2 , 0, 2), +( 3 , 1, 4), +( 4 , 1, 8), +( 5 , 2, 32), +( 6 , 2, 64), +( 7 , 2, 128), +( 8 , 2, 16); +select pk, a, b, +bit_or(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) as bit_or +from t1; +pk a b bit_or +1 0 1 3 +2 0 2 3 +3 1 4 12 +4 1 8 12 +5 2 32 96 +6 2 64 224 +7 2 128 208 +8 2 16 144 +# Extra ROWS n PRECEDING tests +select pk, a, b, +bit_or(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) as bit_or +from t1; +pk a b bit_or +1 0 1 0 +2 0 2 1 +3 1 4 0 +4 1 8 4 +5 2 32 0 +6 2 64 32 +7 2 128 64 +8 2 16 128 +drop table t1; +create table t2 ( +pk int, +a int, +b int +); +insert into t2 values +( 1, 0, 1), +( 2, 0, 2), +( 3, 0, 4), +( 4, 0, 8), +( 5, 1, 16), +( 6, 1, 32), +( 7, 1, 64), +( 8, 1, 128), +( 9, 2, 256), +(10, 2, 512), +(11, 2, 1024), +(12, 2, 2048); +select pk, a, b, +bit_or(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) as bit_or +from t2; +pk a b bit_or +1 0 1 0 +2 0 2 1 +3 0 4 2 +4 0 8 4 +5 1 16 0 +6 1 32 16 +7 1 64 32 +8 1 128 64 +9 2 256 0 +10 2 512 256 +11 2 1024 512 +12 2 2048 1024 +select pk, a, b, +bit_or(b) over (partition by a order by pk ROWS BETWEEN 2 PRECEDING AND 2 PRECEDING) as bit_or +from t2; +pk a b bit_or +1 0 1 0 +2 0 2 0 +3 0 4 1 +4 0 8 2 +5 1 16 0 +6 1 32 0 +7 1 64 16 +8 1 128 32 +9 2 256 0 +10 2 512 0 +11 2 1024 256 +12 2 2048 512 +select pk, a, b, +bit_or(b) over (partition by a order by pk ROWS BETWEEN 2 PRECEDING AND 1 PRECEDING) as bit_or +from t2; +pk a b bit_or +1 0 1 0 +2 0 2 1 +3 0 4 3 +4 0 8 6 +5 1 16 0 +6 1 32 16 +7 1 64 48 +8 1 128 96 +9 2 256 0 +10 2 512 256 +11 2 1024 768 +12 2 2048 1536 +# Check CURRENT ROW +select pk, a, b, +bit_or(b) over (partition by a order by pk ROWS BETWEEN CURRENT ROW AND CURRENT ROW) as bit_or +from t2; +pk a b bit_or +1 0 1 1 +2 0 2 2 +3 0 4 4 +4 0 8 8 +5 1 16 16 +6 1 32 32 +7 1 64 64 +8 1 128 128 +9 2 256 256 +10 2 512 512 +11 2 1024 1024 +12 2 2048 2048 +drop table t2; +# +# Try RANGE PRECEDING|FOLLWING n +# +create table t1 ( +part_id int, +pk int, +a int +); +insert into t1 values +(10, 1, 1), +(10, 2, 2), +(10, 3, 4), +(10, 4, 8), +(10, 5,26), +(10, 6,27), +(10, 7,40), +(10, 8,71), +(10, 9,72); +select +pk, a, +count(a) over (ORDER BY a +RANGE BETWEEN UNBOUNDED PRECEDING +AND 10 FOLLOWING) as cnt +from t1; +pk a cnt +1 1 4 +2 2 4 +3 4 4 +4 8 4 +5 26 6 +6 27 6 +7 40 7 +8 71 9 +9 72 9 +select +pk, a, +count(a) over (ORDER BY a DESC +RANGE BETWEEN UNBOUNDED PRECEDING +AND 10 FOLLOWING) as cnt +from t1; +pk a cnt +9 72 2 +8 71 2 +7 40 3 +6 27 5 +5 26 5 +4 8 9 +3 4 9 +2 2 9 +1 1 9 +select +pk, a, +count(a) over (ORDER BY a +RANGE BETWEEN UNBOUNDED PRECEDING +AND 1 FOLLOWING) as cnt +from t1; +pk a cnt +1 1 2 +2 2 2 +3 4 3 +4 8 4 +5 26 6 +6 27 6 +7 40 7 +8 71 9 +9 72 9 +select +pk, a, +count(a) over (ORDER BY a +RANGE BETWEEN UNBOUNDED PRECEDING +AND 10 PRECEDING) as cnt +from t1; +pk a cnt +1 1 0 +2 2 0 +3 4 0 +4 8 0 +5 26 4 +6 27 4 +7 40 6 +8 71 7 +9 72 7 +select +pk, a, +count(a) over (ORDER BY a DESC +RANGE BETWEEN UNBOUNDED PRECEDING +AND 10 PRECEDING) as cnt +from t1; +pk a cnt +9 72 0 +8 71 0 +7 40 2 +6 27 3 +5 26 3 +4 8 5 +3 4 5 +2 2 5 +1 1 5 +select +pk, a, +count(a) over (ORDER BY a +RANGE BETWEEN UNBOUNDED PRECEDING +AND 1 PRECEDING) as cnt +from t1; +pk a cnt +1 1 0 +2 2 1 +3 4 2 +4 8 3 +5 26 4 +6 27 5 +7 40 6 +8 71 7 +9 72 8 +select +pk, a, +count(a) over (ORDER BY a +RANGE BETWEEN 1 PRECEDING +AND CURRENT ROW) as cnt +from t1; +pk a cnt +1 1 1 +2 2 2 +3 4 1 +4 8 1 +5 26 1 +6 27 2 +7 40 1 +8 71 1 +9 72 2 +select +pk, a, +count(a) over (ORDER BY a DESC +RANGE BETWEEN 1 PRECEDING +AND CURRENT ROW) as cnt +from t1; +pk a cnt +9 72 1 +8 71 2 +7 40 1 +6 27 1 +5 26 2 +4 8 1 +3 4 1 +2 2 1 +1 1 2 +select +pk, a, +count(a) over (ORDER BY a +RANGE BETWEEN 1 FOLLOWING +AND 3 FOLLOWING) as cnt +from t1; +pk a cnt +1 1 2 +2 2 1 +3 4 0 +4 8 0 +5 26 1 +6 27 0 +7 40 0 +8 71 1 +9 72 0 +# Try CURRENT ROW with[out] DESC +select +pk, a, +count(a) over (ORDER BY a +RANGE BETWEEN CURRENT ROW +AND 1 FOLLOWING) as cnt +from t1; +pk a cnt +1 1 2 +2 2 1 +3 4 1 +4 8 1 +5 26 2 +6 27 1 +7 40 1 +8 71 2 +9 72 1 +select +pk, a, +count(a) over (order by a desc +range between current row +and 1 following) as cnt +from t1; +pk a cnt +9 72 2 +8 71 1 +7 40 1 +6 27 2 +5 26 1 +4 8 1 +3 4 1 +2 2 2 +1 1 1 +insert into t1 select 22, pk, a from t1; +select +part_id, pk, a, +count(a) over (PARTITION BY part_id +ORDER BY a +RANGE BETWEEN UNBOUNDED PRECEDING +AND 10 FOLLOWING) as cnt +from t1; +part_id pk a cnt +10 1 1 4 +10 2 2 4 +10 3 4 4 +10 4 8 4 +10 5 26 6 +10 6 27 6 +10 7 40 7 +10 8 71 9 +10 9 72 9 +22 1 1 4 +22 2 2 4 +22 3 4 4 +22 4 8 4 +22 5 26 6 +22 6 27 6 +22 7 40 7 +22 8 71 9 +22 9 72 9 +select +pk, a, +count(a) over (PARTITION BY part_id +ORDER BY a +RANGE BETWEEN UNBOUNDED PRECEDING +AND 1 PRECEDING) as cnt +from t1; +pk a cnt +1 1 0 +2 2 1 +3 4 2 +4 8 3 +5 26 4 +6 27 5 +7 40 6 +8 71 7 +9 72 8 +1 1 0 +2 2 1 +3 4 2 +4 8 3 +5 26 4 +6 27 5 +7 40 6 +8 71 7 +9 72 8 +drop table t1; +# Try a RANGE frame over non-integer datatype: +create table t1 ( +col1 int, +a decimal(5,3) +); +insert into t1 values (1, 0.45); +insert into t1 values (1, 0.5); +insert into t1 values (1, 0.55); +insert into t1 values (1, 1.21); +insert into t1 values (1, 1.22); +insert into t1 values (1, 3.33); +select +a, +count(col1) over (order by a +range between 0.1 preceding +and 0.1 following) +from t1; +a count(col1) over (order by a +range between 0.1 preceding +and 0.1 following) +0.450 3 +0.500 3 +0.550 3 +1.210 2 +1.220 2 +3.330 1 +drop table t1; +# +# RANGE-type frames and NULL values +# +create table t1 ( +pk int, +a int, +b int +); +insert into t1 values (1, NULL,1); +insert into t1 values (2, NULL,1); +insert into t1 values (3, NULL,1); +insert into t1 values (4, 10 ,1); +insert into t1 values (5, 11 ,1); +insert into t1 values (6, 12 ,1); +insert into t1 values (7, 13 ,1); +insert into t1 values (8, 14 ,1); +select +pk, a, +count(b) over (order by a +range between 2 preceding +and 2 following) as CNT +from t1 +order by a, pk; +pk a CNT +1 NULL 3 +2 NULL 3 +3 NULL 3 +4 10 3 +5 11 4 +6 12 5 +7 13 4 +8 14 3 +drop table t1; +# +# Try ranges that have bound1 > bound2. The standard actually allows them +# +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (pk int, c int); +insert into t1 select a+1,1 from t0; +update t1 set c=2 where pk not in (1,2,3,4); +select * from t1; +pk c +1 1 +2 1 +3 1 +4 1 +5 2 +6 2 +7 2 +8 2 +9 2 +10 2 +select +pk, c, +count(*) over (partition by c +order by pk +rows between 1 preceding +and 2 preceding) +as cnt +from t1; +pk c cnt +1 1 0 +2 1 0 +3 1 0 +4 1 0 +5 2 0 +6 2 0 +7 2 0 +8 2 0 +9 2 0 +10 2 0 +select +pk, c, +sum(c) over (partition by c +order by pk +rows between 1 preceding +and 2 preceding) +as sum +from t1; +pk c sum +1 1 NULL +2 1 NULL +3 1 NULL +4 1 NULL +5 2 NULL +6 2 NULL +7 2 NULL +8 2 NULL +9 2 NULL +10 2 NULL +select +pk, c, +sum(c) over (partition by c +order by pk +rows between 2 following +and 1 following) +as sum +from t1; +pk c sum +1 1 NULL +2 1 NULL +3 1 NULL +4 1 NULL +5 2 NULL +6 2 NULL +7 2 NULL +8 2 NULL +9 2 NULL +10 2 NULL +select +pk, c, +count(*) over (partition by c +order by pk +range between 1 preceding +and 2 preceding) +as cnt +from t1; +pk c cnt +1 1 0 +2 1 0 +3 1 0 +4 1 0 +5 2 0 +6 2 0 +7 2 0 +8 2 0 +9 2 0 +10 2 0 +drop table t0, t1; +# +# Error checking for frame bounds +# +create table t1 (a int, b int, c varchar(32)); +insert into t1 values (1,1,'foo'); +insert into t1 values (2,2,'bar'); +select +count(*) over (order by a,b +range between unbounded preceding and current row) +from t1; +ERROR HY000: RANGE-type frame requires ORDER BY clause with single sort key +select +count(*) over (order by c +range between unbounded preceding and current row) +from t1; +ERROR HY000: Numeric datatype is required for RANGE-type frame +select +count(*) over (order by a +range between 'abcd' preceding and current row) +from t1; +ERROR HY000: Numeric datatype is required for RANGE-type frame +select +count(*) over (order by a +range between current row and 'foo' following) +from t1; +ERROR HY000: Numeric datatype is required for RANGE-type frame +# Try range frame with invalid bounds +select +count(*) over (order by a +rows between 0.5 preceding and current row) +from t1; +ERROR HY000: Integer is required for ROWS-type frame +select +count(*) over (order by a +rows between current row and 3.14 following) +from t1; +ERROR HY000: Integer is required for ROWS-type frame +# +# EXCLUDE clause is parsed but not supported +# +select +count(*) over (order by a +rows between 1 preceding and 1 following +exclude current row) +from t1; +ERROR HY000: Frame exclusion is not supported yet +select +count(*) over (order by a +range between 1 preceding and 1 following +exclude ties) +from t1; +ERROR HY000: Frame exclusion is not supported yet +select +count(*) over (order by a +range between 1 preceding and 1 following +exclude group) +from t1; +ERROR HY000: Frame exclusion is not supported yet +select +count(*) over (order by a +rows between 1 preceding and 1 following +exclude no others) +from t1; +count(*) over (order by a +rows between 1 preceding and 1 following +exclude no others) +2 +2 +drop table t1; +# +# Window function in grouping query +# +create table t1 ( +username varchar(32), +amount int +); +insert into t1 values +('user1',1), +('user1',5), +('user1',3), +('user2',10), +('user2',20), +('user2',30); +select +username, +sum(amount) as s, +rank() over (order by s desc) +from t1 +group by username; +username s rank() over (order by s desc) +user1 9 2 +user2 60 1 +drop table t1; +# +# mdev-9719: Window function in prepared statement +# +create table t1(a int, b int, x char(32)); +insert into t1 values (2, 10, 'xx'); +insert into t1 values (2, 10, 'zz'); +insert into t1 values (2, 20, 'yy'); +insert into t1 values (3, 10, 'xxx'); +insert into t1 values (3, 20, 'vvv'); +prepare stmt from 'select a, row_number() over (partition by a order by b) from t1'; +execute stmt; +a row_number() over (partition by a order by b) +2 1 +2 2 +2 3 +3 1 +3 2 +drop table t1; +# +# mdev-9754: Window name resolution in prepared statement +# +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (pk int, c int); +insert into t1 select a+1,1 from t0; +update t1 set c=2 where pk not in (1,2,3,4); +select * from t1; +pk c +1 1 +2 1 +3 1 +4 1 +5 2 +6 2 +7 2 +8 2 +9 2 +10 2 +prepare stmt from +'select + pk, c, + count(*) over w1 as CNT +from t1 +window w1 as (partition by c order by pk + rows between 2 preceding and 2 following)'; +execute stmt; +pk c CNT +1 1 3 +2 1 4 +3 1 4 +4 1 3 +5 2 3 +6 2 4 +7 2 5 +8 2 5 +9 2 4 +10 2 3 +drop table t0,t1; +# +# EXPLAIN FORMAT=JSON support for window functions +# +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +explain format=json select rank() over (order by a) from t0; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "window_functions_computation": { + "sorts": { + "filesort": { + "sort_key": "t0.a" + } + }, + "temporary_table": { + "table": { + "table_name": "t0", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + } + } + } + } +} +create table t1 (a int, b int, c int); +insert into t1 select a,a,a from t0; +explain format=json +select +a, +rank() over (order by sum(b)) +from t1 +group by a; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "filesort": { + "sort_key": "t1.a", + "window_functions_computation": { + "sorts": { + "filesort": { + "sort_key": "sum(t1.b)" + } + }, + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + } + } + } + } + } +} +explain format=json +select +a, +rank() over (order by sum(b)) +from t1 +group by a +order by null; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "window_functions_computation": { + "sorts": { + "filesort": { + "sort_key": "sum(t1.b)" + } + }, + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + } + } + } + } +} +# +# Check how window function works together with GROUP BY and HAVING +# +select b,max(a) as MX, rank() over (order by b) from t1 group by b having MX in (3,5,7); +b MX rank() over (order by b) +3 3 1 +5 5 2 +7 7 3 +explain format=json +select b,max(a) as MX, rank() over (order by b) from t1 group by b having MX in (3,5,7); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "having_condition": "MX in (3,5,7)", + "filesort": { + "sort_key": "t1.b", + "window_functions_computation": { + "sorts": { + "filesort": { + "sort_key": "t1.b" + } + }, + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 10, + "filtered": 100 + } + } + } + } + } +} +drop table t1; +drop table t0; +# +# Building ordering index for window functions +# +create table t1 ( +pk int primary key, +a int, +b int, +c int +); +insert into t1 values +(101 , 0, 10, 1), +(102 , 0, 10, 2), +(103 , 1, 10, 3), +(104 , 1, 10, 4), +(108 , 2, 10, 5), +(105 , 2, 20, 6), +(106 , 2, 20, 7), +(107 , 2, 20, 8), +(109 , 4, 20, 9), +(110 , 4, 20, 10), +(111 , 5, NULL, 11), +(112 , 5, 1, 12), +(113 , 5, NULL, 13), +(114 , 5, NULL, 14), +(115 , 5, NULL, 15), +(116 , 6, 1, NULL), +(117 , 6, 1, 10), +(118 , 6, 1, 1), +(119 , 6, 1, NULL), +(120 , 6, 1, NULL), +(121 , 6, 1, NULL), +(122 , 6, 1, 2), +(123 , 6, 1, 20), +(124 , 6, 1, -10), +(125 , 6, 1, NULL), +(126 , 6, 1, NULL), +(127 , 6, 1, NULL); +select sum(b) over (partition by a order by b,pk +rows between unbounded preceding and current row) as c1, +avg(b) over (w1 rows between 1 preceding and 1 following) as c2, +sum(c) over (w2 rows between 1 preceding and 1 following) as c5, +avg(b) over (w1 rows between 5 preceding and 5 following) as c3, +sum(b) over (w1 rows between 1 preceding and 1 following) as c4 +from t1 +window w1 as (partition by a order by b,pk), +w2 as (partition by b order by c,pk); +c1 c2 c5 c3 c4 +1 1.0000 42 1.0000 1 +1 1.0000 NULL 1.0000 2 +10 1.0000 NULL 1.0000 3 +10 10.0000 3 10.0000 20 +10 10.0000 9 10.0000 20 +10 15.0000 9 17.5000 30 +11 1.0000 NULL 1.0000 3 +12 1.0000 -10 1.0000 2 +2 1.0000 24 1.0000 3 +20 10.0000 12 10.0000 20 +20 10.0000 6 10.0000 20 +20 20.0000 27 20.0000 40 +3 1.0000 -7 1.0000 3 +30 16.6667 13 17.5000 50 +4 1.0000 NULL 1.0000 3 +40 20.0000 19 20.0000 40 +5 1.0000 NULL 1.0000 3 +50 20.0000 21 17.5000 60 +6 1.0000 NULL 1.0000 3 +7 1.0000 13 1.0000 3 +70 20.0000 24 17.5000 40 +8 1.0000 32 1.0000 3 +9 1.0000 -9 1.0000 3 +NULL 1.0000 29 1.0000 1 +NULL NULL 24 1.0000 NULL +NULL NULL 38 1.0000 NULL +NULL NULL 42 1.0000 NULL +drop table t1; +# +# MDEV-9848: Window functions: reuse sorting and/or scanning +# +create table t1 (a int, b int, c int); +insert into t1 values +(1,3,1), +(2,2,1), +(3,1,1); +# Check using counters +flush status; +select +rank() over (partition by c order by a), +rank() over (partition by c order by b) +from t1; +rank() over (partition by c order by a) rank() over (partition by c order by b) +1 3 +2 2 +3 1 +show status like '%sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_priority_queue_sorts 0 +Sort_range 0 +Sort_rows 6 +Sort_scan 2 +flush status; +select +rank() over (partition by c order by a), +rank() over (partition by c order by a) +from t1; +rank() over (partition by c order by a) rank() over (partition by c order by a) +1 1 +2 2 +3 3 +show status like '%sort%'; +Variable_name Value +Sort_merge_passes 0 +Sort_priority_queue_sorts 0 +Sort_range 0 +Sort_rows 3 +Sort_scan 1 +explain format=json +select +rank() over (partition by c order by a), +rank() over (partition by c order by a) +from t1; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "window_functions_computation": { + "sorts": { + "filesort": { + "sort_key": "t1.c, t1.a" + } + }, + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } +} +explain format=json +select +rank() over (order by a), +row_number() over (order by a) +from t1; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "window_functions_computation": { + "sorts": { + "filesort": { + "sort_key": "t1.a" + } + }, + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } +} +explain format=json +select +rank() over (partition by c order by a), +count(*) over (partition by c) +from t1; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "window_functions_computation": { + "sorts": { + "filesort": { + "sort_key": "t1.c, t1.a" + } + }, + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } +} +explain format=json +select +count(*) over (partition by c), +rank() over (partition by c order by a) +from t1; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "window_functions_computation": { + "sorts": { + "filesort": { + "sort_key": "t1.c, t1.a" + } + }, + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } +} +drop table t1; +# +# MDEV-9847: Window functions: crash with big_tables=1 +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +set @tmp=@@big_tables; +set big_tables=1; +select rank() over (order by a) from t1; +rank() over (order by a) +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +set big_tables=@tmp; +drop table t1; +# +# Check if "ORDER BY window_func" works +# +create table t1 (s1 int, s2 char(5)); +insert into t1 values (1,'a'); +insert into t1 values (null,null); +insert into t1 values (1,null); +insert into t1 values (null,'a'); +insert into t1 values (2,'b'); +insert into t1 values (-1,''); +explain format=json +select *, row_number() over (order by s1, s2) as X from t1 order by X desc; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "filesort": { + "sort_key": "row_number() over ( order by t1.s1,t1.s2) desc", + "window_functions_computation": { + "sorts": { + "filesort": { + "sort_key": "t1.s1, t1.s2" + } + }, + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 6, + "filtered": 100 + } + } + } + } + } +} +select *, row_number() over (order by s1, s2) as X from t1 order by X desc; +s1 s2 X +2 b 6 +1 a 5 +1 NULL 4 +-1 3 +NULL a 2 +NULL NULL 1 +drop table t1; +# +# Try window functions that are not directly present in the select list +# +create table t1 (a int, b int); +insert into t1 values +(1,3), +(2,2), +(3,1); +select +a, b, +rank() over (order by a), rank() over (order by b), +rank() over (order by a) - rank() over (order by b) as diff +from +t1; +a b rank() over (order by a) rank() over (order by b) diff +1 3 1 3 -2 +2 2 2 2 0 +3 1 3 1 2 +drop table t1; +create table t1 (i int); +insert into t1 values (1),(2); +SELECT MAX(i) OVER (PARTITION BY (i)) FROM t1; +MAX(i) OVER (PARTITION BY (i)) +1 +2 +drop table t1; +# +# Check the 0 in ROWS 0 PRECEDING +# +create table t1 ( +part_id int, +pk int, +a int +); +insert into t1 values (1, 1, 1); +insert into t1 values (1, 2, 2); +insert into t1 values (1, 3, 4); +insert into t1 values (1, 4, 8); +select +pk, a, +sum(a) over (order by pk rows between 0 preceding and current row) +from t1; +pk a sum(a) over (order by pk rows between 0 preceding and current row) +1 1 1 +2 2 2 +3 4 4 +4 8 8 +select +pk, a, +sum(a) over (order by pk rows between 1 preceding and 0 preceding) +from t1; +pk a sum(a) over (order by pk rows between 1 preceding and 0 preceding) +1 1 1 +2 2 3 +3 4 6 +4 8 12 +insert into t1 values (200, 1, 1); +insert into t1 values (200, 2, 2); +insert into t1 values (200, 3, 4); +insert into t1 values (200, 4, 8); +select +part_id, pk, a, +sum(a) over (partition by part_id order by pk rows between 0 preceding and current row) +from t1; +part_id pk a sum(a) over (partition by part_id order by pk rows between 0 preceding and current row) +1 1 1 1 +1 2 2 2 +1 3 4 4 +1 4 8 8 +200 1 1 1 +200 2 2 2 +200 3 4 4 +200 4 8 8 +select +part_id, pk, a, +sum(a) over (partition by part_id order by pk rows between 1 preceding and 0 preceding) +from t1; +part_id pk a sum(a) over (partition by part_id order by pk rows between 1 preceding and 0 preceding) +1 1 1 1 +1 2 2 3 +1 3 4 6 +1 4 8 12 +200 1 1 1 +200 2 2 3 +200 3 4 6 +200 4 8 12 +drop table t1; +# +# MDEV-9780, The "DISTINCT must not bet converted into GROUP BY when +# window functions are present" part +# +create table t1 (part_id int, a int); +insert into t1 values +(100, 1), +(100, 2), +(100, 2), +(100, 3), +(2000, 1), +(2000, 2), +(2000, 3), +(2000, 3), +(2000, 3); +select rank() over (partition by part_id order by a) from t1; +rank() over (partition by part_id order by a) +1 +2 +2 +4 +1 +2 +3 +3 +3 +select distinct rank() over (partition by part_id order by a) from t1; +rank() over (partition by part_id order by a) +1 +2 +4 +3 +explain format=json +select distinct rank() over (partition by part_id order by a) from t1; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "duplicate_removal": { + "window_functions_computation": { + "sorts": { + "filesort": { + "sort_key": "t1.part_id, t1.a" + } + }, + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + } + } + } + } + } +} +drop table t1; +# +# MDEV-9893: Window functions with different ORDER BY lists, +# one of these lists containing an expression +# +create table t1 (s1 int, s2 char(5)); +insert into t1 values (1,'a'); +insert into t1 values (null,null); +insert into t1 values (3,null); +insert into t1 values (4,'a'); +insert into t1 values (2,'b'); +insert into t1 values (-1,''); +select +*, +ROW_NUMBER() OVER (order by s1), +CUME_DIST() OVER (order by -s1) +from t1; +s1 s2 ROW_NUMBER() OVER (order by s1) CUME_DIST() OVER (order by -s1) +-1 2 1.0000000000 +1 a 3 0.8333333333 +2 b 4 0.6666666667 +3 NULL 5 0.5000000000 +4 a 6 0.3333333333 +NULL NULL 1 0.1666666667 +drop table t1; +# +# MDEV-9925: Wrong result with aggregate function as a window function +# +create table t1 (i int); +insert into t1 values (1),(2); +select i, sum(i) over (partition by i) from t1; +i sum(i) over (partition by i) +1 1 +2 2 +drop table t1; +# +# MDEV-9922: Assertion `!join->only_const_tables() && fsort' failed in int create_sort_index +# +create view v1 as select 1 as i; +select rank() over (order by i) from v1; +rank() over (order by i) +1 +drop view v1; +# +# MDEV-10097: Assertion `count > 0' failed in Item_sum_sum::add_helper(bool) +# +CREATE TABLE `orders` ( +`o_orderkey` int(11) NOT NULL, +`o_custkey` int(11) DEFAULT NULL, +PRIMARY KEY (`o_orderkey`) +) DEFAULT CHARSET=latin1; +INSERT INTO `orders` VALUES (59908,242); +INSERT INTO `orders` VALUES (59940,238); +SELECT o_custkey, avg(o_custkey) OVER (PARTITION BY abs(o_custkey) +ORDER BY o_custkey +RANGE BETWEEN 15 FOLLOWING +AND 15 FOLLOWING) from orders; +o_custkey avg(o_custkey) OVER (PARTITION BY abs(o_custkey) +ORDER BY o_custkey +RANGE BETWEEN 15 FOLLOWING +AND 15 FOLLOWING) +238 NULL +242 NULL +DROP table orders; +# +# MDEV-10842: window functions with the same order column +# but different directions +# +create table t1 ( +pk int primary key, +a int, +b int, +c char(10) +); +insert into t1 values +( 1, 0, 1, 'one'), +( 2, 0, 2, 'two'), +( 3, 0, 3, 'three'), +( 4, 1, 1, 'one'), +( 5, 1, 1, 'two'), +( 6, 1, 2, 'three'), +( 7, 2, NULL, 'n_one'), +( 8, 2, 1, 'n_two'), +( 9, 2, 2, 'n_three'), +(10, 2, 0, 'n_four'), +(11, 2, 10, NULL); +select pk, +row_number() over (order by pk desc) as r_desc, +row_number() over (order by pk asc) as r_asc +from t1; +pk r_desc r_asc +11 1 11 +10 2 10 +9 3 9 +8 4 8 +7 5 7 +6 6 6 +5 7 5 +4 8 4 +3 9 3 +2 10 2 +1 11 1 +drop table t1; +# +# MDEV-10874: two window functions with compatible sorting +# +create table t1 ( +pk int primary key, +a int, +b int, +c char(10), +d decimal(10, 3), +e real +); +insert into t1 values +( 1, 0, 1, 'one', 0.1, 0.001), +( 2, 0, 2, 'two', 0.2, 0.002), +( 3, 0, 3, 'three', 0.3, 0.003), +( 4, 1, 2, 'three', 0.4, 0.004), +( 5, 1, 1, 'two', 0.5, 0.005), +( 6, 1, 1, 'one', 0.6, 0.006), +( 7, 2, NULL, 'n_one', 0.5, 0.007), +( 8, 2, 1, 'n_two', NULL, 0.008), +( 9, 2, 2, NULL, 0.7, 0.009), +(10, 2, 0, 'n_four', 0.8, 0.010), +(11, 2, 10, NULL, 0.9, NULL); +select pk, a, d, +sum(d) over (partition by a order by pk +ROWS between 1 preceding and current row) as sum_1, +sum(d) over (order by a +ROWS BETWEEN 1 preceding and 2 following) as sum_2 +from t1; +pk a d sum_1 sum_2 +1 0 0.100 0.100 0.600 +2 0 0.200 0.300 1.000 +3 0 0.300 0.500 1.400 +4 1 0.400 0.400 1.800 +5 1 0.500 0.900 2.000 +6 1 0.600 1.100 1.600 +7 2 0.500 0.500 1.800 +8 2 NULL 0.500 2.000 +9 2 0.700 0.700 2.400 +10 2 0.800 1.500 2.400 +11 2 0.900 1.700 1.700 +explain format=json +select pk, a, d, +sum(d) over (partition by a order by pk +ROWS between 1 preceding and current row) as sum_1, +sum(d) over (order by a +ROWS BETWEEN 1 preceding and 2 following) as sum_2 +from t1; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "window_functions_computation": { + "sorts": { + "filesort": { + "sort_key": "t1.a, t1.pk" + } + }, + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 11, + "filtered": 100 + } + } + } + } +} +select pk, a, d, +sum(d) over (partition by a order by pk desc +ROWS between 1 preceding and current row) as sum_1, +sum(d) over (order by a +ROWS BETWEEN 1 preceding and 2 following) as sum_2 +from t1; +pk a d sum_1 sum_2 +3 0 0.300 0.300 0.600 +2 0 0.200 0.500 1.200 +1 0 0.100 0.300 1.400 +6 1 0.600 0.600 1.600 +5 1 0.500 1.100 2.400 +4 1 0.400 0.900 2.600 +11 2 0.900 0.900 2.800 +10 2 0.800 1.700 2.400 +9 2 0.700 1.500 2.000 +8 2 NULL 0.700 1.200 +7 2 0.500 0.500 0.500 +drop table t1; +# +# MDEV-9941: two window functions with compatible partitions +# +create table t1 ( +a int, +b int, +c int +); +insert into t1 values +(10, 1, 1), +(10, 3, 10), +(10, 1, 10), +(10, 3, 100), +(10, 5, 1000), +(10, 1, 100); +explain format=json +select +a,b,c, +row_number() over (partition by a), +row_number() over (partition by a, b) +from t1; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "window_functions_computation": { + "sorts": { + "filesort": { + "sort_key": "t1.a, t1.b" + } + }, + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 6, + "filtered": 100 + } + } + } + } +} +drop table t1; +# +# MDEV-10815: Window Function Expressions Wrong Results +# +create table t(a decimal(35,10), b int); +insert into t(a,b) values(1,1); +insert into t(a,b) values(2,1); +insert into t(a,b) values(0,1); +insert into t(a,b) values(1, 2); +insert into t(a,b) values(1.5,2); +insert into t(a,b) values(3, 2); +insert into t(a,b) values(4.5,2); +select a, b, +sum(t.a) over (partition by t.b order by a) as simple_sum, +sum(t.a) over (partition by t.b order by a) + 1 as sum_and_const, +sum(t.b) over (partition by t.b order by a) + sum(t.a) over (partition by t.b order by a) as sum_and_sum +from t +order by t.b, t.a; +a b simple_sum sum_and_const sum_and_sum +0.0000000000 1 0.0000000000 1.0000000000 1.0000000000 +1.0000000000 1 1.0000000000 2.0000000000 3.0000000000 +2.0000000000 1 3.0000000000 4.0000000000 6.0000000000 +1.0000000000 2 1.0000000000 2.0000000000 3.0000000000 +1.5000000000 2 2.5000000000 3.5000000000 6.5000000000 +3.0000000000 2 5.5000000000 6.5000000000 11.5000000000 +4.5000000000 2 10.0000000000 11.0000000000 18.0000000000 +drop table t; +# +# MDEV-10669: Crash in SELECT with window function used +# +create table t(a decimal(35,10), b int); +insert into t(a,b) values(1,1); +insert into t(a,b) values(2,1); +insert into t(a,b) values(0,1); +SELECT (CASE WHEN sum(t.a) over (partition by t.b)=0 THEN null ELSE null END) AS a FROM t; +a +NULL +NULL +NULL +SELECT ifnull(((t.a) / CASE WHEN sum(t.a) over(partition by t.b) =0 then null else null end) ,0) from t; +ifnull(((t.a) / CASE WHEN sum(t.a) over(partition by t.b) =0 then null else null end) ,0) +0.00000000000000 +0.00000000000000 +0.00000000000000 +SELECT sum(t.a) over (partition by t.b order by a), +sqrt(ifnull((sum(t.a) over (partition by t.b order by a)), 0)) +from t; +sum(t.a) over (partition by t.b order by a) sqrt(ifnull((sum(t.a) over (partition by t.b order by a)), 0)) +0.0000000000 0 +1.0000000000 1 +3.0000000000 1.7320508075688772 +drop table t; +# +# MDEV-10868: view definitions with window functions +# +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (pk int, c int); +insert into t1 select a+1,1 from t0; +update t1 set c=2 where pk not in (1,2,3,4); +select * from t1; +pk c +1 1 +2 1 +3 1 +4 1 +5 2 +6 2 +7 2 +8 2 +9 2 +10 2 +select pk, c, c/count(*) over (partition by c order by pk +rows between 1 preceding and 2 following) as CNT +from t1; +pk c CNT +1 1 0.3333 +2 1 0.2500 +3 1 0.3333 +4 1 0.5000 +5 2 0.6667 +6 2 0.5000 +7 2 0.5000 +8 2 0.5000 +9 2 0.6667 +10 2 1.0000 +create view v1 as select pk, c, c/count(*) over (partition by c order by pk +rows between 1 preceding and 2 following) as CNT +from t1; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`pk` AS `pk`,`t1`.`c` AS `c`,`t1`.`c` / count(0) over ( partition by `t1`.`c` order by `t1`.`pk` rows between 1 preceding and 2 following ) AS `CNT` from `t1` latin1 latin1_swedish_ci +select * from v1; +pk c CNT +1 1 0.3333 +2 1 0.2500 +3 1 0.3333 +4 1 0.5000 +5 2 0.6667 +6 2 0.5000 +7 2 0.5000 +8 2 0.5000 +9 2 0.6667 +10 2 1.0000 +select pk, c, c/count(*) over w1 as CNT from t1 +window w1 as (partition by c order by pk rows between 1 preceding and 2 following); +pk c CNT +1 1 0.3333 +2 1 0.2500 +3 1 0.3333 +4 1 0.5000 +5 2 0.6667 +6 2 0.5000 +7 2 0.5000 +8 2 0.5000 +9 2 0.6667 +10 2 1.0000 +create view v2 as select pk, c, c/count(*) over w1 as CNT from t1 +window w1 as (partition by c order by pk rows between 1 preceding and 2 following); +show create view v2; +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`pk` AS `pk`,`t1`.`c` AS `c`,`t1`.`c` / count(0) over ( partition by `t1`.`c` order by `t1`.`pk` rows between 1 preceding and 2 following ) AS `CNT` from `t1` latin1 latin1_swedish_ci +select * from v2; +pk c CNT +1 1 0.3333 +2 1 0.2500 +3 1 0.3333 +4 1 0.5000 +5 2 0.6667 +6 2 0.5000 +7 2 0.5000 +8 2 0.5000 +9 2 0.6667 +10 2 1.0000 +select pk, c, c/count(*) over w1 as CNT from t1 +window w1 as (partition by c order by pk rows unbounded preceding); +pk c CNT +1 1 1.0000 +2 1 0.5000 +3 1 0.3333 +4 1 0.2500 +5 2 2.0000 +6 2 1.0000 +7 2 0.6667 +8 2 0.5000 +9 2 0.4000 +10 2 0.3333 +create view v3 as select pk, c, c/count(*) over w1 as CNT from t1 +window w1 as (partition by c order by pk rows unbounded preceding); +show create view v3; +View Create View character_set_client collation_connection +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`pk` AS `pk`,`t1`.`c` AS `c`,`t1`.`c` / count(0) over ( partition by `t1`.`c` order by `t1`.`pk` rows between unbounded preceding and current row ) AS `CNT` from `t1` latin1 latin1_swedish_ci +select * from v3; +pk c CNT +1 1 1.0000 +2 1 0.5000 +3 1 0.3333 +4 1 0.2500 +5 2 2.0000 +6 2 1.0000 +7 2 0.6667 +8 2 0.5000 +9 2 0.4000 +10 2 0.3333 +select pk, c, c/count(*) over (partition by c order by pk +range between 3 preceding and current row) as CNT +from t1; +pk c CNT +1 1 1.0000 +2 1 0.5000 +3 1 0.3333 +4 1 0.2500 +5 2 2.0000 +6 2 1.0000 +7 2 0.6667 +8 2 0.5000 +9 2 0.5000 +10 2 0.5000 +create view v4 as select pk, c, c/count(*) over (partition by c order by pk +range between 3 preceding and current row) as CNT +from t1; +show create view v4; +View Create View character_set_client collation_connection +v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`pk` AS `pk`,`t1`.`c` AS `c`,`t1`.`c` / count(0) over ( partition by `t1`.`c` order by `t1`.`pk` range between 3 preceding and current row ) AS `CNT` from `t1` latin1 latin1_swedish_ci +select * from v4; +pk c CNT +1 1 1.0000 +2 1 0.5000 +3 1 0.3333 +4 1 0.2500 +5 2 2.0000 +6 2 1.0000 +7 2 0.6667 +8 2 0.5000 +9 2 0.5000 +10 2 0.5000 +drop view v1,v2,v3,v4; +drop table t0,t1; +# +# MDEV-10875: window function in subquery +# +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (3),(1); +CREATE TABLE t2 (c VARCHAR(8)); +INSERT INTO t2 VALUES ('foo'),('bar'),('foo'); +SELECT COUNT(*) OVER (PARTITION BY c) FROM t2; +COUNT(*) OVER (PARTITION BY c) +1 +2 +2 +SELECT * FROM t1 WHERE i IN ( SELECT COUNT(*) OVER (PARTITION BY c) FROM t2 ); +i +1 +DROP TABLE t1, t2; +# +# MDEV-9976: window function without PARTITION BY and ORDER BY +# +CREATE TABLE t1 (id int, a int); +INSERT INTO t1 VALUES +(1,1000), (2,1100), (3,1800), (4,1500), (5,1700), (6,1200), +(7,2000), (8,2100), (9,1600); +SELECT id, sum(a) OVER (PARTITION BY id +ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM t1; +id sum(a) OVER (PARTITION BY id +1 1000 +2 1100 +3 1800 +4 1500 +5 1700 +6 1200 +7 2000 +8 2100 +9 1600 +ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +SELECT id, sum(a) OVER (ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM t1; +id sum(a) OVER (ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +1 14000 +2 13000 +3 5900 +4 10700 +5 7600 +6 11900 +7 4100 +8 2100 +9 9200 +DROP TABLE t1; +# +# MDEV-11867: window function with aggregation +# over the result of grouping +# +create table t1 ( +username varchar(32), +amount int +); +insert into t1 values +('user1',1), +('user1',5), +('user1',3), +('user2',10), +('user2',20), +('user2',30); +select username, sum(amount) as s, avg(sum(amount)) over (order by s desc) +from t1 +group by username; +username s avg(sum(amount)) over (order by s desc) +user1 9 34.5000 +user2 60 60.0000 +select username, sum(amount), avg(sum(amount)) over (order by sum(amount) desc) +from t1 +group by username; +username sum(amount) avg(sum(amount)) over (order by sum(amount) desc) +user1 9 34.5000 +user2 60 60.0000 +drop table t1; +# +# MDEV-11594: window function over implicit grouping +# +create table t1 (id int); +insert into t1 values (1), (2), (3), (2); +select sum(id) over (order by sum(id)) from t1; +sum(id) over (order by sum(id)) +1 +select sum(sum(id)) over (order by sum(id)) from t1; +sum(sum(id)) over (order by sum(id)) +8 +drop table t1; +# +# MDEV-9923: integer constant in order by list +# of window specification +# +create table t1 (id int); +insert into t1 values (1), (2), (3), (2); +select rank() over (order by 1) from t1; +rank() over (order by 1) +1 +1 +1 +1 +select rank() over (order by 2) from t1; +rank() over (order by 2) +1 +1 +1 +1 +select rank() over (partition by id order by 2) from t1; +rank() over (partition by id order by 2) +1 +1 +1 +1 +drop table t1; +# +# MDEV-10660: view using a simple window function +# +create table t1 (id int); +insert into t1 values (1), (2), (3), (2); +create view v1(id,rnk) as +select id, rank() over (order by id) from t1; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`id` AS `id`,rank() over ( order by `t1`.`id`) AS `rnk` from `t1` latin1 latin1_swedish_ci +select id, rank() over (order by id) from t1; +id rank() over (order by id) +1 1 +2 2 +2 2 +3 4 +select * from v1; +id rnk +1 1 +2 2 +2 2 +3 4 +drop view v1; +drop table t1; +# +# MDEV-11138: window function in the query without tables +# +select row_number() over (); +row_number() over () +1 +select count(*) over (); +count(*) over () +1 +select sum(5) over (); +sum(5) over () +5 +select row_number() over (), sum(5) over (); +row_number() over () sum(5) over () +1 5 +select row_number() over (order by 2); +row_number() over (order by 2) +1 +select row_number() over (partition by 2); +row_number() over (partition by 2) +1 +select row_number() over (partition by 4 order by 1+2); +row_number() over (partition by 4 order by 1+2) +1 +# +# MDEV-11999: execution of prepared statement for +# tableless query with window functions +# +prepare stmt from +"select row_number() over (partition by 4 order by 1+2)"; +execute stmt; +row_number() over (partition by 4 order by 1+2) +1 +execute stmt; +row_number() over (partition by 4 order by 1+2) +1 +deallocate prepare stmt; +# +# MDEV-11745: window function with min/max +# +create table t1 (i int, b int); +insert into t1 values +(1,1),(2,1),(3,1),(4,4),(5,4),(6,4),(7,8),(8,8),(9,8),(10,8); +select b, min(i) over (partition by b) as f +from t1 as tt +order by i; +b f +1 1 +1 1 +1 1 +4 4 +4 4 +4 4 +8 7 +8 7 +8 7 +8 7 +select b, min(i) over (partition by b) as f +from (select * from t1) as tt +order by i; +b f +1 1 +1 1 +1 1 +4 4 +4 4 +4 4 +8 7 +8 7 +8 7 +8 7 +select b, min(i+10) over (partition by b) as f +from t1 as tt +order by i; +b f +1 11 +1 11 +1 11 +4 14 +4 14 +4 14 +8 17 +8 17 +8 17 +8 17 +select b, min(i) over (partition by b) as f +from (select i+10 as i, b from t1) as tt +order by i; +b f +1 11 +1 11 +1 11 +4 14 +4 14 +4 14 +8 17 +8 17 +8 17 +8 17 +select b, min(i+20) over (partition by b) as f +from (select i+10 as i, b from t1) as tt +order by i; +b f +1 31 +1 31 +1 31 +4 34 +4 34 +4 34 +8 37 +8 37 +8 37 +8 37 +select b, max(i) over (partition by b) as f +from t1 as tt +order by i; +b f +1 3 +1 3 +1 3 +4 6 +4 6 +4 6 +8 10 +8 10 +8 10 +8 10 +select b, max(i) over (partition by b) as f +from (select * from t1) as tt +order by i; +b f +1 3 +1 3 +1 3 +4 6 +4 6 +4 6 +8 10 +8 10 +8 10 +8 10 +select b, max(i+10) over (partition by b) as f +from t1 as tt +order by i; +b f +1 13 +1 13 +1 13 +4 16 +4 16 +4 16 +8 20 +8 20 +8 20 +8 20 +select b, max(i) over (partition by b) as f +from (select i+10 as i, b from t1) as tt +order by i; +b f +1 13 +1 13 +1 13 +4 16 +4 16 +4 16 +8 20 +8 20 +8 20 +8 20 +select b, max(i+20) over (partition by b) as f +from (select i+10 as i, b from t1) as tt +order by i; +b f +1 33 +1 33 +1 33 +4 36 +4 36 +4 36 +8 40 +8 40 +8 40 +8 40 +select max(i), max(i), sum(i), count(i) +from t1 as tt +group by b; +max(i) max(i) sum(i) count(i) +3 3 6 3 +6 6 15 3 +10 10 34 4 +select max(i), min(sum(i)) over (partition by count(i)) f +from t1 as tt +group by b; +max(i) f +3 6 +6 6 +10 34 +select max(i), min(sum(i)) over (partition by count(i)) f +from (select * from t1) as tt +group by b; +max(i) f +3 6 +6 6 +10 34 +select max(i+10), min(sum(i)+10) over (partition by count(i)) f +from t1 as tt +group by b; +max(i+10) f +13 16 +16 16 +20 44 +select max(i), max(i), sum(i), count(i) +from (select i+10 as i, b from t1) as tt +group by b; +max(i) max(i) sum(i) count(i) +13 13 36 3 +16 16 45 3 +20 20 74 4 +select max(i), min(sum(i)) over (partition by count(i)) f +from (select i+10 as i, b from t1) as tt +group by b; +max(i) f +13 36 +16 36 +20 74 +select max(i), min(i), min(max(i)-min(i)) over (partition by count(i)) f +from (select i+10 as i, b from t1) as tt +group by b; +max(i) min(i) f +13 11 2 +16 14 2 +20 17 3 +drop table t1; +# +# MDEV-12015: window function over select with WHERE +# that is always FALSE +# +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (3), (1), (2); +SELECT i, ROW_NUMBER() OVER () FROM t1 WHERE 1 = 2; +i ROW_NUMBER() OVER () +SELECT i, COUNT(*) OVER () FROM t1 WHERE 1 = 2; +i COUNT(*) OVER () +DROP TABLE t1; +# +# MDEV-12051: window function in query with implicit grouping +# on always empty set +# +create table t1 (a int, b varchar(8)); +insert into t1 values (1,'foo'),(2,'bar'); +select max(a), row_number() over () from t1 where a > 10; +max(a) row_number() over () +NULL 1 +select max(a), sum(max(a)) over () from t1 where a > 10; +max(a) sum(max(a)) over () +NULL NULL +select max(a), sum(max(a)) over (partition by max(a)) from t1 where a > 10; +max(a) sum(max(a)) over (partition by max(a)) +NULL NULL +select max(a), row_number() over () from t1 where 1 = 2; +max(a) row_number() over () +NULL 1 +select max(a), sum(max(a)) over () from t1 where 1 = 2; +max(a) sum(max(a)) over () +NULL NULL +select max(a), sum(max(a)) over (partition by max(a)) from t1 where 1 = 2; +max(a) sum(max(a)) over (partition by max(a)) +NULL NULL +select max(a), row_number() over () from t1 where 1 = 2 +having max(a) is not null; +max(a) row_number() over () +select max(a), sum(max(a)) over () from t1 where 1 = 2 +having max(a) is not null; +max(a) sum(max(a)) over () +drop table t1; +# +# MDEV-10885: window function in query with implicit grouping +# with constant condition evaluated to false +# +CREATE TABLE t1 (a INT, b VARCHAR(8)); +INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); +CREATE TABLE t2 (c INT); +INSERT INTO t2 VALUES (3),(4); +CREATE TABLE t3 (d INT); +INSERT INTO t3 VALUES (5),(6); +SELECT MAX(a), ROW_NUMBER() OVER (PARTITION BY MAX(a)) FROM t1 +WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) ); +MAX(a) ROW_NUMBER() OVER (PARTITION BY MAX(a)) +NULL 1 +SELECT MAX(a), COUNT(MAX(a)) OVER (PARTITION BY MAX(a)) FROM t1 +WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) ); +MAX(a) COUNT(MAX(a)) OVER (PARTITION BY MAX(a)) +NULL 0 +SELECT MAX(a), SUM(MAX(a)) OVER (PARTITION BY MAX(a)) FROM t1 +WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) ); +MAX(a) SUM(MAX(a)) OVER (PARTITION BY MAX(a)) +NULL NULL +SELECT MAX(a), ROW_NUMBER() OVER (PARTITION BY MAX(a)) FROM t1 +WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) ) +HAVING MAX(a) IS NOT NULL; +MAX(a) ROW_NUMBER() OVER (PARTITION BY MAX(a)) +SELECT a, MAX(a), ROW_NUMBER() OVER (PARTITION BY b) FROM t1 +WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) ); +a MAX(a) ROW_NUMBER() OVER (PARTITION BY b) +NULL NULL 1 +SELECT a, COUNT(a), AVG(a) OVER (PARTITION BY b) FROM t1 +WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) ); +a COUNT(a) AVG(a) OVER (PARTITION BY b) +NULL 0 NULL +SELECT a, MAX(a), AVG(a) OVER (PARTITION BY b) FROM t1 +WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) ); +a MAX(a) AVG(a) OVER (PARTITION BY b) +NULL NULL NULL +DROP TABLE t1,t2,t3; +# +# MDEV-10859: Wrong result of aggregate window function in query +# with HAVING and no ORDER BY +# +create table empsalary (depname varchar(32), empno smallint primary key, salary int); +insert into empsalary values +('develop', 1, 5000), ('develop', 2, 4000),('sales', 3, '6000'),('sales', 4, 5000); +SELECT depname, empno, salary, avg(salary) OVER (PARTITION BY depname) FROM empsalary; +depname empno salary avg(salary) OVER (PARTITION BY depname) +develop 1 5000 4500.0000 +develop 2 4000 4500.0000 +sales 3 6000 5500.0000 +sales 4 5000 5500.0000 +SELECT depname, empno, salary, avg(salary) OVER (PARTITION BY depname) FROM empsalary ORDER BY depname; +depname empno salary avg(salary) OVER (PARTITION BY depname) +develop 1 5000 4500.0000 +develop 2 4000 4500.0000 +sales 3 6000 5500.0000 +sales 4 5000 5500.0000 +# +# These last 2 should have the same row results, ignoring order. +# +SELECT depname, empno, salary, avg(salary) OVER (PARTITION BY depname) FROM empsalary HAVING empno > 1; +depname empno salary avg(salary) OVER (PARTITION BY depname) +develop 2 4000 4000.0000 +sales 3 6000 5500.0000 +sales 4 5000 5500.0000 +SELECT depname, empno, salary, avg(salary) OVER (PARTITION BY depname) FROM empsalary HAVING empno > 1 ORDER BY depname; +depname empno salary avg(salary) OVER (PARTITION BY depname) +develop 2 4000 4000.0000 +sales 3 6000 5500.0000 +sales 4 5000 5500.0000 +drop table empsalary; +# +# MDEV-11868: min(distinct) over () returns wrong value +# +create table TDEC (CDEC int, RNUM int); +create view VDEC as select * from TDEC; +insert into TDEC (CDEC) values (null),(-1),(0),(1),(0),(10); +select TDEC.CDEC, min(TDEC.CDEC) over () from TDEC; +CDEC min(TDEC.CDEC) over () +NULL -1 +-1 -1 +0 -1 +0 -1 +1 -1 +10 -1 +select VDEC.CDEC, min(VDEC.CDEC) over () from VDEC; +CDEC min(VDEC.CDEC) over () +NULL -1 +-1 -1 +0 -1 +0 -1 +1 -1 +10 -1 +select TDEC.CDEC, max(TDEC.CDEC) over () from TDEC; +CDEC max(TDEC.CDEC) over () +NULL 10 +-1 10 +0 10 +0 10 +1 10 +10 10 +select VDEC.CDEC, max(VDEC.CDEC) over () from VDEC; +CDEC max(VDEC.CDEC) over () +NULL 10 +-1 10 +0 10 +0 10 +1 10 +10 10 +select TDEC.CDEC, min(distinct TDEC.CDEC) over () from TDEC; +CDEC min(distinct TDEC.CDEC) over () +NULL -1 +-1 -1 +0 -1 +0 -1 +1 -1 +10 -1 +select VDEC.CDEC, min(distinct VDEC.CDEC) over () from VDEC; +CDEC min(distinct VDEC.CDEC) over () +NULL -1 +-1 -1 +0 -1 +0 -1 +1 -1 +10 -1 +select TDEC.CDEC, max(distinct TDEC.CDEC) over () from TDEC; +CDEC max(distinct TDEC.CDEC) over () +NULL 10 +-1 10 +0 10 +0 10 +1 10 +10 10 +select VDEC.CDEC, max(distinct VDEC.CDEC) over () from VDEC; +CDEC max(distinct VDEC.CDEC) over () +NULL 10 +-1 10 +0 10 +0 10 +1 10 +10 10 +# +# These should be removed once support for them is added. +# +select TDEC.CDEC, count(distinct TDEC.CDEC) over () from TDEC; +ERROR 42000: This version of MariaDB doesn't yet support 'COUNT(DISTINCT) aggregate as window function' +select VDEC.CDEC, count(distinct VDEC.CDEC) over () from VDEC; +ERROR 42000: This version of MariaDB doesn't yet support 'COUNT(DISTINCT) aggregate as window function' +select TDEC.CDEC, sum(distinct TDEC.CDEC) over () from TDEC; +ERROR 42000: This version of MariaDB doesn't yet support 'SUM(DISTINCT) aggregate as window function' +select VDEC.CDEC, sum(distinct VDEC.CDEC) over () from VDEC; +ERROR 42000: This version of MariaDB doesn't yet support 'SUM(DISTINCT) aggregate as window function' +select TDEC.CDEC, avg(distinct TDEC.CDEC) over () from TDEC; +ERROR 42000: This version of MariaDB doesn't yet support 'AVG(DISTINCT) aggregate as window function' +select VDEC.CDEC, avg(distinct VDEC.CDEC) over () from VDEC; +ERROR 42000: This version of MariaDB doesn't yet support 'AVG(DISTINCT) aggregate as window function' +select TDEC.CDEC, GROUP_CONCAT(TDEC.CDEC) over () from TDEC; +ERROR 42000: This version of MariaDB doesn't yet support 'GROUP_CONCAT() aggregate as window function' +select VDEC.CDEC, GROUP_CONCAT(distinct VDEC.CDEC) over () from VDEC; +ERROR 42000: This version of MariaDB doesn't yet support 'GROUP_CONCAT() aggregate as window function' +drop table TDEC; +drop view VDEC; +# +# MDEV-10700: 10.2.2 windowing function returns incorrect result +# +create table t(a int,b int, c int , d int); +insert into t(a,b,c,d) values(1, rand(10)*1000, rand(10)*1000, rand(10)*1000); +insert into t(a,b,c,d) values(1, rand(10)*1000, rand(10)*1000, rand(10)*1000); +replace into t(a,b,c,d) select 1, rand(10)*1000, rand(10)*1000, rand(10)*1000 from t t1, t t2, t t3, t t4, t t5, t t6, t t7, t t8, t t9, t t10, t t11, t t12, t t13, t t14, t t15, t t16, t t17; +select count(distinct s) from (select sum(d) over(partition by a,b,c) as s from t) Z where s > 0; +count(distinct s) +993 +select count(distinct s) from (select sum(d) as s from t group by a,b,c) Z where s > 0; +count(distinct s) +993 +select count(distinct s) from (select sum(d) over(partition by a,b) as s from t) Z where s > 0; +count(distinct s) +993 +select count(distinct s) from (select sum(d) as s from t group by a,b) Z where s > 0; +count(distinct s) +993 +select count(distinct s) from (select sum(d) over(partition by a) as s from t) Z where s > 0; +count(distinct s) +1 +select count(distinct s) from (select sum(d) as s from t group by a) Z where s > 0; +count(distinct s) +1 +drop table t; +# +# MDEV-9924: window function in query with group by optimized away +# +create table t1 (i int); +insert into t1 values (2),(3),(1); +select row_number() over () from t1 group by 1+2; +row_number() over () +1 +select max(i), row_number() over () from t1 group by 1+2; +max(i) row_number() over () +3 1 +select rank() over (order by max(i)) from t1 group by 1+2; +rank() over (order by max(i)) +1 +select i, row_number() over () from t1 group by 1+2; +i row_number() over () +2 1 +select i, rank() over (order by i) rnk from t1 group by 1+2; +i rnk +2 1 +drop table t1; +# +# MDEV-11907: window function as the second operand of division +# +create table t1 (pk int, c int); +insert into t1 values (1,1),(2,1),(3,1),(4,1),(5,2); +set @sql_mode_save= @@sql_mode; +set sql_mode='ERROR_FOR_DIVISION_BY_ZERO'; +select pk, c, c/count(*) over +(partition by c order by pk +rows between 1 preceding and 2 following) as CNT +from t1; +pk c CNT +1 1 0.3333 +2 1 0.2500 +3 1 0.3333 +4 1 0.5000 +5 2 2.0000 +show warnings; +Level Code Message +set sql_mode=@sql_mode_save; +drop table t1; +# +# MDEV-12336: several functions over a window function +# +create table t1 (name varchar(10), cnt int); +insert into t1 values ('Fred', 23), ('Fred', 35), ('Joe', 10); +select q.name, q.row_cnt, +round( 100 * ( q.row_cnt / +sum(q.row_cnt) over +( +order by q.name +rows between +unbounded preceding and +unbounded following +) +),2 +) pct_of_total +from +( +select name, count(*) row_cnt, sum(cnt) sum_cnt +from t1 +group by 1 +) q; +name row_cnt pct_of_total +Fred 2 66.67 +Joe 1 33.33 +drop table t1; +# +# MDEV-11990: window function over min/max aggregation +# +create table t1 (id int); +insert into t1 values (1), (2), (3), (2), (4), (2); +select sum(max(id)) over (order by max(id)) from t1; +sum(max(id)) over (order by max(id)) +4 +explain +select sum(max(id)) over (order by max(id)) from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary +create index idx on t1(id); +select sum(max(id)) over (order by max(id)) from t1; +sum(max(id)) over (order by max(id)) +4 +explain +select sum(max(id)) over (order by max(id)) from t1; +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 +select sum(max(id)) over (order by max(id)) from t1 where id < 3; +sum(max(id)) over (order by max(id)) +2 +select count(max(id)) over (order by max(id)) from t1 where id < 3; +count(max(id)) over (order by max(id)) +1 +select max(id), rank() over (order by max(id)) from t1 where id < 3; +max(id) rank() over (order by max(id)) +2 1 +drop table t1; +# +# main.win failure post MDEV-12336 +# +create table t(a decimal(35,10), b int); +insert into t values (1, 10), (2, 20), (3, 30); +prepare stmt from "SELECT (CASE WHEN sum(t.a) over (partition by t.b)=1 THEN 1000 ELSE 300 END) AS a FROM t"; +execute stmt; +a +1000 +300 +300 +drop table t; +# +# MDEV-12851 case with window functions query crashes server +# +create table t1(dt datetime); +insert into t1 values ('2017-05-17'), ('2017-05-18'); +select dt, +case when (max(dt) over (order by dt rows between 1 following and 1 following) is null) +then '9999-12-31 12:00:00' + else max(dt) over (order by dt rows between 1 following and 1 following) +end x, +case when (max(dt) over (order by dt rows between 1 following and 1 following) is not null) +then '9999-12-31 12:00:00' + else max(dt) over (order by dt rows between 1 following and 1 following) +end x +from t1; +dt x x +2017-05-17 00:00:00 2017-05-18 00:00:00 9999-12-31 12:00:00 +2017-05-18 00:00:00 9999-12-31 12:00:00 NULL +drop table t1; +create table t1(i int); +insert into t1 values (null),(1),(2); +select max(i) over (order by i), +max(i) over (order by i) is null, +max(i) over (order by i) is not null +from t1; +max(i) over (order by i) max(i) over (order by i) is null max(i) over (order by i) is not null +NULL 1 0 +1 0 1 +2 0 1 +drop table t1; +# +# MDEV-13189: Window functions crash when using INTERVAL function +# +create table t1(i int); +insert into t1 values (1),(2),(10),(20),(30); +select sum(i) over (order by i), interval(sum(i) over (order by i), 10, 20) +from t1; +sum(i) over (order by i) interval(sum(i) over (order by i), 10, 20) +1 0 +3 0 +13 1 +33 2 +63 2 +drop table t1; +# +# MDEV-13352: Server crashes in st_join_table::remove_duplicates +# +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1),(2); +SELECT DISTINCT ROW_NUMBER() OVER(), i FROM t1 WHERE 0; +ROW_NUMBER() OVER() i +SELECT ROW_NUMBER() OVER(), i FROM t1 WHERE 0; +ROW_NUMBER() OVER() i +DROP TABLE t1; +# +# MDEV-13344: Server crashes in in AGGR_OP::put_record on subquery +# with window function and constant table +# (Testcase only) +# +CREATE TABLE t1 (c CHAR(8)) ENGINE=MyISAM; +INSERT IGNORE INTO t1 VALUES ('foo'); +SELECT ('bar',1) IN ( SELECT c, ROW_NUMBER() OVER (PARTITION BY c) FROM t1); +('bar',1) IN ( SELECT c, ROW_NUMBER() OVER (PARTITION BY c) FROM t1) +0 +DROP TABLE t1; +# +# MDEV-13351: Server crashes in st_select_lex::set_explain_type upon UNION with window function +# +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1),(2); +SELECT Nth_value(i,1) OVER() FROM t1 +UNION ALL +( SELECT Nth_value(i,2) OVER() FROM t1 LIMIT 0 ) +; +Nth_value(i,1) OVER() +1 +1 +DROP TABLE t1; +# +# A regression after MDEV-13351: +# MDEV-13374 : Server crashes in first_linear_tab / st_select_lex::set_explain_type +# upon UNION with aggregate function +# +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +SELECT i AS fld FROM t1 UNION SELECT COUNT(*) AS fld FROM t1; +fld +1 +2 +DROP TABLE t1; +# +# MDEV-13240 Wrong warning with MAX(datetime_field) OVER (...) +# +CREATE TABLE t1 (dt DATETIME); +INSERT INTO t1 VALUES ('2017-05-17'); +SELECT MAX(dt) OVER (ORDER BY dt ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING) FROM t1; +MAX(dt) OVER (ORDER BY dt ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING) +NULL +DROP TABLE t1; +# +# MDEV-13358 FIRST_VALUE throws SQL Error (1292): Incorrect datetime value +# +CREATE TABLE IF NOT EXISTS `fv_test` ( +`SOME_DATE` datetime NOT NULL +); +INSERT INTO `fv_test` (`SOME_DATE`) VALUES ('2017-07-20 12:47:56'); +CREATE TABLE fv_result +SELECT +FIRST_VALUE(SOME_DATE) OVER(ORDER BY SOME_DATE DESC) AS somedate +FROM fv_test; +SHOW CREATE TABLE fv_result; +Table Create Table +fv_result CREATE TABLE `fv_result` ( + `somedate` datetime DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT * FROM fv_result; +somedate +2017-07-20 12:47:56 +DROP TABLE fv_test, fv_result; +# +# MDEV-13649: Server crashes in set_field_to_null_with_conversions or in Field::set_notnull +# +CREATE TABLE t1 (a int); +INSERT INTO t1 VALUES (0),(1),(2); +SELECT LEAD(a) OVER (PARTITION BY a ORDER BY a) as lead, +a AND LEAD(a) OVER (PARTITION BY a ORDER BY a) AS a_and_lead_part +FROM t1; +lead a_and_lead_part +NULL 0 +NULL NULL +NULL NULL +SELECT a OR LEAD(a) OVER (ORDER BY a) AS a_or_lead_order +FROM t1 +ORDER BY a; +a_or_lead_order +1 +1 +1 +SELECT a AND LEAD(a) OVER (ORDER BY a) AS a_and_lead_order +FROM t1 +ORDER BY a; +a_and_lead_order +0 +1 +NULL +SELECT a XOR LEAD(a) OVER (ORDER BY a) AS a_xor_lead_order +FROM t1 +ORDER BY a; +a_xor_lead_order +1 +0 +NULL +SELECT NOT LEAD(a) OVER (ORDER BY a) AS not_lead_order +FROM t1 +ORDER BY a; +not_lead_order +0 +0 +NULL +SELECT LEAD(a) OVER (ORDER BY a) is not null AS is_not_null_lead_order +FROM t1 +ORDER BY a; +is_not_null_lead_order +1 +1 +0 +drop table t1; +# +# MDEV-13354: Server crashes in find_field_in_tables upon PS with window function and subquery +# +CREATE TABLE t1 (i INT, a char); +INSERT INTO t1 VALUES (1, 'a'),(2, 'b'); +PREPARE stmt FROM "SELECT row_number() over (partition by i order by i), i FROM (SELECT * from t1) as sq"; +EXECUTE stmt; +row_number() over (partition by i order by i) i +1 1 +1 2 +DROP TABLE t1; +# +# MDEV-13384: "window" seems like a reserved column name but it's not listed as one +# +# Currently we allow window as an identifier, except for table aliases. +# +CREATE TABLE door (id INT, window VARCHAR(10)); +SELECT id +FROM door as window; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'window' at line 2 +SELECT id, window +FROM door; +id window +SELECT id, window +FROM door as window; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'window' at line 2 +DROP TABLE door; +# +# MDEV-13352: Server crashes in st_join_table::remove_duplicates +# +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1),(2); +SELECT DISTINCT ROW_NUMBER() OVER(), i FROM t1 WHERE 0; +ROW_NUMBER() OVER() i +SELECT ROW_NUMBER() OVER(), i FROM t1 WHERE 0; +ROW_NUMBER() OVER() i +DROP TABLE t1; +# +# MDEV-15853: Assertion `tab->filesort_result == 0' failed +# +CREATE TABLE t1 ( a1 int); +insert into t1 values (1),(2),(3); +CREATE TABLE t2 (b1 int, a1 int, a2 int); +insert into t2 values (1,2,3),(2,3,4),(3,4,5); +SELECT COUNT(DISTINCT t2.a2), +rank() OVER (ORDER BY t2.b1) +FROM t2 ,t1 GROUP BY t2.b1 ORDER BY t1.a1; +COUNT(DISTINCT t2.a2) rank() OVER (ORDER BY t2.b1) +1 1 +1 2 +1 3 +DROP TABLE t1,t2; +# +# MDEV-16990: server crashes in base_list_iterator::next +# +CREATE TABLE t1(i int); +insert into t1 values (1),(2); +SELECT DISTINCT row_number() OVER (), MAX(1) FROM t1; +row_number() OVER () MAX(1) +1 1 +SELECT DISTINCT BIT_AND(0) OVER (), MAX(1) FROM t1; +BIT_AND(0) OVER () MAX(1) +0 1 +drop table t1; +# +# MDEV-17525: Window functions not working in ONLY_FULL_GROUP_BY mode +# +CREATE TABLE t1 (name CHAR(10), test CHAR(10), score TINYINT); +INSERT INTO t1 VALUES +('Chun', 'SQL', 75), ('Chun', 'Tuning', 73), +('Esben', 'SQL', 43), ('Esben', 'Tuning', 31), +('Kaolin', 'SQL', 56), ('Kaolin', 'Tuning', 88), +('Tatiana', 'SQL', 87), ('Tatiana', 'Tuning', 83); +SET @save_sql_mode= @@sql_mode; +SET sql_mode = 'ONLY_FULL_GROUP_BY'; +SELECT name, test, score, +AVG(score) OVER (PARTITION BY test) AS average_by_test +FROM t1 +ORDER BY test, name; +name test score average_by_test +Chun SQL 75 65.2500 +Esben SQL 43 65.2500 +Kaolin SQL 56 65.2500 +Tatiana SQL 87 65.2500 +Chun Tuning 73 68.7500 +Esben Tuning 31 68.7500 +Kaolin Tuning 88 68.7500 +Tatiana Tuning 83 68.7500 +set @@sql_mode= @save_sql_mode; +SELECT name, test, score, +AVG(score) OVER (PARTITION BY test) AS average_by_test +FROM t1 +ORDER BY test, name; +name test score average_by_test +Chun SQL 75 65.2500 +Esben SQL 43 65.2500 +Kaolin SQL 56 65.2500 +Tatiana SQL 87 65.2500 +Chun Tuning 73 68.7500 +Esben Tuning 31 68.7500 +Kaolin Tuning 88 68.7500 +Tatiana Tuning 83 68.7500 +drop table t1; +# +# MDEV-12575: Server crash in AGGR_OP::put_record or in JOIN_CACHE::free +# or Invalid write in JOIN::make_aggr_tables_info +# +SELECT DISTINCT BIT_OR(100) OVER () FROM dual +GROUP BY LEFT('2018-08-24', 100) order by 1+2; +BIT_OR(100) OVER () +100 +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1),(2); +SELECT * FROM ( +SELECT +ROW_NUMBER() OVER(), i, sum(i) +FROM t1 +WHERE 1=0 +limit 0 +) AS sq; +ROW_NUMBER() OVER() i sum(i) +SELECT * FROM ( +SELECT +ROW_NUMBER() OVER(), i, sum(i) +FROM t1 +WHERE 1=0 +GROUP BY i +) AS sq; +ROW_NUMBER() OVER() i sum(i) +drop table t1; +create table t1 (a int); +explain +select distinct 1, row_number() over (order by 1) from t1 where a=0 group by a with rollup; +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 distinct 1, row_number() over (order by 1) from t1 where a=0 group by a with rollup; +1 row_number() over (order by 1) +drop table t1; +explain +SELECT DISTINCT BIT_OR(100) OVER () FROM dual +GROUP BY LEFT('2018-08-24', 100) WITH ROLLUP +HAVING @A := 'qwerty'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +SELECT DISTINCT BIT_OR(100) OVER () FROM dual +GROUP BY LEFT('2018-08-24', 100) WITH ROLLUP +HAVING @A := 'qwerty'; +BIT_OR(100) OVER () +explain +SELECT DISTINCT BIT_OR(100) OVER () FROM dual +GROUP BY LEFT('2018-08-24', 100) +HAVING @A := 'qwerty'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +SELECT DISTINCT BIT_OR(100) OVER () FROM dual +GROUP BY LEFT('2018-08-24', 100) +HAVING @A := 'qwerty'; +BIT_OR(100) OVER () +create table t1 (a int); +explain +SELECT DISTINCT BIT_OR(100) OVER () FROM t1 +GROUP BY LEFT('2018-08-24', 100) having 1=1 limit 0; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Zero limit +drop table t1; +# +# MDEV-13170: Database service (MySQL) stops after update with trigger +# +CREATE TABLE t1 ( t1_id int, point_id int, ml_id int, UNIQUE KEY t1_ml_u (ml_id,point_id)) ; +INSERT INTO t1 VALUES (1,1,8884),(2,1,8885); +CREATE TABLE t2 ( db_time datetime, au_nr int, col_id int, new_val int); +CREATE TABLE t3 (id1 int, id2 int, d1 int); +CREATE TRIGGER t1_aurtrg AFTER UPDATE ON t1 FOR EACH ROW begin +CREATE OR REPLACE TEMPORARY TABLE trg_u AS +WITH l AS +(SELECT a.*, +Max(t2.col_id) over (PARTITION BY a.d1), +Max(t2.new_val) over (PARTITION BY a.d1) +FROM +(SELECT d1 , id1, id2 FROM t3) a +JOIN t2 ON (a.d1=t2.db_time AND a.id1=t2.au_nr)) +SELECT 1; +END;// +update t1 set ml_id=8884 where point_id=1; +ERROR 23000: Duplicate entry '8884-1' for key 't1_ml_u' +update t1 set ml_id=8884 where point_id=1; +ERROR 23000: Duplicate entry '8884-1' for key 't1_ml_u' +drop table t1, t2,t3; +CREATE TABLE t1 (i INT, a char); +INSERT INTO t1 VALUES (1, 'a'),(2, 'b'); +create view v1 as select * from t1; +PREPARE stmt FROM "SELECT i, row_number() over (partition by i order by i) FROM v1"; +execute stmt; +i row_number() over (partition by i order by i) +1 1 +2 1 +deallocate prepare stmt; +drop table t1; +drop view v1; +# +# MDEV-17676: Assertion `inited==NONE || (inited==RND && scan)' failed in handler::ha_rnd_init +# +CREATE TABLE t1 (b1 text NOT NULL); +INSERT INTO t1 VALUES ('2'),('1'); +EXPLAIN +SELECT DISTINCT MIN(b1) OVER () FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary +SELECT DISTINCT MIN(b1) OVER () FROM t1; +MIN(b1) OVER () +1 +drop table t1; +# +# MDEV-15424: Unreasonal SQL Error (1356) on select from view +# +create table t1 (id int, n1 int); +insert into t1 values (1,1), (2,1), (3,2), (4,4); +create view v1 as SELECT ifnull(max(n1) over (partition by n1),'aaa') FROM t1; +explain select * from v1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 +2 DERIVED t1 ALL NULL NULL NULL NULL 4 Using temporary +select * from v1; +ifnull(max(n1) over (partition by n1),'aaa') +1 +1 +2 +4 +drop table t1; +drop view v1; +# +# MDEV-18431: Select max + row_number giving incorrect result +# +create table t1 (id int, v int); +insert into t1 values (1, 1), (1,2), (1,3), (2, 1), (2, 2); +select e.id, +(select max(t1.v) from t1 where t1.id=e.id) as a, +row_number() over (partition by e.id order by e.v) as b, +(select max(t1.v) from t1 where t1.id=e.id) + (row_number() over (partition by e.id order by e.v)) as sum_a_b +from t1 e; +id a b sum_a_b +1 3 1 4 +1 3 2 5 +1 3 3 6 +2 2 1 3 +2 2 2 4 +drop table t1; +# +# MDEV-15837: Assertion `item1->type() == Item::FIELD_ITEM && item2->type() == Item::FIELD_ITEM' +# failed in compare_order_elements function +# +CREATE TABLE t1 (a1 int); +insert into t1 values (1),(2),(3); +SELECT rank() OVER (ORDER BY 1), ROW_NUMBER() OVER (ORDER BY (EXPORT_SET(5,'Y','N',',',4))) FROM t1; +rank() OVER (ORDER BY 1) ROW_NUMBER() OVER (ORDER BY (EXPORT_SET(5,'Y','N',',',4))) +1 1 +1 2 +1 3 +drop table t1; +# ++# MDEV-17781: Server crashes in next_linear_tab ++# ++CREATE TABLE t1 (i1 int); ++explain ++(SELECT AVG(0) OVER (), MAX('2') FROM t1) ++UNION ALL ++(SELECT AVG(0) OVER (), MAX('2') FROM t1); ++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 UNION NULL NULL NULL NULL NULL NULL NULL No tables used ++(SELECT AVG(0) OVER (), MAX('2') FROM t1) ++UNION ALL ++(SELECT AVG(0) OVER (), MAX('2') FROM t1); ++AVG(0) OVER () MAX('2') ++0.0000 NULL ++0.0000 NULL ++drop table t1; ++# ++# MDEV-14791: Crash with order by expression containing window functions ++# ++CREATE TABLE t1 (b1 int, b2 int); ++INSERT INTO t1 VALUES (1,1),(0,0); ++explain ++SELECT b1 from t1 order by row_number() over (ORDER BY b2) + 1; ++id select_type table type possible_keys key key_len ref rows Extra ++1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort ++SELECT b1 from t1 order by row_number() over (ORDER BY b2) + 1; ++b1 ++0 ++1 ++explain ++SELECT b1 from t1 order by row_number() over (ORDER BY b2); ++id select_type table type possible_keys key key_len ref rows Extra ++1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort ++SELECT b1 from t1 order by row_number() over (ORDER BY b2); ++b1 ++0 ++1 ++DROP TABLE t1; ++CREATE TABLE t1 (a int, b int, c int); ++INSERT INTO t1 VALUES (2,3,207), (1,21,909), (7,13,312), (8,64,248); ++explain ++SELECT * FROM t1 ORDER BY max(t1.a) over (partition by c); ++id select_type table type possible_keys key key_len ref rows Extra ++1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort ++SELECT * FROM t1 ORDER BY max(t1.a) over (partition by c); ++a b c ++1 21 909 ++2 3 207 ++7 13 312 ++8 64 248 ++explain ++SELECT max(t1.a) over (partition by c) as x, b, c from t1 order by max(t1.a) over (partition by c); ++id select_type table type possible_keys key key_len ref rows Extra ++1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort ++SELECT max(t1.a) over (partition by c) as x, b, c from t1 order by max(t1.a) over (partition by c); ++x b c ++1 21 909 ++2 3 207 ++7 13 312 ++8 64 248 ++drop table t1; ++# ++# MDEV-18373: DENSE_RANK is not calculated correctly ++# ++create table t1 (a int, b int); ++insert into t1 values (60, 1515),(60, 2000),(70, 2000),(55, 1600); ++select b, dense_rank() over (order by sum(a)) from t1 group by b; ++b dense_rank() over (order by sum(a)) ++1515 2 ++1600 1 ++2000 3 ++select b, dense_rank() over (order by sum(a)+1) from t1 group by b; ++b dense_rank() over (order by sum(a)+1) ++1515 2 ++1600 1 ++2000 3 ++select b, row_number() over (partition by sum(a)) from t1 group by b; ++b row_number() over (partition by sum(a)) ++1515 1 ++1600 1 ++2000 1 ++select b, row_number() over (partition by sum(a)+1) from t1 group by b; ++b row_number() over (partition by sum(a)+1) ++1515 1 ++1600 1 ++2000 1 ++drop table t1; ++# +# End of 10.2 tests +# +# +# MDEV-16489 when lead() returns null on a datetime field, the result is treated as the literal string '[NULL]' +# +CREATE TABLE t1 (d datetime); +INSERT INTO t1 VALUES ('2018-01-01 00:00:00'),('2018-02-01 00:00:00'); +SELECT *, LEAD(d) OVER (ORDER BY d) AS x FROM t1; +d x +2018-01-01 00:00:00 2018-02-01 00:00:00 +2018-02-01 00:00:00 NULL +DROP TABLE t1; +CREATE TABLE t1 (d time); +INSERT INTO t1 VALUES ('00:00:01'),('00:00:02'); +SELECT *, LEAD(d) OVER (ORDER BY d) AS x FROM t1; +d x +00:00:01 00:00:02 +00:00:02 NULL +DROP TABLE t1; +# +# End of 10.3 tests +# diff --cc mysql-test/main/win.test index 81d3be19c10,00000000000..16e8be5eb0a mode 100644,000000..100644 --- a/mysql-test/main/win.test +++ b/mysql-test/main/win.test @@@ -1,2288 -1,0 +1,2348 @@@ +# +# Window Functions Tests +# + +--disable_warnings +drop table if exists t1,t2; +drop view if exists v1; +--enable_warnings + +--echo # ######################################################################## +--echo # # Parser tests +--echo # ######################################################################## +--echo # +--echo # Check what happens when one attempts to use window function without OVER clause +create table t1 (a int, b int); +insert into t1 values (1,1),(2,2); + +--error ER_PARSE_ERROR +select row_number() from t1; +--error ER_PARSE_ERROR +select rank() from t1; + +--echo # Attempt to use window function in the WHERE clause +--error ER_WRONG_PLACEMENT_OF_WINDOW_FUNCTION +select * from t1 where 1=rank() over (order by a); +--error ER_WRONG_PLACEMENT_OF_WINDOW_FUNCTION +select * from t1 where 1>row_number() over (partition by b order by a); +drop table t1; + +--echo # ######################################################################## +--echo # # Functionality tests +--echo # ######################################################################## +--echo # +--echo # Check if ROW_NUMBER() works in basic cases +create table t1(a int, b int, x char(32)); +insert into t1 values (2, 10, 'xx'); +insert into t1 values (2, 10, 'zz'); +insert into t1 values (2, 20, 'yy'); +insert into t1 values (3, 10, 'xxx'); +insert into t1 values (3, 20, 'vvv'); + +--sorted_result +select a, row_number() over (partition by a order by b) from t1; + +select a, b, x, row_number() over (partition by a order by x) from t1; + +drop table t1; + +create table t1 (pk int primary key, a int, b int); +insert into t1 values + (1, 10, 22), + (2, 11, 21), + (3, 12, 20), + (4, 13, 19), + (5, 14, 18); + +select + pk, a, b, + row_number() over (order by a), + row_number() over (order by b) +from t1 +order by b; + +drop table t1; + +--echo # +--echo # Try RANK() function +--echo # +create table t2 ( + pk int primary key, + a int +); + +insert into t2 values +( 1 , 0), +( 2 , 0), +( 3 , 1), +( 4 , 1), +( 8 , 2), +( 5 , 2), +( 6 , 2), +( 7 , 2), +( 9 , 4), +(10 , 4); + +--sorted_result +select pk, a, rank() over (order by a) from t2; +--sorted_result +select pk, a, rank() over (order by a desc) from t2; + +drop table t2; + +--echo # +--echo # Try Aggregates as window functions. With frames. +--echo # +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t1 (pk int, c int); +insert into t1 select a+1,1 from t0; +update t1 set c=2 where pk not in (1,2,3,4); +select * from t1; + +select + pk, c, + count(*) over (partition by c order by pk + rows between 2 preceding and 2 following) as CNT +from t1; + +select + pk, c, + count(*) over (partition by c order by pk + rows between 1 preceding and 2 following) as CNT +from t1; + +select + pk, c, + count(*) over (partition by c order by pk + rows between 2 preceding and current row) as CNT +from t1; + +select + pk,c, + count(*) over (partition by c order by pk rows + between 1 following and 2 following) as CNT +from t1; + +select + pk,c, + count(*) over (partition by c order by pk rows + between 2 preceding and 1 preceding) as CNT +from t1; + +select + pk, c, + count(*) over (partition by c order by pk + rows between current row and 1 following) as CNT +from t1; + +--echo # Check ORDER BY DESC +select + pk, c, + count(*) over (partition by c order by pk desc + rows between 2 preceding and 2 following) as CNT +from t1; + +drop table t0,t1; + +--echo # +--echo # Resolution of window names +--echo # + +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t1 (pk int, c int); +insert into t1 select a+1,1 from t0; +update t1 set c=2 where pk not in (1,2,3,4); +select * from t1; + +select + pk, c, + count(*) over w1 as CNT +from t1 +window w1 as (partition by c order by pk + rows between 2 preceding and 2 following); + +select + pk, c, + count(*) over (w1 rows between 2 preceding and 2 following) as CNT +from t1 +window w1 as (partition by c order by pk); + +select + pk, c, + count(*) over (w1 order by pk rows between 2 preceding and 2 following) as CNT +from t1 +window w1 as (partition by c); + +select + pk, c, + count(*) over (w2 rows between 2 preceding and 2 following) as CNT +from t1 +window w1 as (partition by c), w2 as (w1 order by pk); + +select + pk, c, + count(*) over w3 as CNT +from t1 +window + w1 as (partition by c), + w2 as (w1 order by pk), + w3 as (w2 rows between 2 preceding and 2 following); + +--error ER_WRONG_WINDOW_SPEC_NAME +select + pk, c, + count(*) over w as CNT +from t1 +window w1 as (partition by c order by pk + rows between 2 preceding and 2 following); + +--error ER_DUP_WINDOW_NAME +select + pk, c, + count(*) over (w2 rows between 2 preceding and 2 following) as CNT +from t1 +window w1 as (partition by c), w1 as (order by pk); + +--error ER_WRONG_WINDOW_SPEC_NAME +select + pk, c, + count(*) over (w2 rows between 2 preceding and 2 following) as CNT +from t1 +window w1 as (partition by c), w2 as (w partition by c order by pk); + +--error ER_PARTITION_LIST_IN_REFERENCING_WINDOW_SPEC +select + pk, c, + count(*) over (w2 rows between 2 preceding and 2 following) as CNT +from t1 +window w1 as (partition by c), w2 as (w1 partition by c order by pk); + +--error ER_ORDER_LIST_IN_REFERENCING_WINDOW_SPEC +select + pk, c, + count(*) over (w2 rows between 2 preceding and 2 following) as CNT +from t1 +window w1 as (partition by c order by pk), w2 as (w1 order by pk); + +--error ER_WINDOW_FRAME_IN_REFERENCED_WINDOW_SPEC +select + pk, c, + count(*) over w3 as CNT +from t1 +window + w1 as (partition by c), + w2 as (w1 order by pk rows between 3 preceding and 2 following), + w3 as (w2 rows between 2 preceding and 2 following); + +--error ER_BAD_COMBINATION_OF_WINDOW_FRAME_BOUND_SPECS +select + pk, c, + count(*) over w1 as CNT +from t1 +window w1 as (partition by c order by pk + rows between unbounded following and 2 following); + +--error ER_BAD_COMBINATION_OF_WINDOW_FRAME_BOUND_SPECS +select + pk, c, + count(*) over (w1 rows between 2 preceding and unbounded preceding) as CNT +from t1 +window w1 as (partition by c order by pk); + +--error ER_BAD_COMBINATION_OF_WINDOW_FRAME_BOUND_SPECS +select + pk, c, + count(*) over (w1 order by pk rows between current row and 2 preceding) as CNT +from t1 +window w1 as (partition by c); + +--error ER_BAD_COMBINATION_OF_WINDOW_FRAME_BOUND_SPECS +select + pk, c, + count(*) over (w2 rows between 2 following and current row) as CNT +from t1 +window w1 as (partition by c), w2 as (w1 order by pk); + +--error ER_WRONG_PLACEMENT_OF_WINDOW_FUNCTION +select + pk, c +from t1 where rank() over w1 > 2 +window w1 as (partition by c order by pk); + +--error ER_WRONG_PLACEMENT_OF_WINDOW_FUNCTION +select + c, max(pk) as m +from t1 + group by c + rank() over w1 +window w1 as (order by m); + +--error ER_WRONG_PLACEMENT_OF_WINDOW_FUNCTION +select + c, max(pk) as m, rank() over w1 as r +from t1 + group by c+r +window w1 as (order by m); + +--error ER_WRONG_PLACEMENT_OF_WINDOW_FUNCTION +select + c, max(pk) as m, rank() over w1 as r +from t1 + group by c having c+r > 3 +window w1 as (order by m); + +--error ER_WINDOW_FUNCTION_IN_WINDOW_SPEC +select + c, max(pk) as m, rank() over w1 as r, + rank() over (partition by r+1 order by m) +from t1 + group by c +window w1 as (order by m); + +--error ER_WINDOW_FUNCTION_IN_WINDOW_SPEC +select + c, max(pk) as m, rank() over w1 as r, + rank() over (partition by m order by r) +from t1 + group by c +window w1 as (order by m); + +--error ER_WINDOW_FUNCTION_IN_WINDOW_SPEC +select + c, max(pk) as m, rank() over w1 as r, dense_rank() over w2 as dr +from t1 + group by c +window w1 as (order by m), w2 as (partition by r order by m); + +--error ER_NOT_ALLOWED_WINDOW_FRAME +select + pk, c, + row_number() over (partition by c order by pk + range between unbounded preceding and current row) as r +from t1; + +--error ER_NOT_ALLOWED_WINDOW_FRAME +select + pk, c, + rank() over w1 as r +from t1 +window w1 as (partition by c order by pk + rows between 2 preceding and 2 following); + +--error ER_NOT_ALLOWED_WINDOW_FRAME +select + pk, c, + dense_rank() over (partition by c order by pk + rows between 1 preceding and 1 following) as r +from t1; + +--error ER_NO_ORDER_LIST_IN_WINDOW_SPEC +select + pk, c, + rank() over w1 as r +from t1 +window w1 as (partition by c); + +--error ER_NO_ORDER_LIST_IN_WINDOW_SPEC +select + pk, c, + dense_rank() over (partition by c) as r +from t1; + +drop table t0,t1; + +--echo # +--echo # MDEV-9634: Window function produces incorrect value +--echo # + +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2 (part_id int, pk int, a int); +insert into t2 select + if(a<5, 0, 1), a, if(a<5, NULL, 1) from t0; +select * from t2; + +select + part_id, pk, a, + count(a) over (partition by part_id order by pk + rows between 1 preceding and 1 following) as CNT +from t2; + +drop table t0, t2; + +--echo # +--echo # RANGE-type bounds +--echo # + +create table t3 ( + pk int, + val int +); + +insert into t3 values +(0, 1), +(1, 1), +(2, 1), +(3, 2), +(4, 2), +(5, 2), +(6, 2); + +select + val, + count(val) over (order by val + range between current row and + current row) + as CNT +from t3; + +insert into t3 values +(7, 3), +(8, 3); + +select + val, + count(val) over (order by val + range between current row and + current row) + as CNT +from t3; + +drop table t3; + +--echo # Now, check with PARTITION BY +create table t4 ( + part_id int, + pk int, + val int +); + +insert into t4 values +(1234, 100, 1), +(1234, 101, 1), +(1234, 102, 1), +(1234, 103, 2), +(1234, 104, 2), +(1234, 105, 2), +(1234, 106, 2), +(1234, 107, 3), +(1234, 108, 3), + +(5678, 200, 1), +(5678, 201, 1), +(5678, 202, 1), +(5678, 203, 2), +(5678, 204, 2), +(5678, 205, 2), +(5678, 206, 2), +(5678, 207, 3), +(5678, 208, 3); + +select + part_id, + val, + count(val) over (partition by part_id + order by val + range between current row and + current row) + as CNT +from t4; + +--echo # +--echo # Try RANGE UNBOUNDED PRECEDING | FOLLOWING +--echo # +select + part_id, + val, + count(val) over (partition by part_id + order by val + range between unbounded preceding and + current row) + as CNT +from t4; + +select + part_id, + val, + count(val) over (partition by part_id + order by val + range between current row and + unbounded following) + as CNT +from t4; + +select + part_id, + val, + count(val) over (partition by part_id + order by val + range between unbounded preceding and + unbounded following) + as CNT +from t4; + +drop table t4; + +--echo # +--echo # MDEV-9695: Wrong window frame when using RANGE BETWEEN N FOLLOWING AND PRECEDING +--echo # +create table t1 (pk int, a int, b int); +insert into t1 values +( 1 , 0, 1), +( 2 , 0, 2), +( 3 , 1, 4), +( 4 , 1, 8), +( 5 , 2, 32), +( 6 , 2, 64), +( 7 , 2, 128), +( 8 , 2, 16); + +select pk, a, b, +bit_or(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) as bit_or +from t1; + +--echo # Extra ROWS n PRECEDING tests +select pk, a, b, +bit_or(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) as bit_or +from t1; +drop table t1; + + +create table t2 ( + pk int, + a int, + b int +); + +insert into t2 values +( 1, 0, 1), +( 2, 0, 2), +( 3, 0, 4), +( 4, 0, 8), +( 5, 1, 16), +( 6, 1, 32), +( 7, 1, 64), +( 8, 1, 128), +( 9, 2, 256), +(10, 2, 512), +(11, 2, 1024), +(12, 2, 2048); + +select pk, a, b, +bit_or(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) as bit_or +from t2; + +select pk, a, b, +bit_or(b) over (partition by a order by pk ROWS BETWEEN 2 PRECEDING AND 2 PRECEDING) as bit_or +from t2; + +select pk, a, b, +bit_or(b) over (partition by a order by pk ROWS BETWEEN 2 PRECEDING AND 1 PRECEDING) as bit_or +from t2; + +--echo # Check CURRENT ROW + +select pk, a, b, +bit_or(b) over (partition by a order by pk ROWS BETWEEN CURRENT ROW AND CURRENT ROW) as bit_or +from t2; + +drop table t2; + +--echo # +--echo # Try RANGE PRECEDING|FOLLWING n +--echo # +create table t1 ( + part_id int, + pk int, + a int +); + +insert into t1 values +(10, 1, 1), +(10, 2, 2), +(10, 3, 4), +(10, 4, 8), +(10, 5,26), +(10, 6,27), +(10, 7,40), +(10, 8,71), +(10, 9,72); + +select + pk, a, + count(a) over (ORDER BY a + RANGE BETWEEN UNBOUNDED PRECEDING + AND 10 FOLLOWING) as cnt +from t1; + +select + pk, a, + count(a) over (ORDER BY a DESC + RANGE BETWEEN UNBOUNDED PRECEDING + AND 10 FOLLOWING) as cnt +from t1; + +select + pk, a, + count(a) over (ORDER BY a + RANGE BETWEEN UNBOUNDED PRECEDING + AND 1 FOLLOWING) as cnt +from t1; + +select + pk, a, + count(a) over (ORDER BY a + RANGE BETWEEN UNBOUNDED PRECEDING + AND 10 PRECEDING) as cnt +from t1; + +select + pk, a, + count(a) over (ORDER BY a DESC + RANGE BETWEEN UNBOUNDED PRECEDING + AND 10 PRECEDING) as cnt +from t1; + +select + pk, a, + count(a) over (ORDER BY a + RANGE BETWEEN UNBOUNDED PRECEDING + AND 1 PRECEDING) as cnt +from t1; + +# Try bottom bound +select + pk, a, + count(a) over (ORDER BY a + RANGE BETWEEN 1 PRECEDING + AND CURRENT ROW) as cnt +from t1; + +select + pk, a, + count(a) over (ORDER BY a DESC + RANGE BETWEEN 1 PRECEDING + AND CURRENT ROW) as cnt +from t1; + +select + pk, a, + count(a) over (ORDER BY a + RANGE BETWEEN 1 FOLLOWING + AND 3 FOLLOWING) as cnt +from t1; + +--echo # Try CURRENT ROW with[out] DESC +select + pk, a, + count(a) over (ORDER BY a + RANGE BETWEEN CURRENT ROW + AND 1 FOLLOWING) as cnt +from t1; + +select + pk, a, + count(a) over (order by a desc + range between current row + and 1 following) as cnt +from t1; + + +# Try with partitions +insert into t1 select 22, pk, a from t1; +select + part_id, pk, a, + count(a) over (PARTITION BY part_id + ORDER BY a + RANGE BETWEEN UNBOUNDED PRECEDING + AND 10 FOLLOWING) as cnt +from t1; + +select + pk, a, + count(a) over (PARTITION BY part_id + ORDER BY a + RANGE BETWEEN UNBOUNDED PRECEDING + AND 1 PRECEDING) as cnt +from t1; + +drop table t1; + +--echo # Try a RANGE frame over non-integer datatype: + +create table t1 ( + col1 int, + a decimal(5,3) +); + +insert into t1 values (1, 0.45); +insert into t1 values (1, 0.5); +insert into t1 values (1, 0.55); +insert into t1 values (1, 1.21); +insert into t1 values (1, 1.22); +insert into t1 values (1, 3.33); + +select + a, + count(col1) over (order by a + range between 0.1 preceding + and 0.1 following) +from t1; + +drop table t1; + +--echo # +--echo # RANGE-type frames and NULL values +--echo # +create table t1 ( + pk int, + a int, + b int +); + +insert into t1 values (1, NULL,1); +insert into t1 values (2, NULL,1); +insert into t1 values (3, NULL,1); +insert into t1 values (4, 10 ,1); +insert into t1 values (5, 11 ,1); +insert into t1 values (6, 12 ,1); +insert into t1 values (7, 13 ,1); +insert into t1 values (8, 14 ,1); + + +select + pk, a, + count(b) over (order by a + range between 2 preceding + and 2 following) as CNT +from t1 +order by a, pk; +drop table t1; + +--echo # +--echo # Try ranges that have bound1 > bound2. The standard actually allows them +--echo # + +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t1 (pk int, c int); +insert into t1 select a+1,1 from t0; +update t1 set c=2 where pk not in (1,2,3,4); +select * from t1; + +select + pk, c, + count(*) over (partition by c + order by pk + rows between 1 preceding + and 2 preceding) + as cnt +from t1; + +select + pk, c, + sum(c) over (partition by c + order by pk + rows between 1 preceding + and 2 preceding) + as sum +from t1; + +select + pk, c, + sum(c) over (partition by c + order by pk + rows between 2 following + and 1 following) + as sum +from t1; + + +select + pk, c, + count(*) over (partition by c + order by pk + range between 1 preceding + and 2 preceding) + as cnt +from t1; +drop table t0, t1; + +--echo # +--echo # Error checking for frame bounds +--echo # + +create table t1 (a int, b int, c varchar(32)); +insert into t1 values (1,1,'foo'); +insert into t1 values (2,2,'bar'); +--error ER_RANGE_FRAME_NEEDS_SIMPLE_ORDERBY +select + count(*) over (order by a,b + range between unbounded preceding and current row) +from t1; + +--error ER_WRONG_TYPE_FOR_RANGE_FRAME +select + count(*) over (order by c + range between unbounded preceding and current row) +from t1; + +--error ER_WRONG_TYPE_FOR_RANGE_FRAME +select + count(*) over (order by a + range between 'abcd' preceding and current row) +from t1; + +--error ER_WRONG_TYPE_FOR_RANGE_FRAME +select + count(*) over (order by a + range between current row and 'foo' following) +from t1; + +--echo # Try range frame with invalid bounds +--error ER_WRONG_TYPE_FOR_ROWS_FRAME +select + count(*) over (order by a + rows between 0.5 preceding and current row) +from t1; + +--error ER_WRONG_TYPE_FOR_ROWS_FRAME +select + count(*) over (order by a + rows between current row and 3.14 following) +from t1; + +--echo # +--echo # EXCLUDE clause is parsed but not supported +--echo # + +--error ER_FRAME_EXCLUSION_NOT_SUPPORTED +select + count(*) over (order by a + rows between 1 preceding and 1 following + exclude current row) +from t1; + +--error ER_FRAME_EXCLUSION_NOT_SUPPORTED +select + count(*) over (order by a + range between 1 preceding and 1 following + exclude ties) +from t1; + +--error ER_FRAME_EXCLUSION_NOT_SUPPORTED +select + count(*) over (order by a + range between 1 preceding and 1 following + exclude group) +from t1; + +# EXCLUDE NO OTHERS means 'don't exclude anything' +select + count(*) over (order by a + rows between 1 preceding and 1 following + exclude no others) +from t1; + +drop table t1; + +--echo # +--echo # Window function in grouping query +--echo # + +create table t1 ( + username varchar(32), + amount int +); + +insert into t1 values +('user1',1), +('user1',5), +('user1',3), +('user2',10), +('user2',20), +('user2',30); + +select + username, + sum(amount) as s, + rank() over (order by s desc) +from t1 +group by username; + +drop table t1; + +--echo # +--echo # mdev-9719: Window function in prepared statement +--echo # + +create table t1(a int, b int, x char(32)); +insert into t1 values (2, 10, 'xx'); +insert into t1 values (2, 10, 'zz'); +insert into t1 values (2, 20, 'yy'); +insert into t1 values (3, 10, 'xxx'); +insert into t1 values (3, 20, 'vvv'); + +prepare stmt from 'select a, row_number() over (partition by a order by b) from t1'; +--sorted_result +execute stmt; + +drop table t1; + +--echo # +--echo # mdev-9754: Window name resolution in prepared statement +--echo # + +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t1 (pk int, c int); +insert into t1 select a+1,1 from t0; +update t1 set c=2 where pk not in (1,2,3,4); +select * from t1; + +prepare stmt from +'select + pk, c, + count(*) over w1 as CNT +from t1 +window w1 as (partition by c order by pk + rows between 2 preceding and 2 following)'; +execute stmt; + +drop table t0,t1; + +--echo # +--echo # EXPLAIN FORMAT=JSON support for window functions +--echo # +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +explain format=json select rank() over (order by a) from t0; + +create table t1 (a int, b int, c int); +insert into t1 select a,a,a from t0; + +explain format=json +select + a, + rank() over (order by sum(b)) +from t1 +group by a; + +explain format=json +select + a, + rank() over (order by sum(b)) +from t1 +group by a +order by null; + +--echo # +--echo # Check how window function works together with GROUP BY and HAVING +--echo # + +select b,max(a) as MX, rank() over (order by b) from t1 group by b having MX in (3,5,7); +explain format=json +select b,max(a) as MX, rank() over (order by b) from t1 group by b having MX in (3,5,7); + +drop table t1; +drop table t0; + +--echo # +--echo # Building ordering index for window functions +--echo # + +create table t1 ( + pk int primary key, + a int, + b int, + c int +); + +insert into t1 values +(101 , 0, 10, 1), +(102 , 0, 10, 2), +(103 , 1, 10, 3), +(104 , 1, 10, 4), +(108 , 2, 10, 5), +(105 , 2, 20, 6), +(106 , 2, 20, 7), +(107 , 2, 20, 8), +(109 , 4, 20, 9), +(110 , 4, 20, 10), +(111 , 5, NULL, 11), +(112 , 5, 1, 12), +(113 , 5, NULL, 13), +(114 , 5, NULL, 14), +(115 , 5, NULL, 15), +(116 , 6, 1, NULL), +(117 , 6, 1, 10), +(118 , 6, 1, 1), +(119 , 6, 1, NULL), +(120 , 6, 1, NULL), +(121 , 6, 1, NULL), +(122 , 6, 1, 2), +(123 , 6, 1, 20), +(124 , 6, 1, -10), +(125 , 6, 1, NULL), +(126 , 6, 1, NULL), +(127 , 6, 1, NULL); + +--sorted_result +select sum(b) over (partition by a order by b,pk + rows between unbounded preceding and current row) as c1, + avg(b) over (w1 rows between 1 preceding and 1 following) as c2, + sum(c) over (w2 rows between 1 preceding and 1 following) as c5, + avg(b) over (w1 rows between 5 preceding and 5 following) as c3, + sum(b) over (w1 rows between 1 preceding and 1 following) as c4 +from t1 +window w1 as (partition by a order by b,pk), + w2 as (partition by b order by c,pk); + +drop table t1; + + +--echo # +--echo # MDEV-9848: Window functions: reuse sorting and/or scanning +--echo # + +create table t1 (a int, b int, c int); +insert into t1 values +(1,3,1), +(2,2,1), +(3,1,1); + +--echo # Check using counters +flush status; +--sorted_result +select + rank() over (partition by c order by a), + rank() over (partition by c order by b) +from t1; +show status like '%sort%'; + +flush status; +--sorted_result +select + rank() over (partition by c order by a), + rank() over (partition by c order by a) +from t1; +show status like '%sort%'; + +# Check using EXPLAIN FORMAT=JSON +explain format=json +select + rank() over (partition by c order by a), + rank() over (partition by c order by a) +from t1; + +explain format=json +select + rank() over (order by a), + row_number() over (order by a) +from t1; + +explain format=json +select + rank() over (partition by c order by a), + count(*) over (partition by c) +from t1; + +explain format=json +select + count(*) over (partition by c), + rank() over (partition by c order by a) +from t1; + +drop table t1; + + +--echo # +--echo # MDEV-9847: Window functions: crash with big_tables=1 +--echo # +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +set @tmp=@@big_tables; +set big_tables=1; +select rank() over (order by a) from t1; +set big_tables=@tmp; +drop table t1; + +--echo # +--echo # Check if "ORDER BY window_func" works +--echo # + +create table t1 (s1 int, s2 char(5)); +insert into t1 values (1,'a'); +insert into t1 values (null,null); +insert into t1 values (1,null); +insert into t1 values (null,'a'); +insert into t1 values (2,'b'); +insert into t1 values (-1,''); + +explain format=json +select *, row_number() over (order by s1, s2) as X from t1 order by X desc; +select *, row_number() over (order by s1, s2) as X from t1 order by X desc; +drop table t1; + +--echo # +--echo # Try window functions that are not directly present in the select list +--echo # +create table t1 (a int, b int); +insert into t1 values + (1,3), + (2,2), + (3,1); + +--sorted_result +select + a, b, + rank() over (order by a), rank() over (order by b), + rank() over (order by a) - rank() over (order by b) as diff +from + t1; + +drop table t1; + +create table t1 (i int); +insert into t1 values (1),(2); +SELECT MAX(i) OVER (PARTITION BY (i)) FROM t1; +drop table t1; + +--echo # +--echo # Check the 0 in ROWS 0 PRECEDING +--echo # + +create table t1 ( + part_id int, + pk int, + a int +); + +insert into t1 values (1, 1, 1); +insert into t1 values (1, 2, 2); +insert into t1 values (1, 3, 4); +insert into t1 values (1, 4, 8); + +select + pk, a, + sum(a) over (order by pk rows between 0 preceding and current row) +from t1; + +select + pk, a, + sum(a) over (order by pk rows between 1 preceding and 0 preceding) +from t1; + +insert into t1 values (200, 1, 1); +insert into t1 values (200, 2, 2); +insert into t1 values (200, 3, 4); +insert into t1 values (200, 4, 8); +select + part_id, pk, a, + sum(a) over (partition by part_id order by pk rows between 0 preceding and current row) +from t1; + +select + part_id, pk, a, + sum(a) over (partition by part_id order by pk rows between 1 preceding and 0 preceding) +from t1; + +drop table t1; +--echo # +--echo # MDEV-9780, The "DISTINCT must not bet converted into GROUP BY when +--echo # window functions are present" part +--echo # + +create table t1 (part_id int, a int); +insert into t1 values +(100, 1), +(100, 2), +(100, 2), +(100, 3), +(2000, 1), +(2000, 2), +(2000, 3), +(2000, 3), +(2000, 3); + +select rank() over (partition by part_id order by a) from t1; +select distinct rank() over (partition by part_id order by a) from t1; +explain format=json +select distinct rank() over (partition by part_id order by a) from t1; + +drop table t1; + +--echo # +--echo # MDEV-9893: Window functions with different ORDER BY lists, +--echo # one of these lists containing an expression +--echo # + +create table t1 (s1 int, s2 char(5)); +insert into t1 values (1,'a'); +insert into t1 values (null,null); +insert into t1 values (3,null); +insert into t1 values (4,'a'); +insert into t1 values (2,'b'); +insert into t1 values (-1,''); + +--sorted_result +select + *, + ROW_NUMBER() OVER (order by s1), + CUME_DIST() OVER (order by -s1) +from t1; + +drop table t1; + + +--echo # +--echo # MDEV-9925: Wrong result with aggregate function as a window function +--echo # +create table t1 (i int); +insert into t1 values (1),(2); +select i, sum(i) over (partition by i) from t1; +drop table t1; + +--echo # +--echo # MDEV-9922: Assertion `!join->only_const_tables() && fsort' failed in int create_sort_index +--echo # +create view v1 as select 1 as i; +select rank() over (order by i) from v1; +drop view v1; + +--echo # +--echo # MDEV-10097: Assertion `count > 0' failed in Item_sum_sum::add_helper(bool) +--echo # +CREATE TABLE `orders` ( + `o_orderkey` int(11) NOT NULL, + `o_custkey` int(11) DEFAULT NULL, + PRIMARY KEY (`o_orderkey`) + ) DEFAULT CHARSET=latin1; + +INSERT INTO `orders` VALUES (59908,242); +INSERT INTO `orders` VALUES (59940,238); + +SELECT o_custkey, avg(o_custkey) OVER (PARTITION BY abs(o_custkey) + ORDER BY o_custkey + RANGE BETWEEN 15 FOLLOWING + AND 15 FOLLOWING) from orders; +DROP table orders; + +--echo # +--echo # MDEV-10842: window functions with the same order column +--echo # but different directions +--echo # + +create table t1 ( + pk int primary key, + a int, + b int, + c char(10) +); + +insert into t1 values +( 1, 0, 1, 'one'), +( 2, 0, 2, 'two'), +( 3, 0, 3, 'three'), +( 4, 1, 1, 'one'), +( 5, 1, 1, 'two'), +( 6, 1, 2, 'three'), +( 7, 2, NULL, 'n_one'), +( 8, 2, 1, 'n_two'), +( 9, 2, 2, 'n_three'), +(10, 2, 0, 'n_four'), +(11, 2, 10, NULL); + +select pk, + row_number() over (order by pk desc) as r_desc, + row_number() over (order by pk asc) as r_asc +from t1; + +drop table t1; + +--echo # +--echo # MDEV-10874: two window functions with compatible sorting +--echo # + +create table t1 ( +pk int primary key, +a int, +b int, +c char(10), +d decimal(10, 3), +e real +); +insert into t1 values +( 1, 0, 1, 'one', 0.1, 0.001), +( 2, 0, 2, 'two', 0.2, 0.002), +( 3, 0, 3, 'three', 0.3, 0.003), +( 4, 1, 2, 'three', 0.4, 0.004), +( 5, 1, 1, 'two', 0.5, 0.005), +( 6, 1, 1, 'one', 0.6, 0.006), +( 7, 2, NULL, 'n_one', 0.5, 0.007), +( 8, 2, 1, 'n_two', NULL, 0.008), +( 9, 2, 2, NULL, 0.7, 0.009), +(10, 2, 0, 'n_four', 0.8, 0.010), +(11, 2, 10, NULL, 0.9, NULL); + +select pk, a, d, + sum(d) over (partition by a order by pk + ROWS between 1 preceding and current row) as sum_1, + sum(d) over (order by a + ROWS BETWEEN 1 preceding and 2 following) as sum_2 +from t1; +explain format=json +select pk, a, d, + sum(d) over (partition by a order by pk + ROWS between 1 preceding and current row) as sum_1, + sum(d) over (order by a + ROWS BETWEEN 1 preceding and 2 following) as sum_2 +from t1; + +select pk, a, d, + sum(d) over (partition by a order by pk desc + ROWS between 1 preceding and current row) as sum_1, + sum(d) over (order by a + ROWS BETWEEN 1 preceding and 2 following) as sum_2 +from t1; + +drop table t1; + +--echo # +--echo # MDEV-9941: two window functions with compatible partitions +--echo # + +create table t1 ( + a int, + b int, + c int +); + +insert into t1 values + (10, 1, 1), + (10, 3, 10), + (10, 1, 10), + (10, 3, 100), + (10, 5, 1000), + (10, 1, 100); + +explain format=json +select + a,b,c, + row_number() over (partition by a), + row_number() over (partition by a, b) +from t1; + +drop table t1; + +--echo # +--echo # MDEV-10815: Window Function Expressions Wrong Results +--echo # +create table t(a decimal(35,10), b int); +insert into t(a,b) values(1,1); +insert into t(a,b) values(2,1); +insert into t(a,b) values(0,1); +insert into t(a,b) values(1, 2); +insert into t(a,b) values(1.5,2); +insert into t(a,b) values(3, 2); +insert into t(a,b) values(4.5,2); +select a, b, + sum(t.a) over (partition by t.b order by a) as simple_sum, + sum(t.a) over (partition by t.b order by a) + 1 as sum_and_const, + sum(t.b) over (partition by t.b order by a) + sum(t.a) over (partition by t.b order by a) as sum_and_sum +from t +order by t.b, t.a; +drop table t; + +--echo # +--echo # MDEV-10669: Crash in SELECT with window function used +--echo # +create table t(a decimal(35,10), b int); +insert into t(a,b) values(1,1); +insert into t(a,b) values(2,1); +insert into t(a,b) values(0,1); +SELECT (CASE WHEN sum(t.a) over (partition by t.b)=0 THEN null ELSE null END) AS a FROM t; +SELECT ifnull(((t.a) / CASE WHEN sum(t.a) over(partition by t.b) =0 then null else null end) ,0) from t; +SELECT sum(t.a) over (partition by t.b order by a), + sqrt(ifnull((sum(t.a) over (partition by t.b order by a)), 0)) +from t; +drop table t; + +--echo # +--echo # MDEV-10868: view definitions with window functions +--echo # + +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t1 (pk int, c int); +insert into t1 select a+1,1 from t0; +update t1 set c=2 where pk not in (1,2,3,4); +select * from t1; + +let $q= +select pk, c, c/count(*) over (partition by c order by pk + rows between 1 preceding and 2 following) as CNT +from t1; + +eval $q; +eval create view v1 as $q; +show create view v1; +select * from v1; + +let $q= +select pk, c, c/count(*) over w1 as CNT from t1 + window w1 as (partition by c order by pk rows between 1 preceding and 2 following); + +eval $q; +eval create view v2 as $q; +show create view v2; +select * from v2; + +let $q= +select pk, c, c/count(*) over w1 as CNT from t1 + window w1 as (partition by c order by pk rows unbounded preceding); + +eval $q; +eval create view v3 as $q; +show create view v3; +select * from v3; + +let $q= +select pk, c, c/count(*) over (partition by c order by pk + range between 3 preceding and current row) as CNT +from t1; + +eval $q; +eval create view v4 as $q; +show create view v4; +select * from v4; + +drop view v1,v2,v3,v4; +drop table t0,t1; + +--echo # +--echo # MDEV-10875: window function in subquery +--echo # + +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (3),(1); + +CREATE TABLE t2 (c VARCHAR(8)); +INSERT INTO t2 VALUES ('foo'),('bar'),('foo'); + +SELECT COUNT(*) OVER (PARTITION BY c) FROM t2; + +SELECT * FROM t1 WHERE i IN ( SELECT COUNT(*) OVER (PARTITION BY c) FROM t2 ); + +DROP TABLE t1, t2; + +--echo # +--echo # MDEV-9976: window function without PARTITION BY and ORDER BY +--echo # + +CREATE TABLE t1 (id int, a int); +INSERT INTO t1 VALUES + (1,1000), (2,1100), (3,1800), (4,1500), (5,1700), (6,1200), + (7,2000), (8,2100), (9,1600); + +--sorted_result +SELECT id, sum(a) OVER (PARTITION BY id + ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM t1; + +--sorted_result +SELECT id, sum(a) OVER (ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM t1; + +DROP TABLE t1; + +--echo # +--echo # MDEV-11867: window function with aggregation +--echo # over the result of grouping +--echo # + +create table t1 ( + username varchar(32), + amount int +); + +insert into t1 values +('user1',1), +('user1',5), +('user1',3), +('user2',10), +('user2',20), +('user2',30); + +select username, sum(amount) as s, avg(sum(amount)) over (order by s desc) + from t1 +group by username; + +select username, sum(amount), avg(sum(amount)) over (order by sum(amount) desc) + from t1 +group by username; + +drop table t1; + +--echo # +--echo # MDEV-11594: window function over implicit grouping +--echo # + +create table t1 (id int); +insert into t1 values (1), (2), (3), (2); + +select sum(id) over (order by sum(id)) from t1; + +select sum(sum(id)) over (order by sum(id)) from t1; + +drop table t1; + +--echo # +--echo # MDEV-9923: integer constant in order by list +--echo # of window specification +--echo # + +create table t1 (id int); +insert into t1 values (1), (2), (3), (2); + +select rank() over (order by 1) from t1; +select rank() over (order by 2) from t1; +select rank() over (partition by id order by 2) from t1; + +drop table t1; + +--echo # +--echo # MDEV-10660: view using a simple window function +--echo # + +create table t1 (id int); +insert into t1 values (1), (2), (3), (2); + +create view v1(id,rnk) as + select id, rank() over (order by id) from t1; + +show create view v1; + +select id, rank() over (order by id) from t1; +select * from v1; + +drop view v1; +drop table t1; + +--echo # +--echo # MDEV-11138: window function in the query without tables +--echo # + +select row_number() over (); +select count(*) over (); +select sum(5) over (); +select row_number() over (), sum(5) over (); +select row_number() over (order by 2); +select row_number() over (partition by 2); +select row_number() over (partition by 4 order by 1+2); + +--echo # +--echo # MDEV-11999: execution of prepared statement for +--echo # tableless query with window functions +--echo # + +prepare stmt from +"select row_number() over (partition by 4 order by 1+2)"; +execute stmt; +execute stmt; +deallocate prepare stmt; + +--echo # +--echo # MDEV-11745: window function with min/max +--echo # + +create table t1 (i int, b int); +insert into t1 values + (1,1),(2,1),(3,1),(4,4),(5,4),(6,4),(7,8),(8,8),(9,8),(10,8); + +select b, min(i) over (partition by b) as f + from t1 as tt +order by i; + +select b, min(i) over (partition by b) as f + from (select * from t1) as tt +order by i; + +select b, min(i+10) over (partition by b) as f + from t1 as tt +order by i; + +select b, min(i) over (partition by b) as f + from (select i+10 as i, b from t1) as tt +order by i; + +select b, min(i+20) over (partition by b) as f + from (select i+10 as i, b from t1) as tt +order by i; + +select b, max(i) over (partition by b) as f + from t1 as tt +order by i; + +select b, max(i) over (partition by b) as f + from (select * from t1) as tt +order by i; + +select b, max(i+10) over (partition by b) as f + from t1 as tt +order by i; + +select b, max(i) over (partition by b) as f + from (select i+10 as i, b from t1) as tt +order by i; + +select b, max(i+20) over (partition by b) as f + from (select i+10 as i, b from t1) as tt +order by i; + +select max(i), max(i), sum(i), count(i) + from t1 as tt +group by b; + +select max(i), min(sum(i)) over (partition by count(i)) f + from t1 as tt +group by b; + +select max(i), min(sum(i)) over (partition by count(i)) f + from (select * from t1) as tt +group by b; + +select max(i+10), min(sum(i)+10) over (partition by count(i)) f + from t1 as tt +group by b; + +select max(i), max(i), sum(i), count(i) + from (select i+10 as i, b from t1) as tt +group by b; + +select max(i), min(sum(i)) over (partition by count(i)) f + from (select i+10 as i, b from t1) as tt +group by b; + +select max(i), min(i), min(max(i)-min(i)) over (partition by count(i)) f + from (select i+10 as i, b from t1) as tt +group by b; + +drop table t1; + +--echo # +--echo # MDEV-12015: window function over select with WHERE +--echo # that is always FALSE +--echo # + +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (3), (1), (2); + +SELECT i, ROW_NUMBER() OVER () FROM t1 WHERE 1 = 2; + +SELECT i, COUNT(*) OVER () FROM t1 WHERE 1 = 2; + +DROP TABLE t1; + +--echo # +--echo # MDEV-12051: window function in query with implicit grouping +--echo # on always empty set +--echo # + +create table t1 (a int, b varchar(8)); +insert into t1 values (1,'foo'),(2,'bar'); + +select max(a), row_number() over () from t1 where a > 10; +select max(a), sum(max(a)) over () from t1 where a > 10; +select max(a), sum(max(a)) over (partition by max(a)) from t1 where a > 10; + +select max(a), row_number() over () from t1 where 1 = 2; +select max(a), sum(max(a)) over () from t1 where 1 = 2; +select max(a), sum(max(a)) over (partition by max(a)) from t1 where 1 = 2; + +select max(a), row_number() over () from t1 where 1 = 2 + having max(a) is not null; +select max(a), sum(max(a)) over () from t1 where 1 = 2 + having max(a) is not null; + +drop table t1; + +--echo # +--echo # MDEV-10885: window function in query with implicit grouping +--echo # with constant condition evaluated to false +--echo # + +CREATE TABLE t1 (a INT, b VARCHAR(8)); +INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); + +CREATE TABLE t2 (c INT); +INSERT INTO t2 VALUES (3),(4); + +CREATE TABLE t3 (d INT); +INSERT INTO t3 VALUES (5),(6); + +SELECT MAX(a), ROW_NUMBER() OVER (PARTITION BY MAX(a)) FROM t1 +WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) ); + +SELECT MAX(a), COUNT(MAX(a)) OVER (PARTITION BY MAX(a)) FROM t1 +WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) ); + +SELECT MAX(a), SUM(MAX(a)) OVER (PARTITION BY MAX(a)) FROM t1 +WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) ); + +SELECT MAX(a), ROW_NUMBER() OVER (PARTITION BY MAX(a)) FROM t1 +WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) ) +HAVING MAX(a) IS NOT NULL; + +SELECT a, MAX(a), ROW_NUMBER() OVER (PARTITION BY b) FROM t1 +WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) ); + +SELECT a, COUNT(a), AVG(a) OVER (PARTITION BY b) FROM t1 +WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) ); + +SELECT a, MAX(a), AVG(a) OVER (PARTITION BY b) FROM t1 +WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) ); + +DROP TABLE t1,t2,t3; + +--echo # +--echo # MDEV-10859: Wrong result of aggregate window function in query +--echo # with HAVING and no ORDER BY +--echo # + +create table empsalary (depname varchar(32), empno smallint primary key, salary int); +insert into empsalary values + ('develop', 1, 5000), ('develop', 2, 4000),('sales', 3, '6000'),('sales', 4, 5000); + +--sorted_result +SELECT depname, empno, salary, avg(salary) OVER (PARTITION BY depname) FROM empsalary; +--sorted_result +SELECT depname, empno, salary, avg(salary) OVER (PARTITION BY depname) FROM empsalary ORDER BY depname; +--echo # +--echo # These last 2 should have the same row results, ignoring order. +--echo # +--sorted_result +SELECT depname, empno, salary, avg(salary) OVER (PARTITION BY depname) FROM empsalary HAVING empno > 1; +--sorted_result +SELECT depname, empno, salary, avg(salary) OVER (PARTITION BY depname) FROM empsalary HAVING empno > 1 ORDER BY depname; + +drop table empsalary; + +--echo # +--echo # MDEV-11868: min(distinct) over () returns wrong value +--echo # + +create table TDEC (CDEC int, RNUM int); +create view VDEC as select * from TDEC; +insert into TDEC (CDEC) values (null),(-1),(0),(1),(0),(10); +select TDEC.CDEC, min(TDEC.CDEC) over () from TDEC; +select VDEC.CDEC, min(VDEC.CDEC) over () from VDEC; +select TDEC.CDEC, max(TDEC.CDEC) over () from TDEC; +select VDEC.CDEC, max(VDEC.CDEC) over () from VDEC; + +select TDEC.CDEC, min(distinct TDEC.CDEC) over () from TDEC; +select VDEC.CDEC, min(distinct VDEC.CDEC) over () from VDEC; +select TDEC.CDEC, max(distinct TDEC.CDEC) over () from TDEC; +select VDEC.CDEC, max(distinct VDEC.CDEC) over () from VDEC; + +--echo # +--echo # These should be removed once support for them is added. +--echo # +--error ER_NOT_SUPPORTED_YET +select TDEC.CDEC, count(distinct TDEC.CDEC) over () from TDEC; +--error ER_NOT_SUPPORTED_YET +select VDEC.CDEC, count(distinct VDEC.CDEC) over () from VDEC; +--error ER_NOT_SUPPORTED_YET +select TDEC.CDEC, sum(distinct TDEC.CDEC) over () from TDEC; +--error ER_NOT_SUPPORTED_YET +select VDEC.CDEC, sum(distinct VDEC.CDEC) over () from VDEC; +--error ER_NOT_SUPPORTED_YET +select TDEC.CDEC, avg(distinct TDEC.CDEC) over () from TDEC; +--error ER_NOT_SUPPORTED_YET +select VDEC.CDEC, avg(distinct VDEC.CDEC) over () from VDEC; +--error ER_NOT_SUPPORTED_YET +select TDEC.CDEC, GROUP_CONCAT(TDEC.CDEC) over () from TDEC; +--error ER_NOT_SUPPORTED_YET +select VDEC.CDEC, GROUP_CONCAT(distinct VDEC.CDEC) over () from VDEC; + +drop table TDEC; +drop view VDEC; + +--echo # +--echo # MDEV-10700: 10.2.2 windowing function returns incorrect result +--echo # +create table t(a int,b int, c int , d int); +insert into t(a,b,c,d) values(1, rand(10)*1000, rand(10)*1000, rand(10)*1000); +insert into t(a,b,c,d) values(1, rand(10)*1000, rand(10)*1000, rand(10)*1000); +replace into t(a,b,c,d) select 1, rand(10)*1000, rand(10)*1000, rand(10)*1000 from t t1, t t2, t t3, t t4, t t5, t t6, t t7, t t8, t t9, t t10, t t11, t t12, t t13, t t14, t t15, t t16, t t17; + +select count(distinct s) from (select sum(d) over(partition by a,b,c) as s from t) Z where s > 0; +select count(distinct s) from (select sum(d) as s from t group by a,b,c) Z where s > 0; + +select count(distinct s) from (select sum(d) over(partition by a,b) as s from t) Z where s > 0; +select count(distinct s) from (select sum(d) as s from t group by a,b) Z where s > 0; + +select count(distinct s) from (select sum(d) over(partition by a) as s from t) Z where s > 0; +select count(distinct s) from (select sum(d) as s from t group by a) Z where s > 0; + +drop table t; + +--echo # +--echo # MDEV-9924: window function in query with group by optimized away +--echo # + +create table t1 (i int); +insert into t1 values (2),(3),(1); + +select row_number() over () from t1 group by 1+2; +select max(i), row_number() over () from t1 group by 1+2; +select rank() over (order by max(i)) from t1 group by 1+2; + +select i, row_number() over () from t1 group by 1+2; +select i, rank() over (order by i) rnk from t1 group by 1+2; + +drop table t1; + +--echo # +--echo # MDEV-11907: window function as the second operand of division +--echo # + +create table t1 (pk int, c int); +insert into t1 values (1,1),(2,1),(3,1),(4,1),(5,2); + +set @sql_mode_save= @@sql_mode; +set sql_mode='ERROR_FOR_DIVISION_BY_ZERO'; + +select pk, c, c/count(*) over + (partition by c order by pk + rows between 1 preceding and 2 following) as CNT +from t1; +show warnings; + +set sql_mode=@sql_mode_save; + +drop table t1; + +--echo # +--echo # MDEV-12336: several functions over a window function +--echo # + +create table t1 (name varchar(10), cnt int); +insert into t1 values ('Fred', 23), ('Fred', 35), ('Joe', 10); + +select q.name, q.row_cnt, + round( 100 * ( q.row_cnt / + sum(q.row_cnt) over + ( + order by q.name + rows between + unbounded preceding and + unbounded following + ) + ),2 + ) pct_of_total +from +( + select name, count(*) row_cnt, sum(cnt) sum_cnt + from t1 + group by 1 +) q; + +drop table t1; + +--echo # +--echo # MDEV-11990: window function over min/max aggregation +--echo # + +create table t1 (id int); +insert into t1 values (1), (2), (3), (2), (4), (2); + +select sum(max(id)) over (order by max(id)) from t1; +explain +select sum(max(id)) over (order by max(id)) from t1; + +create index idx on t1(id); +select sum(max(id)) over (order by max(id)) from t1; +explain +select sum(max(id)) over (order by max(id)) from t1; +select sum(max(id)) over (order by max(id)) from t1 where id < 3; +select count(max(id)) over (order by max(id)) from t1 where id < 3; +select max(id), rank() over (order by max(id)) from t1 where id < 3; + +drop table t1; + +--echo # +--echo # main.win failure post MDEV-12336 +--echo # +create table t(a decimal(35,10), b int); +insert into t values (1, 10), (2, 20), (3, 30); + +prepare stmt from "SELECT (CASE WHEN sum(t.a) over (partition by t.b)=1 THEN 1000 ELSE 300 END) AS a FROM t"; +execute stmt; +drop table t; + +--echo # +--echo # MDEV-12851 case with window functions query crashes server +--echo # + +create table t1(dt datetime); +insert into t1 values ('2017-05-17'), ('2017-05-18'); +select dt, + case when (max(dt) over (order by dt rows between 1 following and 1 following) is null) + then '9999-12-31 12:00:00' + else max(dt) over (order by dt rows between 1 following and 1 following) + end x, + case when (max(dt) over (order by dt rows between 1 following and 1 following) is not null) + then '9999-12-31 12:00:00' + else max(dt) over (order by dt rows between 1 following and 1 following) + end x +from t1; + +drop table t1; + +create table t1(i int); +insert into t1 values (null),(1),(2); +select max(i) over (order by i), + max(i) over (order by i) is null, + max(i) over (order by i) is not null +from t1; +drop table t1; + +--echo # +--echo # MDEV-13189: Window functions crash when using INTERVAL function +--echo # +create table t1(i int); +insert into t1 values (1),(2),(10),(20),(30); +select sum(i) over (order by i), interval(sum(i) over (order by i), 10, 20) +from t1; +drop table t1; + +--echo # +--echo # MDEV-13352: Server crashes in st_join_table::remove_duplicates +--echo # +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1),(2); +SELECT DISTINCT ROW_NUMBER() OVER(), i FROM t1 WHERE 0; +SELECT ROW_NUMBER() OVER(), i FROM t1 WHERE 0; +DROP TABLE t1; + +--echo # +--echo # MDEV-13344: Server crashes in in AGGR_OP::put_record on subquery +--echo # with window function and constant table +--echo # (Testcase only) +--echo # +CREATE TABLE t1 (c CHAR(8)) ENGINE=MyISAM; +INSERT IGNORE INTO t1 VALUES ('foo'); +SELECT ('bar',1) IN ( SELECT c, ROW_NUMBER() OVER (PARTITION BY c) FROM t1); +DROP TABLE t1; + +--echo # +--echo # MDEV-13351: Server crashes in st_select_lex::set_explain_type upon UNION with window function +--echo # +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1),(2); +SELECT Nth_value(i,1) OVER() FROM t1 +UNION ALL +( SELECT Nth_value(i,2) OVER() FROM t1 LIMIT 0 ) +; +DROP TABLE t1; + +--echo # +--echo # A regression after MDEV-13351: +--echo # MDEV-13374 : Server crashes in first_linear_tab / st_select_lex::set_explain_type +--echo # upon UNION with aggregate function +--echo # + +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +SELECT i AS fld FROM t1 UNION SELECT COUNT(*) AS fld FROM t1; +DROP TABLE t1; + +--echo # +--echo # MDEV-13240 Wrong warning with MAX(datetime_field) OVER (...) +--echo # + +CREATE TABLE t1 (dt DATETIME); +INSERT INTO t1 VALUES ('2017-05-17'); +SELECT MAX(dt) OVER (ORDER BY dt ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING) FROM t1; +DROP TABLE t1; + +--echo # +--echo # MDEV-13358 FIRST_VALUE throws SQL Error (1292): Incorrect datetime value +--echo # +CREATE TABLE IF NOT EXISTS `fv_test` ( + `SOME_DATE` datetime NOT NULL + ); + +INSERT INTO `fv_test` (`SOME_DATE`) VALUES ('2017-07-20 12:47:56'); + +CREATE TABLE fv_result +SELECT +FIRST_VALUE(SOME_DATE) OVER(ORDER BY SOME_DATE DESC) AS somedate +FROM fv_test; + +SHOW CREATE TABLE fv_result; + +SELECT * FROM fv_result; + +DROP TABLE fv_test, fv_result; + +--echo # +--echo # MDEV-13649: Server crashes in set_field_to_null_with_conversions or in Field::set_notnull +--echo # + +CREATE TABLE t1 (a int); +INSERT INTO t1 VALUES (0),(1),(2); +SELECT LEAD(a) OVER (PARTITION BY a ORDER BY a) as lead, + a AND LEAD(a) OVER (PARTITION BY a ORDER BY a) AS a_and_lead_part +FROM t1; + +SELECT a OR LEAD(a) OVER (ORDER BY a) AS a_or_lead_order +FROM t1 +ORDER BY a; + +SELECT a AND LEAD(a) OVER (ORDER BY a) AS a_and_lead_order +FROM t1 +ORDER BY a; + +SELECT a XOR LEAD(a) OVER (ORDER BY a) AS a_xor_lead_order +FROM t1 +ORDER BY a; + +SELECT NOT LEAD(a) OVER (ORDER BY a) AS not_lead_order +FROM t1 +ORDER BY a; + +SELECT LEAD(a) OVER (ORDER BY a) is not null AS is_not_null_lead_order +FROM t1 +ORDER BY a; + +drop table t1; + +--echo # +--echo # MDEV-13354: Server crashes in find_field_in_tables upon PS with window function and subquery +--echo # + +CREATE TABLE t1 (i INT, a char); +INSERT INTO t1 VALUES (1, 'a'),(2, 'b'); +PREPARE stmt FROM "SELECT row_number() over (partition by i order by i), i FROM (SELECT * from t1) as sq"; +EXECUTE stmt; + +DROP TABLE t1; + +--echo # +--echo # MDEV-13384: "window" seems like a reserved column name but it's not listed as one +--echo # +--echo # Currently we allow window as an identifier, except for table aliases. +--echo # + +CREATE TABLE door (id INT, window VARCHAR(10)); + +--error ER_PARSE_ERROR +SELECT id +FROM door as window; + +SELECT id, window +FROM door; + +--error ER_PARSE_ERROR +SELECT id, window +FROM door as window; + +DROP TABLE door; + +--echo # +--echo # MDEV-13352: Server crashes in st_join_table::remove_duplicates +--echo # +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1),(2); +SELECT DISTINCT ROW_NUMBER() OVER(), i FROM t1 WHERE 0; +SELECT ROW_NUMBER() OVER(), i FROM t1 WHERE 0; +DROP TABLE t1; + +--echo # +--echo # MDEV-15853: Assertion `tab->filesort_result == 0' failed +--echo # + +CREATE TABLE t1 ( a1 int); +insert into t1 values (1),(2),(3); + +CREATE TABLE t2 (b1 int, a1 int, a2 int); +insert into t2 values (1,2,3),(2,3,4),(3,4,5); + +--sorted_result +SELECT COUNT(DISTINCT t2.a2), + rank() OVER (ORDER BY t2.b1) +FROM t2 ,t1 GROUP BY t2.b1 ORDER BY t1.a1; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-16990: server crashes in base_list_iterator::next +--echo # + +CREATE TABLE t1(i int); +insert into t1 values (1),(2); +SELECT DISTINCT row_number() OVER (), MAX(1) FROM t1; +SELECT DISTINCT BIT_AND(0) OVER (), MAX(1) FROM t1; +drop table t1; + +--echo # +--echo # MDEV-17525: Window functions not working in ONLY_FULL_GROUP_BY mode +--echo # + +CREATE TABLE t1 (name CHAR(10), test CHAR(10), score TINYINT); + +INSERT INTO t1 VALUES +('Chun', 'SQL', 75), ('Chun', 'Tuning', 73), +('Esben', 'SQL', 43), ('Esben', 'Tuning', 31), +('Kaolin', 'SQL', 56), ('Kaolin', 'Tuning', 88), +('Tatiana', 'SQL', 87), ('Tatiana', 'Tuning', 83); + +SET @save_sql_mode= @@sql_mode; +SET sql_mode = 'ONLY_FULL_GROUP_BY'; + +SELECT name, test, score, + AVG(score) OVER (PARTITION BY test) AS average_by_test +FROM t1 +ORDER BY test, name; + +set @@sql_mode= @save_sql_mode; +SELECT name, test, score, + AVG(score) OVER (PARTITION BY test) AS average_by_test +FROM t1 +ORDER BY test, name; +drop table t1; + +--echo # +--echo # MDEV-12575: Server crash in AGGR_OP::put_record or in JOIN_CACHE::free +--echo # or Invalid write in JOIN::make_aggr_tables_info +--echo # + +SELECT DISTINCT BIT_OR(100) OVER () FROM dual +GROUP BY LEFT('2018-08-24', 100) order by 1+2; + +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1),(2); + +SELECT * FROM ( + SELECT + ROW_NUMBER() OVER(), i, sum(i) + FROM t1 + WHERE 1=0 + limit 0 +) AS sq; + +SELECT * FROM ( + SELECT + ROW_NUMBER() OVER(), i, sum(i) + FROM t1 + WHERE 1=0 + GROUP BY i +) AS sq; +drop table t1; + +create table t1 (a int); +explain +select distinct 1, row_number() over (order by 1) from t1 where a=0 group by a with rollup; +select distinct 1, row_number() over (order by 1) from t1 where a=0 group by a with rollup; +drop table t1; + +explain +SELECT DISTINCT BIT_OR(100) OVER () FROM dual +GROUP BY LEFT('2018-08-24', 100) WITH ROLLUP +HAVING @A := 'qwerty'; +SELECT DISTINCT BIT_OR(100) OVER () FROM dual +GROUP BY LEFT('2018-08-24', 100) WITH ROLLUP +HAVING @A := 'qwerty'; + +explain +SELECT DISTINCT BIT_OR(100) OVER () FROM dual +GROUP BY LEFT('2018-08-24', 100) +HAVING @A := 'qwerty'; +SELECT DISTINCT BIT_OR(100) OVER () FROM dual +GROUP BY LEFT('2018-08-24', 100) +HAVING @A := 'qwerty'; + +create table t1 (a int); +explain +SELECT DISTINCT BIT_OR(100) OVER () FROM t1 +GROUP BY LEFT('2018-08-24', 100) having 1=1 limit 0; +drop table t1; + +--echo # +--echo # MDEV-13170: Database service (MySQL) stops after update with trigger +--echo # + +CREATE TABLE t1 ( t1_id int, point_id int, ml_id int, UNIQUE KEY t1_ml_u (ml_id,point_id)) ; +INSERT INTO t1 VALUES (1,1,8884),(2,1,8885); + +CREATE TABLE t2 ( db_time datetime, au_nr int, col_id int, new_val int); +CREATE TABLE t3 (id1 int, id2 int, d1 int); + +delimiter //; + +CREATE TRIGGER t1_aurtrg AFTER UPDATE ON t1 FOR EACH ROW begin +CREATE OR REPLACE TEMPORARY TABLE trg_u AS +WITH l AS + (SELECT a.*, + Max(t2.col_id) over (PARTITION BY a.d1), + Max(t2.new_val) over (PARTITION BY a.d1) + FROM + (SELECT d1 , id1, id2 FROM t3) a + JOIN t2 ON (a.d1=t2.db_time AND a.id1=t2.au_nr)) +SELECT 1; + + END;// + + delimiter ;// +--error 1062 +update t1 set ml_id=8884 where point_id=1; +--error 1062 +update t1 set ml_id=8884 where point_id=1; +drop table t1, t2,t3; + +CREATE TABLE t1 (i INT, a char); +INSERT INTO t1 VALUES (1, 'a'),(2, 'b'); +create view v1 as select * from t1; +PREPARE stmt FROM "SELECT i, row_number() over (partition by i order by i) FROM v1"; +execute stmt; +deallocate prepare stmt; +drop table t1; +drop view v1; + +--echo # +--echo # MDEV-17676: Assertion `inited==NONE || (inited==RND && scan)' failed in handler::ha_rnd_init +--echo # + +CREATE TABLE t1 (b1 text NOT NULL); +INSERT INTO t1 VALUES ('2'),('1'); +EXPLAIN +SELECT DISTINCT MIN(b1) OVER () FROM t1; +SELECT DISTINCT MIN(b1) OVER () FROM t1; +drop table t1; + +--echo # +--echo # MDEV-15424: Unreasonal SQL Error (1356) on select from view +--echo # + +create table t1 (id int, n1 int); +insert into t1 values (1,1), (2,1), (3,2), (4,4); + +create view v1 as SELECT ifnull(max(n1) over (partition by n1),'aaa') FROM t1; +explain select * from v1; +select * from v1; +drop table t1; +drop view v1; + +--echo # +--echo # MDEV-18431: Select max + row_number giving incorrect result +--echo # + +create table t1 (id int, v int); +insert into t1 values (1, 1), (1,2), (1,3), (2, 1), (2, 2); + +select e.id, + (select max(t1.v) from t1 where t1.id=e.id) as a, + row_number() over (partition by e.id order by e.v) as b, + (select max(t1.v) from t1 where t1.id=e.id) + (row_number() over (partition by e.id order by e.v)) as sum_a_b +from t1 e; +drop table t1; + +--echo # +--echo # MDEV-15837: Assertion `item1->type() == Item::FIELD_ITEM && item2->type() == Item::FIELD_ITEM' +--echo # failed in compare_order_elements function +--echo # + +CREATE TABLE t1 (a1 int); +insert into t1 values (1),(2),(3); +SELECT rank() OVER (ORDER BY 1), ROW_NUMBER() OVER (ORDER BY (EXPORT_SET(5,'Y','N',',',4))) FROM t1; +drop table t1; + ++--echo # ++--echo # MDEV-17781: Server crashes in next_linear_tab ++--echo # ++ ++CREATE TABLE t1 (i1 int); ++explain ++(SELECT AVG(0) OVER (), MAX('2') FROM t1) ++UNION ALL ++(SELECT AVG(0) OVER (), MAX('2') FROM t1); ++(SELECT AVG(0) OVER (), MAX('2') FROM t1) ++UNION ALL ++(SELECT AVG(0) OVER (), MAX('2') FROM t1); ++drop table t1; ++ ++--echo # ++--echo # MDEV-14791: Crash with order by expression containing window functions ++--echo # ++ ++CREATE TABLE t1 (b1 int, b2 int); ++INSERT INTO t1 VALUES (1,1),(0,0); ++ ++explain ++SELECT b1 from t1 order by row_number() over (ORDER BY b2) + 1; ++ ++SELECT b1 from t1 order by row_number() over (ORDER BY b2) + 1; ++ ++explain ++SELECT b1 from t1 order by row_number() over (ORDER BY b2); ++ ++SELECT b1 from t1 order by row_number() over (ORDER BY b2); ++DROP TABLE t1; ++ ++CREATE TABLE t1 (a int, b int, c int); ++INSERT INTO t1 VALUES (2,3,207), (1,21,909), (7,13,312), (8,64,248); ++ ++explain ++SELECT * FROM t1 ORDER BY max(t1.a) over (partition by c); ++SELECT * FROM t1 ORDER BY max(t1.a) over (partition by c); ++ ++explain ++SELECT max(t1.a) over (partition by c) as x, b, c from t1 order by max(t1.a) over (partition by c); ++SELECT max(t1.a) over (partition by c) as x, b, c from t1 order by max(t1.a) over (partition by c); ++ ++drop table t1; ++ ++--echo # ++--echo # MDEV-18373: DENSE_RANK is not calculated correctly ++--echo # ++ ++create table t1 (a int, b int); ++insert into t1 values (60, 1515),(60, 2000),(70, 2000),(55, 1600); ++ ++select b, dense_rank() over (order by sum(a)) from t1 group by b; ++select b, dense_rank() over (order by sum(a)+1) from t1 group by b; ++ ++select b, row_number() over (partition by sum(a)) from t1 group by b; ++select b, row_number() over (partition by sum(a)+1) from t1 group by b; ++ ++drop table t1; ++ +--echo # +--echo # End of 10.2 tests +--echo # + +--echo # +--echo # MDEV-16489 when lead() returns null on a datetime field, the result is treated as the literal string '[NULL]' +--echo # + +CREATE TABLE t1 (d datetime); +INSERT INTO t1 VALUES ('2018-01-01 00:00:00'),('2018-02-01 00:00:00'); +SELECT *, LEAD(d) OVER (ORDER BY d) AS x FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (d time); +INSERT INTO t1 VALUES ('00:00:01'),('00:00:02'); +SELECT *, LEAD(d) OVER (ORDER BY d) AS x FROM t1; +DROP TABLE t1; + +--echo # +--echo # End of 10.3 tests +--echo # diff --cc mysql-test/suite.pm index 1c99e1ed645,fe68295340c..76bfab714df --- a/mysql-test/suite.pm +++ b/mysql-test/suite.pm @@@ -70,6 -79,10 +70,10 @@@ sub skip_combinations unless $::mysqld_variables{'version-ssl-library'} =~ /OpenSSL (\S+)/ and $1 ge "1.0.2"; - $skip{'t/ssl_verify_ip.test'} = 'x509v3 support required' ++ $skip{'main/ssl_verify_ip.test'} = 'x509v3 support required' + unless $::mysqld_variables{'version-ssl-library'} =~ /OpenSSL (\S+)/ + and $1 ge "1.0.2"; + %skip; } diff --cc mysql-test/suite/compat/oracle/r/events.result index 7b4ad5679eb,00000000000..ef9c50115ae mode 100644,000000..100644 --- a/mysql-test/suite/compat/oracle/r/events.result +++ b/mysql-test/suite/compat/oracle/r/events.result @@@ -1,16 -1,0 +1,18 @@@ +set sql_mode='ORACLE'; +# +# MDEV-16891 EVENTs created with SQL_MODE=ORACLE fail to execute +# +SET GLOBAL event_scheduler=off; +SET sql_mode='ORACLE'; +CREATE TABLE t1 (a TIMESTAMP); +CREATE EVENT e1 +ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 MICROSECOND +DO INSERT INTO t1 VALUES(NOW()); ++Warnings: ++Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. +SET GLOBAL event_scheduler=on; +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +DROP TABLE t1; +SET GLOBAL event_scheduler=off; diff --cc mysql-test/suite/funcs_1/r/is_routines_embedded.result index 1739a0c15c8,193265433aa..ec68057eaa1 --- a/mysql-test/suite/funcs_1/r/is_routines_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_routines_embedded.result @@@ -197,8 -197,12 +197,12 @@@ sp_6_408002_2 def db_datadict_2 sp_6_40 SELECT * FROM db_datadict_2.res_6_408002_2; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci add_suppression def mtr add_suppression PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN INSERT INTO test_suppressions (pattern) VALUES (pattern); FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci -check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp', 'innodb_file_format_max') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema'); SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT( table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.host, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.user; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci -check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci +check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDE R BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.host, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zon e, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.user; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci +check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci + AddGeometryColumn def mysql AddGeometryColumn PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL begin + set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' ADD ', geometry_column,' GEOMETRY REF_SYSTEM_ID=', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end NULL NULL SQL NO CONTAINS SQL NULL INVOKER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci + DropGeometryColumn def mysql DropGeometryColumn PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL begin + set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' DROP ', geometry_column); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end NULL NULL SQL NO CONTAINS SQL NULL INVOKER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci connect testuser2, localhost, testuser2, , db_datadict; SELECT * FROM information_schema.routines; SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@@ -209,8 -213,12 +213,12 @@@ sp_6_408002_2 def db_datadict_2 sp_6_40 SELECT * FROM db_datadict_2.res_6_408002_2; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci add_suppression def mtr add_suppression PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN INSERT INTO test_suppressions (pattern) VALUES (pattern); FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci -check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp', 'innodb_file_format_max') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema'); SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT( table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.host, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.user; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci -check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci +check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDE R BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.host, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zon e, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.user; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci +check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci + AddGeometryColumn def mysql AddGeometryColumn PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL begin + set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' ADD ', geometry_column,' GEOMETRY REF_SYSTEM_ID=', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end NULL NULL SQL NO CONTAINS SQL NULL INVOKER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci + DropGeometryColumn def mysql DropGeometryColumn PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL begin + set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' DROP ', geometry_column); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end NULL NULL SQL NO CONTAINS SQL NULL INVOKER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci connect testuser3, localhost, testuser3, , test; SELECT * FROM information_schema.routines; SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@@ -221,8 -229,12 +229,12 @@@ sp_6_408002_2 def db_datadict_2 sp_6_40 SELECT * FROM db_datadict_2.res_6_408002_2; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci add_suppression def mtr add_suppression PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN INSERT INTO test_suppressions (pattern) VALUES (pattern); FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci -check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp', 'innodb_file_format_max') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema'); SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT( table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.host, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.user; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci -check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci +check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDE R BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.host, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zon e, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.user; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci +check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci + AddGeometryColumn def mysql AddGeometryColumn PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL begin + set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' ADD ', geometry_column,' GEOMETRY REF_SYSTEM_ID=', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end NULL NULL SQL NO CONTAINS SQL NULL INVOKER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci + DropGeometryColumn def mysql DropGeometryColumn PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL begin + set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' DROP ', geometry_column); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end NULL NULL SQL NO CONTAINS SQL NULL INVOKER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci connection default; disconnect testuser1; disconnect testuser2; diff --cc mysql-test/suite/rpl/r/rpl_events.result index 4b2226109d9,e51bc982110..a84bc6b67f5 --- a/mysql-test/suite/rpl/r/rpl_events.result +++ b/mysql-test/suite/rpl/r/rpl_events.result @@@ -29,8 -31,10 +29,10 @@@ db name status originato test justonce SLAVESIDE_DISABLED 1 "Dropping event test.slave_once on the slave" DROP EVENT IF EXISTS test.slave_once; -CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO +CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once'); + Warnings: + Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. "Checking event status on the slave for originator value = slave's server_id" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once'; db name status originator @@@ -76,8 -80,10 +78,10 @@@ connection slave SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; db name status originator "Creating event test.slave_terminate on the slave" -CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO +CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate'); + Warnings: + Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. "Checking event status on the slave" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; db name status originator @@@ -85,8 -91,10 +89,10 @@@ test slave_terminate ENABLED "Dropping event test.slave_terminate on the slave" DROP EVENT test.slave_terminate; "Creating event test.slave_terminate with DISABLE ON SLAVE on the slave" -CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DISABLE ON SLAVE DO +CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DISABLE ON SLAVE DO INSERT IGNORE INTO t1(c) VALUES (7, 'from slave_terminate'); + Warnings: + Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. "Checking event status on the slave" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; db name status originator diff --cc mysys/tree.c index b07d56ec942,433bb809a85..87297bb434e --- a/mysys/tree.c +++ b/mysys/tree.c @@@ -203,25 -175,14 +201,25 @@@ int reset_tree(TREE* tree } -static void delete_tree_element(TREE *tree, TREE_ELEMENT *element) +static int delete_tree_element(TREE *tree, TREE_ELEMENT *element, + my_bool abort) { + int error, first_error= 0; - if (element != &tree->null_element) + if (element != &null_element) { - delete_tree_element(tree,element->left); - if (tree->free) - (*tree->free)(ELEMENT_KEY(tree,element), free_free, tree->custom_arg); - delete_tree_element(tree,element->right); + if ((first_error= delete_tree_element(tree, element->left, abort))) + abort= 1; + if (!abort && tree->free) + { + if ((error= (*tree->free)(ELEMENT_KEY(tree,element), free_free, + tree->custom_arg))) + { + first_error= first_error ? first_error : error; + abort= 1; + } + } + if ((error= delete_tree_element(tree, element->right, abort))) + first_error= first_error ? first_error : error; if (tree->with_delete) my_free(element); } diff --cc scripts/mysql_install_db.sh index 52107405525,2c132cccf2a..92e6ed20cff --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@@ -487,27 -488,6 +487,28 @@@ mysqld_install_cmd_line( --net_buffer_length=16K } +cat_sql() +{ ++ echo "create database if not exists mysql;" + echo "use mysql;" + + case "$auth_root_authentication_method" in + normal) + echo "SET @skip_auth_root_nopasswd=NULL;" + echo "SET @auth_root_socket=NULL;" + ;; + socket) + echo "SET @skip_auth_root_nopasswd=1;" + echo "SET @auth_root_socket='$auth_root_socket_user';" + ;; + esac + + cat "$create_system_tables" "$create_system_tables2" "$fill_system_tables" "$fill_help_tables" "$maria_add_gis_sp" + if test "$skip_test_db" -eq 0 + then + cat "$mysql_test_db" + fi +} # Create the system and help tables by passing them to "mysqld --bootstrap" s_echo "Installing MariaDB/MySQL system tables in '$ldata' ..." diff --cc sql/ha_partition.cc index 6371c330170,c280bc13e0a..2646a2a1225 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@@ -10055,39 -7768,58 +10055,44 @@@ bool ha_partition::prepare_inplace_alte } -/** - Number of rows in table. see handler.h - - @return Number of records in the table (after pruning!) -*/ - -ha_rows ha_partition::records() +bool ha_partition::inplace_alter_table(TABLE *altered_table, + Alter_inplace_info *ha_alter_info) { - ha_rows rows, tot_rows= 0; - uint i; - DBUG_ENTER("ha_partition::records"); + uint index= 0; + bool error= false; + ha_partition_inplace_ctx *part_inplace_ctx; - for (i= bitmap_get_first_set(&m_part_info->read_partitions); - i < m_tot_parts; - i= bitmap_get_next_set(&m_part_info->read_partitions, i)) + DBUG_ENTER("ha_partition::inplace_alter_table"); + + /* + Changing to similar partitioning, only update metadata. + Non allowed changes would be catched in prep_alter_part_table(). + */ + if (ha_alter_info->alter_info->partition_flags == ALTER_PARTITION_INFO) { - rows= m_file[i]->records(); - if (rows == HA_POS_ERROR) - DBUG_RETURN(HA_POS_ERROR); - tot_rows+= rows; + DBUG_ASSERT(ha_alter_info->alter_info->flags == 0); + DBUG_RETURN(false); } - DBUG_RETURN(tot_rows); -} - - -/* - Is it ok to switch to a new engine for this table - SYNOPSIS - can_switch_engine() + part_inplace_ctx= + static_cast<class ha_partition_inplace_ctx*>(ha_alter_info->handler_ctx); - RETURN VALUE - TRUE Ok - FALSE Not ok + for (index= 0; index < m_tot_parts && !error; index++) + { - ha_alter_info->handler_ctx= part_inplace_ctx->handler_ctx_array[index]; ++ if ((ha_alter_info->handler_ctx= ++ part_inplace_ctx->handler_ctx_array[index]) != NULL ++ && index != 0) ++ ha_alter_info->handler_ctx->set_shared_data ++ (*part_inplace_ctx->handler_ctx_array[index - 1]); + - DESCRIPTION - Used to ensure that tables with foreign key constraints are not moved - to engines without foreign key support. -*/ + if (m_file[index]->ha_inplace_alter_table(altered_table, + ha_alter_info)) + error= true; + part_inplace_ctx->handler_ctx_array[index]= ha_alter_info->handler_ctx; + } + ha_alter_info->handler_ctx= part_inplace_ctx; -bool ha_partition::can_switch_engines() -{ - handler **file; - DBUG_ENTER("ha_partition::can_switch_engines"); - - file= m_file; - do - { - if (!(*file)->can_switch_engines()) - DBUG_RETURN(FALSE); - } while (*(++file)); - DBUG_RETURN(TRUE); + DBUG_RETURN(error); } diff --cc sql/item_func.h index 80d90ae21c5,7592fc9b779..61491b34cf8 --- a/sql/item_func.h +++ b/sql/item_func.h @@@ -2464,8 -1990,9 +2464,9 @@@ public bool register_field_in_bitmap(void *arg); bool set_entry(THD *thd, bool create_if_not_exists); void cleanup(); - Item *get_copy(THD *thd, MEM_ROOT *mem_root) - { return get_item_copy<Item_func_set_user_var>(thd, mem_root, this); } + Item *get_copy(THD *thd) + { return get_item_copy<Item_func_set_user_var>(thd, this); } + bool excl_dep_on_table(table_map tab_map) { return false; } }; diff --cc sql/item_sum.cc index ce0c9d3e944,b1b22d0877f..e27b61e9d22 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@@ -3843,12 -3443,11 +3844,15 @@@ void Item_func_group_concat::clear( null_value= TRUE; warning_for_row= FALSE; no_appended= TRUE; + if (offset_limit) + copy_offset_limit= offset_limit->val_int(); + if (row_limit) + copy_row_limit= row_limit->val_int(); if (tree) + { reset_tree(tree); + tree_len= 0; + } if (unique_filter) unique_filter->reset(); if (table && table->blob_storage) @@@ -3856,6 -3455,62 +3860,62 @@@ /* No need to reset the table as we never call write_row */ } + struct st_repack_tree { + TREE tree; + TABLE *table; + size_t len, maxlen; + }; + + extern "C" + int copy_to_tree(void* key, element_count count __attribute__((unused)), + void* arg) + { + struct st_repack_tree *st= (struct st_repack_tree*)arg; + TABLE *table= st->table; + Field* field= table->field[0]; + const uchar *ptr= field->ptr_in_record((uchar*)key - table->s->null_bytes); + size_t len= (size_t)field->val_int(ptr); + + DBUG_ASSERT(count == 1); + if (!tree_insert(&st->tree, key, 0, st->tree.custom_arg)) + return 1; + + st->len += len; + return st->len > st->maxlen; + } + + bool Item_func_group_concat::repack_tree(THD *thd) + { + struct st_repack_tree st; + + init_tree(&st.tree, (size_t) MY_MIN(thd->variables.max_heap_table_size, + thd->variables.sortbuff_size/16), 0, + tree->size_of_element, group_concat_key_cmp_with_order, NULL, + (void*) this, MYF(MY_THREAD_SPECIFIC)); + st.table= table; + st.len= 0; + st.maxlen= (size_t)thd->variables.group_concat_max_len; + tree_walk(tree, ©_to_tree, &st, left_root_right); + if (st.len <= st.maxlen) // Copying aborted. Must be OOM + { - delete_tree(&st.tree); ++ delete_tree(&st.tree, 0); + return 1; + } - delete_tree(tree); ++ delete_tree(tree, 0); + *tree= st.tree; + tree_len= st.len; + return 0; + } + + /* + Repacking the tree is expensive. But it keeps the tree small, and + inserting into an unnecessary large tree is also waste of time. + + The following number is best-by-test. Test execution time slowly + decreases up to N=10 (that is, factor=1024) and then starts to increase, + again, very slowly. + */ + #define GCONCAT_REPACK_FACTOR (1 << 10) bool Item_func_group_concat::add() { diff --cc sql/item_sum.h index b400ebd5f80,c1373f6c1fc..7152916498c --- a/sql/item_sum.h +++ b/sql/item_sum.h @@@ -1796,6 -1630,11 +1797,9 @@@ class Item_func_group_concat : public I friend int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)), void* item_arg); -protected: - Field *make_string_field(TABLE *table); + + bool repack_tree(THD *thd); + public: Item_func_group_concat(THD *thd, Name_resolution_context *context_arg, bool is_distinct, List<Item> *is_select, @@@ -1852,11 -1689,11 +1856,11 @@@ String* val_str(String* str); Item *copy_or_same(THD* thd); void no_rows_in_result() {} - virtual void print(String *str, enum_query_type query_type); - virtual bool change_context_processor(void *cntx) + void print(String *str, enum_query_type query_type); + bool change_context_processor(void *cntx) { context= (Name_resolution_context *)cntx; return FALSE; } - Item *get_copy(THD *thd, MEM_ROOT *mem_root) - { return get_item_copy<Item_func_group_concat>(thd, mem_root, this); } + Item *get_copy(THD *thd) + { return get_item_copy<Item_func_group_concat>(thd, this); } }; #endif /* ITEM_SUM_INCLUDED */ diff --cc sql/log_event.cc index 52556cddd12,8aea32004c3..fa42e7b0a07 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@@ -11301,9 -10806,8 +11308,8 @@@ int Rows_log_event::do_apply_event(rpl_ lex->query_tables_last= &tables->next_global; } } - if (open_and_lock_tables(thd, rgi->tables_to_lock, FALSE, 0)) + if (unlikely(open_and_lock_tables(thd, rgi->tables_to_lock, FALSE, 0))) { - uint actual_error= thd->get_stmt_da()->sql_errno(); #ifdef WITH_WSREP if (WSREP(thd)) { diff --cc sql/log_event_old.cc index b5381ec6d74,098672947b3..f56bc86127d --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@@ -99,10 -99,9 +99,9 @@@ Old_rows_log_event::do_apply_event(Old_ */ ev_thd->lex->set_stmt_row_injection(); - if (open_and_lock_tables(ev_thd, rgi->tables_to_lock, FALSE, 0)) + if (unlikely(open_and_lock_tables(ev_thd, rgi->tables_to_lock, FALSE, 0))) { - uint actual_error= ev_thd->get_stmt_da()->sql_errno(); - if (ev_thd->is_slave_error || ev_thd->is_fatal_error) + if (ev_thd->is_error()) { /* Error reporting borrowed from Query_log_event with many excessive diff --cc sql/mysql_upgrade_service.cc index 9ea78accf44,ef01afe899d..94ca10766d8 --- a/sql/mysql_upgrade_service.cc +++ b/sql/mysql_upgrade_service.cc @@@ -159,8 -148,9 +159,9 @@@ static void die(const char *fmt, ... #define WRITE_LOG(fmt,...) {\ char log_buf[1024]; \ + DWORD nbytes; \ snprintf(log_buf,sizeof(log_buf), fmt, __VA_ARGS__);\ - WriteFile(logfile_handle,log_buf, (DWORD)strlen(log_buf), 0 , 0);\ - WriteFile(logfile_handle,log_buf, strlen(log_buf), &nbytes , 0);\ ++ WriteFile(logfile_handle,log_buf, (DWORD)strlen(log_buf), &nbytes , 0);\ } /* diff --cc sql/sp_head.cc index 924fd04007e,c473aec51a1..747bf92dbf9 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@@ -1496,11 -1455,9 +1496,11 @@@ sp_head::execute(THD *thd, bool merge_d NULL. In this case, mysql_change_db() would generate an error. */ - err_status|= mysql_change_db(thd, (LEX_CSTRING*) &saved_cur_db_name, TRUE); - err_status|= mysql_change_db(thd, &saved_cur_db_name, TRUE); ++ err_status|= mysql_change_db(thd, (LEX_CSTRING*)&saved_cur_db_name, TRUE) != 0; } m_flags&= ~IS_INVOKED; + if (m_parent) + m_parent->m_invoked_subroutine_count--; DBUG_PRINT("info", ("first free for %p --: %p->%p, level: %lu, flags %x", m_first_instance, diff --cc sql/sql_base.cc index ddb8fee6f70,cb817e83fd7..73817ddb722 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@@ -3362,6 -3257,45 +3362,47 @@@ open_and_process_routine(THD *thd, Quer DBUG_RETURN(FALSE); } + /* + If we are not already in prelocked mode and extended table list is not + yet built we might have to build the prelocking set for this statement. + + Since currently no prelocking strategy prescribes doing anything for + tables which are only read, we do below checks only if table is going + to be changed. + */ + bool extend_table_list(THD *thd, TABLE_LIST *tables, + Prelocking_strategy *prelocking_strategy, + bool has_prelocking_list) + { + bool error= false; + LEX *lex= thd->lex; ++ bool maybe_need_prelocking= ++ (tables->updating && tables->lock_type >= TL_WRITE_ALLOW_WRITE) ++ || thd->lex->default_used; + + if (thd->locked_tables_mode <= LTM_LOCK_TABLES && - ! has_prelocking_list && tables->updating && - tables->lock_type >= TL_WRITE_ALLOW_WRITE) ++ ! has_prelocking_list && maybe_need_prelocking) + { + bool need_prelocking= FALSE; + TABLE_LIST **save_query_tables_last= lex->query_tables_last; + /* + Extend statement's table list and the prelocking set with + tables and routines according to the current prelocking + strategy. + + For example, for DML statements we need to add tables and routines + used by triggers which are going to be invoked for this element of + table list and also add tables required for handling of foreign keys. + */ + error= prelocking_strategy->handle_table(thd, lex, tables, + &need_prelocking); + + if (need_prelocking && ! lex->requires_prelocking()) + lex->mark_as_requiring_prelocking(save_query_tables_last); + } + return error; + } + /** Handle table list element by obtaining metadata lock, opening table or view @@@ -3670,38 -3601,9 +3710,9 @@@ open_and_process_table(THD *thd, TABLE_ if (tables->open_strategy && !tables->table) goto end; - /* - If we are not already in prelocked mode and extended table list is not - yet built we might have to build the prelocking set for this statement. - - Since currently no prelocking strategy prescribes doing anything for - tables which are only read, we do below checks only if table is going - to be changed. - */ - if (thd->locked_tables_mode <= LTM_LOCK_TABLES && - ! has_prelocking_list && - (tables->lock_type >= TL_WRITE_ALLOW_WRITE || thd->lex->default_used)) - { - bool need_prelocking= FALSE; - TABLE_LIST **save_query_tables_last= lex->query_tables_last; - /* - Extend statement's table list and the prelocking set with - tables and routines according to the current prelocking - strategy. - - For example, for DML statements we need to add tables and routines - used by triggers which are going to be invoked for this element of - table list and also add tables required for handling of foreign keys. - */ - error= prelocking_strategy->handle_table(thd, lex, tables, - &need_prelocking); - - if (need_prelocking && ! lex->requires_prelocking()) - lex->mark_as_requiring_prelocking(save_query_tables_last); - - if (unlikely(error)) - goto end; - } + error= extend_table_list(thd, tables, prelocking_strategy, has_prelocking_list); - if (error) ++ if (unlikely(error)) + goto end; /* Copy grant information from TABLE_LIST instance to TABLE one. */ tables->table->grant= tables->grant; @@@ -4139,11 -4041,11 +4152,11 @@@ restart for (tables= *table_to_open; tables; table_to_open= &tables->next_global, tables= tables->next_global) { - error= open_and_process_table(thd, thd->lex, tables, counter, - flags, prelocking_strategy, - has_prelocking_list, &ot_ctx); + error= open_and_process_table(thd, tables, counter, flags, + prelocking_strategy, has_prelocking_list, + &ot_ctx); - if (error) + if (unlikely(error)) { if (ot_ctx.can_recover_from_failed_open()) { @@@ -8688,12 -8402,11 +8701,11 @@@ my_bool mysql_rm_tmp_tables(void { file=dirp->dir_entry+idx; - if (!memcmp(file->name, tmp_file_prefix, - tmp_file_prefix_length)) + if (!strncmp(file->name, tmp_file_prefix, tmp_file_prefix_length)) { char *ext= fn_ext(file->name); - uint ext_len= strlen(ext); - uint filePath_len= my_snprintf(filePath, sizeof(filePath), + size_t ext_len= strlen(ext); + size_t filePath_len= my_snprintf(filePath, sizeof(filePath), "%s%c%s", tmpdir, FN_LIBCHAR, file->name); if (!strcmp(reg_ext, ext)) diff --cc sql/sql_class.h index 221e453eab5,9c968abf25c..2a949856879 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@@ -37,7 -38,7 +37,8 @@@ #include "thr_lock.h" /* thr_lock_type, THR_LOCK_DATA, THR_LOCK_INFO */ #include "thr_timer.h" #include "thr_malloc.h" +#include "log_slow.h" /* LOG_SLOW_DISABLE_... */ + #include <my_tree.h> #include "sql_digest_stream.h" // sql_digest_state diff --cc sql/sql_db.cc index cce0bdadedb,ebc04decbb3..957b676f81f --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@@ -1441,15 -1459,14 +1441,15 @@@ static void backup_current_db_name(THD a stack pointer set by Stored Procedures was used by replication after the stack address was long gone. - @return Operation status - @retval FALSE Success - @retval TRUE Error + @return error code (ER_XXX) + @retval 0 Success + @retval >0 Error */ - bool mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name, -uint mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch) ++uint mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name, + bool force_switch) { - LEX_STRING new_db_file_name; + LEX_CSTRING new_db_file_name; Security_context *sctx= thd->security_ctx; ulong db_access= sctx->db_access; @@@ -1552,8 -1568,8 +1552,8 @@@ new_db_file_name.str); general_log_print(thd, COM_INIT_DB, ER_THD(thd, ER_DBACCESS_DENIED_ERROR), sctx->priv_user, sctx->priv_host, new_db_file_name.str); - my_free(new_db_file_name.str); + my_free(const_cast<char*>(new_db_file_name.str)); - DBUG_RETURN(TRUE); + DBUG_RETURN(ER_DBACCESS_DENIED_ERROR); } #endif @@@ -1851,7 -1866,7 +1851,7 @@@ bool mysql_upgrade_db(THD *thd, const L /* Step9: Let's do "use newdb" if we renamed the current database */ if (change_to_newdb) -- error|= mysql_change_db(thd, & new_db, FALSE); ++ error|= mysql_change_db(thd, & new_db, FALSE) != 0; exit: DBUG_RETURN(error); diff --cc sql/sql_db.h index c0646bd65f0,b778e42645a..7eee86fa7c8 --- a/sql/sql_db.h +++ b/sql/sql_db.h @@@ -20,13 -20,13 +20,13 @@@ class THD; -int mysql_create_db(THD *thd, char *db, DDL_options_st options, +int mysql_create_db(THD *thd, const LEX_CSTRING *db, DDL_options_st options, const Schema_specification_st *create); -bool mysql_alter_db(THD *thd, const char *db, +bool mysql_alter_db(THD *thd, const LEX_CSTRING *db, const Schema_specification_st *create); -bool mysql_rm_db(THD *thd, char *db, bool if_exists); -bool mysql_upgrade_db(THD *thd, LEX_STRING *old_db); -uint mysql_change_db(THD *thd, const LEX_STRING *new_db_name, +bool mysql_rm_db(THD *thd, const LEX_CSTRING *db, bool if_exists); +bool mysql_upgrade_db(THD *thd, const LEX_CSTRING *old_db); - bool mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name, ++uint mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name, bool force_switch); bool mysql_opt_change_db(THD *thd, diff --cc sql/sql_parse.cc index ab649f23160,4a4fc91296a..7a74f322dc1 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@@ -4601,7 -4307,16 +4598,17 @@@ end_with_restore_list else res= 0; + unit->set_limit(select_lex); + /* + We can not use mysql_explain_union() because of parameters of + mysql_select in mysql_multi_update so just set the option if needed + */ + if (thd->lex->describe) + { + select_lex->set_explain_type(FALSE); + select_lex->options|= SELECT_DESCRIBE; + } + res= mysql_multi_update_prepare(thd); #ifdef HAVE_REPLICATION diff --cc sql/sql_show.cc index fe8ed5076a8,56103d8b654..8ec5435fd45 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@@ -8516,11 -8097,10 +8516,10 @@@ int mysql_schema_table(THD *thd, LEX *l views working correctly */ - if (table_list->schema_table_name) + if (table_list->schema_table_name.str) table->alias_name_used= my_strcasecmp(table_alias_charset, - table_list->schema_table_name, - table_list->alias); + table_list->schema_table_name.str, + table_list->alias.str); - table_list->table_name= table->s->table_name; table_list->table= table; table->next= thd->derived_tables; thd->derived_tables= table; diff --cc sql/sql_table.cc index cbea0c6cbfd,e2c44fa9af3..513b6a2e2f3 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@@ -8811,6 -8504,50 +8811,52 @@@ static bool fk_prepare_copy_alter_table } } + /* + Normally, an attempt to modify an FK parent table will cause + FK children to be prelocked, so the table-being-altered cannot + be modified by a cascade FK action, because ALTER holds a lock + and prelocking will wait. + + But if a new FK is being added by this very ALTER, then the target + table is not locked yet (it's a temporary table). So, we have to + lock FK parents explicitly. + */ - if (alter_info->flags & Alter_info::ADD_FOREIGN_KEY) ++ if (alter_info->flags & ALTER_ADD_FOREIGN_KEY) + { + List_iterator<Key> fk_list_it(alter_info->key_list); + + while (Key *key= fk_list_it++) + { + if (key->type != Key::FOREIGN_KEY) + continue; + + Foreign_key *fk= static_cast<Foreign_key*>(key); + char dbuf[NAME_LEN]; + char tbuf[NAME_LEN]; - const char *ref_db= fk->ref_db.str ? fk->ref_db.str : alter_ctx->new_db; ++ const char *ref_db= (fk->ref_db.str ? ++ fk->ref_db.str : ++ alter_ctx->new_db.str); + const char *ref_table= fk->ref_table.str; + MDL_request mdl_request; + + if (lower_case_table_names) + { + strmake_buf(dbuf, ref_db); + my_casedn_str(system_charset_info, dbuf); + strmake_buf(tbuf, ref_table); + my_casedn_str(system_charset_info, tbuf); + ref_db= dbuf; + ref_table= tbuf; + } + + mdl_request.init(MDL_key::TABLE, ref_db, ref_table, MDL_SHARED_NO_WRITE, + MDL_TRANSACTION); + if (thd->mdl_context.acquire_lock(&mdl_request, + thd->variables.lock_wait_timeout)) + DBUG_RETURN(true); + } + } + DBUG_RETURN(false); } diff --cc sql/sql_truncate.cc index bab9bb5e9ac,6252caf98b0..d87fe13b10e --- a/sql/sql_truncate.cc +++ b/sql/sql_truncate.cc @@@ -147,18 -150,14 +147,14 @@@ fk_truncate_illegal_if_parent(THD *thd /* Loop over the set of foreign keys for which this table is a parent. */ while ((fk_info= it++)) { - DBUG_ASSERT(!lex_string_cmp(system_charset_info, - fk_info->referenced_db, - &table->s->db)); - - DBUG_ASSERT(!lex_string_cmp(system_charset_info, - fk_info->referenced_table, - &table->s->table_name)); - - if (lex_string_cmp(system_charset_info, fk_info->foreign_db, - if (my_strcasecmp(system_charset_info, fk_info->referenced_db->str, - table->s->db.str) || - my_strcasecmp(system_charset_info, fk_info->referenced_table->str, - table->s->table_name.str) || - my_strcasecmp(system_charset_info, fk_info->foreign_db->str, - table->s->db.str) || - my_strcasecmp(system_charset_info, fk_info->foreign_table->str, - table->s->table_name.str)) ++ if (lex_string_cmp(system_charset_info, fk_info->referenced_db, ++ &table->s->db) || ++ lex_string_cmp(system_charset_info, fk_info->referenced_table, ++ &table->s->table_name) || ++ lex_string_cmp(system_charset_info, fk_info->foreign_db, + &table->s->db) || + lex_string_cmp(system_charset_info, fk_info->foreign_table, + &table->s->table_name)) break; } diff --cc sql/sql_view.cc index 50416940960,0684e6ebcc5..b85243dc134 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@@ -1550,10 -1538,9 +1550,11 @@@ bool mysql_make_view(THD *thd, TABLE_SH */ for (tbl= view_main_select_tables; tbl; tbl= tbl->next_local) { - tbl->lock_type= table->lock_type; + /* We have to keep the lock type for sequence tables */ + if (!tbl->sequence) + tbl->lock_type= table->lock_type; tbl->mdl_request.set_type(table->mdl_request.type); + tbl->updating= table->updating; } /* If the view is mergeable, we might want to diff --cc sql/sql_yacc.yy index 8910d7418fd,f45456e88d4..6414609f643 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@@ -9540,10 -8703,10 +9540,10 @@@ opt_select_lock_type { LEX *lex=Lex; lex->current_select->lock_type= TL_WRITE; - lex->current_select->set_lock_for_tables(TL_WRITE); + lex->current_select->set_lock_for_tables(TL_WRITE, false); lex->safe_to_cache_query=0; } - | LOCK_SYM IN_SYM SHARE_SYM MODE_SYM + | LOCK_SYM IN_SYM SHARE_SYM MODE_SYM opt_lock_wait_timeout { LEX *lex=Lex; lex->current_select->lock_type= TL_READ_WITH_SHARED_LOCKS; @@@ -13666,14 -12542,14 +13666,14 @@@ update opt_low_priority opt_ignore join_table_list SET update_list { - LEX *lex= Lex; - if (lex->select_lex.table_list.elements > 1) - lex->sql_command= SQLCOM_UPDATE_MULTI; - else if (unlikely(lex->select_lex.get_table_list()->derived)) + SELECT_LEX *slex= &Lex->select_lex; + if (slex->table_list.elements > 1) + Lex->sql_command= SQLCOM_UPDATE_MULTI; - else if (slex->get_table_list()->derived) ++ else if (unlikely(slex->get_table_list()->derived)) { /* it is single table update and it is update of derived table */ my_error(ER_NON_UPDATABLE_TABLE, MYF(0), - lex->select_lex.get_table_list()->alias.str, "UPDATE"); - slex->get_table_list()->alias, "UPDATE"); ++ slex->get_table_list()->alias.str, "UPDATE"); MYSQL_YYABORT; } /* @@@ -16691,14 -15565,16 +16691,17 @@@ table_lock table_ident opt_table_alias lock_option { thr_lock_type lock_type= (thr_lock_type) $3; - bool lock_for_write= lock_type >= TL_WRITE_ALLOW_WRITE; + bool lock_for_write= (lock_type >= TL_WRITE_ALLOW_WRITE); + ulong table_options= lock_for_write ? TL_OPTION_UPDATING : 0; + enum_mdl_type mdl_type= !lock_for_write + ? MDL_SHARED_READ + : lock_type == TL_WRITE_CONCURRENT_INSERT + ? MDL_SHARED_WRITE + : MDL_SHARED_NO_READ_WRITE; + - if (!Select->add_table_to_list(thd, $1, $2, table_options, - lock_type, mdl_type)) + if (unlikely(!Select-> - add_table_to_list(thd, $1, $2, 0, lock_type, - (lock_for_write ? - lock_type == TL_WRITE_CONCURRENT_INSERT ? - MDL_SHARED_WRITE : - MDL_SHARED_NO_READ_WRITE : - MDL_SHARED_READ)))) ++ add_table_to_list(thd, $1, $2, table_options, ++ lock_type, mdl_type))) MYSQL_YYABORT; } ; diff --cc sql/sql_yacc_ora.yy index 1c83462e6ac,00000000000..40315c05056 mode 100644,000000..100644 --- a/sql/sql_yacc_ora.yy +++ b/sql/sql_yacc_ora.yy @@@ -1,18214 -1,0 +1,18217 @@@ +/* + Copyright (c) 2000, 2015, Oracle and/or its affiliates. + Copyright (c) 2010, 2016, MariaDB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + +/* sql_yacc.yy */ + +/** + @defgroup Parser Parser + @{ +*/ + +%{ +#define YYLIP (& thd->m_parser_state->m_lip) +#define YYPS (& thd->m_parser_state->m_yacc) +#define YYCSCL (thd->variables.character_set_client) + +#define MYSQL_YACC +#define YYINITDEPTH 100 +#define YYMAXDEPTH 3200 /* Because of 64K stack */ +#define Lex (thd->lex) + +#define Select Lex->current_select +#include "mariadb.h" +#include "sql_priv.h" +#include "sql_parse.h" /* comp_*_creator */ +#include "sql_table.h" /* primary_key_name */ +#include "sql_partition.h" /* partition_info, HASH_PARTITION */ +#include "sql_acl.h" /* *_ACL */ +#include "sql_class.h" /* Key_part_spec, enum_filetype, Diag_condition_item_name */ +#include "slave.h" +#include "lex_symbol.h" +#include "item_create.h" +#include "sp_head.h" +#include "sp_rcontext.h" +#include "sp.h" +#include "sql_show.h" +#include "sql_alter.h" // Sql_cmd_alter_table* +#include "sql_truncate.h" // Sql_cmd_truncate_table +#include "sql_admin.h" // Sql_cmd_analyze/Check..._table +#include "sql_partition_admin.h" // Sql_cmd_alter_table_*_part. +#include "sql_handler.h" // Sql_cmd_handler_* +#include "sql_signal.h" +#include "sql_get_diagnostics.h" // Sql_cmd_get_diagnostics +#include "sql_cte.h" +#include "sql_window.h" +#include "item_windowfunc.h" +#include "event_parse_data.h" +#include "create_options.h" +#include <myisam.h> +#include <myisammrg.h> +#include "keycaches.h" +#include "set_var.h" +#include "rpl_mi.h" +#include "lex_token.h" +#include "sql_lex.h" +#include "sql_sequence.h" +#include "my_base.h" + +/* this is to get the bison compilation windows warnings out */ +#ifdef _MSC_VER +/* warning C4065: switch statement contains 'default' but no 'case' labels */ +#pragma warning (disable : 4065) +#endif + +int yylex(void *yylval, void *yythd); + +#define yyoverflow(A,B,C,D,E,F) \ + { \ + size_t val= *(F); \ + if (unlikely(my_yyoverflow((B), (D), &val))) \ + { \ + yyerror(thd, (char*) (A)); \ + return 2; \ + } \ + else \ + { \ + *(F)= (YYSIZE_T)val; \ + } \ + } + +#define MYSQL_YYABORT \ + do \ + { \ + LEX::cleanup_lex_after_parse_error(thd); \ + YYABORT; \ + } while (0) + +#define MYSQL_YYABORT_UNLESS(A) \ + if (unlikely(!(A))) \ + { \ + thd->parse_error(); \ + MYSQL_YYABORT; \ + } + +#define my_yyabort_error(A) \ + do { my_error A; MYSQL_YYABORT; } while(0) + +#ifndef DBUG_OFF +#define YYDEBUG 1 +#else +#define YYDEBUG 0 +#endif + + +/** + @brief Bison callback to report a syntax/OOM error + + This function is invoked by the bison-generated parser + when a syntax error, a parse error or an out-of-memory + condition occurs. This function is not invoked when the + parser is requested to abort by semantic action code + by means of YYABORT or YYACCEPT macros. This is why these + macros should not be used (use MYSQL_YYABORT/MYSQL_YYACCEPT + instead). + + The parser will abort immediately after invoking this callback. + + This function is not for use in semantic actions and is internal to + the parser, as it performs some pre-return cleanup. + In semantic actions, please use thd->parse_error() or my_error to + push an error into the error stack and MYSQL_YYABORT + to abort from the parser. +*/ + +void ORAerror(THD *thd, const char *s) +{ + /* + Restore the original LEX if it was replaced when parsing + a stored procedure. We must ensure that a parsing error + does not leave any side effects in the THD. + */ + LEX::cleanup_lex_after_parse_error(thd); + + /* "parse error" changed into "syntax error" between bison 1.75 and 1.875 */ + if (strcmp(s,"parse error") == 0 || strcmp(s,"syntax error") == 0) + s= ER_THD(thd, ER_SYNTAX_ERROR); + thd->parse_error(s, 0); +} + + + + +#define bincmp_collation(X,Y) \ + do \ + { \ + if (unlikely(Lex->set_bincmp(X,Y))) \ + MYSQL_YYABORT; \ + } while(0) + +%} +%union { + int num; + ulong ulong_num; + ulonglong ulonglong_number; + longlong longlong_number; + uint sp_instr_addr; + + /* structs */ + LEX_CSTRING lex_str; + Lex_ident_cli_st kwd; + Lex_ident_cli_st ident_cli; + Lex_ident_sys_st ident_sys; + Lex_string_with_metadata_st lex_string_with_metadata; + Lex_spblock_st spblock; + Lex_spblock_handlers_st spblock_handlers; + Lex_length_and_dec_st Lex_length_and_dec; + Lex_cast_type_st Lex_cast_type; + Lex_field_type_st Lex_field_type; + Lex_dyncol_type_st Lex_dyncol_type; + Lex_for_loop_st for_loop; + Lex_for_loop_bounds_st for_loop_bounds; + Lex_trim_st trim; + vers_history_point_t vers_history_point; + + /* pointers */ + Create_field *create_field; + Spvar_definition *spvar_definition; + Row_definition_list *spvar_definition_list; + const Type_handler *type_handler; + CHARSET_INFO *charset; + Condition_information_item *cond_info_item; + DYNCALL_CREATE_DEF *dyncol_def; + Diagnostics_information *diag_info; + Item *item; + Item_num *item_num; + Item_param *item_param; + Item_basic_constant *item_basic_constant; + Key_part_spec *key_part; + LEX *lex; + sp_assignment_lex *assignment_lex; + class sp_lex_cursor *sp_cursor_stmt; + LEX_CSTRING *lex_str_ptr; + LEX_USER *lex_user; + List<Condition_information_item> *cond_info_list; + List<DYNCALL_CREATE_DEF> *dyncol_def_list; + List<Item> *item_list; + List<sp_assignment_lex> *sp_assignment_lex_list; + List<Statement_information_item> *stmt_info_list; + List<String> *string_list; + List<LEX_CSTRING> *lex_str_list; + Statement_information_item *stmt_info_item; + String *string; + TABLE_LIST *table_list; + Table_ident *table; + Qualified_column_ident *qualified_column_ident; + char *simple_string; + const char *const_simple_string; + chooser_compare_func_creator boolfunc2creator; + class my_var *myvar; + class sp_condition_value *spcondvalue; + class sp_head *sphead; + class sp_name *spname; + class sp_variable *spvar; + class With_clause *with_clause; + class Virtual_column_info *virtual_column; + + handlerton *db_type; + st_select_lex *select_lex; + struct p_elem_val *p_elem_value; + class Window_frame *window_frame; + class Window_frame_bound *window_frame_bound; + udf_func *udf; + st_trg_execution_order trg_execution_order; + + /* enums */ + enum enum_sp_suid_behaviour sp_suid; + enum enum_view_suid view_suid; + enum sub_select_type unit_type; + enum Condition_information_item::Name cond_info_item_name; + enum enum_diag_condition_item_name diag_condition_item_name; + enum Diagnostics_information::Which_area diag_area; + enum Field::geometry_type geom_type; + enum enum_fk_option m_fk_option; + enum Item_udftype udf_type; + enum Key::Keytype key_type; + enum Statement_information_item::Name stmt_info_item_name; + enum enum_filetype filetype; + enum enum_tx_isolation tx_isolation; + enum enum_var_type var_type; + enum enum_yes_no_unknown m_yes_no_unk; + enum ha_choice choice; + enum ha_key_alg key_alg; + enum ha_rkey_function ha_rkey_mode; + enum index_hint_type index_hint; + enum interval_type interval, interval_time_st; + enum row_type row_type; + enum sp_variable::enum_mode spvar_mode; + enum thr_lock_type lock_type; + enum enum_mysql_timestamp_type date_time_type; + enum Window_frame_bound::Bound_precedence_type bound_precedence_type; + enum Window_frame::Frame_units frame_units; + enum Window_frame::Frame_exclusion frame_exclusion; + enum trigger_order_type trigger_action_order_type; + DDL_options_st object_ddl_options; + enum vers_sys_type_t vers_range_unit; + enum Column_definition::enum_column_versioning vers_column_versioning; + enum plsql_cursor_attr_t plsql_cursor_attr; +} + +%{ +bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); +%} + +%pure-parser /* We have threads */ +%parse-param { THD *thd } +%lex-param { THD *thd } +/* + Currently there are 53 shift/reduce conflicts. + We should not introduce new conflicts any more. +*/ +%expect 53 + +/* + Comments for TOKENS. + For each token, please include in the same line a comment that contains + the following tags: + SQL-2011-R : Reserved keyword as per SQL-2011 + SQL-2011-N : Non Reserved keyword as per SQL-2011 + SQL-2003-R : Reserved keyword as per SQL-2003 + SQL-2003-N : Non Reserved keyword as per SQL-2003 + SQL-1999-R : Reserved keyword as per SQL-1999 + SQL-1999-N : Non Reserved keyword as per SQL-1999 + MYSQL : MySQL extention (unspecified) + MYSQL-FUNC : MySQL extention, function + INTERNAL : Not a real token, lex optimization + OPERATOR : SQL operator + FUTURE-USE : Reserved for future use + + This makes the code grep-able, and helps maintenance. +*/ + + +/* + Reserved keywords and operators +*/ +%token ABORT_SYM /* INTERNAL (used in lex) */ +%token ACCESSIBLE_SYM +%token ADD /* SQL-2003-R */ +%token ALL /* SQL-2003-R */ +%token ALTER /* SQL-2003-R */ +%token ANALYZE_SYM +%token AND_AND_SYM /* OPERATOR */ +%token AND_SYM /* SQL-2003-R */ +%token AS /* SQL-2003-R */ +%token ASC /* SQL-2003-N */ +%token ASENSITIVE_SYM /* FUTURE-USE */ +%token BEFORE_SYM /* SQL-2003-N */ +%token BETWEEN_SYM /* SQL-2003-R */ +%token BIGINT /* SQL-2003-R */ +%token BINARY /* SQL-2003-R */ +%token BIN_NUM +%token BIT_AND /* MYSQL-FUNC */ +%token BIT_OR /* MYSQL-FUNC */ +%token BIT_XOR /* MYSQL-FUNC */ +%token BLOB_MARIADB_SYM /* SQL-2003-R */ +%token BLOB_ORACLE_SYM /* Oracle-R */ +%token BODY_ORACLE_SYM /* Oracle-R */ +%token BOTH /* SQL-2003-R */ +%token BY /* SQL-2003-R */ +%token CALL_SYM /* SQL-2003-R */ +%token CASCADE /* SQL-2003-N */ +%token CASE_SYM /* SQL-2003-R */ +%token CAST_SYM /* SQL-2003-R */ +%token CHANGE +%token CHAR_SYM /* SQL-2003-R */ +%token CHECK_SYM /* SQL-2003-R */ +%token COLLATE_SYM /* SQL-2003-R */ +%token CONDITION_SYM /* SQL-2003-R, SQL-2008-R */ +%token CONSTRAINT /* SQL-2003-R */ +%token CONTINUE_MARIADB_SYM /* SQL-2003-R, Oracle-R */ +%token CONTINUE_ORACLE_SYM /* SQL-2003-R, Oracle-R */ +%token CONVERT_SYM /* SQL-2003-N */ +%token COUNT_SYM /* SQL-2003-N */ +%token CREATE /* SQL-2003-R */ +%token CROSS /* SQL-2003-R */ +%token CUME_DIST_SYM +%token CURDATE /* MYSQL-FUNC */ +%token CURRENT_USER /* SQL-2003-R */ +%token CURRENT_ROLE /* SQL-2003-R */ +%token CURSOR_SYM /* SQL-2003-R */ +%token CURTIME /* MYSQL-FUNC */ +%token DATABASE +%token DATABASES +%token DATE_ADD_INTERVAL /* MYSQL-FUNC */ +%token DATE_SUB_INTERVAL /* MYSQL-FUNC */ +%token DAY_HOUR_SYM +%token DAY_MICROSECOND_SYM +%token DAY_MINUTE_SYM +%token DAY_SECOND_SYM +%token DECIMAL_NUM +%token DECIMAL_SYM /* SQL-2003-R */ +%token DECLARE_MARIADB_SYM /* SQL-2003-R */ +%token DECLARE_ORACLE_SYM /* Oracle-R */ +%token DEFAULT /* SQL-2003-R */ +%token DELETE_DOMAIN_ID_SYM +%token DELETE_SYM /* SQL-2003-R */ +%token DENSE_RANK_SYM +%token DESC /* SQL-2003-N */ +%token DESCRIBE /* SQL-2003-R */ +%token DETERMINISTIC_SYM /* SQL-2003-R */ +%token DISTINCT /* SQL-2003-R */ +%token DIV_SYM +%token DOUBLE_SYM /* SQL-2003-R */ +%token DO_DOMAIN_IDS_SYM +%token DOT_DOT_SYM +%token DROP /* SQL-2003-R */ +%token DUAL_SYM +%token EACH_SYM /* SQL-2003-R */ +%token ELSE /* SQL-2003-R */ +%token ELSEIF_MARIADB_SYM +%token ELSIF_ORACLE_SYM /* PLSQL-R */ +%token ENCLOSED +%token END_OF_INPUT /* INTERNAL */ +%token EQUAL_SYM /* OPERATOR */ +%token ESCAPED +%token EXCEPT_SYM /* SQL-2003-R */ +%token EXISTS /* SQL-2003-R */ +%token EXTRACT_SYM /* SQL-2003-N */ +%token FALSE_SYM /* SQL-2003-R */ +%token FETCH_SYM /* SQL-2003-R */ +%token FIRST_VALUE_SYM /* SQL-2011 */ +%token FLOAT_NUM +%token FLOAT_SYM /* SQL-2003-R */ +%token FOREIGN /* SQL-2003-R */ +%token FOR_SYM /* SQL-2003-R */ +%token FOR_SYSTEM_TIME_SYM /* INTERNAL */ +%token FROM +%token FULLTEXT_SYM +%token GE +%token GOTO_ORACLE_SYM /* Oracle-R */ +%token GRANT /* SQL-2003-R */ +%token GROUP_SYM /* SQL-2003-R */ +%token GROUP_CONCAT_SYM +%token LAG_SYM /* SQL-2011 */ +%token LEAD_SYM /* SQL-2011 */ +%token HAVING /* SQL-2003-R */ +%token HEX_NUM +%token HEX_STRING +%token HOUR_MICROSECOND_SYM +%token HOUR_MINUTE_SYM +%token HOUR_SECOND_SYM +%token IDENT +%token IDENT_QUOTED +%token IF_SYM +%token IGNORE_DOMAIN_IDS_SYM +%token IGNORE_SYM +%token INDEX_SYM +%token INFILE +%token INNER_SYM /* SQL-2003-R */ +%token INOUT_SYM /* SQL-2003-R */ +%token INSENSITIVE_SYM /* SQL-2003-R */ +%token INSERT /* SQL-2003-R */ +%token INTERSECT_SYM /* SQL-2003-R */ +%token INTERVAL_SYM /* SQL-2003-R */ +%token INTO /* SQL-2003-R */ +%token INT_SYM /* SQL-2003-R */ +%token IN_SYM /* SQL-2003-R */ +%token IS /* SQL-2003-R */ +%token ITERATE_SYM +%token JOIN_SYM /* SQL-2003-R */ +%token KEYS +%token KEY_SYM /* SQL-2003-N */ +%token KILL_SYM +%token LE /* OPERATOR */ +%token LEADING /* SQL-2003-R */ +%token LEAVE_SYM +%token LEFT /* SQL-2003-R */ +%token LEX_HOSTNAME +%token LIKE /* SQL-2003-R */ +%token LIMIT +%token LINEAR_SYM +%token LINES +%token LOAD +%token LOCATOR_SYM /* SQL-2003-N */ +%token LOCK_SYM +%token LONGBLOB +%token LONGTEXT +%token LONG_NUM +%token LONG_SYM +%token LOOP_SYM +%token LOW_PRIORITY +%token MASTER_SSL_VERIFY_SERVER_CERT_SYM +%token MATCH /* SQL-2003-R */ +%token MAX_SYM /* SQL-2003-N */ +%token MAXVALUE_SYM /* SQL-2003-N */ +%token MEDIAN_SYM +%token MEDIUMBLOB +%token MEDIUMINT +%token MEDIUMTEXT +%token MINUTE_MICROSECOND_SYM +%token MINUTE_SECOND_SYM +%token MIN_SYM /* SQL-2003-N */ +%token MODIFIES_SYM /* SQL-2003-R */ +%token MOD_SYM /* SQL-2003-N */ +%token MYSQL_CONCAT_SYM /* OPERATOR */ +%token NATURAL /* SQL-2003-R */ +%token NCHAR_STRING +%token NE /* OPERATOR */ +%token NEG +%token NOT2_SYM +%token NOT_SYM /* SQL-2003-R */ +%token NOW_SYM +%token NO_WRITE_TO_BINLOG +%token NTILE_SYM +%token NULL_SYM /* SQL-2003-R */ +%token NUM +%token NUMERIC_SYM /* SQL-2003-R */ +%token NTH_VALUE_SYM /* SQL-2011 */ +%token ON /* SQL-2003-R */ +%token OPTIMIZE +%token OPTIONALLY +%token ORACLE_CONCAT_SYM /* INTERNAL */ +%token OR2_SYM +%token ORDER_SYM /* SQL-2003-R */ +%token OR_SYM /* SQL-2003-R */ +%token OTHERS_ORACLE_SYM /* SQL-2011-N, PLSQL-R */ +%token OUTER +%token OUTFILE +%token OUT_SYM /* SQL-2003-R */ +%token OVER_SYM +%token PACKAGE_ORACLE_SYM /* Oracle-R */ +%token PAGE_CHECKSUM_SYM +%token PARAM_MARKER +%token PARSE_VCOL_EXPR_SYM +%token PARTITION_SYM /* SQL-2003-R */ +%token PERCENT_ORACLE_SYM /* INTERNAL */ +%token PERCENT_RANK_SYM +%token PERCENTILE_CONT_SYM +%token PERCENTILE_DISC_SYM +%token POSITION_SYM /* SQL-2003-N */ +%token PRECISION /* SQL-2003-R */ +%token PRIMARY_SYM /* SQL-2003-R */ +%token PROCEDURE_SYM /* SQL-2003-R */ +%token PURGE +%token RAISE_ORACLE_SYM /* PLSQL-R */ +%token RANGE_SYM /* SQL-2003-R */ +%token RANK_SYM +%token READS_SYM /* SQL-2003-R */ +%token READ_SYM /* SQL-2003-N */ +%token READ_WRITE_SYM +%token REAL /* SQL-2003-R */ +%token RECURSIVE_SYM +%token REF_SYSTEM_ID_SYM +%token REFERENCES /* SQL-2003-R */ +%token REGEXP +%token RELEASE_SYM /* SQL-2003-R */ +%token RENAME +%token REPEAT_SYM /* MYSQL-FUNC */ +%token REPLACE /* MYSQL-FUNC */ +%token REQUIRE_SYM +%token RESIGNAL_SYM /* SQL-2003-R */ +%token RESTRICT +%token RETURNING_SYM +%token RETURN_MARIADB_SYM /* SQL-2003-R, PLSQL-R */ +%token RETURN_ORACLE_SYM /* SQL-2003-R, PLSQL-R */ +%token REVOKE /* SQL-2003-R */ +%token RIGHT /* SQL-2003-R */ +%token ROWS_SYM /* SQL-2003-R */ +%token ROWTYPE_ORACLE_SYM /* PLSQL-R */ +%token ROW_NUMBER_SYM +%token SECOND_MICROSECOND_SYM +%token SELECT_SYM /* SQL-2003-R */ +%token SENSITIVE_SYM /* FUTURE-USE */ +%token SEPARATOR_SYM +%token SERVER_OPTIONS +%token SET /* SQL-2003-R */ +%token SET_VAR +%token SHIFT_LEFT /* OPERATOR */ +%token SHIFT_RIGHT /* OPERATOR */ +%token SHOW +%token SIGNAL_SYM /* SQL-2003-R */ +%token SMALLINT /* SQL-2003-R */ +%token SPATIAL_SYM +%token SPECIFIC_SYM /* SQL-2003-R */ +%token SQLEXCEPTION_SYM /* SQL-2003-R */ +%token SQLSTATE_SYM /* SQL-2003-R */ +%token SQLWARNING_SYM /* SQL-2003-R */ +%token SQL_BIG_RESULT +%token SQL_SMALL_RESULT +%token SQL_SYM /* SQL-2003-R */ +%token SSL_SYM +%token STARTING +%token STATS_AUTO_RECALC_SYM +%token STATS_PERSISTENT_SYM +%token STATS_SAMPLE_PAGES_SYM +%token STDDEV_SAMP_SYM /* SQL-2003-N */ +%token STD_SYM +%token STRAIGHT_JOIN +%token SUBSTRING /* SQL-2003-N */ +%token SUM_SYM /* SQL-2003-N */ +%token SYSDATE +%token TABLE_REF_PRIORITY +%token TABLE_SYM /* SQL-2003-R */ +%token TERMINATED +%token TEXT_STRING +%token THEN_SYM /* SQL-2003-R */ +%token TINYBLOB +%token TINYINT +%token TINYTEXT +%token TO_SYM /* SQL-2003-R */ +%token TRAILING /* SQL-2003-R */ +%token TRIGGER_SYM /* SQL-2003-R */ +%token TRIM /* SQL-2003-N */ +%token TRUE_SYM /* SQL-2003-R */ +%token ULONGLONG_NUM +%token UNDERSCORE_CHARSET +%token UNDO_SYM /* FUTURE-USE */ +%token UNION_SYM /* SQL-2003-R */ +%token UNIQUE_SYM +%token UNLOCK_SYM +%token UNSIGNED +%token UPDATE_SYM /* SQL-2003-R */ +%token USAGE /* SQL-2003-N */ +%token USE_SYM +%token USING /* SQL-2003-R */ +%token UTC_DATE_SYM +%token UTC_TIMESTAMP_SYM +%token UTC_TIME_SYM +%token VALUES /* SQL-2003-R */ +%token VALUES_IN_SYM +%token VALUES_LESS_SYM +%token VARBINARY +%token VARCHAR /* SQL-2003-R */ +%token VARIANCE_SYM +%token VARYING /* SQL-2003-R */ +%token VAR_SAMP_SYM +%token WHEN_SYM /* SQL-2003-R */ +%token WHERE /* SQL-2003-R */ +%token WHILE_SYM +%token WITH /* SQL-2003-R */ +%token WITH_CUBE_SYM /* INTERNAL */ +%token WITH_ROLLUP_SYM /* INTERNAL */ +%token WITH_SYSTEM_SYM /* INTERNAL */ +%token XOR +%token YEAR_MONTH_SYM +%token ZEROFILL + +%token IMPOSSIBLE_ACTION /* To avoid warning for yyerrlab1 */ + + +/* + Keywords that have different reserved status in std/oracle modes. +*/ +%token <kwd> BODY_MARIADB_SYM // Oracle-R +%token <kwd> ELSEIF_ORACLE_SYM +%token <kwd> ELSIF_MARIADB_SYM // PLSQL-R +%token <kwd> EXCEPTION_ORACLE_SYM // SQL-2003-N, PLSQL-R +%token <kwd> GOTO_MARIADB_SYM // Oracle-R +%token <kwd> OTHERS_MARIADB_SYM // SQL-2011-N, PLSQL-R +%token <kwd> PACKAGE_MARIADB_SYM // Oracle-R +%token <kwd> RAISE_MARIADB_SYM // PLSQL-R +%token <kwd> ROWTYPE_MARIADB_SYM // PLSQL-R + +/* + Non-reserved keywords +*/ + +%token <kwd> ACTION /* SQL-2003-N */ +%token <kwd> ADMIN_SYM /* SQL-2003-N */ +%token <kwd> ADDDATE_SYM /* MYSQL-FUNC */ +%token <kwd> AFTER_SYM /* SQL-2003-N */ +%token <kwd> AGAINST +%token <kwd> AGGREGATE_SYM +%token <kwd> ALGORITHM_SYM +%token <kwd> ALWAYS_SYM +%token <kwd> ANY_SYM /* SQL-2003-R */ +%token <kwd> ASCII_SYM /* MYSQL-FUNC */ +%token <kwd> AT_SYM /* SQL-2003-R */ +%token <kwd> ATOMIC_SYM /* SQL-2003-R */ +%token <kwd> AUTHORS_SYM +%token <kwd> AUTOEXTEND_SIZE_SYM +%token <kwd> AUTO_INC +%token <kwd> AUTO_SYM +%token <kwd> AVG_ROW_LENGTH +%token <kwd> AVG_SYM /* SQL-2003-N */ +%token <kwd> BACKUP_SYM +%token <kwd> BEGIN_MARIADB_SYM /* SQL-2003-R, PLSQL-R */ +%token <kwd> BEGIN_ORACLE_SYM /* SQL-2003-R, PLSQL-R */ +%token <kwd> BINLOG_SYM +%token <kwd> BIT_SYM /* MYSQL-FUNC */ +%token <kwd> BLOCK_SYM +%token <kwd> BOOL_SYM +%token <kwd> BOOLEAN_SYM /* SQL-2003-R, PLSQL-R */ +%token <kwd> BTREE_SYM +%token <kwd> BYTE_SYM +%token <kwd> CACHE_SYM +%token <kwd> CASCADED /* SQL-2003-R */ +%token <kwd> CATALOG_NAME_SYM /* SQL-2003-N */ +%token <kwd> CHAIN_SYM /* SQL-2003-N */ +%token <kwd> CHANGED +%token <kwd> CHARSET +%token <kwd> CHECKPOINT_SYM +%token <kwd> CHECKSUM_SYM +%token <kwd> CIPHER_SYM +%token <kwd> CLASS_ORIGIN_SYM /* SQL-2003-N */ +%token <kwd> CLIENT_SYM +%token <kwd> CLOB_MARIADB_SYM /* SQL-2003-R */ +%token <kwd> CLOB_ORACLE_SYM /* Oracle-R */ +%token <kwd> CLOSE_SYM /* SQL-2003-R */ +%token <kwd> COALESCE /* SQL-2003-N */ +%token <kwd> CODE_SYM +%token <kwd> COLLATION_SYM /* SQL-2003-N */ +%token <kwd> COLON_ORACLE_SYM /* INTERNAL */ +%token <kwd> COLUMNS +%token <kwd> COLUMN_ADD_SYM +%token <kwd> COLUMN_CHECK_SYM +%token <kwd> COLUMN_CREATE_SYM +%token <kwd> COLUMN_DELETE_SYM +%token <kwd> COLUMN_GET_SYM +%token <kwd> COLUMN_SYM /* SQL-2003-R */ +%token <kwd> COLUMN_NAME_SYM /* SQL-2003-N */ +%token <kwd> COMMENT_SYM /* Oracle-R */ +%token <kwd> COMMITTED_SYM /* SQL-2003-N */ +%token <kwd> COMMIT_SYM /* SQL-2003-R */ +%token <kwd> COMPACT_SYM +%token <kwd> COMPLETION_SYM +%token <kwd> COMPRESSED_SYM +%token <kwd> CONCURRENT +%token <kwd> CONNECTION_SYM +%token <kwd> CONSISTENT_SYM +%token <kwd> CONSTRAINT_CATALOG_SYM /* SQL-2003-N */ +%token <kwd> CONSTRAINT_NAME_SYM /* SQL-2003-N */ +%token <kwd> CONSTRAINT_SCHEMA_SYM /* SQL-2003-N */ +%token <kwd> CONTAINS_SYM /* SQL-2003-N */ +%token <kwd> CONTEXT_SYM +%token <kwd> CONTRIBUTORS_SYM +%token <kwd> CPU_SYM +%token <kwd> CUBE_SYM /* SQL-2003-R */ +%token <kwd> CURRENT_SYM /* SQL-2003-R */ +%token <kwd> CURRENT_POS_SYM +%token <kwd> CURSOR_NAME_SYM /* SQL-2003-N */ +%token <kwd> CYCLE_SYM +%token <kwd> DATAFILE_SYM +%token <kwd> DATA_SYM /* SQL-2003-N */ +%token <kwd> DATETIME +%token <kwd> DATE_FORMAT_SYM /* MYSQL-FUNC */ +%token <kwd> DATE_SYM /* SQL-2003-R, Oracle-R, PLSQL-R */ +%token <kwd> DAY_SYM /* SQL-2003-R */ +%token <kwd> DEALLOCATE_SYM /* SQL-2003-R */ +%token <kwd> DECODE_MARIADB_SYM /* Function, non-reserved */ +%token <kwd> DECODE_ORACLE_SYM /* Function, non-reserved */ +%token <kwd> DEFINER_SYM +%token <kwd> DELAYED_SYM +%token <kwd> DELAY_KEY_WRITE_SYM +%token <kwd> DES_KEY_FILE +%token <kwd> DIAGNOSTICS_SYM /* SQL-2003-N */ +%token <kwd> DIRECTORY_SYM +%token <kwd> DISABLE_SYM +%token <kwd> DISCARD +%token <kwd> DISK_SYM +%token <kwd> DO_SYM +%token <kwd> DUMPFILE +%token <kwd> DUPLICATE_SYM +%token <kwd> DYNAMIC_SYM /* SQL-2003-R */ +%token <kwd> ENABLE_SYM +%token <kwd> END /* SQL-2003-R, PLSQL-R */ +%token <kwd> ENDS_SYM +%token <kwd> ENGINES_SYM +%token <kwd> ENGINE_SYM +%token <kwd> ENUM +%token <kwd> ERROR_SYM +%token <kwd> ERRORS +%token <kwd> ESCAPE_SYM /* SQL-2003-R */ +%token <kwd> EVENTS_SYM +%token <kwd> EVENT_SYM +%token <kwd> EVERY_SYM /* SQL-2003-N */ +%token <kwd> EXCHANGE_SYM +%token <kwd> EXAMINED_SYM +%token <kwd> EXCLUDE_SYM /* SQL-2011-N */ +%token <kwd> EXECUTE_SYM /* SQL-2003-R */ +%token <kwd> EXCEPTION_MARIADB_SYM /* SQL-2003-N, PLSQL-R */ +%token <kwd> EXIT_MARIADB_SYM /* PLSQL-R */ +%token <kwd> EXIT_ORACLE_SYM /* PLSQL-R */ +%token <kwd> EXPANSION_SYM +%token <kwd> EXPORT_SYM +%token <kwd> EXTENDED_SYM +%token <kwd> EXTENT_SIZE_SYM +%token <kwd> FAST_SYM +%token <kwd> FAULTS_SYM +%token <kwd> FILE_SYM +%token <kwd> FIRST_SYM /* SQL-2003-N */ +%token <kwd> FIXED_SYM +%token <kwd> FLUSH_SYM +%token <kwd> FOLLOWS_SYM /* MYSQL trigger*/ +%token <kwd> FOLLOWING_SYM /* SQL-2011-N */ +%token <kwd> FORCE_SYM +%token <kwd> FORMAT_SYM +%token <kwd> FOUND_SYM /* SQL-2003-R */ +%token <kwd> FULL /* SQL-2003-R */ +%token <kwd> FUNCTION_SYM /* SQL-2003-R, Oracle-R */ +%token <kwd> GENERAL +%token <kwd> GENERATED_SYM +%token <kwd> GEOMETRYCOLLECTION +%token <kwd> GEOMETRY_SYM +%token <kwd> GET_FORMAT /* MYSQL-FUNC */ +%token <kwd> GET_SYM /* SQL-2003-R */ +%token <kwd> GLOBAL_SYM /* SQL-2003-R */ +%token <kwd> GRANTS +%token <kwd> HANDLER_SYM +%token <kwd> HARD_SYM +%token <kwd> HASH_SYM +%token <kwd> HELP_SYM +%token <kwd> HIGH_PRIORITY +%token <kwd> HISTORY_SYM /* MYSQL */ +%token <kwd> HOST_SYM +%token <kwd> HOSTS_SYM +%token <kwd> HOUR_SYM /* SQL-2003-R */ +%token <kwd> ID_SYM /* MYSQL */ +%token <kwd> IDENTIFIED_SYM +%token <kwd> IGNORE_SERVER_IDS_SYM +%token <kwd> IMMEDIATE_SYM /* SQL-2003-R */ +%token <kwd> IMPORT +%token <kwd> INCREMENT_SYM +%token <kwd> INDEXES +%token <kwd> INITIAL_SIZE_SYM +%token <kwd> INSERT_METHOD +%token <kwd> INSTALL_SYM +%token <kwd> INVOKER_SYM +%token <kwd> IO_SYM +%token <kwd> IPC_SYM +%token <kwd> ISOLATION /* SQL-2003-R */ +%token <kwd> ISOPEN_SYM /* Oracle-N */ +%token <kwd> ISSUER_SYM +%token <kwd> INVISIBLE_SYM +%token <kwd> JSON_SYM +%token <kwd> KEY_BLOCK_SIZE +%token <kwd> LANGUAGE_SYM /* SQL-2003-R */ +%token <kwd> LAST_SYM /* SQL-2003-N */ +%token <kwd> LAST_VALUE +%token <kwd> LASTVAL_SYM /* PostgreSQL sequence function */ +%token <kwd> LEAVES +%token <kwd> LESS_SYM +%token <kwd> LEVEL_SYM +%token <kwd> LINESTRING +%token <kwd> LIST_SYM +%token <kwd> LOCAL_SYM /* SQL-2003-R */ +%token <kwd> LOCKS_SYM +%token <kwd> LOGFILE_SYM +%token <kwd> LOGS_SYM +%token <kwd> MASTER_CONNECT_RETRY_SYM +%token <kwd> MASTER_DELAY_SYM +%token <kwd> MASTER_GTID_POS_SYM +%token <kwd> MASTER_HOST_SYM +%token <kwd> MASTER_LOG_FILE_SYM +%token <kwd> MASTER_LOG_POS_SYM +%token <kwd> MASTER_PASSWORD_SYM +%token <kwd> MASTER_PORT_SYM +%token <kwd> MASTER_SERVER_ID_SYM +%token <kwd> MASTER_SSL_CAPATH_SYM +%token <kwd> MASTER_SSL_CA_SYM +%token <kwd> MASTER_SSL_CERT_SYM +%token <kwd> MASTER_SSL_CIPHER_SYM +%token <kwd> MASTER_SSL_CRL_SYM +%token <kwd> MASTER_SSL_CRLPATH_SYM +%token <kwd> MASTER_SSL_KEY_SYM +%token <kwd> MASTER_SSL_SYM +%token <kwd> MASTER_SYM +%token <kwd> MASTER_USER_SYM +%token <kwd> MASTER_USE_GTID_SYM +%token <kwd> MASTER_HEARTBEAT_PERIOD_SYM +%token <kwd> MAX_CONNECTIONS_PER_HOUR +%token <kwd> MAX_QUERIES_PER_HOUR +%token <kwd> MAX_ROWS +%token <kwd> MAX_SIZE_SYM +%token <kwd> MAX_UPDATES_PER_HOUR +%token <kwd> MAX_STATEMENT_TIME_SYM +%token <kwd> MAX_USER_CONNECTIONS_SYM +%token <kwd> MEDIUM_SYM +%token <kwd> MEMORY_SYM +%token <kwd> MERGE_SYM /* SQL-2003-R */ +%token <kwd> MESSAGE_TEXT_SYM /* SQL-2003-N */ +%token <kwd> MICROSECOND_SYM /* MYSQL-FUNC */ +%token <kwd> MIGRATE_SYM +%token <kwd> MINUTE_SYM /* SQL-2003-R */ +%token <kwd> MINVALUE_SYM +%token <kwd> MIN_ROWS +%token <kwd> MODE_SYM +%token <kwd> MODIFY_SYM +%token <kwd> MONTH_SYM /* SQL-2003-R */ +%token <kwd> MULTILINESTRING +%token <kwd> MULTIPOINT +%token <kwd> MULTIPOLYGON +%token <kwd> MUTEX_SYM +%token <kwd> MYSQL_SYM +%token <kwd> MYSQL_ERRNO_SYM +%token <kwd> NAMES_SYM /* SQL-2003-N */ +%token <kwd> NAME_SYM /* SQL-2003-N */ +%token <kwd> NATIONAL_SYM /* SQL-2003-R */ +%token <kwd> NCHAR_SYM /* SQL-2003-R */ +%token <kwd> NEW_SYM /* SQL-2003-R */ +%token <kwd> NEXT_SYM /* SQL-2003-N */ +%token <kwd> NEXTVAL_SYM /* PostgreSQL sequence function */ +%token <kwd> NOCACHE_SYM +%token <kwd> NOCYCLE_SYM +%token <kwd> NODEGROUP_SYM +%token <kwd> NONE_SYM /* SQL-2003-R */ +%token <kwd> NOTFOUND_SYM /* Oracle-R */ +%token <kwd> NO_SYM /* SQL-2003-R */ +%token <kwd> NOMAXVALUE_SYM +%token <kwd> NOMINVALUE_SYM +%token <kwd> NO_WAIT_SYM +%token <kwd> NOWAIT_SYM +%token <kwd> NUMBER_MARIADB_SYM /* SQL-2003-N */ +%token <kwd> NUMBER_ORACLE_SYM /* Oracle-R, PLSQL-R */ +%token <kwd> NVARCHAR_SYM +%token <kwd> OF_SYM /* SQL-1992-R, Oracle-R */ +%token <kwd> OFFSET_SYM +%token <kwd> OLD_PASSWORD_SYM +%token <kwd> ONE_SYM +%token <kwd> ONLY_SYM /* SQL-2003-R */ +%token <kwd> ONLINE_SYM +%token <kwd> OPEN_SYM /* SQL-2003-R */ +%token <kwd> OPTIONS_SYM +%token <kwd> OPTION /* SQL-2003-N */ +%token <kwd> OWNER_SYM +%token <kwd> PACK_KEYS_SYM +%token <kwd> PAGE_SYM +%token <kwd> PARSER_SYM +%token <kwd> PARTIAL /* SQL-2003-N */ +%token <kwd> PARTITIONS_SYM +%token <kwd> PARTITIONING_SYM +%token <kwd> PASSWORD_SYM +%token <kwd> PERIOD_SYM /* SQL-2011-R */ +%token <kwd> PERSISTENT_SYM +%token <kwd> PHASE_SYM +%token <kwd> PLUGINS_SYM +%token <kwd> PLUGIN_SYM +%token <kwd> POINT_SYM +%token <kwd> POLYGON +%token <kwd> PORT_SYM +%token <kwd> PRECEDES_SYM /* MYSQL */ +%token <kwd> PRECEDING_SYM /* SQL-2011-N */ +%token <kwd> PREPARE_SYM /* SQL-2003-R */ +%token <kwd> PRESERVE_SYM +%token <kwd> PREV_SYM +%token <kwd> PREVIOUS_SYM +%token <kwd> PRIVILEGES /* SQL-2003-N */ +%token <kwd> PROCESS +%token <kwd> PROCESSLIST_SYM +%token <kwd> PROFILE_SYM +%token <kwd> PROFILES_SYM +%token <kwd> PROXY_SYM +%token <kwd> QUARTER_SYM +%token <kwd> QUERY_SYM +%token <kwd> QUICK +%token <kwd> RAW_MARIADB_SYM +%token <kwd> RAW_ORACLE_SYM /* Oracle-R */ +%token <kwd> READ_ONLY_SYM +%token <kwd> REBUILD_SYM +%token <kwd> RECOVER_SYM +%token <kwd> REDOFILE_SYM +%token <kwd> REDO_BUFFER_SIZE_SYM +%token <kwd> REDUNDANT_SYM +%token <kwd> RELAY +%token <kwd> RELAYLOG_SYM +%token <kwd> RELAY_LOG_FILE_SYM +%token <kwd> RELAY_LOG_POS_SYM +%token <kwd> RELAY_THREAD +%token <kwd> RELOAD +%token <kwd> REMOVE_SYM +%token <kwd> REORGANIZE_SYM +%token <kwd> REPAIR +%token <kwd> REPEATABLE_SYM /* SQL-2003-N */ +%token <kwd> REPLICATION +%token <kwd> RESET_SYM +%token <kwd> RESTART_SYM +%token <kwd> RESOURCES +%token <kwd> RESTORE_SYM +%token <kwd> RESUME_SYM +%token <kwd> RETURNED_SQLSTATE_SYM /* SQL-2003-N */ +%token <kwd> RETURNS_SYM /* SQL-2003-R */ +%token <kwd> REUSE_SYM /* Oracle-R */ +%token <kwd> REVERSE_SYM +%token <kwd> ROLE_SYM +%token <kwd> ROLLBACK_SYM /* SQL-2003-R */ +%token <kwd> ROLLUP_SYM /* SQL-2003-R */ +%token <kwd> ROUTINE_SYM /* SQL-2003-N */ +%token <kwd> ROWCOUNT_SYM /* Oracle-N */ +%token <kwd> ROW_SYM /* SQL-2003-R */ +%token <kwd> ROW_COUNT_SYM /* SQL-2003-N */ +%token <kwd> ROW_FORMAT_SYM +%token <kwd> RTREE_SYM +%token <kwd> SAVEPOINT_SYM /* SQL-2003-R */ +%token <kwd> SCHEDULE_SYM +%token <kwd> SCHEMA_NAME_SYM /* SQL-2003-N */ +%token <kwd> SECOND_SYM /* SQL-2003-R */ +%token <kwd> SECURITY_SYM /* SQL-2003-N */ +%token <kwd> SEQUENCE_SYM +%token <kwd> SERIALIZABLE_SYM /* SQL-2003-N */ +%token <kwd> SERIAL_SYM +%token <kwd> SESSION_SYM /* SQL-2003-N */ +%token <kwd> SERVER_SYM +%token <kwd> SETVAL_SYM /* PostgreSQL sequence function */ +%token <kwd> SHARE_SYM +%token <kwd> SHUTDOWN +%token <kwd> SIGNED_SYM +%token <kwd> SIMPLE_SYM /* SQL-2003-N */ +%token <kwd> SLAVE +%token <kwd> SLAVES +%token <kwd> SLAVE_POS_SYM +%token <kwd> SLOW +%token <kwd> SNAPSHOT_SYM +%token <kwd> SOCKET_SYM +%token <kwd> SOFT_SYM +%token <kwd> SONAME_SYM +%token <kwd> SOUNDS_SYM +%token <kwd> SOURCE_SYM +%token <kwd> SQL_BUFFER_RESULT +%token <kwd> SQL_CACHE_SYM +%token <kwd> SQL_CALC_FOUND_ROWS +%token <kwd> SQL_NO_CACHE_SYM +%token <kwd> SQL_THREAD +%token <kwd> STARTS_SYM +%token <kwd> START_SYM /* SQL-2003-R */ +%token <kwd> STATEMENT_SYM +%token <kwd> STATUS_SYM +%token <kwd> STOP_SYM +%token <kwd> STORAGE_SYM +%token <kwd> STORED_SYM +%token <kwd> STRING_SYM +%token <kwd> SUBCLASS_ORIGIN_SYM /* SQL-2003-N */ +%token <kwd> SUBDATE_SYM +%token <kwd> SUBJECT_SYM +%token <kwd> SUBPARTITIONS_SYM +%token <kwd> SUBPARTITION_SYM +%token <kwd> SUPER_SYM +%token <kwd> SUSPEND_SYM +%token <kwd> SWAPS_SYM +%token <kwd> SWITCHES_SYM +%token <kwd> SYSTEM /* SQL-2011-R */ +%token <kwd> SYSTEM_TIME_SYM /* SQL-2011-R */ +%token <kwd> TABLES +%token <kwd> TABLESPACE +%token <kwd> TABLE_CHECKSUM_SYM +%token <kwd> TABLE_NAME_SYM /* SQL-2003-N */ +%token <kwd> TEMPORARY /* SQL-2003-N */ +%token <kwd> TEMPTABLE_SYM +%token <kwd> TEXT_SYM +%token <kwd> THAN_SYM +%token <kwd> TIES_SYM /* SQL-2011-N */ +%token <kwd> TIMESTAMP /* SQL-2003-R */ +%token <kwd> TIMESTAMP_ADD +%token <kwd> TIMESTAMP_DIFF +%token <kwd> TIME_SYM /* SQL-2003-R, Oracle-R */ +%token <kwd> TRANSACTION_SYM +%token <kwd> TRANSACTIONAL_SYM +%token <kwd> TRIGGERS_SYM +%token <kwd> TRIM_ORACLE +%token <kwd> TRUNCATE_SYM +%token <kwd> TYPES_SYM +%token <kwd> TYPE_SYM /* SQL-2003-N */ +%token <kwd> UDF_RETURNS_SYM +%token <kwd> UNBOUNDED_SYM /* SQL-2011-N */ +%token <kwd> UNCOMMITTED_SYM /* SQL-2003-N */ +%token <kwd> UNDEFINED_SYM +%token <kwd> UNDOFILE_SYM +%token <kwd> UNDO_BUFFER_SIZE_SYM +%token <kwd> UNICODE_SYM +%token <kwd> UNINSTALL_SYM +%token <kwd> UNKNOWN_SYM /* SQL-2003-R */ +%token <kwd> UNTIL_SYM +%token <kwd> UPGRADE_SYM +%token <kwd> USER_SYM /* SQL-2003-R */ +%token <kwd> USE_FRM +%token <kwd> VALUE_SYM /* SQL-2003-R */ +%token <kwd> VARCHAR2_MARIADB_SYM +%token <kwd> VARCHAR2_ORACLE_SYM /* Oracle-R, PLSQL-R */ +%token <kwd> VARIABLES +%token <kwd> VERSIONING_SYM /* SQL-2011-R */ +%token <kwd> VIA_SYM +%token <kwd> VIEW_SYM /* SQL-2003-N */ +%token <kwd> VIRTUAL_SYM +%token <kwd> WAIT_SYM +%token <kwd> WARNINGS +%token <kwd> WEEK_SYM +%token <kwd> WEIGHT_STRING_SYM +%token <kwd> WINDOW_SYM /* SQL-2003-R */ +%token <kwd> WITHIN +%token <kwd> WITHOUT /* SQL-2003-R */ +%token <kwd> WORK_SYM /* SQL-2003-N */ +%token <kwd> WRAPPER_SYM +%token <kwd> WRITE_SYM /* SQL-2003-N */ +%token <kwd> X509_SYM +%token <kwd> XA_SYM +%token <kwd> XML_SYM +%token <kwd> YEAR_SYM /* SQL-2003-R */ + + +%left JOIN_SYM INNER_SYM STRAIGHT_JOIN CROSS LEFT RIGHT +/* A dummy token to force the priority of table_ref production in a join. */ +%left TABLE_REF_PRIORITY + +/* + Give ESCAPE (in LIKE) a very low precedence. + This allows the concatenation operator || to be used on the right + side of "LIKE" with sql_mode=PIPES_AS_CONCAT (without ORACLE): + SELECT 'ab' LIKE 'a'||'b'||'c'; +*/ +%left PREC_BELOW_ESCAPE +%left ESCAPE_SYM + +%left SET_VAR +%left OR_SYM OR2_SYM +%left XOR +%left AND_SYM AND_AND_SYM + +%left PREC_BELOW_NOT +%left NOT_SYM + +%left BETWEEN_SYM CASE_SYM WHEN_SYM THEN_SYM ELSE +%left '=' EQUAL_SYM GE '>' LE '<' NE IS LIKE SOUNDS_SYM REGEXP IN_SYM +%left '|' +%left '&' +%left SHIFT_LEFT SHIFT_RIGHT +%left '-' '+' ORACLE_CONCAT_SYM +%left '*' '/' '%' DIV_SYM MOD_SYM +%left '^' +%left MYSQL_CONCAT_SYM +%left NEG '~' NOT2_SYM BINARY +%left COLLATE_SYM + +/* + Tokens that can change their meaning from identifier to something else + in certain context. + + - TRANSACTION: identifier, history unit: + SELECT transaction FROM t1; + SELECT * FROM t1 FOR SYSTEM_TIME AS OF TRANSACTION @var; + + - TIMESTAMP: identifier, literal, history unit: + SELECT timestamp FROM t1; + SELECT TIMESTAMP '2001-01-01 10:20:30'; + SELECT * FROM t1 FOR SYSTEM_TIME AS OF TIMESTAMP CONCAT(@date,' ',@time); + + - PERIOD: identifier, period for system time: + SELECT period FROM t1; + ALTER TABLE DROP PERIOD FOR SYSTEM TIME; + + - SYSTEM: identifier, system versioning: + SELECT system FROM t1; + ALTER TABLE DROP SYSTEM VERSIONIONG; + + - USER: identifier, user: + SELECT user FROM t1; + KILL USER foo; + + Note, we need here only tokens that cause shift/reduce conflicts + with keyword identifiers. For example: + opt_clause1: %empty | KEYWORD ... ; + clause2: opt_clause1 ident; + KEYWORD can appear both in opt_clause1 and in "ident" through the "keyword" + rule. So the parser reports a conflict on how to interpret KEYWORD: + - as a start of non-empty branch in opt_clause1, or + - as an identifier which follows the empty branch in opt_clause1. + + Example#1: + alter_list_item: + DROP opt_column opt_if_exists_table_element field_ident + | DROP SYSTEM VERSIONING_SYM + SYSTEM can be a keyword in field_ident, or can be a start of + SYSTEM VERSIONING. + + Example#2: + system_time_expr: AS OF_SYM history_point + history_point: opt_history_unit bit_expr + opt_history_unit: | TRANSACTION_SYM + TRANSACTION can be a non-empty history unit, or can be an identifier + in bit_expr. + + In the grammar below we use %prec to explicitely tell Bison to go + through the empty branch in the optional rule only when the lookahead + token does not belong to a small set of selected tokens. + + Tokens NEXT_SYM and PREVIOUS_SYM also change their meaning from + identifiers to sequence operations when followed by VALUE_SYM: + SELECT NEXT VALUE FOR s1, PREVIOUS VALUE FOR s1; + but we don't need to list them here as they do not seem to cause + conflicts (according to bison -v), as both meanings + (as identifier, and as a sequence operation) are parts of the same target + column_default_non_parenthesized_expr, and there are no any optional + clauses between the start of column_default_non_parenthesized_expr + and until NEXT_SYM / PREVIOUS_SYM. +*/ +%left PREC_BELOW_IDENTIFIER_OPT_SPECIAL_CASE +%left TRANSACTION_SYM TIMESTAMP PERIOD_SYM SYSTEM USER + + +/* + Tokens that can appear in a token contraction on the second place + and change the meaning of the previous token. + + - TEXT_STRING: changes the meaning of TIMESTAMP/TIME/DATE + from identifier to literal: + SELECT timestamp FROM t1; + SELECT TIMESTAMP'2001-01-01 00:00:00' FROM t1; + + - Parenthesis: changes the meaning of TIMESTAMP/TIME/DATE + from identifiers to CAST-alike functions: + SELECT timestamp FROM t1; + SELECT timestamp(1) FROM t1; + + - VALUE: changes NEXT and PREVIOUS from identifier to sequence operation: + SELECT next, previous FROM t1; + SELECT NEXT VALUE FOR s1, PREVIOUS VALUE FOR s1; + + - VERSIONING: changes SYSTEM from identifier to SYSTEM VERSIONING + SELECT system FROM t1; + ALTER TABLE t1 ADD SYSTEM VERSIONING; +*/ +%left PREC_BELOW_CONTRACTION_TOKEN2 +%left TEXT_STRING '(' VALUE_SYM VERSIONING_SYM + +%type <lex_str> + DECIMAL_NUM FLOAT_NUM NUM LONG_NUM + HEX_NUM HEX_STRING + LEX_HOSTNAME ULONGLONG_NUM field_ident select_alias ident_or_text + TEXT_STRING_sys TEXT_STRING_literal + key_cache_name + sp_opt_label BIN_NUM TEXT_STRING_filesystem + opt_constraint constraint opt_ident + opt_package_routine_end_name + sp_block_label opt_place opt_db + +%type <lex_str> + label_declaration_oracle + labels_declaration_oracle + +%type <ident_sys> + IDENT_sys + ident + label_ident + sp_decl_ident + ident_set_usual_case + ident_or_empty + ident_table_alias + ident_sysvar_name + ident_directly_assignable + +%type <lex_string_with_metadata> + TEXT_STRING + NCHAR_STRING + +%type <lex_str_ptr> + opt_table_alias + +%type <ident_cli> + IDENT + IDENT_QUOTED + IDENT_cli + ident_cli + +%type <kwd> + keyword_data_type + keyword_ident + keyword_label + keyword_set_special_case + keyword_set_usual_case + keyword_sp_block_section + keyword_sp_decl + keyword_sp_head + keyword_sp_var_and_label + keyword_sp_var_not_label + keyword_sysvar_name + keyword_sysvar_type + keyword_table_alias + keyword_verb_clause + keyword_directly_assignable + +%type <table> + table_ident table_ident_nodb references xid + table_ident_opt_wild create_like + +%type <qualified_column_ident> + optionally_qualified_column_ident + +%type <simple_string> + remember_name remember_end remember_end_opt + remember_tok_start remember_tok_end + wild_and_where + +%type <const_simple_string> + field_length opt_field_length opt_field_length_default_1 + opt_compression_method + +%type <string> + text_string hex_or_bin_String opt_gconcat_separator + +%type <type_handler> int_type real_type + +%type <Lex_field_type> type_with_opt_collate field_type + sp_param_type_with_opt_collate + sp_param_field_type + sp_param_field_type_string + field_type_numeric + field_type_string + field_type_lob + field_type_temporal + field_type_misc + +%type <Lex_dyncol_type> opt_dyncol_type dyncol_type + numeric_dyncol_type temporal_dyncol_type string_dyncol_type + +%type <create_field> field_spec column_def + +%type <geom_type> spatial_type + +%type <num> + order_dir lock_option + udf_type opt_local opt_no_write_to_binlog + opt_temporary all_or_any opt_distinct opt_glimit_clause + opt_ignore_leaves fulltext_options union_option + opt_not + select_derived_init transaction_access_mode_types + opt_natural_language_mode opt_query_expansion + opt_ev_status opt_ev_on_completion ev_on_completion opt_ev_comment + ev_alter_on_schedule_completion opt_ev_rename_to opt_ev_sql_stmt + optional_flush_tables_arguments + opt_time_precision kill_type kill_option int_num + opt_default_time_precision + case_stmt_body opt_bin_mod opt_for_system_time_clause + opt_if_exists_table_element opt_if_not_exists_table_element + opt_recursive opt_format_xid + +%type <object_ddl_options> + create_or_replace + opt_if_not_exists + opt_if_exists + +/* + Bit field of MYSQL_START_TRANS_OPT_* flags. +*/ +%type <num> opt_start_transaction_option_list +%type <num> start_transaction_option_list +%type <num> start_transaction_option + +%type <m_yes_no_unk> + opt_chain opt_release + +%type <m_fk_option> + delete_option + +%type <ulong_num> + ulong_num real_ulong_num merge_insert_types + ws_nweights opt_versioning_interval_start + ws_level_flag_desc ws_level_flag_reverse ws_level_flags + opt_ws_levels ws_level_list ws_level_list_item ws_level_number + ws_level_range ws_level_list_or_range bool + +%type <ulonglong_number> + ulonglong_num real_ulonglong_num size_number + +%type <longlong_number> + longlong_num + +%type <choice> choice + +%type <lock_type> + replace_lock_option opt_low_priority insert_lock_option load_data_lock + +%type <item> + literal insert_ident order_ident temporal_literal + simple_ident expr sum_expr in_sum_expr + variable variable_aux bool_pri + predicate bit_expr parenthesized_expr + table_wild simple_expr column_default_non_parenthesized_expr udf_expr + primary_expr string_factor_expr mysql_concatenation_expr + select_sublist_qualified_asterisk + expr_or_default set_expr_or_default + geometry_function signed_literal expr_or_literal + opt_escape + sp_opt_default + simple_ident_nospvar + field_or_var limit_option + part_func_expr + window_func_expr + window_func + simple_window_func + inverse_distribution_function + percentile_function + inverse_distribution_function_def + explicit_cursor_attr + function_call_keyword + function_call_keyword_timestamp + function_call_nonkeyword + function_call_generic + function_call_conflict kill_expr + signal_allowed_expr + simple_target_specification + condition_number + reset_lex_expr + +%type <item_param> param_marker + +%type <item_num> + NUM_literal + +%type <item_basic_constant> text_literal + +%type <item_list> + expr_list opt_udf_expr_list udf_expr_list when_list when_list_opt_else + ident_list ident_list_arg opt_expr_list + decode_when_list_oracle + +%type <sp_cursor_stmt> + sp_cursor_stmt_lex + sp_cursor_stmt + +%type <assignment_lex> + assignment_source_lex + assignment_source_expr + for_loop_bound_expr + +%type <sp_assignment_lex_list> + cursor_actual_parameters + opt_parenthesized_cursor_actual_parameters + +%type <var_type> + option_type opt_var_type opt_var_ident_type + +%type <key_type> + opt_unique constraint_key_type fulltext spatial + +%type <key_alg> + btree_or_rtree opt_key_algorithm_clause opt_USING_key_algorithm + +%type <string_list> + using_list opt_use_partition use_partition + +%type <key_part> + key_part + +%type <table_list> + join_table_list join_table + table_factor table_ref esc_table_ref + table_primary_ident table_primary_derived + select_derived derived_table_list + select_derived_union + derived_simple_table + derived_query_specification + derived_table_value_constructor +%type <date_time_type> date_time_type; +%type <interval> interval + +%type <interval_time_st> interval_time_stamp + +%type <db_type> storage_engines known_storage_engines + +%type <row_type> row_types + +%type <tx_isolation> isolation_types + +%type <ha_rkey_mode> handler_rkey_mode + +%type <Lex_cast_type> cast_type cast_type_numeric cast_type_temporal + +%type <Lex_length_and_dec> precision opt_precision float_options + opt_field_length_default_sp_param_varchar + opt_field_length_default_sp_param_char + +%type <lex_user> user grant_user grant_role user_or_role current_role + admin_option_for_role user_maybe_role + +%type <charset> + opt_collate + charset_name + charset_or_alias + charset_name_or_default + old_or_new_charset_name + old_or_new_charset_name_or_default + collation_name + collation_name_or_default + opt_load_data_charset + UNDERSCORE_CHARSET + +%type <select_lex> subselect + get_select_lex get_select_lex_derived + simple_table + query_specification + query_term_union_not_ready + query_term_union_ready + query_expression_body + select_paren_derived + table_value_constructor + +%type <boolfunc2creator> comp_op + +%type <dyncol_def> dyncall_create_element + +%type <dyncol_def_list> dyncall_create_list + +%type <myvar> select_outvar + +%type <virtual_column> opt_check_constraint check_constraint virtual_column_func + column_default_expr +%type <unit_type> unit_type_decl + +%type <NONE> + analyze_stmt_command + query verb_clause create change select do drop insert replace insert2 + insert_values update delete truncate rename compound_statement + show describe load alter optimize keycache preload flush + reset purge begin_stmt_mariadb commit rollback savepoint release + slave master_def master_defs master_file_def slave_until_opts + repair analyze opt_with_admin opt_with_admin_option + analyze_table_list analyze_table_elem_spec + opt_persistent_stat_clause persistent_stat_spec + persistent_column_stat_spec persistent_index_stat_spec + table_column_list table_index_list table_index_name + check start checksum + field_list field_list_item kill key_def constraint_def + keycache_list keycache_list_or_parts assign_to_keycache + assign_to_keycache_parts + preload_list preload_list_or_parts preload_keys preload_keys_parts + select_item_list select_item values_list no_braces + opt_limit_clause delete_limit_clause fields opt_values values + no_braces_with_names opt_values_with_names values_with_names + procedure_list procedure_list2 procedure_item + field_def handler opt_generated_always + opt_ignore opt_column opt_restrict + grant revoke set lock unlock string_list field_options + opt_binary table_lock_list table_lock + ref_list opt_match_clause opt_on_update_delete use + opt_delete_options opt_delete_option varchar nchar nvarchar + opt_outer table_list table_name table_alias_ref_list table_alias_ref + opt_attribute opt_attribute_list attribute column_list column_list_id + opt_column_list grant_privileges grant_ident grant_list grant_option + object_privilege object_privilege_list user_list user_and_role_list + rename_list table_or_tables + clear_privileges flush_options flush_option + opt_flush_lock flush_lock flush_options_list + equal optional_braces + opt_mi_check_type opt_to mi_check_types + table_to_table_list table_to_table opt_table_list opt_as + handler_rkey_function handler_read_or_scan + single_multi table_wild_list table_wild_one opt_wild + union_clause union_list + subselect_start opt_and charset + subselect_end select_var_list select_var_list_init help + opt_extended_describe shutdown + opt_format_json + prepare prepare_src execute deallocate + statement + sp_c_chistics sp_a_chistics sp_chistic sp_c_chistic xa + opt_field_or_var_spec fields_or_vars opt_load_data_set_spec + view_list_opt view_list view_select + trigger_tail sp_tail sf_tail event_tail + udf_tail create_function_tail + install uninstall partition_entry binlog_base64_event + normal_key_options normal_key_opts all_key_opt + spatial_key_options fulltext_key_options normal_key_opt + fulltext_key_opt spatial_key_opt fulltext_key_opts spatial_key_opts + keep_gcc_happy + key_using_alg + part_column_list + period_for_system_time + server_def server_options_list server_option + definer_opt no_definer definer get_diagnostics + parse_vcol_expr vcol_opt_specifier vcol_opt_attribute + vcol_opt_attribute_list vcol_attribute + opt_serial_attribute opt_serial_attribute_list serial_attribute + explainable_command + opt_lock_wait_timeout + opt_delete_gtid_domain + asrow_attribute + set_assign + sf_tail_standalone + sp_tail_standalone + opt_constraint_no_id +END_OF_INPUT + +%type <NONE> call sp_proc_stmts sp_proc_stmts1 sp_proc_stmt +%type <NONE> sp_proc_stmt_statement sp_proc_stmt_return +%type <NONE> sp_proc_stmt_compound_ok +%type <NONE> sp_proc_stmt_if +%type <NONE> sp_labeled_control sp_unlabeled_control +%type <NONE> sp_labeled_block sp_unlabeled_block +%type <NONE> sp_labelable_stmt +%type <NONE> sp_proc_stmt_continue_oracle +%type <NONE> sp_proc_stmt_exit_oracle +%type <NONE> sp_proc_stmt_leave +%type <NONE> sp_proc_stmt_iterate +%type <NONE> sp_proc_stmt_goto_oracle +%type <NONE> sp_proc_stmt_open sp_proc_stmt_fetch sp_proc_stmt_close +%type <NONE> case_stmt_specification +%type <NONE> loop_body while_body repeat_body + +%type <num> view_algorithm view_check_option +%type <view_suid> view_suid opt_view_suid + +%type <plsql_cursor_attr> plsql_cursor_attr +%type <sp_suid> sp_suid + +%type <num> sp_decl_idents sp_decl_idents_init_vars +%type <num> sp_handler_type sp_hcond_list +%type <spcondvalue> sp_cond sp_hcond sqlstate signal_value opt_signal_value +%type <spblock> sp_decl_body_list opt_sp_decl_body_list +%type <spblock> sp_decl_vars +%type <spblock> sp_decl_non_handler sp_decl_non_handler_list +%type <spblock> sp_decl_handler sp_decl_handler_list opt_sp_decl_handler_list +%type <spblock> package_implementation_routine_definition +%type <spblock> package_implementation_item_declaration +%type <spblock> package_implementation_declare_section +%type <spblock> package_implementation_declare_section_list1 +%type <spblock> package_implementation_declare_section_list2 +%type <spblock_handlers> sp_block_statements_and_exceptions +%type <spblock_handlers> package_implementation_executable_section +%type <sp_instr_addr> sp_instr_addr +%type <num> opt_exception_clause exception_handlers +%type <lex> remember_lex package_routine_lex + package_specification_function + package_specification_procedure +%type <spname> sp_name opt_sp_name +%type <spvar> sp_param_name sp_param_name_and_type +%type <for_loop> sp_for_loop_index_and_bounds +%type <for_loop_bounds> sp_for_loop_bounds +%type <trim> trim_operands +%type <num> opt_sp_for_loop_direction +%type <spvar_mode> sp_opt_inout +%type <index_hint> index_hint_type +%type <num> index_hint_clause normal_join inner_join +%type <filetype> data_or_xml + +%type <NONE> signal_stmt resignal_stmt raise_stmt_oracle +%type <diag_condition_item_name> signal_condition_information_item_name + +%type <trg_execution_order> trigger_follows_precedes_clause; +%type <trigger_action_order_type> trigger_action_order; + +%type <diag_area> which_area; +%type <diag_info> diagnostics_information; +%type <stmt_info_item> statement_information_item; +%type <stmt_info_item_name> statement_information_item_name; +%type <stmt_info_list> statement_information; +%type <cond_info_item> condition_information_item; +%type <cond_info_item_name> condition_information_item_name; +%type <cond_info_list> condition_information; + +%type <spvar_definition> row_field_name row_field_definition +%type <spvar_definition_list> row_field_definition_list row_type_body + +%type <NONE> opt_window_clause window_def_list window_def window_spec +%type <lex_str_ptr> window_name +%type <NONE> opt_window_ref opt_window_frame_clause +%type <frame_units> window_frame_units; +%type <NONE> window_frame_extent; +%type <frame_exclusion> opt_window_frame_exclusion; +%type <window_frame_bound> window_frame_start window_frame_bound; + +%type <NONE> + '-' '+' '*' '/' '%' '(' ')' + ',' '!' '{' '}' '&' '|' AND_SYM OR_SYM BETWEEN_SYM CASE_SYM + THEN_SYM WHEN_SYM DIV_SYM MOD_SYM OR2_SYM AND_AND_SYM DELETE_SYM + MYSQL_CONCAT_SYM ORACLE_CONCAT_SYM + +%type <with_clause> opt_with_clause with_clause + +%type <lex_str_ptr> query_name + +%type <lex_str_list> opt_with_column_list + +%type <vers_range_unit> opt_history_unit +%type <vers_history_point> history_point +%type <vers_column_versioning> with_or_without_system +%% + + +/* + Indentation of grammar rules: + +rule: <-- starts at col 1 + rule1a rule1b rule1c <-- starts at col 11 + { <-- starts at col 11 + code <-- starts at col 13, indentation is 2 spaces + } + | rule2a rule2b + { + code + } + ; <-- on a line by itself, starts at col 9 + + Also, please do not use any <TAB>, but spaces. + Having a uniform indentation in this file helps + code reviews, patches, merges, and make maintenance easier. + Tip: grep [[:cntrl:]] sql_yacc.yy + Thanks. +*/ + +query: + END_OF_INPUT + { + if (likely(!thd->bootstrap) && + unlikely(!(thd->lex->select_lex.options & OPTION_FOUND_COMMENT))) + my_yyabort_error((ER_EMPTY_QUERY, MYF(0))); + + thd->lex->sql_command= SQLCOM_EMPTY_QUERY; + YYLIP->found_semicolon= NULL; + } + | verb_clause + { + Lex_input_stream *lip = YYLIP; + + if ((thd->client_capabilities & CLIENT_MULTI_QUERIES) && + lip->multi_statements && + ! lip->eof()) + { + /* + We found a well formed query, and multi queries are allowed: + - force the parser to stop after the ';' + - mark the start of the next query for the next invocation + of the parser. + */ + lip->next_state= MY_LEX_END; + lip->found_semicolon= lip->get_ptr(); + } + else + { + /* Single query, terminated. */ + lip->found_semicolon= NULL; + } + } + ';' + opt_end_of_input + | verb_clause END_OF_INPUT + { + /* Single query, not terminated. */ + YYLIP->found_semicolon= NULL; + } + ; + +opt_end_of_input: + /* empty */ + | END_OF_INPUT + ; + +verb_clause: + statement + | begin_stmt_mariadb + | compound_statement + ; + +/* Verb clauses, except begin and compound_statement */ +statement: + alter + | analyze + | analyze_stmt_command + | binlog_base64_event + | call + | change + | check + | checksum + | commit + | create + | deallocate + | delete + | describe + | do + | drop + | execute + | flush + | get_diagnostics + | grant + | handler + | help + | insert + | install + | keep_gcc_happy + | keycache + | kill + | load + | lock + | optimize + | parse_vcol_expr + | partition_entry + | preload + | prepare + | purge + | raise_stmt_oracle + | release + | rename + | repair + | replace + | reset + | resignal_stmt + | revoke + | rollback + | savepoint + | select + | set + | set_assign + | signal_stmt + | show + | shutdown + | slave + | start + | truncate + | uninstall + | unlock + | update + | use + | xa + ; + +deallocate: + deallocate_or_drop PREPARE_SYM ident + { + LEX *lex= thd->lex; + lex->sql_command= SQLCOM_DEALLOCATE_PREPARE; + lex->prepared_stmt_name= $3; + } + ; + +deallocate_or_drop: + DEALLOCATE_SYM + | DROP + ; + +prepare: + PREPARE_SYM ident FROM prepare_src + { + LEX *lex= thd->lex; + if (unlikely(lex->table_or_sp_used())) + my_yyabort_error((ER_SUBQUERIES_NOT_SUPPORTED, MYF(0), + "PREPARE..FROM")); + lex->sql_command= SQLCOM_PREPARE; + lex->prepared_stmt_name= $2; + } + ; + +prepare_src: + { Lex->expr_allows_subselect= false; } + expr + { + Lex->prepared_stmt_code= $2; + Lex->expr_allows_subselect= true; + } + ; + +execute: + EXECUTE_SYM ident + { + LEX *lex= thd->lex; + lex->sql_command= SQLCOM_EXECUTE; + lex->prepared_stmt_name= $2; + } + execute_using + {} + | EXECUTE_SYM IMMEDIATE_SYM prepare_src + { + if (unlikely(Lex->table_or_sp_used())) + my_yyabort_error((ER_SUBQUERIES_NOT_SUPPORTED, MYF(0), + "EXECUTE IMMEDIATE")); + Lex->sql_command= SQLCOM_EXECUTE_IMMEDIATE; + } + execute_using + {} + ; + +execute_using: + /* nothing */ + | USING { Lex->expr_allows_subselect= false; } + execute_var_list + { + if (unlikely(Lex->table_or_sp_used())) + my_yyabort_error((ER_SUBQUERIES_NOT_SUPPORTED, MYF(0), + "EXECUTE..USING")); + Lex->expr_allows_subselect= true; + } + ; + +execute_var_list: + execute_var_list ',' execute_var_ident + | execute_var_ident + ; + +execute_var_ident: + expr_or_default + { + if (unlikely(Lex->prepared_stmt_params.push_back($1, + thd->mem_root))) + MYSQL_YYABORT; + } + ; + +/* help */ + +help: + HELP_SYM + { + if (unlikely(Lex->sphead)) + my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "HELP")); + } + ident_or_text + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_HELP; + lex->help_arg= $3.str; + } + ; + +/* change master */ + +change: + CHANGE MASTER_SYM optional_connection_name TO_SYM + { + Lex->sql_command = SQLCOM_CHANGE_MASTER; + } + master_defs + {} + ; + +master_defs: + master_def + | master_defs ',' master_def + ; + +master_def: + MASTER_HOST_SYM '=' TEXT_STRING_sys + { + Lex->mi.host = $3.str; + } + | MASTER_USER_SYM '=' TEXT_STRING_sys + { + Lex->mi.user = $3.str; + } + | MASTER_PASSWORD_SYM '=' TEXT_STRING_sys + { + Lex->mi.password = $3.str; + } + | MASTER_PORT_SYM '=' ulong_num + { + Lex->mi.port = $3; + } + | MASTER_CONNECT_RETRY_SYM '=' ulong_num + { + Lex->mi.connect_retry = $3; + } + | MASTER_DELAY_SYM '=' ulong_num + { + if ($3 > MASTER_DELAY_MAX) + { + my_error(ER_MASTER_DELAY_VALUE_OUT_OF_RANGE, MYF(0), + (ulong) $3, (ulong) MASTER_DELAY_MAX); + } + else + Lex->mi.sql_delay = $3; + } + | MASTER_SSL_SYM '=' ulong_num + { + Lex->mi.ssl= $3 ? + LEX_MASTER_INFO::LEX_MI_ENABLE : LEX_MASTER_INFO::LEX_MI_DISABLE; + } + | MASTER_SSL_CA_SYM '=' TEXT_STRING_sys + { + Lex->mi.ssl_ca= $3.str; + } + | MASTER_SSL_CAPATH_SYM '=' TEXT_STRING_sys + { + Lex->mi.ssl_capath= $3.str; + } + | MASTER_SSL_CERT_SYM '=' TEXT_STRING_sys + { + Lex->mi.ssl_cert= $3.str; + } + | MASTER_SSL_CIPHER_SYM '=' TEXT_STRING_sys + { + Lex->mi.ssl_cipher= $3.str; + } + | MASTER_SSL_KEY_SYM '=' TEXT_STRING_sys + { + Lex->mi.ssl_key= $3.str; + } + | MASTER_SSL_VERIFY_SERVER_CERT_SYM '=' ulong_num + { + Lex->mi.ssl_verify_server_cert= $3 ? + LEX_MASTER_INFO::LEX_MI_ENABLE : LEX_MASTER_INFO::LEX_MI_DISABLE; + } + | MASTER_SSL_CRL_SYM '=' TEXT_STRING_sys + { + Lex->mi.ssl_crl= $3.str; + } + | MASTER_SSL_CRLPATH_SYM '=' TEXT_STRING_sys + { + Lex->mi.ssl_crlpath= $3.str; + } + + | MASTER_HEARTBEAT_PERIOD_SYM '=' NUM_literal + { + Lex->mi.heartbeat_period= (float) $3->val_real(); + if (unlikely(Lex->mi.heartbeat_period > + SLAVE_MAX_HEARTBEAT_PERIOD) || + unlikely(Lex->mi.heartbeat_period < 0.0)) + my_yyabort_error((ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE, MYF(0), + SLAVE_MAX_HEARTBEAT_PERIOD)); + + if (unlikely(Lex->mi.heartbeat_period > slave_net_timeout)) + { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX, + ER_THD(thd, ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX)); + } + if (unlikely(Lex->mi.heartbeat_period < 0.001)) + { + if (unlikely(Lex->mi.heartbeat_period != 0.0)) + { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN, + ER_THD(thd, ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN)); + Lex->mi.heartbeat_period= 0.0; + } + Lex->mi.heartbeat_opt= LEX_MASTER_INFO::LEX_MI_DISABLE; + } + Lex->mi.heartbeat_opt= LEX_MASTER_INFO::LEX_MI_ENABLE; + } + | IGNORE_SERVER_IDS_SYM '=' '(' ignore_server_id_list ')' + { + Lex->mi.repl_ignore_server_ids_opt= LEX_MASTER_INFO::LEX_MI_ENABLE; + } + | DO_DOMAIN_IDS_SYM '=' '(' do_domain_id_list ')' + { + Lex->mi.repl_do_domain_ids_opt= LEX_MASTER_INFO::LEX_MI_ENABLE; + } + | IGNORE_DOMAIN_IDS_SYM '=' '(' ignore_domain_id_list ')' + { + Lex->mi.repl_ignore_domain_ids_opt= LEX_MASTER_INFO::LEX_MI_ENABLE; + } + | + master_file_def + ; + +ignore_server_id_list: + /* Empty */ + | ignore_server_id + | ignore_server_id_list ',' ignore_server_id + ; + +ignore_server_id: + ulong_num + { + insert_dynamic(&Lex->mi.repl_ignore_server_ids, (uchar*) &($1)); + } + ; + +do_domain_id_list: + /* Empty */ + | do_domain_id + | do_domain_id_list ',' do_domain_id + ; + +do_domain_id: + ulong_num + { + insert_dynamic(&Lex->mi.repl_do_domain_ids, (uchar*) &($1)); + } + ; + +ignore_domain_id_list: + /* Empty */ + | ignore_domain_id + | ignore_domain_id_list ',' ignore_domain_id + ; + +ignore_domain_id: + ulong_num + { + insert_dynamic(&Lex->mi.repl_ignore_domain_ids, (uchar*) &($1)); + } + ; + +master_file_def: + MASTER_LOG_FILE_SYM '=' TEXT_STRING_sys + { + Lex->mi.log_file_name = $3.str; + } + | MASTER_LOG_POS_SYM '=' ulonglong_num + { + /* + If the user specified a value < BIN_LOG_HEADER_SIZE, adjust it + instead of causing subsequent errors. + We need to do it in this file, because only there we know that + MASTER_LOG_POS has been explicitly specified. On the contrary + in change_master() (sql_repl.cc) we cannot distinguish between 0 + (MASTER_LOG_POS explicitly specified as 0) and 0 (unspecified), + whereas we want to distinguish (specified 0 means "read the binlog + from 0" (4 in fact), unspecified means "don't change the position + (keep the preceding value)"). + */ + Lex->mi.pos= MY_MAX(BIN_LOG_HEADER_SIZE, $3); + } + | RELAY_LOG_FILE_SYM '=' TEXT_STRING_sys + { + Lex->mi.relay_log_name = $3.str; + } + | RELAY_LOG_POS_SYM '=' ulong_num + { + Lex->mi.relay_log_pos = $3; + /* Adjust if < BIN_LOG_HEADER_SIZE (same comment as Lex->mi.pos) */ + Lex->mi.relay_log_pos= MY_MAX(BIN_LOG_HEADER_SIZE, Lex->mi.relay_log_pos); + } + | MASTER_USE_GTID_SYM '=' CURRENT_POS_SYM + { + if (unlikely(Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED)) + my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MASTER_use_gtid")); + Lex->mi.use_gtid_opt= LEX_MASTER_INFO::LEX_GTID_CURRENT_POS; + } + | MASTER_USE_GTID_SYM '=' SLAVE_POS_SYM + { + if (unlikely(Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED)) + my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MASTER_use_gtid")); + Lex->mi.use_gtid_opt= LEX_MASTER_INFO::LEX_GTID_SLAVE_POS; + } + | MASTER_USE_GTID_SYM '=' NO_SYM + { + if (unlikely(Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED)) + my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MASTER_use_gtid")); + Lex->mi.use_gtid_opt= LEX_MASTER_INFO::LEX_GTID_NO; + } + ; + +optional_connection_name: + /* empty */ + { + LEX *lex= thd->lex; + lex->mi.connection_name= null_clex_str; + } + | connection_name + ; + +connection_name: + TEXT_STRING_sys + { + Lex->mi.connection_name= $1; +#ifdef HAVE_REPLICATION + if (unlikely(check_master_connection_name(&$1))) + my_yyabort_error((ER_WRONG_ARGUMENTS, MYF(0), "MASTER_CONNECTION_NAME")); +#endif + } + ; + +/* create a table */ + +create: + create_or_replace opt_temporary TABLE_SYM opt_if_not_exists table_ident + { + LEX *lex= thd->lex; + lex->create_info.init(); + if (unlikely(lex->set_command_with_check(SQLCOM_CREATE_TABLE, $2, + $1 | $4))) + MYSQL_YYABORT; + if (unlikely(!lex->select_lex.add_table_to_list(thd, $5, NULL, + TL_OPTION_UPDATING, + TL_WRITE, + MDL_EXCLUSIVE))) + MYSQL_YYABORT; + lex->alter_info.reset(); + /* + For CREATE TABLE we should not open the table even if it exists. + If the table exists, we should either not create it or replace it + */ + lex->query_tables->open_strategy= TABLE_LIST::OPEN_STUB; + lex->create_info.default_table_charset= NULL; + lex->name= null_clex_str; + lex->create_last_non_select_table= lex->last_table(); + } + create_body + { + LEX *lex= thd->lex; + lex->current_select= &lex->select_lex; + if ((lex->create_info.used_fields & HA_CREATE_USED_ENGINE) && + !lex->create_info.db_type) + { + lex->create_info.use_default_db_type(thd); + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_WARN_USING_OTHER_HANDLER, + ER_THD(thd, ER_WARN_USING_OTHER_HANDLER), + hton_name(lex->create_info.db_type)->str, + $5->table.str); + } + create_table_set_open_action_and_adjust_tables(lex); + } + | create_or_replace opt_temporary SEQUENCE_SYM opt_if_not_exists table_ident + { + LEX *lex= thd->lex; + lex->create_info.init(); + if (unlikely(lex->set_command_with_check(SQLCOM_CREATE_SEQUENCE, $2, + $1 | $4))) + MYSQL_YYABORT; + + if (unlikely(!lex->select_lex.add_table_to_list(thd, $5, NULL, + TL_OPTION_UPDATING, + TL_WRITE, + MDL_EXCLUSIVE))) + MYSQL_YYABORT; + + /* + For CREATE TABLE, an non-existing table is not an error. + Instruct open_tables() to just take an MDL lock if the + table does not exist. + */ + lex->alter_info.reset(); + lex->query_tables->open_strategy= TABLE_LIST::OPEN_STUB; + lex->name= null_clex_str; + lex->create_last_non_select_table= lex->last_table(); + if (unlikely(!(lex->create_info.seq_create_info= + new (thd->mem_root) sequence_definition()))) + MYSQL_YYABORT; + } + opt_sequence opt_create_table_options + { + LEX *lex= thd->lex; + + if (unlikely(lex->create_info.seq_create_info->check_and_adjust(1))) + { + my_error(ER_SEQUENCE_INVALID_DATA, MYF(0), + lex->select_lex.table_list.first->db.str, + lex->select_lex.table_list.first->table_name.str); + MYSQL_YYABORT; + } + + /* No fields specified, generate them */ + if (unlikely(prepare_sequence_fields(thd, + &lex->alter_info.create_list))) + MYSQL_YYABORT; + + /* CREATE SEQUENCE always creates a sequence */ + Lex->create_info.used_fields|= HA_CREATE_USED_SEQUENCE; + Lex->create_info.sequence= 1; + + lex->current_select= &lex->select_lex; + if (unlikely((lex->create_info.used_fields & + HA_CREATE_USED_ENGINE) && + !lex->create_info.db_type)) + { + lex->create_info.use_default_db_type(thd); + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_WARN_USING_OTHER_HANDLER, + ER_THD(thd, ER_WARN_USING_OTHER_HANDLER), + hton_name(lex->create_info.db_type)->str, + $5->table.str); + } + create_table_set_open_action_and_adjust_tables(lex); + } + | create_or_replace opt_unique INDEX_SYM opt_if_not_exists ident + opt_key_algorithm_clause + ON table_ident + { + if (unlikely(Lex->add_create_index_prepare($8))) + MYSQL_YYABORT; + if (unlikely(Lex->add_create_index($2, &$5, $6, $1 | $4))) + MYSQL_YYABORT; + } + '(' key_list ')' opt_lock_wait_timeout normal_key_options + opt_index_lock_algorithm { } + | create_or_replace fulltext INDEX_SYM opt_if_not_exists ident + ON table_ident + { + if (unlikely(Lex->add_create_index_prepare($7))) + MYSQL_YYABORT; + if (unlikely(Lex->add_create_index($2, &$5, HA_KEY_ALG_UNDEF, + $1 | $4))) + MYSQL_YYABORT; + } + '(' key_list ')' opt_lock_wait_timeout fulltext_key_options + opt_index_lock_algorithm { } + | create_or_replace spatial INDEX_SYM opt_if_not_exists ident + ON table_ident + { + if (unlikely(Lex->add_create_index_prepare($7))) + MYSQL_YYABORT; + if (unlikely(Lex->add_create_index($2, &$5, HA_KEY_ALG_UNDEF, + $1 | $4))) + MYSQL_YYABORT; + } + '(' key_list ')' opt_lock_wait_timeout spatial_key_options + opt_index_lock_algorithm { } + | create_or_replace DATABASE opt_if_not_exists ident + { + Lex->create_info.default_table_charset= NULL; + Lex->create_info.used_fields= 0; + } + opt_create_database_options + { + LEX *lex=Lex; + if (unlikely(lex->set_command_with_check(SQLCOM_CREATE_DB, 0, + $1 | $3))) + MYSQL_YYABORT; + lex->name= $4; + } + | create_or_replace definer_opt opt_view_suid VIEW_SYM + opt_if_not_exists table_ident + { + if (unlikely(Lex->add_create_view(thd, $1 | $5, + DTYPE_ALGORITHM_UNDEFINED, $3, + $6))) + MYSQL_YYABORT; + } + view_list_opt AS view_select + { } + | create_or_replace view_algorithm definer_opt opt_view_suid VIEW_SYM + opt_if_not_exists table_ident + { + if (unlikely(Lex->add_create_view(thd, $1 | $6, $2, $4, $7))) + MYSQL_YYABORT; + } + view_list_opt AS view_select + { } + | create_or_replace definer_opt TRIGGER_SYM + { Lex->create_info.set($1); } + trigger_tail + { } + | create_or_replace definer_opt PROCEDURE_SYM + { Lex->create_info.set($1); } + sp_tail_standalone + { } + | create_or_replace definer_opt EVENT_SYM + { Lex->create_info.set($1); } + event_tail + { } + | create_or_replace definer FUNCTION_SYM + { Lex->create_info.set($1); } + sf_tail_standalone + { } + | create_or_replace no_definer FUNCTION_SYM + { Lex->create_info.set($1); } + create_function_tail + { } + | create_or_replace no_definer AGGREGATE_SYM FUNCTION_SYM + { + Lex->create_info.set($1); + Lex->udf.type= UDFTYPE_AGGREGATE; + } + udf_tail + { } + | create_or_replace USER_SYM opt_if_not_exists clear_privileges grant_list + opt_require_clause opt_resource_options + { + if (unlikely(Lex->set_command_with_check(SQLCOM_CREATE_USER, + $1 | $3))) + MYSQL_YYABORT; + } + | create_or_replace ROLE_SYM opt_if_not_exists + clear_privileges role_list opt_with_admin + { + if (unlikely(Lex->set_command_with_check(SQLCOM_CREATE_ROLE, + $1 | $3))) + MYSQL_YYABORT; + } + | CREATE LOGFILE_SYM GROUP_SYM logfile_group_info + { + Lex->alter_tablespace_info->ts_cmd_type= CREATE_LOGFILE_GROUP; + } + | CREATE TABLESPACE tablespace_info + { + Lex->alter_tablespace_info->ts_cmd_type= CREATE_TABLESPACE; + } + | create_or_replace { Lex->set_command(SQLCOM_CREATE_SERVER, $1); } + server_def + { } + | create_or_replace definer_opt PACKAGE_ORACLE_SYM + opt_if_not_exists sp_name opt_create_package_chistics_init + sp_tail_is + remember_name + { + sp_package *pkg; + if (unlikely(!(pkg= Lex-> + create_package_start(thd, + SQLCOM_CREATE_PACKAGE, + &sp_handler_package_spec, + $5, $1 | $4)))) + MYSQL_YYABORT; + pkg->set_chistics(Lex->sp_chistics); + } + opt_package_specification_element_list END + remember_end_opt opt_sp_name + { + if (unlikely(Lex->create_package_finalize(thd, $5, $13, $8, $12))) + MYSQL_YYABORT; + } + | create_or_replace definer_opt PACKAGE_ORACLE_SYM BODY_ORACLE_SYM + opt_if_not_exists sp_name opt_create_package_chistics_init + sp_tail_is + remember_name + { + sp_package *pkg; + if (unlikely(!(pkg= Lex-> + create_package_start(thd, + SQLCOM_CREATE_PACKAGE_BODY, + &sp_handler_package_body, + $6, $1 | $5)))) + MYSQL_YYABORT; + pkg->set_chistics(Lex->sp_chistics); + Lex->sp_block_init(thd); + } + package_implementation_declare_section + { + if (unlikely(Lex->sp_block_with_exceptions_finalize_declarations(thd))) + MYSQL_YYABORT; + } + package_implementation_executable_section + { + $11.hndlrs+= $13.hndlrs; + if (unlikely(Lex->sp_block_finalize(thd, $11))) + MYSQL_YYABORT; + } + remember_end_opt opt_sp_name + { + if (unlikely(Lex->create_package_finalize(thd, $6, $16, $9, $15))) + MYSQL_YYABORT; + } + ; + +package_implementation_executable_section: + END + { + if (unlikely(Lex->sp_block_with_exceptions_add_empty(thd))) + MYSQL_YYABORT; + $$.init(0); + } + | BEGIN_ORACLE_SYM sp_block_statements_and_exceptions END { $$= $2; } + ; + +/* + Inside CREATE PACKAGE BODY, package-wide items (e.g. variables) + must be declared before routine definitions. +*/ +package_implementation_declare_section: + package_implementation_declare_section_list1 + | package_implementation_declare_section_list2 + | package_implementation_declare_section_list1 + package_implementation_declare_section_list2 + { $$.join($1, $2); } + ; + +package_implementation_declare_section_list1: + package_implementation_item_declaration + | package_implementation_declare_section_list1 + package_implementation_item_declaration + { $$.join($1, $2); } + ; + +package_implementation_declare_section_list2: + package_implementation_routine_definition + | package_implementation_declare_section_list2 + package_implementation_routine_definition + { $$.join($1, $2); } + ; + +package_routine_lex: + { + if (unlikely(!($$= new (thd->mem_root) + sp_lex_local(thd, thd->lex)))) + MYSQL_YYABORT; + thd->m_parser_state->m_yacc.reset_before_substatement(); + } + ; + + +package_specification_function: + remember_lex package_routine_lex ident + { + DBUG_ASSERT($1->sphead->get_package()); + $2->sql_command= SQLCOM_CREATE_FUNCTION; + sp_name *spname= $1->make_sp_name_package_routine(thd, &$3); + if (unlikely(!spname)) + MYSQL_YYABORT; + thd->lex= $2; + if (unlikely(!$2->make_sp_head_no_recursive(thd, spname, + &sp_handler_package_function))) + MYSQL_YYABORT; + $1->sphead->get_package()->m_current_routine= $2; + (void) is_native_function_with_warn(thd, &$3); + } + opt_sp_parenthesized_fdparam_list + sf_return_type + sp_c_chistics + { + sp_head *sp= thd->lex->sphead; + sp->restore_thd_mem_root(thd); + thd->lex= $1; + $$= $2; + } + ; + +package_specification_procedure: + remember_lex package_routine_lex ident + { + DBUG_ASSERT($1->sphead->get_package()); + $2->sql_command= SQLCOM_CREATE_PROCEDURE; + sp_name *spname= $1->make_sp_name_package_routine(thd, &$3); + if (unlikely(!spname)) + MYSQL_YYABORT; + thd->lex= $2; + if (unlikely(!$2->make_sp_head_no_recursive(thd, spname, + &sp_handler_package_procedure))) + MYSQL_YYABORT; + $1->sphead->get_package()->m_current_routine= $2; + } + opt_sp_parenthesized_pdparam_list + sp_c_chistics + { + sp_head *sp= thd->lex->sphead; + sp->restore_thd_mem_root(thd); + thd->lex= $1; + $$= $2; + + } + ; + + +package_implementation_routine_definition: + FUNCTION_SYM package_specification_function + package_implementation_function_body ';' + { + sp_package *pkg= Lex->get_sp_package(); + if (unlikely(pkg->add_routine_implementation($2))) + MYSQL_YYABORT; + pkg->m_current_routine= NULL; + $$.init(); + } + | PROCEDURE_SYM package_specification_procedure + package_implementation_procedure_body ';' + { + sp_package *pkg= Lex->get_sp_package(); + if (unlikely(pkg->add_routine_implementation($2))) + MYSQL_YYABORT; + pkg->m_current_routine= NULL; + $$.init(); + } + | package_specification_element { $$.init(); } + ; + + +package_implementation_function_body: + sp_tail_is remember_lex + { + sp_package *pkg= Lex->get_sp_package(); + sp_head *sp= pkg->m_current_routine->sphead; + thd->lex= pkg->m_current_routine; + sp->reset_thd_mem_root(thd); + sp->set_body_start(thd, YYLIP->get_cpp_tok_start()); + } + sp_body opt_package_routine_end_name + { + if (unlikely(Lex->sphead->m_flags & sp_head::HAS_AGGREGATE_INSTR)) + { + my_yyabort_error((ER_NOT_AGGREGATE_FUNCTION, MYF(0))); + } + Lex->sphead->set_chistics_agg_type(NOT_AGGREGATE); + if (unlikely(thd->lex->sp_body_finalize_function(thd) || + thd->lex->sphead->check_package_routine_end_name($5))) + MYSQL_YYABORT; + thd->lex= $2; + } + ; + +package_implementation_procedure_body: + sp_tail_is remember_lex + { + sp_package *pkg= Lex->get_sp_package(); + sp_head *sp= pkg->m_current_routine->sphead; + thd->lex= pkg->m_current_routine; + sp->reset_thd_mem_root(thd); + sp->set_body_start(thd, YYLIP->get_cpp_tok_start()); + } + sp_body opt_package_routine_end_name + { + if (unlikely(thd->lex->sp_body_finalize_procedure(thd) || + thd->lex->sphead->check_package_routine_end_name($5))) + MYSQL_YYABORT; + thd->lex= $2; + } + ; + + +package_implementation_item_declaration: + sp_decl_vars ';' + ; + +opt_package_specification_element_list: + /* Empty */ + | package_specification_element_list + ; + +package_specification_element_list: + package_specification_element + | package_specification_element_list package_specification_element + ; + +package_specification_element: + FUNCTION_SYM package_specification_function ';' + { + sp_package *pkg= Lex->get_sp_package(); + if (unlikely(pkg->add_routine_declaration($2))) + MYSQL_YYABORT; + pkg->m_current_routine= NULL; + } + | PROCEDURE_SYM package_specification_procedure ';' + { + sp_package *pkg= Lex->get_sp_package(); + if (unlikely(pkg->add_routine_declaration($2))) + MYSQL_YYABORT; + pkg->m_current_routine= NULL; + } + ; + +create_function_tail: + sf_tail_standalone { } + | udf_tail { Lex->udf.type= UDFTYPE_FUNCTION; } + ; + +opt_sequence: + /* empty */ { } + | sequence_defs + ; + +sequence_defs: + sequence_def + | sequence_defs sequence_def + ; + +sequence_def: + MINVALUE_SYM opt_equal longlong_num + { + Lex->create_info.seq_create_info->min_value= $3; + Lex->create_info.seq_create_info->used_fields|= seq_field_used_min_value; + } + | NO_SYM MINVALUE_SYM + { + if (unlikely(Lex->create_info.seq_create_info->used_fields & seq_field_used_min_value)) + my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MINVALUE")); + Lex->create_info.seq_create_info->used_fields|= seq_field_used_min_value; + } + | NOMINVALUE_SYM + { + if (unlikely(Lex->create_info.seq_create_info->used_fields & seq_field_used_min_value)) + my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MINVALUE")); + Lex->create_info.seq_create_info->used_fields|= seq_field_used_min_value; + } + | MAXVALUE_SYM opt_equal longlong_num + { + if (unlikely(Lex->create_info.seq_create_info->used_fields & + seq_field_used_max_value)) + my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MAXVALUE")); + Lex->create_info.seq_create_info->max_value= $3; + Lex->create_info.seq_create_info->used_fields|= seq_field_used_max_value; + } + | NO_SYM MAXVALUE_SYM + { + if (unlikely(Lex->create_info.seq_create_info->used_fields & seq_field_used_max_value)) + my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MAXVALUE")); + Lex->create_info.seq_create_info->used_fields|= seq_field_used_max_value; + } + | NOMAXVALUE_SYM + { + if (unlikely(Lex->create_info.seq_create_info->used_fields & seq_field_used_max_value)) + my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MAXVALUE")); + Lex->create_info.seq_create_info->used_fields|= seq_field_used_max_value; + } + | START_SYM opt_with longlong_num + { + if (unlikely(Lex->create_info.seq_create_info->used_fields & + seq_field_used_start)) + my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "START")); + Lex->create_info.seq_create_info->start= $3; + Lex->create_info.seq_create_info->used_fields|= seq_field_used_start; + } + | INCREMENT_SYM opt_by longlong_num + { + if (unlikely(Lex->create_info.seq_create_info->used_fields & + seq_field_used_increment)) + my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "INCREMENT")); + Lex->create_info.seq_create_info->increment= $3; + Lex->create_info.seq_create_info->used_fields|= seq_field_used_increment; + } + | CACHE_SYM opt_equal longlong_num + { + if (unlikely(Lex->create_info.seq_create_info->used_fields & + seq_field_used_cache)) + my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CACHE")); + Lex->create_info.seq_create_info->cache= $3; + Lex->create_info.seq_create_info->used_fields|= seq_field_used_cache; + } + | NOCACHE_SYM + { + if (unlikely(Lex->create_info.seq_create_info->used_fields & + seq_field_used_cache)) + my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CACHE")); + Lex->create_info.seq_create_info->cache= 0; + Lex->create_info.seq_create_info->used_fields|= seq_field_used_cache; + } + | CYCLE_SYM + { + if (unlikely(Lex->create_info.seq_create_info->used_fields & + seq_field_used_cycle)) + my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CYCLE")); + Lex->create_info.seq_create_info->cycle= 1; + Lex->create_info.seq_create_info->used_fields|= seq_field_used_cycle; + } + | NOCYCLE_SYM + { + if (unlikely(Lex->create_info.seq_create_info->used_fields & + seq_field_used_cycle)) + my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CYCLE")); + Lex->create_info.seq_create_info->cycle= 0; + Lex->create_info.seq_create_info->used_fields|= seq_field_used_cycle; + } + | RESTART_SYM + { + if (unlikely(Lex->sql_command != SQLCOM_ALTER_SEQUENCE)) + { + thd->parse_error(ER_SYNTAX_ERROR, "RESTART"); + YYABORT; + } + if (unlikely(Lex->create_info.seq_create_info->used_fields & + seq_field_used_restart)) + my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "RESTART")); + Lex->create_info.seq_create_info->used_fields|= seq_field_used_restart; + } + | RESTART_SYM opt_with longlong_num + { + if (unlikely(Lex->sql_command != SQLCOM_ALTER_SEQUENCE)) + { + thd->parse_error(ER_SYNTAX_ERROR, "RESTART"); + YYABORT; + } + if (unlikely(Lex->create_info.seq_create_info->used_fields & + seq_field_used_restart)) + my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "RESTART")); + Lex->create_info.seq_create_info->restart= $3; + Lex->create_info.seq_create_info->used_fields|= seq_field_used_restart | seq_field_used_restart_value; + } + ; + +server_def: + SERVER_SYM opt_if_not_exists ident_or_text + { + if (unlikely(Lex->add_create_options_with_check($2))) + MYSQL_YYABORT; + Lex->server_options.reset($3); + } + FOREIGN DATA_SYM WRAPPER_SYM ident_or_text + OPTIONS_SYM '(' server_options_list ')' + { Lex->server_options.scheme= $8; } + ; + +server_options_list: + server_option + | server_options_list ',' server_option + ; + +server_option: + USER_SYM TEXT_STRING_sys + { + MYSQL_YYABORT_UNLESS(Lex->server_options.username.str == 0); + Lex->server_options.username= $2; + } + | HOST_SYM TEXT_STRING_sys + { + MYSQL_YYABORT_UNLESS(Lex->server_options.host.str == 0); + Lex->server_options.host= $2; + my_casedn_str(system_charset_info, + (char*) Lex->server_options.host.str); + } + | DATABASE TEXT_STRING_sys + { + MYSQL_YYABORT_UNLESS(Lex->server_options.db.str == 0); + Lex->server_options.db= $2; + } + | OWNER_SYM TEXT_STRING_sys + { + MYSQL_YYABORT_UNLESS(Lex->server_options.owner.str == 0); + Lex->server_options.owner= $2; + } + | PASSWORD_SYM TEXT_STRING_sys + { + MYSQL_YYABORT_UNLESS(Lex->server_options.password.str == 0); + Lex->server_options.password= $2; + } + | SOCKET_SYM TEXT_STRING_sys + { + MYSQL_YYABORT_UNLESS(Lex->server_options.socket.str == 0); + Lex->server_options.socket= $2; + } + | PORT_SYM ulong_num + { + Lex->server_options.port= $2; + } + ; + +event_tail: + remember_name opt_if_not_exists sp_name + { + LEX *lex=Lex; + + lex->stmt_definition_begin= $1; + if (unlikely(lex->add_create_options_with_check($2))) + MYSQL_YYABORT; + if (unlikely(!(lex->event_parse_data= + Event_parse_data::new_instance(thd)))) + MYSQL_YYABORT; + lex->event_parse_data->identifier= $3; + lex->event_parse_data->on_completion= + Event_parse_data::ON_COMPLETION_DROP; + + lex->sql_command= SQLCOM_CREATE_EVENT; + /* We need that for disallowing subqueries */ + } + ON SCHEDULE_SYM ev_schedule_time + opt_ev_on_completion + opt_ev_status + opt_ev_comment + DO_SYM ev_sql_stmt + { + /* + sql_command is set here because some rules in ev_sql_stmt + can overwrite it + */ + Lex->sql_command= SQLCOM_CREATE_EVENT; + } + ; + +ev_schedule_time: + EVERY_SYM expr interval + { + Lex->event_parse_data->item_expression= $2; + Lex->event_parse_data->interval= $3; + } + ev_starts + ev_ends + | AT_SYM expr + { + Lex->event_parse_data->item_execute_at= $2; + } + ; + +opt_ev_status: + /* empty */ { $$= 0; } + | ENABLE_SYM + { + Lex->event_parse_data->status= Event_parse_data::ENABLED; + Lex->event_parse_data->status_changed= true; + $$= 1; + } + | DISABLE_SYM ON SLAVE + { + Lex->event_parse_data->status= Event_parse_data::SLAVESIDE_DISABLED; + Lex->event_parse_data->status_changed= true; + $$= 1; + } + | DISABLE_SYM + { + Lex->event_parse_data->status= Event_parse_data::DISABLED; + Lex->event_parse_data->status_changed= true; + $$= 1; + } + ; + +ev_starts: + /* empty */ + { + Item *item= new (thd->mem_root) Item_func_now_local(thd, 0); + if (unlikely(item == NULL)) + MYSQL_YYABORT; + Lex->event_parse_data->item_starts= item; + } + | STARTS_SYM expr + { + Lex->event_parse_data->item_starts= $2; + } + ; + +ev_ends: + /* empty */ + | ENDS_SYM expr + { + Lex->event_parse_data->item_ends= $2; + } + ; + +opt_ev_on_completion: + /* empty */ { $$= 0; } + | ev_on_completion + ; + +ev_on_completion: + ON COMPLETION_SYM opt_not PRESERVE_SYM + { + Lex->event_parse_data->on_completion= $3 + ? Event_parse_data::ON_COMPLETION_DROP + : Event_parse_data::ON_COMPLETION_PRESERVE; + $$= 1; + } + ; + +opt_ev_comment: + /* empty */ { $$= 0; } + | COMMENT_SYM TEXT_STRING_sys + { + Lex->comment= Lex->event_parse_data->comment= $2; + $$= 1; + } + ; + +ev_sql_stmt: + { + LEX *lex= thd->lex; + Lex_input_stream *lip= YYLIP; + + /* + This stops the following : + - CREATE EVENT ... DO CREATE EVENT ...; + - ALTER EVENT ... DO CREATE EVENT ...; + - CREATE EVENT ... DO ALTER EVENT DO ....; + - CREATE PROCEDURE ... BEGIN CREATE EVENT ... END| + This allows: + - CREATE EVENT ... DO DROP EVENT yyy; + - CREATE EVENT ... DO ALTER EVENT yyy; + (the nested ALTER EVENT can have anything but DO clause) + - ALTER EVENT ... DO ALTER EVENT yyy; + (the nested ALTER EVENT can have anything but DO clause) + - ALTER EVENT ... DO DROP EVENT yyy; + - CREATE PROCEDURE ... BEGIN ALTER EVENT ... END| + (the nested ALTER EVENT can have anything but DO clause) + - CREATE PROCEDURE ... BEGIN DROP EVENT ... END| + */ + if (unlikely(lex->sphead)) + my_yyabort_error((ER_EVENT_RECURSION_FORBIDDEN, MYF(0))); + + if (unlikely(!lex->make_sp_head(thd, + lex->event_parse_data->identifier, + &sp_handler_procedure))) + MYSQL_YYABORT; + + lex->sphead->set_body_start(thd, lip->get_cpp_ptr()); + } + sp_proc_stmt + { + LEX *lex= thd->lex; + + /* return back to the original memory root ASAP */ + lex->sphead->set_stmt_end(thd); + lex->sphead->restore_thd_mem_root(thd); + + lex->event_parse_data->body_changed= TRUE; + } + ; + +clear_privileges: + /* Nothing */ + { + LEX *lex=Lex; + lex->users_list.empty(); + lex->columns.empty(); + lex->grant= lex->grant_tot_col= 0; + lex->all_privileges= 0; + lex->select_lex.db= null_clex_str; + lex->ssl_type= SSL_TYPE_NOT_SPECIFIED; + lex->ssl_cipher= lex->x509_subject= lex->x509_issuer= 0; + bzero((char *)&(lex->mqh),sizeof(lex->mqh)); + } + ; + +sp_name: + ident '.' ident + { + if (unlikely(!($$= Lex->make_sp_name(thd, &$1, &$3)))) + MYSQL_YYABORT; + } + | ident + { + if (unlikely(!($$= Lex->make_sp_name(thd, &$1)))) + MYSQL_YYABORT; + } + ; + +opt_sp_name: + /* Empty */ { $$= NULL; } + | sp_name { $$= $1; } + ; + +sp_a_chistics: + /* Empty */ {} + | sp_a_chistics sp_chistic {} + ; + +sp_c_chistics: + /* Empty */ {} + | sp_c_chistics sp_c_chistic {} + ; + +/* Characteristics for both create and alter */ +sp_chistic: + COMMENT_SYM TEXT_STRING_sys + { Lex->sp_chistics.comment= $2; } + | LANGUAGE_SYM SQL_SYM + { /* Just parse it, we only have one language for now. */ } + | NO_SYM SQL_SYM + { Lex->sp_chistics.daccess= SP_NO_SQL; } + | CONTAINS_SYM SQL_SYM + { Lex->sp_chistics.daccess= SP_CONTAINS_SQL; } + | READS_SYM SQL_SYM DATA_SYM + { Lex->sp_chistics.daccess= SP_READS_SQL_DATA; } + | MODIFIES_SYM SQL_SYM DATA_SYM + { Lex->sp_chistics.daccess= SP_MODIFIES_SQL_DATA; } + | sp_suid + { Lex->sp_chistics.suid= $1; } + ; + +create_package_chistic: + COMMENT_SYM TEXT_STRING_sys + { Lex->sp_chistics.comment= $2; } + | sp_suid + { Lex->sp_chistics.suid= $1; } + ; + +create_package_chistics: + create_package_chistic {} + | create_package_chistics create_package_chistic { } + ; + +opt_create_package_chistics: + /* Empty */ + | create_package_chistics { } + ; + +opt_create_package_chistics_init: + { Lex->sp_chistics.init(); } + opt_create_package_chistics + ; + +/* Create characteristics */ +sp_c_chistic: + sp_chistic { } + | opt_not DETERMINISTIC_SYM { Lex->sp_chistics.detistic= ! $1; } + ; + +sp_suid: + SQL_SYM SECURITY_SYM DEFINER_SYM { $$= SP_IS_SUID; } + | SQL_SYM SECURITY_SYM INVOKER_SYM { $$= SP_IS_NOT_SUID; } + ; + +call: + CALL_SYM sp_name + { + if (unlikely(Lex->call_statement_start(thd, $2))) + MYSQL_YYABORT; + } + opt_sp_cparam_list {} + ; + +/* CALL parameters */ +opt_sp_cparam_list: + /* Empty */ + | '(' opt_sp_cparams ')' + ; + +opt_sp_cparams: + /* Empty */ + | sp_cparams + ; + +sp_cparams: + sp_cparams ',' expr + { + Lex->value_list.push_back($3, thd->mem_root); + } + | expr + { + Lex->value_list.push_back($1, thd->mem_root); + } + ; + +/* Stored FUNCTION parameter declaration list */ +sp_fdparam_list: + /* Empty */ + | sp_fdparams + ; + +sp_fdparams: + sp_fdparams ',' sp_param_name_and_type + | sp_param_name_and_type + ; + +sp_param_name: + ident + { + if (unlikely(!($$= Lex->sp_param_init(&$1)))) + MYSQL_YYABORT; + } + ; + +sp_param_name_and_type: + sp_param_name sp_param_type_with_opt_collate + { + if (unlikely(Lex->sp_param_fill_definition($$= $1))) + MYSQL_YYABORT; + } + | sp_param_name sp_decl_ident '.' ident PERCENT_ORACLE_SYM TYPE_SYM + { + if (unlikely(Lex->sphead->spvar_fill_type_reference(thd, $$= $1, $2, $4))) + MYSQL_YYABORT; + } + | sp_param_name sp_decl_ident '.' ident '.' ident PERCENT_ORACLE_SYM TYPE_SYM + { + if (unlikely(Lex->sphead->spvar_fill_type_reference(thd, $$= $1, $2, $4, $6))) + MYSQL_YYABORT; + } + | sp_param_name sp_decl_ident PERCENT_ORACLE_SYM ROWTYPE_ORACLE_SYM + { + if (unlikely(Lex->sphead->spvar_fill_table_rowtype_reference(thd, $$= $1, $2))) + MYSQL_YYABORT; + } + | sp_param_name sp_decl_ident '.' ident PERCENT_ORACLE_SYM ROWTYPE_ORACLE_SYM + { + if (unlikely(Lex->sphead->spvar_fill_table_rowtype_reference(thd, $$= $1, $2, $4))) + MYSQL_YYABORT; + } + | sp_param_name ROW_SYM row_type_body + { + if (unlikely(Lex->sphead->spvar_fill_row(thd, $$= $1, $3))) + MYSQL_YYABORT; + } + ; + +/* Stored PROCEDURE parameter declaration list */ +sp_pdparam_list: + /* Empty */ + | sp_pdparams + ; + +sp_pdparams: + sp_pdparams ',' sp_pdparam + | sp_pdparam + ; + +sp_pdparam: + sp_param_name sp_opt_inout sp_param_type_with_opt_collate + { + $1->mode= $2; + if (unlikely(Lex->sp_param_fill_definition($1))) + MYSQL_YYABORT; + } + | sp_param_name sp_opt_inout sp_decl_ident '.' ident PERCENT_ORACLE_SYM TYPE_SYM + { + $1->mode= $2; + if (unlikely(Lex->sphead->spvar_fill_type_reference(thd, $1, $3, $5))) + MYSQL_YYABORT; + } + | sp_param_name sp_opt_inout sp_decl_ident '.' ident '.' ident PERCENT_ORACLE_SYM TYPE_SYM + { + $1->mode= $2; + if (unlikely(Lex->sphead->spvar_fill_type_reference(thd, $1, $3, $5, $7))) + MYSQL_YYABORT; + } + | sp_param_name sp_opt_inout sp_decl_ident PERCENT_ORACLE_SYM ROWTYPE_ORACLE_SYM + { + $1->mode= $2; + if (unlikely(Lex->sphead->spvar_fill_table_rowtype_reference(thd, $1, $3))) + MYSQL_YYABORT; + } + | sp_param_name sp_opt_inout sp_decl_ident '.' ident PERCENT_ORACLE_SYM ROWTYPE_ORACLE_SYM + { + $1->mode= $2; + if (unlikely(Lex->sphead->spvar_fill_table_rowtype_reference(thd, $1, $3, $5))) + MYSQL_YYABORT; + } + | sp_param_name sp_opt_inout ROW_SYM row_type_body + { + $1->mode= $2; + if (unlikely(Lex->sphead->spvar_fill_row(thd, $1, $4))) + MYSQL_YYABORT; + } + ; + +sp_opt_inout: + /* Empty */ { $$= sp_variable::MODE_IN; } + | IN_SYM { $$= sp_variable::MODE_IN; } + | OUT_SYM { $$= sp_variable::MODE_OUT; } + | INOUT_SYM { $$= sp_variable::MODE_INOUT; } + | IN_SYM OUT_SYM { $$= sp_variable::MODE_INOUT; } + ; + +sp_parenthesized_fdparam_list: + '(' + { + Lex->sphead->m_param_begin= YYLIP->get_cpp_tok_start() + 1; + } + sp_fdparam_list + ')' + { + Lex->sphead->m_param_end= YYLIP->get_cpp_tok_start(); + } + ; + +sp_parenthesized_pdparam_list: + '(' + { + Lex->sphead->m_param_begin= YYLIP->get_cpp_tok_start() + 1; + } + sp_pdparam_list + ')' + { + Lex->sphead->m_param_end= YYLIP->get_cpp_tok_start(); + } + ; + +sp_no_param: + /* Empty */ + { + Lex->sphead->m_param_begin= Lex->sphead->m_param_end= + YYLIP->get_cpp_tok_start() + 1; + } + ; + +opt_sp_parenthesized_fdparam_list: + sp_no_param + | sp_parenthesized_fdparam_list + ; + +opt_sp_parenthesized_pdparam_list: + sp_no_param + | sp_parenthesized_pdparam_list + ; + +sp_proc_stmts: + /* Empty */ {} + | sp_proc_stmts sp_proc_stmt ';' + ; + +sp_proc_stmts1: + sp_proc_stmt ';' {} + | sp_proc_stmts1 sp_proc_stmt ';' + ; + +sp_proc_stmts1_implicit_block: + { + Lex->sp_block_init(thd); + } + sp_proc_stmts1 + { + if (unlikely(Lex->sp_block_finalize(thd))) + MYSQL_YYABORT; + } + ; + +opt_sp_decl_body_list: + /* Empty */ + { + $$.init(); + } + | sp_decl_body_list { $$= $1; } + ; + +sp_decl_body_list: + sp_decl_non_handler_list + { + if (unlikely(Lex->sphead->sp_add_instr_cpush_for_cursors(thd, Lex->spcont))) + MYSQL_YYABORT; + } + opt_sp_decl_handler_list + { + $$.join($1, $3); + } + | sp_decl_handler_list + ; + +sp_decl_non_handler_list: + sp_decl_non_handler ';' { $$= $1; } + | sp_decl_non_handler_list sp_decl_non_handler ';' + { + $$.join($1, $2); + } + ; + +sp_decl_handler_list: + sp_decl_handler ';' { $$= $1; } + | sp_decl_handler_list sp_decl_handler ';' + { + $$.join($1, $2); + } + ; + +opt_sp_decl_handler_list: + /* Empty*/ { $$.init(); } + | sp_decl_handler_list + ; + +optionally_qualified_column_ident: + sp_decl_ident + { + if (unlikely(!($$= new (thd->mem_root) + Qualified_column_ident(&$1)))) + MYSQL_YYABORT; + } + | sp_decl_ident '.' ident + { + if (unlikely(!($$= new (thd->mem_root) + Qualified_column_ident(&$1, &$3)))) + MYSQL_YYABORT; + } + | sp_decl_ident '.' ident '.' ident + { + if (unlikely(!($$= new (thd->mem_root) + Qualified_column_ident(thd, &$1, &$3, &$5)))) + MYSQL_YYABORT; + } + ; + +row_field_name: + ident_directly_assignable + { + if (unlikely(check_string_char_length(&$1, 0, NAME_CHAR_LEN, + system_charset_info, 1))) + my_yyabort_error((ER_TOO_LONG_IDENT, MYF(0), $1.str)); + if (unlikely(!($$= new (thd->mem_root) Spvar_definition()))) + MYSQL_YYABORT; + Lex->init_last_field($$, &$1, thd->variables.collation_database); + } + ; + +row_field_definition: + row_field_name type_with_opt_collate + ; + +row_field_definition_list: + row_field_definition + { + if (unlikely(!($$= new (thd->mem_root) Row_definition_list())) || + unlikely($$->push_back($1, thd->mem_root))) + MYSQL_YYABORT; + } + | row_field_definition_list ',' row_field_definition + { + uint unused; + if (unlikely($1->find_row_field_by_name(&$3->field_name, &unused))) + my_yyabort_error((ER_DUP_FIELDNAME, MYF(0), $3->field_name.str)); + $$= $1; + if (unlikely($$->push_back($3, thd->mem_root))) + MYSQL_YYABORT; + } + ; + +row_type_body: + '(' row_field_definition_list ')' { $$= $2; } + ; + +sp_decl_idents_init_vars: + sp_decl_idents + { + Lex->sp_variable_declarations_init(thd, $1); + } + ; + +sp_decl_vars: + sp_decl_idents_init_vars + type_with_opt_collate + sp_opt_default + { + if (unlikely(Lex->sp_variable_declarations_finalize(thd, $1, + &Lex->last_field[0], + $3))) + MYSQL_YYABORT; + $$.init_using_vars($1); + } + | sp_decl_idents_init_vars + optionally_qualified_column_ident PERCENT_ORACLE_SYM TYPE_SYM + sp_opt_default + { + if (unlikely(Lex->sp_variable_declarations_with_ref_finalize(thd, $1, $2, $5))) + MYSQL_YYABORT; + $$.init_using_vars($1); + } + | sp_decl_idents_init_vars + optionally_qualified_column_ident PERCENT_ORACLE_SYM ROWTYPE_ORACLE_SYM + sp_opt_default + { + if (unlikely(Lex->sp_variable_declarations_rowtype_finalize(thd, $1, $2, $5))) + MYSQL_YYABORT; + $$.init_using_vars($1); + } + | sp_decl_idents_init_vars + ROW_SYM row_type_body + sp_opt_default + { + if (unlikely(Lex->sp_variable_declarations_row_finalize(thd, $1, $3, $4))) + MYSQL_YYABORT; + $$.init_using_vars($1); + } + ; + +sp_decl_non_handler: + sp_decl_vars + | ident_directly_assignable CONDITION_SYM FOR_SYM sp_cond + { + if (unlikely(Lex->spcont->declare_condition(thd, &$1, $4))) + MYSQL_YYABORT; + $$.vars= $$.hndlrs= $$.curs= 0; + $$.conds= 1; + } + | ident_directly_assignable EXCEPTION_ORACLE_SYM + { + sp_condition_value *spcond= new (thd->mem_root) + sp_condition_value_user_defined(); + if (unlikely(!spcond) || + unlikely(Lex->spcont->declare_condition(thd, &$1, spcond))) + MYSQL_YYABORT; + $$.vars= $$.hndlrs= $$.curs= 0; + $$.conds= 1; + } + | CURSOR_SYM ident_directly_assignable + { + Lex->sp_block_init(thd); + } + opt_parenthesized_cursor_formal_parameters + IS sp_cursor_stmt + { + sp_pcontext *param_ctx= Lex->spcont; + if (unlikely(Lex->sp_block_finalize(thd))) + MYSQL_YYABORT; + if (unlikely(Lex->sp_declare_cursor(thd, &$2, $6, param_ctx, false))) + MYSQL_YYABORT; + $$.vars= $$.conds= $$.hndlrs= 0; + $$.curs= 1; + } + ; + +sp_decl_handler: + sp_handler_type HANDLER_SYM FOR_SYM + { + if (unlikely(Lex->sp_handler_declaration_init(thd, $1))) + MYSQL_YYABORT; + } + sp_hcond_list sp_proc_stmt + { + if (unlikely(Lex->sp_handler_declaration_finalize(thd, $1))) + MYSQL_YYABORT; + $$.vars= $$.conds= $$.curs= 0; + $$.hndlrs= 1; + } + ; + +opt_parenthesized_cursor_formal_parameters: + /* Empty */ + | '(' sp_fdparams ')' + ; + + +sp_cursor_stmt_lex: + { + DBUG_ASSERT(thd->lex->sphead); + if (unlikely(!($$= new (thd->mem_root) + sp_lex_cursor(thd, thd->lex)))) + MYSQL_YYABORT; + } + ; + +sp_cursor_stmt: + sp_cursor_stmt_lex + { + DBUG_ASSERT(thd->free_list == NULL); + Lex->sphead->reset_lex(thd, $1); + } + select + { + DBUG_ASSERT(Lex == $1); + if (unlikely($1->stmt_finalize(thd)) || + unlikely($1->sphead->restore_lex(thd))) + MYSQL_YYABORT; + $$= $1; + } + ; + +sp_handler_type: + EXIT_MARIADB_SYM { $$= sp_handler::EXIT; } + | CONTINUE_MARIADB_SYM { $$= sp_handler::CONTINUE; } + | EXIT_ORACLE_SYM { $$= sp_handler::EXIT; } + | CONTINUE_ORACLE_SYM { $$= sp_handler::CONTINUE; } + /*| UNDO_SYM { QQ No yet } */ + ; + +sp_hcond_list: + sp_hcond_element + { $$= 1; } + | sp_hcond_list ',' sp_hcond_element + { $$+= 1; } + ; + +sp_hcond_element: + sp_hcond + { + LEX *lex= Lex; + sp_head *sp= lex->sphead; + sp_pcontext *ctx= lex->spcont->parent_context(); + + if (unlikely(ctx->check_duplicate_handler($1))) + my_yyabort_error((ER_SP_DUP_HANDLER, MYF(0))); + + sp_instr_hpush_jump *i= (sp_instr_hpush_jump *)sp->last_instruction(); + i->add_condition($1); + } + ; + +sp_cond: + ulong_num + { /* mysql errno */ + if (unlikely($1 == 0)) + my_yyabort_error((ER_WRONG_VALUE, MYF(0), "CONDITION", "0")); + $$= new (thd->mem_root) sp_condition_value($1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | sqlstate + ; + +sqlstate: + SQLSTATE_SYM opt_value TEXT_STRING_literal + { /* SQLSTATE */ + + /* + An error is triggered: + - if the specified string is not a valid SQLSTATE, + - or if it represents the completion condition -- it is not + allowed to SIGNAL, or declare a handler for the completion + condition. + */ + if (unlikely(!is_sqlstate_valid(&$3) || + is_sqlstate_completion($3.str))) + my_yyabort_error((ER_SP_BAD_SQLSTATE, MYF(0), $3.str)); + $$= new (thd->mem_root) sp_condition_value($3.str); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + +opt_value: + /* Empty */ {} + | VALUE_SYM {} + ; + +sp_hcond: + sp_cond + { + $$= $1; + } + | ident /* CONDITION name */ + { + $$= Lex->spcont->find_declared_or_predefined_condition(thd, &$1); + if (unlikely($$ == NULL)) + my_yyabort_error((ER_SP_COND_MISMATCH, MYF(0), $1.str)); + } + | SQLWARNING_SYM /* SQLSTATEs 01??? */ + { + $$= new (thd->mem_root) sp_condition_value(sp_condition_value::WARNING); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | not FOUND_SYM /* SQLSTATEs 02??? */ + { + $$= new (thd->mem_root) sp_condition_value(sp_condition_value::NOT_FOUND); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | SQLEXCEPTION_SYM /* All other SQLSTATEs */ + { + $$= new (thd->mem_root) sp_condition_value(sp_condition_value::EXCEPTION); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | OTHERS_ORACLE_SYM /* All other SQLSTATEs */ + { + $$= new (thd->mem_root) sp_condition_value(sp_condition_value::EXCEPTION); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + + +raise_stmt_oracle: + RAISE_ORACLE_SYM opt_set_signal_information + { + if (unlikely(Lex->add_resignal_statement(thd, NULL))) + MYSQL_YYABORT; + } + | RAISE_ORACLE_SYM signal_value opt_set_signal_information + { + if (unlikely(Lex->add_signal_statement(thd, $2))) + MYSQL_YYABORT; + } + ; + +signal_stmt: + SIGNAL_SYM signal_value opt_set_signal_information + { + if (unlikely(Lex->add_signal_statement(thd, $2))) + MYSQL_YYABORT; + } + ; + +signal_value: + ident + { + LEX *lex= Lex; + sp_condition_value *cond; + + /* SIGNAL foo cannot be used outside of stored programs */ + if (unlikely(lex->spcont == NULL)) + my_yyabort_error((ER_SP_COND_MISMATCH, MYF(0), $1.str)); + cond= lex->spcont->find_declared_or_predefined_condition(thd, &$1); + if (unlikely(cond == NULL)) + my_yyabort_error((ER_SP_COND_MISMATCH, MYF(0), $1.str)); + if (unlikely(!cond->has_sql_state())) + my_yyabort_error((ER_SIGNAL_BAD_CONDITION_TYPE, MYF(0))); + $$= cond; + } + | sqlstate + { $$= $1; } + ; + +opt_signal_value: + /* empty */ + { $$= NULL; } + | signal_value + { $$= $1; } + ; + +opt_set_signal_information: + /* empty */ + { + thd->m_parser_state->m_yacc.m_set_signal_info.clear(); + } + | SET signal_information_item_list + ; + +signal_information_item_list: + signal_condition_information_item_name '=' signal_allowed_expr + { + Set_signal_information *info; + info= &thd->m_parser_state->m_yacc.m_set_signal_info; + int index= (int) $1; + info->clear(); + info->m_item[index]= $3; + } + | signal_information_item_list ',' + signal_condition_information_item_name '=' signal_allowed_expr + { + Set_signal_information *info; + info= &thd->m_parser_state->m_yacc.m_set_signal_info; + int index= (int) $3; + if (unlikely(info->m_item[index] != NULL)) + my_yyabort_error((ER_DUP_SIGNAL_SET, MYF(0), + Diag_condition_item_names[index].str)); + info->m_item[index]= $5; + } + ; + +/* + Only a limited subset of <expr> are allowed in SIGNAL/RESIGNAL. +*/ +signal_allowed_expr: + literal + { $$= $1; } + | variable + { + if ($1->type() == Item::FUNC_ITEM) + { + Item_func *item= (Item_func*) $1; + if (unlikely(item->functype() == Item_func::SUSERVAR_FUNC)) + { + /* + Don't allow the following syntax: + SIGNAL/RESIGNAL ... + SET <signal condition item name> = @foo := expr + */ + thd->parse_error(); + MYSQL_YYABORT; + } + } + $$= $1; + } + | simple_ident + { $$= $1; } + ; + +/* conditions that can be set in signal / resignal */ +signal_condition_information_item_name: + CLASS_ORIGIN_SYM + { $$= DIAG_CLASS_ORIGIN; } + | SUBCLASS_ORIGIN_SYM + { $$= DIAG_SUBCLASS_ORIGIN; } + | CONSTRAINT_CATALOG_SYM + { $$= DIAG_CONSTRAINT_CATALOG; } + | CONSTRAINT_SCHEMA_SYM + { $$= DIAG_CONSTRAINT_SCHEMA; } + | CONSTRAINT_NAME_SYM + { $$= DIAG_CONSTRAINT_NAME; } + | CATALOG_NAME_SYM + { $$= DIAG_CATALOG_NAME; } + | SCHEMA_NAME_SYM + { $$= DIAG_SCHEMA_NAME; } + | TABLE_NAME_SYM + { $$= DIAG_TABLE_NAME; } + | COLUMN_NAME_SYM + { $$= DIAG_COLUMN_NAME; } + | CURSOR_NAME_SYM + { $$= DIAG_CURSOR_NAME; } + | MESSAGE_TEXT_SYM + { $$= DIAG_MESSAGE_TEXT; } + | MYSQL_ERRNO_SYM + { $$= DIAG_MYSQL_ERRNO; } + ; + +resignal_stmt: + RESIGNAL_SYM opt_signal_value opt_set_signal_information + { + if (unlikely(Lex->add_resignal_statement(thd, $2))) + MYSQL_YYABORT; + } + ; + +get_diagnostics: + GET_SYM which_area DIAGNOSTICS_SYM diagnostics_information + { + Diagnostics_information *info= $4; + + info->set_which_da($2); + + Lex->sql_command= SQLCOM_GET_DIAGNOSTICS; + Lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_get_diagnostics(info); + + if (unlikely(Lex->m_sql_cmd == NULL)) + MYSQL_YYABORT; + } + ; + +which_area: + /* If <which area> is not specified, then CURRENT is implicit. */ + { $$= Diagnostics_information::CURRENT_AREA; } + | CURRENT_SYM + { $$= Diagnostics_information::CURRENT_AREA; } + ; + +diagnostics_information: + statement_information + { + $$= new (thd->mem_root) Statement_information($1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | CONDITION_SYM condition_number condition_information + { + $$= new (thd->mem_root) Condition_information($2, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + +statement_information: + statement_information_item + { + $$= new (thd->mem_root) List<Statement_information_item>; + if (unlikely($$ == NULL) || + unlikely($$->push_back($1, thd->mem_root))) + MYSQL_YYABORT; + } + | statement_information ',' statement_information_item + { + if (unlikely($1->push_back($3, thd->mem_root))) + MYSQL_YYABORT; + $$= $1; + } + ; + +statement_information_item: + simple_target_specification '=' statement_information_item_name + { + $$= new (thd->mem_root) Statement_information_item($3, $1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + +simple_target_specification: + ident_cli + { + if (unlikely(!($$= thd->lex->create_item_for_sp_var(&$1, NULL)))) + MYSQL_YYABORT; + } + | '@' ident_or_text + { + $$= new (thd->mem_root) Item_func_get_user_var(thd, &$2); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + +statement_information_item_name: + NUMBER_MARIADB_SYM + { $$= Statement_information_item::NUMBER; } + | NUMBER_ORACLE_SYM + { $$= Statement_information_item::NUMBER; } + | ROW_COUNT_SYM + { $$= Statement_information_item::ROW_COUNT; } + ; + +/* + Only a limited subset of <expr> are allowed in GET DIAGNOSTICS + <condition number>, same subset as for SIGNAL/RESIGNAL. +*/ +condition_number: + signal_allowed_expr + { $$= $1; } + ; + +condition_information: + condition_information_item + { + $$= new (thd->mem_root) List<Condition_information_item>; + if (unlikely($$ == NULL) || + unlikely($$->push_back($1, thd->mem_root))) + MYSQL_YYABORT; + } + | condition_information ',' condition_information_item + { + if (unlikely($1->push_back($3, thd->mem_root))) + MYSQL_YYABORT; + $$= $1; + } + ; + +condition_information_item: + simple_target_specification '=' condition_information_item_name + { + $$= new (thd->mem_root) Condition_information_item($3, $1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + +condition_information_item_name: + CLASS_ORIGIN_SYM + { $$= Condition_information_item::CLASS_ORIGIN; } + | SUBCLASS_ORIGIN_SYM + { $$= Condition_information_item::SUBCLASS_ORIGIN; } + | CONSTRAINT_CATALOG_SYM + { $$= Condition_information_item::CONSTRAINT_CATALOG; } + | CONSTRAINT_SCHEMA_SYM + { $$= Condition_information_item::CONSTRAINT_SCHEMA; } + | CONSTRAINT_NAME_SYM + { $$= Condition_information_item::CONSTRAINT_NAME; } + | CATALOG_NAME_SYM + { $$= Condition_information_item::CATALOG_NAME; } + | SCHEMA_NAME_SYM + { $$= Condition_information_item::SCHEMA_NAME; } + | TABLE_NAME_SYM + { $$= Condition_information_item::TABLE_NAME; } + | COLUMN_NAME_SYM + { $$= Condition_information_item::COLUMN_NAME; } + | CURSOR_NAME_SYM + { $$= Condition_information_item::CURSOR_NAME; } + | MESSAGE_TEXT_SYM + { $$= Condition_information_item::MESSAGE_TEXT; } + | MYSQL_ERRNO_SYM + { $$= Condition_information_item::MYSQL_ERRNO; } + | RETURNED_SQLSTATE_SYM + { $$= Condition_information_item::RETURNED_SQLSTATE; } + ; + +sp_decl_ident: + IDENT_sys + | keyword_sp_decl + { + if (unlikely($$.copy_ident_cli(thd, &$1))) + MYSQL_YYABORT; + } + ; + +sp_decl_idents: + sp_decl_ident + { + /* NOTE: field definition is filled in sp_decl section. */ + + LEX *lex= Lex; + sp_pcontext *spc= lex->spcont; + + if (unlikely(spc->find_variable(&$1, TRUE))) + my_yyabort_error((ER_SP_DUP_VAR, MYF(0), $1.str)); + spc->add_variable(thd, &$1); + $$= 1; + } + | sp_decl_idents ',' ident + { + /* NOTE: field definition is filled in sp_decl section. */ + + LEX *lex= Lex; + sp_pcontext *spc= lex->spcont; + + if (unlikely(spc->find_variable(&$3, TRUE))) + my_yyabort_error((ER_SP_DUP_VAR, MYF(0), $3.str)); + spc->add_variable(thd, &$3); + $$= $1 + 1; + } + ; + +sp_opt_default: + /* Empty */ { $$ = NULL; } + | DEFAULT expr { $$ = $2; } + | SET_VAR expr { $$ = $2; } + ; + +sp_proc_stmt: + sp_labeled_block + | sp_unlabeled_block + | sp_labeled_control + | sp_unlabeled_control + | sp_labelable_stmt + | labels_declaration_oracle sp_labelable_stmt {} + ; + +sp_labelable_stmt: + sp_proc_stmt_statement + | sp_proc_stmt_continue_oracle + | sp_proc_stmt_exit_oracle + | sp_proc_stmt_leave + | sp_proc_stmt_iterate + | sp_proc_stmt_goto_oracle + | sp_proc_stmt_open + | sp_proc_stmt_fetch + | sp_proc_stmt_close + | sp_proc_stmt_return + | sp_proc_stmt_if + | case_stmt_specification + | NULL_SYM { } + ; + +sp_proc_stmt_compound_ok: + sp_proc_stmt_if + | case_stmt_specification + | sp_unlabeled_block + | sp_unlabeled_control + ; + +sp_proc_stmt_if: + IF_SYM + { + if (unlikely(Lex->maybe_start_compound_statement(thd))) + MYSQL_YYABORT; + Lex->sphead->new_cont_backpatch(NULL); + } + sp_if END IF_SYM + { Lex->sphead->do_cont_backpatch(); } + ; + +sp_statement: + statement + | ident_directly_assignable + { + // Direct procedure call (without the CALL keyword) + if (unlikely(Lex->call_statement_start(thd, &$1))) + MYSQL_YYABORT; + } + opt_sp_cparam_list + | ident_directly_assignable '.' ident + { + if (unlikely(Lex->call_statement_start(thd, &$1, &$3))) + MYSQL_YYABORT; + } + opt_sp_cparam_list + ; + +sp_proc_stmt_statement: + { + LEX *lex= thd->lex; + Lex_input_stream *lip= YYLIP; + + lex->sphead->reset_lex(thd); + lex->sphead->m_tmp_query= lip->get_tok_start(); + } + sp_statement + { + LEX *lex= thd->lex; + Lex_input_stream *lip= YYLIP; + sp_head *sp= lex->sphead; + + sp->m_flags|= sp_get_flags_for_command(lex); + /* "USE db" doesn't work in a procedure */ + if (unlikely(lex->sql_command == SQLCOM_CHANGE_DB)) + my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "USE")); + /* + Don't add an instruction for SET statements, since all + instructions for them were already added during processing + of "set" rule. + */ + DBUG_ASSERT(lex->sql_command != SQLCOM_SET_OPTION || + lex->var_list.is_empty()); + if (lex->sql_command != SQLCOM_SET_OPTION) + { + sp_instr_stmt *i=new (thd->mem_root) + sp_instr_stmt(sp->instructions(), lex->spcont, lex); + if (unlikely(i == NULL)) + MYSQL_YYABORT; + + /* + Extract the query statement from the tokenizer. The + end is either lex->ptr, if there was no lookahead, + lex->tok_end otherwise. + */ + if (yychar == YYEMPTY) + i->m_query.length= lip->get_ptr() - sp->m_tmp_query; + else + i->m_query.length= lip->get_tok_start() - sp->m_tmp_query;; + if (unlikely(!(i->m_query.str= strmake_root(thd->mem_root, + sp->m_tmp_query, + i->m_query.length))) || + unlikely(sp->add_instr(i))) + MYSQL_YYABORT; + } + if (unlikely(sp->restore_lex(thd))) + MYSQL_YYABORT; + } + ; + + +RETURN_ALLMODES_SYM: + RETURN_MARIADB_SYM + | RETURN_ORACLE_SYM + ; + +sp_proc_stmt_return: + RETURN_ALLMODES_SYM + { Lex->sphead->reset_lex(thd); } + expr + { + LEX *lex= Lex; + sp_head *sp= lex->sphead; + if (unlikely(sp->m_handler->add_instr_freturn(thd, sp, lex->spcont, + $3, lex)) || + unlikely(sp->restore_lex(thd))) + MYSQL_YYABORT; + } + | RETURN_ORACLE_SYM + { + LEX *lex= Lex; + sp_head *sp= lex->sphead; + if (unlikely(sp->m_handler->add_instr_preturn(thd, sp, + lex->spcont))) + MYSQL_YYABORT; + } + ; + +reset_lex_expr: + { Lex->sphead->reset_lex(thd); } expr { $$= $2; } + ; + +sp_proc_stmt_exit_oracle: + EXIT_ORACLE_SYM + { + if (unlikely(Lex->sp_exit_statement(thd, NULL))) + MYSQL_YYABORT; + } + | EXIT_ORACLE_SYM label_ident + { + if (unlikely(Lex->sp_exit_statement(thd, &$2, NULL))) + MYSQL_YYABORT; + } + | EXIT_ORACLE_SYM WHEN_SYM reset_lex_expr + { + if (unlikely(Lex->sp_exit_statement(thd, $3)) || + unlikely(Lex->sphead->restore_lex(thd))) + MYSQL_YYABORT; + } + | EXIT_ORACLE_SYM label_ident WHEN_SYM reset_lex_expr + { + if (unlikely(Lex->sp_exit_statement(thd, &$2, $4)) || + unlikely(Lex->sphead->restore_lex(thd))) + MYSQL_YYABORT; + } + ; + +sp_proc_stmt_continue_oracle: + CONTINUE_ORACLE_SYM + { + if (unlikely(Lex->sp_continue_statement(thd, NULL))) + MYSQL_YYABORT; + } + | CONTINUE_ORACLE_SYM label_ident + { + if (unlikely(Lex->sp_continue_statement(thd, &$2, NULL))) + MYSQL_YYABORT; + } + | CONTINUE_ORACLE_SYM WHEN_SYM reset_lex_expr + { + if (unlikely(Lex->sp_continue_statement(thd, $3)) || + unlikely(Lex->sphead->restore_lex(thd))) + MYSQL_YYABORT; + } + | CONTINUE_ORACLE_SYM label_ident WHEN_SYM reset_lex_expr + { + if (unlikely(Lex->sp_continue_statement(thd, &$2, $4)) || + unlikely(Lex->sphead->restore_lex(thd))) + MYSQL_YYABORT; + } + ; + + +sp_proc_stmt_leave: + LEAVE_SYM label_ident + { + if (unlikely(Lex->sp_leave_statement(thd, &$2))) + MYSQL_YYABORT; + } + ; + +sp_proc_stmt_iterate: + ITERATE_SYM label_ident + { + if (unlikely(Lex->sp_iterate_statement(thd, &$2))) + MYSQL_YYABORT; + } + ; + +sp_proc_stmt_goto_oracle: + GOTO_ORACLE_SYM label_ident + { + if (unlikely(Lex->sp_goto_statement(thd, &$2))) + MYSQL_YYABORT; + } + ; + + +remember_lex: + { + $$= thd->lex; + } + ; + +assignment_source_lex: + { + DBUG_ASSERT(Lex->sphead); + if (unlikely(!($$= new (thd->mem_root) + sp_assignment_lex(thd, thd->lex)))) + MYSQL_YYABORT; + } + ; + +assignment_source_expr: + assignment_source_lex + { + DBUG_ASSERT(thd->free_list == NULL); + Lex->sphead->reset_lex(thd, $1); + } + expr + { + DBUG_ASSERT($1 == thd->lex); + $$= $1; + $$->sp_lex_in_use= true; + $$->set_item_and_free_list($3, thd->free_list); + thd->free_list= NULL; + if (unlikely($$->sphead->restore_lex(thd))) + MYSQL_YYABORT; + } + ; + +for_loop_bound_expr: + assignment_source_lex + { + Lex->sphead->reset_lex(thd, $1); + } + expr + { + DBUG_ASSERT($1 == thd->lex); + $$= $1; + $$->sp_lex_in_use= true; + $$->set_item_and_free_list($3, NULL); + if (unlikely($$->sphead->restore_lex(thd))) + MYSQL_YYABORT; + } + ; + +cursor_actual_parameters: + assignment_source_expr + { + if (unlikely(!($$= new (thd->mem_root) List<sp_assignment_lex>))) + MYSQL_YYABORT; + $$->push_back($1, thd->mem_root); + } + | cursor_actual_parameters ',' assignment_source_expr + { + $$= $1; + $$->push_back($3, thd->mem_root); + } + ; + +opt_parenthesized_cursor_actual_parameters: + /* Empty */ { $$= NULL; } + | '(' cursor_actual_parameters ')' { $$= $2; } + ; + +sp_proc_stmt_open: + OPEN_SYM ident opt_parenthesized_cursor_actual_parameters + { + if (unlikely(Lex->sp_open_cursor(thd, &$2, $3))) + MYSQL_YYABORT; + } + ; + +sp_proc_stmt_fetch_head: + FETCH_SYM ident INTO + { + if (unlikely(Lex->sp_add_cfetch(thd, &$2))) + MYSQL_YYABORT; + } + | FETCH_SYM FROM ident INTO + { + if (unlikely(Lex->sp_add_cfetch(thd, &$3))) + MYSQL_YYABORT; + } + | FETCH_SYM NEXT_SYM FROM ident INTO + { + if (unlikely(Lex->sp_add_cfetch(thd, &$4))) + MYSQL_YYABORT; + } + ; + +sp_proc_stmt_fetch: + sp_proc_stmt_fetch_head sp_fetch_list { } + ; + +sp_proc_stmt_close: + CLOSE_SYM ident + { + LEX *lex= Lex; + sp_head *sp= lex->sphead; + uint offset; + sp_instr_cclose *i; + + if (unlikely(!lex->spcont->find_cursor(&$2, &offset, false))) + my_yyabort_error((ER_SP_CURSOR_MISMATCH, MYF(0), $2.str)); + i= new (thd->mem_root) + sp_instr_cclose(sp->instructions(), lex->spcont, offset); + if (unlikely(i == NULL) || + unlikely(sp->add_instr(i))) + MYSQL_YYABORT; + } + ; + +sp_fetch_list: + ident + { + LEX *lex= Lex; + sp_head *sp= lex->sphead; + sp_pcontext *spc= lex->spcont; + sp_variable *spv; + + if (unlikely(!spc || !(spv = spc->find_variable(&$1, false)))) + my_yyabort_error((ER_SP_UNDECLARED_VAR, MYF(0), $1.str)); + + /* An SP local variable */ + sp_instr_cfetch *i= (sp_instr_cfetch *)sp->last_instruction(); + i->add_to_varlist(spv); + } + | sp_fetch_list ',' ident + { + LEX *lex= Lex; + sp_head *sp= lex->sphead; + sp_pcontext *spc= lex->spcont; + sp_variable *spv; + + if (unlikely(!spc || !(spv = spc->find_variable(&$3, false)))) + my_yyabort_error((ER_SP_UNDECLARED_VAR, MYF(0), $3.str)); + + /* An SP local variable */ + sp_instr_cfetch *i= (sp_instr_cfetch *)sp->last_instruction(); + i->add_to_varlist(spv); + } + ; + +sp_if: + { Lex->sphead->reset_lex(thd); } + expr THEN_SYM + { + LEX *lex= Lex; + sp_head *sp= lex->sphead; + sp_pcontext *ctx= lex->spcont; + uint ip= sp->instructions(); + sp_instr_jump_if_not *i= new (thd->mem_root) + sp_instr_jump_if_not(ip, ctx, $2, lex); + if (unlikely(i == NULL) || + unlikely(sp->push_backpatch(thd, i, ctx->push_label(thd, &empty_clex_str, 0))) || + unlikely(sp->add_cont_backpatch(i)) || + unlikely(sp->add_instr(i))) + MYSQL_YYABORT; + if (unlikely(sp->restore_lex(thd))) + MYSQL_YYABORT; + } + sp_proc_stmts1_implicit_block + { + sp_head *sp= Lex->sphead; + sp_pcontext *ctx= Lex->spcont; + uint ip= sp->instructions(); + sp_instr_jump *i= new (thd->mem_root) sp_instr_jump(ip, ctx); + if (unlikely(i == NULL) || + unlikely(sp->add_instr(i))) + MYSQL_YYABORT; + sp->backpatch(ctx->pop_label()); + sp->push_backpatch(thd, i, ctx->push_label(thd, &empty_clex_str, 0)); + } + sp_elseifs + { + LEX *lex= Lex; + + lex->sphead->backpatch(lex->spcont->pop_label()); + } + ; + +sp_elseifs: + /* Empty */ + | ELSIF_ORACLE_SYM sp_if + | ELSE sp_proc_stmts1_implicit_block + ; + +case_stmt_specification: + CASE_SYM + { + if (unlikely(Lex->maybe_start_compound_statement(thd))) + MYSQL_YYABORT; + + /** + An example of the CASE statement in use is + <pre> + CREATE PROCEDURE proc_19194_simple(i int) + BEGIN + DECLARE str CHAR(10); + + CASE i + WHEN 1 THEN SET str="1"; + WHEN 2 THEN SET str="2"; + WHEN 3 THEN SET str="3"; + ELSE SET str="unknown"; + END CASE; + + SELECT str; + END + </pre> + The actions are used to generate the following code: + <pre> + SHOW PROCEDURE CODE proc_19194_simple; + Pos Instruction + 0 set str@1 NULL + 1 set_case_expr (12) 0 i@0 + 2 jump_if_not 5(12) (case_expr@0 = 1) + 3 set str@1 _latin1'1' + 4 jump 12 + 5 jump_if_not 8(12) (case_expr@0 = 2) + 6 set str@1 _latin1'2' + 7 jump 12 + 8 jump_if_not 11(12) (case_expr@0 = 3) + 9 set str@1 _latin1'3' + 10 jump 12 + 11 set str@1 _latin1'unknown' + 12 stmt 0 "SELECT str" + </pre> + */ + + Lex->sphead->new_cont_backpatch(NULL); + + /* + BACKPATCH: Creating target label for the jump to after END CASE + (instruction 12 in the example) + */ + Lex->spcont->push_label(thd, &empty_clex_str, Lex->sphead->instructions()); + } + case_stmt_body + else_clause_opt + END + CASE_SYM + { + /* + BACKPATCH: Resolving forward jump from + "case_stmt_action_then" to after END CASE + (jump from instruction 4 to 12, 7 to 12 ... in the example) + */ + Lex->sphead->backpatch(Lex->spcont->pop_label()); + + if ($3) + Lex->spcont->pop_case_expr_id(); + + Lex->sphead->do_cont_backpatch(); + } + ; + +case_stmt_body: + { Lex->sphead->reset_lex(thd); /* For expr $2 */ } + expr + { + if (unlikely(Lex->case_stmt_action_expr($2))) + MYSQL_YYABORT; + if (unlikely(Lex->sphead->restore_lex(thd))) + MYSQL_YYABORT; + } + simple_when_clause_list + { $$= 1; } + | searched_when_clause_list + { $$= 0; } + ; + +simple_when_clause_list: + simple_when_clause + | simple_when_clause_list simple_when_clause + ; + +searched_when_clause_list: + searched_when_clause + | searched_when_clause_list searched_when_clause + ; + +simple_when_clause: + WHEN_SYM + { + Lex->sphead->reset_lex(thd); /* For expr $3 */ + } + expr + { + /* Simple case: <caseval> = <whenval> */ + + LEX *lex= Lex; + if (unlikely(lex->case_stmt_action_when($3, true))) + MYSQL_YYABORT; + /* For expr $3 */ + if (unlikely(lex->sphead->restore_lex(thd))) + MYSQL_YYABORT; + } + THEN_SYM + sp_proc_stmts1_implicit_block + { + if (unlikely(Lex->case_stmt_action_then())) + MYSQL_YYABORT; + } + ; + +searched_when_clause: + WHEN_SYM + { + Lex->sphead->reset_lex(thd); /* For expr $3 */ + } + expr + { + LEX *lex= Lex; + if (unlikely(lex->case_stmt_action_when($3, false))) + MYSQL_YYABORT; + /* For expr $3 */ + if (unlikely(lex->sphead->restore_lex(thd))) + MYSQL_YYABORT; + } + THEN_SYM + sp_proc_stmts1_implicit_block + { + if (unlikely(Lex->case_stmt_action_then())) + MYSQL_YYABORT; + } + ; + +else_clause_opt: + /* empty */ + { + LEX *lex= Lex; + sp_head *sp= lex->sphead; + uint ip= sp->instructions(); + sp_instr_error *i= new (thd->mem_root) + sp_instr_error(ip, lex->spcont, ER_SP_CASE_NOT_FOUND); + if (unlikely(i == NULL) || + unlikely(sp->add_instr(i))) + MYSQL_YYABORT; + } + | ELSE sp_proc_stmts1_implicit_block + ; + +sp_opt_label: + /* Empty */ { $$= null_clex_str; } + | label_ident { $$= $1; } + ; + +sp_block_label: + labels_declaration_oracle + { + if (unlikely(Lex->spcont->block_label_declare(&$1))) + MYSQL_YYABORT; + $$= $1; + } + ; + +sp_labeled_block: + sp_block_label + BEGIN_ORACLE_SYM + { + Lex->sp_block_init(thd, &$1); + if (unlikely(Lex->sp_block_with_exceptions_finalize_declarations(thd))) + MYSQL_YYABORT; + } + sp_block_statements_and_exceptions + END + sp_opt_label + { + if (unlikely(Lex->sp_block_finalize(thd, Lex_spblock($4), &$6))) + MYSQL_YYABORT; + } + | sp_block_label + DECLARE_ORACLE_SYM + { + Lex->sp_block_init(thd, &$1); + } + sp_decl_body_list + { + if (unlikely(Lex->sp_block_with_exceptions_finalize_declarations(thd))) + MYSQL_YYABORT; + } + BEGIN_ORACLE_SYM + sp_block_statements_and_exceptions + END + sp_opt_label + { + $4.hndlrs+= $7.hndlrs; + if (unlikely(Lex->sp_block_finalize(thd, $4, &$9))) + MYSQL_YYABORT; + } + ; + +opt_not_atomic: + /* Empty */ + | not ATOMIC_SYM /* TODO: BEGIN ATOMIC (not -> opt_not) */ + ; + +sp_unlabeled_block: + BEGIN_ORACLE_SYM opt_not_atomic + { + if (unlikely(Lex->maybe_start_compound_statement(thd))) + MYSQL_YYABORT; + Lex->sp_block_init(thd); + if (unlikely(Lex->sp_block_with_exceptions_finalize_declarations(thd))) + MYSQL_YYABORT; + } + sp_block_statements_and_exceptions + END + { + if (unlikely(Lex->sp_block_finalize(thd, Lex_spblock($4)))) + MYSQL_YYABORT; + } + | DECLARE_ORACLE_SYM + { + if (unlikely(Lex->maybe_start_compound_statement(thd))) + MYSQL_YYABORT; + Lex->sp_block_init(thd); + } + sp_decl_body_list + { + if (unlikely(Lex->sp_block_with_exceptions_finalize_declarations(thd))) + MYSQL_YYABORT; + } + BEGIN_ORACLE_SYM + sp_block_statements_and_exceptions + END + { + $3.hndlrs+= $6.hndlrs; + if (unlikely(Lex->sp_block_finalize(thd, $3))) + MYSQL_YYABORT; + } + ; + +sp_instr_addr: + { $$= Lex->sphead->instructions(); } + ; + +sp_body: + { + Lex->sp_block_init(thd); + } + opt_sp_decl_body_list + { + if (unlikely(Lex->sp_block_with_exceptions_finalize_declarations(thd))) + MYSQL_YYABORT; + } + BEGIN_ORACLE_SYM + sp_block_statements_and_exceptions + { + $2.hndlrs+= $5.hndlrs; + if (unlikely(Lex->sp_block_finalize(thd, $2))) + MYSQL_YYABORT; + } + END + ; + +sp_block_statements_and_exceptions: + sp_instr_addr + sp_proc_stmts + { + if (unlikely(Lex->sp_block_with_exceptions_finalize_executable_section(thd, $1))) + MYSQL_YYABORT; + } + opt_exception_clause + { + if (unlikely(Lex->sp_block_with_exceptions_finalize_exceptions(thd, $1, $4))) + MYSQL_YYABORT; + $$.init($4); + } + ; + +opt_exception_clause: + /* Empty */ { $$= 0; } + | EXCEPTION_ORACLE_SYM exception_handlers { $$= $2; } + ; + +exception_handlers: + exception_handler { $$= 1; } + | exception_handlers exception_handler { $$= $1 + 1; } + ; + +exception_handler: + WHEN_SYM + { + if (unlikely(Lex->sp_handler_declaration_init(thd, sp_handler::EXIT))) + MYSQL_YYABORT; + } + sp_hcond_list + THEN_SYM + sp_proc_stmts1_implicit_block + { + if (unlikely(Lex->sp_handler_declaration_finalize(thd, sp_handler::EXIT))) + MYSQL_YYABORT; + } + ; + +/* This adds one shift/reduce conflict */ +opt_sp_for_loop_direction: + /* Empty */ { $$= 1; } + | REVERSE_SYM { $$= -1; } + ; + +sp_for_loop_index_and_bounds: + ident_directly_assignable sp_for_loop_bounds + { + if (unlikely(Lex->sp_for_loop_declarations(thd, &$$, &$1, $2))) + MYSQL_YYABORT; + } + ; + +sp_for_loop_bounds: + IN_SYM opt_sp_for_loop_direction for_loop_bound_expr + DOT_DOT_SYM for_loop_bound_expr + { + $$= Lex_for_loop_bounds_intrange($2, $3, $5); + } + | IN_SYM opt_sp_for_loop_direction for_loop_bound_expr + { + $$.m_direction= $2; + $$.m_index= $3; + $$.m_target_bound= NULL; + $$.m_implicit_cursor= false; + } + | IN_SYM opt_sp_for_loop_direction '(' sp_cursor_stmt ')' + { + if (unlikely(Lex->sp_for_loop_implicit_cursor_statement(thd, &$$, + $4))) + MYSQL_YYABORT; + } + ; + +loop_body: + sp_proc_stmts1 END LOOP_SYM + { + LEX *lex= Lex; + uint ip= lex->sphead->instructions(); + sp_label *lab= lex->spcont->last_label(); /* Jumping back */ + sp_instr_jump *i= new (thd->mem_root) + sp_instr_jump(ip, lex->spcont, lab->ip); + if (unlikely(i == NULL) || + unlikely(lex->sphead->add_instr(i))) + MYSQL_YYABORT; + } + ; + +while_body: + expr LOOP_SYM + { + LEX *lex= Lex; + if (unlikely(lex->sp_while_loop_expression(thd, $1))) + MYSQL_YYABORT; + if (unlikely(lex->sphead->restore_lex(thd))) + MYSQL_YYABORT; + } + sp_proc_stmts1 END LOOP_SYM + { + if (unlikely(Lex->sp_while_loop_finalize(thd))) + MYSQL_YYABORT; + } + ; + +repeat_body: + sp_proc_stmts1 UNTIL_SYM + { Lex->sphead->reset_lex(thd); } + expr END REPEAT_SYM + { + LEX *lex= Lex; + uint ip= lex->sphead->instructions(); + sp_label *lab= lex->spcont->last_label(); /* Jumping back */ + sp_instr_jump_if_not *i= new (thd->mem_root) + sp_instr_jump_if_not(ip, lex->spcont, $4, lab->ip, lex); + if (unlikely(i == NULL) || + unlikely(lex->sphead->add_instr(i))) + MYSQL_YYABORT; + if (unlikely(lex->sphead->restore_lex(thd))) + MYSQL_YYABORT; + /* We can shortcut the cont_backpatch here */ + i->m_cont_dest= ip+1; + } + ; + +pop_sp_loop_label: + sp_opt_label + { + if (unlikely(Lex->sp_pop_loop_label(thd, &$1))) + MYSQL_YYABORT; + } + ; + +sp_labeled_control: + labels_declaration_oracle LOOP_SYM + { + if (unlikely(Lex->sp_push_loop_label(thd, &$1))) + MYSQL_YYABORT; + } + loop_body pop_sp_loop_label + { } + | labels_declaration_oracle WHILE_SYM + { + if (unlikely(Lex->sp_push_loop_label(thd, &$1))) + MYSQL_YYABORT; + Lex->sphead->reset_lex(thd); + } + while_body pop_sp_loop_label + { } + | labels_declaration_oracle FOR_SYM + { + // See "The FOR LOOP statement" comments in sql_lex.cc + Lex->sp_block_init(thd); // The outer DECLARE..BEGIN..END block + } + sp_for_loop_index_and_bounds + { + if (unlikely(Lex->sp_push_loop_label(thd, &$1))) // The inner WHILE block + MYSQL_YYABORT; + if (unlikely(Lex->sp_for_loop_condition_test(thd, $4))) + MYSQL_YYABORT; + } + LOOP_SYM + sp_proc_stmts1 + END LOOP_SYM + { + if (unlikely(Lex->sp_for_loop_finalize(thd, $4))) + MYSQL_YYABORT; + } + pop_sp_loop_label // The inner WHILE block + { + if (unlikely(Lex->sp_for_loop_outer_block_finalize(thd, $4))) + MYSQL_YYABORT; + } + | labels_declaration_oracle REPEAT_SYM + { + if (unlikely(Lex->sp_push_loop_label(thd, &$1))) + MYSQL_YYABORT; + } + repeat_body pop_sp_loop_label + { } + ; + +sp_unlabeled_control: + LOOP_SYM + { + if (unlikely(Lex->sp_push_loop_empty_label(thd))) + MYSQL_YYABORT; + } + loop_body + { + Lex->sp_pop_loop_empty_label(thd); + } + | WHILE_SYM + { + if (unlikely(Lex->sp_push_loop_empty_label(thd))) + MYSQL_YYABORT; + Lex->sphead->reset_lex(thd); + } + while_body + { + Lex->sp_pop_loop_empty_label(thd); + } + | FOR_SYM + { + // See "The FOR LOOP statement" comments in sql_lex.cc + if (unlikely(Lex->maybe_start_compound_statement(thd))) + MYSQL_YYABORT; + Lex->sp_block_init(thd); // The outer DECLARE..BEGIN..END block + } + sp_for_loop_index_and_bounds + { + if (unlikely(Lex->sp_push_loop_empty_label(thd))) // The inner WHILE block + MYSQL_YYABORT; + if (unlikely(Lex->sp_for_loop_condition_test(thd, $3))) + MYSQL_YYABORT; + } + LOOP_SYM + sp_proc_stmts1 + END LOOP_SYM + { + if (unlikely(Lex->sp_for_loop_finalize(thd, $3))) + MYSQL_YYABORT; + Lex->sp_pop_loop_empty_label(thd); // The inner WHILE block + if (unlikely(Lex->sp_for_loop_outer_block_finalize(thd, $3))) + MYSQL_YYABORT; + } + | REPEAT_SYM + { + if (unlikely(Lex->sp_push_loop_empty_label(thd))) + MYSQL_YYABORT; + } + repeat_body + { + Lex->sp_pop_loop_empty_label(thd); + } + ; + +trg_action_time: + BEFORE_SYM + { Lex->trg_chistics.action_time= TRG_ACTION_BEFORE; } + | AFTER_SYM + { Lex->trg_chistics.action_time= TRG_ACTION_AFTER; } + ; + +trg_event: + INSERT + { Lex->trg_chistics.event= TRG_EVENT_INSERT; } + | UPDATE_SYM + { Lex->trg_chistics.event= TRG_EVENT_UPDATE; } + | DELETE_SYM + { Lex->trg_chistics.event= TRG_EVENT_DELETE; } + ; +/* + This part of the parser contains common code for all TABLESPACE + commands. + CREATE TABLESPACE name ... + ALTER TABLESPACE name CHANGE DATAFILE ... + ALTER TABLESPACE name ADD DATAFILE ... + ALTER TABLESPACE name access_mode + CREATE LOGFILE GROUP_SYM name ... + ALTER LOGFILE GROUP_SYM name ADD UNDOFILE .. + ALTER LOGFILE GROUP_SYM name ADD REDOFILE .. + DROP TABLESPACE name + DROP LOGFILE GROUP_SYM name +*/ +change_tablespace_access: + tablespace_name + ts_access_mode + ; + +change_tablespace_info: + tablespace_name + CHANGE ts_datafile + change_ts_option_list + ; + +tablespace_info: + tablespace_name + ADD ts_datafile + opt_logfile_group_name + tablespace_option_list + ; + +opt_logfile_group_name: + /* empty */ {} + | USE_SYM LOGFILE_SYM GROUP_SYM ident + { + LEX *lex= Lex; + lex->alter_tablespace_info->logfile_group_name= $4.str; + } + ; + +alter_tablespace_info: + tablespace_name + ADD ts_datafile + alter_tablespace_option_list + { + Lex->alter_tablespace_info->ts_alter_tablespace_type= ALTER_TABLESPACE_ADD_FILE; + } + | tablespace_name + DROP ts_datafile + alter_tablespace_option_list + { + Lex->alter_tablespace_info->ts_alter_tablespace_type= ALTER_TABLESPACE_DROP_FILE; + } + ; + +logfile_group_info: + logfile_group_name + add_log_file + logfile_group_option_list + ; + +alter_logfile_group_info: + logfile_group_name + add_log_file + alter_logfile_group_option_list + ; + +add_log_file: + ADD lg_undofile + | ADD lg_redofile + ; + +change_ts_option_list: + /* empty */ {} + change_ts_options + ; + +change_ts_options: + change_ts_option + | change_ts_options change_ts_option + | change_ts_options ',' change_ts_option + ; + +change_ts_option: + opt_ts_initial_size + | opt_ts_autoextend_size + | opt_ts_max_size + ; + +tablespace_option_list: + tablespace_options + ; + +tablespace_options: + tablespace_option + | tablespace_options tablespace_option + | tablespace_options ',' tablespace_option + ; + +tablespace_option: + opt_ts_initial_size + | opt_ts_autoextend_size + | opt_ts_max_size + | opt_ts_extent_size + | opt_ts_nodegroup + | opt_ts_engine + | ts_wait + | opt_ts_comment + ; + +alter_tablespace_option_list: + alter_tablespace_options + ; + +alter_tablespace_options: + alter_tablespace_option + | alter_tablespace_options alter_tablespace_option + | alter_tablespace_options ',' alter_tablespace_option + ; + +alter_tablespace_option: + opt_ts_initial_size + | opt_ts_autoextend_size + | opt_ts_max_size + | opt_ts_engine + | ts_wait + ; + +logfile_group_option_list: + logfile_group_options + ; + +logfile_group_options: + logfile_group_option + | logfile_group_options logfile_group_option + | logfile_group_options ',' logfile_group_option + ; + +logfile_group_option: + opt_ts_initial_size + | opt_ts_undo_buffer_size + | opt_ts_redo_buffer_size + | opt_ts_nodegroup + | opt_ts_engine + | ts_wait + | opt_ts_comment + ; + +alter_logfile_group_option_list: + alter_logfile_group_options + ; + +alter_logfile_group_options: + alter_logfile_group_option + | alter_logfile_group_options alter_logfile_group_option + | alter_logfile_group_options ',' alter_logfile_group_option + ; + +alter_logfile_group_option: + opt_ts_initial_size + | opt_ts_engine + | ts_wait + ; + + +ts_datafile: + DATAFILE_SYM TEXT_STRING_sys + { + LEX *lex= Lex; + lex->alter_tablespace_info->data_file_name= $2.str; + } + ; + +lg_undofile: + UNDOFILE_SYM TEXT_STRING_sys + { + LEX *lex= Lex; + lex->alter_tablespace_info->undo_file_name= $2.str; + } + ; + +lg_redofile: + REDOFILE_SYM TEXT_STRING_sys + { + LEX *lex= Lex; + lex->alter_tablespace_info->redo_file_name= $2.str; + } + ; + +tablespace_name: + ident + { + LEX *lex= Lex; + lex->alter_tablespace_info= (new (thd->mem_root) + st_alter_tablespace()); + if (unlikely(lex->alter_tablespace_info == NULL)) + MYSQL_YYABORT; + lex->alter_tablespace_info->tablespace_name= $1.str; + lex->sql_command= SQLCOM_ALTER_TABLESPACE; + } + ; + +logfile_group_name: + ident + { + LEX *lex= Lex; + lex->alter_tablespace_info= (new (thd->mem_root) + st_alter_tablespace()); + if (unlikely(lex->alter_tablespace_info == NULL)) + MYSQL_YYABORT; + lex->alter_tablespace_info->logfile_group_name= $1.str; + lex->sql_command= SQLCOM_ALTER_TABLESPACE; + } + ; + +ts_access_mode: + READ_ONLY_SYM + { + LEX *lex= Lex; + lex->alter_tablespace_info->ts_access_mode= TS_READ_ONLY; + } + | READ_WRITE_SYM + { + LEX *lex= Lex; + lex->alter_tablespace_info->ts_access_mode= TS_READ_WRITE; + } + | NOT_SYM ACCESSIBLE_SYM + { + LEX *lex= Lex; + lex->alter_tablespace_info->ts_access_mode= TS_NOT_ACCESSIBLE; + } + ; + +opt_ts_initial_size: + INITIAL_SIZE_SYM opt_equal size_number + { + LEX *lex= Lex; + lex->alter_tablespace_info->initial_size= $3; + } + ; + +opt_ts_autoextend_size: + AUTOEXTEND_SIZE_SYM opt_equal size_number + { + LEX *lex= Lex; + lex->alter_tablespace_info->autoextend_size= $3; + } + ; + +opt_ts_max_size: + MAX_SIZE_SYM opt_equal size_number + { + LEX *lex= Lex; + lex->alter_tablespace_info->max_size= $3; + } + ; + +opt_ts_extent_size: + EXTENT_SIZE_SYM opt_equal size_number + { + LEX *lex= Lex; + lex->alter_tablespace_info->extent_size= $3; + } + ; + +opt_ts_undo_buffer_size: + UNDO_BUFFER_SIZE_SYM opt_equal size_number + { + LEX *lex= Lex; + lex->alter_tablespace_info->undo_buffer_size= $3; + } + ; + +opt_ts_redo_buffer_size: + REDO_BUFFER_SIZE_SYM opt_equal size_number + { + LEX *lex= Lex; + lex->alter_tablespace_info->redo_buffer_size= $3; + } + ; + +opt_ts_nodegroup: + NODEGROUP_SYM opt_equal real_ulong_num + { + LEX *lex= Lex; + if (unlikely(lex->alter_tablespace_info->nodegroup_id != UNDEF_NODEGROUP)) + my_yyabort_error((ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0),"NODEGROUP")); + lex->alter_tablespace_info->nodegroup_id= $3; + } + ; + +opt_ts_comment: + COMMENT_SYM opt_equal TEXT_STRING_sys + { + LEX *lex= Lex; + if (unlikely(lex->alter_tablespace_info->ts_comment != NULL)) + my_yyabort_error((ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0),"COMMENT")); + lex->alter_tablespace_info->ts_comment= $3.str; + } + ; + +opt_ts_engine: + opt_storage ENGINE_SYM opt_equal storage_engines + { + LEX *lex= Lex; + if (unlikely(lex->alter_tablespace_info->storage_engine != NULL)) + my_yyabort_error((ER_FILEGROUP_OPTION_ONLY_ONCE, MYF(0), + "STORAGE ENGINE")); + lex->alter_tablespace_info->storage_engine= $4; + } + ; + +opt_ts_wait: + /* empty */ + | ts_wait + ; + +ts_wait: + WAIT_SYM + { + LEX *lex= Lex; + lex->alter_tablespace_info->wait_until_completed= TRUE; + } + | NO_WAIT_SYM + { + LEX *lex= Lex; + if (unlikely(!(lex->alter_tablespace_info->wait_until_completed))) + my_yyabort_error((ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0),"NO_WAIT")); + lex->alter_tablespace_info->wait_until_completed= FALSE; + } + ; + +size_number: + real_ulonglong_num { $$= $1;} + | IDENT_sys + { + if ($1.to_size_number(&$$)) + MYSQL_YYABORT; + } + ; + +/* + End tablespace part +*/ + +create_body: + '(' create_field_list ')' + { Lex->create_info.option_list= NULL; } + opt_create_table_options opt_create_partitioning opt_create_select {} + | opt_create_table_options opt_create_partitioning opt_create_select {} + /* + the following rule is redundant, but there's a shift/reduce + conflict that prevents the rule above from parsing a syntax like + CREATE TABLE t1 (SELECT 1); + */ + | '(' create_select_query_specification ')' + | '(' create_select_query_specification ')' + { Select->set_braces(1);} union_list {} + | '(' create_select_query_specification ')' + { Select->set_braces(1);} union_order_or_limit {} + | create_like + { + + Lex->create_info.add(DDL_options_st::OPT_LIKE); + TABLE_LIST *src_table= Lex->select_lex.add_table_to_list(thd, + $1, NULL, 0, TL_READ, MDL_SHARED_READ); + if (unlikely(! src_table)) + MYSQL_YYABORT; + /* CREATE TABLE ... LIKE is not allowed for views. */ + src_table->required_type= TABLE_TYPE_NORMAL; + } + ; + +create_like: + LIKE table_ident { $$= $2; } + | '(' LIKE table_ident ')' { $$= $3; } + ; + +opt_create_select: + /* empty */ {} + | opt_duplicate opt_as create_select_query_expression opt_versioning_option + ; + +create_select_query_expression: + opt_with_clause SELECT_SYM create_select_part2 opt_table_expression + create_select_part4 + { + Select->set_braces(0); + Select->set_with_clause($1); + } + union_clause + | opt_with_clause SELECT_SYM create_select_part2 + create_select_part3_union_not_ready create_select_part4 + { + Select->set_with_clause($1); + } + | '(' create_select_query_specification ')' + | '(' create_select_query_specification ')' + { Select->set_braces(1);} union_list {} + | '(' create_select_query_specification ')' + { Select->set_braces(1);} union_order_or_limit {} + ; + +opt_create_partitioning: + opt_partitioning + { + /* + Remove all tables used in PARTITION clause from the global table + list. Partitioning with subqueries is not allowed anyway. + */ + TABLE_LIST *last_non_sel_table= Lex->create_last_non_select_table; + last_non_sel_table->next_global= 0; + Lex->query_tables_last= &last_non_sel_table->next_global; + } + ; + +/* + This part of the parser is about handling of the partition information. + + It's first version was written by Mikael Ronstrm with lots of answers to + questions provided by Antony Curtis. + + The partition grammar can be called from three places. + 1) CREATE TABLE ... PARTITION .. + 2) ALTER TABLE table_name PARTITION ... + 3) PARTITION ... + + The first place is called when a new table is created from a MySQL client. + The second place is called when a table is altered with the ALTER TABLE + command from a MySQL client. + The third place is called when opening an frm file and finding partition + info in the .frm file. It is necessary to avoid allowing PARTITION to be + an allowed entry point for SQL client queries. This is arranged by setting + some state variables before arriving here. + + To be able to handle errors we will only set error code in this code + and handle the error condition in the function calling the parser. This + is necessary to ensure we can also handle errors when calling the parser + from the openfrm function. +*/ +opt_partitioning: + /* empty */ {} + | partitioning + ; + +partitioning: + PARTITION_SYM have_partitioning + { + LEX *lex= Lex; + lex->part_info= new (thd->mem_root) partition_info(); + if (unlikely(!lex->part_info)) + MYSQL_YYABORT; + if (lex->sql_command == SQLCOM_ALTER_TABLE) + { + lex->alter_info.partition_flags|= ALTER_PARTITION_INFO; + } + } + partition + ; + +have_partitioning: + /* empty */ + { +#ifdef WITH_PARTITION_STORAGE_ENGINE + LEX_CSTRING partition_name={STRING_WITH_LEN("partition")}; + if (unlikely(!plugin_is_ready(&partition_name, MYSQL_STORAGE_ENGINE_PLUGIN))) + my_yyabort_error((ER_OPTION_PREVENTS_STATEMENT, MYF(0), + "--skip-partition")); +#else + my_yyabort_error((ER_FEATURE_DISABLED, MYF(0), "partitioning", + "--with-plugin-partition")); +#endif + } + ; + +partition_entry: + PARTITION_SYM + { + if (unlikely(!Lex->part_info)) + { + thd->parse_error(ER_PARTITION_ENTRY_ERROR); + MYSQL_YYABORT; + } + DBUG_ASSERT(Lex->part_info->table); + /* + We enter here when opening the frm file to translate + partition info string into part_info data structure. + */ + } + partition {} + ; + +partition: + BY + { Lex->safe_to_cache_query= 1; } + part_type_def opt_num_parts opt_sub_part part_defs + ; + +part_type_def: + opt_linear KEY_SYM opt_key_algo '(' part_field_list ')' + { + partition_info *part_info= Lex->part_info; + part_info->list_of_part_fields= TRUE; + part_info->column_list= FALSE; + part_info->part_type= HASH_PARTITION; + } + | opt_linear HASH_SYM + { Lex->part_info->part_type= HASH_PARTITION; } + part_func {} + | RANGE_SYM part_func + { Lex->part_info->part_type= RANGE_PARTITION; } + | RANGE_SYM part_column_list + { Lex->part_info->part_type= RANGE_PARTITION; } + | LIST_SYM + { + Select->parsing_place= IN_PART_FUNC; + } + part_func + { + Lex->part_info->part_type= LIST_PARTITION; + Select->parsing_place= NO_MATTER; + } + | LIST_SYM part_column_list + { Lex->part_info->part_type= LIST_PARTITION; } + | SYSTEM_TIME_SYM + { + if (unlikely(Lex->part_info->vers_init_info(thd))) + MYSQL_YYABORT; + } + opt_versioning_rotation + ; + +opt_linear: + /* empty */ {} + | LINEAR_SYM + { Lex->part_info->linear_hash_ind= TRUE;} + ; + +opt_key_algo: + /* empty */ + { Lex->part_info->key_algorithm= partition_info::KEY_ALGORITHM_NONE;} + | ALGORITHM_SYM '=' real_ulong_num + { + switch ($3) { + case 1: + Lex->part_info->key_algorithm= partition_info::KEY_ALGORITHM_51; + break; + case 2: + Lex->part_info->key_algorithm= partition_info::KEY_ALGORITHM_55; + break; + default: + thd->parse_error(); + MYSQL_YYABORT; + } + } + ; + +part_field_list: + /* empty */ {} + | part_field_item_list {} + ; + +part_field_item_list: + part_field_item {} + | part_field_item_list ',' part_field_item {} + ; + +part_field_item: + ident + { + partition_info *part_info= Lex->part_info; + part_info->num_columns++; + if (unlikely(part_info->part_field_list.push_back($1.str, + thd->mem_root))) + MYSQL_YYABORT; + if (unlikely(part_info->num_columns > MAX_REF_PARTS)) + my_yyabort_error((ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR, MYF(0), + "list of partition fields")); + } + ; + +part_column_list: + COLUMNS '(' part_field_list ')' + { + partition_info *part_info= Lex->part_info; + part_info->column_list= TRUE; + part_info->list_of_part_fields= TRUE; + } + ; + + +part_func: + '(' remember_name part_func_expr remember_end ')' + { + partition_info *part_info= Lex->part_info; + if (unlikely(part_info->set_part_expr(thd, $2 + 1, $3, $4, FALSE))) + MYSQL_YYABORT; + part_info->num_columns= 1; + part_info->column_list= FALSE; + } + ; + +sub_part_func: + '(' remember_name part_func_expr remember_end ')' + { + if (unlikely(Lex->part_info->set_part_expr(thd, $2 + 1, $3, $4, TRUE))) + MYSQL_YYABORT; + } + ; + + +opt_num_parts: + /* empty */ {} + | PARTITIONS_SYM real_ulong_num + { + uint num_parts= $2; + partition_info *part_info= Lex->part_info; + if (unlikely(num_parts == 0)) + my_yyabort_error((ER_NO_PARTS_ERROR, MYF(0), "partitions")); + + part_info->num_parts= num_parts; + part_info->use_default_num_partitions= FALSE; + } + ; + +opt_sub_part: + /* empty */ {} + | SUBPARTITION_SYM BY opt_linear HASH_SYM sub_part_func + { Lex->part_info->subpart_type= HASH_PARTITION; } + opt_num_subparts {} + | SUBPARTITION_SYM BY opt_linear KEY_SYM opt_key_algo + '(' sub_part_field_list ')' + { + partition_info *part_info= Lex->part_info; + part_info->subpart_type= HASH_PARTITION; + part_info->list_of_subpart_fields= TRUE; + } + opt_num_subparts {} + ; + +sub_part_field_list: + sub_part_field_item {} + | sub_part_field_list ',' sub_part_field_item {} + ; + +sub_part_field_item: + ident + { + partition_info *part_info= Lex->part_info; + if (unlikely(part_info->subpart_field_list.push_back($1.str, + thd->mem_root))) + MYSQL_YYABORT; + + if (unlikely(part_info->subpart_field_list.elements > MAX_REF_PARTS)) + my_yyabort_error((ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR, MYF(0), + "list of subpartition fields")); + } + ; + +part_func_expr: + bit_expr + { + if (unlikely(!Lex->safe_to_cache_query)) + { + thd->parse_error(ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR); + MYSQL_YYABORT; + } + $$=$1; + } + ; + +opt_num_subparts: + /* empty */ {} + | SUBPARTITIONS_SYM real_ulong_num + { + uint num_parts= $2; + LEX *lex= Lex; + if (unlikely(num_parts == 0)) + my_yyabort_error((ER_NO_PARTS_ERROR, MYF(0), "subpartitions")); + lex->part_info->num_subparts= num_parts; + lex->part_info->use_default_num_subpartitions= FALSE; + } + ; + +part_defs: + /* empty */ + { + partition_info *part_info= Lex->part_info; + if (unlikely(part_info->part_type == RANGE_PARTITION)) + my_yyabort_error((ER_PARTITIONS_MUST_BE_DEFINED_ERROR, MYF(0), + "RANGE")); + if (unlikely(part_info->part_type == LIST_PARTITION)) + my_yyabort_error((ER_PARTITIONS_MUST_BE_DEFINED_ERROR, MYF(0), + "LIST")); + } + | '(' part_def_list ')' + { + partition_info *part_info= Lex->part_info; + uint count_curr_parts= part_info->partitions.elements; + if (part_info->num_parts != 0) + { + if (unlikely(part_info->num_parts != + count_curr_parts)) + { + thd->parse_error(ER_PARTITION_WRONG_NO_PART_ERROR); + MYSQL_YYABORT; + } + } + else if (count_curr_parts > 0) + { + part_info->num_parts= count_curr_parts; + } + part_info->count_curr_subparts= 0; + } + ; + +part_def_list: + part_definition {} + | part_def_list ',' part_definition {} + ; + +part_definition: + PARTITION_SYM + { + partition_info *part_info= Lex->part_info; + partition_element *p_elem= new (thd->mem_root) partition_element(); + + if (unlikely(!p_elem) || + unlikely(part_info->partitions.push_back(p_elem, thd->mem_root))) + MYSQL_YYABORT; + + p_elem->part_state= PART_NORMAL; + p_elem->id= part_info->partitions.elements - 1; + part_info->curr_part_elem= p_elem; + part_info->current_partition= p_elem; + part_info->use_default_partitions= FALSE; + part_info->use_default_num_partitions= FALSE; + } + part_name + opt_part_values + opt_part_options + opt_sub_partition + {} + ; + +part_name: + ident + { + partition_info *part_info= Lex->part_info; + partition_element *p_elem= part_info->curr_part_elem; + if (unlikely(check_ident_length(&$1))) + MYSQL_YYABORT; + p_elem->partition_name= $1.str; + } + ; + +opt_part_values: + /* empty */ + { + LEX *lex= Lex; + partition_info *part_info= lex->part_info; + if (! lex->is_partition_management()) + { + if (unlikely(part_info->error_if_requires_values())) + MYSQL_YYABORT; + if (unlikely(part_info->part_type == VERSIONING_PARTITION)) + my_yyabort_error((ER_VERS_WRONG_PARTS, MYF(0), + lex->create_last_non_select_table-> + table_name.str)); + } + else + part_info->part_type= HASH_PARTITION; + } + | VALUES_LESS_SYM THAN_SYM + { + LEX *lex= Lex; + partition_info *part_info= lex->part_info; + if (! lex->is_partition_management()) + { + if (unlikely(part_info->part_type != RANGE_PARTITION)) + my_yyabort_error((ER_PARTITION_WRONG_VALUES_ERROR, MYF(0), + "RANGE", "LESS THAN")); + } + else + part_info->part_type= RANGE_PARTITION; + } + part_func_max {} + | VALUES_IN_SYM + { + LEX *lex= Lex; + partition_info *part_info= lex->part_info; + if (! lex->is_partition_management()) + { + if (unlikely(part_info->part_type != LIST_PARTITION)) + my_yyabort_error((ER_PARTITION_WRONG_VALUES_ERROR, MYF(0), + "LIST", "IN")); + } + else + part_info->part_type= LIST_PARTITION; + } + part_values_in {} + | CURRENT_SYM + { + if (Lex->part_values_current(thd)) + MYSQL_YYABORT; + } + | HISTORY_SYM + { + if (Lex->part_values_history(thd)) + MYSQL_YYABORT; + } + | DEFAULT + { + LEX *lex= Lex; + partition_info *part_info= lex->part_info; + if (! lex->is_partition_management()) + { + if (unlikely(part_info->part_type != LIST_PARTITION)) + my_yyabort_error((ER_PARTITION_WRONG_VALUES_ERROR, MYF(0), + "LIST", "DEFAULT")); + } + else + part_info->part_type= LIST_PARTITION; + if (unlikely(part_info->init_column_part(thd))) + MYSQL_YYABORT; + if (unlikely(part_info->add_max_value(thd))) + MYSQL_YYABORT; + } + ; + +part_func_max: + MAXVALUE_SYM + { + partition_info *part_info= Lex->part_info; + + if (unlikely(part_info->num_columns && + part_info->num_columns != 1U)) + { + part_info->print_debug("Kilroy II", NULL); + thd->parse_error(ER_PARTITION_COLUMN_LIST_ERROR); + MYSQL_YYABORT; + } + else + part_info->num_columns= 1U; + if (unlikely(part_info->init_column_part(thd))) + MYSQL_YYABORT; + if (unlikely(part_info->add_max_value(thd))) + MYSQL_YYABORT; + } + | part_value_item {} + ; + +part_values_in: + part_value_item + { + LEX *lex= Lex; + partition_info *part_info= lex->part_info; + part_info->print_debug("part_values_in: part_value_item", NULL); + + if (part_info->num_columns != 1U) + { + if (unlikely(!lex->is_partition_management() || + part_info->num_columns == 0 || + part_info->num_columns > MAX_REF_PARTS)) + { + part_info->print_debug("Kilroy III", NULL); + thd->parse_error(ER_PARTITION_COLUMN_LIST_ERROR); + MYSQL_YYABORT; + } + /* + Reorganize the current large array into a list of small + arrays with one entry in each array. This can happen + in the first partition of an ALTER TABLE statement where + we ADD or REORGANIZE partitions. Also can only happen + for LIST partitions. + */ + if (unlikely(part_info->reorganize_into_single_field_col_val(thd))) + MYSQL_YYABORT; + } + } + | '(' part_value_list ')' + { + partition_info *part_info= Lex->part_info; + if (unlikely(part_info->num_columns < 2U)) + { + thd->parse_error(ER_ROW_SINGLE_PARTITION_FIELD_ERROR); + MYSQL_YYABORT; + } + } + ; + +part_value_list: + part_value_item {} + | part_value_list ',' part_value_item {} + ; + +part_value_item: + '(' + { + partition_info *part_info= Lex->part_info; + part_info->print_debug("( part_value_item", NULL); + /* Initialisation code needed for each list of value expressions */ + if (unlikely(!(part_info->part_type == LIST_PARTITION && + part_info->num_columns == 1U) && + part_info->init_column_part(thd))) + MYSQL_YYABORT; + } + part_value_item_list {} + ')' + { + partition_info *part_info= Lex->part_info; + part_info->print_debug(") part_value_item", NULL); + if (part_info->num_columns == 0) + part_info->num_columns= part_info->curr_list_object; + if (unlikely(part_info->num_columns != part_info->curr_list_object)) + { + /* + All value items lists must be of equal length, in some cases + which is covered by the above if-statement we don't know yet + how many columns is in the partition so the assignment above + ensures that we only report errors when we know we have an + error. + */ + part_info->print_debug("Kilroy I", NULL); + thd->parse_error(ER_PARTITION_COLUMN_LIST_ERROR); + MYSQL_YYABORT; + } + part_info->curr_list_object= 0; + } + ; + +part_value_item_list: + part_value_expr_item {} + | part_value_item_list ',' part_value_expr_item {} + ; + +part_value_expr_item: + MAXVALUE_SYM + { + partition_info *part_info= Lex->part_info; + if (unlikely(part_info->part_type == LIST_PARTITION)) + { + thd->parse_error(ER_MAXVALUE_IN_VALUES_IN); + MYSQL_YYABORT; + } + if (unlikely(part_info->add_max_value(thd))) + MYSQL_YYABORT; + } + | bit_expr + { + LEX *lex= Lex; + partition_info *part_info= lex->part_info; + Item *part_expr= $1; + + if (unlikely(!lex->safe_to_cache_query)) + { + thd->parse_error(ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR); + MYSQL_YYABORT; + } + if (unlikely(part_info->add_column_list_value(thd, part_expr))) + MYSQL_YYABORT; + } + ; + + +opt_sub_partition: + /* empty */ + { + partition_info *part_info= Lex->part_info; + if (unlikely(part_info->num_subparts != 0 && + !part_info->use_default_subpartitions)) + { + /* + We come here when we have defined subpartitions on the first + partition but not on all the subsequent partitions. + */ + thd->parse_error(ER_PARTITION_WRONG_NO_SUBPART_ERROR); + MYSQL_YYABORT; + } + } + | '(' sub_part_list ')' + { + partition_info *part_info= Lex->part_info; + if (part_info->num_subparts != 0) + { + if (unlikely(part_info->num_subparts != + part_info->count_curr_subparts)) + { + thd->parse_error(ER_PARTITION_WRONG_NO_SUBPART_ERROR); + MYSQL_YYABORT; + } + } + else if (part_info->count_curr_subparts > 0) + { + if (unlikely(part_info->partitions.elements > 1)) + { + thd->parse_error(ER_PARTITION_WRONG_NO_SUBPART_ERROR); + MYSQL_YYABORT; + } + part_info->num_subparts= part_info->count_curr_subparts; + } + part_info->count_curr_subparts= 0; + } + ; + +sub_part_list: + sub_part_definition {} + | sub_part_list ',' sub_part_definition {} + ; + +sub_part_definition: + SUBPARTITION_SYM + { + partition_info *part_info= Lex->part_info; + partition_element *curr_part= part_info->current_partition; + partition_element *sub_p_elem= new (thd->mem_root) + partition_element(curr_part); + if (unlikely(part_info->use_default_subpartitions && + part_info->partitions.elements >= 2)) + { + /* + create table t1 (a int) + partition by list (a) subpartition by hash (a) + (partition p0 values in (1), + partition p1 values in (2) subpartition sp11); + causes use to arrive since we are on the second + partition, but still use_default_subpartitions + is set. When we come here we're processing at least + the second partition (the current partition processed + have already been put into the partitions list. + */ + thd->parse_error(ER_PARTITION_WRONG_NO_SUBPART_ERROR); + MYSQL_YYABORT; + } + if (unlikely(!sub_p_elem) || + unlikely(curr_part->subpartitions.push_back(sub_p_elem, thd->mem_root))) + MYSQL_YYABORT; + + sub_p_elem->id= curr_part->subpartitions.elements - 1; + part_info->curr_part_elem= sub_p_elem; + part_info->use_default_subpartitions= FALSE; + part_info->use_default_num_subpartitions= FALSE; + part_info->count_curr_subparts++; + } + sub_name opt_part_options {} + ; + +sub_name: + ident_or_text + { + if (unlikely(check_ident_length(&$1))) + MYSQL_YYABORT; + Lex->part_info->curr_part_elem->partition_name= $1.str; + } + ; + +opt_part_options: + /* empty */ {} + | opt_part_option_list {} + ; + +opt_part_option_list: + opt_part_option_list opt_part_option {} + | opt_part_option {} + ; + +opt_part_option: + TABLESPACE opt_equal ident_or_text + { Lex->part_info->curr_part_elem->tablespace_name= $3.str; } + | opt_storage ENGINE_SYM opt_equal storage_engines + { + partition_info *part_info= Lex->part_info; + part_info->curr_part_elem->engine_type= $4; + part_info->default_engine_type= $4; + } + | CONNECTION_SYM opt_equal TEXT_STRING_sys + { + LEX *lex= Lex; + lex->part_info->curr_part_elem->connect_string.str= $3.str; + lex->part_info->curr_part_elem->connect_string.length= $3.length; + } + | NODEGROUP_SYM opt_equal real_ulong_num + { Lex->part_info->curr_part_elem->nodegroup_id= (uint16) $3; } + | MAX_ROWS opt_equal real_ulonglong_num + { Lex->part_info->curr_part_elem->part_max_rows= (ha_rows) $3; } + | MIN_ROWS opt_equal real_ulonglong_num + { Lex->part_info->curr_part_elem->part_min_rows= (ha_rows) $3; } + | DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys + { Lex->part_info->curr_part_elem->data_file_name= $4.str; } + | INDEX_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys + { Lex->part_info->curr_part_elem->index_file_name= $4.str; } + | COMMENT_SYM opt_equal TEXT_STRING_sys + { Lex->part_info->curr_part_elem->part_comment= $3.str; } + ; + +opt_versioning_rotation: + /* empty */ {} + | INTERVAL_SYM expr interval opt_versioning_interval_start + { + partition_info *part_info= Lex->part_info; + if (unlikely(part_info->vers_set_interval($2, $3, $4))) + { + my_error(ER_PART_WRONG_VALUE, MYF(0), + Lex->create_last_non_select_table->table_name.str, + "INTERVAL"); + MYSQL_YYABORT; + } + } + | LIMIT ulonglong_num + { + partition_info *part_info= Lex->part_info; + if (unlikely(part_info->vers_set_limit($2))) + { + my_error(ER_PART_WRONG_VALUE, MYF(0), + Lex->create_last_non_select_table->table_name.str, + "LIMIT"); + MYSQL_YYABORT; + } + } + ; + + +opt_versioning_interval_start: + /* empty */ + { + $$= thd->query_start(); + } + | STARTS_SYM ulong_num + { + /* only allowed from mysql_unpack_partition() */ + if (unlikely(!Lex->part_info->table)) + { + thd->parse_error(ER_SYNTAX_ERROR, $1.pos()); + MYSQL_YYABORT; + } + $$= (ulong)$2; + } + ; + +/* + End of partition parser part +*/ + +create_select_query_specification: + opt_with_clause SELECT_SYM create_select_part2 create_select_part3 + create_select_part4 + { + Select->set_with_clause($1); + } + ; + +create_select_part2: + { + LEX *lex=Lex; + if (lex->sql_command == SQLCOM_INSERT) + lex->sql_command= SQLCOM_INSERT_SELECT; + else if (lex->sql_command == SQLCOM_REPLACE) + lex->sql_command= SQLCOM_REPLACE_SELECT; + /* + The following work only with the local list, the global list + is created correctly in this case + */ + lex->current_select->table_list.save_and_clear(&lex->save_list); + mysql_init_select(lex); + lex->current_select->parsing_place= SELECT_LIST; + } + select_options select_item_list + { + Select->parsing_place= NO_MATTER; + } + ; + +create_select_part3: + opt_table_expression + | create_select_part3_union_not_ready + ; + +create_select_part3_union_not_ready: + table_expression order_or_limit + | order_or_limit + ; + +create_select_part4: + opt_select_lock_type + { + /* + The following work only with the local list, the global list + is created correctly in this case + */ + Lex->current_select->table_list.push_front(&Lex->save_list); + } + ; + +opt_as: + /* empty */ {} + | AS {} + ; + +opt_create_database_options: + /* empty */ {} + | create_database_options {} + ; + +create_database_options: + create_database_option {} + | create_database_options create_database_option {} + ; + +create_database_option: + default_collation {} + | default_charset {} + ; + +opt_if_not_exists_table_element: + /* empty */ + { + Lex->check_exists= FALSE; + } + | IF_SYM not EXISTS + { + Lex->check_exists= TRUE; + } + ; + +opt_if_not_exists: + /* empty */ + { + $$.init(); + } + | IF_SYM not EXISTS + { + $$.set(DDL_options_st::OPT_IF_NOT_EXISTS); + } + ; + +create_or_replace: + CREATE /* empty */ + { + $$.init(); + } + | CREATE OR_SYM REPLACE + { + $$.set(DDL_options_st::OPT_OR_REPLACE); + } + ; + +opt_create_table_options: + /* empty */ + | create_table_options + ; + +create_table_options_space_separated: + create_table_option + | create_table_option create_table_options_space_separated + ; + +create_table_options: + create_table_option + | create_table_option create_table_options + | create_table_option ',' create_table_options + ; + +create_table_option: + ENGINE_SYM opt_equal storage_engines + { + Lex->create_info.db_type= $3; + Lex->create_info.used_fields|= HA_CREATE_USED_ENGINE; + } + | MAX_ROWS opt_equal ulonglong_num + { + Lex->create_info.max_rows= $3; + Lex->create_info.used_fields|= HA_CREATE_USED_MAX_ROWS; + } + | MIN_ROWS opt_equal ulonglong_num + { + Lex->create_info.min_rows= $3; + Lex->create_info.used_fields|= HA_CREATE_USED_MIN_ROWS; + } + | AVG_ROW_LENGTH opt_equal ulong_num + { + Lex->create_info.avg_row_length=$3; + Lex->create_info.used_fields|= HA_CREATE_USED_AVG_ROW_LENGTH; + } + | PASSWORD_SYM opt_equal TEXT_STRING_sys + { + Lex->create_info.password=$3.str; + Lex->create_info.used_fields|= HA_CREATE_USED_PASSWORD; + } + | COMMENT_SYM opt_equal TEXT_STRING_sys + { + Lex->create_info.comment=$3; + Lex->create_info.used_fields|= HA_CREATE_USED_COMMENT; + } + | AUTO_INC opt_equal ulonglong_num + { + Lex->create_info.auto_increment_value=$3; + Lex->create_info.used_fields|= HA_CREATE_USED_AUTO; + } + | PACK_KEYS_SYM opt_equal ulong_num + { + switch($3) { + case 0: + Lex->create_info.table_options|= HA_OPTION_NO_PACK_KEYS; + break; + case 1: + Lex->create_info.table_options|= HA_OPTION_PACK_KEYS; + break; + default: + thd->parse_error(); + MYSQL_YYABORT; + } + Lex->create_info.used_fields|= HA_CREATE_USED_PACK_KEYS; + } + | PACK_KEYS_SYM opt_equal DEFAULT + { + Lex->create_info.table_options&= + ~(HA_OPTION_PACK_KEYS | HA_OPTION_NO_PACK_KEYS); + Lex->create_info.used_fields|= HA_CREATE_USED_PACK_KEYS; + } + | STATS_AUTO_RECALC_SYM opt_equal ulong_num + { + switch($3) { + case 0: + Lex->create_info.stats_auto_recalc= HA_STATS_AUTO_RECALC_OFF; + break; + case 1: + Lex->create_info.stats_auto_recalc= HA_STATS_AUTO_RECALC_ON; + break; + default: + thd->parse_error(); + MYSQL_YYABORT; + } + Lex->create_info.used_fields|= HA_CREATE_USED_STATS_AUTO_RECALC; + } + | STATS_AUTO_RECALC_SYM opt_equal DEFAULT + { + Lex->create_info.stats_auto_recalc= HA_STATS_AUTO_RECALC_DEFAULT; + Lex->create_info.used_fields|= HA_CREATE_USED_STATS_AUTO_RECALC; + } + | STATS_PERSISTENT_SYM opt_equal ulong_num + { + switch($3) { + case 0: + Lex->create_info.table_options|= HA_OPTION_NO_STATS_PERSISTENT; + break; + case 1: + Lex->create_info.table_options|= HA_OPTION_STATS_PERSISTENT; + break; + default: + thd->parse_error(); + MYSQL_YYABORT; + } + Lex->create_info.used_fields|= HA_CREATE_USED_STATS_PERSISTENT; + } + | STATS_PERSISTENT_SYM opt_equal DEFAULT + { + Lex->create_info.table_options&= + ~(HA_OPTION_STATS_PERSISTENT | HA_OPTION_NO_STATS_PERSISTENT); + Lex->create_info.used_fields|= HA_CREATE_USED_STATS_PERSISTENT; + } + | STATS_SAMPLE_PAGES_SYM opt_equal ulong_num + { + /* From user point of view STATS_SAMPLE_PAGES can be specified as + STATS_SAMPLE_PAGES=N (where 0<N<=65535, it does not make sense to + scan 0 pages) or STATS_SAMPLE_PAGES=default. Internally we record + =default as 0. See create_frm() in sql/table.cc, we use only two + bytes for stats_sample_pages and this is why we do not allow + larger values. 65535 pages, 16kb each means to sample 1GB, which + is impractical. If at some point this needs to be extended, then + we can store the higher bits from stats_sample_pages in .frm too. */ + if (unlikely($3 == 0 || $3 > 0xffff)) + { + thd->parse_error(); + MYSQL_YYABORT; + } + Lex->create_info.stats_sample_pages=$3; + Lex->create_info.used_fields|= HA_CREATE_USED_STATS_SAMPLE_PAGES; + } + | STATS_SAMPLE_PAGES_SYM opt_equal DEFAULT + { + Lex->create_info.stats_sample_pages=0; + Lex->create_info.used_fields|= HA_CREATE_USED_STATS_SAMPLE_PAGES; + } + | CHECKSUM_SYM opt_equal ulong_num + { + Lex->create_info.table_options|= $3 ? HA_OPTION_CHECKSUM : HA_OPTION_NO_CHECKSUM; + Lex->create_info.used_fields|= HA_CREATE_USED_CHECKSUM; + } + | TABLE_CHECKSUM_SYM opt_equal ulong_num + { + Lex->create_info.table_options|= $3 ? HA_OPTION_CHECKSUM : HA_OPTION_NO_CHECKSUM; + Lex->create_info.used_fields|= HA_CREATE_USED_CHECKSUM; + } + | PAGE_CHECKSUM_SYM opt_equal choice + { + Lex->create_info.used_fields|= HA_CREATE_USED_PAGE_CHECKSUM; + Lex->create_info.page_checksum= $3; + } + | DELAY_KEY_WRITE_SYM opt_equal ulong_num + { + Lex->create_info.table_options|= $3 ? HA_OPTION_DELAY_KEY_WRITE : HA_OPTION_NO_DELAY_KEY_WRITE; + Lex->create_info.used_fields|= HA_CREATE_USED_DELAY_KEY_WRITE; + } + | ROW_FORMAT_SYM opt_equal row_types + { + Lex->create_info.row_type= $3; + Lex->create_info.used_fields|= HA_CREATE_USED_ROW_FORMAT; + } + | UNION_SYM opt_equal + { + Lex->select_lex.table_list.save_and_clear(&Lex->save_list); + } + '(' opt_table_list ')' + { + /* + Move the union list to the merge_list and exclude its tables + from the global list. + */ + LEX *lex=Lex; + lex->create_info.merge_list= lex->select_lex.table_list.first; + lex->select_lex.table_list= lex->save_list; + /* + When excluding union list from the global list we assume that + elements of the former immediately follow elements which represent + table being created/altered and parent tables. + */ + TABLE_LIST *last_non_sel_table= lex->create_last_non_select_table; + DBUG_ASSERT(last_non_sel_table->next_global == + lex->create_info.merge_list); + last_non_sel_table->next_global= 0; + Lex->query_tables_last= &last_non_sel_table->next_global; + + lex->create_info.used_fields|= HA_CREATE_USED_UNION; + } + | default_charset + | default_collation + | INSERT_METHOD opt_equal merge_insert_types + { + Lex->create_info.merge_insert_method= $3; + Lex->create_info.used_fields|= HA_CREATE_USED_INSERT_METHOD; + } + | DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys + { + Lex->create_info.data_file_name= $4.str; + Lex->create_info.used_fields|= HA_CREATE_USED_DATADIR; + } + | INDEX_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys + { + Lex->create_info.index_file_name= $4.str; + Lex->create_info.used_fields|= HA_CREATE_USED_INDEXDIR; + } + | TABLESPACE ident + {Lex->create_info.tablespace= $2.str;} + | STORAGE_SYM DISK_SYM + {Lex->create_info.storage_media= HA_SM_DISK;} + | STORAGE_SYM MEMORY_SYM + {Lex->create_info.storage_media= HA_SM_MEMORY;} + | CONNECTION_SYM opt_equal TEXT_STRING_sys + { + Lex->create_info.connect_string.str= $3.str; + Lex->create_info.connect_string.length= $3.length; + Lex->create_info.used_fields|= HA_CREATE_USED_CONNECTION; + } + | KEY_BLOCK_SIZE opt_equal ulong_num + { + Lex->create_info.used_fields|= HA_CREATE_USED_KEY_BLOCK_SIZE; + Lex->create_info.key_block_size= $3; + } + | TRANSACTIONAL_SYM opt_equal choice + { + Lex->create_info.used_fields|= HA_CREATE_USED_TRANSACTIONAL; + Lex->create_info.transactional= $3; + } + | IDENT_sys equal TEXT_STRING_sys + { + if (unlikely($3.length > ENGINE_OPTION_MAX_LENGTH)) + my_yyabort_error((ER_VALUE_TOO_LONG, MYF(0), $1.str)); + (void) new (thd->mem_root) + engine_option_value($1, $3, true, + &Lex->create_info.option_list, + &Lex->option_list_last); + } + | IDENT_sys equal ident + { + if (unlikely($3.length > ENGINE_OPTION_MAX_LENGTH)) + my_yyabort_error((ER_VALUE_TOO_LONG, MYF(0), $1.str)); + (void) new (thd->mem_root) + engine_option_value($1, $3, false, + &Lex->create_info.option_list, + &Lex->option_list_last); + } + | IDENT_sys equal real_ulonglong_num + { + (void) new (thd->mem_root) + engine_option_value($1, $3, &Lex->create_info.option_list, + &Lex->option_list_last, thd->mem_root); + } + | IDENT_sys equal DEFAULT + { + (void) new (thd->mem_root) + engine_option_value($1, &Lex->create_info.option_list, + &Lex->option_list_last); + } + | SEQUENCE_SYM opt_equal choice + { + Lex->create_info.used_fields|= HA_CREATE_USED_SEQUENCE; + Lex->create_info.sequence= ($3 == HA_CHOICE_YES); + } + | versioning_option + ; + +opt_versioning_option: + /* empty */ + | versioning_option + ; + +versioning_option: + WITH_SYSTEM_SYM VERSIONING_SYM + { + if (unlikely(Lex->create_info.options & HA_LEX_CREATE_TMP_TABLE)) + { + if (DBUG_EVALUATE_IF("sysvers_force", 0, 1)) + { + my_error(ER_VERS_TEMPORARY, MYF(0)); + MYSQL_YYABORT; + } + } + else + { + Lex->alter_info.flags|= ALTER_ADD_SYSTEM_VERSIONING; + Lex->create_info.options|= HA_VERSIONED_TABLE; + } + } + ; + +default_charset: + opt_default charset opt_equal charset_name_or_default + { + if (unlikely(Lex->create_info.add_table_option_default_charset($4))) + MYSQL_YYABORT; + } + ; + +default_collation: + opt_default COLLATE_SYM opt_equal collation_name_or_default + { + HA_CREATE_INFO *cinfo= &Lex->create_info; + if (unlikely((cinfo->used_fields & HA_CREATE_USED_DEFAULT_CHARSET) && + cinfo->default_table_charset && $4 && + !($4= merge_charset_and_collation(cinfo->default_table_charset, + $4)))) + MYSQL_YYABORT; + + Lex->create_info.default_table_charset= $4; + Lex->create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET; + } + ; + +storage_engines: + ident_or_text + { + plugin_ref plugin= ha_resolve_by_name(thd, &$1, + thd->lex->create_info.tmp_table()); + + if (likely(plugin)) + $$= plugin_hton(plugin); + else + { + if (thd->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION) + my_yyabort_error((ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str)); + $$= 0; + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_UNKNOWN_STORAGE_ENGINE, + ER_THD(thd, ER_UNKNOWN_STORAGE_ENGINE), + $1.str); + } + } + ; + +known_storage_engines: + ident_or_text + { + plugin_ref plugin; + if (likely((plugin= ha_resolve_by_name(thd, &$1, false)))) + $$= plugin_hton(plugin); + else + my_yyabort_error((ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str)); + } + ; + +row_types: + DEFAULT { $$= ROW_TYPE_DEFAULT; } + | FIXED_SYM { $$= ROW_TYPE_FIXED; } + | DYNAMIC_SYM { $$= ROW_TYPE_DYNAMIC; } + | COMPRESSED_SYM { $$= ROW_TYPE_COMPRESSED; } + | REDUNDANT_SYM { $$= ROW_TYPE_REDUNDANT; } + | COMPACT_SYM { $$= ROW_TYPE_COMPACT; } + | PAGE_SYM { $$= ROW_TYPE_PAGE; } + ; + +merge_insert_types: + NO_SYM { $$= MERGE_INSERT_DISABLED; } + | FIRST_SYM { $$= MERGE_INSERT_TO_FIRST; } + | LAST_SYM { $$= MERGE_INSERT_TO_LAST; } + ; + +udf_type: + STRING_SYM {$$ = (int) STRING_RESULT; } + | REAL {$$ = (int) REAL_RESULT; } + | DECIMAL_SYM {$$ = (int) DECIMAL_RESULT; } + | INT_SYM {$$ = (int) INT_RESULT; } + ; + + +create_field_list: + field_list + { + Lex->create_last_non_select_table= Lex->last_table(); + } + ; + +field_list: + field_list_item + | field_list ',' field_list_item + ; + +field_list_item: + column_def { } + | key_def + | constraint_def + | period_for_system_time + ; + +column_def: + field_spec + { $$= $1; } + | field_spec references + { $$= $1; } + ; + +key_def: + key_or_index opt_if_not_exists opt_ident opt_USING_key_algorithm + { + Lex->option_list= NULL; + if (unlikely(Lex->add_key(Key::MULTIPLE, &$3, $4, $2))) + MYSQL_YYABORT; + } + '(' key_list ')' normal_key_options { } + | key_or_index opt_if_not_exists ident TYPE_SYM btree_or_rtree + { + Lex->option_list= NULL; + if (unlikely(Lex->add_key(Key::MULTIPLE, &$3, $5, $2))) + MYSQL_YYABORT; + } + '(' key_list ')' normal_key_options { } + | fulltext opt_key_or_index opt_if_not_exists opt_ident + { + Lex->option_list= NULL; + if (unlikely(Lex->add_key($1, &$4, HA_KEY_ALG_UNDEF, $3))) + MYSQL_YYABORT; + } + '(' key_list ')' fulltext_key_options { } + | spatial opt_key_or_index opt_if_not_exists opt_ident + { + Lex->option_list= NULL; + if (unlikely(Lex->add_key($1, &$4, HA_KEY_ALG_UNDEF, $3))) + MYSQL_YYABORT; + } + '(' key_list ')' spatial_key_options { } + | opt_constraint constraint_key_type + opt_if_not_exists opt_ident + opt_USING_key_algorithm + { + Lex->option_list= NULL; + if (unlikely(Lex->add_key($2, $4.str ? &$4 : &$1, $5, $3))) + MYSQL_YYABORT; + } + '(' key_list ')' normal_key_options { } + | opt_constraint constraint_key_type opt_if_not_exists ident + TYPE_SYM btree_or_rtree + { + Lex->option_list= NULL; + if (unlikely(Lex->add_key($2, $4.str ? &$4 : &$1, $6, $3))) + MYSQL_YYABORT; + } + '(' key_list ')' normal_key_options { } + | opt_constraint FOREIGN KEY_SYM opt_if_not_exists opt_ident + { + if (unlikely(Lex->check_add_key($4)) || + unlikely(!(Lex->last_key= (new (thd->mem_root) + Key(Key::MULTIPLE, + $1.str ? &$1 : &$5, + HA_KEY_ALG_UNDEF, true, $4))))) + MYSQL_YYABORT; + Lex->option_list= NULL; + } + '(' key_list ')' references + { + LEX *lex=Lex; + Key *key= (new (thd->mem_root) + Foreign_key($5.str ? &$5 : &$1, + &lex->last_key->columns, + &$10->db, + &$10->table, + &lex->ref_list, + lex->fk_delete_opt, + lex->fk_update_opt, + lex->fk_match_option, + $4)); + if (unlikely(key == NULL)) + MYSQL_YYABORT; + /* + handle_if_exists_options() expectes the two keys in this order: + the Foreign_key, followed by its auto-generated Key. + */ + lex->alter_info.key_list.push_back(key, thd->mem_root); + lex->alter_info.key_list.push_back(Lex->last_key, thd->mem_root); + lex->option_list= NULL; + + /* Only used for ALTER TABLE. Ignored otherwise. */ + lex->alter_info.flags|= ALTER_ADD_FOREIGN_KEY; + } + ; + +constraint_def: + opt_constraint check_constraint + { + Lex->add_constraint(&$1, $2, FALSE); + } + ; + +period_for_system_time: + // If FOR_SYM is followed by SYSTEM_TIME_SYM then they are merged to: FOR_SYSTEM_TIME_SYM . + PERIOD_SYM FOR_SYSTEM_TIME_SYM '(' ident ',' ident ')' + { + Vers_parse_info &info= Lex->vers_get_info(); + info.set_system_time($4, $6); + } + ; + +opt_check_constraint: + /* empty */ { $$= (Virtual_column_info*) 0; } + | check_constraint { $$= $1;} + ; + +check_constraint: + CHECK_SYM '(' expr ')' + { + Virtual_column_info *v= add_virtual_expression(thd, $3); + if (unlikely(!v)) + MYSQL_YYABORT; + $$= v; + } + ; + +opt_constraint_no_id: + /* Empty */ {} + | CONSTRAINT {} + ; + +opt_constraint: + /* empty */ { $$= null_clex_str; } + | constraint { $$= $1; } + ; + +constraint: + CONSTRAINT opt_ident { $$=$2; } + ; + +field_spec: + field_ident + { + LEX *lex=Lex; + Create_field *f= new (thd->mem_root) Create_field(); + + if (unlikely(check_string_char_length(&$1, 0, NAME_CHAR_LEN, + system_charset_info, 1))) + my_yyabort_error((ER_TOO_LONG_IDENT, MYF(0), $1.str)); + + if (unlikely(!f)) + MYSQL_YYABORT; + + lex->init_last_field(f, &$1, NULL); + $<create_field>$= f; + } + field_type_or_serial opt_check_constraint + { + LEX *lex=Lex; + $$= $<create_field>2; + + $$->check_constraint= $4; + + if (unlikely($$->check(thd))) + MYSQL_YYABORT; + + lex->alter_info.create_list.push_back($$, thd->mem_root); + + $$->create_if_not_exists= Lex->check_exists; + if ($$->flags & PRI_KEY_FLAG) + lex->add_key_to_list(&$1, Key::PRIMARY, lex->check_exists); + else if ($$->flags & UNIQUE_KEY_FLAG) + lex->add_key_to_list(&$1, Key::UNIQUE, lex->check_exists); + } + ; + +field_type_or_serial: + field_type { Lex->last_field->set_attributes($1, Lex->charset); } + field_def + | SERIAL_SYM + { + Lex->last_field->set_handler(&type_handler_longlong); + Lex->last_field->flags|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG + | UNSIGNED_FLAG | UNIQUE_KEY_FLAG; + } + opt_serial_attribute + ; + +opt_serial_attribute: + /* empty */ {} + | opt_serial_attribute_list {} + ; + +opt_serial_attribute_list: + opt_serial_attribute_list serial_attribute {} + | serial_attribute + ; + +opt_asrow_attribute: + /* empty */ {} + | opt_asrow_attribute_list {} + ; + +opt_asrow_attribute_list: + opt_asrow_attribute_list asrow_attribute {} + | asrow_attribute + ; + +field_def: + opt_attribute + | opt_generated_always AS virtual_column_func + { + Lex->last_field->vcol_info= $3; + Lex->last_field->flags&= ~NOT_NULL_FLAG; // undo automatic NOT NULL for timestamps + } + vcol_opt_specifier vcol_opt_attribute + | opt_generated_always AS ROW_SYM START_SYM opt_asrow_attribute + { + if (Lex->last_field_generated_always_as_row_start()) + MYSQL_YYABORT; + } + | opt_generated_always AS ROW_SYM END opt_asrow_attribute + { + if (Lex->last_field_generated_always_as_row_end()) + MYSQL_YYABORT; + } + ; + +opt_generated_always: + /* empty */ {} + | GENERATED_SYM ALWAYS_SYM {} + ; + +vcol_opt_specifier: + /* empty */ + { + Lex->last_field->vcol_info->set_stored_in_db_flag(FALSE); + } + | VIRTUAL_SYM + { + Lex->last_field->vcol_info->set_stored_in_db_flag(FALSE); + } + | PERSISTENT_SYM + { + Lex->last_field->vcol_info->set_stored_in_db_flag(TRUE); + } + | STORED_SYM + { + Lex->last_field->vcol_info->set_stored_in_db_flag(TRUE); + } + ; + +vcol_opt_attribute: + /* empty */ {} + | vcol_opt_attribute_list {} + ; + +vcol_opt_attribute_list: + vcol_opt_attribute_list vcol_attribute {} + | vcol_attribute + ; + +vcol_attribute: + UNIQUE_SYM + { + LEX *lex=Lex; + lex->last_field->flags|= UNIQUE_KEY_FLAG; + lex->alter_info.flags|= ALTER_ADD_INDEX; + } + | UNIQUE_SYM KEY_SYM + { + LEX *lex=Lex; + lex->last_field->flags|= UNIQUE_KEY_FLAG; + lex->alter_info.flags|= ALTER_ADD_INDEX; + } + | COMMENT_SYM TEXT_STRING_sys { Lex->last_field->comment= $2; } + | INVISIBLE_SYM + { + Lex->last_field->invisible= INVISIBLE_USER; + } + ; + +parse_vcol_expr: + PARSE_VCOL_EXPR_SYM + { + /* + "PARSE_VCOL_EXPR" can only be used by the SQL server + when reading a '*.frm' file. + Prevent the end user from invoking this command. + */ + MYSQL_YYABORT_UNLESS(Lex->parse_vcol_expr); + } + expr + { + Virtual_column_info *v= add_virtual_expression(thd, $3); + if (unlikely(!v)) + MYSQL_YYABORT; + Lex->last_field->vcol_info= v; + } + ; + +parenthesized_expr: + subselect + { + $$= new (thd->mem_root) Item_singlerow_subselect(thd, $1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | expr + | expr ',' expr_list + { + $3->push_front($1, thd->mem_root); + $$= new (thd->mem_root) Item_row(thd, *$3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + +virtual_column_func: + '(' parenthesized_expr ')' + { + Virtual_column_info *v= + add_virtual_expression(thd, $2); + if (unlikely(!v)) + MYSQL_YYABORT; + $$= v; + } + ; + +expr_or_literal: column_default_non_parenthesized_expr | signed_literal ; + +column_default_expr: + virtual_column_func + | expr_or_literal + { + if (unlikely(!($$= add_virtual_expression(thd, $1)))) + MYSQL_YYABORT; + } + ; + +field_type: + field_type_numeric + | field_type_temporal + | field_type_string + | field_type_lob + | field_type_misc + ; + + +sp_param_field_type: + field_type_numeric + | field_type_temporal + | sp_param_field_type_string + | field_type_lob + | field_type_misc + ; + + +field_type_numeric: + int_type opt_field_length field_options { $$.set($1, $2); } + | real_type opt_precision field_options { $$.set($1, $2); } + | FLOAT_SYM float_options field_options + { + $$.set(&type_handler_float, $2); + if ($2.length() && !$2.dec()) + { + int err; + ulonglong tmp_length= my_strtoll10($2.length(), NULL, &err); + if (unlikely(err || tmp_length > PRECISION_FOR_DOUBLE)) + my_yyabort_error((ER_WRONG_FIELD_SPEC, MYF(0), + Lex->last_field->field_name.str)); + if (tmp_length > PRECISION_FOR_FLOAT) + $$.set(&type_handler_double); + else + $$.set(&type_handler_float); + } + } + | BIT_SYM opt_field_length_default_1 + { + $$.set(&type_handler_bit, $2); + } + | BOOL_SYM + { + $$.set(&type_handler_tiny, "1"); + } + | BOOLEAN_SYM + { + $$.set(&type_handler_tiny, "1"); + } + | DECIMAL_SYM float_options field_options + { $$.set(&type_handler_newdecimal, $2);} + | NUMBER_ORACLE_SYM float_options field_options + { + if ($2.length() != 0) + $$.set(&type_handler_newdecimal, $2); + else + $$.set(&type_handler_double); + } + | NUMERIC_SYM float_options field_options + { $$.set(&type_handler_newdecimal, $2);} + | FIXED_SYM float_options field_options + { $$.set(&type_handler_newdecimal, $2);} + ; + + +field_type_string: + char opt_field_length_default_1 opt_binary + { + $$.set(&type_handler_string, $2); + } + | nchar opt_field_length_default_1 opt_bin_mod + { + $$.set(&type_handler_string, $2); + bincmp_collation(national_charset_info, $3); + } + | BINARY opt_field_length_default_1 + { + Lex->charset=&my_charset_bin; + $$.set(&type_handler_string, $2); + } + | varchar field_length opt_binary + { + $$.set(&type_handler_varchar, $2); + } + | VARCHAR2_ORACLE_SYM field_length opt_binary + { + $$.set(&type_handler_varchar, $2); + } + | nvarchar field_length opt_bin_mod + { + $$.set(&type_handler_varchar, $2); + bincmp_collation(national_charset_info, $3); + } + | VARBINARY field_length + { + Lex->charset=&my_charset_bin; + $$.set(&type_handler_varchar, $2); + } + | RAW_ORACLE_SYM field_length + { + Lex->charset= &my_charset_bin; + $$.set(&type_handler_varchar, $2); + } + ; + + +sp_param_field_type_string: + char opt_field_length_default_sp_param_char opt_binary + { + $$.set(&type_handler_varchar, $2); + } + | nchar opt_field_length_default_sp_param_char opt_bin_mod + { + $$.set(&type_handler_varchar, $2); + bincmp_collation(national_charset_info, $3); + } + | BINARY opt_field_length_default_sp_param_char + { + Lex->charset=&my_charset_bin; + $$.set(&type_handler_varchar, $2); + } + | varchar opt_field_length_default_sp_param_varchar opt_binary + { + $$.set(&type_handler_varchar, $2); + } + | VARCHAR2_ORACLE_SYM opt_field_length_default_sp_param_varchar opt_binary + { + $$.set(&type_handler_varchar, $2); + } + | nvarchar opt_field_length_default_sp_param_varchar opt_bin_mod + { + $$.set(&type_handler_varchar, $2); + bincmp_collation(national_charset_info, $3); + } + | VARBINARY opt_field_length_default_sp_param_varchar + { + Lex->charset= &my_charset_bin; + $$.set(&type_handler_varchar, $2); + } + | RAW_ORACLE_SYM opt_field_length_default_sp_param_varchar + { + Lex->charset= &my_charset_bin; + $$.set(&type_handler_varchar, $2); + } + ; + + +field_type_temporal: + YEAR_SYM opt_field_length field_options + { + if ($2) + { + errno= 0; + ulong length= strtoul($2, NULL, 10); + if (errno == 0 && length <= MAX_FIELD_BLOBLENGTH && length != 4) + { + char buff[sizeof("YEAR()") + MY_INT64_NUM_DECIMAL_DIGITS + 1]; + my_snprintf(buff, sizeof(buff), "YEAR(%lu)", length); + push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, + ER_WARN_DEPRECATED_SYNTAX, + ER_THD(thd, ER_WARN_DEPRECATED_SYNTAX), + buff, "YEAR(4)"); + } + } + $$.set(&type_handler_year, $2); + } + | DATE_SYM { $$.set(thd->type_handler_for_date()); } + | TIME_SYM opt_field_length + { + $$.set(opt_mysql56_temporal_format ? + static_cast<const Type_handler*>(&type_handler_time2) : + static_cast<const Type_handler*>(&type_handler_time), + $2); + } + | TIMESTAMP opt_field_length + { + if (thd->variables.sql_mode & MODE_MAXDB) + $$.set(opt_mysql56_temporal_format ? + static_cast<const Type_handler*>(&type_handler_datetime2) : + static_cast<const Type_handler*>(&type_handler_datetime), + $2); + else + { + /* + Unlike other types TIMESTAMP fields are NOT NULL by default. + Unless --explicit-defaults-for-timestamp is given. + */ + if (!opt_explicit_defaults_for_timestamp) + Lex->last_field->flags|= NOT_NULL_FLAG; + $$.set(opt_mysql56_temporal_format ? + static_cast<const Type_handler*>(&type_handler_timestamp2): + static_cast<const Type_handler*>(&type_handler_timestamp), + $2); + } + } + | DATETIME opt_field_length + { + $$.set(opt_mysql56_temporal_format ? + static_cast<const Type_handler*>(&type_handler_datetime2) : + static_cast<const Type_handler*>(&type_handler_datetime), + $2); + } + ; + + +field_type_lob: + TINYBLOB + { + Lex->charset=&my_charset_bin; + $$.set(&type_handler_tiny_blob); + } + | BLOB_MARIADB_SYM opt_field_length + { + Lex->charset=&my_charset_bin; + $$.set(&type_handler_blob, $2); + } + | BLOB_ORACLE_SYM opt_field_length + { + Lex->charset=&my_charset_bin; + $$.set(&type_handler_long_blob); + } + | spatial_type float_options srid_option + { +#ifdef HAVE_SPATIAL + Lex->charset=&my_charset_bin; + Lex->last_field->geom_type= $1; + $$.set(&type_handler_geometry, $2); +#else + my_yyabort_error((ER_FEATURE_DISABLED, MYF(0), sym_group_geom.name, + sym_group_geom.needed_define)); +#endif + } + | MEDIUMBLOB + { + Lex->charset=&my_charset_bin; + $$.set(&type_handler_medium_blob); + } + | LONGBLOB + { + Lex->charset=&my_charset_bin; + $$.set(&type_handler_long_blob); + } + | LONG_SYM VARBINARY + { + Lex->charset=&my_charset_bin; + $$.set(&type_handler_medium_blob); + } + | LONG_SYM varchar opt_binary + { $$.set(&type_handler_medium_blob); } + | TINYTEXT opt_binary + { $$.set(&type_handler_tiny_blob); } + | TEXT_SYM opt_field_length opt_binary + { $$.set(&type_handler_blob, $2); } + | MEDIUMTEXT opt_binary + { $$.set(&type_handler_medium_blob); } + | LONGTEXT opt_binary + { $$.set(&type_handler_long_blob); } + | CLOB_ORACLE_SYM opt_binary + { $$.set(&type_handler_long_blob); } + | LONG_SYM opt_binary + { $$.set(&type_handler_medium_blob); } + | JSON_SYM + { + Lex->charset= &my_charset_utf8mb4_bin; + $$.set(&type_handler_long_blob); + } + ; + +field_type_misc: + ENUM '(' string_list ')' opt_binary + { $$.set(&type_handler_enum); } + | SET '(' string_list ')' opt_binary + { $$.set(&type_handler_set); } + ; + +spatial_type: + GEOMETRY_SYM { $$= Field::GEOM_GEOMETRY; } + | GEOMETRYCOLLECTION { $$= Field::GEOM_GEOMETRYCOLLECTION; } + | POINT_SYM { $$= Field::GEOM_POINT; } + | MULTIPOINT { $$= Field::GEOM_MULTIPOINT; } + | LINESTRING { $$= Field::GEOM_LINESTRING; } + | MULTILINESTRING { $$= Field::GEOM_MULTILINESTRING; } + | POLYGON { $$= Field::GEOM_POLYGON; } + | MULTIPOLYGON { $$= Field::GEOM_MULTIPOLYGON; } + ; + +char: + CHAR_SYM {} + ; + +nchar: + NCHAR_SYM {} + | NATIONAL_SYM CHAR_SYM {} + ; + +varchar: + char VARYING {} + | VARCHAR {} + ; + +nvarchar: + NATIONAL_SYM VARCHAR {} + | NVARCHAR_SYM {} + | NCHAR_SYM VARCHAR {} + | NATIONAL_SYM CHAR_SYM VARYING {} + | NCHAR_SYM VARYING {} + ; + +int_type: + INT_SYM { $$= &type_handler_long; } + | TINYINT { $$= &type_handler_tiny; } + | SMALLINT { $$= &type_handler_short; } + | MEDIUMINT { $$= &type_handler_int24; } + | BIGINT { $$= &type_handler_longlong; } + ; + +real_type: + REAL + { + $$= thd->variables.sql_mode & MODE_REAL_AS_FLOAT ? + static_cast<const Type_handler *>(&type_handler_float) : + static_cast<const Type_handler *>(&type_handler_double); + } + | DOUBLE_SYM { $$= &type_handler_double; } + | DOUBLE_SYM PRECISION { $$= &type_handler_double; } + ; + +srid_option: + /* empty */ + { Lex->last_field->srid= 0; } + | + REF_SYSTEM_ID_SYM '=' NUM + { + Lex->last_field->srid=atoi($3.str); + } + ; + +float_options: + /* empty */ { $$.set(0, 0); } + | field_length { $$.set($1, 0); } + | precision { $$= $1; } + ; + +precision: + '(' NUM ',' NUM ')' { $$.set($2.str, $4.str); } + ; + +field_options: + /* empty */ {} + | SIGNED_SYM {} + | UNSIGNED { Lex->last_field->flags|= UNSIGNED_FLAG;} + | ZEROFILL { Lex->last_field->flags|= UNSIGNED_FLAG | ZEROFILL_FLAG; } + | UNSIGNED ZEROFILL { Lex->last_field->flags|= UNSIGNED_FLAG | ZEROFILL_FLAG; } + | ZEROFILL UNSIGNED { Lex->last_field->flags|= UNSIGNED_FLAG | ZEROFILL_FLAG; } + ; + +field_length: + '(' LONG_NUM ')' { $$= $2.str; } + | '(' ULONGLONG_NUM ')' { $$= $2.str; } + | '(' DECIMAL_NUM ')' { $$= $2.str; } + | '(' NUM ')' { $$= $2.str; }; + +opt_field_length: + /* empty */ { $$= (char*) 0; /* use default length */ } + | field_length { $$= $1; } + +opt_field_length_default_1: + /* empty */ { $$= (char*) "1"; } + | field_length { $$= $1; } + + +/* + In sql_mode=ORACLE, real size of VARCHAR and CHAR with no length + in SP parameters is fixed at runtime with the length of real args. + Let's translate VARCHAR to VARCHAR(4000) for return value. + + Since Oracle 9, maximum size for VARCHAR in PL/SQL is 32767. + + In MariaDB the limit for VARCHAR is 65535 bytes. + We could translate VARCHAR with no length to VARCHAR(65535), but + it would mean that for multi-byte character sets we'd have to translate + VARCHAR to MEDIUMTEXT, to guarantee 65535 characters. + + Also we could translate VARCHAR to VARCHAR(16383), where 16383 is + the maximum possible length in characters in case of mbmaxlen=4 + (e.g. utf32, utf16, utf8mb4). However, we'll have character sets with + mbmaxlen=5 soon (e.g. gb18030). +*/ +opt_field_length_default_sp_param_varchar: + /* empty */ { $$.set("4000", "4000"); } + | field_length { $$.set($1, NULL); } + +opt_field_length_default_sp_param_char: + /* empty */ { $$.set("2000", "2000"); } + | field_length { $$.set($1, NULL); } + +opt_precision: + /* empty */ { $$.set(0, 0); } + | precision { $$= $1; } + ; + +opt_attribute: + /* empty */ {} + | opt_attribute_list {} + ; + +opt_attribute_list: + opt_attribute_list attribute {} + | attribute + ; + +attribute: + NULL_SYM { Lex->last_field->flags&= ~ NOT_NULL_FLAG; } + | DEFAULT column_default_expr { Lex->last_field->default_value= $2; } + | ON UPDATE_SYM NOW_SYM opt_default_time_precision + { + Item *item= new (thd->mem_root) Item_func_now_local(thd, $4); + if (unlikely(item == NULL)) + MYSQL_YYABORT; + Lex->last_field->on_update= item; + } + | AUTO_INC { Lex->last_field->flags|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG; } + | SERIAL_SYM DEFAULT VALUE_SYM + { + LEX *lex=Lex; + lex->last_field->flags|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG | UNIQUE_KEY_FLAG; + lex->alter_info.flags|= ALTER_ADD_INDEX; + } + | COLLATE_SYM collation_name + { + if (unlikely(Lex->charset && !my_charset_same(Lex->charset,$2))) + my_yyabort_error((ER_COLLATION_CHARSET_MISMATCH, MYF(0), + $2->name,Lex->charset->csname)); + Lex->last_field->charset= $2; + } + | COMPRESSED_SYM opt_compression_method + { + if (unlikely(Lex->last_field->set_compressed($2))) + MYSQL_YYABORT; + } + | serial_attribute + ; + +opt_compression_method: + /* empty */ { $$= NULL; } + | equal ident { $$= $2.str; } + ; + +asrow_attribute: + not NULL_SYM + { + Lex->last_field->flags|= NOT_NULL_FLAG; + } + | opt_primary KEY_SYM + { + LEX *lex=Lex; + lex->last_field->flags|= PRI_KEY_FLAG | NOT_NULL_FLAG; + lex->alter_info.flags|= ALTER_ADD_INDEX; + } + | vcol_attribute + ; + +serial_attribute: + asrow_attribute + | IDENT_sys equal TEXT_STRING_sys + { + if (unlikely($3.length > ENGINE_OPTION_MAX_LENGTH)) + my_yyabort_error((ER_VALUE_TOO_LONG, MYF(0), $1.str)); + (void) new (thd->mem_root) + engine_option_value($1, $3, true, + &Lex->last_field->option_list, + &Lex->option_list_last); + } + | IDENT_sys equal ident + { + if (unlikely($3.length > ENGINE_OPTION_MAX_LENGTH)) + my_yyabort_error((ER_VALUE_TOO_LONG, MYF(0), $1.str)); + (void) new (thd->mem_root) + engine_option_value($1, $3, false, + &Lex->last_field->option_list, + &Lex->option_list_last); + } + | IDENT_sys equal real_ulonglong_num + { + (void) new (thd->mem_root) + engine_option_value($1, $3, &Lex->last_field->option_list, + &Lex->option_list_last, thd->mem_root); + } + | IDENT_sys equal DEFAULT + { + (void) new (thd->mem_root) + engine_option_value($1, &Lex->last_field->option_list, + &Lex->option_list_last); + } + | with_or_without_system VERSIONING_SYM + { + Lex->last_field->versioning= $1; + Lex->create_info.options|= HA_VERSIONED_TABLE; + } + ; + +with_or_without_system: + WITH_SYSTEM_SYM + { + Lex->alter_info.flags|= ALTER_COLUMN_UNVERSIONED; + Lex->create_info.vers_info.versioned_fields= true; + $$= Column_definition::WITH_VERSIONING; + } + | WITHOUT SYSTEM + { + Lex->alter_info.flags|= ALTER_COLUMN_UNVERSIONED; + Lex->create_info.vers_info.unversioned_fields= true; + $$= Column_definition::WITHOUT_VERSIONING; + } + ; + + +type_with_opt_collate: + field_type opt_collate + { + $$= $1; + + if ($2) + { + if (unlikely(!(Lex->charset= merge_charset_and_collation(Lex->charset, $2)))) + MYSQL_YYABORT; + } + Lex->last_field->set_attributes($1, Lex->charset); + } + ; + +sp_param_type_with_opt_collate: + sp_param_field_type opt_collate + { + $$= $1; + if ($2) + { + if (unlikely(!(Lex->charset= merge_charset_and_collation(Lex->charset, $2)))) + MYSQL_YYABORT; + } + Lex->last_field->set_attributes($1, Lex->charset); + } + ; + +charset: + CHAR_SYM SET {} + | CHARSET {} + ; + +charset_name: + ident_or_text + { + if (unlikely(!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))))) + my_yyabort_error((ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str)); + } + | BINARY { $$= &my_charset_bin; } + ; + +charset_name_or_default: + charset_name { $$=$1; } + | DEFAULT { $$=NULL; } + ; + +opt_load_data_charset: + /* Empty */ { $$= NULL; } + | charset charset_name_or_default { $$= $2; } + ; + +old_or_new_charset_name: + ident_or_text + { + if (unlikely(!($$=get_charset_by_csname($1.str, + MY_CS_PRIMARY,MYF(0))) && + !($$=get_old_charset_by_name($1.str)))) + my_yyabort_error((ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str)); + } + | BINARY { $$= &my_charset_bin; } + ; + +old_or_new_charset_name_or_default: + old_or_new_charset_name { $$=$1; } + | DEFAULT { $$=NULL; } + ; + +collation_name: + ident_or_text + { + if (unlikely(!($$= mysqld_collation_get_by_name($1.str)))) + MYSQL_YYABORT; + } + ; + +opt_collate: + /* empty */ { $$=NULL; } + | COLLATE_SYM collation_name_or_default { $$=$2; } + ; + +collation_name_or_default: + collation_name { $$=$1; } + | DEFAULT { $$=NULL; } + ; + +opt_default: + /* empty */ {} + | DEFAULT {} + ; + +charset_or_alias: + charset charset_name { $$= $2; } + | ASCII_SYM { $$= &my_charset_latin1; } + | UNICODE_SYM + { + if (unlikely(!($$= get_charset_by_csname("ucs2", MY_CS_PRIMARY,MYF(0))))) + my_yyabort_error((ER_UNKNOWN_CHARACTER_SET, MYF(0), "ucs2")); + } + ; + +opt_binary: + /* empty */ { bincmp_collation(NULL, false); } + | BYTE_SYM { bincmp_collation(&my_charset_bin, false); } + | charset_or_alias opt_bin_mod { bincmp_collation($1, $2); } + | BINARY { bincmp_collation(NULL, true); } + | BINARY charset_or_alias { bincmp_collation($2, true); } + ; + +opt_bin_mod: + /* empty */ { $$= false; } + | BINARY { $$= true; } + ; + +ws_nweights: + '(' real_ulong_num + { + if (unlikely($2 == 0)) + { + thd->parse_error(); + MYSQL_YYABORT; + } + } + ')' + { $$= $2; } + ; + +ws_level_flag_desc: + ASC { $$= 0; } + | DESC { $$= 1 << MY_STRXFRM_DESC_SHIFT; } + ; + +ws_level_flag_reverse: + REVERSE_SYM { $$= 1 << MY_STRXFRM_REVERSE_SHIFT; } ; + +ws_level_flags: + /* empty */ { $$= 0; } + | ws_level_flag_desc { $$= $1; } + | ws_level_flag_desc ws_level_flag_reverse { $$= $1 | $2; } + | ws_level_flag_reverse { $$= $1 ; } + ; + +ws_level_number: + real_ulong_num + { + $$= $1 < 1 ? 1 : ($1 > MY_STRXFRM_NLEVELS ? MY_STRXFRM_NLEVELS : $1); + $$--; + } + ; + +ws_level_list_item: + ws_level_number ws_level_flags + { + $$= (1 | $2) << $1; + } + ; + +ws_level_list: + ws_level_list_item { $$= $1; } + | ws_level_list ',' ws_level_list_item { $$|= $3; } + ; + +ws_level_range: + ws_level_number '-' ws_level_number + { + uint start= $1; + uint end= $3; + for ($$= 0; start <= end; start++) + $$|= (1 << start); + } + ; + +ws_level_list_or_range: + ws_level_list { $$= $1; } + | ws_level_range { $$= $1; } + ; + +opt_ws_levels: + /* empty*/ { $$= 0; } + | LEVEL_SYM ws_level_list_or_range { $$= $2; } + ; + +opt_primary: + /* empty */ + | PRIMARY_SYM + ; + +references: + REFERENCES + table_ident + opt_ref_list + opt_match_clause + opt_on_update_delete + { + $$=$2; + } + ; + +opt_ref_list: + /* empty */ + { Lex->ref_list.empty(); } + | '(' ref_list ')' + ; + +ref_list: + ref_list ',' ident + { + Key_part_spec *key= new (thd->mem_root) Key_part_spec(&$3, 0); + if (unlikely(key == NULL)) + MYSQL_YYABORT; + Lex->ref_list.push_back(key, thd->mem_root); + } + | ident + { + Key_part_spec *key= new (thd->mem_root) Key_part_spec(&$1, 0); + if (unlikely(key == NULL)) + MYSQL_YYABORT; + LEX *lex= Lex; + lex->ref_list.empty(); + lex->ref_list.push_back(key, thd->mem_root); + } + ; + +opt_match_clause: + /* empty */ + { Lex->fk_match_option= Foreign_key::FK_MATCH_UNDEF; } + | MATCH FULL + { Lex->fk_match_option= Foreign_key::FK_MATCH_FULL; } + | MATCH PARTIAL + { Lex->fk_match_option= Foreign_key::FK_MATCH_PARTIAL; } + | MATCH SIMPLE_SYM + { Lex->fk_match_option= Foreign_key::FK_MATCH_SIMPLE; } + ; + +opt_on_update_delete: + /* empty */ + { + LEX *lex= Lex; + lex->fk_update_opt= FK_OPTION_UNDEF; + lex->fk_delete_opt= FK_OPTION_UNDEF; + } + | ON UPDATE_SYM delete_option + { + LEX *lex= Lex; + lex->fk_update_opt= $3; + lex->fk_delete_opt= FK_OPTION_UNDEF; + } + | ON DELETE_SYM delete_option + { + LEX *lex= Lex; + lex->fk_update_opt= FK_OPTION_UNDEF; + lex->fk_delete_opt= $3; + } + | ON UPDATE_SYM delete_option + ON DELETE_SYM delete_option + { + LEX *lex= Lex; + lex->fk_update_opt= $3; + lex->fk_delete_opt= $6; + } + | ON DELETE_SYM delete_option + ON UPDATE_SYM delete_option + { + LEX *lex= Lex; + lex->fk_update_opt= $6; + lex->fk_delete_opt= $3; + } + ; + +delete_option: + RESTRICT { $$= FK_OPTION_RESTRICT; } + | CASCADE { $$= FK_OPTION_CASCADE; } + | SET NULL_SYM { $$= FK_OPTION_SET_NULL; } + | NO_SYM ACTION { $$= FK_OPTION_NO_ACTION; } + | SET DEFAULT { $$= FK_OPTION_SET_DEFAULT; } + ; + +constraint_key_type: + PRIMARY_SYM KEY_SYM { $$= Key::PRIMARY; } + | UNIQUE_SYM opt_key_or_index { $$= Key::UNIQUE; } + ; + +key_or_index: + KEY_SYM {} + | INDEX_SYM {} + ; + +opt_key_or_index: + /* empty */ {} + | key_or_index + ; + +keys_or_index: + KEYS {} + | INDEX_SYM {} + | INDEXES {} + ; + +opt_unique: + /* empty */ { $$= Key::MULTIPLE; } + | UNIQUE_SYM { $$= Key::UNIQUE; } + ; + +fulltext: + FULLTEXT_SYM { $$= Key::FULLTEXT;} + ; + +spatial: + SPATIAL_SYM + { +#ifdef HAVE_SPATIAL + $$= Key::SPATIAL; +#else + my_yyabort_error((ER_FEATURE_DISABLED, MYF(0), sym_group_geom.name, + sym_group_geom.needed_define)); +#endif + } + ; + +normal_key_options: + /* empty */ {} + | normal_key_opts { Lex->last_key->option_list= Lex->option_list; } + ; + +fulltext_key_options: + /* empty */ {} + | fulltext_key_opts { Lex->last_key->option_list= Lex->option_list; } + ; + +spatial_key_options: + /* empty */ {} + | spatial_key_opts { Lex->last_key->option_list= Lex->option_list; } + ; + +normal_key_opts: + normal_key_opt + | normal_key_opts normal_key_opt + ; + +spatial_key_opts: + spatial_key_opt + | spatial_key_opts spatial_key_opt + ; + +fulltext_key_opts: + fulltext_key_opt + | fulltext_key_opts fulltext_key_opt + ; + +opt_USING_key_algorithm: + /* Empty*/ { $$= HA_KEY_ALG_UNDEF; } + | USING btree_or_rtree { $$= $2; } + +/* TYPE is a valid identifier, so it's handled differently than USING */ +opt_key_algorithm_clause: + /* Empty*/ { $$= HA_KEY_ALG_UNDEF; } + | USING btree_or_rtree { $$= $2; } + | TYPE_SYM btree_or_rtree { $$= $2; } + +key_using_alg: + USING btree_or_rtree + { Lex->last_key->key_create_info.algorithm= $2; } + | TYPE_SYM btree_or_rtree + { Lex->last_key->key_create_info.algorithm= $2; } + ; + +all_key_opt: + KEY_BLOCK_SIZE opt_equal ulong_num + { + Lex->last_key->key_create_info.block_size= $3; + Lex->last_key->key_create_info.flags|= HA_USES_BLOCK_SIZE; + } + | COMMENT_SYM TEXT_STRING_sys + { Lex->last_key->key_create_info.comment= $2; } + | IDENT_sys equal TEXT_STRING_sys + { + if (unlikely($3.length > ENGINE_OPTION_MAX_LENGTH)) + my_yyabort_error((ER_VALUE_TOO_LONG, MYF(0), $1.str)); + (void) new (thd->mem_root) + engine_option_value($1, $3, true, &Lex->option_list, + &Lex->option_list_last); + } + | IDENT_sys equal ident + { + if (unlikely($3.length > ENGINE_OPTION_MAX_LENGTH)) + my_yyabort_error((ER_VALUE_TOO_LONG, MYF(0), $1.str)); + (void) new (thd->mem_root) + engine_option_value($1, $3, false, &Lex->option_list, + &Lex->option_list_last); + } + | IDENT_sys equal real_ulonglong_num + { + (void) new (thd->mem_root) + engine_option_value($1, $3, &Lex->option_list, + &Lex->option_list_last, thd->mem_root); + } + | IDENT_sys equal DEFAULT + { + (void) new (thd->mem_root) + engine_option_value($1, &Lex->option_list, + &Lex->option_list_last); + } + ; + +normal_key_opt: + all_key_opt + | key_using_alg + ; + +spatial_key_opt: + all_key_opt + ; + +fulltext_key_opt: + all_key_opt + | WITH PARSER_SYM IDENT_sys + { + if (likely(plugin_is_ready(&$3, MYSQL_FTPARSER_PLUGIN))) + Lex->last_key->key_create_info.parser_name= $3; + else + my_yyabort_error((ER_FUNCTION_NOT_DEFINED, MYF(0), $3.str)); + } + ; + +btree_or_rtree: + BTREE_SYM { $$= HA_KEY_ALG_BTREE; } + | RTREE_SYM { $$= HA_KEY_ALG_RTREE; } + | HASH_SYM { $$= HA_KEY_ALG_HASH; } + ; + +key_list: + key_list ',' key_part order_dir + { + Lex->last_key->columns.push_back($3, thd->mem_root); + } + | key_part order_dir + { + Lex->last_key->columns.push_back($1, thd->mem_root); + } + ; + +key_part: + ident + { + $$= new (thd->mem_root) Key_part_spec(&$1, 0); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | ident '(' NUM ')' + { + int key_part_len= atoi($3.str); + if (unlikely(!key_part_len)) + my_yyabort_error((ER_KEY_PART_0, MYF(0), $1.str)); + $$= new (thd->mem_root) Key_part_spec(&$1, (uint) key_part_len); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + +opt_ident: + /* empty */ { $$= null_clex_str; } + | field_ident { $$= $1; } + ; + +string_list: + text_string + { Lex->last_field->interval_list.push_back($1, thd->mem_root); } + | string_list ',' text_string + { Lex->last_field->interval_list.push_back($3, thd->mem_root); }; + +/* +** Alter table +*/ + +alter: + ALTER + { + Lex->name= null_clex_str; + Lex->table_type= TABLE_TYPE_UNKNOWN; + Lex->sql_command= SQLCOM_ALTER_TABLE; + Lex->duplicates= DUP_ERROR; + Lex->select_lex.init_order(); + Lex->create_info.init(); + Lex->create_info.row_type= ROW_TYPE_NOT_USED; + Lex->alter_info.reset(); + Lex->no_write_to_binlog= 0; + Lex->create_info.storage_media= HA_SM_DEFAULT; + DBUG_ASSERT(!Lex->m_sql_cmd); + } + alter_options TABLE_SYM table_ident opt_lock_wait_timeout + { + if (unlikely(!Lex->select_lex.add_table_to_list(thd, $5, NULL, + TL_OPTION_UPDATING, + TL_READ_NO_INSERT, + MDL_SHARED_UPGRADABLE))) + MYSQL_YYABORT; + Lex->select_lex.db= (Lex->select_lex.table_list.first)->db; + Lex->create_last_non_select_table= Lex->last_table(); + } + alter_commands + { + if (likely(!Lex->m_sql_cmd)) + { + /* Create a generic ALTER TABLE statment. */ + Lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_alter_table(); + if (unlikely(Lex->m_sql_cmd == NULL)) + MYSQL_YYABORT; + } + } + | ALTER DATABASE ident_or_empty + { + Lex->create_info.default_table_charset= NULL; + Lex->create_info.used_fields= 0; + } + create_database_options + { + LEX *lex=Lex; + lex->sql_command=SQLCOM_ALTER_DB; + lex->name= $3; + if (lex->name.str == NULL && + unlikely(lex->copy_db_to(&lex->name))) + MYSQL_YYABORT; + } + | ALTER DATABASE ident UPGRADE_SYM DATA_SYM DIRECTORY_SYM NAME_SYM + { + LEX *lex= Lex; + if (unlikely(lex->sphead)) + my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "DATABASE")); + lex->sql_command= SQLCOM_ALTER_DB_UPGRADE; + lex->name= $3; + } + | ALTER PROCEDURE_SYM sp_name + { + LEX *lex= Lex; + + if (unlikely(lex->sphead)) + my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE")); + lex->sp_chistics.init(); + } + sp_a_chistics + { + LEX *lex=Lex; + + lex->sql_command= SQLCOM_ALTER_PROCEDURE; + lex->spname= $3; + } + | ALTER FUNCTION_SYM sp_name + { + LEX *lex= Lex; + + if (unlikely(lex->sphead)) + my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "FUNCTION")); + lex->sp_chistics.init(); + } + sp_a_chistics + { + LEX *lex=Lex; + + lex->sql_command= SQLCOM_ALTER_FUNCTION; + lex->spname= $3; + } + | ALTER view_algorithm definer_opt opt_view_suid VIEW_SYM table_ident + { + if (unlikely(Lex->add_alter_view(thd, $2, $4, $6))) + MYSQL_YYABORT; + } + view_list_opt AS view_select + {} + | ALTER definer_opt opt_view_suid VIEW_SYM table_ident + /* + We have two separate rules for ALTER VIEW rather that + optional view_algorithm above, to resolve the ambiguity + with the ALTER EVENT below. + */ + { + if (unlikely(Lex->add_alter_view(thd, VIEW_ALGORITHM_INHERIT, $3, $5))) + MYSQL_YYABORT; + } + view_list_opt AS view_select + {} + | ALTER definer_opt remember_name EVENT_SYM sp_name + { + /* + It is safe to use Lex->spname because + ALTER EVENT xxx RENATE TO yyy DO ALTER EVENT RENAME TO + is not allowed. Lex->spname is used in the case of RENAME TO + If it had to be supported spname had to be added to + Event_parse_data. + */ + + if (unlikely(!(Lex->event_parse_data= Event_parse_data::new_instance(thd)))) + MYSQL_YYABORT; + Lex->event_parse_data->identifier= $5; + + Lex->sql_command= SQLCOM_ALTER_EVENT; + Lex->stmt_definition_begin= $3; + } + ev_alter_on_schedule_completion + opt_ev_rename_to + opt_ev_status + opt_ev_comment + opt_ev_sql_stmt + { + if (unlikely(!($7 || $8 || $9 || $10 || $11))) + { + thd->parse_error(); + MYSQL_YYABORT; + } + /* + sql_command is set here because some rules in ev_sql_stmt + can overwrite it + */ + Lex->sql_command= SQLCOM_ALTER_EVENT; + Lex->stmt_definition_end= (char*)YYLIP->get_cpp_ptr(); + } + | ALTER TABLESPACE alter_tablespace_info + { + LEX *lex= Lex; + lex->alter_tablespace_info->ts_cmd_type= ALTER_TABLESPACE; + } + | ALTER LOGFILE_SYM GROUP_SYM alter_logfile_group_info + { + LEX *lex= Lex; + lex->alter_tablespace_info->ts_cmd_type= ALTER_LOGFILE_GROUP; + } + | ALTER TABLESPACE change_tablespace_info + { + LEX *lex= Lex; + lex->alter_tablespace_info->ts_cmd_type= CHANGE_FILE_TABLESPACE; + } + | ALTER TABLESPACE change_tablespace_access + { + LEX *lex= Lex; + lex->alter_tablespace_info->ts_cmd_type= ALTER_ACCESS_MODE_TABLESPACE; + } + | ALTER SERVER_SYM ident_or_text + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_ALTER_SERVER; + lex->server_options.reset($3); + } OPTIONS_SYM '(' server_options_list ')' { } + /* ALTER USER foo is allowed for MySQL compatibility. */ + | ALTER opt_if_exists USER_SYM clear_privileges grant_list + opt_require_clause opt_resource_options + { + Lex->create_info.set($2); + Lex->sql_command= SQLCOM_ALTER_USER; + } + | ALTER SEQUENCE_SYM opt_if_exists + { + LEX *lex= Lex; + lex->name= null_clex_str; + lex->table_type= TABLE_TYPE_UNKNOWN; + lex->sql_command= SQLCOM_ALTER_SEQUENCE; + lex->create_info.init(); + lex->no_write_to_binlog= 0; + DBUG_ASSERT(!lex->m_sql_cmd); + } + table_ident + { + LEX *lex= Lex; + if (unlikely(!(lex->create_info.seq_create_info= + new (thd->mem_root) sequence_definition())) || + unlikely(!lex->select_lex.add_table_to_list(thd, $5, NULL, + TL_OPTION_SEQUENCE, + TL_WRITE, + MDL_EXCLUSIVE))) + MYSQL_YYABORT; + } + sequence_defs + { + /* Create a generic ALTER SEQUENCE statment. */ + Lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_alter_sequence($3); + if (unlikely(Lex->m_sql_cmd == NULL)) + MYSQL_YYABORT; + } + ; + +ev_alter_on_schedule_completion: + /* empty */ { $$= 0;} + | ON SCHEDULE_SYM ev_schedule_time { $$= 1; } + | ev_on_completion { $$= 1; } + | ON SCHEDULE_SYM ev_schedule_time ev_on_completion { $$= 1; } + ; + +opt_ev_rename_to: + /* empty */ { $$= 0;} + | RENAME TO_SYM sp_name + { + /* + Use lex's spname to hold the new name. + The original name is in the Event_parse_data object + */ + Lex->spname= $3; + $$= 1; + } + ; + +opt_ev_sql_stmt: + /* empty*/ { $$= 0;} + | DO_SYM ev_sql_stmt { $$= 1; } + ; + +ident_or_empty: + /* empty */ { $$= Lex_ident_sys(); } + | ident + ; + +alter_commands: + /* empty */ + | DISCARD TABLESPACE + { + Lex->m_sql_cmd= new (thd->mem_root) + Sql_cmd_discard_import_tablespace( + Sql_cmd_discard_import_tablespace::DISCARD_TABLESPACE); + if (unlikely(Lex->m_sql_cmd == NULL)) + MYSQL_YYABORT; + } + | IMPORT TABLESPACE + { + Lex->m_sql_cmd= new (thd->mem_root) + Sql_cmd_discard_import_tablespace( + Sql_cmd_discard_import_tablespace::IMPORT_TABLESPACE); + if (unlikely(Lex->m_sql_cmd == NULL)) + MYSQL_YYABORT; + } + | alter_list + opt_partitioning + | alter_list + remove_partitioning + | remove_partitioning + | partitioning +/* + This part was added for release 5.1 by Mikael Ronstrm. + From here we insert a number of commands to manage the partitions of a + partitioned table such as adding partitions, dropping partitions, + reorganising partitions in various manners. In future releases the list + will be longer. +*/ + | add_partition_rule + | DROP PARTITION_SYM opt_if_exists alt_part_name_list + { + Lex->alter_info.partition_flags|= ALTER_PARTITION_DROP; + DBUG_ASSERT(!Lex->if_exists()); + Lex->create_info.add($3); + } + | REBUILD_SYM PARTITION_SYM opt_no_write_to_binlog + all_or_alt_part_name_list + { + LEX *lex= Lex; + lex->alter_info.partition_flags|= ALTER_PARTITION_REBUILD; + lex->no_write_to_binlog= $3; + } + | OPTIMIZE PARTITION_SYM opt_no_write_to_binlog + all_or_alt_part_name_list + { + LEX *lex= thd->lex; + lex->no_write_to_binlog= $3; + lex->check_opt.init(); + DBUG_ASSERT(!lex->m_sql_cmd); + lex->m_sql_cmd= new (thd->mem_root) + Sql_cmd_alter_table_optimize_partition(); + if (unlikely(lex->m_sql_cmd == NULL)) + MYSQL_YYABORT; + } + opt_no_write_to_binlog + | ANALYZE_SYM PARTITION_SYM opt_no_write_to_binlog + all_or_alt_part_name_list + { + LEX *lex= thd->lex; + lex->no_write_to_binlog= $3; + lex->check_opt.init(); + DBUG_ASSERT(!lex->m_sql_cmd); + lex->m_sql_cmd= new (thd->mem_root) + Sql_cmd_alter_table_analyze_partition(); + if (unlikely(lex->m_sql_cmd == NULL)) + MYSQL_YYABORT; + } + | CHECK_SYM PARTITION_SYM all_or_alt_part_name_list + { + LEX *lex= thd->lex; + lex->check_opt.init(); + DBUG_ASSERT(!lex->m_sql_cmd); + lex->m_sql_cmd= new (thd->mem_root) + Sql_cmd_alter_table_check_partition(); + if (unlikely(lex->m_sql_cmd == NULL)) + MYSQL_YYABORT; + } + opt_mi_check_type + | REPAIR PARTITION_SYM opt_no_write_to_binlog + all_or_alt_part_name_list + { + LEX *lex= thd->lex; + lex->no_write_to_binlog= $3; + lex->check_opt.init(); + DBUG_ASSERT(!lex->m_sql_cmd); + lex->m_sql_cmd= new (thd->mem_root) + Sql_cmd_alter_table_repair_partition(); + if (unlikely(lex->m_sql_cmd == NULL)) + MYSQL_YYABORT; + } + opt_mi_repair_type + | COALESCE PARTITION_SYM opt_no_write_to_binlog real_ulong_num + { + LEX *lex= Lex; + lex->alter_info.partition_flags|= ALTER_PARTITION_COALESCE; + lex->no_write_to_binlog= $3; + lex->alter_info.num_parts= $4; + } + | TRUNCATE_SYM PARTITION_SYM all_or_alt_part_name_list + { + LEX *lex= thd->lex; + lex->check_opt.init(); + DBUG_ASSERT(!lex->m_sql_cmd); + lex->m_sql_cmd= new (thd->mem_root) + Sql_cmd_alter_table_truncate_partition(); + if (unlikely(lex->m_sql_cmd == NULL)) + MYSQL_YYABORT; + } + | reorg_partition_rule + | EXCHANGE_SYM PARTITION_SYM alt_part_name_item + WITH TABLE_SYM table_ident have_partitioning + { + LEX *lex= thd->lex; + lex->select_lex.db= $6->db; + if (lex->select_lex.db.str == NULL && + unlikely(lex->copy_db_to(&lex->select_lex.db))) + MYSQL_YYABORT; + lex->name= $6->table; + lex->alter_info.partition_flags|= ALTER_PARTITION_EXCHANGE; + if (unlikely(!lex->select_lex.add_table_to_list(thd, $6, NULL, + TL_OPTION_UPDATING, + TL_READ_NO_INSERT, + MDL_SHARED_NO_WRITE))) + MYSQL_YYABORT; + DBUG_ASSERT(!lex->m_sql_cmd); + lex->m_sql_cmd= new (thd->mem_root) + Sql_cmd_alter_table_exchange_partition(); + if (unlikely(lex->m_sql_cmd == NULL)) + MYSQL_YYABORT; + } + ; + +remove_partitioning: + REMOVE_SYM PARTITIONING_SYM + { + Lex->alter_info.partition_flags|= ALTER_PARTITION_REMOVE; + } + ; + +all_or_alt_part_name_list: + ALL + { + Lex->alter_info.partition_flags|= ALTER_PARTITION_ALL; + } + | alt_part_name_list + ; + +add_partition_rule: + ADD PARTITION_SYM opt_if_not_exists + opt_no_write_to_binlog + { + LEX *lex= Lex; + lex->part_info= new (thd->mem_root) partition_info(); + if (unlikely(!lex->part_info)) + MYSQL_YYABORT; + + lex->alter_info.partition_flags|= ALTER_PARTITION_ADD; + DBUG_ASSERT(!Lex->create_info.if_not_exists()); + lex->create_info.set($3); + lex->no_write_to_binlog= $4; + } + add_part_extra + {} + ; + +add_part_extra: + /* empty */ + | '(' part_def_list ')' + { + LEX *lex= Lex; + lex->part_info->num_parts= lex->part_info->partitions.elements; + } + | PARTITIONS_SYM real_ulong_num + { + Lex->part_info->num_parts= $2; + } + ; + +reorg_partition_rule: + REORGANIZE_SYM PARTITION_SYM opt_no_write_to_binlog + { + LEX *lex= Lex; + lex->part_info= new (thd->mem_root) partition_info(); + if (unlikely(!lex->part_info)) + MYSQL_YYABORT; + + lex->no_write_to_binlog= $3; + } + reorg_parts_rule + ; + +reorg_parts_rule: + /* empty */ + { + Lex->alter_info.partition_flags|= ALTER_PARTITION_TABLE_REORG; + } + | alt_part_name_list + { + Lex->alter_info.partition_flags|= ALTER_PARTITION_REORGANIZE; + } + INTO '(' part_def_list ')' + { + partition_info *part_info= Lex->part_info; + part_info->num_parts= part_info->partitions.elements; + } + ; + +alt_part_name_list: + alt_part_name_item {} + | alt_part_name_list ',' alt_part_name_item {} + ; + +alt_part_name_item: + ident + { + if (unlikely(Lex->alter_info.partition_names.push_back($1.str, + thd->mem_root))) + MYSQL_YYABORT; + } + ; + +/* + End of management of partition commands +*/ + +alter_list: + alter_list_item + | alter_list ',' alter_list_item + ; + +add_column: + ADD opt_column opt_if_not_exists_table_element + ; + +alter_list_item: + add_column column_def opt_place + { + LEX *lex=Lex; + lex->create_last_non_select_table= lex->last_table(); + lex->alter_info.flags|= ALTER_PARSER_ADD_COLUMN; + $2->after= $3; + } + | ADD key_def + { + Lex->create_last_non_select_table= Lex->last_table(); + Lex->alter_info.flags|= ALTER_ADD_INDEX; + } + | ADD period_for_system_time + { + Lex->alter_info.flags|= ALTER_ADD_PERIOD; + } + | add_column '(' create_field_list ')' + { + LEX *lex=Lex; + lex->alter_info.flags|= ALTER_PARSER_ADD_COLUMN; + if (!lex->alter_info.key_list.is_empty()) + lex->alter_info.flags|= ALTER_ADD_INDEX; + } + | ADD constraint_def + { + Lex->alter_info.flags|= ALTER_ADD_CHECK_CONSTRAINT; + } + | ADD CONSTRAINT IF_SYM not EXISTS field_ident check_constraint + { + Lex->alter_info.flags|= ALTER_ADD_CHECK_CONSTRAINT; + Lex->add_constraint(&$6, $7, TRUE); + } + | CHANGE opt_column opt_if_exists_table_element field_ident + field_spec opt_place + { + Lex->alter_info.flags|= ALTER_CHANGE_COLUMN | ALTER_RENAME_COLUMN; + Lex->create_last_non_select_table= Lex->last_table(); + $5->change= $4; + $5->after= $6; + } + | MODIFY_SYM opt_column opt_if_exists_table_element + field_spec opt_place + { + Lex->alter_info.flags|= ALTER_CHANGE_COLUMN; + Lex->create_last_non_select_table= Lex->last_table(); + $4->change= $4->field_name; + $4->after= $5; + } + | DROP opt_column opt_if_exists_table_element field_ident opt_restrict + { + LEX *lex=Lex; + Alter_drop *ad= (new (thd->mem_root) + Alter_drop(Alter_drop::COLUMN, $4.str, $3)); + if (unlikely(ad == NULL)) + MYSQL_YYABORT; + lex->alter_info.drop_list.push_back(ad, thd->mem_root); + lex->alter_info.flags|= ALTER_PARSER_DROP_COLUMN; + } + | DROP CONSTRAINT opt_if_exists_table_element field_ident + { + LEX *lex=Lex; + Alter_drop *ad= (new (thd->mem_root) + Alter_drop(Alter_drop::CHECK_CONSTRAINT, + $4.str, $3)); + if (unlikely(ad == NULL)) + MYSQL_YYABORT; + lex->alter_info.drop_list.push_back(ad, thd->mem_root); + lex->alter_info.flags|= ALTER_DROP_CHECK_CONSTRAINT; + } + | DROP FOREIGN KEY_SYM opt_if_exists_table_element field_ident + { + LEX *lex=Lex; + Alter_drop *ad= (new (thd->mem_root) + Alter_drop(Alter_drop::FOREIGN_KEY, $5.str, $4)); + if (unlikely(ad == NULL)) + MYSQL_YYABORT; + lex->alter_info.drop_list.push_back(ad, thd->mem_root); + lex->alter_info.flags|= ALTER_DROP_FOREIGN_KEY; + } + | DROP opt_constraint_no_id PRIMARY_SYM KEY_SYM + { + LEX *lex=Lex; + Alter_drop *ad= (new (thd->mem_root) + Alter_drop(Alter_drop::KEY, primary_key_name, + FALSE)); + if (unlikely(ad == NULL)) + MYSQL_YYABORT; + lex->alter_info.drop_list.push_back(ad, thd->mem_root); + lex->alter_info.flags|= ALTER_DROP_INDEX; + } + | DROP key_or_index opt_if_exists_table_element field_ident + { + LEX *lex=Lex; + Alter_drop *ad= (new (thd->mem_root) + Alter_drop(Alter_drop::KEY, $4.str, $3)); + if (unlikely(ad == NULL)) + MYSQL_YYABORT; + lex->alter_info.drop_list.push_back(ad, thd->mem_root); + lex->alter_info.flags|= ALTER_DROP_INDEX; + } + | DISABLE_SYM KEYS + { + LEX *lex=Lex; + lex->alter_info.keys_onoff= Alter_info::DISABLE; + lex->alter_info.flags|= ALTER_KEYS_ONOFF; + } + | ENABLE_SYM KEYS + { + LEX *lex=Lex; + lex->alter_info.keys_onoff= Alter_info::ENABLE; + lex->alter_info.flags|= ALTER_KEYS_ONOFF; + } + | ALTER opt_column opt_if_exists_table_element field_ident SET DEFAULT column_default_expr + { + if (unlikely(Lex->add_alter_list($4.str, $7, $3))) + MYSQL_YYABORT; + } + | ALTER opt_column opt_if_exists_table_element field_ident DROP DEFAULT + { + if (unlikely(Lex->add_alter_list($4.str, (Virtual_column_info*) 0, + $3))) + MYSQL_YYABORT; + } + | RENAME opt_to table_ident + { + LEX *lex=Lex; + lex->select_lex.db= $3->db; + if (lex->select_lex.db.str == NULL && + unlikely(lex->copy_db_to(&lex->select_lex.db))) + MYSQL_YYABORT; + if (unlikely(check_table_name($3->table.str,$3->table.length, + FALSE)) || + ($3->db.str && unlikely(check_db_name((LEX_STRING*) &$3->db)))) + my_yyabort_error((ER_WRONG_TABLE_NAME, MYF(0), $3->table.str)); + lex->name= $3->table; + lex->alter_info.flags|= ALTER_RENAME; + } + | CONVERT_SYM TO_SYM charset charset_name_or_default opt_collate + { + if (!$4) + { + $4= thd->variables.collation_database; + } + $5= $5 ? $5 : $4; + if (unlikely(!my_charset_same($4,$5))) + my_yyabort_error((ER_COLLATION_CHARSET_MISMATCH, MYF(0), + $5->name, $4->csname)); + if (unlikely(Lex->create_info.add_alter_list_item_convert_to_charset($5))) + MYSQL_YYABORT; + Lex->alter_info.flags|= ALTER_OPTIONS; + } + | create_table_options_space_separated + { + LEX *lex=Lex; + lex->alter_info.flags|= ALTER_OPTIONS; + if ((lex->create_info.used_fields & HA_CREATE_USED_ENGINE) && + !lex->create_info.db_type) + { + lex->create_info.used_fields&= ~HA_CREATE_USED_ENGINE; + } + } + | FORCE_SYM + { + Lex->alter_info.flags|= ALTER_RECREATE; + } + | alter_order_clause + { + LEX *lex=Lex; + lex->alter_info.flags|= ALTER_ORDER; + } + | alter_algorithm_option + | alter_lock_option + | ADD SYSTEM VERSIONING_SYM + { + Lex->alter_info.flags|= ALTER_ADD_SYSTEM_VERSIONING; + Lex->create_info.options|= HA_VERSIONED_TABLE; + } + | DROP SYSTEM VERSIONING_SYM + { + Lex->alter_info.flags|= ALTER_DROP_SYSTEM_VERSIONING; + } + | DROP PERIOD_SYM FOR_SYSTEM_TIME_SYM + { + Lex->alter_info.flags|= ALTER_DROP_PERIOD; + } + ; + +opt_index_lock_algorithm: + /* empty */ + | alter_lock_option + | alter_algorithm_option + | alter_lock_option alter_algorithm_option + | alter_algorithm_option alter_lock_option + +alter_algorithm_option: + ALGORITHM_SYM opt_equal DEFAULT + { + Lex->alter_info.requested_algorithm= + Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT; + } + | ALGORITHM_SYM opt_equal ident + { + if (unlikely(Lex->alter_info.set_requested_algorithm(&$3))) + my_yyabort_error((ER_UNKNOWN_ALTER_ALGORITHM, MYF(0), $3.str)); + } + ; + +alter_lock_option: + LOCK_SYM opt_equal DEFAULT + { + Lex->alter_info.requested_lock= + Alter_info::ALTER_TABLE_LOCK_DEFAULT; + } + | LOCK_SYM opt_equal ident + { + if (unlikely(Lex->alter_info.set_requested_lock(&$3))) + my_yyabort_error((ER_UNKNOWN_ALTER_LOCK, MYF(0), $3.str)); + } + ; + +opt_column: + /* empty */ {} %prec PREC_BELOW_IDENTIFIER_OPT_SPECIAL_CASE + | COLUMN_SYM {} + ; + +opt_ignore: + /* empty */ { Lex->ignore= 0;} + | IGNORE_SYM { Lex->ignore= 1;} + ; + +alter_options: + { Lex->ignore= 0;} alter_options_part2 + ; + +alter_options_part2: + /* empty */ + | alter_option_list + ; + +alter_option_list: + alter_option_list alter_option + | alter_option + ; + +alter_option: + IGNORE_SYM { Lex->ignore= 1;} + | ONLINE_SYM + { + Lex->alter_info.requested_lock= + Alter_info::ALTER_TABLE_LOCK_NONE; + } + + +opt_restrict: + /* empty */ { Lex->drop_mode= DROP_DEFAULT; } + | RESTRICT { Lex->drop_mode= DROP_RESTRICT; } + | CASCADE { Lex->drop_mode= DROP_CASCADE; } + ; + +opt_place: + /* empty */ { $$= null_clex_str; } + | AFTER_SYM ident + { + $$= $2; + Lex->alter_info.flags |= ALTER_COLUMN_ORDER; + } + | FIRST_SYM + { + $$.str= first_keyword; + $$.length= 5; /* Length of "first" */ + Lex->alter_info.flags |= ALTER_COLUMN_ORDER; + } + ; + +opt_to: + /* empty */ {} + | TO_SYM {} + | '=' {} + | AS {} + ; + +slave: + START_SYM SLAVE optional_connection_name slave_thread_opts + { + LEX *lex=Lex; + lex->sql_command = SQLCOM_SLAVE_START; + lex->type = 0; + /* If you change this code don't forget to update SLAVE START too */ + } + slave_until + {} + | START_SYM ALL SLAVES slave_thread_opts + { + LEX *lex=Lex; + lex->sql_command = SQLCOM_SLAVE_ALL_START; + lex->type = 0; + /* If you change this code don't forget to update STOP SLAVE too */ + } + {} + | STOP_SYM SLAVE optional_connection_name slave_thread_opts + { + LEX *lex=Lex; + lex->sql_command = SQLCOM_SLAVE_STOP; + lex->type = 0; + /* If you change this code don't forget to update SLAVE STOP too */ + } + | STOP_SYM ALL SLAVES slave_thread_opts + { + LEX *lex=Lex; + lex->sql_command = SQLCOM_SLAVE_ALL_STOP; + lex->type = 0; + /* If you change this code don't forget to update SLAVE STOP too */ + } + ; + +start: + START_SYM TRANSACTION_SYM opt_start_transaction_option_list + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_BEGIN; + /* READ ONLY and READ WRITE are mutually exclusive. */ + if (unlikely(($3 & MYSQL_START_TRANS_OPT_READ_WRITE) && + ($3 & MYSQL_START_TRANS_OPT_READ_ONLY))) + { + thd->parse_error(); + MYSQL_YYABORT; + } + lex->start_transaction_opt= $3; + } + ; + +opt_start_transaction_option_list: + /* empty */ + { + $$= 0; + } + | start_transaction_option_list + { + $$= $1; + } + ; + +start_transaction_option_list: + start_transaction_option + { + $$= $1; + } + | start_transaction_option_list ',' start_transaction_option + { + $$= $1 | $3; + } + ; + +start_transaction_option: + WITH CONSISTENT_SYM SNAPSHOT_SYM + { + $$= MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT; + } + | READ_SYM ONLY_SYM + { + $$= MYSQL_START_TRANS_OPT_READ_ONLY; + } + | READ_SYM WRITE_SYM + { + $$= MYSQL_START_TRANS_OPT_READ_WRITE; + } + ; + +slave_thread_opts: + { Lex->slave_thd_opt= 0; } + slave_thread_opt_list + {} + ; + +slave_thread_opt_list: + slave_thread_opt + | slave_thread_opt_list ',' slave_thread_opt + ; + +slave_thread_opt: + /*empty*/ {} + | SQL_THREAD { Lex->slave_thd_opt|=SLAVE_SQL; } + | RELAY_THREAD { Lex->slave_thd_opt|=SLAVE_IO; } + ; + +slave_until: + /*empty*/ {} + | UNTIL_SYM slave_until_opts + { + LEX *lex=Lex; + if (unlikely(((lex->mi.log_file_name || lex->mi.pos) && + (lex->mi.relay_log_name || lex->mi.relay_log_pos)) || + !((lex->mi.log_file_name && lex->mi.pos) || + (lex->mi.relay_log_name && lex->mi.relay_log_pos)))) + my_yyabort_error((ER_BAD_SLAVE_UNTIL_COND, MYF(0))); + } + | UNTIL_SYM MASTER_GTID_POS_SYM '=' TEXT_STRING_sys + { + Lex->mi.gtid_pos_str = $4; + } + ; + +slave_until_opts: + master_file_def + | slave_until_opts ',' master_file_def + ; + +checksum: + CHECKSUM_SYM table_or_tables + { + LEX *lex=Lex; + lex->sql_command = SQLCOM_CHECKSUM; + /* Will be overridden during execution. */ + YYPS->m_lock_type= TL_UNLOCK; + } + table_list opt_checksum_type + {} + ; + +opt_checksum_type: + /* nothing */ { Lex->check_opt.flags= 0; } + | QUICK { Lex->check_opt.flags= T_QUICK; } + | EXTENDED_SYM { Lex->check_opt.flags= T_EXTEND; } + ; + +repair_table_or_view: + table_or_tables table_list opt_mi_repair_type + | VIEW_SYM + { Lex->table_type= TABLE_TYPE_VIEW; } + table_list opt_view_repair_type + ; + +repair: + REPAIR opt_no_write_to_binlog + { + LEX *lex=Lex; + lex->sql_command = SQLCOM_REPAIR; + lex->no_write_to_binlog= $2; + lex->check_opt.init(); + lex->alter_info.reset(); + /* Will be overridden during execution. */ + YYPS->m_lock_type= TL_UNLOCK; + } + repair_table_or_view + { + LEX* lex= thd->lex; + DBUG_ASSERT(!lex->m_sql_cmd); + lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_repair_table(); + if (unlikely(lex->m_sql_cmd == NULL)) + MYSQL_YYABORT; + } + ; + +opt_mi_repair_type: + /* empty */ { Lex->check_opt.flags = T_MEDIUM; } + | mi_repair_types {} + ; + +mi_repair_types: + mi_repair_type {} + | mi_repair_type mi_repair_types {} + ; + +mi_repair_type: + QUICK { Lex->check_opt.flags|= T_QUICK; } + | EXTENDED_SYM { Lex->check_opt.flags|= T_EXTEND; } + | USE_FRM { Lex->check_opt.sql_flags|= TT_USEFRM; } + ; + +opt_view_repair_type: + /* empty */ { } + | FROM MYSQL_SYM { Lex->check_opt.sql_flags|= TT_FROM_MYSQL; } + ; + +analyze: + ANALYZE_SYM opt_no_write_to_binlog table_or_tables + { + LEX *lex=Lex; + lex->sql_command = SQLCOM_ANALYZE; + lex->no_write_to_binlog= $2; + lex->check_opt.init(); + lex->alter_info.reset(); + /* Will be overridden during execution. */ + YYPS->m_lock_type= TL_UNLOCK; + } + analyze_table_list + { + LEX* lex= thd->lex; + DBUG_ASSERT(!lex->m_sql_cmd); + lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_analyze_table(); + if (unlikely(lex->m_sql_cmd == NULL)) + MYSQL_YYABORT; + } + ; + +analyze_table_list: + analyze_table_elem_spec + | analyze_table_list ',' analyze_table_elem_spec + ; + +analyze_table_elem_spec: + table_name opt_persistent_stat_clause + ; + +opt_persistent_stat_clause: + /* empty */ + {} + | PERSISTENT_SYM FOR_SYM persistent_stat_spec + { + thd->lex->with_persistent_for_clause= TRUE; + } + ; + +persistent_stat_spec: + ALL + {} + | COLUMNS persistent_column_stat_spec INDEXES persistent_index_stat_spec + {} + +persistent_column_stat_spec: + ALL {} + | '(' + { + LEX* lex= thd->lex; + lex->column_list= new (thd->mem_root) List<LEX_STRING>; + if (unlikely(lex->column_list == NULL)) + MYSQL_YYABORT; + } + table_column_list + ')' + ; + +persistent_index_stat_spec: + ALL {} + | '(' + { + LEX* lex= thd->lex; + lex->index_list= new (thd->mem_root) List<LEX_STRING>; + if (unlikely(lex->index_list == NULL)) + MYSQL_YYABORT; + } + table_index_list + ')' + ; + +table_column_list: + /* empty */ + {} + | ident + { + Lex->column_list->push_back((LEX_STRING*) + thd->memdup(&$1, sizeof(LEX_STRING)), thd->mem_root); + } + | table_column_list ',' ident + { + Lex->column_list->push_back((LEX_STRING*) + thd->memdup(&$3, sizeof(LEX_STRING)), thd->mem_root); + } + ; + +table_index_list: + /* empty */ + {} + | table_index_name + | table_index_list ',' table_index_name + ; + +table_index_name: + ident + { + Lex->index_list->push_back((LEX_STRING*) + thd->memdup(&$1, sizeof(LEX_STRING)), + thd->mem_root); + } + | + PRIMARY_SYM + { + LEX_STRING str= {(char*) "PRIMARY", 7}; + Lex->index_list->push_back((LEX_STRING*) + thd->memdup(&str, sizeof(LEX_STRING)), + thd->mem_root); + } + ; + +binlog_base64_event: + BINLOG_SYM TEXT_STRING_sys + { + Lex->sql_command = SQLCOM_BINLOG_BASE64_EVENT; + Lex->comment= $2; + Lex->ident.str= NULL; + Lex->ident.length= 0; + } + | + BINLOG_SYM '@' ident_or_text ',' '@' ident_or_text + { + Lex->sql_command = SQLCOM_BINLOG_BASE64_EVENT; + Lex->comment= $3; + Lex->ident= $6; + } + ; + +check_view_or_table: + table_or_tables table_list opt_mi_check_type + | VIEW_SYM + { Lex->table_type= TABLE_TYPE_VIEW; } + table_list opt_view_check_type + ; + +check: CHECK_SYM + { + LEX *lex=Lex; + + lex->sql_command = SQLCOM_CHECK; + lex->check_opt.init(); + lex->alter_info.reset(); + /* Will be overridden during execution. */ + YYPS->m_lock_type= TL_UNLOCK; + } + check_view_or_table + { + LEX* lex= thd->lex; + if (unlikely(lex->sphead)) + my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "CHECK")); + DBUG_ASSERT(!lex->m_sql_cmd); + lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_check_table(); + if (unlikely(lex->m_sql_cmd == NULL)) + MYSQL_YYABORT; + } + ; + +opt_mi_check_type: + /* empty */ { Lex->check_opt.flags = T_MEDIUM; } + | mi_check_types {} + ; + +mi_check_types: + mi_check_type {} + | mi_check_type mi_check_types {} + ; + +mi_check_type: + QUICK { Lex->check_opt.flags|= T_QUICK; } + | FAST_SYM { Lex->check_opt.flags|= T_FAST; } + | MEDIUM_SYM { Lex->check_opt.flags|= T_MEDIUM; } + | EXTENDED_SYM { Lex->check_opt.flags|= T_EXTEND; } + | CHANGED { Lex->check_opt.flags|= T_CHECK_ONLY_CHANGED; } + | FOR_SYM UPGRADE_SYM { Lex->check_opt.sql_flags|= TT_FOR_UPGRADE; } + ; + +opt_view_check_type: + /* empty */ { } + | FOR_SYM UPGRADE_SYM { Lex->check_opt.sql_flags|= TT_FOR_UPGRADE; } + ; + +optimize: + OPTIMIZE opt_no_write_to_binlog table_or_tables + { + LEX *lex=Lex; + lex->sql_command = SQLCOM_OPTIMIZE; + lex->no_write_to_binlog= $2; + lex->check_opt.init(); + lex->alter_info.reset(); + /* Will be overridden during execution. */ + YYPS->m_lock_type= TL_UNLOCK; + } + table_list opt_lock_wait_timeout + { + LEX* lex= thd->lex; + DBUG_ASSERT(!lex->m_sql_cmd); + lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_optimize_table(); + if (unlikely(lex->m_sql_cmd == NULL)) + MYSQL_YYABORT; + } + ; + +opt_no_write_to_binlog: + /* empty */ { $$= 0; } + | NO_WRITE_TO_BINLOG { $$= 1; } + | LOCAL_SYM { $$= 1; } + ; + +rename: + RENAME table_or_tables + { + Lex->sql_command= SQLCOM_RENAME_TABLE; + } + table_to_table_list + {} + | RENAME USER_SYM clear_privileges rename_list + { + Lex->sql_command = SQLCOM_RENAME_USER; + } + ; + +rename_list: + user TO_SYM user + { + if (unlikely(Lex->users_list.push_back($1, thd->mem_root) || + Lex->users_list.push_back($3, thd->mem_root))) + MYSQL_YYABORT; + } + | rename_list ',' user TO_SYM user + { + if (unlikely(Lex->users_list.push_back($3, thd->mem_root) || + Lex->users_list.push_back($5, thd->mem_root))) + MYSQL_YYABORT; + } + ; + +table_to_table_list: + table_to_table + | table_to_table_list ',' table_to_table + ; + +table_to_table: + table_ident opt_lock_wait_timeout TO_SYM table_ident + { + LEX *lex=Lex; + SELECT_LEX *sl= lex->current_select; + if (unlikely(!sl->add_table_to_list(thd, $1,NULL, + TL_OPTION_UPDATING, + TL_IGNORE, MDL_EXCLUSIVE)) || + unlikely(!sl->add_table_to_list(thd, $4, NULL, + TL_OPTION_UPDATING, + TL_IGNORE, MDL_EXCLUSIVE))) + MYSQL_YYABORT; + } + ; + +keycache: + CACHE_SYM INDEX_SYM + { + Lex->alter_info.reset(); + } + keycache_list_or_parts IN_SYM key_cache_name + { + LEX *lex=Lex; + lex->sql_command= SQLCOM_ASSIGN_TO_KEYCACHE; + lex->ident= $6; + } + ; + +keycache_list_or_parts: + keycache_list + | assign_to_keycache_parts + ; + +keycache_list: + assign_to_keycache + | keycache_list ',' assign_to_keycache + ; + +assign_to_keycache: + table_ident cache_keys_spec + { + if (unlikely(!Select->add_table_to_list(thd, $1, NULL, 0, TL_READ, + MDL_SHARED_READ, + Select-> + pop_index_hints()))) + MYSQL_YYABORT; + } + ; + +assign_to_keycache_parts: + table_ident adm_partition cache_keys_spec + { + if (unlikely(!Select->add_table_to_list(thd, $1, NULL, 0, TL_READ, + MDL_SHARED_READ, + Select-> + pop_index_hints()))) + MYSQL_YYABORT; + } + ; + +key_cache_name: + ident { $$= $1; } + | DEFAULT { $$ = default_key_cache_base; } + ; + +preload: + LOAD INDEX_SYM INTO CACHE_SYM + { + LEX *lex=Lex; + lex->sql_command=SQLCOM_PRELOAD_KEYS; + lex->alter_info.reset(); + } + preload_list_or_parts + {} + ; + +preload_list_or_parts: + preload_keys_parts + | preload_list + ; + +preload_list: + preload_keys + | preload_list ',' preload_keys + ; + +preload_keys: + table_ident cache_keys_spec opt_ignore_leaves + { + if (unlikely(!Select->add_table_to_list(thd, $1, NULL, $3, TL_READ, + MDL_SHARED_READ, + Select-> + pop_index_hints()))) + MYSQL_YYABORT; + } + ; + +preload_keys_parts: + table_ident adm_partition cache_keys_spec opt_ignore_leaves + { + if (unlikely(!Select->add_table_to_list(thd, $1, NULL, $4, TL_READ, + MDL_SHARED_READ, + Select-> + pop_index_hints()))) + MYSQL_YYABORT; + } + ; + +adm_partition: + PARTITION_SYM have_partitioning + { + Lex->alter_info.partition_flags|= ALTER_PARTITION_ADMIN; + } + '(' all_or_alt_part_name_list ')' + ; + +cache_keys_spec: + { + Lex->select_lex.alloc_index_hints(thd); + Select->set_index_hint_type(INDEX_HINT_USE, + INDEX_HINT_MASK_ALL); + } + cache_key_list_or_empty + ; + +cache_key_list_or_empty: + /* empty */ { } + | key_or_index '(' opt_key_usage_list ')' + ; + +opt_ignore_leaves: + /* empty */ + { $$= 0; } + | IGNORE_SYM LEAVES { $$= TL_OPTION_IGNORE_LEAVES; } + ; + +/* + Select : retrieve data from table +*/ + + +select: + opt_with_clause select_init + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SELECT; + lex->current_select->set_with_clause($1); + } + ; + +select_init: + SELECT_SYM select_options_and_item_list select_init3 + | table_value_constructor + | table_value_constructor union_list + | table_value_constructor union_order_or_limit + | '(' select_paren ')' + | '(' select_paren ')' union_list + | '(' select_paren ')' union_order_or_limit + ; + +union_list_part2: + SELECT_SYM select_options_and_item_list select_init3_union_query_term + | table_value_constructor + | table_value_constructor union_list + | table_value_constructor union_order_or_limit + | '(' select_paren_union_query_term ')' + | '(' select_paren_union_query_term ')' union_list + | '(' select_paren_union_query_term ')' union_order_or_limit + ; + +select_paren: + { + Lex->current_select->set_braces(true); + } + table_value_constructor select_part3 + { + DBUG_ASSERT(Lex->current_select->braces); + } + | + { + /* + In order to correctly parse UNION's global ORDER BY we need to + set braces before parsing the clause. + */ + Lex->current_select->set_braces(true); + } + SELECT_SYM select_options_and_item_list select_part3 + opt_select_lock_type + { + DBUG_ASSERT(Lex->current_select->braces); + } + | '(' select_paren ')' + ; + +select_parent_union_query_term_proper: + SELECT_SYM select_options_and_item_list select_part3_union_query_term + opt_select_lock_type + | table_value_constructor select_part3_union_query_term + ; + +select_paren_union_query_term: + { + /* + In order to correctly parse UNION's global ORDER BY we need to + set braces before parsing the clause. + */ + Lex->current_select->set_braces(true); + } + select_parent_union_query_term_proper + { + DBUG_ASSERT(Lex->current_select->braces); + } + | '(' select_paren_union_query_term ')' + ; + +select_parent_view_proper: + SELECT_SYM select_options_and_item_list select_part3_view + opt_select_lock_type + | table_value_constructor select_part3_view + ; + +select_paren_view: + { + /* + In order to correctly parse UNION's global ORDER BY we need to + set braces before parsing the clause. + */ + Lex->current_select->set_braces(true); + } + select_parent_view_proper + { + DBUG_ASSERT(Lex->current_select->braces); + } + | '(' select_paren_view ')' + ; + +/* The equivalent of select_paren for nested queries. */ +select_paren_derived: + { + Lex->current_select->set_braces(true); + } + table_value_constructor + { + DBUG_ASSERT(Lex->current_select->braces); + $$= Lex->current_select->master_unit()->first_select(); + } + | + { + Lex->current_select->set_braces(true); + } + SELECT_SYM select_part2_derived + opt_table_expression + opt_order_clause + opt_limit_clause + opt_select_lock_type + { + DBUG_ASSERT(Lex->current_select->braces); + $$= Lex->current_select->master_unit()->first_select(); + } + | '(' select_paren_derived ')' { $$= $2; } + ; + +select_init3: + opt_table_expression + opt_select_lock_type + { + /* Parentheses carry no meaning here */ + Lex->current_select->set_braces(false); + } + union_clause + | select_part3_union_not_ready + opt_select_lock_type + { + /* Parentheses carry no meaning here */ + Lex->current_select->set_braces(false); + } + ; + + +select_init3_union_query_term: + opt_table_expression + opt_select_lock_type + { + /* Parentheses carry no meaning here */ + Lex->current_select->set_braces(false); + } + union_clause + | select_part3_union_not_ready_noproc + opt_select_lock_type + { + /* Parentheses carry no meaning here */ + Lex->current_select->set_braces(false); + } + ; + + +select_init3_view: + opt_table_expression opt_select_lock_type + { + Lex->current_select->set_braces(false); + } + | opt_table_expression opt_select_lock_type + { + Lex->current_select->set_braces(false); + } + union_list_view + | order_or_limit opt_select_lock_type + { + Lex->current_select->set_braces(false); + } + | table_expression order_or_limit opt_select_lock_type + { + Lex->current_select->set_braces(false); + } + ; + +/* + The SELECT parts after select_item_list that cannot be followed by UNION. +*/ + +select_part3: + opt_table_expression + | select_part3_union_not_ready + ; + +select_part3_union_query_term: + opt_table_expression + | select_part3_union_not_ready_noproc + ; + +select_part3_view: + opt_table_expression + | order_or_limit + | table_expression order_or_limit + ; + +select_part3_union_not_ready: + select_part3_union_not_ready_noproc + | table_expression procedure_clause + | table_expression order_or_limit procedure_clause + ; + +select_part3_union_not_ready_noproc: + order_or_limit + | into opt_table_expression opt_order_clause opt_limit_clause + | table_expression into + | table_expression order_or_limit + | table_expression order_or_limit into + ; + +select_options_and_item_list: + { + LEX *lex= Lex; + SELECT_LEX *sel= lex->current_select; + if (sel->linkage != UNION_TYPE) + mysql_init_select(lex); + lex->current_select->parsing_place= SELECT_LIST; + } + select_options select_item_list + { + Select->parsing_place= NO_MATTER; + } + ; + + +/** + <table expression>, as in the SQL standard. +*/ +table_expression: + from_clause + opt_where_clause + opt_group_clause + opt_having_clause + opt_window_clause + ; + +opt_table_expression: + /* Empty */ + | table_expression + ; + +from_clause: + FROM table_reference_list + ; + +table_reference_list: + join_table_list + { + Select->context.table_list= + Select->context.first_name_resolution_table= + Select->table_list.first; + } + | DUAL_SYM + /* oracle compatibility: oracle always requires FROM clause, + and DUAL is system table without fields. + Is "SELECT 1 FROM DUAL" any better than "SELECT 1" ? + Hmmm :) */ + ; + +select_options: + /* empty*/ + | select_option_list + { + if (unlikely((Select->options & SELECT_DISTINCT) && + (Select->options & SELECT_ALL))) + my_yyabort_error((ER_WRONG_USAGE, MYF(0), "ALL", "DISTINCT")); + } + ; + +opt_history_unit: + /* empty*/ %prec PREC_BELOW_IDENTIFIER_OPT_SPECIAL_CASE + { + $$= VERS_UNDEFINED; + } + | TRANSACTION_SYM + { + $$= VERS_TRX_ID; + } + | TIMESTAMP + { + $$= VERS_TIMESTAMP; + } + ; + +history_point: + TIMESTAMP TEXT_STRING + { + Item *item; + if (!(item= create_temporal_literal(thd, $2.str, $2.length, YYCSCL, + MYSQL_TYPE_DATETIME, true))) + MYSQL_YYABORT; + $$= Vers_history_point(VERS_TIMESTAMP, item); + } + | function_call_keyword_timestamp + { + $$= Vers_history_point(VERS_TIMESTAMP, $1); + } + | opt_history_unit bit_expr + { + $$= Vers_history_point($1, $2); + } + ; + +opt_for_system_time_clause: + /* empty */ + { + $$= false; + } + | FOR_SYSTEM_TIME_SYM system_time_expr + { + $$= true; + } + ; + +system_time_expr: + AS OF_SYM history_point + { + Lex->vers_conditions.init(SYSTEM_TIME_AS_OF, $3); + } + | ALL + { + Lex->vers_conditions.init(SYSTEM_TIME_ALL); + } + | FROM history_point TO_SYM history_point + { + Lex->vers_conditions.init(SYSTEM_TIME_FROM_TO, $2, $4); + } + | BETWEEN_SYM history_point AND_SYM history_point + { + Lex->vers_conditions.init(SYSTEM_TIME_BETWEEN, $2, $4); + } + ; + +select_option_list: + select_option_list select_option + | select_option + ; + +select_option: + query_expression_option + | SQL_NO_CACHE_SYM + { + /* + Allow this flag only on the first top-level SELECT statement, if + SQL_CACHE wasn't specified, and only once per query. + */ + if (unlikely(Lex->current_select != &Lex->select_lex)) + my_yyabort_error((ER_CANT_USE_OPTION_HERE, MYF(0), "SQL_NO_CACHE")); + if (unlikely(Lex->select_lex.sql_cache == SELECT_LEX::SQL_CACHE)) + my_yyabort_error((ER_WRONG_USAGE, MYF(0), "SQL_CACHE", "SQL_NO_CACHE")); + if (unlikely(Lex->select_lex.sql_cache == SELECT_LEX::SQL_NO_CACHE)) + my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "SQL_NO_CACHE")); + + Lex->safe_to_cache_query=0; + Lex->select_lex.options&= ~OPTION_TO_QUERY_CACHE; + Lex->select_lex.sql_cache= SELECT_LEX::SQL_NO_CACHE; + } + | SQL_CACHE_SYM + { + /* + Allow this flag only on the first top-level SELECT statement, if + SQL_NO_CACHE wasn't specified, and only once per query. + */ + if (unlikely(Lex->current_select != &Lex->select_lex)) + my_yyabort_error((ER_CANT_USE_OPTION_HERE, MYF(0), "SQL_CACHE")); + if (unlikely(Lex->select_lex.sql_cache == SELECT_LEX::SQL_NO_CACHE)) + my_yyabort_error((ER_WRONG_USAGE, MYF(0), "SQL_NO_CACHE", "SQL_CACHE")); + if (unlikely(Lex->select_lex.sql_cache == SELECT_LEX::SQL_CACHE)) + my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "SQL_CACHE")); + + Lex->safe_to_cache_query=1; + Lex->select_lex.options|= OPTION_TO_QUERY_CACHE; + Lex->select_lex.sql_cache= SELECT_LEX::SQL_CACHE; + } + ; + +opt_select_lock_type: + /* empty */ + | FOR_SYM UPDATE_SYM opt_lock_wait_timeout + { + LEX *lex=Lex; + lex->current_select->lock_type= TL_WRITE; - lex->current_select->set_lock_for_tables(TL_WRITE); ++ lex->current_select->set_lock_for_tables(TL_WRITE, false); + lex->safe_to_cache_query=0; + } + | LOCK_SYM IN_SYM SHARE_SYM MODE_SYM opt_lock_wait_timeout + { + LEX *lex=Lex; + lex->current_select->lock_type= TL_READ_WITH_SHARED_LOCKS; + lex->current_select-> - set_lock_for_tables(TL_READ_WITH_SHARED_LOCKS); ++ set_lock_for_tables(TL_READ_WITH_SHARED_LOCKS, false); + lex->safe_to_cache_query=0; + } + ; + +select_item_list: + select_item_list ',' select_item + | select_item + | '*' + { + Item *item= new (thd->mem_root) + Item_field(thd, &thd->lex->current_select->context, + NULL, NULL, &star_clex_str); + if (unlikely(item == NULL)) + MYSQL_YYABORT; + if (unlikely(add_item_to_list(thd, item))) + MYSQL_YYABORT; + (thd->lex->current_select->with_wild)++; + } + ; + +select_item: + remember_name select_sublist_qualified_asterisk remember_end + { + if (unlikely(add_item_to_list(thd, $2))) + MYSQL_YYABORT; + } + | remember_name expr remember_end select_alias + { + DBUG_ASSERT($1 < $3); + + if (unlikely(add_item_to_list(thd, $2))) + MYSQL_YYABORT; + if ($4.str) + { + if (unlikely(Lex->sql_command == SQLCOM_CREATE_VIEW && + check_column_name($4.str))) + my_yyabort_error((ER_WRONG_COLUMN_NAME, MYF(0), $4.str)); + $2->is_autogenerated_name= FALSE; + $2->set_name(thd, $4.str, $4.length, system_charset_info); + } + else if (!$2->name.str || $2->name.str == item_empty_name) + { + $2->set_name(thd, $1, (uint) ($3 - $1), thd->charset()); + } + } + ; + +remember_tok_start: + { + $$= (char*) YYLIP->get_tok_start(); + } + ; + +remember_tok_end: + { + $$= (char*) YYLIP->get_tok_end(); + } + ; + +remember_name: + { + $$= (char*) YYLIP->get_cpp_tok_start(); + } + ; + +remember_end: + { + $$= (char*) YYLIP->get_cpp_tok_end_rtrim(); + } + ; + +remember_end_opt: + { + if (yychar == YYEMPTY) + $$= (char*) YYLIP->get_cpp_ptr_rtrim(); + else + $$= (char*) YYLIP->get_cpp_tok_end_rtrim(); + } + ; + +select_alias: + /* empty */ { $$=null_clex_str;} + | AS ident { $$=$2; } + | AS TEXT_STRING_sys { $$=$2; } + | ident { $$=$1; } + | TEXT_STRING_sys { $$=$1; } + ; + +opt_default_time_precision: + /* empty */ { $$= NOT_FIXED_DEC; } + | '(' ')' { $$= NOT_FIXED_DEC; } + | '(' real_ulong_num ')' { $$= $2; }; + ; + +opt_time_precision: + /* empty */ { $$= 0; } + | '(' ')' { $$= 0; } + | '(' real_ulong_num ')' { $$= $2; }; + ; + +optional_braces: + /* empty */ {} + | '(' ')' {} + ; + +/* all possible expressions */ +expr: + expr or expr %prec OR_SYM + { + /* + Design notes: + Do not use a manually maintained stack like thd->lex->xxx_list, + but use the internal bison stack ($$, $1 and $3) instead. + Using the bison stack is: + - more robust to changes in the grammar, + - guaranteed to be in sync with the parser state, + - better for performances (no memory allocation). + */ + Item_cond_or *item1; + Item_cond_or *item3; + if (is_cond_or($1)) + { + item1= (Item_cond_or*) $1; + if (is_cond_or($3)) + { + item3= (Item_cond_or*) $3; + /* + (X1 OR X2) OR (Y1 OR Y2) ==> OR (X1, X2, Y1, Y2) + */ + item3->add_at_head(item1->argument_list()); + $$ = $3; + } + else + { + /* + (X1 OR X2) OR Y ==> OR (X1, X2, Y) + */ + item1->add($3, thd->mem_root); + $$ = $1; + } + } + else if (is_cond_or($3)) + { + item3= (Item_cond_or*) $3; + /* + X OR (Y1 OR Y2) ==> OR (X, Y1, Y2) + */ + item3->add_at_head($1, thd->mem_root); + $$ = $3; + } + else + { + /* X OR Y */ + $$= new (thd->mem_root) Item_cond_or(thd, $1, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + } + | expr XOR expr %prec XOR + { + /* XOR is a proprietary extension */ + $$= new (thd->mem_root) Item_func_xor(thd, $1, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | expr and expr %prec AND_SYM + { + /* See comments in rule expr: expr or expr */ + Item_cond_and *item1; + Item_cond_and *item3; + if (is_cond_and($1)) + { + item1= (Item_cond_and*) $1; + if (is_cond_and($3)) + { + item3= (Item_cond_and*) $3; + /* + (X1 AND X2) AND (Y1 AND Y2) ==> AND (X1, X2, Y1, Y2) + */ + item3->add_at_head(item1->argument_list()); + $$ = $3; + } + else + { + /* + (X1 AND X2) AND Y ==> AND (X1, X2, Y) + */ + item1->add($3, thd->mem_root); + $$ = $1; + } + } + else if (is_cond_and($3)) + { + item3= (Item_cond_and*) $3; + /* + X AND (Y1 AND Y2) ==> AND (X, Y1, Y2) + */ + item3->add_at_head($1, thd->mem_root); + $$ = $3; + } + else + { + /* X AND Y */ + $$= new (thd->mem_root) Item_cond_and(thd, $1, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + } + | NOT_SYM expr %prec NOT_SYM + { + $$= negate_expression(thd, $2); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bool_pri IS TRUE_SYM %prec IS + { + $$= new (thd->mem_root) Item_func_istrue(thd, $1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bool_pri IS not TRUE_SYM %prec IS + { + $$= new (thd->mem_root) Item_func_isnottrue(thd, $1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bool_pri IS FALSE_SYM %prec IS + { + $$= new (thd->mem_root) Item_func_isfalse(thd, $1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bool_pri IS not FALSE_SYM %prec IS + { + $$= new (thd->mem_root) Item_func_isnotfalse(thd, $1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bool_pri IS UNKNOWN_SYM %prec IS + { + $$= new (thd->mem_root) Item_func_isnull(thd, $1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bool_pri IS not UNKNOWN_SYM %prec IS + { + $$= new (thd->mem_root) Item_func_isnotnull(thd, $1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bool_pri %prec PREC_BELOW_NOT + ; + +bool_pri: + bool_pri IS NULL_SYM %prec IS + { + $$= new (thd->mem_root) Item_func_isnull(thd, $1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bool_pri IS not NULL_SYM %prec IS + { + $$= new (thd->mem_root) Item_func_isnotnull(thd, $1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bool_pri EQUAL_SYM predicate %prec EQUAL_SYM + { + $$= new (thd->mem_root) Item_func_equal(thd, $1, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bool_pri comp_op predicate %prec '=' + { + $$= (*$2)(0)->create(thd, $1, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bool_pri comp_op all_or_any '(' subselect ')' %prec '=' + { + $$= all_any_subquery_creator(thd, $1, $2, $3, $5); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | predicate + ; + +predicate: + bit_expr IN_SYM '(' subselect ')' + { + $$= new (thd->mem_root) Item_in_subselect(thd, $1, $4); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bit_expr not IN_SYM '(' subselect ')' + { + Item *item= new (thd->mem_root) Item_in_subselect(thd, $1, $5); + if (unlikely(item == NULL)) + MYSQL_YYABORT; + $$= negate_expression(thd, item); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bit_expr IN_SYM '(' expr ')' + { + $$= handle_sql2003_note184_exception(thd, $1, true, $4); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bit_expr IN_SYM '(' expr ',' expr_list ')' + { + $6->push_front($4, thd->mem_root); + $6->push_front($1, thd->mem_root); + $$= new (thd->mem_root) Item_func_in(thd, *$6); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bit_expr not IN_SYM '(' expr ')' + { + $$= handle_sql2003_note184_exception(thd, $1, false, $5); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bit_expr not IN_SYM '(' expr ',' expr_list ')' + { + $7->push_front($5, thd->mem_root); + $7->push_front($1, thd->mem_root); + Item_func_in *item= new (thd->mem_root) Item_func_in(thd, *$7); + if (unlikely(item == NULL)) + MYSQL_YYABORT; + $$= item->neg_transformer(thd); + } + | bit_expr BETWEEN_SYM bit_expr AND_SYM predicate + { + $$= new (thd->mem_root) Item_func_between(thd, $1, $3, $5); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bit_expr not BETWEEN_SYM bit_expr AND_SYM predicate + { + Item_func_between *item; + item= new (thd->mem_root) Item_func_between(thd, $1, $4, $6); + if (unlikely(item == NULL)) + MYSQL_YYABORT; + $$= item->neg_transformer(thd); + } + | bit_expr SOUNDS_SYM LIKE bit_expr + { + Item *item1= new (thd->mem_root) Item_func_soundex(thd, $1); + Item *item4= new (thd->mem_root) Item_func_soundex(thd, $4); + if (unlikely(item1 == NULL) || unlikely(item4 == NULL)) + MYSQL_YYABORT; + $$= new (thd->mem_root) Item_func_eq(thd, item1, item4); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bit_expr LIKE bit_expr opt_escape + { + $$= new (thd->mem_root) Item_func_like(thd, $1, $3, $4, + Lex->escape_used); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bit_expr not LIKE bit_expr opt_escape + { + Item *item= new (thd->mem_root) Item_func_like(thd, $1, $4, $5, + Lex->escape_used); + if (unlikely(item == NULL)) + MYSQL_YYABORT; + $$= item->neg_transformer(thd); + } + | bit_expr REGEXP bit_expr + { + $$= new (thd->mem_root) Item_func_regex(thd, $1, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bit_expr not REGEXP bit_expr + { + Item *item= new (thd->mem_root) Item_func_regex(thd, $1, $4); + if (unlikely(item == NULL)) + MYSQL_YYABORT; + $$= negate_expression(thd, item); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bit_expr %prec PREC_BELOW_NOT + ; + +bit_expr: + bit_expr '|' bit_expr %prec '|' + { + $$= new (thd->mem_root) Item_func_bit_or(thd, $1, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bit_expr '&' bit_expr %prec '&' + { + $$= new (thd->mem_root) Item_func_bit_and(thd, $1, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bit_expr SHIFT_LEFT bit_expr %prec SHIFT_LEFT + { + $$= new (thd->mem_root) Item_func_shift_left(thd, $1, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bit_expr SHIFT_RIGHT bit_expr %prec SHIFT_RIGHT + { + $$= new (thd->mem_root) Item_func_shift_right(thd, $1, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bit_expr ORACLE_CONCAT_SYM bit_expr + { + $$= new (thd->mem_root) Item_func_concat_operator_oracle(thd, + $1, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bit_expr '+' bit_expr %prec '+' + { + $$= new (thd->mem_root) Item_func_plus(thd, $1, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bit_expr '-' bit_expr %prec '-' + { + $$= new (thd->mem_root) Item_func_minus(thd, $1, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bit_expr '+' INTERVAL_SYM expr interval %prec '+' + { + $$= new (thd->mem_root) Item_date_add_interval(thd, $1, $4, $5, 0); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bit_expr '-' INTERVAL_SYM expr interval %prec '-' + { + $$= new (thd->mem_root) Item_date_add_interval(thd, $1, $4, $5, 1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | INTERVAL_SYM expr interval '+' expr + /* we cannot put interval before - */ + { + $$= new (thd->mem_root) Item_date_add_interval(thd, $5, $2, $3, 0); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | '+' INTERVAL_SYM expr interval '+' expr %prec NEG + { + $$= new (thd->mem_root) Item_date_add_interval(thd, $6, $3, $4, 0); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | '-' INTERVAL_SYM expr interval '+' expr %prec NEG + { + $$= new (thd->mem_root) Item_date_add_interval(thd, $6, $3, $4, 1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bit_expr '*' bit_expr %prec '*' + { + $$= new (thd->mem_root) Item_func_mul(thd, $1, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bit_expr '/' bit_expr %prec '/' + { + $$= new (thd->mem_root) Item_func_div(thd, $1, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bit_expr '%' bit_expr %prec '%' + { + $$= new (thd->mem_root) Item_func_mod(thd, $1, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bit_expr DIV_SYM bit_expr %prec DIV_SYM + { + $$= new (thd->mem_root) Item_func_int_div(thd, $1, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bit_expr MOD_SYM bit_expr %prec MOD_SYM + { + $$= new (thd->mem_root) Item_func_mod(thd, $1, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | bit_expr '^' bit_expr + { + $$= new (thd->mem_root) Item_func_bit_xor(thd, $1, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | mysql_concatenation_expr %prec '^' + ; + +or: + OR_SYM + | OR2_SYM + ; + +and: + AND_SYM + | AND_AND_SYM + ; + +not: + NOT_SYM + | NOT2_SYM + ; + +not2: + '!' + | NOT2_SYM + ; + +comp_op: + '=' { $$ = &comp_eq_creator; } + | GE { $$ = &comp_ge_creator; } + | '>' { $$ = &comp_gt_creator; } + | LE { $$ = &comp_le_creator; } + | '<' { $$ = &comp_lt_creator; } + | NE { $$ = &comp_ne_creator; } + ; + +all_or_any: + ALL { $$ = 1; } + | ANY_SYM { $$ = 0; } + ; + +opt_dyncol_type: + /* empty */ + { + $$.set(DYN_COL_NULL); /* automatic type */ + Lex->charset= NULL; + } + | AS dyncol_type { $$= $2; } + ; + +dyncol_type: + numeric_dyncol_type { $$= $1; Lex->charset= NULL; } + | temporal_dyncol_type { $$= $1; Lex->charset= NULL; } + | string_dyncol_type { $$= $1; } + ; + +numeric_dyncol_type: + INT_SYM { $$.set(DYN_COL_INT); } + | UNSIGNED INT_SYM { $$.set(DYN_COL_UINT); } + | DOUBLE_SYM { $$.set(DYN_COL_DOUBLE); } + | REAL { $$.set(DYN_COL_DOUBLE); } + | FLOAT_SYM { $$.set(DYN_COL_DOUBLE); } + | DECIMAL_SYM float_options { $$.set(DYN_COL_DECIMAL, $2); } + ; + +temporal_dyncol_type: + DATE_SYM { $$.set(DYN_COL_DATE); } + | TIME_SYM opt_field_length { $$.set(DYN_COL_TIME, 0, $2); } + | DATETIME opt_field_length { $$.set(DYN_COL_DATETIME, 0, $2); } + ; + +string_dyncol_type: + char + { Lex->charset= thd->variables.collation_connection; } + opt_binary + { + $$.set(DYN_COL_STRING); + } + | nchar + { + $$.set(DYN_COL_STRING); + Lex->charset= national_charset_info; + } + ; + +dyncall_create_element: + expr ',' expr opt_dyncol_type + { + LEX *lex= Lex; + $$= (DYNCALL_CREATE_DEF *) + alloc_root(thd->mem_root, sizeof(DYNCALL_CREATE_DEF)); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + $$->key= $1; + $$->value= $3; + $$->type= (DYNAMIC_COLUMN_TYPE)$4.dyncol_type(); + $$->cs= lex->charset; + if ($4.length()) + $$->len= strtoul($4.length(), NULL, 10); + else + $$->len= 0; + if ($4.dec()) + $$->frac= strtoul($4.dec(), NULL, 10); + else + $$->len= 0; + } + +dyncall_create_list: + dyncall_create_element + { + $$= new (thd->mem_root) List<DYNCALL_CREATE_DEF>; + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + $$->push_back($1, thd->mem_root); + } + | dyncall_create_list ',' dyncall_create_element + { + $1->push_back($3, thd->mem_root); + $$= $1; + } + ; + + +plsql_cursor_attr: + ISOPEN_SYM { $$= PLSQL_CURSOR_ATTR_ISOPEN; } + | FOUND_SYM { $$= PLSQL_CURSOR_ATTR_FOUND; } + | NOTFOUND_SYM { $$= PLSQL_CURSOR_ATTR_NOTFOUND; } + | ROWCOUNT_SYM { $$= PLSQL_CURSOR_ATTR_ROWCOUNT; } + ; + +explicit_cursor_attr: + ident PERCENT_ORACLE_SYM plsql_cursor_attr + { + if (unlikely(!($$= Lex->make_item_plsql_cursor_attr(thd, &$1, $3)))) + MYSQL_YYABORT; + } + ; + + +trim_operands: + expr { $$.set(TRIM_BOTH, $1); } + | LEADING expr FROM expr { $$.set(TRIM_LEADING, $2, $4); } + | TRAILING expr FROM expr { $$.set(TRIM_TRAILING, $2, $4); } + | BOTH expr FROM expr { $$.set(TRIM_BOTH, $2, $4); } + | LEADING FROM expr { $$.set(TRIM_LEADING, $3); } + | TRAILING FROM expr { $$.set(TRIM_TRAILING, $3); } + | BOTH FROM expr { $$.set(TRIM_BOTH, $3); } + | expr FROM expr { $$.set(TRIM_BOTH, $1, $3); } + ; + +/* + Expressions that the parser allows in a column DEFAULT clause + without parentheses. These expressions cannot end with a COLLATE clause. + + If we allowed any "expr" in DEFAULT clause, there would be a confusion + in queries like this: + CREATE TABLE t1 (a TEXT DEFAULT 'a' COLLATE latin1_bin); + It would be not clear what COLLATE stands for: + - the collation of the column `a`, or + - the collation of the string literal 'a' + + This restriction allows to parse the above query unambiguiusly: + COLLATE belongs to the column rather than the literal. + If one needs COLLATE to belong to the literal, parentheses must be used: + CREATE TABLE t1 (a TEXT DEFAULT ('a' COLLATE latin1_bin)); + Note: the COLLATE clause is rather meaningless here, but the query + is syntactically correct. + + Note, some of the expressions are not actually allowed in DEFAULT, + e.g. sum_expr, window_func_expr, ROW(...), VALUES(). + We could move them to simple_expr, but that would make + these two queries return a different error messages: + CREATE TABLE t1 (a INT DEFAULT AVG(1)); + CREATE TABLE t1 (a INT DEFAULT (AVG(1))); + The first query would return "syntax error". + Currenly both return: + Function or expression 'avg(' is not allowed for 'DEFAULT' ... +*/ +column_default_non_parenthesized_expr: + simple_ident + | function_call_keyword + | function_call_nonkeyword + | function_call_generic + | function_call_conflict + | literal + | param_marker { $$= $1; } + | variable + | sum_expr + | window_func_expr + | inverse_distribution_function + | ROW_SYM '(' expr ',' expr_list ')' + { + $5->push_front($3, thd->mem_root); + $$= new (thd->mem_root) Item_row(thd, *$5); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | EXISTS '(' subselect ')' + { + $$= new (thd->mem_root) Item_exists_subselect(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | '{' ident expr '}' + { + if (unlikely(!($$= $3->make_odbc_literal(thd, &$2)))) + MYSQL_YYABORT; + } + | MATCH ident_list_arg AGAINST '(' bit_expr fulltext_options ')' + { + $2->push_front($5, thd->mem_root); + Item_func_match *i1= new (thd->mem_root) Item_func_match(thd, *$2, + $6); + if (unlikely(i1 == NULL)) + MYSQL_YYABORT; + Select->add_ftfunc_to_list(thd, i1); + $$= i1; + } + | CAST_SYM '(' expr AS cast_type ')' + { + if (unlikely(!($$= $5.create_typecast_item(thd, $3, Lex->charset)))) + MYSQL_YYABORT; + } + | CASE_SYM when_list_opt_else END + { + if (unlikely(!($$= new(thd->mem_root) Item_func_case_searched(thd, *$2)))) + MYSQL_YYABORT; + } + | CASE_SYM expr when_list_opt_else END + { + $3->push_front($2, thd->mem_root); + if (unlikely(!($$= new (thd->mem_root) Item_func_case_simple(thd, *$3)))) + MYSQL_YYABORT; + } + | CONVERT_SYM '(' expr ',' cast_type ')' + { + if (unlikely(!($$= $5.create_typecast_item(thd, $3, Lex->charset)))) + MYSQL_YYABORT; + } + | CONVERT_SYM '(' expr USING charset_name ')' + { + $$= new (thd->mem_root) Item_func_conv_charset(thd, $3, $5); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | DEFAULT '(' simple_ident ')' + { + Item_splocal *il= $3->get_item_splocal(); + if (unlikely(il)) + my_yyabort_error((ER_WRONG_COLUMN_NAME, MYF(0), il->my_name()->str)); + $$= new (thd->mem_root) Item_default_value(thd, Lex->current_context(), + $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + Lex->default_used= TRUE; + } + | VALUE_SYM '(' simple_ident_nospvar ')' + { + $$= new (thd->mem_root) Item_insert_value(thd, Lex->current_context(), + $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | NEXT_SYM VALUE_SYM FOR_SYM table_ident + { + if (unlikely(!($$= Lex->create_item_func_nextval(thd, $4)))) + MYSQL_YYABORT; + } + | NEXTVAL_SYM '(' table_ident ')' + { + if (unlikely(!($$= Lex->create_item_func_nextval(thd, $3)))) + MYSQL_YYABORT; + } + | PREVIOUS_SYM VALUE_SYM FOR_SYM table_ident + { + if (unlikely(!($$= Lex->create_item_func_lastval(thd, $4)))) + MYSQL_YYABORT; + } + | LASTVAL_SYM '(' table_ident ')' + { + if (unlikely(!($$= Lex->create_item_func_lastval(thd, $3)))) + MYSQL_YYABORT; + } + | SETVAL_SYM '(' table_ident ',' longlong_num ')' + { + if (unlikely(!($$= Lex->create_item_func_setval(thd, $3, $5, 0, 1)))) + MYSQL_YYABORT; + } + | SETVAL_SYM '(' table_ident ',' longlong_num ',' bool ')' + { + if (unlikely(!($$= Lex->create_item_func_setval(thd, $3, $5, 0, $7)))) + MYSQL_YYABORT; + } + | SETVAL_SYM '(' table_ident ',' longlong_num ',' bool ',' ulonglong_num ')' + { + if (unlikely(!($$= Lex->create_item_func_setval(thd, $3, $5, $9, $7)))) + MYSQL_YYABORT; + } + ; + +primary_expr: + column_default_non_parenthesized_expr + | explicit_cursor_attr + | '(' parenthesized_expr ')' { $$= $2; } + ; + +string_factor_expr: + primary_expr + | string_factor_expr COLLATE_SYM collation_name + { + if (unlikely(!($$= new (thd->mem_root) Item_func_set_collation(thd, $1, $3)))) + MYSQL_YYABORT; + } + ; + +simple_expr: + string_factor_expr %prec NEG + | BINARY simple_expr + { + Type_cast_attributes at(&my_charset_bin); + if (unlikely(!($$= type_handler_long_blob.create_typecast_item(thd, $2, at)))) + MYSQL_YYABORT; + } + | '+' simple_expr %prec NEG + { + $$= $2; + } + | '-' simple_expr %prec NEG + { + $$= $2->neg(thd); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | '~' simple_expr %prec NEG + { + $$= new (thd->mem_root) Item_func_bit_neg(thd, $2); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | not2 simple_expr %prec NEG + { + $$= negate_expression(thd, $2); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + +mysql_concatenation_expr: + simple_expr + | mysql_concatenation_expr MYSQL_CONCAT_SYM simple_expr + { + $$= new (thd->mem_root) Item_func_concat(thd, $1, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + +function_call_keyword_timestamp: + TIMESTAMP '(' expr ')' + { + $$= new (thd->mem_root) Item_datetime_typecast(thd, $3, + AUTO_SEC_PART_DIGITS); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | TIMESTAMP '(' expr ',' expr ')' + { + $$= new (thd->mem_root) Item_func_add_time(thd, $3, $5, 1, 0); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; +/* + Function call syntax using official SQL 2003 keywords. + Because the function name is an official token, + a dedicated grammar rule is needed in the parser. + There is no potential for conflicts +*/ +function_call_keyword: + CHAR_SYM '(' expr_list ')' + { + $$= new (thd->mem_root) Item_func_char(thd, *$3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | CHAR_SYM '(' expr_list USING charset_name ')' + { + $$= new (thd->mem_root) Item_func_char(thd, *$3, $5); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | CURRENT_USER optional_braces + { + $$= new (thd->mem_root) Item_func_current_user(thd, + Lex->current_context()); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION); + Lex->safe_to_cache_query= 0; + } + | CURRENT_ROLE optional_braces + { + $$= new (thd->mem_root) Item_func_current_role(thd, + Lex->current_context()); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION); + Lex->safe_to_cache_query= 0; + } + | DATE_SYM '(' expr ')' + { + $$= new (thd->mem_root) Item_date_typecast(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | DAY_SYM '(' expr ')' + { + $$= new (thd->mem_root) Item_func_dayofmonth(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | HOUR_SYM '(' expr ')' + { + $$= new (thd->mem_root) Item_func_hour(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | INSERT '(' expr ',' expr ',' expr ',' expr ')' + { + $$= new (thd->mem_root) Item_func_insert(thd, $3, $5, $7, $9); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | INTERVAL_SYM '(' expr ',' expr ')' + { + List<Item> *list= new (thd->mem_root) List<Item>; + if (unlikely(list == NULL)) + MYSQL_YYABORT; + if (unlikely(list->push_front($5, thd->mem_root)) || + unlikely(list->push_front($3, thd->mem_root))) + MYSQL_YYABORT; + Item_row *item= new (thd->mem_root) Item_row(thd, *list); + if (unlikely(item == NULL)) + MYSQL_YYABORT; + $$= new (thd->mem_root) Item_func_interval(thd, item); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | INTERVAL_SYM '(' expr ',' expr ',' expr_list ')' + { + $7->push_front($5, thd->mem_root); + $7->push_front($3, thd->mem_root); + Item_row *item= new (thd->mem_root) Item_row(thd, *$7); + if (unlikely(item == NULL)) + MYSQL_YYABORT; + $$= new (thd->mem_root) Item_func_interval(thd, item); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | LEFT '(' expr ',' expr ')' + { + $$= new (thd->mem_root) Item_func_left(thd, $3, $5); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | MINUTE_SYM '(' expr ')' + { + $$= new (thd->mem_root) Item_func_minute(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | MONTH_SYM '(' expr ')' + { + $$= new (thd->mem_root) Item_func_month(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | RIGHT '(' expr ',' expr ')' + { + $$= new (thd->mem_root) Item_func_right(thd, $3, $5); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | SECOND_SYM '(' expr ')' + { + $$= new (thd->mem_root) Item_func_second(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | SQL_SYM PERCENT_ORACLE_SYM ROWCOUNT_SYM + { + $$= new (thd->mem_root) Item_func_oracle_sql_rowcount(thd); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION); + Lex->safe_to_cache_query= 0; + } + | TIME_SYM '(' expr ')' + { + $$= new (thd->mem_root) Item_time_typecast(thd, $3, + AUTO_SEC_PART_DIGITS); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | function_call_keyword_timestamp + { + $$= $1; + } + | TRIM '(' trim_operands ')' + { + if (unlikely(!($$= $3.make_item_func_trim(thd)))) + MYSQL_YYABORT; + } + | USER_SYM '(' ')' + { + $$= new (thd->mem_root) Item_func_user(thd); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION); + Lex->safe_to_cache_query=0; + } + | YEAR_SYM '(' expr ')' + { + $$= new (thd->mem_root) Item_func_year(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + +/* + Function calls using non reserved keywords, with special syntaxic forms. + Dedicated grammar rules are needed because of the syntax, + but also have the potential to cause incompatibilities with other + parts of the language. + MAINTAINER: + The only reasons a function should be added here are: + - for compatibility reasons with another SQL syntax (CURDATE), + - for typing reasons (GET_FORMAT) + Any other 'Syntaxic sugar' enhancements should be *STRONGLY* + discouraged. +*/ +function_call_nonkeyword: + ADDDATE_SYM '(' expr ',' expr ')' + { + $$= new (thd->mem_root) Item_date_add_interval(thd, $3, $5, + INTERVAL_DAY, 0); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | ADDDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')' + { + $$= new (thd->mem_root) Item_date_add_interval(thd, $3, $6, $7, 0); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | CURDATE optional_braces + { + $$= new (thd->mem_root) Item_func_curdate_local(thd); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } + | CURTIME opt_time_precision + { + $$= new (thd->mem_root) Item_func_curtime_local(thd, $2); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } + | DATE_ADD_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')' + { + $$= new (thd->mem_root) Item_date_add_interval(thd, $3, $6, $7, 0); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | DATE_SUB_INTERVAL '(' expr ',' INTERVAL_SYM expr interval ')' + { + $$= new (thd->mem_root) Item_date_add_interval(thd, $3, $6, $7, 1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | DATE_FORMAT_SYM '(' expr ',' expr ')' + { + $$= new (thd->mem_root) Item_func_date_format(thd, $3, $5); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | DATE_FORMAT_SYM '(' expr ',' expr ',' expr ')' + { + $$= new (thd->mem_root) Item_func_date_format(thd, $3, $5, $7); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | DECODE_MARIADB_SYM '(' expr ',' expr ')' + { + $$= new (thd->mem_root) Item_func_decode(thd, $3, $5); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | DECODE_ORACLE_SYM '(' expr ',' decode_when_list_oracle ')' + { + $5->push_front($3, thd->mem_root); + if (unlikely(!($$= new (thd->mem_root) Item_func_decode_oracle(thd, *$5)))) + MYSQL_YYABORT; + } + | EXTRACT_SYM '(' interval FROM expr ')' + { + $$=new (thd->mem_root) Item_extract(thd, $3, $5); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | GET_FORMAT '(' date_time_type ',' expr ')' + { + $$= new (thd->mem_root) Item_func_get_format(thd, $3, $5); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | NOW_SYM opt_time_precision + { + $$= new (thd->mem_root) Item_func_now_local(thd, $2); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } + | POSITION_SYM '(' bit_expr IN_SYM expr ')' + { + $$= new (thd->mem_root) Item_func_locate(thd, $5, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | SUBDATE_SYM '(' expr ',' expr ')' + { + $$= new (thd->mem_root) Item_date_add_interval(thd, $3, $5, + INTERVAL_DAY, 1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | SUBDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')' + { + $$= new (thd->mem_root) Item_date_add_interval(thd, $3, $6, $7, 1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | SUBSTRING '(' expr ',' expr ',' expr ')' + { + if (unlikely(!($$= Lex->make_item_func_substr(thd, $3, $5, $7)))) + MYSQL_YYABORT; + } + | SUBSTRING '(' expr ',' expr ')' + { + if (unlikely(!($$= Lex->make_item_func_substr(thd, $3, $5)))) + MYSQL_YYABORT; + } + | SUBSTRING '(' expr FROM expr FOR_SYM expr ')' + { + if (unlikely(!($$= Lex->make_item_func_substr(thd, $3, $5, $7)))) + MYSQL_YYABORT; + } + | SUBSTRING '(' expr FROM expr ')' + { + if (unlikely(!($$= Lex->make_item_func_substr(thd, $3, $5)))) + MYSQL_YYABORT; + } + | SYSDATE opt_time_precision + { + /* + Unlike other time-related functions, SYSDATE() is + replication-unsafe because it is not affected by the + TIMESTAMP variable. It is unsafe even if + sysdate_is_now=1, because the slave may have + sysdate_is_now=0. + */ + Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION); + if (global_system_variables.sysdate_is_now == 0) + $$= new (thd->mem_root) Item_func_sysdate_local(thd, $2); + else + $$= new (thd->mem_root) Item_func_now_local(thd, $2); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } + | TIMESTAMP_ADD '(' interval_time_stamp ',' expr ',' expr ')' + { + $$= new (thd->mem_root) Item_date_add_interval(thd, $7, $5, $3, 0); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | TIMESTAMP_DIFF '(' interval_time_stamp ',' expr ',' expr ')' + { + $$= new (thd->mem_root) Item_func_timestamp_diff(thd, $5, $7, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | TRIM_ORACLE '(' trim_operands ')' + { + if (unlikely(!($$= $3.make_item_func_trim_oracle(thd)))) + MYSQL_YYABORT; + } + | UTC_DATE_SYM optional_braces + { + $$= new (thd->mem_root) Item_func_curdate_utc(thd); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } + | UTC_TIME_SYM opt_time_precision + { + $$= new (thd->mem_root) Item_func_curtime_utc(thd, $2); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } + | UTC_TIMESTAMP_SYM opt_time_precision + { + $$= new (thd->mem_root) Item_func_now_utc(thd, $2); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } + | + COLUMN_ADD_SYM '(' expr ',' dyncall_create_list ')' + { + $$= create_func_dyncol_add(thd, $3, *$5); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | + COLUMN_DELETE_SYM '(' expr ',' expr_list ')' + { + $$= create_func_dyncol_delete(thd, $3, *$5); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | + COLUMN_CHECK_SYM '(' expr ')' + { + $$= new (thd->mem_root) Item_func_dyncol_check(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | + COLUMN_CREATE_SYM '(' dyncall_create_list ')' + { + $$= create_func_dyncol_create(thd, *$3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | + COLUMN_GET_SYM '(' expr ',' expr AS cast_type ')' + { + LEX *lex= Lex; + $$= create_func_dyncol_get(thd, $3, $5, $7.type_handler(), + $7.length(), $7.dec(), + lex->charset); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + +/* + Functions calls using a non reserved keyword, and using a regular syntax. + Because the non reserved keyword is used in another part of the grammar, + a dedicated rule is needed here. +*/ +function_call_conflict: + ASCII_SYM '(' expr ')' + { + $$= new (thd->mem_root) Item_func_ascii(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | CHARSET '(' expr ')' + { + $$= new (thd->mem_root) Item_func_charset(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | COALESCE '(' expr_list ')' + { + $$= new (thd->mem_root) Item_func_coalesce(thd, *$3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | COLLATION_SYM '(' expr ')' + { + $$= new (thd->mem_root) Item_func_collation(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | DATABASE '(' ')' + { + $$= new (thd->mem_root) Item_func_database(thd); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + Lex->safe_to_cache_query=0; + } + | IF_SYM '(' expr ',' expr ',' expr ')' + { + $$= new (thd->mem_root) Item_func_if(thd, $3, $5, $7); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | FORMAT_SYM '(' expr ',' expr ')' + { + $$= new (thd->mem_root) Item_func_format(thd, $3, $5); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | FORMAT_SYM '(' expr ',' expr ',' expr ')' + { + $$= new (thd->mem_root) Item_func_format(thd, $3, $5, $7); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + /* LAST_VALUE here conflicts with the definition for window functions. + We have these 2 separate rules to remove the shift/reduce conflict. + */ + | LAST_VALUE '(' expr ')' + { + List<Item> *list= new (thd->mem_root) List<Item>; + if (unlikely(list == NULL)) + MYSQL_YYABORT; + list->push_back($3, thd->mem_root); + + $$= new (thd->mem_root) Item_func_last_value(thd, *list); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | LAST_VALUE '(' expr_list ',' expr ')' + { + $3->push_back($5, thd->mem_root); + $$= new (thd->mem_root) Item_func_last_value(thd, *$3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | MICROSECOND_SYM '(' expr ')' + { + $$= new (thd->mem_root) Item_func_microsecond(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | MOD_SYM '(' expr ',' expr ')' + { + $$= new (thd->mem_root) Item_func_mod(thd, $3, $5); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | OLD_PASSWORD_SYM '(' expr ')' + { + $$= new (thd->mem_root) + Item_func_password(thd, $3, Item_func_password::OLD); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | PASSWORD_SYM '(' expr ')' + { + Item* i1; + i1= new (thd->mem_root) Item_func_password(thd, $3); + if (unlikely(i1 == NULL)) + MYSQL_YYABORT; + $$= i1; + } + | QUARTER_SYM '(' expr ')' + { + $$= new (thd->mem_root) Item_func_quarter(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | REPEAT_SYM '(' expr ',' expr ')' + { + $$= new (thd->mem_root) Item_func_repeat(thd, $3, $5); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | REPLACE '(' expr ',' expr ',' expr ')' + { + if (unlikely(!($$= Lex->make_item_func_replace(thd, $3, $5, $7)))) + MYSQL_YYABORT; + } + | REVERSE_SYM '(' expr ')' + { + $$= new (thd->mem_root) Item_func_reverse(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | ROW_COUNT_SYM '(' ')' + { + $$= new (thd->mem_root) Item_func_row_count(thd); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION); + Lex->safe_to_cache_query= 0; + } + | TRUNCATE_SYM '(' expr ',' expr ')' + { + $$= new (thd->mem_root) Item_func_round(thd, $3, $5, 1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | WEEK_SYM '(' expr ')' + { + $$= new (thd->mem_root) Item_func_week(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | WEEK_SYM '(' expr ',' expr ')' + { + $$= new (thd->mem_root) Item_func_week(thd, $3, $5); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | WEIGHT_STRING_SYM '(' expr opt_ws_levels ')' + { + $$= new (thd->mem_root) Item_func_weight_string(thd, $3, 0, 0, $4); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | WEIGHT_STRING_SYM '(' expr AS CHAR_SYM ws_nweights opt_ws_levels ')' + { + $$= new (thd->mem_root) + Item_func_weight_string(thd, $3, 0, $6, + $7 | MY_STRXFRM_PAD_WITH_SPACE); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | WEIGHT_STRING_SYM '(' expr AS BINARY ws_nweights ')' + { + Item *item= new (thd->mem_root) Item_char_typecast(thd, $3, $6, + &my_charset_bin); + if (unlikely(item == NULL)) + MYSQL_YYABORT; + $$= new (thd->mem_root) + Item_func_weight_string(thd, item, 0, $6, + MY_STRXFRM_PAD_WITH_SPACE); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | WEIGHT_STRING_SYM '(' expr ',' ulong_num ',' ulong_num ',' ulong_num ')' + { + $$= new (thd->mem_root) Item_func_weight_string(thd, $3, $5, $7, + $9); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | geometry_function + { +#ifdef HAVE_SPATIAL + $$= $1; + /* $1 may be NULL, GEOM_NEW not tested for out of memory */ + if (unlikely($$ == NULL)) + MYSQL_YYABORT; +#else + my_yyabort_error((ER_FEATURE_DISABLED, MYF(0), sym_group_geom.name, + sym_group_geom.needed_define)); +#endif + } + ; + +geometry_function: + CONTAINS_SYM '(' expr ',' expr ')' + { + $$= GEOM_NEW(thd, + Item_func_spatial_precise_rel(thd, $3, $5, + Item_func::SP_CONTAINS_FUNC)); + } + | GEOMETRYCOLLECTION '(' expr_list ')' + { + $$= GEOM_NEW(thd, + Item_func_spatial_collection(thd, *$3, + Geometry::wkb_geometrycollection, + Geometry::wkb_point)); + } + | LINESTRING '(' expr_list ')' + { + $$= GEOM_NEW(thd, + Item_func_spatial_collection(thd, *$3, + Geometry::wkb_linestring, + Geometry::wkb_point)); + } + | MULTILINESTRING '(' expr_list ')' + { + $$= GEOM_NEW(thd, + Item_func_spatial_collection(thd, *$3, + Geometry::wkb_multilinestring, + Geometry::wkb_linestring)); + } + | MULTIPOINT '(' expr_list ')' + { + $$= GEOM_NEW(thd, + Item_func_spatial_collection(thd, *$3, + Geometry::wkb_multipoint, + Geometry::wkb_point)); + } + | MULTIPOLYGON '(' expr_list ')' + { + $$= GEOM_NEW(thd, + Item_func_spatial_collection(thd, *$3, + Geometry::wkb_multipolygon, + Geometry::wkb_polygon)); + } + | POINT_SYM '(' expr ',' expr ')' + { + $$= GEOM_NEW(thd, Item_func_point(thd, $3, $5)); + } + | POLYGON '(' expr_list ')' + { + $$= GEOM_NEW(thd, + Item_func_spatial_collection(thd, *$3, + Geometry::wkb_polygon, + Geometry::wkb_linestring)); + } + | WITHIN '(' expr ',' expr ')' + { + $$= GEOM_NEW(thd, Item_func_spatial_precise_rel(thd, $3, $5, + Item_func::SP_WITHIN_FUNC)); + } + ; + +/* + Regular function calls. + The function name is *not* a token, and therefore is guaranteed to not + introduce side effects to the language in general. + MAINTAINER: + All the new functions implemented for new features should fit into + this category. The place to implement the function itself is + in sql/item_create.cc +*/ +function_call_generic: + IDENT_sys '(' + { +#ifdef HAVE_DLOPEN + udf_func *udf= 0; + LEX *lex= Lex; + if (using_udf_functions && + (udf= find_udf($1.str, $1.length)) && + udf->type == UDFTYPE_AGGREGATE) + { + if (unlikely(lex->current_select->inc_in_sum_expr())) + { + thd->parse_error(); + MYSQL_YYABORT; + } + } + /* Temporary placing the result of find_udf in $3 */ + $<udf>$= udf; +#endif + } + opt_udf_expr_list ')' + { + Create_func *builder; + Item *item= NULL; + + if (unlikely(check_routine_name(&$1))) + MYSQL_YYABORT; + + /* + Implementation note: + names are resolved with the following order: + - MySQL native functions, + - User Defined Functions, + - Stored Functions (assuming the current <use> database) + + This will be revised with WL#2128 (SQL PATH) + */ + builder= find_native_function_builder(thd, &$1); + if (builder) + { + item= builder->create_func(thd, &$1, $4); + } + else + { +#ifdef HAVE_DLOPEN + /* Retrieving the result of find_udf */ + udf_func *udf= $<udf>3; + + if (udf) + { + if (udf->type == UDFTYPE_AGGREGATE) + { + Select->in_sum_expr--; + } + + item= Create_udf_func::s_singleton.create(thd, udf, $4); + } + else +#endif + { + builder= find_qualified_function_builder(thd); + DBUG_ASSERT(builder); + item= builder->create_func(thd, &$1, $4); + } + } + + if (unlikely(! ($$= item))) + MYSQL_YYABORT; + } + | ident_cli '.' ident_cli '(' opt_expr_list ')' + { + if (unlikely(!($$= Lex->make_item_func_call_generic(thd, &$1, &$3, $5)))) + MYSQL_YYABORT; + } + ; + +fulltext_options: + opt_natural_language_mode opt_query_expansion + { $$= $1 | $2; } + | IN_SYM BOOLEAN_SYM MODE_SYM + { $$= FT_BOOL; } + ; + +opt_natural_language_mode: + /* nothing */ { $$= FT_NL; } + | IN_SYM NATURAL LANGUAGE_SYM MODE_SYM { $$= FT_NL; } + ; + +opt_query_expansion: + /* nothing */ { $$= 0; } + | WITH QUERY_SYM EXPANSION_SYM { $$= FT_EXPAND; } + ; + +opt_udf_expr_list: + /* empty */ { $$= NULL; } + | udf_expr_list { $$= $1; } + ; + +udf_expr_list: + udf_expr + { + $$= new (thd->mem_root) List<Item>; + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + $$->push_back($1, thd->mem_root); + } + | udf_expr_list ',' udf_expr + { + $1->push_back($3, thd->mem_root); + $$= $1; + } + ; + +udf_expr: + remember_name expr remember_end select_alias + { + /* + Use Item::name as a storage for the attribute value of user + defined function argument. It is safe to use Item::name + because the syntax will not allow having an explicit name here. + See WL#1017 re. udf attributes. + */ + if ($4.str) + { + $2->is_autogenerated_name= FALSE; + $2->set_name(thd, $4.str, $4.length, system_charset_info); + } + /* + A field has to have its proper name in order for name + resolution to work, something we are only guaranteed if we + parse it out. If we hijack the input stream with + remember_name we may get quoted or escaped names. + */ + else if ($2->type() != Item::FIELD_ITEM && + $2->type() != Item::REF_ITEM /* For HAVING */ ) + $2->set_name(thd, $1, (uint) ($3 - $1), thd->charset()); + $$= $2; + } + ; + +sum_expr: + AVG_SYM '(' in_sum_expr ')' + { + $$= new (thd->mem_root) Item_sum_avg(thd, $3, FALSE); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | AVG_SYM '(' DISTINCT in_sum_expr ')' + { + $$= new (thd->mem_root) Item_sum_avg(thd, $4, TRUE); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | BIT_AND '(' in_sum_expr ')' + { + $$= new (thd->mem_root) Item_sum_and(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | BIT_OR '(' in_sum_expr ')' + { + $$= new (thd->mem_root) Item_sum_or(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | BIT_XOR '(' in_sum_expr ')' + { + $$= new (thd->mem_root) Item_sum_xor(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | COUNT_SYM '(' opt_all '*' ')' + { + Item *item= new (thd->mem_root) Item_int(thd, (int32) 0L, 1); + if (unlikely(item == NULL)) + MYSQL_YYABORT; + $$= new (thd->mem_root) Item_sum_count(thd, item); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | COUNT_SYM '(' in_sum_expr ')' + { + $$= new (thd->mem_root) Item_sum_count(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | COUNT_SYM '(' DISTINCT + { Select->in_sum_expr++; } + expr_list + { Select->in_sum_expr--; } + ')' + { + $$= new (thd->mem_root) Item_sum_count(thd, *$5); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | MIN_SYM '(' in_sum_expr ')' + { + $$= new (thd->mem_root) Item_sum_min(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + /* + According to ANSI SQL, DISTINCT is allowed and has + no sense inside MIN and MAX grouping functions; so MIN|MAX(DISTINCT ...) + is processed like an ordinary MIN | MAX() + */ + | MIN_SYM '(' DISTINCT in_sum_expr ')' + { + $$= new (thd->mem_root) Item_sum_min(thd, $4); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | MAX_SYM '(' in_sum_expr ')' + { + $$= new (thd->mem_root) Item_sum_max(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | MAX_SYM '(' DISTINCT in_sum_expr ')' + { + $$= new (thd->mem_root) Item_sum_max(thd, $4); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | STD_SYM '(' in_sum_expr ')' + { + $$= new (thd->mem_root) Item_sum_std(thd, $3, 0); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | VARIANCE_SYM '(' in_sum_expr ')' + { + $$= new (thd->mem_root) Item_sum_variance(thd, $3, 0); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | STDDEV_SAMP_SYM '(' in_sum_expr ')' + { + $$= new (thd->mem_root) Item_sum_std(thd, $3, 1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | VAR_SAMP_SYM '(' in_sum_expr ')' + { + $$= new (thd->mem_root) Item_sum_variance(thd, $3, 1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | SUM_SYM '(' in_sum_expr ')' + { + $$= new (thd->mem_root) Item_sum_sum(thd, $3, FALSE); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | SUM_SYM '(' DISTINCT in_sum_expr ')' + { + $$= new (thd->mem_root) Item_sum_sum(thd, $4, TRUE); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | GROUP_CONCAT_SYM '(' opt_distinct + { Select->in_sum_expr++; } + expr_list opt_gorder_clause + opt_gconcat_separator opt_glimit_clause + ')' + { + SELECT_LEX *sel= Select; + sel->in_sum_expr--; + $$= new (thd->mem_root) + Item_func_group_concat(thd, Lex->current_context(), + $3, $5, + sel->gorder_list, $7, $8, + sel->select_limit, + sel->offset_limit); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + sel->select_limit= NULL; + sel->offset_limit= NULL; + sel->explicit_limit= 0; + $5->empty(); + sel->gorder_list.empty(); + } + ; + +window_func_expr: + window_func OVER_SYM window_name + { + $$= new (thd->mem_root) Item_window_func(thd, (Item_sum *) $1, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + if (unlikely(Select->add_window_func((Item_window_func *) $$))) + MYSQL_YYABORT; + } + | + window_func OVER_SYM window_spec + { + LEX *lex= Lex; + if (unlikely(Select->add_window_spec(thd, lex->win_ref, + Select->group_list, + Select->order_list, + lex->win_frame))) + MYSQL_YYABORT; + $$= new (thd->mem_root) Item_window_func(thd, (Item_sum *) $1, + thd->lex->win_spec); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + if (unlikely(Select->add_window_func((Item_window_func *) $$))) + MYSQL_YYABORT; + } + ; + +window_func: + simple_window_func + | + sum_expr + { + ((Item_sum *) $1)->mark_as_window_func_sum_expr(); + } + ; + +simple_window_func: + ROW_NUMBER_SYM '(' ')' + { + $$= new (thd->mem_root) Item_sum_row_number(thd); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | + RANK_SYM '(' ')' + { + $$= new (thd->mem_root) Item_sum_rank(thd); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | + DENSE_RANK_SYM '(' ')' + { + $$= new (thd->mem_root) Item_sum_dense_rank(thd); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | + PERCENT_RANK_SYM '(' ')' + { + $$= new (thd->mem_root) Item_sum_percent_rank(thd); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | + CUME_DIST_SYM '(' ')' + { + $$= new (thd->mem_root) Item_sum_cume_dist(thd); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | + NTILE_SYM '(' expr ')' + { + $$= new (thd->mem_root) Item_sum_ntile(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | + FIRST_VALUE_SYM '(' expr ')' + { + $$= new (thd->mem_root) Item_sum_first_value(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | + LAST_VALUE '(' expr ')' + { + $$= new (thd->mem_root) Item_sum_last_value(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | + NTH_VALUE_SYM '(' expr ',' expr ')' + { + $$= new (thd->mem_root) Item_sum_nth_value(thd, $3, $5); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | + LEAD_SYM '(' expr ')' + { + /* No second argument defaults to 1. */ + Item* item_offset= new (thd->mem_root) Item_uint(thd, 1); + if (unlikely(item_offset == NULL)) + MYSQL_YYABORT; + $$= new (thd->mem_root) Item_sum_lead(thd, $3, item_offset); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | + LEAD_SYM '(' expr ',' expr ')' + { + $$= new (thd->mem_root) Item_sum_lead(thd, $3, $5); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | + LAG_SYM '(' expr ')' + { + /* No second argument defaults to 1. */ + Item* item_offset= new (thd->mem_root) Item_uint(thd, 1); + if (unlikely(item_offset == NULL)) + MYSQL_YYABORT; + $$= new (thd->mem_root) Item_sum_lag(thd, $3, item_offset); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | + LAG_SYM '(' expr ',' expr ')' + { + $$= new (thd->mem_root) Item_sum_lag(thd, $3, $5); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + + + +inverse_distribution_function: + percentile_function OVER_SYM + '(' opt_window_partition_clause ')' + { + LEX *lex= Lex; + if (unlikely(Select->add_window_spec(thd, lex->win_ref, + Select->group_list, + Select->order_list, + NULL))) + MYSQL_YYABORT; + $$= new (thd->mem_root) Item_window_func(thd, (Item_sum *) $1, + thd->lex->win_spec); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + if (unlikely(Select->add_window_func((Item_window_func *) $$))) + MYSQL_YYABORT; + } + ; + +percentile_function: + inverse_distribution_function_def WITHIN GROUP_SYM '(' + { Select->prepare_add_window_spec(thd); } + order_by_single_element_list ')' + { + $$= $1; + } + | MEDIAN_SYM '(' expr ')' + { + Item *args= new (thd->mem_root) Item_decimal(thd, "0.5", 3, + thd->charset()); + if (unlikely(args == NULL) || unlikely(thd->is_error())) + MYSQL_YYABORT; + Select->prepare_add_window_spec(thd); + if (unlikely(add_order_to_list(thd, $3,FALSE))) + MYSQL_YYABORT; + + $$= new (thd->mem_root) Item_sum_percentile_cont(thd, args); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + +inverse_distribution_function_def: + PERCENTILE_CONT_SYM '(' expr ')' + { + $$= new (thd->mem_root) Item_sum_percentile_cont(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | PERCENTILE_DISC_SYM '(' expr ')' + { + $$= new (thd->mem_root) Item_sum_percentile_disc(thd, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + +order_by_single_element_list: + ORDER_SYM BY order_ident order_dir + { + if (unlikely(add_order_to_list(thd, $3,(bool) $4))) + MYSQL_YYABORT; + } + ; + + +window_name: + ident + { + $$= (LEX_CSTRING *) thd->memdup(&$1, sizeof(LEX_CSTRING)); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + +variable: + '@' + { + if (unlikely(! Lex->parsing_options.allows_variable)) + my_yyabort_error((ER_VIEW_SELECT_VARIABLE, MYF(0))); + } + variable_aux + { + $$= $3; + } + ; + +variable_aux: + ident_or_text SET_VAR expr + { + Item_func_set_user_var *item; + $$= item= new (thd->mem_root) Item_func_set_user_var(thd, &$1, $3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + LEX *lex= Lex; + lex->uncacheable(UNCACHEABLE_SIDEEFFECT); + lex->set_var_list.push_back(item, thd->mem_root); + } + | ident_or_text + { + $$= new (thd->mem_root) Item_func_get_user_var(thd, &$1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + LEX *lex= Lex; + lex->uncacheable(UNCACHEABLE_SIDEEFFECT); + } + | '@' opt_var_ident_type ident_sysvar_name + { + if (unlikely(!($$= Lex->make_item_sysvar(thd, $2, &$3)))) + MYSQL_YYABORT; + } + | '@' opt_var_ident_type ident_sysvar_name '.' ident + { + if (unlikely(!($$= Lex->make_item_sysvar(thd, $2, &$3, &$5)))) + MYSQL_YYABORT; + } + ; + +opt_distinct: + /* empty */ { $$ = 0; } + | DISTINCT { $$ = 1; } + ; + +opt_gconcat_separator: + /* empty */ + { + $$= new (thd->mem_root) String(",", 1, &my_charset_latin1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | SEPARATOR_SYM text_string { $$ = $2; } + ; + +opt_gorder_clause: + /* empty */ + | ORDER_SYM BY gorder_list; + ; + +gorder_list: + gorder_list ',' order_ident order_dir + { + if (unlikely(add_gorder_to_list(thd, $3,(bool) $4))) + MYSQL_YYABORT; + } + | order_ident order_dir + { + if (unlikely(add_gorder_to_list(thd, $1,(bool) $2))) + MYSQL_YYABORT; + } + ; + +opt_glimit_clause: + /* empty */ { $$ = 0; } + | glimit_clause { $$ = 1; } + ; + +glimit_clause_init: + LIMIT{} + ; + +glimit_clause: + glimit_clause_init glimit_options + { + Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_LIMIT); + } + ; + +glimit_options: + limit_option + { + SELECT_LEX *sel= Select; + sel->select_limit= $1; + sel->offset_limit= 0; + sel->explicit_limit= 1; + } + | limit_option ',' limit_option + { + SELECT_LEX *sel= Select; + sel->select_limit= $3; + sel->offset_limit= $1; + sel->explicit_limit= 1; + } + | limit_option OFFSET_SYM limit_option + { + SELECT_LEX *sel= Select; + sel->select_limit= $1; + sel->offset_limit= $3; + sel->explicit_limit= 1; + } + ; + + + +in_sum_expr: + opt_all + { + LEX *lex= Lex; + if (unlikely(lex->current_select->inc_in_sum_expr())) + { + thd->parse_error(); + MYSQL_YYABORT; + } + } + expr + { + Select->in_sum_expr--; + $$= $3; + } + ; + +cast_type: + BINARY opt_field_length + { $$.set(&type_handler_long_blob, $2); Lex->charset= &my_charset_bin; } + | CHAR_SYM opt_field_length + { Lex->charset= thd->variables.collation_connection; } + opt_binary + { $$.set(&type_handler_long_blob, $2); } + | VARCHAR field_length + { Lex->charset= thd->variables.collation_connection; } + opt_binary + { $$.set(&type_handler_long_blob, $2); } + | VARCHAR2_ORACLE_SYM field_length + { Lex->charset= thd->variables.collation_connection; } + opt_binary + { $$.set(&type_handler_long_blob, $2); } + | NCHAR_SYM opt_field_length + { + Lex->charset= national_charset_info; + $$.set(&type_handler_long_blob, $2, 0); + } + | cast_type_numeric { $$= $1; Lex->charset= NULL; } + | cast_type_temporal { $$= $1; Lex->charset= NULL; } + ; + +cast_type_numeric: + INT_SYM { $$.set(&type_handler_longlong); } + | SIGNED_SYM { $$.set(&type_handler_longlong); } + | SIGNED_SYM INT_SYM { $$.set(&type_handler_longlong); } + | UNSIGNED { $$.set(&type_handler_ulonglong); } + | UNSIGNED INT_SYM { $$.set(&type_handler_ulonglong); } + | DECIMAL_SYM float_options { $$.set(&type_handler_newdecimal, $2); } + | DOUBLE_SYM opt_precision { $$.set(&type_handler_double, $2); } + ; + +cast_type_temporal: + DATE_SYM { $$.set(&type_handler_newdate); } + | TIME_SYM opt_field_length { $$.set(&type_handler_time2, 0, $2); } + | DATETIME opt_field_length { $$.set(&type_handler_datetime2, 0, $2); } + ; + +opt_expr_list: + /* empty */ { $$= NULL; } + | expr_list { $$= $1;} + ; + +expr_list: + expr + { + $$= new (thd->mem_root) List<Item>; + if (unlikely($$ == NULL) || + unlikely($$->push_back($1, thd->mem_root))) + MYSQL_YYABORT; + } + | expr_list ',' expr + { + $1->push_back($3, thd->mem_root); + $$= $1; + } + ; + +ident_list_arg: + ident_list { $$= $1; } + | '(' ident_list ')' { $$= $2; } + ; + +ident_list: + simple_ident + { + $$= new (thd->mem_root) List<Item>; + if (unlikely($$ == NULL) || + unlikely($$->push_back($1, thd->mem_root))) + MYSQL_YYABORT; + } + | ident_list ',' simple_ident + { + $1->push_back($3, thd->mem_root); + $$= $1; + } + ; + +when_list: + WHEN_SYM expr THEN_SYM expr + { + $$= new (thd->mem_root) List<Item>; + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + if (unlikely($$->push_back($2, thd->mem_root) || + $$->push_back($4, thd->mem_root))) + MYSQL_YYABORT; + } + | when_list WHEN_SYM expr THEN_SYM expr + { + if (unlikely($1->push_back($3, thd->mem_root) || + $1->push_back($5, thd->mem_root))) + MYSQL_YYABORT; + $$= $1; + } + ; + +when_list_opt_else: + when_list + | when_list ELSE expr + { + if (unlikely($1->push_back($3, thd->mem_root))) + MYSQL_YYABORT; + $$= $1; + } + ; + +decode_when_list_oracle: + expr ',' expr + { + $$= new (thd->mem_root) List<Item>; + if (unlikely($$ == NULL) || + unlikely($$->push_back($1, thd->mem_root)) || + unlikely($$->push_back($3, thd->mem_root))) + MYSQL_YYABORT; + + } + | decode_when_list_oracle ',' expr + { + $$= $1; + if (unlikely($$->push_back($3, thd->mem_root))) + MYSQL_YYABORT; + } + ; + + +/* Equivalent to <table reference> in the SQL:2003 standard. */ +/* Warning - may return NULL in case of incomplete SELECT */ +table_ref: + table_factor { $$= $1; } + | join_table + { + LEX *lex= Lex; + if (unlikely(!($$= lex->current_select->nest_last_join(thd)))) + { + thd->parse_error(); + MYSQL_YYABORT; + } + } + ; + +join_table_list: + derived_table_list { MYSQL_YYABORT_UNLESS($$=$1); } + ; + +/* + The ODBC escape syntax for Outer Join is: '{' OJ join_table '}' + The parser does not define OJ as a token, any ident is accepted + instead in $2 (ident). Also, all productions from table_ref can + be escaped, not only join_table. Both syntax extensions are safe + and are ignored. +*/ +esc_table_ref: + table_ref { $$=$1; } + | '{' ident table_ref '}' { $$=$3; } + ; + +/* Equivalent to <table reference list> in the SQL:2003 standard. */ +/* Warning - may return NULL in case of incomplete SELECT */ +derived_table_list: + esc_table_ref { $$=$1; } + | derived_table_list ',' esc_table_ref + { + MYSQL_YYABORT_UNLESS($1 && ($$=$3)); + } + ; + +/* + Notice that JOIN is a left-associative operation, and it must be parsed + as such, that is, the parser must process first the left join operand + then the right one. Such order of processing ensures that the parser + produces correct join trees which is essential for semantic analysis + and subsequent optimization phases. +*/ +join_table: + /* INNER JOIN variants */ + /* + Use %prec to evaluate production 'table_ref' before 'normal_join' + so that [INNER | CROSS] JOIN is properly nested as other + left-associative joins. + */ + table_ref normal_join table_ref %prec TABLE_REF_PRIORITY + { MYSQL_YYABORT_UNLESS($1 && ($$=$3)); $3->straight=$2; } + | table_ref normal_join table_ref + ON + { + MYSQL_YYABORT_UNLESS($1 && $3); + /* Change the current name resolution context to a local context. */ + if (unlikely(push_new_name_resolution_context(thd, $1, $3))) + MYSQL_YYABORT; + Select->parsing_place= IN_ON; + } + expr + { + $3->straight=$2; + add_join_on(thd, $3, $6); + Lex->pop_context(); + Select->parsing_place= NO_MATTER; + } + | table_ref normal_join table_ref + USING + { + MYSQL_YYABORT_UNLESS($1 && $3); + } + '(' using_list ')' + { + $3->straight=$2; + add_join_natural($1,$3,$7,Select); + $$=$3; + } + | table_ref NATURAL inner_join table_factor + { + MYSQL_YYABORT_UNLESS($1 && ($$=$4)); + $4->straight=$3; + add_join_natural($1,$4,NULL,Select); + } + + /* LEFT JOIN variants */ + | table_ref LEFT opt_outer JOIN_SYM table_ref + ON + { + MYSQL_YYABORT_UNLESS($1 && $5); + /* Change the current name resolution context to a local context. */ + if (unlikely(push_new_name_resolution_context(thd, $1, $5))) + MYSQL_YYABORT; + Select->parsing_place= IN_ON; + } + expr + { + add_join_on(thd, $5, $8); + Lex->pop_context(); + $5->outer_join|=JOIN_TYPE_LEFT; + $$=$5; + Select->parsing_place= NO_MATTER; + } + | table_ref LEFT opt_outer JOIN_SYM table_factor + { + MYSQL_YYABORT_UNLESS($1 && $5); + } + USING '(' using_list ')' + { + add_join_natural($1,$5,$9,Select); + $5->outer_join|=JOIN_TYPE_LEFT; + $$=$5; + } + | table_ref NATURAL LEFT opt_outer JOIN_SYM table_factor + { + MYSQL_YYABORT_UNLESS($1 && $6); + add_join_natural($1,$6,NULL,Select); + $6->outer_join|=JOIN_TYPE_LEFT; + $$=$6; + } + + /* RIGHT JOIN variants */ + | table_ref RIGHT opt_outer JOIN_SYM table_ref + ON + { + MYSQL_YYABORT_UNLESS($1 && $5); + /* Change the current name resolution context to a local context. */ + if (unlikely(push_new_name_resolution_context(thd, $1, $5))) + MYSQL_YYABORT; + Select->parsing_place= IN_ON; + } + expr + { + LEX *lex= Lex; + if (unlikely(!($$= lex->current_select->convert_right_join()))) + MYSQL_YYABORT; + add_join_on(thd, $$, $8); + Lex->pop_context(); + Select->parsing_place= NO_MATTER; + } + | table_ref RIGHT opt_outer JOIN_SYM table_factor + { + MYSQL_YYABORT_UNLESS($1 && $5); + } + USING '(' using_list ')' + { + LEX *lex= Lex; + if (unlikely(!($$= lex->current_select->convert_right_join()))) + MYSQL_YYABORT; + add_join_natural($$,$5,$9,Select); + } + | table_ref NATURAL RIGHT opt_outer JOIN_SYM table_factor + { + MYSQL_YYABORT_UNLESS($1 && $6); + add_join_natural($6,$1,NULL,Select); + LEX *lex= Lex; + if (unlikely(!($$= lex->current_select->convert_right_join()))) + MYSQL_YYABORT; + } + ; + + +inner_join: /* $$ set if using STRAIGHT_JOIN, false otherwise */ + JOIN_SYM { $$ = 0; } + | INNER_SYM JOIN_SYM { $$ = 0; } + | STRAIGHT_JOIN { $$ = 1; } + ; + +normal_join: + inner_join { $$ = $1; } + | CROSS JOIN_SYM { $$ = 0; } + ; + +/* + table PARTITION (list of partitions), reusing using_list instead of creating + a new rule for partition_list. +*/ +opt_use_partition: + /* empty */ { $$= 0;} + | use_partition + ; + +use_partition: + PARTITION_SYM '(' using_list ')' have_partitioning + { + $$= $3; + } + ; + +/* + This is a flattening of the rules <table factor> and <table primary> + in the SQL:2003 standard, since we don't have <sample clause> + + I.e. + <table factor> ::= <table primary> [ <sample clause> ] +*/ +/* Warning - may return NULL in case of incomplete SELECT */ +table_factor: + table_primary_ident + | table_primary_derived + ; + +table_primary_ident: + { + DBUG_ASSERT(Select); + SELECT_LEX *sel= Select; + sel->table_join_options= 0; + } + table_ident opt_use_partition opt_for_system_time_clause opt_table_alias opt_key_definition + { + if (unlikely(!($$= Select->add_table_to_list(thd, $2, $5, + Select->get_table_join_options(), + YYPS->m_lock_type, + YYPS->m_mdl_type, + Select-> + pop_index_hints(), + $3)))) + MYSQL_YYABORT; + Select->add_joined_table($$); + if ($4) + $$->vers_conditions= Lex->vers_conditions; + } + ; + + + +/* + Represents a flattening of the following rules from the SQL:2003 + standard. This sub-rule corresponds to the sub-rule + <table primary> ::= ... | <derived table> [ AS ] <correlation name> + + <derived table> ::= <table subquery> + <table subquery> ::= <subquery> + <subquery> ::= <left paren> <query expression> <right paren> + <query expression> ::= [ <with clause> ] <query expression body> + + For the time being we use the non-standard rule + select_derived_union which is a compromise between the standard + and our parser. Possibly this rule could be replaced by our + query_expression_body. +*/ + +table_primary_derived: + '(' get_select_lex select_derived_union ')' opt_for_system_time_clause opt_table_alias + { + /* Use $2 instead of Lex->current_select as derived table will + alter value of Lex->current_select. */ + if (!($3 || $6) && $2->embedding && + !$2->embedding->nested_join->join_list.elements) + { + /* we have a derived table ($3 == NULL) but no alias, + Since we are nested in further parentheses so we + can pass NULL to the outer level parentheses + Permits parsing of "((((select ...))) as xyz)" */ + $$= 0; + } + else if (!$3) + { + /* Handle case of derived table, alias may be NULL if there + are no outer parentheses, add_table_to_list() will throw + error in this case */ + LEX *lex=Lex; + lex->check_automatic_up(UNSPECIFIED_TYPE); + SELECT_LEX *sel= lex->current_select; + SELECT_LEX_UNIT *unit= sel->master_unit(); + lex->current_select= sel= unit->outer_select(); + Table_ident *ti= new (thd->mem_root) Table_ident(unit); + if (unlikely(ti == NULL)) + MYSQL_YYABORT; + if (unlikely(!($$= sel->add_table_to_list(thd, + ti, $6, 0, + TL_READ, + MDL_SHARED_READ)))) + MYSQL_YYABORT; + sel->add_joined_table($$); + lex->pop_context(); + lex->nest_level--; + } + else if (unlikely($6 != NULL)) + { + /* + Tables with or without joins within parentheses cannot + have aliases, and we ruled out derived tables above. + */ + thd->parse_error(); + MYSQL_YYABORT; + } + else + { + /* nested join: FROM (t1 JOIN t2 ...), + nest_level is the same as in the outer query */ + $$= $3; + } + /* + Fields in derived table can be used in upper select in + case of merge. We do not add HAVING fields because we do + not merge such derived. We do not add union because + also do not merge them + */ + if ($$ && $$->derived && + !$$->derived->first_select()->next_select()) + $$->select_lex->add_where_field($$->derived->first_select()); + if ($5) + { + MYSQL_YYABORT_UNLESS(!$3); + $$->vers_conditions= Lex->vers_conditions; + } + } + /* Represents derived table with WITH clause */ + | '(' get_select_lex subselect_start + with_clause query_expression_body + subselect_end ')' opt_for_system_time_clause opt_table_alias + { + LEX *lex=Lex; + SELECT_LEX *sel= $2; + SELECT_LEX_UNIT *unit= $5->master_unit(); + Table_ident *ti= new (thd->mem_root) Table_ident(unit); + if (unlikely(ti == NULL)) + MYSQL_YYABORT; + $5->set_with_clause($4); + lex->current_select= sel; + if (unlikely(!($$= sel->add_table_to_list(lex->thd, + ti, $9, 0, + TL_READ, + MDL_SHARED_READ)))) + MYSQL_YYABORT; + sel->add_joined_table($$); + if ($8) + $$->vers_conditions= Lex->vers_conditions; + } + ; + +/* + This rule accepts just about anything. The reason is that we have + empty-producing rules in the beginning of rules, in this case + subselect_start. This forces bison to take a decision which rules to + reduce by long before it has seen any tokens. This approach ties us + to a very limited class of parseable languages, and unfortunately + SQL is not one of them. The chosen 'solution' was this rule, which + produces just about anything, even complete bogus statements, for + instance ( table UNION SELECT 1 ). + Fortunately, we know that the semantic value returned by + select_derived is NULL if it contained a derived table, and a pointer to + the base table's TABLE_LIST if it was a base table. So in the rule + regarding union's, we throw a parse error manually and pretend it + was bison that did it. + + Also worth noting is that this rule concerns query expressions in + the from clause only. Top level select statements and other types of + subqueries have their own union rules. +*/ +select_derived_union: + select_derived + | select_derived union_order_or_limit + { + if (unlikely($1)) + { + thd->parse_error(); + MYSQL_YYABORT; + } + } + | select_derived union_head_non_top + { + if (unlikely($1)) + { + thd->parse_error(); + MYSQL_YYABORT; + } + } + union_list_derived_part2 + | derived_simple_table opt_select_lock_type + | derived_simple_table order_or_limit opt_select_lock_type + | derived_simple_table opt_select_lock_type union_list_derived + ; + +union_list_derived_part2: + query_term_union_not_ready { Lex->pop_context(); } + | query_term_union_ready { Lex->pop_context(); } + | query_term_union_ready { Lex->pop_context(); } union_list_derived + ; + +union_list_derived: + union_head_non_top union_list_derived_part2 + ; + + +/* The equivalent of select_init2 for nested queries. */ +select_init2_derived: + select_part2_derived + { + Select->set_braces(0); + } + ; + +/* The equivalent of select_part2 for nested queries. */ +select_part2_derived: + { + LEX *lex= Lex; + SELECT_LEX *sel= lex->current_select; + if (sel->linkage != UNION_TYPE) + mysql_init_select(lex); + lex->current_select->parsing_place= SELECT_LIST; + } + opt_query_expression_options select_item_list + { + Select->parsing_place= NO_MATTER; + } + ; + +/* handle contents of parentheses in join expression */ +select_derived: + get_select_lex_derived derived_table_list + { + LEX *lex= Lex; + /* for normal joins, $2 != NULL and end_nested_join() != NULL, + for derived tables, both must equal NULL */ + + if (unlikely(!($$= $1->end_nested_join(lex->thd)) && $2)) + MYSQL_YYABORT; + if (unlikely(!$2 && $$)) + { + thd->parse_error(); + MYSQL_YYABORT; + } + } + ; + +derived_simple_table: + derived_query_specification { $$= $1; } + | derived_table_value_constructor { $$= $1; } + ; +/* + Similar to query_specification, but for derived tables. + Example: the inner parenthesized SELECT in this query: + SELECT * FROM (SELECT * FROM t1); +*/ +derived_query_specification: + SELECT_SYM select_derived_init select_derived2 + { + if ($2) + Select->set_braces(1); + $$= NULL; + } + ; + +derived_table_value_constructor: + VALUES + { + Lex->tvc_start(); + } + values_list + { + if (Lex->tvc_finalize_derived()) + MYSQL_YYABORT; + $$= NULL; + } + ; + + +select_derived2: + { + LEX *lex= Lex; + lex->derived_tables|= DERIVED_SUBQUERY; + if (unlikely(!lex->expr_allows_subselect || + lex->sql_command == (int)SQLCOM_PURGE)) + { + thd->parse_error(); + MYSQL_YYABORT; + } + if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE || + unlikely(mysql_new_select(lex, 1, NULL))) + MYSQL_YYABORT; + mysql_init_select(lex); + lex->current_select->linkage= DERIVED_TABLE_TYPE; + lex->current_select->parsing_place= SELECT_LIST; + } + select_options select_item_list + { + Select->parsing_place= NO_MATTER; + } + opt_table_expression + ; + +get_select_lex: + /* Empty */ { $$= Select; } + ; + +get_select_lex_derived: + get_select_lex + { + LEX *lex= Lex; + if (unlikely($1->init_nested_join(lex->thd))) + MYSQL_YYABORT; + } + ; + +select_derived_init: + { + LEX *lex= Lex; + + TABLE_LIST *embedding= lex->current_select->embedding; + $$= embedding && + !embedding->nested_join->join_list.elements; + /* return true if we are deeply nested */ + } + ; + +opt_outer: + /* empty */ {} + | OUTER {} + ; + +index_hint_clause: + /* empty */ + { + $$= thd->variables.old_mode ? INDEX_HINT_MASK_JOIN : INDEX_HINT_MASK_ALL; + } + | FOR_SYM JOIN_SYM { $$= INDEX_HINT_MASK_JOIN; } + | FOR_SYM ORDER_SYM BY { $$= INDEX_HINT_MASK_ORDER; } + | FOR_SYM GROUP_SYM BY { $$= INDEX_HINT_MASK_GROUP; } + ; + +index_hint_type: + FORCE_SYM { $$= INDEX_HINT_FORCE; } + | IGNORE_SYM { $$= INDEX_HINT_IGNORE; } + ; + +index_hint_definition: + index_hint_type key_or_index index_hint_clause + { + Select->set_index_hint_type($1, $3); + } + '(' key_usage_list ')' + | USE_SYM key_or_index index_hint_clause + { + Select->set_index_hint_type(INDEX_HINT_USE, $3); + } + '(' opt_key_usage_list ')' + ; + +index_hints_list: + index_hint_definition + | index_hints_list index_hint_definition + ; + +opt_index_hints_list: + /* empty */ + | { Select->alloc_index_hints(thd); } index_hints_list + ; + +opt_key_definition: + { Select->clear_index_hints(); } + opt_index_hints_list + ; + +opt_key_usage_list: + /* empty */ { Select->add_index_hint(thd, NULL, 0); } + | key_usage_list {} + ; + +key_usage_element: + ident + { Select->add_index_hint(thd, $1.str, $1.length); } + | PRIMARY_SYM + { Select->add_index_hint(thd, "PRIMARY", 7); } + ; + +key_usage_list: + key_usage_element + | key_usage_list ',' key_usage_element + ; + +using_list: + ident + { + if (unlikely(!($$= new (thd->mem_root) List<String>))) + MYSQL_YYABORT; + String *s= new (thd->mem_root) String((const char *) $1.str, + $1.length, + system_charset_info); + if (unlikely(unlikely(s == NULL))) + MYSQL_YYABORT; + $$->push_back(s, thd->mem_root); + } + | using_list ',' ident + { + String *s= new (thd->mem_root) String((const char *) $3.str, + $3.length, + system_charset_info); + if (unlikely(unlikely(s == NULL))) + MYSQL_YYABORT; + if (unlikely($1->push_back(s, thd->mem_root))) + MYSQL_YYABORT; + $$= $1; + } + ; + +interval: + interval_time_stamp {} + | DAY_HOUR_SYM { $$=INTERVAL_DAY_HOUR; } + | DAY_MICROSECOND_SYM { $$=INTERVAL_DAY_MICROSECOND; } + | DAY_MINUTE_SYM { $$=INTERVAL_DAY_MINUTE; } + | DAY_SECOND_SYM { $$=INTERVAL_DAY_SECOND; } + | HOUR_MICROSECOND_SYM { $$=INTERVAL_HOUR_MICROSECOND; } + | HOUR_MINUTE_SYM { $$=INTERVAL_HOUR_MINUTE; } + | HOUR_SECOND_SYM { $$=INTERVAL_HOUR_SECOND; } + | MINUTE_MICROSECOND_SYM { $$=INTERVAL_MINUTE_MICROSECOND; } + | MINUTE_SECOND_SYM { $$=INTERVAL_MINUTE_SECOND; } + | SECOND_MICROSECOND_SYM { $$=INTERVAL_SECOND_MICROSECOND; } + | YEAR_MONTH_SYM { $$=INTERVAL_YEAR_MONTH; } + ; + +interval_time_stamp: + DAY_SYM { $$=INTERVAL_DAY; } + | WEEK_SYM { $$=INTERVAL_WEEK; } + | HOUR_SYM { $$=INTERVAL_HOUR; } + | MINUTE_SYM { $$=INTERVAL_MINUTE; } + | MONTH_SYM { $$=INTERVAL_MONTH; } + | QUARTER_SYM { $$=INTERVAL_QUARTER; } + | SECOND_SYM { $$=INTERVAL_SECOND; } + | MICROSECOND_SYM { $$=INTERVAL_MICROSECOND; } + | YEAR_SYM { $$=INTERVAL_YEAR; } + ; + +date_time_type: + DATE_SYM {$$=MYSQL_TIMESTAMP_DATE;} + | TIME_SYM {$$=MYSQL_TIMESTAMP_TIME;} + | DATETIME {$$=MYSQL_TIMESTAMP_DATETIME;} + | TIMESTAMP {$$=MYSQL_TIMESTAMP_DATETIME;} + ; + +table_alias: + /* empty */ + | AS + | '=' + ; + +opt_table_alias: + /* empty */ { $$=0; } + | table_alias ident_table_alias + { + $$= (LEX_CSTRING*) thd->memdup(&$2,sizeof(LEX_STRING)); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + +opt_all: + /* empty */ + | ALL + ; + +opt_where_clause: + /* empty */ { Select->where= 0; } + | WHERE + { + Select->parsing_place= IN_WHERE; + } + expr + { + SELECT_LEX *select= Select; + select->where= normalize_cond(thd, $3); + select->parsing_place= NO_MATTER; + if ($3) + $3->top_level_item(); + } + ; + +opt_having_clause: + /* empty */ + | HAVING + { + Select->parsing_place= IN_HAVING; + } + expr + { + SELECT_LEX *sel= Select; + sel->having= normalize_cond(thd, $3); + sel->parsing_place= NO_MATTER; + if ($3) + $3->top_level_item(); + } + ; + +opt_escape: + ESCAPE_SYM simple_expr + { + Lex->escape_used= TRUE; + $$= $2; + } + | /* empty */ %prec PREC_BELOW_ESCAPE + { + Lex->escape_used= FALSE; + $$= ((thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) ? + new (thd->mem_root) Item_string_ascii(thd, "", 0) : + new (thd->mem_root) Item_string_ascii(thd, "\\", 1)); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + +/* + group by statement in select +*/ + +opt_group_clause: + /* empty */ + | GROUP_SYM BY group_list olap_opt + ; + +group_list: + group_list ',' order_ident order_dir + { + if (unlikely(add_group_to_list(thd, $3,(bool) $4))) + MYSQL_YYABORT; + } + | order_ident order_dir + { + if (unlikely(add_group_to_list(thd, $1,(bool) $2))) + MYSQL_YYABORT; + } + ; + +olap_opt: + /* empty */ {} + | WITH_CUBE_SYM + { + /* + 'WITH CUBE' is reserved in the MySQL syntax, but not implemented, + and cause LALR(2) conflicts. + This syntax is not standard. + MySQL syntax: GROUP BY col1, col2, col3 WITH CUBE + SQL-2003: GROUP BY ... CUBE(col1, col2, col3) + */ + LEX *lex=Lex; + if (unlikely(lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)) + my_yyabort_error((ER_WRONG_USAGE, MYF(0), "WITH CUBE", + "global union parameters")); + lex->current_select->olap= CUBE_TYPE; + + my_yyabort_error((ER_NOT_SUPPORTED_YET, MYF(0), "CUBE")); + } + | WITH_ROLLUP_SYM + { + /* + 'WITH ROLLUP' is needed for backward compatibility, + and cause LALR(2) conflicts. + This syntax is not standard. + MySQL syntax: GROUP BY col1, col2, col3 WITH ROLLUP + SQL-2003: GROUP BY ... ROLLUP(col1, col2, col3) + */ + LEX *lex= Lex; + if (unlikely(lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)) + my_yyabort_error((ER_WRONG_USAGE, MYF(0), "WITH ROLLUP", + "global union parameters")); + lex->current_select->olap= ROLLUP_TYPE; + } + ; + +/* + optional window clause in select +*/ + +opt_window_clause: + /* empty */ + {} + | WINDOW_SYM + window_def_list + {} + ; + +window_def_list: + window_def_list ',' window_def + | window_def + ; + +window_def: + window_name AS window_spec + { + LEX *lex= Lex; + if (unlikely(Select->add_window_def(thd, $1, lex->win_ref, + Select->group_list, + Select->order_list, + lex->win_frame))) + MYSQL_YYABORT; + } + ; + +window_spec: + '(' + { Select->prepare_add_window_spec(thd); } + opt_window_ref opt_window_partition_clause + opt_window_order_clause opt_window_frame_clause + ')' + ; + +opt_window_ref: + /* empty */ {} + | ident + { + thd->lex->win_ref= (LEX_CSTRING *) thd->memdup(&$1, sizeof(LEX_CSTRING)); + if (unlikely(thd->lex->win_ref == NULL)) + MYSQL_YYABORT; + } + +opt_window_partition_clause: + /* empty */ { } + | PARTITION_SYM BY group_list + ; + +opt_window_order_clause: + /* empty */ { } + | ORDER_SYM BY order_list + ; + +opt_window_frame_clause: + /* empty */ {} + | window_frame_units window_frame_extent opt_window_frame_exclusion + { + LEX *lex= Lex; + lex->win_frame= + new (thd->mem_root) Window_frame($1, + lex->frame_top_bound, + lex->frame_bottom_bound, + $3); + if (unlikely(lex->win_frame == NULL)) + MYSQL_YYABORT; + } + ; + +window_frame_units: + ROWS_SYM { $$= Window_frame::UNITS_ROWS; } + | RANGE_SYM { $$= Window_frame::UNITS_RANGE; } + ; + +window_frame_extent: + window_frame_start + { + LEX *lex= Lex; + lex->frame_top_bound= $1; + lex->frame_bottom_bound= + new (thd->mem_root) + Window_frame_bound(Window_frame_bound::CURRENT, NULL); + if (unlikely(lex->frame_bottom_bound == NULL)) + MYSQL_YYABORT; + } + | BETWEEN_SYM window_frame_bound AND_SYM window_frame_bound + { + LEX *lex= Lex; + lex->frame_top_bound= $2; + lex->frame_bottom_bound= $4; + } + ; + +window_frame_start: + UNBOUNDED_SYM PRECEDING_SYM + { + $$= new (thd->mem_root) + Window_frame_bound(Window_frame_bound::PRECEDING, NULL); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | CURRENT_SYM ROW_SYM + { + $$= new (thd->mem_root) + Window_frame_bound(Window_frame_bound::CURRENT, NULL); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | literal PRECEDING_SYM + { + $$= new (thd->mem_root) + Window_frame_bound(Window_frame_bound::PRECEDING, $1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + +window_frame_bound: + window_frame_start { $$= $1; } + | UNBOUNDED_SYM FOLLOWING_SYM + { + $$= new (thd->mem_root) + Window_frame_bound(Window_frame_bound::FOLLOWING, NULL); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | literal FOLLOWING_SYM + { + $$= new (thd->mem_root) + Window_frame_bound(Window_frame_bound::FOLLOWING, $1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + +opt_window_frame_exclusion: + /* empty */ { $$= Window_frame::EXCL_NONE; } + | EXCLUDE_SYM CURRENT_SYM ROW_SYM + { $$= Window_frame::EXCL_CURRENT_ROW; } + | EXCLUDE_SYM GROUP_SYM + { $$= Window_frame::EXCL_GROUP; } + | EXCLUDE_SYM TIES_SYM + { $$= Window_frame::EXCL_TIES; } + | EXCLUDE_SYM NO_SYM OTHERS_MARIADB_SYM + { $$= Window_frame::EXCL_NONE; } + | EXCLUDE_SYM NO_SYM OTHERS_ORACLE_SYM + { $$= Window_frame::EXCL_NONE; } + ; + +/* + Order by statement in ALTER TABLE +*/ + +alter_order_clause: + ORDER_SYM BY alter_order_list + ; + +alter_order_list: + alter_order_list ',' alter_order_item + | alter_order_item + ; + +alter_order_item: + simple_ident_nospvar order_dir + { + bool ascending= ($2 == 1) ? true : false; + if (unlikely(add_order_to_list(thd, $1, ascending))) + MYSQL_YYABORT; + } + ; + +/* + Order by statement in select +*/ + +opt_order_clause: + /* empty */ + | order_clause + ; + +order_clause: + ORDER_SYM BY + { + LEX *lex=Lex; + SELECT_LEX *sel= lex->current_select; + SELECT_LEX_UNIT *unit= sel-> master_unit(); + if (unlikely(sel->linkage != GLOBAL_OPTIONS_TYPE && + sel->olap != UNSPECIFIED_OLAP_TYPE && + (sel->linkage != UNION_TYPE || sel->braces))) + { + my_error(ER_WRONG_USAGE, MYF(0), + "CUBE/ROLLUP", "ORDER BY"); + MYSQL_YYABORT; + } + if (lex->sql_command != SQLCOM_ALTER_TABLE && + !unit->fake_select_lex) + { + /* + A query of the of the form (SELECT ...) ORDER BY order_list is + executed in the same way as the query + SELECT ... ORDER BY order_list + unless the SELECT construct contains ORDER BY or LIMIT clauses. + Otherwise we create a fake SELECT_LEX if it has not been + created yet. + */ + SELECT_LEX *first_sl= unit->first_select(); + if (unlikely(!unit->is_unit_op() && + (first_sl->order_list.elements || + first_sl->select_limit) && + unit->add_fake_select_lex(thd))) + MYSQL_YYABORT; + } + if (sel->master_unit()->is_unit_op() && !sel->braces) + { + /* + At this point we don't know yet whether this is the last + select in union or not, but we move ORDER BY to + fake_select_lex anyway. If there would be one more select + in union mysql_new_select will correctly throw error. + */ + DBUG_ASSERT(sel->master_unit()->fake_select_lex); + lex->current_select= sel->master_unit()->fake_select_lex; + } + } + order_list + { + + } + ; + +order_list: + order_list ',' order_ident order_dir + { + if (unlikely(add_order_to_list(thd, $3,(bool) $4))) + MYSQL_YYABORT; + } + | order_ident order_dir + { + if (unlikely(add_order_to_list(thd, $1,(bool) $2))) + MYSQL_YYABORT; + } + ; + +order_dir: + /* empty */ { $$ = 1; } + | ASC { $$ =1; } + | DESC { $$ =0; } + ; + +opt_limit_clause: + /* empty */ {} + | limit_clause {} + ; + +limit_clause_init: + LIMIT + { + SELECT_LEX *sel= Select; + if (sel->master_unit()->is_unit_op() && !sel->braces) + { + /* Move LIMIT that belongs to UNION to fake_select_lex */ + Lex->current_select= sel->master_unit()->fake_select_lex; + DBUG_ASSERT(Select); + } + } + ; + +limit_clause: + limit_clause_init limit_options + { + SELECT_LEX *sel= Select; + if (!sel->select_limit->basic_const_item() || + sel->select_limit->val_int() > 0) + Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_LIMIT); + } + | limit_clause_init limit_options + ROWS_SYM EXAMINED_SYM limit_rows_option + { + Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_LIMIT); + } + | limit_clause_init ROWS_SYM EXAMINED_SYM limit_rows_option + { + Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_LIMIT); + } + ; + +limit_options: + limit_option + { + SELECT_LEX *sel= Select; + sel->select_limit= $1; + sel->offset_limit= 0; + sel->explicit_limit= 1; + } + | limit_option ',' limit_option + { + SELECT_LEX *sel= Select; + sel->select_limit= $3; + sel->offset_limit= $1; + sel->explicit_limit= 1; + } + | limit_option OFFSET_SYM limit_option + { + SELECT_LEX *sel= Select; + sel->select_limit= $1; + sel->offset_limit= $3; + sel->explicit_limit= 1; + } + ; + +limit_option: + ident_cli + { + if (unlikely(!($$= Lex->create_item_limit(thd, &$1)))) + MYSQL_YYABORT; + } + | ident_cli '.' ident_cli + { + if (unlikely(!($$= Lex->create_item_limit(thd, &$1, &$3)))) + MYSQL_YYABORT; + } + | param_marker + { + $1->limit_clause_param= TRUE; + } + | ULONGLONG_NUM + { + $$= new (thd->mem_root) Item_uint(thd, $1.str, $1.length); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | LONG_NUM + { + $$= new (thd->mem_root) Item_uint(thd, $1.str, $1.length); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | NUM + { + $$= new (thd->mem_root) Item_uint(thd, $1.str, $1.length); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + +limit_rows_option: + limit_option + { + LEX *lex=Lex; + lex->limit_rows_examined= $1; + } + +delete_limit_clause: + /* empty */ + { + LEX *lex=Lex; + lex->current_select->select_limit= 0; + } + | LIMIT limit_option + { + SELECT_LEX *sel= Select; + sel->select_limit= $2; + Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_LIMIT); + sel->explicit_limit= 1; + } + | LIMIT ROWS_SYM EXAMINED_SYM { thd->parse_error(); MYSQL_YYABORT; } + | LIMIT limit_option ROWS_SYM EXAMINED_SYM { thd->parse_error(); MYSQL_YYABORT; } + ; + +opt_plus: + /* empty */ + | '+' + ; + +int_num: + opt_plus NUM { int error; $$= (int) my_strtoll10($2.str, (char**) 0, &error); } + | '-' NUM { int error; $$= -(int) my_strtoll10($2.str, (char**) 0, &error); } + +ulong_num: + opt_plus NUM { int error; $$= (ulong) my_strtoll10($2.str, (char**) 0, &error); } + | HEX_NUM { $$= (ulong) strtol($1.str, (char**) 0, 16); } + | opt_plus LONG_NUM { int error; $$= (ulong) my_strtoll10($2.str, (char**) 0, &error); } + | opt_plus ULONGLONG_NUM { int error; $$= (ulong) my_strtoll10($2.str, (char**) 0, &error); } + | opt_plus DECIMAL_NUM { int error; $$= (ulong) my_strtoll10($2.str, (char**) 0, &error); } + | opt_plus FLOAT_NUM { int error; $$= (ulong) my_strtoll10($2.str, (char**) 0, &error); } + ; + +real_ulong_num: + NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); } + | HEX_NUM { $$= (ulong) strtol($1.str, (char**) 0, 16); } + | LONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); } + | ULONGLONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); } + | dec_num_error { MYSQL_YYABORT; } + ; + +longlong_num: + opt_plus NUM { int error; $$= (longlong) my_strtoll10($2.str, (char**) 0, &error); } + | LONG_NUM { int error; $$= (longlong) my_strtoll10($1.str, (char**) 0, &error); } + | '-' NUM { int error; $$= -(longlong) my_strtoll10($2.str, (char**) 0, &error); } + | '-' LONG_NUM { int error; $$= -(longlong) my_strtoll10($2.str, (char**) 0, &error); } + + +ulonglong_num: + opt_plus NUM { int error; $$= (ulonglong) my_strtoll10($2.str, (char**) 0, &error); } + | opt_plus ULONGLONG_NUM { int error; $$= (ulonglong) my_strtoll10($2.str, (char**) 0, &error); } + | opt_plus LONG_NUM { int error; $$= (ulonglong) my_strtoll10($2.str, (char**) 0, &error); } + | opt_plus DECIMAL_NUM { int error; $$= (ulonglong) my_strtoll10($2.str, (char**) 0, &error); } + | opt_plus FLOAT_NUM { int error; $$= (ulonglong) my_strtoll10($2.str, (char**) 0, &error); } + ; + +real_ulonglong_num: + NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); } + | ULONGLONG_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); } + | HEX_NUM { $$= strtoull($1.str, (char**) 0, 16); } + | LONG_NUM { int error; $$= (ulonglong) my_strtoll10($1.str, (char**) 0, &error); } + | dec_num_error { MYSQL_YYABORT; } + ; + +dec_num_error: + dec_num + { thd->parse_error(ER_ONLY_INTEGERS_ALLOWED); } + ; + +dec_num: + DECIMAL_NUM + | FLOAT_NUM + ; + +choice: + ulong_num { $$= $1 != 0 ? HA_CHOICE_YES : HA_CHOICE_NO; } + | DEFAULT { $$= HA_CHOICE_UNDEF; } + ; + +bool: + ulong_num { $$= $1 != 0; } + | TRUE_SYM { $$= 1; } + | FALSE_SYM { $$= 0; } + + +procedure_clause: + PROCEDURE_SYM ident /* Procedure name */ + { + LEX *lex=Lex; + + DBUG_ASSERT(&lex->select_lex == lex->current_select); + + lex->proc_list.elements=0; + lex->proc_list.first=0; + lex->proc_list.next= &lex->proc_list.first; + Item_field *item= new (thd->mem_root) + Item_field(thd, &lex->current_select->context, + NULL, NULL, &$2); + if (unlikely(item == NULL)) + MYSQL_YYABORT; + if (unlikely(add_proc_to_list(thd, item))) + MYSQL_YYABORT; + Lex->uncacheable(UNCACHEABLE_SIDEEFFECT); + + /* + PROCEDURE CLAUSE cannot handle subquery as one of its parameter, + so set expr_allows_subselect as false to disallow any subqueries + further. Reset expr_allows_subselect back to true once the + parameters are reduced. + */ + Lex->expr_allows_subselect= false; + } + '(' procedure_list ')' + { + /* Subqueries are allowed from now.*/ + Lex->expr_allows_subselect= true; + } + ; + +procedure_list: + /* empty */ {} + | procedure_list2 {} + ; + +procedure_list2: + procedure_list2 ',' procedure_item + | procedure_item + ; + +procedure_item: + remember_name expr remember_end + { + if (unlikely(add_proc_to_list(thd, $2))) + MYSQL_YYABORT; + if (!$2->name.str || $2->name.str == item_empty_name) + $2->set_name(thd, $1, (uint) ($3 - $1), thd->charset()); + } + ; + +select_var_list_init: + { + LEX *lex=Lex; + if (!lex->describe && + unlikely((!(lex->result= new (thd->mem_root) + select_dumpvar(thd))))) + MYSQL_YYABORT; + } + select_var_list + {} + ; + +select_var_list: + select_var_list ',' select_var_ident + | select_var_ident {} + ; + +select_var_ident: select_outvar + { + if (Lex->result) + { + if (unlikely($1 == NULL)) + MYSQL_YYABORT; + ((select_dumpvar *)Lex->result)->var_list.push_back($1, thd->mem_root); + } + else + { + /* + The parser won't create select_result instance only + if it's an EXPLAIN. + */ + DBUG_ASSERT(Lex->describe); + } + } + ; + +select_outvar: + '@' ident_or_text + { + $$ = Lex->result ? new (thd->mem_root) my_var_user(&$2) : NULL; + } + | ident_or_text + { + if (unlikely(!($$= Lex->create_outvar(thd, &$1)) && Lex->result)) + MYSQL_YYABORT; + } + | ident '.' ident + { + if (unlikely(!($$= Lex->create_outvar(thd, &$1, &$3)) && Lex->result)) + MYSQL_YYABORT; + } + ; + +into: + INTO into_destination + ; + +into_destination: + OUTFILE TEXT_STRING_filesystem + { + LEX *lex= Lex; + lex->uncacheable(UNCACHEABLE_SIDEEFFECT); + if (unlikely(!(lex->exchange= + new (thd->mem_root) sql_exchange($2.str, 0))) || + unlikely(!(lex->result= + new (thd->mem_root) + select_export(thd, lex->exchange)))) + MYSQL_YYABORT; + } + opt_load_data_charset + { Lex->exchange->cs= $4; } + opt_field_term opt_line_term + | DUMPFILE TEXT_STRING_filesystem + { + LEX *lex=Lex; + if (!lex->describe) + { + lex->uncacheable(UNCACHEABLE_SIDEEFFECT); + if (unlikely(!(lex->exchange= + new (thd->mem_root) sql_exchange($2.str,1)))) + MYSQL_YYABORT; + if (unlikely(!(lex->result= + new (thd->mem_root) + select_dump(thd, lex->exchange)))) + MYSQL_YYABORT; + } + } + | select_var_list_init + { + Lex->uncacheable(UNCACHEABLE_SIDEEFFECT); + } + ; + +/* + DO statement +*/ + +do: + DO_SYM + { + LEX *lex=Lex; + lex->sql_command = SQLCOM_DO; + mysql_init_select(lex); + } + expr_list + { + Lex->insert_list= $3; + } + ; + +/* + Drop : delete tables or index or user +*/ + +drop: + DROP opt_temporary table_or_tables opt_if_exists + { + LEX *lex=Lex; + lex->set_command(SQLCOM_DROP_TABLE, $2, $4); + YYPS->m_lock_type= TL_UNLOCK; + YYPS->m_mdl_type= MDL_EXCLUSIVE; + } + table_list opt_lock_wait_timeout opt_restrict + {} + | DROP INDEX_SYM opt_if_exists_table_element ident ON table_ident opt_lock_wait_timeout + { + LEX *lex=Lex; + Alter_drop *ad= (new (thd->mem_root) + Alter_drop(Alter_drop::KEY, $4.str, $3)); + if (unlikely(ad == NULL)) + MYSQL_YYABORT; + lex->sql_command= SQLCOM_DROP_INDEX; + lex->alter_info.reset(); + lex->alter_info.flags= ALTER_DROP_INDEX; + lex->alter_info.drop_list.push_back(ad, thd->mem_root); + if (unlikely(!lex->current_select-> + add_table_to_list(thd, $6, NULL, TL_OPTION_UPDATING, + TL_READ_NO_INSERT, + MDL_SHARED_UPGRADABLE))) + MYSQL_YYABORT; + } + | DROP DATABASE opt_if_exists ident + { + LEX *lex=Lex; + lex->set_command(SQLCOM_DROP_DB, $3); + lex->name= $4; + } + | DROP PACKAGE_ORACLE_SYM opt_if_exists sp_name + { + LEX *lex= Lex; + lex->set_command(SQLCOM_DROP_PACKAGE, $3); + if (unlikely(lex->sphead)) + my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "PACKAGE")); + lex->spname= $4; + } + | DROP PACKAGE_ORACLE_SYM BODY_ORACLE_SYM opt_if_exists sp_name + { + LEX *lex= Lex; + lex->set_command(SQLCOM_DROP_PACKAGE_BODY, $4); + if (unlikely(lex->sphead)) + my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "PACKAGE BODY")); + lex->spname= $5; + } + | DROP FUNCTION_SYM opt_if_exists ident '.' ident + { + LEX *lex= thd->lex; + sp_name *spname; + if (unlikely($4.str && check_db_name((LEX_STRING*) &$4))) + my_yyabort_error((ER_WRONG_DB_NAME, MYF(0), $4.str)); + if (unlikely(lex->sphead)) + my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "FUNCTION")); + lex->set_command(SQLCOM_DROP_FUNCTION, $3); + spname= new (thd->mem_root) sp_name(&$4, &$6, true); + if (unlikely(spname == NULL)) + MYSQL_YYABORT; + lex->spname= spname; + } + | DROP FUNCTION_SYM opt_if_exists ident + { + LEX *lex= thd->lex; + LEX_CSTRING db= {0, 0}; + sp_name *spname; + if (unlikely(lex->sphead)) + my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "FUNCTION")); + if (thd->db.str && unlikely(lex->copy_db_to(&db))) + MYSQL_YYABORT; + lex->set_command(SQLCOM_DROP_FUNCTION, $3); + spname= new (thd->mem_root) sp_name(&db, &$4, false); + if (unlikely(spname == NULL)) + MYSQL_YYABORT; + lex->spname= spname; + } + | DROP PROCEDURE_SYM opt_if_exists sp_name + { + LEX *lex=Lex; + if (unlikely(lex->sphead)) + my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE")); + lex->set_command(SQLCOM_DROP_PROCEDURE, $3); + lex->spname= $4; + } + | DROP USER_SYM opt_if_exists clear_privileges user_list + { + Lex->set_command(SQLCOM_DROP_USER, $3); + } + | DROP ROLE_SYM opt_if_exists clear_privileges role_list + { + Lex->set_command(SQLCOM_DROP_ROLE, $3); + } + | DROP VIEW_SYM opt_if_exists + { + LEX *lex= Lex; + lex->set_command(SQLCOM_DROP_VIEW, $3); + YYPS->m_lock_type= TL_UNLOCK; + YYPS->m_mdl_type= MDL_EXCLUSIVE; + } + table_list opt_restrict + {} + | DROP EVENT_SYM opt_if_exists sp_name + { + Lex->spname= $4; + Lex->set_command(SQLCOM_DROP_EVENT, $3); + } + | DROP TRIGGER_SYM opt_if_exists sp_name + { + LEX *lex= Lex; + lex->set_command(SQLCOM_DROP_TRIGGER, $3); + lex->spname= $4; + } + | DROP TABLESPACE tablespace_name opt_ts_engine opt_ts_wait + { + LEX *lex= Lex; + lex->alter_tablespace_info->ts_cmd_type= DROP_TABLESPACE; + } + | DROP LOGFILE_SYM GROUP_SYM logfile_group_name opt_ts_engine opt_ts_wait + { + LEX *lex= Lex; + lex->alter_tablespace_info->ts_cmd_type= DROP_LOGFILE_GROUP; + } + | DROP SERVER_SYM opt_if_exists ident_or_text + { + Lex->set_command(SQLCOM_DROP_SERVER, $3); + Lex->server_options.reset($4); + } + | DROP opt_temporary SEQUENCE_SYM opt_if_exists + + { + LEX *lex= Lex; + lex->set_command(SQLCOM_DROP_SEQUENCE, $2, $4); + lex->table_type= TABLE_TYPE_SEQUENCE; + YYPS->m_lock_type= TL_UNLOCK; + YYPS->m_mdl_type= MDL_EXCLUSIVE; + } + table_list + {} + ; + +table_list: + table_name + | table_list ',' table_name + ; + +table_name: + table_ident + { + if (unlikely(!Select->add_table_to_list(thd, $1, NULL, + TL_OPTION_UPDATING, + YYPS->m_lock_type, + YYPS->m_mdl_type))) + MYSQL_YYABORT; + } + ; + +table_name_with_opt_use_partition: + table_ident opt_use_partition + { + if (unlikely(!Select->add_table_to_list(thd, $1, NULL, + TL_OPTION_UPDATING, + YYPS->m_lock_type, + YYPS->m_mdl_type, + NULL, + $2))) + MYSQL_YYABORT; + } + ; + +table_alias_ref_list: + table_alias_ref + | table_alias_ref_list ',' table_alias_ref + ; + +table_alias_ref: + table_ident_opt_wild + { + if (unlikely(!Select-> + add_table_to_list(thd, $1, NULL, + (TL_OPTION_UPDATING | + TL_OPTION_ALIAS), + YYPS->m_lock_type, + YYPS->m_mdl_type))) + MYSQL_YYABORT; + } + ; + +opt_if_exists_table_element: + /* empty */ + { + Lex->check_exists= FALSE; + $$= 0; + } + | IF_SYM EXISTS + { + Lex->check_exists= TRUE; + $$= 1; + } + ; + +opt_if_exists: + /* empty */ + { + $$.set(DDL_options_st::OPT_NONE); + } + | IF_SYM EXISTS + { + $$.set(DDL_options_st::OPT_IF_EXISTS); + } + ; + +opt_temporary: + /* empty */ { $$= 0; } + | TEMPORARY { $$= HA_LEX_CREATE_TMP_TABLE; } + ; +/* +** Insert : add new data to table +*/ + +insert: + INSERT + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_INSERT; + lex->duplicates= DUP_ERROR; + mysql_init_select(lex); + } + insert_lock_option + opt_ignore insert2 + { - Select->set_lock_for_tables($3); ++ Select->set_lock_for_tables($3, true); + Lex->current_select= &Lex->select_lex; + } + insert_field_spec opt_insert_update + {} + ; + +replace: + REPLACE + { + LEX *lex=Lex; + lex->sql_command = SQLCOM_REPLACE; + lex->duplicates= DUP_REPLACE; + mysql_init_select(lex); + } + replace_lock_option insert2 + { - Select->set_lock_for_tables($3); ++ Select->set_lock_for_tables($3, true); + Lex->current_select= &Lex->select_lex; + } + insert_field_spec + {} + ; + +insert_lock_option: + /* empty */ + { + /* + If it is SP we do not allow insert optimisation when result of + insert visible only after the table unlocking but everyone can + read table. + */ + $$= (Lex->sphead ? TL_WRITE_DEFAULT : TL_WRITE_CONCURRENT_INSERT); + } + | LOW_PRIORITY { $$= TL_WRITE_LOW_PRIORITY; } + | DELAYED_SYM + { + // QQ: why was +1? + Lex->keyword_delayed_begin_offset= (uint)($1.pos() - thd->query()); + Lex->keyword_delayed_end_offset= (uint)($1.end() - thd->query()); + $$= TL_WRITE_DELAYED; + } + | HIGH_PRIORITY { $$= TL_WRITE; } + ; + +replace_lock_option: + opt_low_priority { $$= $1; } + | DELAYED_SYM + { + Lex->keyword_delayed_begin_offset= (uint)($1.pos() - thd->query()); + Lex->keyword_delayed_end_offset= (uint)($1.end() - thd->query()); + $$= TL_WRITE_DELAYED; + } + ; + +insert2: + INTO insert_table {} + | insert_table {} + ; + +insert_table: + table_name_with_opt_use_partition + { + LEX *lex=Lex; + lex->field_list.empty(); + lex->many_values.empty(); + lex->insert_list=0; + }; + +insert_field_spec: + insert_values {} + | '(' ')' insert_values {} + | '(' fields ')' insert_values {} + | SET + { + LEX *lex=Lex; + if (unlikely(!(lex->insert_list= new (thd->mem_root) List_item)) || + unlikely(lex->many_values.push_back(lex->insert_list, + thd->mem_root))) + MYSQL_YYABORT; + } + ident_eq_list + ; + +fields: + fields ',' insert_ident + { Lex->field_list.push_back($3, thd->mem_root); } + | insert_ident { Lex->field_list.push_back($1, thd->mem_root); } + ; + +insert_values: + VALUES values_list {} + | VALUE_SYM values_list {} + | create_select_query_expression {} + ; + +values_list: + values_list ',' no_braces + | no_braces_with_names + ; + +ident_eq_list: + ident_eq_list ',' ident_eq_value + | ident_eq_value + ; + +ident_eq_value: + simple_ident_nospvar equal expr_or_default + { + LEX *lex=Lex; + if (unlikely(lex->field_list.push_back($1, thd->mem_root)) || + unlikely(lex->insert_list->push_back($3, thd->mem_root))) + MYSQL_YYABORT; + } + ; + +equal: + '=' {} + | SET_VAR {} + ; + +opt_equal: + /* empty */ {} + | equal {} + ; + +opt_with: + opt_equal {} + | WITH {} + ; + +opt_by: + opt_equal {} + | BY {} + ; + +no_braces: + '(' + { + if (unlikely(!(Lex->insert_list= new (thd->mem_root) List_item))) + MYSQL_YYABORT; + } + opt_values ')' + { + LEX *lex=Lex; + if (unlikely(lex->many_values.push_back(lex->insert_list, + thd->mem_root))) + MYSQL_YYABORT; + } + ; + +no_braces_with_names: + '(' + { + if (unlikely(!(Lex->insert_list= new (thd->mem_root) List_item))) + MYSQL_YYABORT; + } + opt_values_with_names ')' + { + LEX *lex=Lex; + if (unlikely(lex->many_values.push_back(lex->insert_list, + thd->mem_root))) + MYSQL_YYABORT; + } + ; + +opt_values: + /* empty */ {} + | values + ; + +opt_values_with_names: + /* empty */ {} + | values_with_names + ; + +values: + values ',' expr_or_default + { + if (unlikely(Lex->insert_list->push_back($3, thd->mem_root))) + MYSQL_YYABORT; + } + | expr_or_default + { + if (unlikely(Lex->insert_list->push_back($1, thd->mem_root))) + MYSQL_YYABORT; + } + ; + +values_with_names: + values_with_names ',' remember_name expr_or_default remember_end + { + if (unlikely(Lex->insert_list->push_back($4, thd->mem_root))) + MYSQL_YYABORT; + // give some name in case of using in table value constuctor (TVC) + if (!$4->name.str || $4->name.str == item_empty_name) + $4->set_name(thd, $3, (uint) ($5 - $3), thd->charset()); + } + | remember_name expr_or_default remember_end + { + if (unlikely(Lex->insert_list->push_back($2, thd->mem_root))) + MYSQL_YYABORT; + // give some name in case of using in table value constuctor (TVC) + if (!$2->name.str || $2->name.str == item_empty_name) + $2->set_name(thd, $1, (uint) ($3 - $1), thd->charset()); + } + ; + +expr_or_default: + expr { $$= $1;} + | DEFAULT + { + $$= new (thd->mem_root) Item_default_value(thd, Lex->current_context()); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | IGNORE_SYM + { + $$= new (thd->mem_root) Item_ignore_value(thd, Lex->current_context()); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + +opt_insert_update: + /* empty */ + | ON DUPLICATE_SYM { Lex->duplicates= DUP_UPDATE; } + KEY_SYM UPDATE_SYM + { + Select->parsing_place= IN_UPDATE_ON_DUP_KEY; + } + insert_update_list + { + Select->parsing_place= NO_MATTER; + } + ; + +/* Update rows in a table */ + +update: + UPDATE_SYM + { + LEX *lex= Lex; + mysql_init_select(lex); + lex->sql_command= SQLCOM_UPDATE; + lex->duplicates= DUP_ERROR; + } + opt_low_priority opt_ignore join_table_list + SET update_list + { - LEX *lex= Lex; - if (lex->select_lex.table_list.elements > 1) - lex->sql_command= SQLCOM_UPDATE_MULTI; - else if (unlikely(lex->select_lex.get_table_list()->derived)) ++ SELECT_LEX *slex= &Lex->select_lex; ++ if (slex->table_list.elements > 1) ++ Lex->sql_command= SQLCOM_UPDATE_MULTI; ++ else if (unlikely(slex->get_table_list()->derived)) + { + /* it is single table update and it is update of derived table */ + my_error(ER_NON_UPDATABLE_TABLE, MYF(0), - lex->select_lex.get_table_list()->alias.str, "UPDATE"); ++ slex->get_table_list()->alias.str, "UPDATE"); + MYSQL_YYABORT; + } + /* + In case of multi-update setting write lock for all tables may + be too pessimistic. We will decrease lock level if possible in + mysql_multi_update(). + */ - Select->set_lock_for_tables($3); ++ slex->set_lock_for_tables($3, slex->table_list.elements == 1); + } + opt_where_clause opt_order_clause delete_limit_clause {} + ; + +update_list: + update_list ',' update_elem + | update_elem + ; + +update_elem: + simple_ident_nospvar equal expr_or_default + { + if (unlikely(add_item_to_list(thd, $1)) || + unlikely(add_value_to_list(thd, $3))) + MYSQL_YYABORT; + } + ; + +insert_update_list: + insert_update_list ',' insert_update_elem + | insert_update_elem + ; + +insert_update_elem: + simple_ident_nospvar equal expr_or_default + { + LEX *lex= Lex; + if (unlikely(lex->update_list.push_back($1, thd->mem_root)) || + unlikely(lex->value_list.push_back($3, thd->mem_root))) + MYSQL_YYABORT; + } + ; + +opt_low_priority: + /* empty */ { $$= TL_WRITE_DEFAULT; } + | LOW_PRIORITY { $$= TL_WRITE_LOW_PRIORITY; } + ; + +/* Delete rows from a table */ + +delete: + DELETE_SYM + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_DELETE; + mysql_init_select(lex); + YYPS->m_lock_type= TL_WRITE_DEFAULT; + YYPS->m_mdl_type= MDL_SHARED_WRITE; + + lex->ignore= 0; + lex->select_lex.init_order(); + } + delete_part2 + ; + +opt_delete_system_time: + /* empty */ + { + Lex->vers_conditions.init(SYSTEM_TIME_ALL); + } + | BEFORE_SYM SYSTEM_TIME_SYM history_point + { + Lex->vers_conditions.init(SYSTEM_TIME_BEFORE, $3); + } + ; + +delete_part2: + opt_delete_options single_multi {} + | HISTORY_SYM delete_single_table opt_delete_system_time + { + Lex->last_table()->vers_conditions= Lex->vers_conditions; + } + ; + +delete_single_table: + FROM table_ident opt_use_partition + { + if (unlikely(!Select-> + add_table_to_list(thd, $2, NULL, TL_OPTION_UPDATING, + YYPS->m_lock_type, + YYPS->m_mdl_type, + NULL, + $3))) + MYSQL_YYABORT; + YYPS->m_lock_type= TL_READ_DEFAULT; + YYPS->m_mdl_type= MDL_SHARED_READ; + } + ; + +single_multi: + delete_single_table + opt_where_clause + opt_order_clause + delete_limit_clause + opt_select_expressions {} + | table_wild_list + { + mysql_init_multi_delete(Lex); + YYPS->m_lock_type= TL_READ_DEFAULT; + YYPS->m_mdl_type= MDL_SHARED_READ; + } + FROM join_table_list opt_where_clause + { + if (unlikely(multi_delete_set_locks_and_link_aux_tables(Lex))) + MYSQL_YYABORT; + } + | FROM table_alias_ref_list + { + mysql_init_multi_delete(Lex); + YYPS->m_lock_type= TL_READ_DEFAULT; + YYPS->m_mdl_type= MDL_SHARED_READ; + } + USING join_table_list opt_where_clause + { + if (unlikely(multi_delete_set_locks_and_link_aux_tables(Lex))) + MYSQL_YYABORT; + } + ; + +opt_select_expressions: + /* empty */ + | RETURNING_SYM select_item_list + ; + +table_wild_list: + table_wild_one + | table_wild_list ',' table_wild_one + ; + +table_wild_one: + ident opt_wild + { + Table_ident *ti= new (thd->mem_root) Table_ident(&$1); + if (unlikely(ti == NULL)) + MYSQL_YYABORT; + if (unlikely(!Select-> + add_table_to_list(thd, + ti, + NULL, + (TL_OPTION_UPDATING | + TL_OPTION_ALIAS), + YYPS->m_lock_type, + YYPS->m_mdl_type))) + MYSQL_YYABORT; + } + | ident '.' ident opt_wild + { + Table_ident *ti= new (thd->mem_root) Table_ident(thd, &$1, &$3, 0); + if (unlikely(ti == NULL)) + MYSQL_YYABORT; + if (unlikely(!Select-> + add_table_to_list(thd, + ti, + NULL, + (TL_OPTION_UPDATING | + TL_OPTION_ALIAS), + YYPS->m_lock_type, + YYPS->m_mdl_type))) + MYSQL_YYABORT; + } + ; + +opt_wild: + /* empty */ {} + | '.' '*' {} + ; + +opt_delete_options: + /* empty */ {} + | opt_delete_option opt_delete_options {} + ; + +opt_delete_option: + QUICK { Select->options|= OPTION_QUICK; } + | LOW_PRIORITY { YYPS->m_lock_type= TL_WRITE_LOW_PRIORITY; } + | IGNORE_SYM { Lex->ignore= 1; } + ; + +truncate: + TRUNCATE_SYM + { + LEX* lex= Lex; + lex->sql_command= SQLCOM_TRUNCATE; + lex->alter_info.reset(); + lex->select_lex.options= 0; + lex->select_lex.sql_cache= SELECT_LEX::SQL_CACHE_UNSPECIFIED; + lex->select_lex.init_order(); + YYPS->m_lock_type= TL_WRITE; + YYPS->m_mdl_type= MDL_EXCLUSIVE; + } + opt_table_sym table_name opt_lock_wait_timeout + { + LEX* lex= thd->lex; + DBUG_ASSERT(!lex->m_sql_cmd); + lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_truncate_table(); + if (unlikely(lex->m_sql_cmd == NULL)) + MYSQL_YYABORT; + } + opt_truncate_table_storage_clause { } + ; + +opt_truncate_table_storage_clause: + /* Empty */ + | DROP STORAGE_SYM + | REUSE_SYM STORAGE_SYM + ; + +opt_table_sym: + /* empty */ + | TABLE_SYM + ; + +opt_profile_defs: + /* empty */ + | profile_defs; + +profile_defs: + profile_def + | profile_defs ',' profile_def; + +profile_def: + CPU_SYM + { + Lex->profile_options|= PROFILE_CPU; + } + | MEMORY_SYM + { + Lex->profile_options|= PROFILE_MEMORY; + } + | BLOCK_SYM IO_SYM + { + Lex->profile_options|= PROFILE_BLOCK_IO; + } + | CONTEXT_SYM SWITCHES_SYM + { + Lex->profile_options|= PROFILE_CONTEXT; + } + | PAGE_SYM FAULTS_SYM + { + Lex->profile_options|= PROFILE_PAGE_FAULTS; + } + | IPC_SYM + { + Lex->profile_options|= PROFILE_IPC; + } + | SWAPS_SYM + { + Lex->profile_options|= PROFILE_SWAPS; + } + | SOURCE_SYM + { + Lex->profile_options|= PROFILE_SOURCE; + } + | ALL + { + Lex->profile_options|= PROFILE_ALL; + } + ; + +opt_profile_args: + /* empty */ + { + Lex->profile_query_id= 0; + } + | FOR_SYM QUERY_SYM NUM + { + Lex->profile_query_id= atoi($3.str); + } + ; + +/* Show things */ + +show: + SHOW + { + LEX *lex=Lex; + lex->wild=0; + lex->ident= null_clex_str; + mysql_init_select(lex); + lex->current_select->parsing_place= SELECT_LIST; + lex->create_info.init(); + } + show_param + { + Select->parsing_place= NO_MATTER; + } + ; + +show_param: + DATABASES wild_and_where + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_DATABASES; + if (unlikely(prepare_schema_table(thd, lex, 0, SCH_SCHEMATA))) + MYSQL_YYABORT; + } + | opt_full TABLES opt_db wild_and_where + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_TABLES; + lex->select_lex.db= $3; + if (unlikely(prepare_schema_table(thd, lex, 0, SCH_TABLE_NAMES))) + MYSQL_YYABORT; + } + | opt_full TRIGGERS_SYM opt_db wild_and_where + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_TRIGGERS; + lex->select_lex.db= $3; + if (unlikely(prepare_schema_table(thd, lex, 0, SCH_TRIGGERS))) + MYSQL_YYABORT; + } + | EVENTS_SYM opt_db wild_and_where + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_EVENTS; + lex->select_lex.db= $2; + if (unlikely(prepare_schema_table(thd, lex, 0, SCH_EVENTS))) + MYSQL_YYABORT; + } + | TABLE_SYM STATUS_SYM opt_db wild_and_where + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_TABLE_STATUS; + lex->select_lex.db= $3; + if (unlikely(prepare_schema_table(thd, lex, 0, SCH_TABLES))) + MYSQL_YYABORT; + } + | OPEN_SYM TABLES opt_db wild_and_where + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_OPEN_TABLES; + lex->select_lex.db= $3; + if (unlikely(prepare_schema_table(thd, lex, 0, SCH_OPEN_TABLES))) + MYSQL_YYABORT; + } + | PLUGINS_SYM + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_PLUGINS; + if (unlikely(prepare_schema_table(thd, lex, 0, SCH_PLUGINS))) + MYSQL_YYABORT; + } + | PLUGINS_SYM SONAME_SYM TEXT_STRING_sys + { + Lex->ident= $3; + Lex->sql_command= SQLCOM_SHOW_PLUGINS; + if (unlikely(prepare_schema_table(thd, Lex, 0, SCH_ALL_PLUGINS))) + MYSQL_YYABORT; + } + | PLUGINS_SYM SONAME_SYM wild_and_where + { + Lex->sql_command= SQLCOM_SHOW_PLUGINS; + if (unlikely(prepare_schema_table(thd, Lex, 0, SCH_ALL_PLUGINS))) + MYSQL_YYABORT; + } + | ENGINE_SYM known_storage_engines show_engine_param + { Lex->create_info.db_type= $2; } + | ENGINE_SYM ALL show_engine_param + { Lex->create_info.db_type= NULL; } + | opt_full COLUMNS from_or_in table_ident opt_db wild_and_where + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_FIELDS; + if ($5.str) + $4->change_db(&$5); + if (unlikely(prepare_schema_table(thd, lex, $4, SCH_COLUMNS))) + MYSQL_YYABORT; + } + | master_or_binary LOGS_SYM + { + Lex->sql_command = SQLCOM_SHOW_BINLOGS; + } + | SLAVE HOSTS_SYM + { + Lex->sql_command = SQLCOM_SHOW_SLAVE_HOSTS; + } + | BINLOG_SYM EVENTS_SYM binlog_in binlog_from + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_BINLOG_EVENTS; + } + opt_limit_clause + | RELAYLOG_SYM optional_connection_name EVENTS_SYM binlog_in binlog_from + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_RELAYLOG_EVENTS; + } opt_limit_clause + | keys_or_index from_or_in table_ident opt_db opt_where_clause + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_KEYS; + if ($4.str) + $3->change_db(&$4); + if (unlikely(prepare_schema_table(thd, lex, $3, SCH_STATISTICS))) + MYSQL_YYABORT; + } + | opt_storage ENGINES_SYM + { + LEX *lex=Lex; + lex->sql_command= SQLCOM_SHOW_STORAGE_ENGINES; + if (unlikely(prepare_schema_table(thd, lex, 0, SCH_ENGINES))) + MYSQL_YYABORT; + } + | AUTHORS_SYM + { + LEX *lex=Lex; + lex->sql_command= SQLCOM_SHOW_AUTHORS; + } + | CONTRIBUTORS_SYM + { + LEX *lex=Lex; + lex->sql_command= SQLCOM_SHOW_CONTRIBUTORS; + } + | PRIVILEGES + { + LEX *lex=Lex; + lex->sql_command= SQLCOM_SHOW_PRIVILEGES; + } + | COUNT_SYM '(' '*' ')' WARNINGS + { + LEX_CSTRING var= {STRING_WITH_LEN("warning_count")}; + (void) create_select_for_variable(thd, &var); + } + | COUNT_SYM '(' '*' ')' ERRORS + { + LEX_CSTRING var= {STRING_WITH_LEN("error_count")}; + (void) create_select_for_variable(thd, &var); + } + | WARNINGS opt_limit_clause + { Lex->sql_command = SQLCOM_SHOW_WARNS;} + | ERRORS opt_limit_clause + { Lex->sql_command = SQLCOM_SHOW_ERRORS;} + | PROFILES_SYM + { Lex->sql_command = SQLCOM_SHOW_PROFILES; } + | PROFILE_SYM opt_profile_defs opt_profile_args opt_limit_clause + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_PROFILE; + if (unlikely(prepare_schema_table(thd, lex, NULL, SCH_PROFILES))) + MYSQL_YYABORT; + } + | opt_var_type STATUS_SYM wild_and_where + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_STATUS; + lex->option_type= $1; + if (unlikely(prepare_schema_table(thd, lex, 0, SCH_SESSION_STATUS))) + MYSQL_YYABORT; + } + | opt_full PROCESSLIST_SYM + { Lex->sql_command= SQLCOM_SHOW_PROCESSLIST;} + | opt_var_type VARIABLES wild_and_where + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_VARIABLES; + lex->option_type= $1; + if (unlikely(prepare_schema_table(thd, lex, 0, SCH_SESSION_VARIABLES))) + MYSQL_YYABORT; + } + | charset wild_and_where + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_CHARSETS; + if (unlikely(prepare_schema_table(thd, lex, 0, SCH_CHARSETS))) + MYSQL_YYABORT; + } + | COLLATION_SYM wild_and_where + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_COLLATIONS; + if (unlikely(prepare_schema_table(thd, lex, 0, SCH_COLLATIONS))) + MYSQL_YYABORT; + } + | GRANTS + { + Lex->sql_command= SQLCOM_SHOW_GRANTS; + if (unlikely(!(Lex->grant_user= + (LEX_USER*)thd->alloc(sizeof(LEX_USER))))) + MYSQL_YYABORT; + Lex->grant_user->user= current_user_and_current_role; + } + | GRANTS FOR_SYM user_or_role clear_privileges + { + LEX *lex=Lex; + lex->sql_command= SQLCOM_SHOW_GRANTS; + lex->grant_user=$3; + } + | CREATE DATABASE opt_if_not_exists ident + { + Lex->set_command(SQLCOM_SHOW_CREATE_DB, $3); + Lex->name= $4; + } + | CREATE TABLE_SYM table_ident + { + LEX *lex= Lex; + lex->sql_command = SQLCOM_SHOW_CREATE; + if (unlikely(!lex->select_lex.add_table_to_list(thd, $3, NULL,0))) + MYSQL_YYABORT; + lex->create_info.storage_media= HA_SM_DEFAULT; + } + | CREATE VIEW_SYM table_ident + { + LEX *lex= Lex; + lex->sql_command = SQLCOM_SHOW_CREATE; + if (unlikely(!lex->select_lex.add_table_to_list(thd, $3, NULL, 0))) + MYSQL_YYABORT; + lex->table_type= TABLE_TYPE_VIEW; + } + | CREATE SEQUENCE_SYM table_ident + { + LEX *lex= Lex; + lex->sql_command = SQLCOM_SHOW_CREATE; + if (unlikely(!lex->select_lex.add_table_to_list(thd, $3, NULL, 0))) + MYSQL_YYABORT; + lex->table_type= TABLE_TYPE_SEQUENCE; + } + | MASTER_SYM STATUS_SYM + { + Lex->sql_command = SQLCOM_SHOW_MASTER_STAT; + } + | ALL SLAVES STATUS_SYM + { + Lex->sql_command = SQLCOM_SHOW_SLAVE_STAT; + Lex->verbose= 1; + } + | SLAVE STATUS_SYM + { + LEX *lex= thd->lex; + lex->mi.connection_name= null_clex_str; + lex->sql_command = SQLCOM_SHOW_SLAVE_STAT; + lex->verbose= 0; + } + | SLAVE connection_name STATUS_SYM + { + Lex->sql_command = SQLCOM_SHOW_SLAVE_STAT; + Lex->verbose= 0; + } + | CREATE PROCEDURE_SYM sp_name + { + LEX *lex= Lex; + + lex->sql_command = SQLCOM_SHOW_CREATE_PROC; + lex->spname= $3; + } + | CREATE FUNCTION_SYM sp_name + { + LEX *lex= Lex; + + lex->sql_command = SQLCOM_SHOW_CREATE_FUNC; + lex->spname= $3; + } + | CREATE PACKAGE_ORACLE_SYM sp_name + { + LEX *lex= Lex; + lex->sql_command = SQLCOM_SHOW_CREATE_PACKAGE; + lex->spname= $3; + } + | CREATE PACKAGE_ORACLE_SYM BODY_ORACLE_SYM sp_name + { + LEX *lex= Lex; + lex->sql_command = SQLCOM_SHOW_CREATE_PACKAGE_BODY; + lex->spname= $4; + } + | CREATE TRIGGER_SYM sp_name + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_CREATE_TRIGGER; + lex->spname= $3; + } + | CREATE USER_SYM + { + Lex->sql_command= SQLCOM_SHOW_CREATE_USER; + if (unlikely(!(Lex->grant_user= + (LEX_USER*)thd->alloc(sizeof(LEX_USER))))) + MYSQL_YYABORT; + Lex->grant_user->user= current_user; + } + | CREATE USER_SYM user + { + Lex->sql_command= SQLCOM_SHOW_CREATE_USER; + Lex->grant_user= $3; + } + | PROCEDURE_SYM STATUS_SYM wild_and_where + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_STATUS_PROC; + if (unlikely(prepare_schema_table(thd, lex, 0, SCH_PROCEDURES))) + MYSQL_YYABORT; + } + | FUNCTION_SYM STATUS_SYM wild_and_where + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_STATUS_FUNC; + if (unlikely(prepare_schema_table(thd, lex, 0, SCH_PROCEDURES))) + MYSQL_YYABORT; + } + | PACKAGE_ORACLE_SYM STATUS_SYM wild_and_where + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_STATUS_PACKAGE; + if (unlikely(prepare_schema_table(thd, lex, 0, SCH_PROCEDURES))) + MYSQL_YYABORT; + } + | PACKAGE_ORACLE_SYM BODY_ORACLE_SYM STATUS_SYM wild_and_where + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_STATUS_PACKAGE_BODY; + if (unlikely(prepare_schema_table(thd, lex, 0, SCH_PROCEDURES))) + MYSQL_YYABORT; + } + | PROCEDURE_SYM CODE_SYM sp_name + { + Lex->sql_command= SQLCOM_SHOW_PROC_CODE; + Lex->spname= $3; + } + | FUNCTION_SYM CODE_SYM sp_name + { + Lex->sql_command= SQLCOM_SHOW_FUNC_CODE; + Lex->spname= $3; + } + | PACKAGE_ORACLE_SYM BODY_ORACLE_SYM CODE_SYM sp_name + { + Lex->sql_command= SQLCOM_SHOW_PACKAGE_BODY_CODE; + Lex->spname= $4; + } + | CREATE EVENT_SYM sp_name + { + Lex->spname= $3; + Lex->sql_command = SQLCOM_SHOW_CREATE_EVENT; + } + | describe_command FOR_SYM expr + { + Lex->sql_command= SQLCOM_SHOW_EXPLAIN; + if (unlikely(prepare_schema_table(thd, Lex, 0, SCH_EXPLAIN))) + MYSQL_YYABORT; + add_value_to_list(thd, $3); + } + | IDENT_sys remember_tok_start wild_and_where + { + LEX *lex= Lex; + bool in_plugin; + lex->sql_command= SQLCOM_SHOW_GENERIC; + ST_SCHEMA_TABLE *table= find_schema_table(thd, &$1, &in_plugin); + if (unlikely(!table || !table->old_format || !in_plugin)) + { + thd->parse_error(ER_SYNTAX_ERROR, $2); + MYSQL_YYABORT; + } + if (unlikely(lex->wild && table->idx_field1 < 0)) + { + thd->parse_error(ER_SYNTAX_ERROR, $3); + MYSQL_YYABORT; + } + if (unlikely(make_schema_select(thd, Lex->current_select, table))) + MYSQL_YYABORT; + } + ; + +show_engine_param: + STATUS_SYM + { Lex->sql_command= SQLCOM_SHOW_ENGINE_STATUS; } + | MUTEX_SYM + { Lex->sql_command= SQLCOM_SHOW_ENGINE_MUTEX; } + | LOGS_SYM + { Lex->sql_command= SQLCOM_SHOW_ENGINE_LOGS; } + ; + +master_or_binary: + MASTER_SYM + | BINARY + ; + +opt_storage: + /* empty */ + | STORAGE_SYM + ; + +opt_db: + /* empty */ { $$= null_clex_str; } + | from_or_in ident { $$= $2; } + ; + +opt_full: + /* empty */ { Lex->verbose=0; } + | FULL { Lex->verbose=1; } + ; + +from_or_in: + FROM + | IN_SYM + ; + +binlog_in: + /* empty */ { Lex->mi.log_file_name = 0; } + | IN_SYM TEXT_STRING_sys { Lex->mi.log_file_name = $2.str; } + ; + +binlog_from: + /* empty */ { Lex->mi.pos = 4; /* skip magic number */ } + | FROM ulonglong_num { Lex->mi.pos = $2; } + ; + +wild_and_where: + /* empty */ { $$= 0; } + | LIKE remember_tok_start TEXT_STRING_sys + { + Lex->wild= new (thd->mem_root) String($3.str, $3.length, + system_charset_info); + if (unlikely(Lex->wild == NULL)) + MYSQL_YYABORT; + $$= $2; + } + | WHERE remember_tok_start expr + { + Select->where= normalize_cond(thd, $3); + if ($3) + $3->top_level_item(); + $$= $2; + } + ; + +/* A Oracle compatible synonym for show */ +describe: + describe_command table_ident + { + LEX *lex= Lex; + mysql_init_select(lex); + lex->current_select->parsing_place= SELECT_LIST; + lex->sql_command= SQLCOM_SHOW_FIELDS; + lex->select_lex.db= null_clex_str; + lex->verbose= 0; + if (unlikely(prepare_schema_table(thd, lex, $2, SCH_COLUMNS))) + MYSQL_YYABORT; + } + opt_describe_column + { + Select->parsing_place= NO_MATTER; + } + | describe_command opt_extended_describe + { Lex->describe|= DESCRIBE_NORMAL; } + explainable_command + { + LEX *lex=Lex; + lex->select_lex.options|= SELECT_DESCRIBE; + } + ; + +explainable_command: + select + | insert + | replace + | update + | delete + ; + +describe_command: + DESC + | DESCRIBE + ; + +analyze_stmt_command: + ANALYZE_SYM opt_format_json explainable_command + { + Lex->analyze_stmt= true; + } + ; + +opt_extended_describe: + EXTENDED_SYM { Lex->describe|= DESCRIBE_EXTENDED; } + | PARTITIONS_SYM { Lex->describe|= DESCRIBE_PARTITIONS; } + | opt_format_json {} + ; + +opt_format_json: + /* empty */ {} + | FORMAT_SYM '=' ident_or_text + { + if (lex_string_eq(&$3, STRING_WITH_LEN("JSON"))) + Lex->explain_json= true; + else if (lex_string_eq(&$3, STRING_WITH_LEN("TRADITIONAL"))) + DBUG_ASSERT(Lex->explain_json==false); + else + my_yyabort_error((ER_UNKNOWN_EXPLAIN_FORMAT, MYF(0), "EXPLAIN", + $3.str)); + } + ; + +opt_describe_column: + /* empty */ {} + | text_string { Lex->wild= $1; } + | ident + { + Lex->wild= new (thd->mem_root) String((const char*) $1.str, + $1.length, + system_charset_info); + if (unlikely(Lex->wild == NULL)) + MYSQL_YYABORT; + } + ; + + +/* flush things */ + +flush: + FLUSH_SYM opt_no_write_to_binlog + { + LEX *lex=Lex; + lex->sql_command= SQLCOM_FLUSH; + lex->type= 0; + lex->no_write_to_binlog= $2; + } + flush_options + {} + ; + +flush_options: + table_or_tables + { + Lex->type|= REFRESH_TABLES; + /* + Set type of metadata and table locks for + FLUSH TABLES table_list [WITH READ LOCK]. + */ + YYPS->m_lock_type= TL_READ_NO_INSERT; + YYPS->m_mdl_type= MDL_SHARED_HIGH_PRIO; + } + opt_table_list opt_flush_lock + {} + | flush_options_list + ; + +opt_flush_lock: + /* empty */ {} + | flush_lock + { + TABLE_LIST *tables= Lex->query_tables; + for (; tables; tables= tables->next_global) + { + tables->mdl_request.set_type(MDL_SHARED_NO_WRITE); + /* Don't try to flush views. */ + tables->required_type= TABLE_TYPE_NORMAL; + /* Ignore temporary tables. */ + tables->open_type= OT_BASE_ONLY; + } + } + ; + +flush_lock: + WITH READ_SYM LOCK_SYM optional_flush_tables_arguments + { Lex->type|= REFRESH_READ_LOCK | $4; } + | FOR_SYM + { + if (unlikely(Lex->query_tables == NULL)) + { + // Table list can't be empty + thd->parse_error(ER_NO_TABLES_USED); + MYSQL_YYABORT; + } + Lex->type|= REFRESH_FOR_EXPORT; + } EXPORT_SYM {} + ; + +flush_options_list: + flush_options_list ',' flush_option + | flush_option + {} + ; + +flush_option: + ERROR_SYM LOGS_SYM + { Lex->type|= REFRESH_ERROR_LOG; } + | ENGINE_SYM LOGS_SYM + { Lex->type|= REFRESH_ENGINE_LOG; } + | GENERAL LOGS_SYM + { Lex->type|= REFRESH_GENERAL_LOG; } + | SLOW LOGS_SYM + { Lex->type|= REFRESH_SLOW_LOG; } + | BINARY LOGS_SYM opt_delete_gtid_domain + { Lex->type|= REFRESH_BINARY_LOG; } + | RELAY LOGS_SYM optional_connection_name + { + LEX *lex= Lex; + if (unlikely(lex->type & REFRESH_RELAY_LOG)) + my_yyabort_error((ER_WRONG_USAGE, MYF(0), "FLUSH", "RELAY LOGS")); + lex->type|= REFRESH_RELAY_LOG; + lex->relay_log_connection_name= lex->mi.connection_name; + } + | QUERY_SYM CACHE_SYM + { Lex->type|= REFRESH_QUERY_CACHE_FREE; } + | HOSTS_SYM + { Lex->type|= REFRESH_HOSTS; } + | PRIVILEGES + { Lex->type|= REFRESH_GRANT; } + | LOGS_SYM + { + Lex->type|= REFRESH_LOG; + Lex->relay_log_connection_name= empty_clex_str; + } + | STATUS_SYM + { Lex->type|= REFRESH_STATUS; } + | SLAVE optional_connection_name + { + LEX *lex= Lex; + if (unlikely(lex->type & REFRESH_SLAVE)) + my_yyabort_error((ER_WRONG_USAGE, MYF(0), "FLUSH","SLAVE")); + lex->type|= REFRESH_SLAVE; + lex->reset_slave_info.all= false; + } + | MASTER_SYM + { Lex->type|= REFRESH_MASTER; } + | DES_KEY_FILE + { Lex->type|= REFRESH_DES_KEY_FILE; } + | RESOURCES + { Lex->type|= REFRESH_USER_RESOURCES; } + | IDENT_sys remember_tok_start + { + Lex->type|= REFRESH_GENERIC; + ST_SCHEMA_TABLE *table= find_schema_table(thd, &$1); + if (unlikely(!table || !table->reset_table)) + { + thd->parse_error(ER_SYNTAX_ERROR, $2); + MYSQL_YYABORT; + } + if (unlikely(Lex->view_list.push_back((LEX_CSTRING*) + thd->memdup(&$1, sizeof(LEX_CSTRING)), + thd->mem_root))) + MYSQL_YYABORT; + } + ; + +opt_table_list: + /* empty */ {} + | table_list {} + ; + +opt_delete_gtid_domain: + /* empty */ {} + | DELETE_DOMAIN_ID_SYM '=' '(' delete_domain_id_list ')' + {} + ; +delete_domain_id_list: + /* Empty */ + | delete_domain_id + | delete_domain_id_list ',' delete_domain_id + ; + +delete_domain_id: + ulonglong_num + { + uint32 value= (uint32) $1; + if ($1 > UINT_MAX32) + { + my_printf_error(ER_BINLOG_CANT_DELETE_GTID_DOMAIN, + "The value of gtid domain being deleted ('%llu') " + "exceeds its maximum size " + "of 32 bit unsigned integer", MYF(0), $1); + MYSQL_YYABORT; + } + insert_dynamic(&Lex->delete_gtid_domain, (uchar*) &value); + } + ; + +optional_flush_tables_arguments: + /* empty */ {$$= 0;} + | AND_SYM DISABLE_SYM CHECKPOINT_SYM {$$= REFRESH_CHECKPOINT; } + +reset: + RESET_SYM + { + LEX *lex=Lex; + lex->sql_command= SQLCOM_RESET; lex->type=0; + } + reset_options + {} + ; + +reset_options: + reset_options ',' reset_option + | reset_option + ; + +reset_option: + SLAVE { Lex->type|= REFRESH_SLAVE; } + optional_connection_name + slave_reset_options { } + | MASTER_SYM + { + Lex->type|= REFRESH_MASTER; + Lex->next_binlog_file_number= 0; + } + master_reset_options + | QUERY_SYM CACHE_SYM { Lex->type|= REFRESH_QUERY_CACHE;} + ; + +slave_reset_options: + /* empty */ { Lex->reset_slave_info.all= false; } + | ALL { Lex->reset_slave_info.all= true; } + ; + +master_reset_options: + /* empty */ {} + | TO_SYM ulong_num + { + Lex->next_binlog_file_number = $2; + } + ; + +purge: + PURGE + { + LEX *lex=Lex; + lex->type=0; + lex->sql_command = SQLCOM_PURGE; + } + purge_options + {} + ; + +purge_options: + master_or_binary LOGS_SYM purge_option + ; + +purge_option: + TO_SYM TEXT_STRING_sys + { + Lex->to_log = $2.str; + } + | BEFORE_SYM expr + { + LEX *lex= Lex; + lex->value_list.empty(); + lex->value_list.push_front($2, thd->mem_root); + lex->sql_command= SQLCOM_PURGE_BEFORE; + } + ; + +/* kill threads */ + +kill: + KILL_SYM + { + LEX *lex=Lex; + lex->value_list.empty(); + lex->users_list.empty(); + lex->sql_command= SQLCOM_KILL; + lex->kill_type= KILL_TYPE_ID; + } + kill_type kill_option kill_expr + { + Lex->kill_signal= (killed_state) ($3 | $4); + } + ; + +kill_type: + /* Empty */ { $$= (int) KILL_HARD_BIT; } + | HARD_SYM { $$= (int) KILL_HARD_BIT; } + | SOFT_SYM { $$= 0; } + +kill_option: + /* empty */ { $$= (int) KILL_CONNECTION; } + | CONNECTION_SYM { $$= (int) KILL_CONNECTION; } + | QUERY_SYM { $$= (int) KILL_QUERY; } + | QUERY_SYM ID_SYM + { + $$= (int) KILL_QUERY; + Lex->kill_type= KILL_TYPE_QUERY; + } + ; + +kill_expr: + expr + { + Lex->value_list.push_front($$, thd->mem_root); + } + | USER_SYM user + { + Lex->users_list.push_back($2, thd->mem_root); + Lex->kill_type= KILL_TYPE_USER; + } + ; + + +shutdown: + SHUTDOWN { Lex->sql_command= SQLCOM_SHUTDOWN; } + ; + +/* change database */ + +use: + USE_SYM ident + { + LEX *lex=Lex; + lex->sql_command=SQLCOM_CHANGE_DB; + lex->select_lex.db= $2; + } + ; + +/* import, export of files */ + +load: + LOAD data_or_xml + { + LEX *lex= thd->lex; + + if (unlikely(lex->sphead)) + { + my_error(ER_SP_BADSTATEMENT, MYF(0), + $2 == FILETYPE_CSV ? "LOAD DATA" : "LOAD XML"); + MYSQL_YYABORT; + } + } + load_data_lock opt_local INFILE TEXT_STRING_filesystem + { + LEX *lex=Lex; + lex->sql_command= SQLCOM_LOAD; + lex->local_file= $5; + lex->duplicates= DUP_ERROR; + lex->ignore= 0; + if (unlikely(!(lex->exchange= new (thd->mem_root) + sql_exchange($7.str, 0, $2)))) + MYSQL_YYABORT; + } + opt_duplicate INTO TABLE_SYM table_ident opt_use_partition + { + LEX *lex=Lex; + if (unlikely(!Select->add_table_to_list(thd, $12, NULL, + TL_OPTION_UPDATING, + $4, MDL_SHARED_WRITE, + NULL, $13))) + MYSQL_YYABORT; + lex->field_list.empty(); + lex->update_list.empty(); + lex->value_list.empty(); + lex->many_values.empty(); + } + opt_load_data_charset + { Lex->exchange->cs= $15; } + opt_xml_rows_identified_by + opt_field_term opt_line_term opt_ignore_lines opt_field_or_var_spec + opt_load_data_set_spec + {} + ; + +data_or_xml: + DATA_SYM { $$= FILETYPE_CSV; } + | XML_SYM { $$= FILETYPE_XML; } + ; + +opt_local: + /* empty */ { $$=0;} + | LOCAL_SYM { $$=1;} + ; + +load_data_lock: + /* empty */ { $$= TL_WRITE_DEFAULT; } + | CONCURRENT + { + /* + Ignore this option in SP to avoid problem with query cache and + triggers with non default priority locks + */ + $$= (Lex->sphead ? TL_WRITE_DEFAULT : TL_WRITE_CONCURRENT_INSERT); + } + | LOW_PRIORITY { $$= TL_WRITE_LOW_PRIORITY; } + ; + +opt_duplicate: + /* empty */ { Lex->duplicates=DUP_ERROR; } + | REPLACE { Lex->duplicates=DUP_REPLACE; } + | IGNORE_SYM { Lex->ignore= 1; } + ; + +opt_field_term: + /* empty */ + | COLUMNS field_term_list + ; + +field_term_list: + field_term_list field_term + | field_term + ; + +field_term: + TERMINATED BY text_string + { + DBUG_ASSERT(Lex->exchange != 0); + Lex->exchange->field_term= $3; + } + | OPTIONALLY ENCLOSED BY text_string + { + LEX *lex= Lex; + DBUG_ASSERT(lex->exchange != 0); + lex->exchange->enclosed= $4; + lex->exchange->opt_enclosed= 1; + } + | ENCLOSED BY text_string + { + DBUG_ASSERT(Lex->exchange != 0); + Lex->exchange->enclosed= $3; + } + | ESCAPED BY text_string + { + DBUG_ASSERT(Lex->exchange != 0); + Lex->exchange->escaped= $3; + } + ; + +opt_line_term: + /* empty */ + | LINES line_term_list + ; + +line_term_list: + line_term_list line_term + | line_term + ; + +line_term: + TERMINATED BY text_string + { + DBUG_ASSERT(Lex->exchange != 0); + Lex->exchange->line_term= $3; + } + | STARTING BY text_string + { + DBUG_ASSERT(Lex->exchange != 0); + Lex->exchange->line_start= $3; + } + ; + +opt_xml_rows_identified_by: + /* empty */ { } + | ROWS_SYM IDENTIFIED_SYM BY text_string + { Lex->exchange->line_term = $4; }; + +opt_ignore_lines: + /* empty */ + | IGNORE_SYM NUM lines_or_rows + { + DBUG_ASSERT(Lex->exchange != 0); + Lex->exchange->skip_lines= atol($2.str); + } + ; + +lines_or_rows: + LINES { } + | ROWS_SYM { } + ; + +opt_field_or_var_spec: + /* empty */ {} + | '(' fields_or_vars ')' {} + | '(' ')' {} + ; + +fields_or_vars: + fields_or_vars ',' field_or_var + { Lex->field_list.push_back($3, thd->mem_root); } + | field_or_var + { Lex->field_list.push_back($1, thd->mem_root); } + ; + +field_or_var: + simple_ident_nospvar {$$= $1;} + | '@' ident_or_text + { + $$= new (thd->mem_root) Item_user_var_as_out_param(thd, &$2); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + +opt_load_data_set_spec: + /* empty */ {} + | SET load_data_set_list {} + ; + +load_data_set_list: + load_data_set_list ',' load_data_set_elem + | load_data_set_elem + ; + +load_data_set_elem: + simple_ident_nospvar equal remember_name expr_or_default remember_end + { + LEX *lex= Lex; + if (unlikely(lex->update_list.push_back($1, thd->mem_root)) || + unlikely(lex->value_list.push_back($4, thd->mem_root))) + MYSQL_YYABORT; + $4->set_name_no_truncate(thd, $3, (uint) ($5 - $3), thd->charset()); + } + ; + +/* Common definitions */ + +text_literal: + TEXT_STRING + { + if (unlikely(!($$= thd->make_string_literal($1)))) + MYSQL_YYABORT; + } + | NCHAR_STRING + { + if (unlikely(!($$= thd->make_string_literal_nchar($1)))) + MYSQL_YYABORT; + } + | UNDERSCORE_CHARSET TEXT_STRING + { + if (unlikely(!($$= thd->make_string_literal_charset($2, $1)))) + MYSQL_YYABORT; + } + | text_literal TEXT_STRING_literal + { + if (unlikely(!($$= $1->make_string_literal_concat(thd, &$2)))) + MYSQL_YYABORT; + } + ; + +text_string: + TEXT_STRING_literal + { + $$= new (thd->mem_root) String($1.str, + $1.length, + thd->variables.collation_connection); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | hex_or_bin_String { $$= $1; } + ; + + +hex_or_bin_String: + HEX_NUM + { + Item *tmp= new (thd->mem_root) Item_hex_hybrid(thd, $1.str, + $1.length); + if (unlikely(tmp == NULL)) + MYSQL_YYABORT; + /* + it is OK only emulate fix_fields, because we need only + value of constant + */ + tmp->quick_fix_field(); + $$= tmp->val_str((String*) 0); + } + | HEX_STRING + { + Item *tmp= new (thd->mem_root) Item_hex_string(thd, $1.str, + $1.length); + if (unlikely(tmp == NULL)) + MYSQL_YYABORT; + tmp->quick_fix_field(); + $$= tmp->val_str((String*) 0); + } + | BIN_NUM + { + Item *tmp= new (thd->mem_root) Item_bin_string(thd, $1.str, + $1.length); + if (unlikely(tmp == NULL)) + MYSQL_YYABORT; + /* + it is OK only emulate fix_fields, because we need only + value of constant + */ + tmp->quick_fix_field(); + $$= tmp->val_str((String*) 0); + } + ; + +param_marker: + PARAM_MARKER + { + if (unlikely(!($$= Lex->add_placeholder(thd, ¶m_clex_str, + YYLIP->get_tok_start(), + YYLIP->get_tok_start() + 1)))) + MYSQL_YYABORT; + } + | COLON_ORACLE_SYM ident_cli + { + if (unlikely(!($$= Lex->add_placeholder(thd, &null_clex_str, + $1.pos(), $2.end())))) + MYSQL_YYABORT; + } + | COLON_ORACLE_SYM NUM + { + if (unlikely(!($$= Lex->add_placeholder(thd, &null_clex_str, + $1.pos(), + YYLIP->get_ptr())))) + MYSQL_YYABORT; + } + ; + +signed_literal: + '+' NUM_literal { $$ = $2; } + | '-' NUM_literal + { + $2->max_length++; + $$= $2->neg(thd); + } + ; + +literal: + text_literal { $$ = $1; } + | NUM_literal { $$ = $1; } + | temporal_literal { $$= $1; } + | NULL_SYM + { + /* + For the digest computation, in this context only, + NULL is considered a literal, hence reduced to '?' + REDUCE: + TOK_GENERIC_VALUE := NULL_SYM + */ + YYLIP->reduce_digest_token(TOK_GENERIC_VALUE, NULL_SYM); + $$= new (thd->mem_root) Item_null(thd); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + YYLIP->next_state= MY_LEX_OPERATOR_OR_IDENT; + } + | FALSE_SYM + { + $$= new (thd->mem_root) Item_bool(thd, (char*) "FALSE",0); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | TRUE_SYM + { + $$= new (thd->mem_root) Item_bool(thd, (char*) "TRUE",1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | HEX_NUM + { + $$= new (thd->mem_root) Item_hex_hybrid(thd, $1.str, $1.length); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | HEX_STRING + { + $$= new (thd->mem_root) Item_hex_string(thd, $1.str, $1.length); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | BIN_NUM + { + $$= new (thd->mem_root) Item_bin_string(thd, $1.str, $1.length); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | UNDERSCORE_CHARSET hex_or_bin_String + { + Item_string_with_introducer *item_str; + /* + Pass NULL as name. Name will be set in the "select_item" rule and + will include the introducer and the original hex/bin notation. + */ + item_str= new (thd->mem_root) + Item_string_with_introducer(thd, NULL, $2->ptr(), $2->length(), + $1); + if (unlikely(!item_str || + !item_str->check_well_formed_result(true))) + MYSQL_YYABORT; + + $$= item_str; + } + ; + +NUM_literal: + NUM + { + int error; + $$= new (thd->mem_root) + Item_int(thd, $1.str, + (longlong) my_strtoll10($1.str, NULL, &error), + $1.length); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | LONG_NUM + { + int error; + $$= new (thd->mem_root) + Item_int(thd, $1.str, + (longlong) my_strtoll10($1.str, NULL, &error), + $1.length); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | ULONGLONG_NUM + { + $$= new (thd->mem_root) Item_uint(thd, $1.str, $1.length); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | DECIMAL_NUM + { + $$= new (thd->mem_root) Item_decimal(thd, $1.str, $1.length, + thd->charset()); + if (unlikely($$ == NULL) || unlikely(thd->is_error())) + MYSQL_YYABORT; + } + | FLOAT_NUM + { + $$= new (thd->mem_root) Item_float(thd, $1.str, $1.length); + if (unlikely($$ == NULL) || unlikely(thd->is_error())) + MYSQL_YYABORT; + } + ; + + +temporal_literal: + DATE_SYM TEXT_STRING + { + if (unlikely(!($$= create_temporal_literal(thd, $2.str, $2.length, + YYCSCL, + MYSQL_TYPE_DATE, + true)))) + MYSQL_YYABORT; + } + | TIME_SYM TEXT_STRING + { + if (unlikely(!($$= create_temporal_literal(thd, $2.str, $2.length, + YYCSCL, + MYSQL_TYPE_TIME, + true)))) + MYSQL_YYABORT; + } + | TIMESTAMP TEXT_STRING + { + if (unlikely(!($$= create_temporal_literal(thd, $2.str, $2.length, + YYCSCL, + MYSQL_TYPE_DATETIME, + true)))) + MYSQL_YYABORT; + } + ; + + +opt_with_clause: + /*empty */ { $$= 0; } + | with_clause + { + $$= $1; + } + ; + + +with_clause: + WITH opt_recursive + { + With_clause *with_clause= + new With_clause($2, Lex->curr_with_clause); + if (unlikely(with_clause == NULL)) + MYSQL_YYABORT; + Lex->derived_tables|= DERIVED_WITH; + Lex->curr_with_clause= with_clause; + with_clause->add_to_list(Lex->with_clauses_list_last_next); + } + with_list + { + $$= Lex->curr_with_clause; + Lex->curr_with_clause= Lex->curr_with_clause->pop(); + } + ; + + +opt_recursive: + /*empty*/ { $$= 0; } + | RECURSIVE_SYM { $$= 1; } + ; + + +with_list: + with_list_element + | with_list ',' with_list_element + ; + + +with_list_element: + query_name + opt_with_column_list + { + $2= new List<LEX_CSTRING> (Lex->with_column_list); + if (unlikely($2 == NULL)) + MYSQL_YYABORT; + Lex->with_column_list.empty(); + } + AS '(' remember_tok_start subselect remember_tok_end ')' + { + LEX *lex= thd->lex; + const char *query_start= lex->sphead ? lex->sphead->m_tmp_query + : thd->query(); + char *spec_start= $6 + 1; + With_element *elem= new With_element($1, *$2, $7->master_unit()); + if (unlikely(elem == NULL) || + unlikely(Lex->curr_with_clause->add_with_element(elem))) + MYSQL_YYABORT; + if (elem->set_unparsed_spec(thd, spec_start, $8, + spec_start - query_start)) + MYSQL_YYABORT; + } + ; + + +opt_with_column_list: + /* empty */ + { $$= NULL; } + | '(' with_column_list ')' + { $$= NULL; } + ; + + +with_column_list: + ident + { + Lex->with_column_list.push_back((LEX_CSTRING*) + thd->memdup(&$1, sizeof(LEX_CSTRING))); + } + | with_column_list ',' ident + { + Lex->with_column_list.push_back((LEX_CSTRING*) + thd->memdup(&$3, sizeof(LEX_CSTRING))); + } + ; + + +query_name: + ident + { + $$= (LEX_CSTRING *) thd->memdup(&$1, sizeof(LEX_CSTRING)); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + + + +/********************************************************************** +** Creating different items. +**********************************************************************/ + +insert_ident: + simple_ident_nospvar { $$=$1; } + | table_wild { $$=$1; } + ; + +table_wild: + ident '.' '*' + { + if (unlikely(!($$= Lex->create_item_qualified_asterisk(thd, &$1)))) + MYSQL_YYABORT; + } + | ident '.' ident '.' '*' + { + if (unlikely(!($$= Lex->create_item_qualified_asterisk(thd, &$1, &$3)))) + MYSQL_YYABORT; + } + ; + +select_sublist_qualified_asterisk: + ident_cli '.' '*' + { + if (unlikely(!($$= Lex->create_item_qualified_asterisk(thd, &$1)))) + MYSQL_YYABORT; + } + | ident_cli '.' ident_cli '.' '*' + { + if (unlikely(!($$= Lex->create_item_qualified_asterisk(thd, &$1, &$3)))) + MYSQL_YYABORT; + } + ; + +order_ident: + expr { $$=$1; } + ; + + +simple_ident: + ident_cli + { + if (unlikely(!($$= Lex->create_item_ident(thd, &$1)))) + MYSQL_YYABORT; + } + | ident_cli '.' ident_cli + { + if (unlikely(!($$= Lex->create_item_ident(thd, &$1, &$3)))) + MYSQL_YYABORT; + } + | '.' ident_cli '.' ident_cli + { + Lex_ident_cli empty($2.pos(), 0); + if (unlikely(!($$= Lex->create_item_ident(thd, &empty, &$2, &$4)))) + MYSQL_YYABORT; + } + | ident_cli '.' ident_cli '.' ident_cli + { + if (unlikely(!($$= Lex->create_item_ident(thd, &$1, &$3, &$5)))) + MYSQL_YYABORT; + } + | COLON_ORACLE_SYM ident_cli '.' ident_cli + { + if (unlikely(!($$= Lex->make_item_colon_ident_ident(thd, &$2, &$4)))) + MYSQL_YYABORT; + } + ; + +simple_ident_nospvar: + ident + { + if (unlikely(!($$= Lex->create_item_ident_nosp(thd, &$1)))) + MYSQL_YYABORT; + } + | ident '.' ident + { + if (unlikely(!($$= Lex->create_item_ident_nospvar(thd, &$1, &$3)))) + MYSQL_YYABORT; + } + | COLON_ORACLE_SYM ident_cli '.' ident_cli + { + if (unlikely(!($$= Lex->make_item_colon_ident_ident(thd, &$2, &$4)))) + MYSQL_YYABORT; + } + | '.' ident '.' ident + { + Lex_ident_sys none; + if (unlikely(!($$= Lex->create_item_ident(thd, &none, &$2, &$4)))) + MYSQL_YYABORT; + } + | ident '.' ident '.' ident + { + if (unlikely(!($$= Lex->create_item_ident(thd, &$1, &$3, &$5)))) + MYSQL_YYABORT; + } + ; + +field_ident: + ident { $$=$1;} + | ident '.' ident '.' ident + { + TABLE_LIST *table= Select->table_list.first; + if (unlikely(my_strcasecmp(table_alias_charset, $1.str, + table->db.str))) + my_yyabort_error((ER_WRONG_DB_NAME, MYF(0), $1.str)); + if (unlikely(my_strcasecmp(table_alias_charset, $3.str, + table->table_name.str))) + my_yyabort_error((ER_WRONG_TABLE_NAME, MYF(0), $3.str)); + $$=$5; + } + | ident '.' ident + { + TABLE_LIST *table= Select->table_list.first; + if (unlikely(my_strcasecmp(table_alias_charset, $1.str, + table->alias.str))) + my_yyabort_error((ER_WRONG_TABLE_NAME, MYF(0), $1.str)); + $$=$3; + } + | '.' ident { $$=$2;} /* For Delphi */ + ; + +table_ident: + ident + { + $$= new (thd->mem_root) Table_ident(&$1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | ident '.' ident + { + $$= new (thd->mem_root) Table_ident(thd, &$1, &$3, 0); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | '.' ident + { + /* For Delphi */ + $$= new (thd->mem_root) Table_ident(&$2); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + +table_ident_opt_wild: + ident opt_wild + { + $$= new (thd->mem_root) Table_ident(&$1); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | ident '.' ident opt_wild + { + $$= new (thd->mem_root) Table_ident(thd, &$1, &$3, 0); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + +table_ident_nodb: + ident + { + LEX_CSTRING db={(char*) any_db,3}; + $$= new (thd->mem_root) Table_ident(thd, &db, &$1, 0); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + +IDENT_cli: + IDENT + | IDENT_QUOTED + ; + +ident_cli: + IDENT + | IDENT_QUOTED + | keyword_ident { $$= $1; } + ; + +IDENT_sys: + IDENT_cli + { + if (unlikely(thd->to_ident_sys_alloc(&$$, &$1))) + MYSQL_YYABORT; + } + ; + +TEXT_STRING_sys: + TEXT_STRING + { + if (thd->make_text_string_sys(&$$, &$1)) + MYSQL_YYABORT; + } + ; + +TEXT_STRING_literal: + TEXT_STRING + { + if (thd->make_text_string_connection(&$$, &$1)) + MYSQL_YYABORT; + } + ; + +TEXT_STRING_filesystem: + TEXT_STRING + { + if (thd->make_text_string_filesystem(&$$, &$1)) + MYSQL_YYABORT; + } + ; + +ident_table_alias: + IDENT_sys + | keyword_table_alias + { + if (unlikely($$.copy_keyword(thd, &$1))) + MYSQL_YYABORT; + } + ; + +ident_set_usual_case: + IDENT_sys + | keyword_set_usual_case + { + if (unlikely($$.copy_keyword(thd, &$1))) + MYSQL_YYABORT; + } + ; + +ident_sysvar_name: + IDENT_sys + | keyword_sysvar_name + { + if (unlikely($$.copy_keyword(thd, &$1))) + MYSQL_YYABORT; + } + | TEXT_STRING_sys + { + if (unlikely($$.copy_sys(thd, &$1))) + MYSQL_YYABORT; + } + ; + + +ident: + IDENT_sys + | keyword_ident + { + if (unlikely($$.copy_keyword(thd, &$1))) + MYSQL_YYABORT; + } + ; + +ident_directly_assignable: + IDENT_sys + | keyword_directly_assignable + { + if (unlikely($$.copy_keyword(thd, &$1))) + MYSQL_YYABORT; + } + ; + + +label_ident: + IDENT_sys + | keyword_label + { + if (unlikely($$.copy_keyword(thd, &$1))) + MYSQL_YYABORT; + } + ; + +labels_declaration_oracle: + label_declaration_oracle { $$= $1; } + | labels_declaration_oracle label_declaration_oracle { $$= $2; } + ; + +label_declaration_oracle: + SHIFT_LEFT label_ident SHIFT_RIGHT + { + if (unlikely(Lex->sp_push_goto_label(thd, &$2))) + MYSQL_YYABORT; + $$= $2; + } + ; + +ident_or_text: + ident { $$=$1;} + | TEXT_STRING_sys { $$=$1;} + | LEX_HOSTNAME { $$=$1;} + ; + +user_maybe_role: + ident_or_text + { + if (unlikely(!($$=(LEX_USER*) thd->alloc(sizeof(LEX_USER))))) + MYSQL_YYABORT; + $$->user = $1; + $$->host= null_clex_str; // User or Role, see get_current_user() + $$->reset_auth(); + + if (unlikely(check_string_char_length(&$$->user, ER_USERNAME, + username_char_length, + system_charset_info, 0))) + MYSQL_YYABORT; + } + | ident_or_text '@' ident_or_text + { + if (unlikely(!($$=(LEX_USER*) thd->alloc(sizeof(LEX_USER))))) + MYSQL_YYABORT; + $$->user = $1; $$->host=$3; + $$->reset_auth(); + + if (unlikely(check_string_char_length(&$$->user, ER_USERNAME, + username_char_length, + system_charset_info, 0)) || + unlikely(check_host_name(&$$->host))) + MYSQL_YYABORT; + if ($$->host.str[0]) + { + /* + Convert hostname part of username to lowercase. + It's OK to use in-place lowercase as long as + the character set is utf8. + */ + my_casedn_str(system_charset_info, (char*) $$->host.str); + } + else + { + /* + fix historical undocumented convention that empty host is the + same as '%' + */ + $$->host= host_not_specified; + } + } + | CURRENT_USER optional_braces + { + if (unlikely(!($$=(LEX_USER*)thd->calloc(sizeof(LEX_USER))))) + MYSQL_YYABORT; + $$->user= current_user; + $$->plugin= empty_clex_str; + $$->auth= empty_clex_str; + } + ; + +user_or_role: user_maybe_role | current_role; + +user: user_maybe_role + { + if ($1->user.str != current_user.str && $1->host.str == 0) + $1->host= host_not_specified; + $$= $1; + } + ; + +/* Keywords which we allow as table aliases. */ +keyword_table_alias: + keyword_data_type + | keyword_set_special_case + | keyword_sp_block_section + | keyword_sp_head + | keyword_sp_var_and_label + | keyword_sp_var_not_label + | keyword_sysvar_type + | keyword_verb_clause + | FUNCTION_SYM + ; + +/* Keyword that we allow for identifiers (except SP labels) */ +keyword_ident: + keyword_data_type + | keyword_set_special_case + | keyword_sp_block_section + | keyword_sp_head + | keyword_sp_var_and_label + | keyword_sp_var_not_label + | keyword_sysvar_type + | keyword_verb_clause + | FUNCTION_SYM + | WINDOW_SYM + ; + +/* + Keywords that we allow for labels in SPs. + Should not include keywords that start a statement or SP characteristics. +*/ +keyword_label: + keyword_data_type + | keyword_set_special_case + | keyword_sp_var_and_label + | keyword_sysvar_type + | FUNCTION_SYM + ; + +keyword_sysvar_name: + keyword_data_type + | keyword_set_special_case + | keyword_sp_block_section + | keyword_sp_head + | keyword_sp_var_and_label + | keyword_sp_var_not_label + | keyword_verb_clause + | FUNCTION_SYM + | WINDOW_SYM + ; + +keyword_sp_decl: + keyword_sp_head + | keyword_set_special_case + | keyword_sp_var_and_label + | keyword_sp_var_not_label + | keyword_sysvar_type + | keyword_verb_clause + | WINDOW_SYM + ; + +keyword_set_usual_case: + keyword_data_type + | keyword_sp_block_section + | keyword_sp_head + | keyword_sp_var_and_label + | keyword_sp_var_not_label + | keyword_sysvar_type + | keyword_verb_clause + | FUNCTION_SYM + | WINDOW_SYM + ; + +keyword_directly_assignable: + keyword_data_type + | keyword_set_special_case + | keyword_sp_var_and_label + | keyword_sp_var_not_label + | keyword_sysvar_type + | FUNCTION_SYM + | WINDOW_SYM + ; + +/* + Keywords that we allow in Oracle-style direct assignments: + xxx := 10; + but do not allow in labels in the default sql_mode: + label: + stmt1; + stmt2; + TODO: check if some of them can migrate to keyword_sp_var_and_label. +*/ +keyword_sp_var_not_label: + ASCII_SYM + | BACKUP_SYM + | BINLOG_SYM + | BYTE_SYM + | CACHE_SYM + | CHECKSUM_SYM + | CHECKPOINT_SYM + | COLUMN_ADD_SYM + | COLUMN_CHECK_SYM + | COLUMN_CREATE_SYM + | COLUMN_DELETE_SYM + | COLUMN_GET_SYM + | COMMENT_SYM + | DEALLOCATE_SYM + | EXAMINED_SYM + | EXCLUDE_SYM + | EXECUTE_SYM + | FLUSH_SYM + | FOLLOWING_SYM + | FORMAT_SYM + | GET_SYM + | HELP_SYM + | HOST_SYM + | INSTALL_SYM + | OPTION + | OPTIONS_SYM + | OTHERS_MARIADB_SYM + | OWNER_SYM + | PARSER_SYM + | PERIOD_SYM + | PORT_SYM + | PRECEDING_SYM + | PREPARE_SYM + | REMOVE_SYM + | RESET_SYM + | RESTORE_SYM + | SECURITY_SYM + | SERVER_SYM + | SIGNED_SYM + | SOCKET_SYM + | SLAVE + | SLAVES + | SONAME_SYM + | START_SYM + | STOP_SYM + | STORED_SYM + | TIES_SYM + | UNICODE_SYM + | UNINSTALL_SYM + | UNBOUNDED_SYM + | WITHIN + | WRAPPER_SYM + | XA_SYM + | UPGRADE_SYM + ; + +/* + Keywords that can start optional clauses in SP or trigger declarations + Allowed as identifiers (e.g. table, column names), + but: + - not allowed as SP label names + - not allowed as variable names in Oracle-style assignments: + xxx := 10; + + If we allowed these variables in assignments, there would be conflicts + with SP characteristics, or verb clauses, or compound statements, e.g.: + CREATE PROCEDURE p1 LANGUAGE ... + would be either: + CREATE PROCEDURE p1 LANGUAGE SQL BEGIN END; + or + CREATE PROCEDURE p1 LANGUAGE:=10; + + Note, these variables can still be assigned using quoted identifiers: + `do`:= 10; + "do":= 10; (when ANSI_QUOTES) + or using a SET statement: + SET do= 10; + + Note, some of these keywords are reserved keywords in Oracle. + In case if heavy grammar conflicts are found in the future, + we'll possibly need to make them reserved for sql_mode=ORACLE. + + TODO: Allow these variables as SP lables when sql_mode=ORACLE. + TODO: Allow assigning of "SP characteristics" marked variables + inside compound blocks. + TODO: Allow "follows" and "precedes" as variables in compound blocks: + BEGIN + follows := 10; + END; + as they conflict only with non-block FOR EACH ROW statement: + CREATE TRIGGER .. FOR EACH ROW follows:= 10; + CREATE TRIGGER .. FOR EACH ROW FOLLOWS tr1 a:= 10; +*/ +keyword_sp_head: + CONTAINS_SYM /* SP characteristic */ + | LANGUAGE_SYM /* SP characteristic */ + | NO_SYM /* SP characteristic */ + | CHARSET /* SET CHARSET utf8; */ + | FOLLOWS_SYM /* Conflicts with assignment in FOR EACH */ + | PRECEDES_SYM /* Conflicts with assignment in FOR EACH */ + ; + +/* + Keywords that start a statement. + Generally allowed as identifiers (e.g. table, column names) + - not allowed as SP label names + - not allowed as variable names in Oracle-style assignments: + xxx:=10 +*/ +keyword_verb_clause: + CLOSE_SYM /* Verb clause. Reserved in Oracle */ + | COMMIT_SYM /* Verb clause. Reserved in Oracle */ + | DO_SYM /* Verb clause */ + | HANDLER_SYM /* Verb clause */ + | OPEN_SYM /* Verb clause. Reserved in Oracle */ + | REPAIR /* Verb clause */ + | ROLLBACK_SYM /* Verb clause. Reserved in Oracle */ + | SAVEPOINT_SYM /* Verb clause. Reserved in Oracle */ + | SHUTDOWN /* Verb clause */ + | TRUNCATE_SYM /* Verb clause. Reserved in Oracle */ + ; + +keyword_set_special_case: + NAMES_SYM + | ROLE_SYM + | PASSWORD_SYM + ; + +/* + Keywords that start an SP block section. +*/ +keyword_sp_block_section: + BEGIN_ORACLE_SYM + | EXCEPTION_ORACLE_SYM + | END + ; + +keyword_sysvar_type: + GLOBAL_SYM + | LOCAL_SYM + | SESSION_SYM + ; + + +/* + These keywords are generally allowed as identifiers, + but not allowed as non-delimited SP variable names in sql_mode=ORACLE. +*/ +keyword_data_type: + BIT_SYM + | BOOLEAN_SYM + | BOOL_SYM + | CLOB_MARIADB_SYM + | CLOB_ORACLE_SYM + | DATE_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2 + | DATETIME + | ENUM + | FIXED_SYM + | GEOMETRYCOLLECTION + | GEOMETRY_SYM + | JSON_SYM + | LINESTRING + | MEDIUM_SYM + | MULTILINESTRING + | MULTIPOINT + | MULTIPOLYGON + | NATIONAL_SYM + | NCHAR_SYM + | NUMBER_MARIADB_SYM + | NUMBER_ORACLE_SYM + | NVARCHAR_SYM + | POINT_SYM + | POLYGON + | RAW_MARIADB_SYM + | RAW_ORACLE_SYM + | ROW_SYM + | SERIAL_SYM + | TEXT_SYM + | TIMESTAMP %prec PREC_BELOW_CONTRACTION_TOKEN2 + | TIME_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2 + | VARCHAR2_MARIADB_SYM + | VARCHAR2_ORACLE_SYM + | YEAR_SYM + ; + + +/* + These keywords are fine for both SP variable names and SP labels. +*/ +keyword_sp_var_and_label: + ACTION + | ADDDATE_SYM + | ADMIN_SYM + | AFTER_SYM + | AGAINST + | AGGREGATE_SYM + | ALGORITHM_SYM + | ALWAYS_SYM + | ANY_SYM + | AT_SYM + | ATOMIC_SYM + | AUTHORS_SYM + | AUTO_INC + | AUTOEXTEND_SIZE_SYM + | AUTO_SYM + | AVG_ROW_LENGTH + | AVG_SYM + | BLOCK_SYM + | BODY_MARIADB_SYM + | BTREE_SYM + | CASCADED + | CATALOG_NAME_SYM + | CHAIN_SYM + | CHANGED + | CIPHER_SYM + | CLIENT_SYM + | CLASS_ORIGIN_SYM + | COALESCE + | CODE_SYM + | COLLATION_SYM + | COLUMN_NAME_SYM + | COLUMNS + | COMMITTED_SYM + | COMPACT_SYM + | COMPLETION_SYM + | COMPRESSED_SYM + | CONCURRENT + | CONNECTION_SYM + | CONSISTENT_SYM + | CONSTRAINT_CATALOG_SYM + | CONSTRAINT_SCHEMA_SYM + | CONSTRAINT_NAME_SYM + | CONTEXT_SYM + | CONTRIBUTORS_SYM + | CURRENT_POS_SYM + | CPU_SYM + | CUBE_SYM + /* + Although a reserved keyword in SQL:2003 (and :2008), + not reserved in MySQL per WL#2111 specification. + */ + | CURRENT_SYM + | CURSOR_NAME_SYM + | CYCLE_SYM + | DATA_SYM + | DATAFILE_SYM + | DATE_FORMAT_SYM + | DAY_SYM + | DECODE_MARIADB_SYM + | DECODE_ORACLE_SYM + | DEFINER_SYM + | DELAY_KEY_WRITE_SYM + | DES_KEY_FILE + | DIAGNOSTICS_SYM + | DIRECTORY_SYM + | DISABLE_SYM + | DISCARD + | DISK_SYM + | DUMPFILE + | DUPLICATE_SYM + | DYNAMIC_SYM + | ELSEIF_ORACLE_SYM + | ELSIF_MARIADB_SYM + | ENDS_SYM + | ENGINE_SYM + | ENGINES_SYM + | ERROR_SYM + | ERRORS + | ESCAPE_SYM + | EVENT_SYM + | EVENTS_SYM + | EVERY_SYM + | EXCEPTION_MARIADB_SYM + | EXCHANGE_SYM + | EXPANSION_SYM + | EXPORT_SYM + | EXTENDED_SYM + | EXTENT_SIZE_SYM + | FAULTS_SYM + | FAST_SYM + | FOUND_SYM + | ENABLE_SYM + | FULL + | FILE_SYM + | FIRST_SYM + | GENERAL + | GENERATED_SYM + | GET_FORMAT + | GRANTS + | GOTO_MARIADB_SYM + | HASH_SYM + | HARD_SYM + | HISTORY_SYM + | HOSTS_SYM + | HOUR_SYM + | ID_SYM + | IDENTIFIED_SYM + | IGNORE_SERVER_IDS_SYM + | INCREMENT_SYM + | IMMEDIATE_SYM + | INVOKER_SYM + | IMPORT + | INDEXES + | INITIAL_SIZE_SYM + | IO_SYM + | IPC_SYM + | ISOLATION + | ISOPEN_SYM + | ISSUER_SYM + | INSERT_METHOD + | INVISIBLE_SYM + | KEY_BLOCK_SIZE + | LAST_VALUE + | LAST_SYM + | LASTVAL_SYM + | LEAVES + | LESS_SYM + | LEVEL_SYM + | LIST_SYM + | LOCKS_SYM + | LOGFILE_SYM + | LOGS_SYM + | MAX_ROWS + | MASTER_SYM + | MASTER_HEARTBEAT_PERIOD_SYM + | MASTER_GTID_POS_SYM + | MASTER_HOST_SYM + | MASTER_PORT_SYM + | MASTER_LOG_FILE_SYM + | MASTER_LOG_POS_SYM + | MASTER_USER_SYM + | MASTER_USE_GTID_SYM + | MASTER_PASSWORD_SYM + | MASTER_SERVER_ID_SYM + | MASTER_CONNECT_RETRY_SYM + | MASTER_DELAY_SYM + | MASTER_SSL_SYM + | MASTER_SSL_CA_SYM + | MASTER_SSL_CAPATH_SYM + | MASTER_SSL_CERT_SYM + | MASTER_SSL_CIPHER_SYM + | MASTER_SSL_CRL_SYM + | MASTER_SSL_CRLPATH_SYM + | MASTER_SSL_KEY_SYM + | MAX_CONNECTIONS_PER_HOUR + | MAX_QUERIES_PER_HOUR + | MAX_SIZE_SYM + | MAX_STATEMENT_TIME_SYM + | MAX_UPDATES_PER_HOUR + | MAX_USER_CONNECTIONS_SYM + | MEMORY_SYM + | MERGE_SYM + | MESSAGE_TEXT_SYM + | MICROSECOND_SYM + | MIGRATE_SYM + | MINUTE_SYM + | MINVALUE_SYM + | MIN_ROWS + | MODIFY_SYM + | MODE_SYM + | MONTH_SYM + | MUTEX_SYM + | MYSQL_SYM + | MYSQL_ERRNO_SYM + | NAME_SYM + | NEXT_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2 + | NEXTVAL_SYM + | NEW_SYM + | NOCACHE_SYM + | NOCYCLE_SYM + | NOMINVALUE_SYM + | NOMAXVALUE_SYM + | NO_WAIT_SYM + | NOWAIT_SYM + | NODEGROUP_SYM + | NONE_SYM + | NOTFOUND_SYM + | OF_SYM + | OFFSET_SYM + | OLD_PASSWORD_SYM + | ONE_SYM + | ONLINE_SYM + | ONLY_SYM + | PACKAGE_MARIADB_SYM + | PACK_KEYS_SYM + | PAGE_SYM + | PARTIAL + | PARTITIONING_SYM + | PARTITIONS_SYM + | PERSISTENT_SYM + | PHASE_SYM + | PLUGIN_SYM + | PLUGINS_SYM + | PRESERVE_SYM + | PREV_SYM + | PREVIOUS_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2 + | PRIVILEGES + | PROCESS + | PROCESSLIST_SYM + | PROFILE_SYM + | PROFILES_SYM + | PROXY_SYM + | QUARTER_SYM + | QUERY_SYM + | QUICK + | RAISE_MARIADB_SYM + | READ_ONLY_SYM + | REBUILD_SYM + | RECOVER_SYM + | REDO_BUFFER_SIZE_SYM + | REDOFILE_SYM + | REDUNDANT_SYM + | RELAY + | RELAYLOG_SYM + | RELAY_LOG_FILE_SYM + | RELAY_LOG_POS_SYM + | RELAY_THREAD + | RELOAD + | REORGANIZE_SYM + | REPEATABLE_SYM + | REPLICATION + | RESOURCES + | RESTART_SYM + | RESUME_SYM + | RETURNED_SQLSTATE_SYM + | RETURNS_SYM + | REUSE_SYM + | REVERSE_SYM + | ROLLUP_SYM + | ROUTINE_SYM + | ROWCOUNT_SYM + | ROWTYPE_MARIADB_SYM + | ROW_COUNT_SYM + | ROW_FORMAT_SYM + | RTREE_SYM + | SCHEDULE_SYM + | SCHEMA_NAME_SYM + | SECOND_SYM + | SEQUENCE_SYM + | SERIALIZABLE_SYM + | SETVAL_SYM + | SIMPLE_SYM + | SHARE_SYM + | SLAVE_POS_SYM + | SLOW + | SNAPSHOT_SYM + | SOFT_SYM + | SOUNDS_SYM + | SOURCE_SYM + | SQL_CACHE_SYM + | SQL_BUFFER_RESULT + | SQL_NO_CACHE_SYM + | SQL_THREAD + | STARTS_SYM + | STATEMENT_SYM + | STATUS_SYM + | STORAGE_SYM + | STRING_SYM + | SUBCLASS_ORIGIN_SYM + | SUBDATE_SYM + | SUBJECT_SYM + | SUBPARTITION_SYM + | SUBPARTITIONS_SYM + | SUPER_SYM + | SUSPEND_SYM + | SWAPS_SYM + | SWITCHES_SYM + | SYSTEM + | SYSTEM_TIME_SYM + | TABLE_NAME_SYM + | TABLES + | TABLE_CHECKSUM_SYM + | TABLESPACE + | TEMPORARY + | TEMPTABLE_SYM + | THAN_SYM + | TRANSACTION_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2 + | TRANSACTIONAL_SYM + | TRIGGERS_SYM + | TRIM_ORACLE + | TIMESTAMP_ADD + | TIMESTAMP_DIFF + | TYPES_SYM + | TYPE_SYM + | UDF_RETURNS_SYM + | UNCOMMITTED_SYM + | UNDEFINED_SYM + | UNDO_BUFFER_SIZE_SYM + | UNDOFILE_SYM + | UNKNOWN_SYM + | UNTIL_SYM + | USER_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2 + | USE_FRM + | VARIABLES + | VERSIONING_SYM + | VIEW_SYM + | VIRTUAL_SYM + | VALUE_SYM + | WARNINGS + | WAIT_SYM + | WEEK_SYM + | WEIGHT_STRING_SYM + | WITHOUT + | WORK_SYM + | X509_SYM + | XML_SYM + | VIA_SYM + ; + +/* + SQLCOM_SET_OPTION statement. + + Note that to avoid shift/reduce conflicts, we have separate rules for the + first option listed in the statement. +*/ + +set: + SET + { + LEX *lex=Lex; + lex->set_stmt_init(); + lex->var_list.empty(); + sp_create_assignment_lex(thd, yychar == YYEMPTY); + } + start_option_value_list + {} + | SET STATEMENT_SYM + { + Lex->set_stmt_init(); + } + set_stmt_option_value_following_option_type_list + { + LEX *lex= Lex; + if (unlikely(lex->table_or_sp_used())) + my_yyabort_error((ER_SUBQUERIES_NOT_SUPPORTED, MYF(0), "SET STATEMENT")); + lex->stmt_var_list= lex->var_list; + lex->var_list.empty(); + } + FOR_SYM verb_clause + {} + ; + +set_assign: + ident_directly_assignable SET_VAR + { + LEX *lex=Lex; + lex->set_stmt_init(); + lex->var_list.empty(); + sp_create_assignment_lex(thd, yychar == YYEMPTY); + } + set_expr_or_default + { + if (unlikely(Lex->set_variable(&$1, $4)) || + unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY))) + MYSQL_YYABORT; + } + | ident_directly_assignable '.' ident SET_VAR + { + LEX *lex=Lex; + lex->set_stmt_init(); + lex->var_list.empty(); + sp_create_assignment_lex(thd, yychar == YYEMPTY); + } + set_expr_or_default + { + LEX *lex= Lex; + DBUG_ASSERT(lex->var_list.is_empty()); + if (unlikely(lex->set_variable(&$1, &$3, $6)) || + unlikely(lex->sphead->restore_lex(thd))) + MYSQL_YYABORT; + } + | COLON_ORACLE_SYM ident '.' ident SET_VAR + { + LEX *lex= Lex; + if (unlikely(!lex->is_trigger_new_or_old_reference(&$2))) + { + thd->parse_error(ER_SYNTAX_ERROR, $1.pos()); + MYSQL_YYABORT; + } + lex->set_stmt_init(); + lex->var_list.empty(); + sp_create_assignment_lex(thd, yychar == YYEMPTY); + } + set_expr_or_default + { + LEX_CSTRING tmp= { $2.str, $2.length }; + if (unlikely(Lex->set_trigger_field(&tmp, &$4, $7)) || + unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY))) + MYSQL_YYABORT; + } + ; + +set_stmt_option_value_following_option_type_list: + /* + Only system variables can be used here. If this condition is changed + please check careful code under lex->option_type == OPT_STATEMENT + condition on wrong type casts. + */ + option_value_following_option_type + | set_stmt_option_value_following_option_type_list ',' option_value_following_option_type + ; + +/* Start of option value list */ +start_option_value_list: + option_value_no_option_type + { + if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY))) + MYSQL_YYABORT; + } + option_value_list_continued + | TRANSACTION_SYM + { + Lex->option_type= OPT_DEFAULT; + } + transaction_characteristics + { + if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY))) + MYSQL_YYABORT; + } + | option_type + { + Lex->option_type= $1; + } + start_option_value_list_following_option_type + ; + + +/* Start of option value list, option_type was given */ +start_option_value_list_following_option_type: + option_value_following_option_type + { + if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY))) + MYSQL_YYABORT; + } + option_value_list_continued + | TRANSACTION_SYM transaction_characteristics + { + if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY))) + MYSQL_YYABORT; + } + ; + +/* Remainder of the option value list after first option value. */ +option_value_list_continued: + /* empty */ + | ',' option_value_list + ; + +/* Repeating list of option values after first option value. */ +option_value_list: + { + sp_create_assignment_lex(thd, yychar == YYEMPTY); + } + option_value + { + if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY))) + MYSQL_YYABORT; + } + | option_value_list ',' + { + sp_create_assignment_lex(thd, yychar == YYEMPTY); + } + option_value + { + if (unlikely(sp_create_assignment_instr(thd, yychar == YYEMPTY))) + MYSQL_YYABORT; + } + ; + +/* Wrapper around option values following the first option value in the stmt. */ +option_value: + option_type + { + Lex->option_type= $1; + } + option_value_following_option_type + | option_value_no_option_type + ; + +option_type: + GLOBAL_SYM { $$=OPT_GLOBAL; } + | LOCAL_SYM { $$=OPT_SESSION; } + | SESSION_SYM { $$=OPT_SESSION; } + ; + +opt_var_type: + /* empty */ { $$=OPT_SESSION; } + | GLOBAL_SYM { $$=OPT_GLOBAL; } + | LOCAL_SYM { $$=OPT_SESSION; } + | SESSION_SYM { $$=OPT_SESSION; } + ; + +opt_var_ident_type: + /* empty */ { $$=OPT_DEFAULT; } + | GLOBAL_SYM '.' { $$=OPT_GLOBAL; } + | LOCAL_SYM '.' { $$=OPT_SESSION; } + | SESSION_SYM '.' { $$=OPT_SESSION; } + ; + +/* Option values with preceding option_type. */ +option_value_following_option_type: + ident equal set_expr_or_default + { + if (unlikely(Lex->set_system_variable(Lex->option_type, &$1, $3))) + MYSQL_YYABORT; + } + | ident '.' ident equal set_expr_or_default + { + if (unlikely(Lex->set_system_variable(thd, Lex->option_type, &$1, &$3, $5))) + MYSQL_YYABORT; + } + | DEFAULT '.' ident equal set_expr_or_default + { + if (unlikely(Lex->set_default_system_variable(Lex->option_type, &$3, $5))) + MYSQL_YYABORT; + } + ; + +/* Option values without preceding option_type. */ +option_value_no_option_type: + ident_set_usual_case equal set_expr_or_default + { + if (unlikely(Lex->set_variable(&$1, $3))) + MYSQL_YYABORT; + } + | ident '.' ident equal set_expr_or_default + { + if (unlikely(Lex->set_variable(&$1, &$3, $5))) + MYSQL_YYABORT; + } + | DEFAULT '.' ident equal set_expr_or_default + { + if (unlikely(Lex->set_default_system_variable(Lex->option_type, &$3, $5))) + MYSQL_YYABORT; + } + | '@' ident_or_text equal expr + { + if (unlikely(Lex->set_user_variable(thd, &$2, $4))) + MYSQL_YYABORT; + } + | '@' '@' opt_var_ident_type ident_sysvar_name equal set_expr_or_default + { + if (unlikely(Lex->set_system_variable($3, &$4, $6))) + MYSQL_YYABORT; + } + | '@' '@' opt_var_ident_type ident_sysvar_name '.' ident equal set_expr_or_default + { + if (unlikely(Lex->set_system_variable(thd, $3, &$4, &$6, $8))) + MYSQL_YYABORT; + } + | '@' '@' opt_var_ident_type DEFAULT '.' ident equal set_expr_or_default + { + if (unlikely(Lex->set_default_system_variable($3, &$6, $8))) + MYSQL_YYABORT; + } + | charset old_or_new_charset_name_or_default + { + LEX *lex= thd->lex; + CHARSET_INFO *cs2; + cs2= $2 ? $2: global_system_variables.character_set_client; + set_var_collation_client *var; + var= (new (thd->mem_root) + set_var_collation_client(cs2, + thd->variables.collation_database, + cs2)); + if (unlikely(var == NULL)) + MYSQL_YYABORT; + lex->var_list.push_back(var, thd->mem_root); + } + | NAMES_SYM equal expr + { + LEX *lex= Lex; + sp_pcontext *spc= lex->spcont; + LEX_CSTRING names= { STRING_WITH_LEN("names") }; + if (unlikely(spc && spc->find_variable(&names, false))) + my_error(ER_SP_BAD_VAR_SHADOW, MYF(0), names.str); + else + thd->parse_error(); + MYSQL_YYABORT; + } + | NAMES_SYM charset_name_or_default opt_collate + { + LEX *lex= Lex; + CHARSET_INFO *cs2; + CHARSET_INFO *cs3; + cs2= $2 ? $2 : global_system_variables.character_set_client; + cs3= $3 ? $3 : cs2; + if (unlikely(!my_charset_same(cs2, cs3))) + { + my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0), + cs3->name, cs2->csname); + MYSQL_YYABORT; + } + set_var_collation_client *var; + var= new (thd->mem_root) set_var_collation_client(cs3, cs3, cs3); + if (unlikely(var == NULL) || + unlikely(lex->var_list.push_back(var, thd->mem_root))) + MYSQL_YYABORT; + } + | DEFAULT ROLE_SYM grant_role + { + LEX *lex = Lex; + LEX_USER *user; + if (unlikely(!(user=(LEX_USER *) thd->calloc(sizeof(LEX_USER))))) + MYSQL_YYABORT; + user->user= current_user; + set_var_default_role *var= (new (thd->mem_root) + set_var_default_role(user, + $3->user)); + if (unlikely(var == NULL) || + unlikely(lex->var_list.push_back(var, thd->mem_root))) + MYSQL_YYABORT; + + thd->lex->autocommit= TRUE; + if (lex->sphead) + lex->sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT; + } + | DEFAULT ROLE_SYM grant_role FOR_SYM user + { + LEX *lex = Lex; + set_var_default_role *var= (new (thd->mem_root) + set_var_default_role($5, $3->user)); + if (unlikely(var == NULL) || + unlikely(lex->var_list.push_back(var, thd->mem_root))) + MYSQL_YYABORT; + thd->lex->autocommit= TRUE; + if (lex->sphead) + lex->sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT; + } + | ROLE_SYM ident_or_text + { + LEX *lex = Lex; + set_var_role *var= new (thd->mem_root) set_var_role($2); + if (unlikely(var == NULL) || + unlikely(lex->var_list.push_back(var, thd->mem_root))) + MYSQL_YYABORT; + } + | ROLE_SYM equal set_expr_or_default + { + if (unlikely(Lex->set_variable(&$1, $3))) + MYSQL_YYABORT; + } + | PASSWORD_SYM opt_for_user text_or_password + { + LEX *lex = Lex; + set_var_password *var= (new (thd->mem_root) + set_var_password(lex->definer)); + if (unlikely(var == NULL) || + unlikely(lex->var_list.push_back(var, thd->mem_root))) + MYSQL_YYABORT; + lex->autocommit= TRUE; + if (lex->sphead) + lex->sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT; + } + ; + + +transaction_characteristics: + transaction_access_mode + | isolation_level + | transaction_access_mode ',' isolation_level + | isolation_level ',' transaction_access_mode + ; + +transaction_access_mode: + transaction_access_mode_types + { + LEX *lex=Lex; + Item *item= new (thd->mem_root) Item_int(thd, (int32) $1); + if (unlikely(item == NULL)) + MYSQL_YYABORT; + set_var *var= (new (thd->mem_root) + set_var(thd, lex->option_type, + find_sys_var(thd, "tx_read_only"), + &null_clex_str, + item)); + if (unlikely(var == NULL)) + MYSQL_YYABORT; + if (unlikely(lex->var_list.push_back(var, thd->mem_root))) + MYSQL_YYABORT; + } + ; + +isolation_level: + ISOLATION LEVEL_SYM isolation_types + { + LEX *lex=Lex; + Item *item= new (thd->mem_root) Item_int(thd, (int32) $3); + if (unlikely(item == NULL)) + MYSQL_YYABORT; + set_var *var= (new (thd->mem_root) + set_var(thd, lex->option_type, + find_sys_var(thd, "tx_isolation"), + &null_clex_str, + item)); + if (unlikely(var == NULL) || + unlikely(lex->var_list.push_back(var, thd->mem_root))) + MYSQL_YYABORT; + } + ; + +transaction_access_mode_types: + READ_SYM ONLY_SYM { $$= true; } + | READ_SYM WRITE_SYM { $$= false; } + ; + +isolation_types: + READ_SYM UNCOMMITTED_SYM { $$= ISO_READ_UNCOMMITTED; } + | READ_SYM COMMITTED_SYM { $$= ISO_READ_COMMITTED; } + | REPEATABLE_SYM READ_SYM { $$= ISO_REPEATABLE_READ; } + | SERIALIZABLE_SYM { $$= ISO_SERIALIZABLE; } + ; + +opt_for_user: + equal + { + LEX *lex= thd->lex; + sp_pcontext *spc= lex->spcont; + LEX_CSTRING pw= { STRING_WITH_LEN("password") }; + + if (unlikely(spc && spc->find_variable(&pw, false))) + my_yyabort_error((ER_SP_BAD_VAR_SHADOW, MYF(0), pw.str)); + if (unlikely(!(lex->definer= (LEX_USER*) + thd->calloc(sizeof(LEX_USER))))) + MYSQL_YYABORT; + lex->definer->user= current_user; + lex->definer->plugin= empty_clex_str; + lex->definer->auth= empty_clex_str; + } + | FOR_SYM user equal { Lex->definer= $2; } + ; + +text_or_password: + TEXT_STRING { Lex->definer->pwhash= $1;} + | PASSWORD_SYM '(' TEXT_STRING ')' { Lex->definer->pwtext= $3; } + | OLD_PASSWORD_SYM '(' TEXT_STRING ')' + { + Lex->definer->pwtext= $3; + Lex->definer->pwhash.str= Item_func_password::alloc(thd, + $3.str, $3.length, Item_func_password::OLD); + Lex->definer->pwhash.length= SCRAMBLED_PASSWORD_CHAR_LENGTH_323; + } + ; + +set_expr_or_default: + expr { $$=$1; } + | DEFAULT { $$=0; } + | ON + { + $$=new (thd->mem_root) Item_string_sys(thd, "ON", 2); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | ALL + { + $$=new (thd->mem_root) Item_string_sys(thd, "ALL", 3); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + | BINARY + { + $$=new (thd->mem_root) Item_string_sys(thd, "binary", 6); + if (unlikely($$ == NULL)) + MYSQL_YYABORT; + } + ; + +/* Lock function */ + +lock: + LOCK_SYM table_or_tables + { + LEX *lex= Lex; + + if (unlikely(lex->sphead)) + my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "LOCK")); + lex->sql_command= SQLCOM_LOCK_TABLES; + } + table_lock_list opt_lock_wait_timeout + {} + ; + +opt_lock_wait_timeout: + /* empty */ + {} + | WAIT_SYM ulong_num + { + if (unlikely(set_statement_var_if_exists(thd, STRING_WITH_LEN("lock_wait_timeout"), $2)) || + unlikely(set_statement_var_if_exists(thd, STRING_WITH_LEN("innodb_lock_wait_timeout"), $2))) + MYSQL_YYABORT; + } + | NOWAIT_SYM + { + if (unlikely(set_statement_var_if_exists(thd, STRING_WITH_LEN("lock_wait_timeout"), 0)) || + unlikely(set_statement_var_if_exists(thd, STRING_WITH_LEN("innodb_lock_wait_timeout"), 0))) + MYSQL_YYABORT; + } + ; + +table_or_tables: + TABLE_SYM { } + | TABLES { } + ; + +table_lock_list: + table_lock + | table_lock_list ',' table_lock + ; + +table_lock: + table_ident opt_table_alias lock_option + { + thr_lock_type lock_type= (thr_lock_type) $3; + bool lock_for_write= (lock_type >= TL_WRITE_ALLOW_WRITE); ++ ulong table_options= lock_for_write ? TL_OPTION_UPDATING : 0; ++ enum_mdl_type mdl_type= !lock_for_write ++ ? MDL_SHARED_READ ++ : lock_type == TL_WRITE_CONCURRENT_INSERT ++ ? MDL_SHARED_WRITE ++ : MDL_SHARED_NO_READ_WRITE; ++ + if (unlikely(!Select-> - add_table_to_list(thd, $1, $2, 0, lock_type, - (lock_for_write ? - lock_type == TL_WRITE_CONCURRENT_INSERT ? - MDL_SHARED_WRITE : - MDL_SHARED_NO_READ_WRITE : - MDL_SHARED_READ)))) ++ add_table_to_list(thd, $1, $2, table_options, ++ lock_type, mdl_type))) + MYSQL_YYABORT; + } + ; + +lock_option: + READ_SYM { $$= TL_READ_NO_INSERT; } + | WRITE_SYM { $$= TL_WRITE_DEFAULT; } + | WRITE_SYM CONCURRENT + { + $$= (Lex->sphead ? TL_WRITE_DEFAULT : TL_WRITE_CONCURRENT_INSERT); + } + + | LOW_PRIORITY WRITE_SYM { $$= TL_WRITE_LOW_PRIORITY; } + | READ_SYM LOCAL_SYM { $$= TL_READ; } + ; + +unlock: + UNLOCK_SYM + { + LEX *lex= Lex; + + if (unlikely(lex->sphead)) + my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "UNLOCK")); + lex->sql_command= SQLCOM_UNLOCK_TABLES; + } + table_or_tables + {} + ; + +/* +** Handler: direct access to ISAM functions +*/ + +handler: + HANDLER_SYM table_ident OPEN_SYM opt_table_alias + { + LEX *lex= Lex; + if (unlikely(lex->sphead)) + my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "HANDLER")); + lex->sql_command = SQLCOM_HA_OPEN; + if (unlikely(!lex->current_select->add_table_to_list(thd, $2, $4, + 0))) + MYSQL_YYABORT; + } + | HANDLER_SYM table_ident_nodb CLOSE_SYM + { + LEX *lex= Lex; + if (unlikely(lex->sphead)) + my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "HANDLER")); + lex->sql_command = SQLCOM_HA_CLOSE; + if (unlikely(!lex->current_select->add_table_to_list(thd, $2, 0, + 0))) + MYSQL_YYABORT; + } + | HANDLER_SYM table_ident_nodb READ_SYM + { + LEX *lex=Lex; + if (unlikely(lex->sphead)) + my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "HANDLER")); + lex->expr_allows_subselect= FALSE; + lex->sql_command = SQLCOM_HA_READ; + lex->ha_rkey_mode= HA_READ_KEY_EXACT; /* Avoid purify warnings */ + Item *one= new (thd->mem_root) Item_int(thd, (int32) 1); + if (unlikely(one == NULL)) + MYSQL_YYABORT; + lex->current_select->select_limit= one; + lex->current_select->offset_limit= 0; + lex->limit_rows_examined= 0; + if (unlikely(!lex->current_select->add_table_to_list(thd, $2, 0, + 0))) + MYSQL_YYABORT; + } + handler_read_or_scan opt_where_clause opt_limit_clause + { + Lex->expr_allows_subselect= TRUE; + /* Stored functions are not supported for HANDLER READ. */ + if (unlikely(Lex->uses_stored_routines())) + { + my_error(ER_NOT_SUPPORTED_YET, MYF(0), + "stored functions in HANDLER ... READ"); + MYSQL_YYABORT; + } + } + ; + +handler_read_or_scan: + handler_scan_function { Lex->ident= null_clex_str; } + | ident handler_rkey_function { Lex->ident= $1; } + ; + +handler_scan_function: + FIRST_SYM { Lex->ha_read_mode = RFIRST; } + | NEXT_SYM { Lex->ha_read_mode = RNEXT; } + ; + +handler_rkey_function: + FIRST_SYM { Lex->ha_read_mode = RFIRST; } + | NEXT_SYM { Lex->ha_read_mode = RNEXT; } + | PREV_SYM { Lex->ha_read_mode = RPREV; } + | LAST_SYM { Lex->ha_read_mode = RLAST; } + | handler_rkey_mode + { + LEX *lex=Lex; + lex->ha_read_mode = RKEY; + lex->ha_rkey_mode=$1; + if (unlikely(!(lex->insert_list= new (thd->mem_root) List_item))) + MYSQL_YYABORT; + } + '(' values ')' + {} + ; + +handler_rkey_mode: + '=' { $$=HA_READ_KEY_EXACT; } + | GE { $$=HA_READ_KEY_OR_NEXT; } + | LE { $$=HA_READ_KEY_OR_PREV; } + | '>' { $$=HA_READ_AFTER_KEY; } + | '<' { $$=HA_READ_BEFORE_KEY; } + ; + +/* GRANT / REVOKE */ + +revoke: + REVOKE clear_privileges revoke_command + {} + ; + +revoke_command: + grant_privileges ON opt_table grant_ident FROM user_and_role_list + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_REVOKE; + lex->type= 0; + } + | grant_privileges ON FUNCTION_SYM grant_ident FROM user_and_role_list + { + if (unlikely(Lex->add_grant_command(thd, SQLCOM_REVOKE, + TYPE_ENUM_FUNCTION))) + MYSQL_YYABORT; + } + | grant_privileges ON PROCEDURE_SYM grant_ident FROM user_and_role_list + { + if (unlikely(Lex->add_grant_command(thd, SQLCOM_REVOKE, + TYPE_ENUM_PROCEDURE))) + MYSQL_YYABORT; + } + | grant_privileges ON PACKAGE_ORACLE_SYM grant_ident + FROM user_and_role_list + { + if (unlikely(Lex->add_grant_command(thd, SQLCOM_REVOKE, + TYPE_ENUM_PACKAGE))) + MYSQL_YYABORT; + } + | grant_privileges ON PACKAGE_ORACLE_SYM BODY_ORACLE_SYM grant_ident + FROM user_and_role_list + { + if (unlikely(Lex->add_grant_command(thd, SQLCOM_REVOKE, + TYPE_ENUM_PACKAGE_BODY))) + MYSQL_YYABORT; + } + | ALL opt_privileges ',' GRANT OPTION FROM user_and_role_list + { + Lex->sql_command = SQLCOM_REVOKE_ALL; + } + | PROXY_SYM ON user FROM user_list + { + LEX *lex= Lex; + lex->users_list.push_front ($3); + lex->sql_command= SQLCOM_REVOKE; + lex->type= TYPE_ENUM_PROXY; + } + | admin_option_for_role FROM user_and_role_list + { + Lex->sql_command= SQLCOM_REVOKE_ROLE; + if (unlikely(Lex->users_list.push_front($1, thd->mem_root))) + MYSQL_YYABORT; + } + ; + +admin_option_for_role: + ADMIN_SYM OPTION FOR_SYM grant_role + { Lex->with_admin_option= true; $$= $4; } + | grant_role + { Lex->with_admin_option= false; $$= $1; } + ; + +grant: + GRANT clear_privileges grant_command + {} + ; + +grant_command: + grant_privileges ON opt_table grant_ident TO_SYM grant_list + opt_require_clause opt_grant_options + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_GRANT; + lex->type= 0; + } + | grant_privileges ON FUNCTION_SYM grant_ident TO_SYM grant_list + opt_require_clause opt_grant_options + { + if (unlikely(Lex->add_grant_command(thd, SQLCOM_GRANT, + TYPE_ENUM_FUNCTION))) + MYSQL_YYABORT; + } + | grant_privileges ON PROCEDURE_SYM grant_ident TO_SYM grant_list + opt_require_clause opt_grant_options + { + if (unlikely(Lex->add_grant_command(thd, SQLCOM_GRANT, + TYPE_ENUM_PROCEDURE))) + MYSQL_YYABORT; + } + | grant_privileges ON PACKAGE_ORACLE_SYM grant_ident TO_SYM grant_list + opt_require_clause opt_grant_options + { + if (unlikely(Lex->add_grant_command(thd, SQLCOM_GRANT, + TYPE_ENUM_PACKAGE))) + MYSQL_YYABORT; + } + | grant_privileges ON PACKAGE_ORACLE_SYM BODY_ORACLE_SYM grant_ident TO_SYM grant_list + opt_require_clause opt_grant_options + { + if (unlikely(Lex->add_grant_command(thd, SQLCOM_GRANT, + TYPE_ENUM_PACKAGE_BODY))) + MYSQL_YYABORT; + } + | PROXY_SYM ON user TO_SYM grant_list opt_grant_option + { + LEX *lex= Lex; + lex->users_list.push_front ($3); + lex->sql_command= SQLCOM_GRANT; + lex->type= TYPE_ENUM_PROXY; + } + | grant_role TO_SYM grant_list opt_with_admin_option + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_GRANT_ROLE; + /* The first role is the one that is granted */ + if (unlikely(Lex->users_list.push_front($1, thd->mem_root))) + MYSQL_YYABORT; + } + + ; + +opt_with_admin: + /* nothing */ { Lex->definer = 0; } + | WITH ADMIN_SYM user_or_role { Lex->definer = $3; } + +opt_with_admin_option: + /* nothing */ { Lex->with_admin_option= false; } + | WITH ADMIN_SYM OPTION { Lex->with_admin_option= true; } + +role_list: + grant_role + { + if (unlikely(Lex->users_list.push_back($1, thd->mem_root))) + MYSQL_YYABORT; + } + | role_list ',' grant_role + { + if (unlikely(Lex->users_list.push_back($3, thd->mem_root))) + MYSQL_YYABORT; + } + ; + +current_role: + CURRENT_ROLE optional_braces + { + if (unlikely(!($$=(LEX_USER*) thd->calloc(sizeof(LEX_USER))))) + MYSQL_YYABORT; + $$->user= current_role; + $$->reset_auth(); + } + ; + +grant_role: + ident_or_text + { + CHARSET_INFO *cs= system_charset_info; + /* trim end spaces (as they'll be lost in mysql.user anyway) */ + $1.length= cs->cset->lengthsp(cs, $1.str, $1.length); + ((char*) $1.str)[$1.length] = '\0'; + if (unlikely($1.length == 0)) + my_yyabort_error((ER_INVALID_ROLE, MYF(0), "")); + if (unlikely(!($$=(LEX_USER*) thd->alloc(sizeof(LEX_USER))))) + MYSQL_YYABORT; + $$->user= $1; + $$->host= empty_clex_str; + $$->reset_auth(); + + if (unlikely(check_string_char_length(&$$->user, ER_USERNAME, + username_char_length, + cs, 0))) + MYSQL_YYABORT; + } + | current_role + ; + +opt_table: + /* Empty */ + | TABLE_SYM + ; + +grant_privileges: + object_privilege_list {} + | ALL opt_privileges + { + Lex->all_privileges= 1; + Lex->grant= GLOBAL_ACLS; + } + ; + +opt_privileges: + /* empty */ + | PRIVILEGES + ; + +object_privilege_list: + object_privilege + | object_privilege_list ',' object_privilege + ; + +object_privilege: + SELECT_SYM + { Lex->which_columns = SELECT_ACL;} + opt_column_list {} + | INSERT + { Lex->which_columns = INSERT_ACL;} + opt_column_list {} + | UPDATE_SYM + { Lex->which_columns = UPDATE_ACL; } + opt_column_list {} + | REFERENCES + { Lex->which_columns = REFERENCES_ACL;} + opt_column_list {} + | DELETE_SYM { Lex->grant |= DELETE_ACL;} + | USAGE {} + | INDEX_SYM { Lex->grant |= INDEX_ACL;} + | ALTER { Lex->grant |= ALTER_ACL;} + | CREATE { Lex->grant |= CREATE_ACL;} + | DROP { Lex->grant |= DROP_ACL;} + | EXECUTE_SYM { Lex->grant |= EXECUTE_ACL;} + | RELOAD { Lex->grant |= RELOAD_ACL;} + | SHUTDOWN { Lex->grant |= SHUTDOWN_ACL;} + | PROCESS { Lex->grant |= PROCESS_ACL;} + | FILE_SYM { Lex->grant |= FILE_ACL;} + | GRANT OPTION { Lex->grant |= GRANT_ACL;} + | SHOW DATABASES { Lex->grant |= SHOW_DB_ACL;} + | SUPER_SYM { Lex->grant |= SUPER_ACL;} + | CREATE TEMPORARY TABLES { Lex->grant |= CREATE_TMP_ACL;} + | LOCK_SYM TABLES { Lex->grant |= LOCK_TABLES_ACL; } + | REPLICATION SLAVE { Lex->grant |= REPL_SLAVE_ACL; } + | REPLICATION CLIENT_SYM { Lex->grant |= REPL_CLIENT_ACL; } + | CREATE VIEW_SYM { Lex->grant |= CREATE_VIEW_ACL; } + | SHOW VIEW_SYM { Lex->grant |= SHOW_VIEW_ACL; } + | CREATE ROUTINE_SYM { Lex->grant |= CREATE_PROC_ACL; } + | ALTER ROUTINE_SYM { Lex->grant |= ALTER_PROC_ACL; } + | CREATE USER_SYM { Lex->grant |= CREATE_USER_ACL; } + | EVENT_SYM { Lex->grant |= EVENT_ACL;} + | TRIGGER_SYM { Lex->grant |= TRIGGER_ACL; } + | CREATE TABLESPACE { Lex->grant |= CREATE_TABLESPACE_ACL; } + | DELETE_SYM HISTORY_SYM { Lex->grant |= DELETE_HISTORY_ACL; } + ; + +opt_and: + /* empty */ {} + | AND_SYM {} + ; + +require_list: + require_list_element opt_and require_list + | require_list_element + ; + +require_list_element: + SUBJECT_SYM TEXT_STRING + { + LEX *lex=Lex; + if (unlikely(lex->x509_subject)) + my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "SUBJECT")); + lex->x509_subject=$2.str; + } + | ISSUER_SYM TEXT_STRING + { + LEX *lex=Lex; + if (unlikely(lex->x509_issuer)) + my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "ISSUER")); + lex->x509_issuer=$2.str; + } + | CIPHER_SYM TEXT_STRING + { + LEX *lex=Lex; + if (unlikely(lex->ssl_cipher)) + my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CIPHER")); + lex->ssl_cipher=$2.str; + } + ; + +grant_ident: + '*' + { + LEX *lex= Lex; + if (unlikely(lex->copy_db_to(&lex->current_select->db))) + MYSQL_YYABORT; + if (lex->grant == GLOBAL_ACLS) + lex->grant = DB_ACLS & ~GRANT_ACL; + else if (unlikely(lex->columns.elements)) + my_yyabort_error((ER_ILLEGAL_GRANT_FOR_TABLE, MYF(0))); + } + | ident '.' '*' + { + LEX *lex= Lex; + lex->current_select->db= $1; + if (lex->grant == GLOBAL_ACLS) + lex->grant = DB_ACLS & ~GRANT_ACL; + else if (unlikely(lex->columns.elements)) + my_yyabort_error((ER_ILLEGAL_GRANT_FOR_TABLE, MYF(0))); + } + | '*' '.' '*' + { + LEX *lex= Lex; + lex->current_select->db= null_clex_str; + if (lex->grant == GLOBAL_ACLS) + lex->grant= GLOBAL_ACLS & ~GRANT_ACL; + else if (unlikely(lex->columns.elements)) + my_yyabort_error((ER_ILLEGAL_GRANT_FOR_TABLE, MYF(0))); + } + | table_ident + { + LEX *lex=Lex; + if (unlikely(!lex->current_select-> + add_table_to_list(thd, $1,NULL, + TL_OPTION_UPDATING))) + MYSQL_YYABORT; + if (lex->grant == GLOBAL_ACLS) + lex->grant = TABLE_ACLS & ~GRANT_ACL; + } + ; + +user_list: + user + { + if (unlikely(Lex->users_list.push_back($1, thd->mem_root))) + MYSQL_YYABORT; + } + | user_list ',' user + { + if (unlikely(Lex->users_list.push_back($3, thd->mem_root))) + MYSQL_YYABORT; + } + ; + +grant_list: + grant_user + { + if (unlikely(Lex->users_list.push_back($1, thd->mem_root))) + MYSQL_YYABORT; + } + | grant_list ',' grant_user + { + if (unlikely(Lex->users_list.push_back($3, thd->mem_root))) + MYSQL_YYABORT; + } + ; + +user_and_role_list: + user_or_role + { + if (unlikely(Lex->users_list.push_back($1, thd->mem_root))) + MYSQL_YYABORT; + } + | user_and_role_list ',' user_or_role + { + if (unlikely(Lex->users_list.push_back($3, thd->mem_root))) + MYSQL_YYABORT; + } + ; + +via_or_with: VIA_SYM | WITH ; +using_or_as: USING | AS ; + +grant_user: + user IDENTIFIED_SYM BY TEXT_STRING + { + $$= $1; + $1->pwtext= $4; + if (unlikely(Lex->sql_command == SQLCOM_REVOKE)) + MYSQL_YYABORT; + } + | user IDENTIFIED_SYM BY PASSWORD_SYM TEXT_STRING + { + $$= $1; + $1->pwhash= $5; + } + | user IDENTIFIED_SYM via_or_with ident_or_text + { + $$= $1; + $1->plugin= $4; + $1->auth= empty_clex_str; + } + | user IDENTIFIED_SYM via_or_with ident_or_text using_or_as TEXT_STRING_sys + { + $$= $1; + $1->plugin= $4; + $1->auth= $6; + } + | user_or_role + { $$= $1; } + ; + +opt_column_list: + /* empty */ + { + LEX *lex=Lex; + lex->grant |= lex->which_columns; + } + | '(' column_list ')' + ; + +column_list: + column_list ',' column_list_id + | column_list_id + ; + +column_list_id: + ident + { + String *new_str= new (thd->mem_root) String((const char*) $1.str,$1.length,system_charset_info); + if (unlikely(new_str == NULL)) + MYSQL_YYABORT; + List_iterator <LEX_COLUMN> iter(Lex->columns); + class LEX_COLUMN *point; + LEX *lex=Lex; + while ((point=iter++)) + { + if (!my_strcasecmp(system_charset_info, + point->column.c_ptr(), new_str->c_ptr())) + break; + } + lex->grant_tot_col|= lex->which_columns; + if (point) + point->rights |= lex->which_columns; + else + { + LEX_COLUMN *col= (new (thd->mem_root) + LEX_COLUMN(*new_str,lex->which_columns)); + if (unlikely(col == NULL)) + MYSQL_YYABORT; + lex->columns.push_back(col, thd->mem_root); + } + } + ; + +opt_require_clause: + /* empty */ + | REQUIRE_SYM require_list + { + Lex->ssl_type=SSL_TYPE_SPECIFIED; + } + | REQUIRE_SYM SSL_SYM + { + Lex->ssl_type=SSL_TYPE_ANY; + } + | REQUIRE_SYM X509_SYM + { + Lex->ssl_type=SSL_TYPE_X509; + } + | REQUIRE_SYM NONE_SYM + { + Lex->ssl_type=SSL_TYPE_NONE; + } + ; + +resource_option: + MAX_QUERIES_PER_HOUR ulong_num + { + LEX *lex=Lex; + lex->mqh.questions=$2; + lex->mqh.specified_limits|= USER_RESOURCES::QUERIES_PER_HOUR; + } + | MAX_UPDATES_PER_HOUR ulong_num + { + LEX *lex=Lex; + lex->mqh.updates=$2; + lex->mqh.specified_limits|= USER_RESOURCES::UPDATES_PER_HOUR; + } + | MAX_CONNECTIONS_PER_HOUR ulong_num + { + LEX *lex=Lex; + lex->mqh.conn_per_hour= $2; + lex->mqh.specified_limits|= USER_RESOURCES::CONNECTIONS_PER_HOUR; + } + | MAX_USER_CONNECTIONS_SYM int_num + { + LEX *lex=Lex; + lex->mqh.user_conn= $2; + lex->mqh.specified_limits|= USER_RESOURCES::USER_CONNECTIONS; + } + | MAX_STATEMENT_TIME_SYM NUM_literal + { + LEX *lex=Lex; + lex->mqh.max_statement_time= $2->val_real(); + lex->mqh.specified_limits|= USER_RESOURCES::MAX_STATEMENT_TIME; + } + ; + +resource_option_list: + resource_option_list resource_option {} + | resource_option {} + ; + +opt_resource_options: + /* empty */ {} + | WITH resource_option_list + ; + + +opt_grant_options: + /* empty */ {} + | WITH grant_option_list {} + ; + +opt_grant_option: + /* empty */ {} + | WITH GRANT OPTION { Lex->grant |= GRANT_ACL;} + ; + +grant_option_list: + grant_option_list grant_option {} + | grant_option {} + ; + +grant_option: + GRANT OPTION { Lex->grant |= GRANT_ACL;} + | resource_option {} + ; + +begin_stmt_mariadb: + BEGIN_MARIADB_SYM + { + LEX *lex=Lex; + lex->sql_command = SQLCOM_BEGIN; + lex->start_transaction_opt= 0; + } + opt_work {} + ; + +compound_statement: + sp_proc_stmt_compound_ok + { + Lex->sql_command= SQLCOM_COMPOUND; + Lex->sphead->set_stmt_end(thd); + Lex->sphead->restore_thd_mem_root(thd); + } + ; + +opt_not: + /* nothing */ { $$= 0; } + | not { $$= 1; } + ; + +opt_work: + /* empty */ {} + | WORK_SYM {} + ; + +opt_chain: + /* empty */ + { $$= TVL_UNKNOWN; } + | AND_SYM NO_SYM CHAIN_SYM { $$= TVL_NO; } + | AND_SYM CHAIN_SYM { $$= TVL_YES; } + ; + +opt_release: + /* empty */ + { $$= TVL_UNKNOWN; } + | RELEASE_SYM { $$= TVL_YES; } + | NO_SYM RELEASE_SYM { $$= TVL_NO; } +; + +commit: + COMMIT_SYM opt_work opt_chain opt_release + { + LEX *lex=Lex; + lex->sql_command= SQLCOM_COMMIT; + /* Don't allow AND CHAIN RELEASE. */ + MYSQL_YYABORT_UNLESS($3 != TVL_YES || $4 != TVL_YES); + lex->tx_chain= $3; + lex->tx_release= $4; + } + ; + +rollback: + ROLLBACK_SYM opt_work opt_chain opt_release + { + LEX *lex=Lex; + lex->sql_command= SQLCOM_ROLLBACK; + /* Don't allow AND CHAIN RELEASE. */ + MYSQL_YYABORT_UNLESS($3 != TVL_YES || $4 != TVL_YES); + lex->tx_chain= $3; + lex->tx_release= $4; + } + | ROLLBACK_SYM opt_work TO_SYM SAVEPOINT_SYM ident + { + LEX *lex=Lex; + lex->sql_command= SQLCOM_ROLLBACK_TO_SAVEPOINT; + lex->ident= $5; + } + | ROLLBACK_SYM opt_work TO_SYM ident + { + LEX *lex=Lex; + lex->sql_command= SQLCOM_ROLLBACK_TO_SAVEPOINT; + lex->ident= $4; + } + ; + +savepoint: + SAVEPOINT_SYM ident + { + LEX *lex=Lex; + lex->sql_command= SQLCOM_SAVEPOINT; + lex->ident= $2; + } + ; + +release: + RELEASE_SYM SAVEPOINT_SYM ident + { + LEX *lex=Lex; + lex->sql_command= SQLCOM_RELEASE_SAVEPOINT; + lex->ident= $3; + } + ; + +/* + UNIONS : glue selects together +*/ + +unit_type_decl: + UNION_SYM + { $$= UNION_TYPE; } + | INTERSECT_SYM + { $$= INTERSECT_TYPE; } + | EXCEPT_SYM + { $$= EXCEPT_TYPE; } + + +union_clause: + /* empty */ {} + | union_list + ; + +union_list: + unit_type_decl union_option + { + if (unlikely(Lex->add_select_to_union_list((bool)$2, $1, TRUE))) + MYSQL_YYABORT; + } + union_list_part2 + { + /* + Remove from the name resolution context stack the context of the + last select in the union. + */ + Lex->pop_context(); + } + ; + +union_list_view: + unit_type_decl union_option + { + if (unlikely(Lex->add_select_to_union_list((bool)$2, $1, TRUE))) + MYSQL_YYABORT; + } + query_expression_body_view + { + Lex->pop_context(); + } + ; + +union_order_or_limit: + { + LEX *lex= thd->lex; + DBUG_ASSERT(lex->current_select->linkage != GLOBAL_OPTIONS_TYPE); + SELECT_LEX *sel= lex->current_select; + SELECT_LEX_UNIT *unit= sel->master_unit(); + SELECT_LEX *fake= unit->fake_select_lex; + if (fake) + { + fake->no_table_names_allowed= 1; + lex->current_select= fake; + } + thd->where= "global ORDER clause"; + } + order_or_limit + { + thd->lex->current_select->no_table_names_allowed= 0; + thd->where= ""; + } + ; + +order_or_limit: + order_clause opt_limit_clause + | limit_clause + ; + +/* + Start a UNION, for non-top level query expressions. +*/ +union_head_non_top: + unit_type_decl union_option + { + if (unlikely(Lex->add_select_to_union_list((bool)$2, $1, FALSE))) + MYSQL_YYABORT; + } + ; + +union_option: + /* empty */ { $$=1; } + | DISTINCT { $$=1; } + | ALL { $$=0; } + ; + +simple_table: + query_specification { $$= $1; } + | table_value_constructor { $$= $1; } + ; + +table_value_constructor: + VALUES + { + Lex->tvc_start(); + } + values_list + { + $$= Lex->current_select; + if (Lex->tvc_finalize()) + MYSQL_YYABORT; + } + ; + +/* + Corresponds to the SQL Standard + <query specification> ::= + SELECT [ <set quantifier> ] <select list> <table expression> + + Notes: + - We allow more options in addition to <set quantifier> + - <table expression> is optional in MariaDB +*/ +query_specification: + SELECT_SYM select_init2_derived opt_table_expression + { + $$= Lex->current_select->master_unit()->first_select(); + } + ; + +query_term_union_not_ready: + simple_table order_or_limit opt_select_lock_type { $$= $1; } + | '(' select_paren_derived ')' union_order_or_limit { $$= $2; } + ; + +query_term_union_ready: + simple_table opt_select_lock_type { $$= $1; } + | '(' select_paren_derived ')' { $$= $2; } + ; + +query_expression_body: + query_term_union_not_ready { $$= $1; } + | query_term_union_ready { $$= $1; } + | query_term_union_ready union_list_derived { $$= $1; } + ; + +/* Corresponds to <query expression> in the SQL:2003 standard. */ +subselect: + subselect_start opt_with_clause query_expression_body subselect_end + { + $3->set_with_clause($2); + $$= $3; + } + ; + +subselect_start: + { + LEX *lex=Lex; + if (unlikely(!lex->expr_allows_subselect || + lex->sql_command == (int)SQLCOM_PURGE)) + { + thd->parse_error(); + MYSQL_YYABORT; + } + /* + we are making a "derived table" for the parenthesis + as we need to have a lex level to fit the union + after the parenthesis, e.g. + (SELECT .. ) UNION ... becomes + SELECT * FROM ((SELECT ...) UNION ...) + */ + if (unlikely(mysql_new_select(Lex, 1, NULL))) + MYSQL_YYABORT; + } + ; + +subselect_end: + { + LEX *lex=Lex; + + lex->check_automatic_up(UNSPECIFIED_TYPE); + lex->pop_context(); + SELECT_LEX *child= lex->current_select; + lex->current_select = lex->current_select->return_after_parsing(); + lex->nest_level--; + lex->current_select->n_child_sum_items += child->n_sum_items; + + /* + A subquery (and all the subsequent query blocks in a UNION) can + add columns to an outer query block. Reserve space for them. + Aggregate functions in having clause can also add fields to an + outer select. + */ + for (SELECT_LEX *temp= child->master_unit()->first_select(); + temp != NULL; temp= temp->next_select()) + { + lex->current_select->select_n_where_fields+= + temp->select_n_where_fields; + lex->current_select->select_n_having_items+= + temp->select_n_having_items; + } + } + ; + +opt_query_expression_options: + /* empty */ + | query_expression_option_list + ; + +query_expression_option_list: + query_expression_option_list query_expression_option + | query_expression_option + ; + +query_expression_option: + STRAIGHT_JOIN { Select->options|= SELECT_STRAIGHT_JOIN; } + | HIGH_PRIORITY + { + if (unlikely(Lex->check_simple_select(&$1))) + MYSQL_YYABORT; + YYPS->m_lock_type= TL_READ_HIGH_PRIORITY; + YYPS->m_mdl_type= MDL_SHARED_READ; + Select->options|= SELECT_HIGH_PRIORITY; + } + | DISTINCT { Select->options|= SELECT_DISTINCT; } + | UNIQUE_SYM { Select->options|= SELECT_DISTINCT; } + | SQL_SMALL_RESULT { Select->options|= SELECT_SMALL_RESULT; } + | SQL_BIG_RESULT { Select->options|= SELECT_BIG_RESULT; } + | SQL_BUFFER_RESULT + { + if (unlikely(Lex->check_simple_select(&$1))) + MYSQL_YYABORT; + Select->options|= OPTION_BUFFER_RESULT; + } + | SQL_CALC_FOUND_ROWS + { + if (unlikely(Lex->check_simple_select(&$1))) + MYSQL_YYABORT; + Select->options|= OPTION_FOUND_ROWS; + } + | ALL { Select->options|= SELECT_ALL; } + ; + +/************************************************************************** + + DEFINER clause support. + +**************************************************************************/ + +definer_opt: + no_definer + | definer + ; + +no_definer: + /* empty */ + { + /* + We have to distinguish missing DEFINER-clause from case when + CURRENT_USER specified as definer explicitly in order to properly + handle CREATE TRIGGER statements which come to replication thread + from older master servers (i.e. to create non-suid trigger in this + case). + */ + thd->lex->definer= 0; + } + ; + +definer: + DEFINER_SYM '=' user_or_role + { + Lex->definer= $3; + Lex->ssl_type= SSL_TYPE_NOT_SPECIFIED; + Lex->ssl_cipher= Lex->x509_subject= Lex->x509_issuer= 0; + bzero(&(Lex->mqh), sizeof(Lex->mqh)); + } + ; + +/************************************************************************** + + CREATE VIEW statement parts. + +**************************************************************************/ + +view_algorithm: + ALGORITHM_SYM '=' UNDEFINED_SYM { $$= DTYPE_ALGORITHM_UNDEFINED; } + | ALGORITHM_SYM '=' MERGE_SYM { $$= VIEW_ALGORITHM_MERGE; } + | ALGORITHM_SYM '=' TEMPTABLE_SYM { $$= VIEW_ALGORITHM_TMPTABLE; } + ; + +opt_view_suid: + /* empty */ { $$= VIEW_SUID_DEFAULT; } + | view_suid { $$= $1; } + ; + +view_suid: + SQL_SYM SECURITY_SYM DEFINER_SYM { $$= VIEW_SUID_DEFINER; } + | SQL_SYM SECURITY_SYM INVOKER_SYM { $$= VIEW_SUID_INVOKER; } + ; + +view_list_opt: + /* empty */ + {} + | '(' view_list ')' + ; + +view_list: + ident + { + Lex->view_list.push_back((LEX_CSTRING*) + thd->memdup(&$1, sizeof(LEX_CSTRING)), + thd->mem_root); + } + | view_list ',' ident + { + Lex->view_list.push_back((LEX_CSTRING*) + thd->memdup(&$3, sizeof(LEX_CSTRING)), + thd->mem_root); + } + ; + +view_select: + { + LEX *lex= Lex; + lex->parsing_options.allows_variable= FALSE; + lex->create_view->select.str= (char *) YYLIP->get_cpp_ptr(); + } + opt_with_clause query_expression_body_view view_check_option + { + LEX *lex= Lex; + size_t len= YYLIP->get_cpp_ptr() - lex->create_view->select.str; + void *create_view_select= thd->memdup(lex->create_view->select.str, len); + lex->create_view->select.length= len; + lex->create_view->select.str= (char *) create_view_select; + trim_whitespace(thd->charset(), + &lex->create_view->select); + lex->create_view->check= $4; + lex->parsing_options.allows_variable= TRUE; + lex->current_select->set_with_clause($2); + } + ; + +/* + SQL Standard <query expression body> for VIEWs. + Does not include INTO and PROCEDURE clauses. +*/ +query_expression_body_view: + SELECT_SYM select_options_and_item_list select_init3_view + | table_value_constructor + | table_value_constructor union_order_or_limit + | table_value_constructor union_list_view + | '(' select_paren_view ')' + | '(' select_paren_view ')' union_order_or_limit + | '(' select_paren_view ')' union_list_view + ; + +view_check_option: + /* empty */ { $$= VIEW_CHECK_NONE; } + | WITH CHECK_SYM OPTION { $$= VIEW_CHECK_CASCADED; } + | WITH CASCADED CHECK_SYM OPTION { $$= VIEW_CHECK_CASCADED; } + | WITH LOCAL_SYM CHECK_SYM OPTION { $$= VIEW_CHECK_LOCAL; } + ; + +/************************************************************************** + + CREATE TRIGGER statement parts. + +**************************************************************************/ + +trigger_action_order: + FOLLOWS_SYM + { $$= TRG_ORDER_FOLLOWS; } + | PRECEDES_SYM + { $$= TRG_ORDER_PRECEDES; } + ; + +trigger_follows_precedes_clause: + /* empty */ + { + $$.ordering_clause= TRG_ORDER_NONE; + $$.anchor_trigger_name.str= NULL; + $$.anchor_trigger_name.length= 0; + } + | + trigger_action_order ident_or_text + { + $$.ordering_clause= $1; + $$.anchor_trigger_name= $2; + } + ; + +trigger_tail: + remember_name + opt_if_not_exists + { + if (unlikely(Lex->add_create_options_with_check($2))) + MYSQL_YYABORT; + } + sp_name + trg_action_time + trg_event + ON + remember_name /* $8 */ + { /* $9 */ + Lex->raw_trg_on_table_name_begin= YYLIP->get_tok_start(); + } + table_ident /* $10 */ + FOR_SYM + remember_name /* $12 */ + { /* $13 */ + Lex->raw_trg_on_table_name_end= YYLIP->get_tok_start(); + } + EACH_SYM + ROW_SYM + { + Lex->trg_chistics.ordering_clause_begin= YYLIP->get_cpp_ptr(); + } + trigger_follows_precedes_clause /* $17 */ + { /* $18 */ + LEX *lex= thd->lex; + Lex_input_stream *lip= YYLIP; + + if (unlikely(lex->sphead)) + my_yyabort_error((ER_SP_NO_RECURSIVE_CREATE, MYF(0), "TRIGGER")); + + lex->stmt_definition_begin= $1; + lex->ident.str= $8; + lex->ident.length= $12 - $8; + lex->spname= $4; + (*static_cast<st_trg_execution_order*>(&lex->trg_chistics))= ($17); + lex->trg_chistics.ordering_clause_end= lip->get_cpp_ptr(); + + if (unlikely(!lex->make_sp_head(thd, $4, &sp_handler_trigger))) + MYSQL_YYABORT; + + lex->sphead->set_body_start(thd, lip->get_cpp_tok_start()); + } + sp_proc_stmt /* $19 */ + { /* $20 */ + LEX *lex= Lex; + sp_head *sp= lex->sphead; + if (unlikely(sp->check_unresolved_goto())) + MYSQL_YYABORT; + + lex->sql_command= SQLCOM_CREATE_TRIGGER; + sp->set_stmt_end(thd); + sp->restore_thd_mem_root(thd); + + if (unlikely(sp->is_not_allowed_in_function("trigger"))) + MYSQL_YYABORT; + + /* + We have to do it after parsing trigger body, because some of + sp_proc_stmt alternatives are not saving/restoring LEX, so + lex->query_tables can be wiped out. + */ + if (unlikely(!lex->select_lex. + add_table_to_list(thd, $10, (LEX_CSTRING*) 0, + TL_OPTION_UPDATING, + TL_READ_NO_INSERT, + MDL_SHARED_NO_WRITE))) + MYSQL_YYABORT; + } + ; + +/************************************************************************** + + CREATE FUNCTION | PROCEDURE statements parts. + +**************************************************************************/ + +udf_tail: + opt_if_not_exists ident + RETURNS_SYM udf_type SONAME_SYM TEXT_STRING_sys + { + LEX *lex= thd->lex; + if (unlikely(lex->add_create_options_with_check($1))) + MYSQL_YYABORT; + if (unlikely(is_native_function(thd, & $2))) + my_yyabort_error((ER_NATIVE_FCT_NAME_COLLISION, MYF(0), $2.str)); + lex->sql_command= SQLCOM_CREATE_FUNCTION; + lex->udf.name= $2; + lex->udf.returns= (Item_result) $4; + lex->udf.dl= $6.str; + } + ; + + +sf_return_type: + RETURN_ORACLE_SYM + { + LEX *lex= Lex; + lex->init_last_field(&lex->sphead->m_return_field_def, + &empty_clex_str, + thd->variables.collation_database); + } + sp_param_type_with_opt_collate + { + if (unlikely(Lex->sphead->fill_field_definition(thd, + Lex->last_field))) + MYSQL_YYABORT; + } + ; + +sf_tail: + opt_if_not_exists + sp_name + { + Lex->sql_command= SQLCOM_CREATE_SPFUNCTION; + if (unlikely(!Lex->make_sp_head_no_recursive(thd, $1, $2, + &sp_handler_function))) + MYSQL_YYABORT; + } + opt_sp_parenthesized_fdparam_list + sf_return_type + sp_c_chistics + { + LEX *lex= thd->lex; + Lex_input_stream *lip= YYLIP; + + lex->sphead->set_chistics(lex->sp_chistics); + lex->sphead->set_body_start(thd, lip->get_cpp_tok_start()); + } + sp_tail_is + sp_body + { + if (unlikely(Lex->sp_body_finalize_function(thd))) + MYSQL_YYABORT; + if (unlikely(Lex->sphead->m_flags & sp_head::HAS_AGGREGATE_INSTR)) + { + my_yyabort_error((ER_NOT_AGGREGATE_FUNCTION, MYF(0))); + } + Lex->sphead->set_chistics_agg_type(NOT_AGGREGATE); + } + ; + +sp_tail: + opt_if_not_exists sp_name + { + Lex->sql_command= SQLCOM_CREATE_PROCEDURE; + if (unlikely(!Lex->make_sp_head_no_recursive(thd, $1, $2, + &sp_handler_procedure))) + MYSQL_YYABORT; + } + opt_sp_parenthesized_pdparam_list + sp_c_chistics + { + Lex->sphead->set_chistics(Lex->sp_chistics); + Lex->sphead->set_body_start(thd, YYLIP->get_cpp_tok_start()); + } + sp_tail_is + sp_body + { + if (unlikely(Lex->sp_body_finalize_procedure(thd))) + MYSQL_YYABORT; + } + ; + +sf_tail_standalone: + sf_tail opt_sp_name + { + if (unlikely($2 && !$2->eq(Lex->sphead))) + my_yyabort_error((ER_END_IDENTIFIER_DOES_NOT_MATCH, MYF(0), + ErrConvDQName($2).ptr(), + ErrConvDQName(Lex->sphead).ptr())); + } + ; + +sp_tail_standalone: + sp_tail opt_sp_name + { + if (unlikely($2 && !$2->eq(Lex->sphead))) + my_yyabort_error((ER_END_IDENTIFIER_DOES_NOT_MATCH, MYF(0), + ErrConvDQName($2).ptr(), + ErrConvDQName(Lex->sphead).ptr())); + } + ; + +opt_package_routine_end_name: + /* Empty */ { $$= null_clex_str; } + | ident { $$= $1; } + ; + +sp_tail_is: + IS + | AS + ; + +/*************************************************************************/ + +xa: + XA_SYM begin_or_start xid opt_join_or_resume + { + Lex->sql_command = SQLCOM_XA_START; + } + | XA_SYM END xid opt_suspend + { + Lex->sql_command = SQLCOM_XA_END; + } + | XA_SYM PREPARE_SYM xid + { + Lex->sql_command = SQLCOM_XA_PREPARE; + } + | XA_SYM COMMIT_SYM xid opt_one_phase + { + Lex->sql_command = SQLCOM_XA_COMMIT; + } + | XA_SYM ROLLBACK_SYM xid + { + Lex->sql_command = SQLCOM_XA_ROLLBACK; + } + | XA_SYM RECOVER_SYM opt_format_xid + { + Lex->sql_command = SQLCOM_XA_RECOVER; + Lex->verbose= $3; + } + ; + +opt_format_xid: + /* empty */ { $$= false; } + | FORMAT_SYM '=' ident_or_text + { + if (lex_string_eq(&$3, STRING_WITH_LEN("SQL"))) + $$= true; + else if (lex_string_eq(&$3, STRING_WITH_LEN("RAW"))) + $$= false; + else + { + my_yyabort_error((ER_UNKNOWN_EXPLAIN_FORMAT, MYF(0), + "XA RECOVER", $3.str)); + $$= false; + } + } + ; + +xid: + text_string + { + MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE); + if (unlikely(!(Lex->xid=(XID *)thd->alloc(sizeof(XID))))) + MYSQL_YYABORT; + Lex->xid->set(1L, $1->ptr(), $1->length(), 0, 0); + } + | text_string ',' text_string + { + MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE); + if (unlikely(!(Lex->xid=(XID *)thd->alloc(sizeof(XID))))) + MYSQL_YYABORT; + Lex->xid->set(1L, $1->ptr(), $1->length(), $3->ptr(), $3->length()); + } + | text_string ',' text_string ',' ulong_num + { + MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE); + if (unlikely(!(Lex->xid=(XID *)thd->alloc(sizeof(XID))))) + MYSQL_YYABORT; + Lex->xid->set($5, $1->ptr(), $1->length(), $3->ptr(), $3->length()); + } + ; + +begin_or_start: + BEGIN_MARIADB_SYM {} + | BEGIN_ORACLE_SYM {} + | START_SYM {} + ; + +opt_join_or_resume: + /* nothing */ { Lex->xa_opt=XA_NONE; } + | JOIN_SYM { Lex->xa_opt=XA_JOIN; } + | RESUME_SYM { Lex->xa_opt=XA_RESUME; } + ; + +opt_one_phase: + /* nothing */ { Lex->xa_opt=XA_NONE; } + | ONE_SYM PHASE_SYM { Lex->xa_opt=XA_ONE_PHASE; } + ; + +opt_suspend: + /* nothing */ + { Lex->xa_opt=XA_NONE; } + | SUSPEND_SYM + { Lex->xa_opt=XA_SUSPEND; } + opt_migrate + ; + +opt_migrate: + /* nothing */ {} + | FOR_SYM MIGRATE_SYM { Lex->xa_opt=XA_FOR_MIGRATE; } + ; + +install: + INSTALL_SYM PLUGIN_SYM ident SONAME_SYM TEXT_STRING_sys + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_INSTALL_PLUGIN; + lex->comment= $3; + lex->ident= $5; + } + | INSTALL_SYM SONAME_SYM TEXT_STRING_sys + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_INSTALL_PLUGIN; + lex->comment= null_clex_str; + lex->ident= $3; + } + ; + +uninstall: + UNINSTALL_SYM PLUGIN_SYM ident + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_UNINSTALL_PLUGIN; + lex->comment= $3; + } + | UNINSTALL_SYM SONAME_SYM TEXT_STRING_sys + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_UNINSTALL_PLUGIN; + lex->comment= null_clex_str; + lex->ident= $3; + } + ; + +/* Avoid compiler warning from sql_yacc.cc where yyerrlab1 is not used */ +keep_gcc_happy: + IMPOSSIBLE_ACTION + { + YYERROR; + } + +/** + @} (end of group Parser) +*/ diff --cc sql/table.cc index 7042959215d,e1c28212121..e46af771507 --- a/sql/table.cc +++ b/sql/table.cc @@@ -6096,11 -5986,12 +6096,12 @@@ const char *Field_iterator_table_ref::g if (table_ref->is_derived()) return table_ref->table->s->table_name.str; else if (table_ref->is_natural_join) - return natural_join_it.column_ref()->table_name(); + return natural_join_it.column_ref()->safe_table_name(); - DBUG_ASSERT(!strcmp(table_ref->table_name, + DBUG_ASSERT(!strcmp(table_ref->table_name.str, - table_ref->table->s->table_name.str)); + table_ref->table->s->table_name.str) || + table_ref->schema_table); - return table_ref->table_name; + return table_ref->table_name.str; } diff --cc sql/table.h index b7c14e0a606,e72e2bb2902..abef6e44806 --- a/sql/table.h +++ b/sql/table.h @@@ -1941,42 -1770,35 +1941,43 @@@ struct TABLE_LIS else mdl_type= MDL_SHARED_READ; - DBUG_ASSERT(!db_name_arg || strlen(db_name_arg) == db_length_arg); - DBUG_ASSERT(!table_name_arg || strlen(table_name_arg) == table_name_length_arg); reset(); - db= (char*) db_name_arg; - db_length= db_length_arg; - table_name= (char*) table_name_arg; - table_name_length= table_name_length_arg; - alias= (char*) (alias_arg ? alias_arg : table_name_arg); + DBUG_ASSERT(!db_arg->str || strlen(db_arg->str) == db_arg->length); + DBUG_ASSERT(!table_name_arg->str || strlen(table_name_arg->str) == table_name_arg->length); + DBUG_ASSERT(!alias_arg || strlen(alias_arg->str) == alias_arg->length); + db= *db_arg; + table_name= *table_name_arg; + alias= (alias_arg ? *alias_arg : *table_name_arg); lock_type= lock_type_arg; + updating= lock_type >= TL_WRITE_ALLOW_WRITE; - mdl_request.init(MDL_key::TABLE, db, table_name, mdl_type, MDL_TRANSACTION); - } - - inline void init_one_table_for_prelocking(const char *db_name_arg, - size_t db_length_arg, - const char *table_name_arg, - size_t table_name_length_arg, - const char *alias_arg, - enum thr_lock_type lock_type_arg, - bool routine, - TABLE_LIST *belong_to_view_arg, - uint8 trg_event_map_arg, - TABLE_LIST ***last_ptr) - { - init_one_table(db_name_arg, db_length_arg, table_name_arg, - table_name_length_arg, alias_arg, lock_type_arg); + mdl_request.init(MDL_key::TABLE, db.str, table_name.str, mdl_type, + MDL_TRANSACTION); + } + + TABLE_LIST(TABLE *table_arg, thr_lock_type lock_type) + { + DBUG_ASSERT(table_arg->s); + init_one_table(&table_arg->s->db, &table_arg->s->table_name, + NULL, lock_type); + table= table_arg; + } + + inline void init_one_table_for_prelocking(const LEX_CSTRING *db_arg, + const LEX_CSTRING *table_name_arg, + const LEX_CSTRING *alias_arg, + enum thr_lock_type lock_type_arg, + prelocking_types prelocking_type, + TABLE_LIST *belong_to_view_arg, + uint8 trg_event_map_arg, + TABLE_LIST ***last_ptr) + + { + init_one_table(db_arg, table_name_arg, alias_arg, lock_type_arg); cacheable_table= 1; - prelocking_placeholder= routine ? ROUTINE : FK; - open_type= routine ? OT_TEMPORARY_OR_BASE : OT_BASE_ONLY; + prelocking_placeholder= prelocking_type; + open_type= (prelocking_type == PRELOCK_ROUTINE ? + OT_TEMPORARY_OR_BASE : + OT_BASE_ONLY); belong_to_view= belong_to_view_arg; trg_event_map= trg_event_map_arg; diff --cc storage/connect/ha_connect.h index 789b4ba3ce6,de61f868038..c60b1017549 --- a/storage/connect/ha_connect.h +++ b/storage/connect/ha_connect.h @@@ -509,9 -509,10 +509,10 @@@ private DsMrr_impl ds_mrr; protected: - bool check_privileges(THD *thd, PTOS options, char *dbn, bool quick=false); + bool check_privileges(THD *thd, PTOS options, const char *dbn, bool quick=false); MODE CheckMode(PGLOBAL g, THD *thd, MODE newmode, bool *chk, bool *cras); - char *GetDBfromName(const char *name); + int check_stmt(PGLOBAL g, MODE newmode, bool cras); + char *GetDBfromName(const char *name); // Members static ulong num; // Tracable handler number diff --cc storage/innobase/fts/fts0fts.cc index 59d60ec4a15,57ee9a66c15..5e5077f3481 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@@ -2073,8 -2059,7 +2065,7 @@@ fts_create_index_tables(trx_t* trx, con fts_table.type = FTS_INDEX_TABLE; fts_table.index_id = index->id; - fts_table.table_id = table_id; + fts_table.table_id = id; - fts_table.parent = index->table->name.m_name; fts_table.table = index->table; /* aux_idx_tables vector is used for dropping FTS AUX INDEX @@@ -2659,9 -2676,7 +2649,7 @@@ retry fts_table.type = FTS_COMMON_TABLE; fts_table.table = table; - fts_table.parent = table->name.m_name; - - trx = trx_allocate_for_background(); + trx = trx_create(); if (srv_read_only_mode) { trx_start_internal_read_only(trx); } else { @@@ -2783,14 -2797,9 +2770,9 @@@ fts_update_sync_doc_id fts_table.table_id = table->id; fts_table.type = FTS_COMMON_TABLE; fts_table.table = table; - if (table_name) { - fts_table.parent = table_name; - } else { - fts_table.parent = table->name.m_name; - } if (!trx) { - trx = trx_allocate_for_background(); + trx = trx_create(); trx_start_internal(trx); trx->op_info = "setting last FTS document id"; diff --cc storage/innobase/fts/fts0opt.cc index f91ebcbf2a6,2d39643f770..42d3eb158ce --- a/storage/innobase/fts/fts0opt.cc +++ b/storage/innobase/fts/fts0opt.cc @@@ -1605,10 -1596,9 +1596,9 @@@ fts_optimize_create optim->table = table; - optim->trx = trx_allocate_for_background(); + optim->trx = trx_create(); trx_start_internal(optim->trx); - optim->fts_common_table.parent = table->name.m_name; optim->fts_common_table.table_id = table->id; optim->fts_common_table.type = FTS_COMMON_TABLE; optim->fts_common_table.table = table; diff --cc storage/innobase/handler/ha_innodb.cc index 35f748d4754,7c9d81cdd7f..3f810ba0e03 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@@ -14807,9 -15098,13 +14807,13 @@@ get_foreign_key_info char tmp_buff[NAME_LEN+1]; char name_buff[NAME_LEN+1]; const char* ptr; - LEX_STRING* referenced_key_name; - LEX_STRING* name = NULL; + LEX_CSTRING* referenced_key_name; + LEX_CSTRING* name = NULL; + if (dict_table_t::is_temporary_name(foreign->foreign_table_name)) { + return NULL; + } + ptr = dict_remove_db_name(foreign->id); f_key_info.foreign_id = thd_make_lex_string( thd, 0, ptr, strlen(ptr), 1); diff --cc storage/innobase/handler/handler0alter.cc index 70f2c1940fc,f470ac3ca4c..a2e503de88f --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@@ -288,15 -234,6 +288,19 @@@ struct ha_innobase_inplace_ctx : publi ~ha_innobase_inplace_ctx() { UT_DELETE(m_stage); + if (instant_table) { ++ ut_ad(!instant_table->id); + while (dict_index_t* index + = UT_LIST_GET_LAST(instant_table->indexes)) { + UT_LIST_REMOVE(instant_table->indexes, index); + rw_lock_free(&index->lock); + dict_mem_index_free(index); + } ++ if (instant_table->fts) { ++ fts_free(instant_table); ++ } + dict_mem_table_free(instant_table); + } mem_heap_free(heap); } @@@ -314,36 -251,23 +318,53 @@@ } } + /** Convert table-rebuilding ALTER to instant ALTER. */ + void prepare_instant() + { + DBUG_ASSERT(need_rebuild()); + DBUG_ASSERT(!is_instant()); + DBUG_ASSERT(old_table->n_cols == old_table->n_def); + DBUG_ASSERT(new_table->n_cols == new_table->n_def); + DBUG_ASSERT(old_table->n_cols == old_n_cols); + DBUG_ASSERT(new_table->n_cols > old_table->n_cols); + instant_table = new_table; + + new_table = old_table; + export_vars.innodb_instant_alter_column++; + } + + /** Revert prepare_instant() if the transaction is rolled back. */ + void rollback_instant() + { + if (!is_instant()) return; + old_table->rollback_instant(old_n_cols, + old_cols, old_col_names); + } + + /** @return whether this is instant ALTER TABLE */ + bool is_instant() const + { + DBUG_ASSERT(!instant_table || !instant_table->can_be_evicted); + return instant_table; + } + + /** Share context between partitions. + @param[in] ctx context from another partition of the table */ + void set_shared_data(const inplace_alter_handler_ctx& ctx) + { + if (add_autoinc != ULINT_UNDEFINED) { + const ha_innobase_inplace_ctx& ha_ctx = + static_cast<const ha_innobase_inplace_ctx&> + (ctx); + /* When adding an AUTO_INCREMENT column to a + partitioned InnoDB table, we must share the + sequence for all partitions. */ + ut_ad(ha_ctx.add_autoinc == add_autoinc); + ut_ad(ha_ctx.sequence.last()); + sequence = ha_ctx.sequence; + } + } + private: // Disable copying ha_innobase_inplace_ctx(const ha_innobase_inplace_ctx&); diff --cc storage/innobase/include/fts0priv.h index 85331cbd31e,45a50cd2938..a86dbd149b1 --- a/storage/innobase/include/fts0priv.h +++ b/storage/innobase/include/fts0priv.h @@@ -318,10 -315,10 +315,9 @@@ the dict mute que_t* fts_parse_sql_no_dict_lock( /*=======================*/ - fts_table_t* fts_table, /*!< in: table with FTS index */ pars_info_t* info, /*!< in: parser info */ const char* sql) /*!< in: SQL string to evaluate */ - MY_ATTRIBUTE((warn_unused_result)); - - MY_ATTRIBUTE((nonnull(3), malloc, warn_unused_result)); ++ MY_ATTRIBUTE((nonnull(2), malloc, warn_unused_result)); /******************************************************************//** Get value from config table. The caller must ensure that enough space is allocated for value to hold the column contents diff --cc storage/innobase/log/log0log.cc index 409b42c452a,316e337ec4e..1cefc848fa3 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@@ -710,13 -883,12 +710,11 @@@ log_file_header_flush " file " ULINTPF " header", start_lsn, nth_file)); - log_sys->n_log_ios++; + log_sys.n_log_ios++; - MONITOR_INC(MONITOR_LOG_IO); - srv_stats.os_log_pending_writes.inc(); - const ulint page_no - = (ulint) (dest_offset / univ_page_size.physical()); + const ulint page_no = ulint(dest_offset >> srv_page_size_shift); fil_io(IORequestLogWrite, true, page_id_t(SRV_LOG_SPACE_FIRST_ID, page_no), @@@ -827,15 -1002,14 +825,13 @@@ loop log_block_store_checksum(buf + i * OS_FILE_LOG_BLOCK_SIZE); } - log_sys->n_log_ios++; + log_sys.n_log_ios++; - MONITOR_INC(MONITOR_LOG_IO); - srv_stats.os_log_pending_writes.inc(); - ut_a(next_offset / UNIV_PAGE_SIZE <= ULINT_MAX); + ut_a((next_offset >> srv_page_size_shift) <= ULINT_MAX); - const ulint page_no - = (ulint) (next_offset / univ_page_size.physical()); + const ulint page_no = ulint(next_offset >> srv_page_size_shift); fil_io(IORequestLogWrite, true, page_id_t(SRV_LOG_SPACE_FIRST_ID, page_no), @@@ -1013,15 -1187,14 +1008,14 @@@ loop ulint pad_size; DBUG_PRINT("ib_log", ("write " LSN_PF " to " LSN_PF, - log_sys->write_lsn, - log_sys->lsn)); + log_sys.write_lsn, + log_sys.lsn)); if (flush_to_disk) { - log_sys->n_pending_flushes++; - log_sys->current_flush_lsn = log_sys->lsn; - os_event_reset(log_sys->flush_event); + log_sys.n_pending_flushes++; + log_sys.current_flush_lsn = log_sys.lsn; - MONITOR_INC(MONITOR_PENDING_LOG_FLUSH); + os_event_reset(log_sys.flush_event); - if (log_sys->buf_free == log_sys->buf_next_to_write) { + if (log_sys.buf_free == log_sys.buf_next_to_write) { /* Nothing to write, flush only */ log_mutex_exit_all(); log_write_flush_to_disk_low(); diff --cc storage/innobase/srv/srv0mon.cc index 85d9f0522aa,ff965989ce4..090cea262fa --- a/storage/innobase/srv/srv0mon.cc +++ b/storage/innobase/srv/srv0mon.cc @@@ -2004,9 -2007,28 +2007,28 @@@ srv_mon_process_existing_counter break; case MONITOR_OVLD_LSN_CURRENT: - value = (mon_type_t) log_sys->lsn; + value = (mon_type_t) log_sys.lsn; break; + case MONITOR_PENDING_LOG_FLUSH: - mutex_enter(&log_sys->mutex); - value = static_cast<mon_type_t>(log_sys->n_pending_flushes); - mutex_exit(&log_sys->mutex); ++ mutex_enter(&log_sys.mutex); ++ value = static_cast<mon_type_t>(log_sys.n_pending_flushes); ++ mutex_exit(&log_sys.mutex); + break; + + case MONITOR_PENDING_CHECKPOINT_WRITE: - mutex_enter(&log_sys->mutex); ++ mutex_enter(&log_sys.mutex); + value = static_cast<mon_type_t>( - log_sys->n_pending_checkpoint_writes); - mutex_exit(&log_sys->mutex); ++ log_sys.n_pending_checkpoint_writes); ++ mutex_exit(&log_sys.mutex); + break; + + case MONITOR_LOG_IO: - mutex_enter(&log_sys->mutex); - value = static_cast<mon_type_t>(log_sys->n_log_ios); - mutex_exit(&log_sys->mutex); ++ mutex_enter(&log_sys.mutex); ++ value = static_cast<mon_type_t>(log_sys.n_log_ios); ++ mutex_exit(&log_sys.mutex); + break; + case MONITOR_OVLD_BUF_OLDEST_LSN: value = (mon_type_t) buf_pool_get_oldest_modification(); break; diff --cc storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result index 00000000000,55599a1268a..8d5b6270318 mode 000000,100644..100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result @@@ -1,0 -1,344 +1,344 @@@ + SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX; -trx_id trx_state trx_started trx_requested_lock_id trx_wait_started trx_weight trx_mysql_thread_id trx_query trx_operation_state trx_tables_in_use trx_tables_locked trx_lock_structs trx_lock_memory_bytes trx_rows_locked trx_rows_modified trx_concurrency_tickets trx_isolation_level trx_unique_checks trx_foreign_key_checks trx_last_foreign_key_error trx_adaptive_hash_latched trx_is_read_only trx_autocommit_non_locking ++trx_id trx_state trx_started trx_requested_lock_id trx_wait_started trx_weight trx_mysql_thread_id trx_query trx_operation_state trx_tables_in_use trx_tables_locked trx_lock_structs trx_lock_memory_bytes trx_rows_locked trx_rows_modified trx_concurrency_tickets trx_isolation_level trx_unique_checks trx_foreign_key_checks trx_last_foreign_key_error trx_is_read_only trx_autocommit_non_locking + SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS; + lock_id lock_trx_id lock_mode lock_type lock_table lock_index lock_space lock_page lock_rec lock_data + SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS; + requesting_trx_id requested_lock_id blocking_trx_id blocking_lock_id + SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP; + page_size compress_ops compress_ops_ok compress_time uncompress_ops uncompress_time + SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP_RESET; + page_size compress_ops compress_ops_ok compress_time uncompress_ops uncompress_time + SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX; + database_name table_name index_name compress_ops compress_ops_ok compress_time uncompress_ops uncompress_time + SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX_RESET; + database_name table_name index_name compress_ops compress_ops_ok compress_time uncompress_ops uncompress_time + SELECT * FROM INFORMATION_SCHEMA.INNODB_CMPMEM; + page_size buffer_pool_instance pages_used pages_free relocation_ops relocation_time + SELECT * FROM INFORMATION_SCHEMA.INNODB_CMPMEM_RESET; + page_size buffer_pool_instance pages_used pages_free relocation_ops relocation_time + SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS; + NAME SUBSYSTEM COUNT MAX_COUNT MIN_COUNT AVG_COUNT COUNT_RESET MAX_COUNT_RESET MIN_COUNT_RESET AVG_COUNT_RESET TIME_ENABLED TIME_DISABLED TIME_ELAPSED TIME_RESET STATUS TYPE COMMENT + metadata_table_handles_opened metadata 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of table handles opened + metadata_table_handles_closed metadata 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of table handles closed + metadata_table_reference_count metadata 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Table reference counter + lock_deadlocks lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of deadlocks + lock_timeouts lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of lock timeouts + lock_rec_lock_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times enqueued into record lock wait queue + lock_table_lock_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times enqueued into table lock wait queue + lock_rec_lock_requests lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of record locks requested + lock_rec_lock_created lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of record locks created + lock_rec_lock_removed lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of record locks removed from the lock queue + lock_rec_locks lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Current number of record locks on tables + lock_table_lock_created lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of table locks created + lock_table_lock_removed lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of table locks removed from the lock queue + lock_table_locks lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Current number of table locks on tables + lock_row_lock_current_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of row locks currently being waited for (innodb_row_lock_current_waits) + lock_row_lock_time lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Time spent in acquiring row locks, in milliseconds (innodb_row_lock_time) + lock_row_lock_time_max lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value The maximum time to acquire a row lock, in milliseconds (innodb_row_lock_time_max) + lock_row_lock_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of times a row lock had to be waited for (innodb_row_lock_waits) + lock_row_lock_time_avg lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value The average time to acquire a row lock, in milliseconds (innodb_row_lock_time_avg) + buffer_pool_size server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Server buffer pool size (all buffer pools) in bytes + buffer_pool_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of reads directly from disk (innodb_buffer_pool_reads) + buffer_pool_read_requests buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of logical read requests (innodb_buffer_pool_read_requests) + buffer_pool_write_requests buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of write requests (innodb_buffer_pool_write_requests) + buffer_pool_wait_free buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of times waited for free buffer (innodb_buffer_pool_wait_free) + buffer_pool_read_ahead buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pages read as read ahead (innodb_buffer_pool_read_ahead) + buffer_pool_read_ahead_evicted buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Read-ahead pages evicted without being accessed (innodb_buffer_pool_read_ahead_evicted) + buffer_pool_pages_total buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Total buffer pool size in pages (innodb_buffer_pool_pages_total) + buffer_pool_pages_misc buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Buffer pages for misc use such as row locks or the adaptive hash index (innodb_buffer_pool_pages_misc) + buffer_pool_pages_data buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Buffer pages containing data (innodb_buffer_pool_pages_data) + buffer_pool_bytes_data buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Buffer bytes containing data (innodb_buffer_pool_bytes_data) + buffer_pool_pages_dirty buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Buffer pages currently dirty (innodb_buffer_pool_pages_dirty) + buffer_pool_bytes_dirty buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Buffer bytes currently dirty (innodb_buffer_pool_bytes_dirty) + buffer_pool_pages_free buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Buffer pages currently free (innodb_buffer_pool_pages_free) + buffer_pages_created buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pages created (innodb_pages_created) + buffer_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pages written (innodb_pages_written) + buffer_index_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of index pages written (innodb_index_pages_written) + buffer_non_index_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of non index pages written (innodb_non_index_pages_written) + buffer_pages_read buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pages read (innodb_pages_read) + buffer_pages0_read buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of page 0 read (innodb_pages0_read) + buffer_index_sec_rec_cluster_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of secondary record reads triggered cluster read + buffer_index_sec_rec_cluster_reads_avoided buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of secondary record reads avoided triggering cluster read + buffer_data_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Amount of data read in bytes (innodb_data_reads) + buffer_data_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Amount of data written in bytes (innodb_data_written) + buffer_flush_batch_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages scanned as part of flush batch + buffer_flush_batch_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of times buffer flush list flush is called + buffer_flush_batch_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages scanned per flush batch scan + buffer_flush_batch_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages flushed as part of flush batch + buffer_flush_batches buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of flush batches + buffer_flush_batch_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as a flush batch + buffer_flush_neighbor_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total neighbors flushed as part of neighbor flush + buffer_flush_neighbor buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of times neighbors flushing is invoked + buffer_flush_neighbor_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as a neighbor batch + buffer_flush_n_to_flush_requested buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages requested for flushing. + buffer_flush_n_to_flush_by_age buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages target by LSN Age for flushing. + buffer_flush_adaptive_avg_time_slot buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Avg time (ms) spent for adaptive flushing recently per slot. + buffer_LRU_batch_flush_avg_time_slot buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Avg time (ms) spent for LRU batch flushing recently per slot. + buffer_flush_adaptive_avg_time_thread buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Avg time (ms) spent for adaptive flushing recently per thread. + buffer_LRU_batch_flush_avg_time_thread buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Avg time (ms) spent for LRU batch flushing recently per thread. + buffer_flush_adaptive_avg_time_est buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Estimated time (ms) spent for adaptive flushing recently. + buffer_LRU_batch_flush_avg_time_est buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Estimated time (ms) spent for LRU batch flushing recently. + buffer_flush_avg_time buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Avg time (ms) spent for flushing recently. + buffer_flush_adaptive_avg_pass buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Numner of adaptive flushes passed during the recent Avg period. + buffer_LRU_batch_flush_avg_pass buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of LRU batch flushes passed during the recent Avg period. + buffer_flush_avg_pass buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of flushes passed during the recent Avg period. + buffer_LRU_get_free_loops buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Total loops in LRU get free. + buffer_LRU_get_free_waits buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Total sleep waits in LRU get free. + buffer_flush_avg_page_rate buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Average number of pages at which flushing is happening + buffer_flush_lsn_avg_rate buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Average redo generation rate + buffer_flush_pct_for_dirty buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Percent of IO capacity used to avoid max dirty page limit + buffer_flush_pct_for_lsn buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Percent of IO capacity used to avoid reusable redo space limit + buffer_flush_sync_waits buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times a wait happens due to sync flushing + buffer_flush_adaptive_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages flushed as part of adaptive flushing + buffer_flush_adaptive buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of adaptive batches + buffer_flush_adaptive_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as an adaptive batch + buffer_flush_sync_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages flushed as part of sync batches + buffer_flush_sync buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of sync batches + buffer_flush_sync_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as a sync batch + buffer_flush_background_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages flushed as part of background batches + buffer_flush_background buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of background batches + buffer_flush_background_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as a background batch + buffer_LRU_batch_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages scanned as part of LRU batch + buffer_LRU_batch_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of times LRU batch is called + buffer_LRU_batch_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages scanned per LRU batch call + buffer_LRU_batch_flush_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages flushed as part of LRU batches + buffer_LRU_batches_flush buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of LRU batches + buffer_LRU_batch_flush_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as an LRU batch + buffer_LRU_batch_evict_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages evicted as part of LRU batches + buffer_LRU_batches_evict buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of LRU batches + buffer_LRU_batch_evict_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as an LRU batch + buffer_LRU_single_flush_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages scanned as part of single page LRU flush + buffer_LRU_single_flush_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of times single page LRU flush is called + buffer_LRU_single_flush_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Page scanned per single LRU flush + buffer_LRU_single_flush_failure_count Buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times attempt to flush a single page from LRU failed + buffer_LRU_get_free_search Buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of searches performed for a clean page + buffer_LRU_search_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages scanned as part of LRU search + buffer_LRU_search_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of times LRU search is performed + buffer_LRU_search_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Page scanned per single LRU search + buffer_LRU_unzip_search_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages scanned as part of LRU unzip search + buffer_LRU_unzip_search_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of times LRU unzip search is performed + buffer_LRU_unzip_search_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Page scanned per single LRU unzip search + buffer_page_read_index_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Index Leaf Pages read + buffer_page_read_index_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Index Non-leaf Pages read + buffer_page_read_index_ibuf_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Index Leaf Pages read + buffer_page_read_index_ibuf_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Index Non-Leaf Pages read + buffer_page_read_undo_log buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Undo Log Pages read + buffer_page_read_index_inode buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Index Inode Pages read + buffer_page_read_ibuf_free_list buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Free List Pages read + buffer_page_read_ibuf_bitmap buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Bitmap Pages read + buffer_page_read_system_page buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of System Pages read + buffer_page_read_trx_system buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Transaction System Pages read + buffer_page_read_fsp_hdr buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of File Space Header Pages read + buffer_page_read_xdes buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Extent Descriptor Pages read + buffer_page_read_blob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Uncompressed BLOB Pages read + buffer_page_read_zblob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of First Compressed BLOB Pages read + buffer_page_read_zblob2 buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Subsequent Compressed BLOB Pages read + buffer_page_read_other buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of other/unknown (old version of InnoDB) Pages read + buffer_page_written_index_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Index Leaf Pages written + buffer_page_written_index_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Index Non-leaf Pages written + buffer_page_written_index_ibuf_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Index Leaf Pages written + buffer_page_written_index_ibuf_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Index Non-Leaf Pages written + buffer_page_written_undo_log buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Undo Log Pages written + buffer_page_written_index_inode buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Index Inode Pages written + buffer_page_written_ibuf_free_list buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Free List Pages written + buffer_page_written_ibuf_bitmap buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Bitmap Pages written + buffer_page_written_system_page buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of System Pages written + buffer_page_written_trx_system buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Transaction System Pages written + buffer_page_written_fsp_hdr buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of File Space Header Pages written + buffer_page_written_xdes buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Extent Descriptor Pages written + buffer_page_written_blob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Uncompressed BLOB Pages written + buffer_page_written_zblob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of First Compressed BLOB Pages written + buffer_page_written_zblob2 buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Subsequent Compressed BLOB Pages written + buffer_page_written_other buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of other/unknown (old version InnoDB) Pages written + os_data_reads os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of reads initiated (innodb_data_reads) + os_data_writes os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of writes initiated (innodb_data_writes) + os_data_fsyncs os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of fsync() calls (innodb_data_fsyncs) + os_pending_reads os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of reads pending + os_pending_writes os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of writes pending + os_log_bytes_written os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Bytes of log written (innodb_os_log_written) + os_log_fsyncs os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of fsync log writes (innodb_os_log_fsyncs) + os_log_pending_fsyncs os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pending fsync write (innodb_os_log_pending_fsyncs) + os_log_pending_writes os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pending log file writes (innodb_os_log_pending_writes) + trx_rw_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of read-write transactions committed + trx_ro_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of read-only transactions committed + trx_nl_ro_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of non-locking auto-commit read-only transactions committed + trx_commits_insert_update transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of transactions committed with inserts and updates + trx_rollbacks transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of transactions rolled back + trx_rollbacks_savepoint transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of transactions rolled back to savepoint + trx_rollback_active transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of resurrected active transactions rolled back + trx_active_transactions transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of active transactions + trx_rseg_history_len transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Length of the TRX_RSEG_HISTORY list + trx_undo_slots_used transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of undo slots used + trx_undo_slots_cached transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of undo slots cached + trx_rseg_current_size transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Current rollback segment size in pages + purge_del_mark_records purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of delete-marked rows purged + purge_upd_exist_or_extern_records purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of purges on updates of existing records and updates on delete marked record with externally stored field + purge_invoked purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times purge was invoked + purge_undo_log_pages purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of undo log pages handled by the purge + purge_dml_delay_usec purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Microseconds DML to be delayed due to purge lagging + purge_stop_count purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Number of times purge was stopped + purge_resume_count purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Number of times purge was resumed + log_checkpoints recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of checkpoints + log_lsn_last_flush recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value LSN of Last flush + log_lsn_last_checkpoint recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value LSN at last checkpoint + log_lsn_current recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Current LSN value + log_lsn_checkpoint_age recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Current LSN value minus LSN at last checkpoint + log_lsn_buf_pool_oldest recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value The oldest modified block LSN in the buffer pool + log_max_modified_age_async recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Maximum LSN difference; when exceeded, start asynchronous preflush + log_max_modified_age_sync recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Maximum LSN difference; when exceeded, start synchronous preflush + log_pending_log_flushes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Pending log flushes + log_pending_checkpoint_writes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Pending checkpoints + log_num_log_io recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Number of log I/Os + log_waits recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of log waits due to small log buffer (innodb_log_waits) + log_write_requests recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of log write requests (innodb_log_write_requests) + log_writes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of log writes (innodb_log_writes) + log_padded recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Bytes of log padded for log write ahead + compress_pages_compressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages compressed + compress_pages_decompressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages decompressed + compression_pad_increments compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times padding is incremented to avoid compression failures + compression_pad_decrements compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times padding is decremented due to good compressibility + compress_saved compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of bytes saved by page compression + compress_pages_page_compressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages compressed by page compression + compress_page_compressed_trim_op compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of TRIM operation performed by page compression + compress_pages_page_decompressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages decompressed by page compression + compress_pages_page_compression_error compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of page compression errors + compress_pages_encrypted compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages encrypted + compress_pages_decrypted compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages decrypted + index_page_splits index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of index page splits + index_page_merge_attempts index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of index page merge attempts + index_page_merge_successful index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of successful index page merges + index_page_reorg_attempts index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of index page reorganization attempts + index_page_reorg_successful index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of successful index page reorganizations + index_page_discards index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of index pages discarded + adaptive_hash_searches adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of successful searches using Adaptive Hash Index + adaptive_hash_searches_btree adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of searches using B-tree on an index search + adaptive_hash_pages_added adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of index pages on which the Adaptive Hash Index is built + adaptive_hash_pages_removed adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of index pages whose corresponding Adaptive Hash Index entries were removed + adaptive_hash_rows_added adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Adaptive Hash Index rows added + adaptive_hash_rows_removed adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Adaptive Hash Index rows removed + adaptive_hash_rows_deleted_no_hash_entry adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of rows deleted that did not have corresponding Adaptive Hash Index entries + adaptive_hash_rows_updated adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Adaptive Hash Index rows updated + file_num_open_files file_system 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Number of files currently open (innodb_num_open_files) + ibuf_merges_insert change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of inserted records merged by change buffering + ibuf_merges_delete_mark change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of deleted records merged by change buffering + ibuf_merges_delete change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of purge records merged by change buffering + ibuf_merges_discard_insert change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of insert merged operations discarded + ibuf_merges_discard_delete_mark change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of deleted merged operations discarded + ibuf_merges_discard_delete change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of purge merged operations discarded + ibuf_merges change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of change buffer merges + ibuf_size change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Change buffer size in pages + innodb_master_thread_sleeps server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times (seconds) master thread sleeps + innodb_activity_count server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Current server activity count + innodb_master_active_loops server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times master thread performs its tasks when server is active + innodb_master_idle_loops server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times master thread performs its tasks when server is idle + innodb_background_drop_table_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Time (in microseconds) spent to process drop table list + innodb_ibuf_merge_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Time (in microseconds) spent to process change buffer merge + innodb_log_flush_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Time (in microseconds) spent to flush log records + innodb_mem_validate_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Time (in microseconds) spent to do memory validation + innodb_master_purge_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Time (in microseconds) spent by master thread to purge records + innodb_dict_lru_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Time (in microseconds) spent to process DICT LRU list + innodb_dict_lru_count_active server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of tables evicted from DICT LRU list in the active loop + innodb_dict_lru_count_idle server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of tables evicted from DICT LRU list in the idle loop + innodb_checkpoint_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Time (in microseconds) spent by master thread to do checkpoint + innodb_dblwr_writes server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of doublewrite operations that have been performed (innodb_dblwr_writes) + innodb_dblwr_pages_written server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pages that have been written for doublewrite operations (innodb_dblwr_pages_written) + innodb_page_size server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value InnoDB page size in bytes (innodb_page_size) + innodb_rwlock_s_spin_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rwlock spin waits due to shared latch request + innodb_rwlock_x_spin_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rwlock spin waits due to exclusive latch request + innodb_rwlock_sx_spin_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rwlock spin waits due to sx latch request + innodb_rwlock_s_spin_rounds server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rwlock spin loop rounds due to shared latch request + innodb_rwlock_x_spin_rounds server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rwlock spin loop rounds due to exclusive latch request + innodb_rwlock_sx_spin_rounds server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rwlock spin loop rounds due to sx latch request + innodb_rwlock_s_os_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of OS waits due to shared latch request + innodb_rwlock_x_os_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of OS waits due to exclusive latch request + innodb_rwlock_sx_os_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of OS waits due to sx latch request + dml_reads dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rows read + dml_inserts dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rows inserted + dml_deletes dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rows deleted + dml_updates dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rows updated + dml_system_reads dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of system rows read + dml_system_inserts dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of system rows inserted + dml_system_deletes dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of system rows deleted + dml_system_updates dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of system rows updated + ddl_background_drop_indexes ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of indexes waiting to be dropped after failed index creation + ddl_background_drop_tables ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of tables in background drop table list + ddl_online_create_index ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of indexes being created online + ddl_pending_alter_table ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of ALTER TABLE, CREATE INDEX, DROP INDEX in progress + ddl_sort_file_alter_table ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of sort files created during alter table + ddl_log_file_alter_table ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of log files created during alter table + icp_attempts icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of attempts for index push-down condition checks + icp_no_match icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Index push-down condition does not match + icp_out_of_range icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Index push-down condition out of range + icp_match icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Index push-down condition matches + SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DEFAULT_STOPWORD; + value + a + about + an + are + as + at + be + by + com + de + en + for + from + how + i + in + is + it + la + of + on + or + that + the + this + to + was + what + when + where + who + will + with + und + the + www + SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED; + DOC_ID + SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED; + DOC_ID + SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE; + WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION + SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE; + WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION + SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG; + KEY VALUE + SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS; + POOL_ID POOL_SIZE FREE_BUFFERS DATABASE_PAGES OLD_DATABASE_PAGES MODIFIED_DATABASE_PAGES PENDING_DECOMPRESS PENDING_READS PENDING_FLUSH_LRU PENDING_FLUSH_LIST PAGES_MADE_YOUNG PAGES_NOT_MADE_YOUNG PAGES_MADE_YOUNG_RATE PAGES_MADE_NOT_YOUNG_RATE NUMBER_PAGES_READ NUMBER_PAGES_CREATED NUMBER_PAGES_WRITTEN PAGES_READ_RATE PAGES_CREATE_RATE PAGES_WRITTEN_RATE NUMBER_PAGES_GET HIT_RATE YOUNG_MAKE_PER_THOUSAND_GETS NOT_YOUNG_MAKE_PER_THOUSAND_GETS NUMBER_PAGES_READ_AHEAD NUMBER_READ_AHEAD_EVICTED READ_AHEAD_RATE READ_AHEAD_EVICTED_RATE LRU_IO_TOTAL LRU_IO_CURRENT UNCOMPRESS_TOTAL UNCOMPRESS_CURRENT + SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE; + POOL_ID BLOCK_ID SPACE PAGE_NUMBER PAGE_TYPE FLUSH_TYPE FIX_COUNT IS_HASHED NEWEST_MODIFICATION OLDEST_MODIFICATION ACCESS_TIME TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE COMPRESSED_SIZE PAGE_STATE IO_FIX IS_OLD FREE_PAGE_CLOCK + SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU; + POOL_ID LRU_POSITION SPACE PAGE_NUMBER PAGE_TYPE FLUSH_TYPE FIX_COUNT IS_HASHED NEWEST_MODIFICATION OLDEST_MODIFICATION ACCESS_TIME TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE COMPRESSED_SIZE COMPRESSED IO_FIX IS_OLD FREE_PAGE_CLOCK + SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES; -TABLE_ID NAME FLAG N_COLS SPACE FILE_FORMAT ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE ++TABLE_ID NAME FLAG N_COLS SPACE ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE + SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS; + TABLE_ID NAME STATS_INITIALIZED NUM_ROWS CLUST_INDEX_SIZE OTHER_INDEX_SIZE MODIFIED_COUNTER AUTOINC REF_COUNT + SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES; + INDEX_ID NAME TABLE_ID TYPE N_FIELDS PAGE_NO SPACE MERGE_THRESHOLD + SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS; + TABLE_ID NAME POS MTYPE PRTYPE LEN + SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS; + INDEX_ID NAME POS + SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN; + ID FOR_NAME REF_NAME N_COLS TYPE + SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS; + ID FOR_COL_NAME REF_COL_NAME POS + SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES; -SPACE NAME FLAG FILE_FORMAT ROW_FORMAT PAGE_SIZE ZIP_PAGE_SIZE SPACE_TYPE FS_BLOCK_SIZE FILE_SIZE ALLOCATED_SIZE ++SPACE NAME FLAG ROW_FORMAT PAGE_SIZE ZIP_PAGE_SIZE SPACE_TYPE FS_BLOCK_SIZE FILE_SIZE ALLOCATED_SIZE + SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_DATAFILES; + SPACE PATH
participants (1)
-
Oleksandr Byelkin