You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3517 lines
112 KiB

19 years ago
21 years ago
Merge mysql.com:/home/my/mysql-4.1 into mysql.com:/home/my/mysql-5.0 BitKeeper/etc/ignore: auto-union BitKeeper/deleted/.del-ctype_cp932.test: Auto merged BitKeeper/deleted/.del-isam.test~834fb0ee8196c445: Auto merged include/thr_lock.h: Auto merged mysql-test/t/alias.test: Auto merged mysql-test/t/alter_table.test: Auto merged mysql-test/t/archive.test: Auto merged mysql-test/t/backup.test: Auto merged mysql-test/t/bool.test: Auto merged mysql-test/t/connect.test: Auto merged mysql-test/t/count_distinct2.test: Auto merged mysql-test/t/create.test: Auto merged mysql-test/t/ctype_many.test: Auto merged mysql-test/t/ctype_ucs_binlog.test: Auto merged mysql-test/t/date_formats.test: Auto merged mysql-test/t/delayed.test: Auto merged mysql-test/t/derived.test: Auto merged mysql-test/t/distinct.test: Auto merged mysql-test/t/drop.test: Auto merged mysql-test/t/endspace.test: Auto merged mysql-test/t/flush.test: Auto merged mysql-test/t/fulltext.test: Auto merged mysql-test/t/fulltext_order_by.test: Auto merged mysql-test/t/func_compress.test: Auto merged mysql-test/t/func_concat.test: Auto merged mysql-test/t/func_date_add.test: Auto merged mysql-test/t/func_equal.test: Auto merged mysql-test/t/func_if.test: Auto merged mysql-test/t/func_sapdb.test: Auto merged mysql-test/t/func_set.test: Auto merged mysql-test/t/func_str.test: Auto merged mysql-test/t/gis-rtree.test: Auto merged mysql-test/t/gis.test: Auto merged mysql-test/t/grant.test: Auto merged mysql-test/t/grant2.test: Auto merged mysql-test/t/grant_cache.test: Auto merged mysql-test/t/heap.test: Auto merged mysql-test/t/heap_btree.test: Auto merged mysql-test/t/heap_hash.test: Auto merged mysql-test/t/init_connect.test: Auto merged mysql-test/t/insert_select.test: Auto merged mysql-test/t/insert_update.test: Auto merged mysql-test/t/key.test: Auto merged mysql-test/t/keywords.test: Auto merged mysql-test/t/limit.test: Auto merged mysql-test/t/lock.test: Auto merged mysql-test/t/lowercase_table.test: Auto merged mysql-test/t/lowercase_table3.test: Auto merged mysql-test/t/merge.test: Auto merged mysql-test/t/mix_innodb_myisam_binlog.test: Auto merged mysql-test/t/myisam.test: Auto merged mysql-test/t/mysqlbinlog2.test: Auto merged mysql-test/t/ndb_alter_table.test: Auto merged mysql-test/t/ndb_autodiscover.test: Auto merged mysql-test/t/ndb_charset.test: Auto merged mysql-test/t/ndb_grant.later: Auto merged mysql-test/t/ndb_index_ordered.test: Auto merged mysql-test/t/ndb_index_unique.test: Auto merged mysql-test/t/ndb_restore.test: Auto merged mysql-test/t/ndb_types.test: Auto merged mysql-test/t/ndb_update.test: Auto merged mysql-test/t/null.test: Auto merged mysql-test/t/null_key.test: Auto merged mysql-test/t/olap.test: Auto merged mysql-test/t/openssl_1.test: Auto merged mysql-test/t/order_by.test: Auto merged mysql-test/t/ps.test: Auto merged mysql-test/t/ps_1general.test: Auto merged mysql-test/t/ps_4heap.test: Auto merged mysql-test/t/ps_5merge.test: Auto merged mysql-test/t/query_cache.test: Auto merged mysql-test/t/replace.test: Auto merged mysql-test/t/row.test: Auto merged mysql-test/t/rpl000001.test: Auto merged mysql-test/t/rpl000015.test: Auto merged mysql-test/t/rpl000017.test: Auto merged mysql-test/t/rpl000018.test: Auto merged mysql-test/t/rpl_EE_error.test: Auto merged mysql-test/t/rpl_change_master.test: Auto merged mysql-test/t/rpl_charset.test: Auto merged mysql-test/t/rpl_create_database.test: Auto merged mysql-test/t/rpl_ddl.test: Auto merged mysql-test/t/rpl_deadlock.test: Auto merged mysql-test/t/rpl_empty_master_crash.test: Auto merged mysql-test/t/rpl_error_ignored_table.test: Auto merged mysql-test/t/rpl_flush_log_loop.test: Auto merged mysql-test/t/rpl_flush_tables.test: Auto merged mysql-test/t/rpl_get_lock.test: Auto merged mysql-test/t/rpl_heap.test: Auto merged mysql-test/t/rpl_loaddata.test: Auto merged mysql-test/t/rpl_loaddata_rule_m.test: Auto merged mysql-test/t/rpl_log.test: Auto merged mysql-test/t/rpl_log_pos.test: Auto merged mysql-test/t/rpl_max_relay_size.test: Auto merged mysql-test/t/rpl_multi_query.test: Auto merged mysql-test/t/rpl_openssl.test: Auto merged mysql-test/t/rpl_redirect.test: Auto merged mysql-test/t/rpl_relayrotate.test: Auto merged mysql-test/t/rpl_replicate_do.test: Auto merged mysql-test/t/rpl_reset_slave.test: Auto merged mysql-test/t/rpl_server_id2.test: Auto merged mysql-test/t/rpl_temporary.test: Auto merged mysql-test/t/rpl_timezone.test: Auto merged mysql-test/t/rpl_user_variables.test: Auto merged mysql-test/t/show_check.test: Auto merged mysql-test/t/subselect.test: Auto merged mysql-test/t/symlink.test: Auto merged mysql-test/t/synchronization.test: Auto merged mysql-test/t/system_mysql_db.test: Auto merged mysql-test/t/system_mysql_db_fix.test: Auto merged mysql-test/t/temp_table.test: Auto merged mysql-test/t/timezone2.test: Auto merged mysql-test/t/timezone_grant.test: Auto merged mysql-test/t/type_float.test: Auto merged mysql-test/t/type_ranges.test: Auto merged mysql-test/t/type_timestamp.test: Auto merged mysql-test/t/union.test: Auto merged mysql-test/t/update.test: Auto merged mysql-test/t/user_var-binlog.test: Auto merged mysql-test/t/warnings.test: Auto merged mysys/thr_lock.c: Auto merged sql/slave.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_select.cc: Auto merged support-files/mysql.spec.sh: Auto merged BitKeeper/deleted/.del-rpl_trunc_binlog.test~961b1f6ac73d37c8: Simple merge mysql-test/r/ps_grant.result: Simple merge mysql-test/t/analyse.test: Simple merge mysql-test/t/auto_increment.test: Simple merge mysql-test/t/bdb.test: Simple merge mysql-test/t/bigint.test: Simple merge mysql-test/t/case.test: Simple merge mysql-test/t/cast.test: Simple merge mysql-test/t/check.test: Simple merge mysql-test/t/count_distinct.test: Simple merge mysql-test/t/ctype_latin1_de.test: Simple merge mysql-test/t/ctype_uca.test: Simple merge mysql-test/t/ctype_ucs.test: Simple merge mysql-test/t/ctype_utf8.test: Simple merge mysql-test/t/delete.test: Simple merge mysql-test/t/flush_block_commit.test: Simple merge mysql-test/t/func_default.test: Simple merge mysql-test/t/func_gconcat.test: Simple merge mysql-test/t/func_group.test: Aligned code with 4.1 mysql-test/t/func_in.test: Simple merge mysql-test/t/func_math.test: Simple merge mysql-test/t/func_misc.test: Simple merge mysql-test/t/func_test.test: Simple merge mysql-test/t/func_time.test: Simple merge mysql-test/t/group_by.test: Simple merge mysql-test/t/having.test: Simple merge mysql-test/t/innodb.test: Simple merge mysql-test/t/insert.test: Simple merge mysql-test/t/join_outer.test: Simple merge mysql-test/t/kill.test: Simple merge mysql-test/t/loaddata.test: Simple merge mysql-test/t/lock_multi.test: Simple merge mysql-test/t/multi_update.test: Simple merge mysql-test/t/mysqlbinlog.test: Simple merge mysql-test/t/mysqldump.test: Aligned code with 4.1 mysql-test/t/mysqltest.test: Simple merge mysql-test/t/ndb_basic.test: Simple merge mysql-test/t/ndb_cache.test: Simple merge mysql-test/t/ndb_subquery.test: Simple merge mysql-test/t/ps_grant.test: Simple merge mysql-test/t/range.test: Simple merge mysql-test/t/rpl_drop_temp.test: Simple merge mysql-test/t/rpl_loaddata_rule_s.test: Simple merge mysql-test/t/rpl_loaddatalocal.test: Simple merge mysql-test/t/rpl_rotate_logs.test: Simple merge mysql-test/t/rpl_until.test: Simple merge mysql-test/t/rpl_variables.test: Simple merge mysql-test/t/select.test: Simple merge mysql-test/t/sql_mode.test: Simple merge mysql-test/t/type_blob.test: Simple merge mysql-test/t/type_decimal.test: Simple merge mysql-test/t/user_var.test: Simple merge mysql-test/t/variables.test: Simple merge sql/lock.cc: Simple optimization sql/mysql_priv.h: Simple merge sql/sql_table.cc: Simple merge sql/table.cc: Simple merge sql/unireg.cc: Simple merge
20 years ago
WL#4189 - dynamic configuration support - safe process - cleanups - create new suite for fedarated BitKeeper/deleted/.del-basic.test: Rename: mysql-test/ndb/basic.test -> BitKeeper/deleted/.del-basic.test BitKeeper/deleted/.del-basic_log.result: Rename: mysql-test/ndb/basic_log.result -> BitKeeper/deleted/.del-basic_log.result mysql-test/suite/federated/federated_transactions.result: Rename: mysql-test/r/federated_transactions.result -> mysql-test/suite/federated/federated_transactions.result BitKeeper/deleted/.del-have_bug25714.require: Rename: mysql-test/r/have_bug25714.require -> BitKeeper/deleted/.del-have_bug25714.require BitKeeper/deleted/.del-kill_master.sh: Rename: mysql-test/misc/kill_master.sh -> BitKeeper/deleted/.del-kill_master.sh BitKeeper/deleted/.del-ndb_config_4_node.ini~d8e572e9b68f933a: Rename: mysql-test/ndb/ndb_config_4_node.ini -> BitKeeper/deleted/.del-ndb_config_4_node.ini~d8e572e9b68f933a BitKeeper/deleted/.del-restart.result: Rename: mysql-test/ndb/restart.result -> BitKeeper/deleted/.del-restart.result mysql-test/suite/federated/federated_cleanup.inc: Rename: mysql-test/include/federated_cleanup.inc -> mysql-test/suite/federated/federated_cleanup.inc mysql-test/suite/rpl/t/rpl_rotate_logs-slave.opt: Rename: mysql-test/suite/rpl/t/rpl_rotate_logs.slave-mi -> mysql-test/suite/rpl/t/rpl_rotate_logs-slave.opt BitKeeper/deleted/.del-install_test_db.sh: Rename: mysql-test/install_test_db.sh -> BitKeeper/deleted/.del-install_test_db.sh BitKeeper/deleted/.del-ndb_config_1_node.ini~7ec640ed25570e16: Rename: mysql-test/ndb/ndb_config_1_node.ini -> BitKeeper/deleted/.del-ndb_config_1_node.ini~7ec640ed25570e16 BitKeeper/deleted/.del-mtr_timer.pl: Rename: mysql-test/lib/mtr_timer.pl -> BitKeeper/deleted/.del-mtr_timer.pl BitKeeper/deleted/.del-create-test-result: Rename: mysql-test/create-test-result -> BitKeeper/deleted/.del-create-test-result BitKeeper/deleted/.del-fix-result: Rename: mysql-test/fix-result -> BitKeeper/deleted/.del-fix-result BitKeeper/deleted/.del-mysql-test-run-shell.sh: Rename: mysql-test/mysql-test-run-shell.sh -> BitKeeper/deleted/.del-mysql-test-run-shell.sh BitKeeper/deleted/.del-mysql-test_V1.9.pl: Rename: mysql-test/misc/mysql-test_V1.9.pl -> BitKeeper/deleted/.del-mysql-test_V1.9.pl BitKeeper/deleted/.del-resolve-stack: Rename: mysql-test/resolve-stack -> BitKeeper/deleted/.del-resolve-stack BitKeeper/deleted/.del-restart_log.result: Rename: mysql-test/ndb/restart_log.result -> BitKeeper/deleted/.del-restart_log.result mysql-test/suite/rpl/t/rpl_000015-slave.opt: Rename: mysql-test/suite/rpl/t/rpl_000015.slave-mi -> mysql-test/suite/rpl/t/rpl_000015-slave.opt BitKeeper/deleted/.del-ndb_config_2_node.ini: Rename: mysql-test/ndb/ndb_config_2_node.ini -> BitKeeper/deleted/.del-ndb_config_2_node.ini BitKeeper/deleted/.del-ndbcluster.sh: Rename: mysql-test/ndb/ndbcluster.sh -> BitKeeper/deleted/.del-ndbcluster.sh BitKeeper/deleted/.del-basic.result: Rename: mysql-test/ndb/basic.result -> BitKeeper/deleted/.del-basic.result BitKeeper/deleted/.del-restart.test: Rename: mysql-test/ndb/restart.test -> BitKeeper/deleted/.del-restart.test BitKeeper/deleted/.del-have_bug25714.inc: Rename: mysql-test/include/have_bug25714.inc -> BitKeeper/deleted/.del-have_bug25714.inc BitKeeper/deleted/.del-mtr_diff.pl: Rename: mysql-test/lib/mtr_diff.pl -> BitKeeper/deleted/.del-mtr_diff.pl mysql-test/suite/federated/federated_transactions-slave.opt: Rename: mysql-test/t/federated_transactions-slave.opt -> mysql-test/suite/federated/federated_transactions-slave.opt BitKeeper/deleted/.del-Makefile.am~343467da4d0f211b: Rename: mysql-test/ndb/Makefile.am -> BitKeeper/deleted/.del-Makefile.am~343467da4d0f211b BitKeeper/deleted/.del-mtr_im.pl~9762b0336c28949: Rename: mysql-test/lib/mtr_im.pl -> BitKeeper/deleted/.del-mtr_im.pl~9762b0336c28949 mysql-test/suite/federated/federated_innodb-slave.opt: Rename: mysql-test/t/federated_innodb-slave.opt -> mysql-test/suite/federated/federated_innodb-slave.opt client/mysqltest.c: Use current files path first when looking for include file configure.in: Remove mysql-test/nbd mysql-test/Makefile.am: Cleanup mysql-test/Makefile.am mysql-test/extra/binlog_tests/blackhole.test: Use new paths mysql-test/extra/binlog_tests/ctype_ucs_binlog.test: Use new paths mysql-test/mysql-test-run.pl: Dynamic configuration support Safe process mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test: Use new paths mysql-test/extra/rpl_tests/rpl_EE_err.test: Use new paths mysql-test/extra/rpl_tests/rpl_loaddata.test: Use new paths mysql-test/extra/rpl_tests/rpl_log.test: Use new paths mysql-test/extra/rpl_tests/rpl_row_001.test: Use new paths mysql-test/extra/rpl_tests/rpl_row_charset.test: Use new paths mysql-test/extra/rpl_tests/rpl_stm_000001.test: Use new paths mysql-test/extra/rpl_tests/rpl_stm_charset.test: Use new paths mysql-test/include/have_blackhole.inc: Use new paths mysql-test/include/have_ndbapi_examples.inc: Use new paths mysql-test/include/loaddata_autocom.inc: Use new paths mysql-test/include/mix1.inc: Use new paths mysql-test/include/ndb_backup.inc: Use new paths mysql-test/include/ndb_restore_master.inc: Use new paths mysql-test/include/ndb_restore_slave_eoption.inc: Use new paths mysql-test/include/testdb_only.inc: Use new paths mysql-test/lib/My/Config.pm: dynamic configuration safe process cleanups mysql-test/lib/mtr_cases.pm: dynamic configuration safe process cleanups mysql-test/lib/mtr_io.pl: dynamic configuration safe process cleanups mysql-test/lib/mtr_misc.pl: dynamic configuration safe process cleanups mysql-test/lib/mtr_process.pl: dynamic configuration safe process cleanups mysql-test/lib/mtr_report.pl: dynamic configuration safe process cleanups mysql-test/lib/mtr_stress.pl: dynamic configuration safe process cleanups mysql-test/r/backup.result: Use new paths mysql-test/r/ctype_big5.result: Use new paths mysql-test/r/gis.result: Use new paths mysql-test/r/loaddata.result: Use new paths mysql-test/r/loaddata_autocom_innodb.result: Use new paths mysql-test/r/mysqlbinlog.result: Use new paths mysql-test/r/mysqlbinlog_base64.result: Use new paths mysql-test/r/outfile.result: Use new paths mysql-test/r/partition_error.result: Use new paths mysql-test/r/partition_not_windows.result: Use new paths mysql-test/r/partition_symlink.result: Use new paths mysql-test/r/query_cache.result: Use new paths mysql-test/r/sp.result: Use new paths mysql-test/r/symlink.result: Use new paths mysql-test/r/system_mysql_db.result: Use new paths mysql-test/r/trigger.result: Use new paths mysql-test/r/type_blob.result: Use new paths mysql-test/r/view.result: Use new paths mysql-test/r/warnings.result: Use new paths mysql-test/suite/binlog/r/binlog_killed_simulate.result: Use new paths mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result: Use new paths mysql-test/suite/binlog/r/binlog_stm_blackhole.result: Use new paths mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result: Use new paths mysql-test/suite/binlog/t/binlog_killed.test: Use new paths mysql-test/suite/binlog/t/binlog_killed_simulate.test: Use new paths mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam.test: Use new paths mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam.test: Use new paths mysql-test/suite/federated/federated.inc: Use new paths mysql-test/suite/federated/federated.result: Use new paths mysql-test/suite/federated/federated.test: Use new paths mysql-test/suite/federated/federated_archive.result: Use new paths mysql-test/suite/federated/federated_archive.test: Use new paths mysql-test/suite/federated/federated_bug_13118.result: Use new paths mysql-test/suite/federated/federated_bug_13118.test: Use new paths mysql-test/suite/federated/federated_bug_25714.result: Use new paths mysql-test/suite/federated/federated_bug_25714.test: Use new paths mysql-test/suite/federated/federated_innodb.result: Use new paths mysql-test/suite/federated/federated_innodb.test: Use new paths mysql-test/suite/federated/federated_server.result: Use new paths mysql-test/suite/federated/federated_server.test: Use new paths mysql-test/suite/federated/federated_transactions.test: Use new paths mysql-test/suite/federated/have_federated_db.inc: Use new paths mysql-test/suite/ndb/r/loaddata_autocom_ndb.result: Use new paths mysql-test/suite/ndb/r/ndb_config.result: Use new paths mysql-test/suite/ndb/r/ndb_dd_backuprestore.result: Use new paths mysql-test/suite/ndb/r/ndb_load.result: Use new paths mysql-test/suite/ndb/r/ndb_loaddatalocal.result: Use new paths mysql-test/suite/ndb/r/ndb_replace.result: Use new paths mysql-test/suite/ndb/r/ndb_restore.result: Use new paths mysql-test/suite/ndb/r/ndb_restore_partition.result: Use new paths mysql-test/suite/ndb/r/ndb_restore_print.result: Use new paths mysql-test/suite/ndb/r/ndb_trigger.result: Use new paths mysql-test/suite/ndb/t/ndb_alter_table.test: Use new paths mysql-test/suite/ndb/t/ndb_config.test: Use new paths mysql-test/suite/ndb/t/ndb_load.test: Use new paths mysql-test/suite/ndb/t/ndb_loaddatalocal.test: Use new paths mysql-test/suite/ndb/t/ndb_replace.test: Use new paths mysql-test/suite/ndb/t/ndb_restore.test: Use new paths mysql-test/suite/ndb/t/ndb_single_user.test: Use new paths mysql-test/suite/ndb/t/ndb_trigger.test: Use new paths mysql-test/suite/ndb/t/ndbapi.test: Use new paths mysql-test/suite/rpl/include/rpl_mixed_dml.inc: Use new paths mysql-test/suite/rpl/r/rpl_LD_INFILE.result: Use new paths mysql-test/suite/rpl/r/rpl_flushlog_loop.result: Use new paths mysql-test/suite/rpl/r/rpl_innodb.result: Use new paths mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result: Use new paths mysql-test/suite/rpl/r/rpl_load_table_from_master.result: Use new paths mysql-test/suite/rpl/r/rpl_loaddata.result: Use new paths mysql-test/suite/rpl/r/rpl_loaddata_charset.result: Use new paths mysql-test/suite/rpl/r/rpl_loaddata_fatal.result: Use new paths mysql-test/suite/rpl/r/rpl_loaddata_m.result: Use new paths mysql-test/suite/rpl/r/rpl_loaddata_s.result: Use new paths mysql-test/suite/rpl/r/rpl_loaddata_simple.result: Use new paths mysql-test/suite/rpl/r/rpl_loaddatalocal.result: Use new paths mysql-test/suite/rpl/r/rpl_loadfile.result: Use new paths mysql-test/suite/rpl/r/rpl_misc_functions.result: Use new paths mysql-test/suite/rpl/r/rpl_replicate_do.result: Use new paths mysql-test/suite/rpl/r/rpl_rewrt_db.result: Use new paths mysql-test/suite/rpl/r/rpl_row_001.result: Use new paths mysql-test/suite/rpl/r/rpl_row_loaddata_m.result: Use new paths mysql-test/suite/rpl/r/rpl_row_log.result: Use new paths mysql-test/suite/rpl/r/rpl_row_log_innodb.result: Use new paths mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result: Use new paths mysql-test/suite/rpl/r/rpl_stm_000001.result: Use new paths mysql-test/suite/rpl/r/rpl_stm_log.result: Use new paths mysql-test/suite/rpl/r/rpl_timezone.result: Use new paths mysql-test/suite/rpl/t/disabled.def: Use new paths mysql-test/suite/rpl/t/rpl000017-slave.sh: Use new paths mysql-test/suite/rpl/t/rpl_LD_INFILE.test: Use new paths mysql-test/suite/rpl/t/rpl_drop_db.test: Use new paths mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt: Use new paths mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt: Use new paths mysql-test/suite/rpl/t/rpl_flushlog_loop.test: Use new paths mysql-test/suite/rpl/t/rpl_innodb.test: Use new paths mysql-test/suite/rpl/t/rpl_innodb_bug30919.test: Use new paths mysql-test/suite/rpl/t/rpl_load_from_master.test: Use new paths mysql-test/suite/rpl/t/rpl_load_table_from_master.test: Use new paths mysql-test/suite/rpl/t/rpl_loaddata_charset.test: Use new paths mysql-test/suite/rpl/t/rpl_loaddata_fatal.test: Use new paths mysql-test/suite/rpl/t/rpl_loaddata_m.test: Use new paths mysql-test/suite/rpl/t/rpl_loaddata_s.test: Use new paths mysql-test/suite/rpl/t/rpl_loaddata_simple.test: Use new paths mysql-test/suite/rpl/t/rpl_loaddatalocal.test: Use new paths mysql-test/suite/rpl/t/rpl_loadfile.test: Use new paths mysql-test/suite/rpl/t/rpl_misc_functions.test: Use new paths mysql-test/suite/rpl/t/rpl_replicate_do.test: Use new paths mysql-test/suite/rpl/t/rpl_rewrt_db.test: Use new paths mysql-test/suite/rpl/t/rpl_rotate_logs-master.opt: Use new paths mysql-test/suite/rpl/t/rpl_rotate_logs.test: Use new paths mysql-test/suite/rpl/t/rpl_row_charset_innodb.test: Use new paths mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test: Use new paths mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test: Use new paths mysql-test/suite/rpl/t/rpl_timezone.test: Use new paths mysql-test/suite/rpl/t/rpl_trigger.test: Use new paths mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_advance.result: Use new paths mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result: Use new paths mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result: Use new paths mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result: Use new paths mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result: Use new paths mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result: Use new paths mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test: Use new paths mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_advance.test: Use new paths mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test: Use new paths mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test: Use new paths mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test: Use new paths mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test: Use new paths mysql-test/t/backup.test: Use new paths mysql-test/t/bootstrap.test: Use new paths mysql-test/t/crash_commit_before.test: Use new paths mysql-test/t/create_not_windows.test: Use new paths mysql-test/t/csv.test: Use new paths mysql-test/t/ctype_big5.test: Use new paths mysql-test/t/disabled.def: Use new paths mysql-test/t/distinct.test: Use new paths mysql-test/t/gis.test: Use new paths mysql-test/t/grant_cache_no_prot.test: Use new paths mysql-test/t/grant_cache_ps_prot.test: Use new paths mysql-test/t/information_schema_chmod.test: Use new paths mysql-test/t/loaddata.test: Use new paths mysql-test/t/log_state.test: Use new paths mysql-test/t/myisam-system.test: Use new paths mysql-test/t/mysql_upgrade.test: Use new paths mysql-test/t/mysqlbinlog-cp932.test: Use new paths mysql-test/t/mysqlbinlog.test: Use new paths mysql-test/t/mysqlbinlog2.test: Use new paths mysql-test/t/mysqlbinlog_base64.test: Use new paths mysql-test/t/mysqldump.test: Use new paths mysql-test/t/outfile.test: Use new paths mysql-test/t/partition.test: Use new paths mysql-test/t/partition_error.test: Use new paths mysql-test/t/partition_federated.test: Use new paths mysql-test/t/partition_mgm.test: Use new paths mysql-test/t/partition_not_windows.test: Use new paths mysql-test/t/partition_symlink.test: Use new paths mysql-test/t/query_cache.test: Use new paths mysql-test/t/repair.test: Use new paths mysql-test/t/show_check.test: Use new paths mysql-test/t/sp-destruct.test: Use new paths mysql-test/t/sp.test: Use new paths mysql-test/t/symlink.test: Use new paths mysql-test/t/system_mysql_db.test: Use new paths mysql-test/t/system_mysql_db_fix30020.test: Use new paths mysql-test/t/system_mysql_db_fix40123.test: Use new paths mysql-test/t/system_mysql_db_fix50030.test: Use new paths mysql-test/t/system_mysql_db_fix50117.test: Use new paths mysql-test/t/trigger-compat.test: Use new paths mysql-test/t/trigger-grant.test: Use new paths mysql-test/t/trigger.test: Use new paths mysql-test/t/type_blob.test: Use new paths mysql-test/t/type_varchar.test: Use new paths mysql-test/t/upgrade.test: Use new paths mysql-test/t/user_var-binlog.test: Use new paths mysql-test/t/varbinary.test: Use new paths mysql-test/t/view.test: Use new paths mysql-test/t/warnings.test: Use new paths mysql-test/lib/My/ConfigFactory.pm: Initial version mysql-test/lib/My/Find.pm: Initial version mysql-test/lib/My/SafeProcess.pm: Initial version mysql-test/std_data/ndb_config_config.ini: Add "old" style config.ini for ndb mysql-test/suite/federated/disabled.def: Move disabled federated to it's new suite mysql-test/suite/federated/my.cnf: Add config for federated mysql-test/suite/ndb/my.cnf: Add config for ndb mysql-test/suite/rpl/my.cnf: Add config for rpl mysql-test/suite/rpl/rpl_1slave_base.cnf: Add base config for rpl mysql-test/suite/rpl/t/rpl_000015-master.opt: Use new paths mysql-test/suite/rpl_ndb/my.cnf: Add config for rpl_ndb mysql-test/lib/My/File/Path.pm: Initial version mysql-test/lib/My/SafeProcess/Base.pm: Initial version mysql-test/lib/My/SafeProcess/safe_kill_win.cc: Initial version mysql-test/lib/My/SafeProcess/safe_process.pl: Initial version mysql-test/lib/My/SafeProcess/safe_process_win.cc: Initial version mysql-test/lib/t/Base.t: Initial version mysql-test/lib/t/Find.t: Initial version mysql-test/lib/t/SafeProcess.t: Initial version mysql-test/lib/t/SafeProcessStress.pl: Initial version mysql-test/lib/t/copytree.t: Initial version mysql-test/lib/t/dummyd.pl: Initial version mysql-test/lib/t/rmtree.t: Initial version mysql-test/lib/t/testMyConfig.t: Initial version mysql-test/lib/t/testMyConfigFactory.t: Initial version mysql-test/lib/t/test_child.pl: Initial version mysql-test/include/default_my.cnf: Add default config file used when no suite specific file is found mysql-test/include/default_mysqld.cnf: New BitKeeper file ``mysql-test/include/default_mysqld.cnf'' mysql-test/include/default_ndbd.cnf: Add default settings for all ndbds mysql-test/lib/mtr_settings.pl: Initial version
18 years ago
Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL Having maybe_null flag unset for geometry/spatial functions leads to wrong Item_func_isnull::val_int()'s results. Fix: set maybe_null flag and add is_null() methods. mysql-test/r/gis.result: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - test result. mysql-test/t/gis.test: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - test case. sql/item_geofunc.cc: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - set maybe_null flag for Item_geometry_func and Item_func_as_wkt. - moved length check to the beginnig of the Item_func_spatial_collection::val_str() to affect geometry collection objects at once. - changed Item_func_isempty::val_int() and Item_func_issimple::val_int() to properly handle null_value. sql/item_geofunc.h: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - set maybe_null flag for geometry/spatial functions. - added is_null() to Item_geometry_func and Item_func_spatial_rel classes. sql/spatial.cc: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - changed return type of Geometry::create_from_wkb() to be consistent with Geometry::create_from_wkt(), now it returns Geometry object or NULL in case of error. sql/spatial.h: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - changed return type of Geometry::create_from_wkb() to be consistent with Geometry::create_from_wkt(), now it returns Geometry object or NULL in case of error.
19 years ago
Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL Having maybe_null flag unset for geometry/spatial functions leads to wrong Item_func_isnull::val_int()'s results. Fix: set maybe_null flag and add is_null() methods. mysql-test/r/gis.result: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - test result. mysql-test/t/gis.test: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - test case. sql/item_geofunc.cc: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - set maybe_null flag for Item_geometry_func and Item_func_as_wkt. - moved length check to the beginnig of the Item_func_spatial_collection::val_str() to affect geometry collection objects at once. - changed Item_func_isempty::val_int() and Item_func_issimple::val_int() to properly handle null_value. sql/item_geofunc.h: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - set maybe_null flag for geometry/spatial functions. - added is_null() to Item_geometry_func and Item_func_spatial_rel classes. sql/spatial.cc: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - changed return type of Geometry::create_from_wkb() to be consistent with Geometry::create_from_wkt(), now it returns Geometry object or NULL in case of error. sql/spatial.h: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - changed return type of Geometry::create_from_wkb() to be consistent with Geometry::create_from_wkt(), now it returns Geometry object or NULL in case of error.
19 years ago
Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL Having maybe_null flag unset for geometry/spatial functions leads to wrong Item_func_isnull::val_int()'s results. Fix: set maybe_null flag and add is_null() methods. mysql-test/r/gis.result: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - test result. mysql-test/t/gis.test: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - test case. sql/item_geofunc.cc: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - set maybe_null flag for Item_geometry_func and Item_func_as_wkt. - moved length check to the beginnig of the Item_func_spatial_collection::val_str() to affect geometry collection objects at once. - changed Item_func_isempty::val_int() and Item_func_issimple::val_int() to properly handle null_value. sql/item_geofunc.h: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - set maybe_null flag for geometry/spatial functions. - added is_null() to Item_geometry_func and Item_func_spatial_rel classes. sql/spatial.cc: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - changed return type of Geometry::create_from_wkb() to be consistent with Geometry::create_from_wkt(), now it returns Geometry object or NULL in case of error. sql/spatial.h: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - changed return type of Geometry::create_from_wkb() to be consistent with Geometry::create_from_wkt(), now it returns Geometry object or NULL in case of error.
19 years ago
Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL Having maybe_null flag unset for geometry/spatial functions leads to wrong Item_func_isnull::val_int()'s results. Fix: set maybe_null flag and add is_null() methods. mysql-test/r/gis.result: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - test result. mysql-test/t/gis.test: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - test case. sql/item_geofunc.cc: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - set maybe_null flag for Item_geometry_func and Item_func_as_wkt. - moved length check to the beginnig of the Item_func_spatial_collection::val_str() to affect geometry collection objects at once. - changed Item_func_isempty::val_int() and Item_func_issimple::val_int() to properly handle null_value. sql/item_geofunc.h: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - set maybe_null flag for geometry/spatial functions. - added is_null() to Item_geometry_func and Item_func_spatial_rel classes. sql/spatial.cc: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - changed return type of Geometry::create_from_wkb() to be consistent with Geometry::create_from_wkt(), now it returns Geometry object or NULL in case of error. sql/spatial.h: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - changed return type of Geometry::create_from_wkb() to be consistent with Geometry::create_from_wkt(), now it returns Geometry object or NULL in case of error.
19 years ago
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Fix tests for new behaviour: an error is thrown if a NON DETERMINISTIC stored function (SF) is called during statement-based replication (SBR). mysql-test/r/func_time.result: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Modify test that contains non-deterministic functions so it can still be called with no error while doing statement-based replication (SBR). mysql-test/r/gis.result: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Mark function as DETERMINISTIC so it can be called with no error while doing statement-based replication (SBR). mysql-test/r/grant2.result: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Modify test that contains non-deterministic functions so it can still be called with no error while doing statement-based replication (SBR). mysql-test/r/innodb_notembedded.result: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Modify test that contains non-deterministic functions so it can still be called with no error while doing statement-based replication (SBR). mysql-test/r/ps.result: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Mark function as DETERMINISTIC so it can be called with no error while doing statement-based replication (SBR). mysql-test/r/query_cache.result: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Modify test that contains non-deterministic functions so it can still be called with no error while doing statement-based replication (SBR). mysql-test/r/query_cache_notembedded.result: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Modify test that contains non-deterministic functions so it can still be called with no error while doing statement-based replication (SBR). mysql-test/r/rpl_sp.result: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Move test for SF-calls in different replication modes to its own file, rpl_sf. mysql-test/r/rpl_sp_effects.result: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Modify test that contains non-deterministic functions so it can still be called with no error while doing statement-based replication (SBR). mysql-test/r/sp.result: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Mark function as DETERMINISTIC so it can be called with no error while doing statement-based replication (SBR). mysql-test/r/timezone2.result: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Modify test that contains non-deterministic functions so it can still be called with no error while doing statement-based replication (SBR). mysql-test/t/func_time.test: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Modify test that contains non-deterministic functions so it can still be called with no error while doing statement-based replication (SBR). mysql-test/t/gis.test: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Mark function as DETERMINISTIC so it can be called with no error while doing statement-based replication (SBR). mysql-test/t/grant2.test: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Modify test that contains non-deterministic functions so it can still be called with no error while doing statement-based replication (SBR). mysql-test/t/innodb_notembedded.test: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Modify test that contains non-deterministic functions so it can still be called with no error while doing statement-based replication (SBR). mysql-test/t/ps.test: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Modify test that contains non-deterministic functions so it can still be called with no error while doing statement-based replication (SBR). mysql-test/t/query_cache.test: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Modify test that contains non-deterministic functions so it can still be called with no error while doing statement-based replication (SBR). mysql-test/t/query_cache_notembedded.test: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Modify test that contains non-deterministic functions so it can still be called with no error while doing statement-based replication (SBR). mysql-test/t/rpl_sp.test: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Modify test that contains non-deterministic functions so it can still be called with no error while doing statement-based replication (SBR). mysql-test/t/rpl_sp_effects.test: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Modify test that contains non-deterministic functions so it can still be called with no error while doing statement-based replication (SBR). mysql-test/t/sp.test: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Mark function as DETERMINISTIC so it can be called with no error while doing statement-based replication (SBR). mysql-test/t/timezone2.test: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Modify test that contains non-deterministic functions so it can still be called with no error while doing statement-based replication (SBR). sql/item_func.cc: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR If 'log_bin_trust_function_creators' variable is set, don't throw an error on calling a non-deterministc function in statement-based replication (SBR). sql/sql_parse.cc: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Do not throw an error on calling a NON DETERMINISTIC stored procedure (SP) while doing statement-based replication (SBR), as the routine body is executed statement-by-statement. mysql-test/r/rpl_sf.result: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Test for stored function (SF) calls in different replication modes. NON DETERMINISTIC SFs are not allowed while doing statement-based replication (SBR). mysql-test/t/rpl_sf.test: Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR Test for stored function (SF) calls in different replication modes. NON DETERMINISTIC SFs are not allowed while doing statement-based replication (SBR).
19 years ago
20 years ago
Bug#28763: Selecting geometry fields in UNION caused server crash. This bug was introduced by the fix for the bug#27300. In this fix a section of code was added to the Item::tmp_table_field_from_field_type method. This section intended to create Field_geom fields for the Item_geometry_func class and its descendants. In order to get the geometry type of the current item it casted "this" to the Item_geometry_func* type. But the Item::tmp_table_field_from_field_type method is also used for creation of fields for UNION and in this case this method is called for an object of the Item_type_holder class and the cast to the Item_geometry_func* type causes a server crash. Now the Item::tmp_table_field_from_field_type method correctly works when it's called for both the Item_type_holder and the Item_geometry_func classes. The new geometry_type variable is added to the Item_type_holder class. The new method called get_geometry_type is added to the Item_field and the Field classes. It returns geometry type from the field for the Item_field and the Field_geom classes and fails an assert for other Field descendants. sql/field.h: Bug#28763: Selecting geometry fields in UNION caused server crash. The new method called get_geometry_type is added to the Field class. It returns geometry type of the field for the Field_geom class and fails an assert for other Field descendants. sql/item.cc: Bug#28763: Selecting geometry fields in UNION caused server crash. Now the Item::tmp_table_field_from_field_type method correctly works when it's called for both the Item_type_holder and the Item_geometry_func classes. mysql-test/r/gis.result: Added a test case for the bug#28763: Selecting geometry fields in UNION caused server crash. mysql-test/t/gis.test: Added a test case for the bug#28763: Selecting geometry fields in UNION caused server crash. sql/item.h: Bug#28763: Selecting geometry fields in UNION caused server crash. The new method called get_geometry_type is added to the Item_field class. It returns geometry type from the field. The new geometry_type variable is added to the Item_type_holder class.
19 years ago
Bug#28763: Selecting geometry fields in UNION caused server crash. This bug was introduced by the fix for the bug#27300. In this fix a section of code was added to the Item::tmp_table_field_from_field_type method. This section intended to create Field_geom fields for the Item_geometry_func class and its descendants. In order to get the geometry type of the current item it casted "this" to the Item_geometry_func* type. But the Item::tmp_table_field_from_field_type method is also used for creation of fields for UNION and in this case this method is called for an object of the Item_type_holder class and the cast to the Item_geometry_func* type causes a server crash. Now the Item::tmp_table_field_from_field_type method correctly works when it's called for both the Item_type_holder and the Item_geometry_func classes. The new geometry_type variable is added to the Item_type_holder class. The new method called get_geometry_type is added to the Item_field and the Field classes. It returns geometry type from the field for the Item_field and the Field_geom classes and fails an assert for other Field descendants. sql/field.h: Bug#28763: Selecting geometry fields in UNION caused server crash. The new method called get_geometry_type is added to the Field class. It returns geometry type of the field for the Field_geom class and fails an assert for other Field descendants. sql/item.cc: Bug#28763: Selecting geometry fields in UNION caused server crash. Now the Item::tmp_table_field_from_field_type method correctly works when it's called for both the Item_type_holder and the Item_geometry_func classes. mysql-test/r/gis.result: Added a test case for the bug#28763: Selecting geometry fields in UNION caused server crash. mysql-test/t/gis.test: Added a test case for the bug#28763: Selecting geometry fields in UNION caused server crash. sql/item.h: Bug#28763: Selecting geometry fields in UNION caused server crash. The new method called get_geometry_type is added to the Item_field class. It returns geometry type from the field. The new geometry_type variable is added to the Item_type_holder class.
19 years ago
Bug#28763: Selecting geometry fields in UNION caused server crash. This bug was introduced by the fix for the bug#27300. In this fix a section of code was added to the Item::tmp_table_field_from_field_type method. This section intended to create Field_geom fields for the Item_geometry_func class and its descendants. In order to get the geometry type of the current item it casted "this" to the Item_geometry_func* type. But the Item::tmp_table_field_from_field_type method is also used for creation of fields for UNION and in this case this method is called for an object of the Item_type_holder class and the cast to the Item_geometry_func* type causes a server crash. Now the Item::tmp_table_field_from_field_type method correctly works when it's called for both the Item_type_holder and the Item_geometry_func classes. The new geometry_type variable is added to the Item_type_holder class. The new method called get_geometry_type is added to the Item_field and the Field classes. It returns geometry type from the field for the Item_field and the Field_geom classes and fails an assert for other Field descendants. sql/field.h: Bug#28763: Selecting geometry fields in UNION caused server crash. The new method called get_geometry_type is added to the Field class. It returns geometry type of the field for the Field_geom class and fails an assert for other Field descendants. sql/item.cc: Bug#28763: Selecting geometry fields in UNION caused server crash. Now the Item::tmp_table_field_from_field_type method correctly works when it's called for both the Item_type_holder and the Item_geometry_func classes. mysql-test/r/gis.result: Added a test case for the bug#28763: Selecting geometry fields in UNION caused server crash. mysql-test/t/gis.test: Added a test case for the bug#28763: Selecting geometry fields in UNION caused server crash. sql/item.h: Bug#28763: Selecting geometry fields in UNION caused server crash. The new method called get_geometry_type is added to the Item_field class. It returns geometry type from the field. The new geometry_type variable is added to the Item_type_holder class.
19 years ago
Bug #30825: Problems when putting a non-spatial index on a GIS column Fixed the usage of spatial data (and Point in specific) with non-spatial indexes. Several problems : - The length of the Point class was not updated to include the spatial reference system identifier. Fixed by increasing with 4 bytes. - The storage length of the spatial columns was not accounting for the length that is prepended to it. Fixed by treating the spatial data columns as blobs (and thus increasing the storage length) - When creating the key image for comparison in index read wrong key image was created (the one needed for and r-tree search, not the one for b-tree/other search). Fixed by treating the spatial data columns as blobs (and creating the correct kind of image based on the index type). mysql-test/r/bdb_gis.result: Bug #30825: bdb tests mysql-test/r/gis-rtree.result: Bug #30825: key length changed mysql-test/r/gis.result: Bug #30825: MyISAM tests mysql-test/r/innodb_gis.result: Bug #30825: InnoDB tests mysql-test/t/bdb_gis.test: Bug #30825: bdb tests mysql-test/t/gis.test: Bug #30825: MyISAM tests mysql-test/t/innodb_gis.test: Bug #30825: InnoDB tests sql/field.cc: Bug #30825: Removed Field_geom::get_key_image as Field_blog::get_key_image takes type parameter into consideration and is a superset of Field_geom::get_key_image() sql/field.h: Bug #30825: Removed Field_geom::get_key_image as Field_blog::get_key_image takes type parameter into consideration and is a superset of Field_geom::get_key_image() sql/sql_select.h: Bug #30825: Geometry data are a blob derivate sql/sql_table.cc: Bug #30825: Increased key length to accomodate for spatial reference system identifier (srid) sql/sql_yacc.yy: Bug #30825: Increased key length to accomodate for spatial reference system identifier (srid) sql/table.cc: Bug #30825: It stores a length for spatial data as well, so increase the storage length (as it's done for blobs). mysql-test/include/gis_keys.inc: Bug #30825: Test file for spatial data and non-spatial indexes
18 years ago
13 years ago
11 years ago
13 years ago
MDEV-10306 Wrong results with combination of CONCAT, SUBSTR and CONVERT in subquery The bug happens because of a combination of unfortunate circumstances: 1. Arguments args[0] and args[2] of Item_func_concat point recursively (through Item_direct_view_ref's) to the same Item_func_conv_charset. Both args[0]->args[0]->ref[0] and args[2]->args[0]->ref[0] refer to this Item_func_conv_charset. 2. When Item_func_concat::args[0]->val_str() is called, Item_func_conv_charset::val_str() writes its result to Item_func_conc_charset::tmp_value. 3. Then, for optimization purposes (to avoid copying), Item_func_substr::val_str() initializes Item_func_substr::tmp_value to point to the buffer fragment owned by Item_func_conv_charset::tmp_value Item_func_substr::tmp_value is returned as a result of Item_func_concat::args[0]->val_str(). 4. Due to optimization to avoid memory reallocs, Item_func_concat::val_str() remembers the result of args[0]->val_str() in "res" and further uses "res" to collect the return value. 5. When Item_func_concat::args[2]->val_str() is called, Item_func_conv_charset::tmp_value gets overwritten (see #1), which effectively overwrites args[0]'s Item_func_substr::tmp_value (see #3), which effectively overwrites "res" (see #4). This patch does the following: a. Changes Item_func_conv_charset::val_str(String *str) to use tmp_value and str the other way around. After this change tmp_value is used to store a temporary result, while str is used to return the value. The fixes the second problem (without SUBSTR): SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT CONVERT(t USING latin1) t2 FROM t1) sub; As Item_func_concat::val_str() supplies two different buffers when calling args[0]->val_str() and args[2]->val_str(), in the new reduction the result created during args[0]->val_str() does not get overwritten by args[2]->val_str(). b. Fixing the same problem in val_str() for similar classes Item_func_to_base64 Item_func_from_base64 Item_func_weight_string Item_func_hex Item_func_unhex Item_func_quote Item_func_compress Item_func_uncompress Item_func_des_encrypt Item_func_des_decrypt Item_func_conv_charset Item_func_reverse Item_func_soundex Item_func_aes_encrypt Item_func_aes_decrypt Item_func_buffer c. Fixing Item_func::val_str_from_val_str_ascii() the same way. Now Item_str_ascii_func::ascii_buff is used for temporary value, while the parameter passed to val_str() is used to return the result. This fixes the same problem when conversion (from ASCII to e.g. UCS2) takes place. See the ctype_ucs.test for example queries that returned wrong results before the fix. d. Some Item_func descendand classes had temporary String buffers (tmp_value and tmp_str), but did not really use them. Removing these temporary buffers from: Item_func_decode_histogram Item_func_format Item_func_binlog_gtid_pos Item_func_spatial_collection: e. Removing Item_func_buffer::tmp_value, because it's not used any more. f. Renaming Item_func_[un]compress::buffer to "tmp_value", for consistency with other classes. Note, this patch does not fix the following classes (although they have a similar problem): Item_str_conv Item_func_make_set Item_char_typecast They have a complex implementations and simple swapping between "tmp_value" and "str" won't work. These classes will be fixed separately.
8 years ago
MDEV-10306 Wrong results with combination of CONCAT, SUBSTR and CONVERT in subquery The bug happens because of a combination of unfortunate circumstances: 1. Arguments args[0] and args[2] of Item_func_concat point recursively (through Item_direct_view_ref's) to the same Item_func_conv_charset. Both args[0]->args[0]->ref[0] and args[2]->args[0]->ref[0] refer to this Item_func_conv_charset. 2. When Item_func_concat::args[0]->val_str() is called, Item_func_conv_charset::val_str() writes its result to Item_func_conc_charset::tmp_value. 3. Then, for optimization purposes (to avoid copying), Item_func_substr::val_str() initializes Item_func_substr::tmp_value to point to the buffer fragment owned by Item_func_conv_charset::tmp_value Item_func_substr::tmp_value is returned as a result of Item_func_concat::args[0]->val_str(). 4. Due to optimization to avoid memory reallocs, Item_func_concat::val_str() remembers the result of args[0]->val_str() in "res" and further uses "res" to collect the return value. 5. When Item_func_concat::args[2]->val_str() is called, Item_func_conv_charset::tmp_value gets overwritten (see #1), which effectively overwrites args[0]'s Item_func_substr::tmp_value (see #3), which effectively overwrites "res" (see #4). This patch does the following: a. Changes Item_func_conv_charset::val_str(String *str) to use tmp_value and str the other way around. After this change tmp_value is used to store a temporary result, while str is used to return the value. The fixes the second problem (without SUBSTR): SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT CONVERT(t USING latin1) t2 FROM t1) sub; As Item_func_concat::val_str() supplies two different buffers when calling args[0]->val_str() and args[2]->val_str(), in the new reduction the result created during args[0]->val_str() does not get overwritten by args[2]->val_str(). b. Fixing the same problem in val_str() for similar classes Item_func_to_base64 Item_func_from_base64 Item_func_weight_string Item_func_hex Item_func_unhex Item_func_quote Item_func_compress Item_func_uncompress Item_func_des_encrypt Item_func_des_decrypt Item_func_conv_charset Item_func_reverse Item_func_soundex Item_func_aes_encrypt Item_func_aes_decrypt Item_func_buffer c. Fixing Item_func::val_str_from_val_str_ascii() the same way. Now Item_str_ascii_func::ascii_buff is used for temporary value, while the parameter passed to val_str() is used to return the result. This fixes the same problem when conversion (from ASCII to e.g. UCS2) takes place. See the ctype_ucs.test for example queries that returned wrong results before the fix. d. Some Item_func descendand classes had temporary String buffers (tmp_value and tmp_str), but did not really use them. Removing these temporary buffers from: Item_func_decode_histogram Item_func_format Item_func_binlog_gtid_pos Item_func_spatial_collection: e. Removing Item_func_buffer::tmp_value, because it's not used any more. f. Renaming Item_func_[un]compress::buffer to "tmp_value", for consistency with other classes. Note, this patch does not fix the following classes (although they have a similar problem): Item_str_conv Item_func_make_set Item_char_typecast They have a complex implementations and simple swapping between "tmp_value" and "str" won't work. These classes will be fixed separately.
8 years ago
MDEV-12506 Split Item_func_min_max::fix_length_and_dec() into methods in Type_handler + MDEV-12497 + MDEV-12504 This patch does the following: 1. Adds a new method Type_handler_hybrid_field_type::aggregate_for_min_max() - For non-traditional data types it uses type_handler_data->m_type_aggregator_for_result.find_handler() This allows pluggable data types to define in the future their own behavior of the result data type detection for LEAST/GREATEST. Also, this disallows expressions of the GEOMETRY data type (and its variants such as POINT) to be mixed in with numeric and temporal data types in LEAST/GREATEST. - For traditional data types it reproduces the old behavior of the result data type detection (but not attributes, see below). 2. Adds a new virtual method Type_handler::Item_func_min_max_fix_attributes() and reuses as much as possible the code that calculates data type attributes for CASE-alike functions (e.g. CASE..THEN, COALESCE, IF). As the old code responsible for attributes calculation in the old implementation of Item_func_min_max::fix_length_and_dec() was not fully correct, this automatically fixes the following bugs: - MDEV-12497 Wrong data type for LEAST(latin1_expr, utf8_expr) The old fix_length_and_dec() calculated max_length before character set aggregation. Now max_length is calculated after, in Item_func::count_string_length() called from Item_func::aggregate_attributes_string() called from Type_handler_string_result::Item_hybrid_func_fix_attributes() called from Type_handler::Item_func_min_max_fix_attributes() called from Item_func_min_max::fix_length_and_dec(). - MDEV-12504 Wrong data type for LEAST(date_expr,time_expr) The old fix_length_and_dec() simply used the maximum of max_length among all arguments to set its own max_length and did not take into account that a mixture of DATE and TIME becomes DATETIME. Now this is correctly handled by: Type_handler_datetime_common::Item_hybrid_func_fix_attributes() called from Type_handler::Item_func_min_max_fix_attributes() called from Item_func_min_max::fix_length_and_dec(). 3. Removes the old implementation of Item_func_min_max::fix_length_and_dec() and replaces it to calls of the new methods. 4. Cleanup: moves the code related to unsigned_flag processing from Type_handler_hybrid_field_type::aggregate_for_result() to Type_handler_int_result::Item_hybrid_func_fix_attributes(). This is done: - to avoid code duplication in Type_handler_hybrid_field_type::aggregate_for_min_max() - to get rid of one more call for field_type(), which is unfriendly to the conceipt of pluggable data types.
9 years ago
MDEV-11361 Equal condition propagation does not work for DECIMAL and temporal dynamic SQL parameters MDEV-16426 Optimizer erroneously treats equal constants of different formats as same A cleanup for MDEV-14630: fixing a crash in Item_decimal::eq(). Problems: - old implementations of Item_decimal::eq() and Item_temporal_literal::eq() were not symmetric with Item_param::eq(), this caused MDEV-11361. - old implementations for DECIMAL and temporal data types did not take into account that in case when eq() is called with binary_cmp==true, {{eq()}} should check not only equality of the two values, but also equality if their decimal precision. This cuases MDEV-16426. - Item_decimal::eq() crashes with "item" pointing to a non-DECIMAL value. Before MDEV-14630 non-DECIMAL values were filtered out by the test: type() == item->type() as literals of different types had different type(). After MDEV-14630 type() for literals of all data types return CONST_ITEM. This caused failures in tests: ./mtr engines/iuds.insert_number ./mtr --ps --embedded main.explain_slowquerylog (revealed by buildbot) The essence of the fix: Making literals and Item_param reuse the same code to avoid asymmetries between Item_param::eq(Item_literal) and Item_literal::eq(Item_param), now and in the future, and to avoid code duplication between Item_literal and Item_param. Adding tests for "decimals" for DECIMAL and temporal data types, to treat constants of different scale as not equal when "binary_cmp" is "true". Details: 1. Adding a helper class Item_const to extract constant values from Items easier 2. Deriving Item_basic_value from Item_const 3. Joining Type_handler::Item_basic_value_eq() and Item_basic_value_bin_eq() into a single method with an extra "binary_cmp" argument (it looks simple this way) and renaming the new method to Item_const_eq(). Modifying its implementations to operate with Item_const instead of Item_basic_value. 4. Adding a new class Type_handler_hex_hybrid, to handle hex constants like 0x616263. 5. Removing Item::VARBIN_ITEM and fixing Item_hex_constant to use type_handler_hex_hybrid instead of type_handler_varchar. Item_hex_hybrid::type() now returns CONST_ITEM, like all other literals do. 6. Move virtual methods Item::type_handler_for_system_time() and Item::cast_to_int_type_handler() from Item to Type_handler. 7. Removing Item_decimal::eq() and Item_temporal_literal::eq(). These classes are now handled by the generic Item_basic_value::eq(). 8. Implementing Type_handler_temporal_result::Item_const_eq() and Type_handler_decimal_result::Item_const_eq(), this fixes MDEV-11361. 9. Adding tests for "decimals" into Type_handler_decimal_result::Item_const_eq() and Type_handler_temporal_result::Item_const_eq() in case if "binary_cmp" is true. This fixes MDEV-16426. 10. Moving Item_cache out of Item_basic_value. They share nothing. It simplifies implementation of Item_basic_value::eq(). Deriving Item_cache directly from Item. 11. Adding class DbugStringItemTypeValue, which used Item::print() internally, and using in instead of the old debug printing code. This gives nicer output in func_debug.result. Changes N5 and N6 do not directly relate to the bugs fixed, but make the code fully symmetric across all literal types. Without a new handler Type_handler_hex_hybrid we'd have to keep two code branches (for regular literals and for hex hybrid literals).
7 years ago
MDEV-16454 Bad results for IN with ROW Consider an IN predicate with ROW-type arguments: predicant IN (value1, ..., valueM) where predicant and all values consist of N elements. When performing IN for these arguments, at every position i (1..N) only data type of i-th element of predicant was taken into account, while data types on i-th elements of value1..valueM were not taken. These led to bad comparison data type detection, e.g. when mixing unsigned and signed integer values. After this change all element data types are taken into account. So, for example, a mixture of unsigned and signed values is now calculated using decimal and does not overflow any more. Detailed changes: 1. All comparators for ROW elements are now created recursively at fix_fields() time, inside cmp_item_row::prepare_comparators(). Previously prepare_comparators() installed comparators only for temporal data types, while comparators for other types were installed at execution time, in cmp_item_row::store_value(). 2. Removing comparator creating code from cmp_item_row::store_value(). It was responsible for non-temporal data types. 3. Removing find_date_time_item(). It's not needed any more. All ROW-element data types are now covered by cmp_item_row::prepare_comparators(). 4. Adding a helper method Item_args::alloc_and_extract_row_elements() to extract elements from an array of ROW-type Items, from the given position. Using this method to collect elements from the i-th position and further pass them to Type_handler_hybrid_field_type::aggregate_for_comparison(). 5. Moving the call for alloc_comparators() inside cmp_item_row::prepare_comparators(). This helps to call prepare_comparators() for ROW elements recursively (if elements appear to be ROWs again). Moving alloc_comparators() from "public" to "private".
7 years ago
MDEV-11361 Equal condition propagation does not work for DECIMAL and temporal dynamic SQL parameters MDEV-16426 Optimizer erroneously treats equal constants of different formats as same A cleanup for MDEV-14630: fixing a crash in Item_decimal::eq(). Problems: - old implementations of Item_decimal::eq() and Item_temporal_literal::eq() were not symmetric with Item_param::eq(), this caused MDEV-11361. - old implementations for DECIMAL and temporal data types did not take into account that in case when eq() is called with binary_cmp==true, {{eq()}} should check not only equality of the two values, but also equality if their decimal precision. This cuases MDEV-16426. - Item_decimal::eq() crashes with "item" pointing to a non-DECIMAL value. Before MDEV-14630 non-DECIMAL values were filtered out by the test: type() == item->type() as literals of different types had different type(). After MDEV-14630 type() for literals of all data types return CONST_ITEM. This caused failures in tests: ./mtr engines/iuds.insert_number ./mtr --ps --embedded main.explain_slowquerylog (revealed by buildbot) The essence of the fix: Making literals and Item_param reuse the same code to avoid asymmetries between Item_param::eq(Item_literal) and Item_literal::eq(Item_param), now and in the future, and to avoid code duplication between Item_literal and Item_param. Adding tests for "decimals" for DECIMAL and temporal data types, to treat constants of different scale as not equal when "binary_cmp" is "true". Details: 1. Adding a helper class Item_const to extract constant values from Items easier 2. Deriving Item_basic_value from Item_const 3. Joining Type_handler::Item_basic_value_eq() and Item_basic_value_bin_eq() into a single method with an extra "binary_cmp" argument (it looks simple this way) and renaming the new method to Item_const_eq(). Modifying its implementations to operate with Item_const instead of Item_basic_value. 4. Adding a new class Type_handler_hex_hybrid, to handle hex constants like 0x616263. 5. Removing Item::VARBIN_ITEM and fixing Item_hex_constant to use type_handler_hex_hybrid instead of type_handler_varchar. Item_hex_hybrid::type() now returns CONST_ITEM, like all other literals do. 6. Move virtual methods Item::type_handler_for_system_time() and Item::cast_to_int_type_handler() from Item to Type_handler. 7. Removing Item_decimal::eq() and Item_temporal_literal::eq(). These classes are now handled by the generic Item_basic_value::eq(). 8. Implementing Type_handler_temporal_result::Item_const_eq() and Type_handler_decimal_result::Item_const_eq(), this fixes MDEV-11361. 9. Adding tests for "decimals" into Type_handler_decimal_result::Item_const_eq() and Type_handler_temporal_result::Item_const_eq() in case if "binary_cmp" is true. This fixes MDEV-16426. 10. Moving Item_cache out of Item_basic_value. They share nothing. It simplifies implementation of Item_basic_value::eq(). Deriving Item_cache directly from Item. 11. Adding class DbugStringItemTypeValue, which used Item::print() internally, and using in instead of the old debug printing code. This gives nicer output in func_debug.result. Changes N5 and N6 do not directly relate to the bugs fixed, but make the code fully symmetric across all literal types. Without a new handler Type_handler_hex_hybrid we'd have to keep two code branches (for regular literals and for hex hybrid literals).
7 years ago
  1. -- source include/have_geometry.inc
  2. -- source include/not_embedded.inc
  3. #
  4. # Spatial objects
  5. #
  6. CREATE TABLE gis_point (fid INTEGER NOT NULL PRIMARY KEY, g POINT);
  7. CREATE TABLE gis_line (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING);
  8. CREATE TABLE gis_polygon (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON);
  9. CREATE TABLE gis_multi_point (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOINT);
  10. CREATE TABLE gis_multi_line (fid INTEGER NOT NULL PRIMARY KEY, g MULTILINESTRING);
  11. CREATE TABLE gis_multi_polygon (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOLYGON);
  12. CREATE TABLE gis_geometrycollection (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRYCOLLECTION);
  13. CREATE TABLE gis_geometry (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY);
  14. SHOW FIELDS FROM gis_point;
  15. SHOW FIELDS FROM gis_line;
  16. SHOW FIELDS FROM gis_polygon;
  17. SHOW FIELDS FROM gis_multi_point;
  18. SHOW FIELDS FROM gis_multi_line;
  19. SHOW FIELDS FROM gis_multi_polygon;
  20. SHOW FIELDS FROM gis_geometrycollection;
  21. SHOW FIELDS FROM gis_geometry;
  22. INSERT INTO gis_point VALUES
  23. (101, PointFromText('POINT(10 10)')),
  24. (102, PointFromText('POINT(20 10)')),
  25. (103, PointFromText('POINT(20 20)')),
  26. (104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
  27. INSERT INTO gis_line VALUES
  28. (105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
  29. (106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
  30. (107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
  31. INSERT INTO gis_polygon VALUES
  32. (108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
  33. (109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
  34. (110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
  35. INSERT INTO gis_multi_point VALUES
  36. (111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
  37. (112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
  38. (113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
  39. INSERT INTO gis_multi_line VALUES
  40. (114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
  41. (115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
  42. (116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
  43. INSERT INTO gis_multi_polygon VALUES
  44. (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)))')),
  45. (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)))')),
  46. (119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
  47. INSERT INTO gis_geometrycollection VALUES
  48. (120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
  49. (121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),
  50. (122, GeomFromText('GeometryCollection()')),
  51. (123, GeomFromText('GeometryCollection EMPTY'));
  52. INSERT into gis_geometry SELECT * FROM gis_point;
  53. INSERT into gis_geometry SELECT * FROM gis_line;
  54. INSERT into gis_geometry SELECT * FROM gis_polygon;
  55. INSERT into gis_geometry SELECT * FROM gis_multi_point;
  56. INSERT into gis_geometry SELECT * FROM gis_multi_line;
  57. INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
  58. INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
  59. SELECT fid, AsText(g) FROM gis_point;
  60. SELECT fid, AsText(g) FROM gis_line;
  61. SELECT fid, AsText(g) FROM gis_polygon;
  62. SELECT fid, AsText(g) FROM gis_multi_point;
  63. SELECT fid, AsText(g) FROM gis_multi_line;
  64. SELECT fid, AsText(g) FROM gis_multi_polygon;
  65. SELECT fid, AsText(g) FROM gis_geometrycollection;
  66. SELECT fid, AsText(g) FROM gis_geometry;
  67. SELECT fid, Dimension(g) FROM gis_geometry;
  68. SELECT fid, GeometryType(g) FROM gis_geometry;
  69. SELECT fid, IsEmpty(g) FROM gis_geometry;
  70. SELECT fid, AsText(Envelope(g)) FROM gis_geometry;
  71. --disable_view_protocol
  72. explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry;
  73. --enable_view_protocol
  74. SELECT fid, X(g) FROM gis_point;
  75. SELECT fid, Y(g) FROM gis_point;
  76. --disable_view_protocol
  77. explain extended select X(g),Y(g) FROM gis_point;
  78. --enable_view_protocol
  79. SELECT fid, AsText(StartPoint(g)) FROM gis_line;
  80. SELECT fid, AsText(EndPoint(g)) FROM gis_line;
  81. SELECT fid, GLength(g) FROM gis_line;
  82. SELECT fid, NumPoints(g) FROM gis_line;
  83. SELECT fid, AsText(PointN(g, 2)) FROM gis_line;
  84. SELECT fid, IsClosed(g) FROM gis_line;
  85. --disable_view_protocol
  86. explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM gis_line;
  87. --enable_view_protocol
  88. SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
  89. SELECT fid, Area(g) FROM gis_polygon;
  90. SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon;
  91. SELECT fid, NumInteriorRings(g) FROM gis_polygon;
  92. SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon;
  93. explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),AsText(InteriorRingN(g, 1)) FROM gis_polygon;
  94. SELECT fid, IsClosed(g) FROM gis_multi_line;
  95. SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
  96. SELECT fid, Area(g) FROM gis_multi_polygon;
  97. SELECT fid, NumGeometries(g) from gis_multi_point;
  98. SELECT fid, NumGeometries(g) from gis_multi_line;
  99. SELECT fid, NumGeometries(g) from gis_multi_polygon;
  100. SELECT fid, NumGeometries(g) from gis_geometrycollection;
  101. --disable_view_protocol
  102. explain extended SELECT fid, NumGeometries(g) from gis_multi_point;
  103. --enable_view_protocol
  104. SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
  105. SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line;
  106. SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon;
  107. SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection;
  108. SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection;
  109. --disable_view_protocol
  110. explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
  111. --enable_view_protocol
  112. #query plan for view protocol doesn't contain database name
  113. --disable_view_protocol
  114. SELECT g1.fid as first, g2.fid as second,
  115. Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
  116. Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
  117. Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
  118. FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
  119. explain extended SELECT g1.fid as first, g2.fid as second,
  120. Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
  121. Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
  122. Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
  123. FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
  124. --enable_view_protocol
  125. DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
  126. #
  127. # Check that ALTER TABLE doesn't loose geometry type
  128. #
  129. CREATE TABLE t1 (
  130. gp point,
  131. ln linestring,
  132. pg polygon,
  133. mp multipoint,
  134. mln multilinestring,
  135. mpg multipolygon,
  136. gc geometrycollection,
  137. gm geometry
  138. );
  139. SHOW FIELDS FROM t1;
  140. ALTER TABLE t1 ADD fid INT NOT NULL;
  141. SHOW FIELDS FROM t1;
  142. DROP TABLE t1;
  143. SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)')))) as exp;
  144. --disable_view_protocol
  145. explain extended SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
  146. explain extended SELECT AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))));
  147. --enable_view_protocol
  148. SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
  149. --disable_view_protocol
  150. explain extended SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
  151. #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)')));
  152. explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6));
  153. --enable_view_protocol
  154. create table t1 (a geometry not null);
  155. insert into t1 values (GeomFromText('Point(1 2)'));
  156. -- error 1416
  157. insert into t1 values ('Garbage');
  158. -- error 1416
  159. insert IGNORE into t1 values ('Garbage');
  160. alter table t1 add spatial index(a);
  161. drop table t1;
  162. #
  163. # Bug #5219: problem with range optimizer
  164. #
  165. create table t1(a geometry not null, spatial index(a));
  166. insert into t1 values
  167. (GeomFromText('POINT(1 1)')), (GeomFromText('POINT(3 3)')),
  168. (GeomFromText('POINT(4 4)')), (GeomFromText('POINT(6 6)'));
  169. select AsText(a) from t1 where
  170. MBRContains(GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a)
  171. or
  172. MBRContains(GeomFromText('Polygon((2 2, 2 5, 5 5, 5 2, 2 2))'), a);
  173. select AsText(a) from t1 where
  174. MBRContains(GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a)
  175. and
  176. MBRContains(GeomFromText('Polygon((0 0, 0 7, 7 7, 7 0, 0 0))'), a);
  177. drop table t1;
  178. CREATE TABLE t1 (Coordinates POINT NOT NULL, SPATIAL INDEX(Coordinates));
  179. INSERT INTO t1 VALUES(GeomFromText('POINT(383293632 1754448)'));
  180. INSERT INTO t1 VALUES(GeomFromText('POINT(564952612 157516260)'));
  181. INSERT INTO t1 VALUES(GeomFromText('POINT(903994614 180726515)'));
  182. INSERT INTO t1 VALUES(GeomFromText('POINT(98128178 141127631)'));
  183. INSERT INTO t1 VALUES(GeomFromText('POINT(862547902 799334546)'));
  184. INSERT INTO t1 VALUES(GeomFromText('POINT(341989013 850270906)'));
  185. INSERT INTO t1 VALUES(GeomFromText('POINT(803302376 93039099)'));
  186. INSERT INTO t1 VALUES(GeomFromText('POINT(857439153 817431356)'));
  187. INSERT INTO t1 VALUES(GeomFromText('POINT(319757546 343162742)'));
  188. INSERT INTO t1 VALUES(GeomFromText('POINT(826341972 717484432)'));
  189. INSERT INTO t1 VALUES(GeomFromText('POINT(305066789 201736238)'));
  190. INSERT INTO t1 VALUES(GeomFromText('POINT(626068992 616241497)'));
  191. INSERT INTO t1 VALUES(GeomFromText('POINT(55789424 755830108)'));
  192. INSERT INTO t1 VALUES(GeomFromText('POINT(802874458 312435220)'));
  193. INSERT INTO t1 VALUES(GeomFromText('POINT(153795660 551723671)'));
  194. INSERT INTO t1 VALUES(GeomFromText('POINT(242207428 537089292)'));
  195. INSERT INTO t1 VALUES(GeomFromText('POINT(553478119 807160039)'));
  196. INSERT INTO t1 VALUES(GeomFromText('POINT(694605552 457472733)'));
  197. INSERT INTO t1 VALUES(GeomFromText('POINT(987886554 792733729)'));
  198. INSERT INTO t1 VALUES(GeomFromText('POINT(598600363 850434457)'));
  199. INSERT INTO t1 VALUES(GeomFromText('POINT(592068275 940589376)'));
  200. INSERT INTO t1 VALUES(GeomFromText('POINT(700705362 395370650)'));
  201. INSERT INTO t1 VALUES(GeomFromText('POINT(33628474 558144514)'));
  202. INSERT INTO t1 VALUES(GeomFromText('POINT(212802006 353386020)'));
  203. INSERT INTO t1 VALUES(GeomFromText('POINT(901307256 39143977)'));
  204. INSERT INTO t1 VALUES(GeomFromText('POINT(70870451 206374045)'));
  205. INSERT INTO t1 VALUES(GeomFromText('POINT(240880214 696939443)'));
  206. INSERT INTO t1 VALUES(GeomFromText('POINT(822615542 296669638)'));
  207. INSERT INTO t1 VALUES(GeomFromText('POINT(452769551 625489999)'));
  208. INSERT INTO t1 VALUES(GeomFromText('POINT(609104858 606565210)'));
  209. INSERT INTO t1 VALUES(GeomFromText('POINT(177213669 851312285)'));
  210. INSERT INTO t1 VALUES(GeomFromText('POINT(143654501 730691787)'));
  211. INSERT INTO t1 VALUES(GeomFromText('POINT(658472325 838260052)'));
  212. INSERT INTO t1 VALUES(GeomFromText('POINT(188164520 646358878)'));
  213. INSERT INTO t1 VALUES(GeomFromText('POINT(630993781 786764883)'));
  214. INSERT INTO t1 VALUES(GeomFromText('POINT(496793334 223062055)'));
  215. INSERT INTO t1 VALUES(GeomFromText('POINT(727354258 197498696)'));
  216. INSERT INTO t1 VALUES(GeomFromText('POINT(618432704 760982731)'));
  217. INSERT INTO t1 VALUES(GeomFromText('POINT(755643210 831234710)'));
  218. INSERT INTO t1 VALUES(GeomFromText('POINT(114368751 656950466)'));
  219. INSERT INTO t1 VALUES(GeomFromText('POINT(870378686 185239202)'));
  220. INSERT INTO t1 VALUES(GeomFromText('POINT(863324511 111258900)'));
  221. INSERT INTO t1 VALUES(GeomFromText('POINT(882178645 685940052)'));
  222. INSERT INTO t1 VALUES(GeomFromText('POINT(407928538 334948195)'));
  223. INSERT INTO t1 VALUES(GeomFromText('POINT(311430051 17033395)'));
  224. INSERT INTO t1 VALUES(GeomFromText('POINT(941513405 488643719)'));
  225. INSERT INTO t1 VALUES(GeomFromText('POINT(868345680 85167906)'));
  226. INSERT INTO t1 VALUES(GeomFromText('POINT(219335507 526818004)'));
  227. INSERT INTO t1 VALUES(GeomFromText('POINT(923427958 407500026)'));
  228. INSERT INTO t1 VALUES(GeomFromText('POINT(173176882 554421738)'));
  229. INSERT INTO t1 VALUES(GeomFromText('POINT(194264908 669970217)'));
  230. INSERT INTO t1 VALUES(GeomFromText('POINT(777483793 921619165)'));
  231. INSERT INTO t1 VALUES(GeomFromText('POINT(867468912 395916497)'));
  232. INSERT INTO t1 VALUES(GeomFromText('POINT(682601897 623112122)'));
  233. INSERT INTO t1 VALUES(GeomFromText('POINT(227151206 796970647)'));
  234. INSERT INTO t1 VALUES(GeomFromText('POINT(280062588 97529892)'));
  235. INSERT INTO t1 VALUES(GeomFromText('POINT(982209849 143387099)'));
  236. INSERT INTO t1 VALUES(GeomFromText('POINT(208788792 864388493)'));
  237. INSERT INTO t1 VALUES(GeomFromText('POINT(829327151 616717329)'));
  238. INSERT INTO t1 VALUES(GeomFromText('POINT(199336688 140757201)'));
  239. INSERT INTO t1 VALUES(GeomFromText('POINT(633750724 140850093)'));
  240. INSERT INTO t1 VALUES(GeomFromText('POINT(629400920 502096404)'));
  241. INSERT INTO t1 VALUES(GeomFromText('POINT(226017998 848736426)'));
  242. INSERT INTO t1 VALUES(GeomFromText('POINT(28914408 149445955)'));
  243. INSERT INTO t1 VALUES(GeomFromText('POINT(256236452 202091290)'));
  244. INSERT INTO t1 VALUES(GeomFromText('POINT(703867693 450501360)'));
  245. INSERT INTO t1 VALUES(GeomFromText('POINT(872061506 481351486)'));
  246. INSERT INTO t1 VALUES(GeomFromText('POINT(372120524 739530418)'));
  247. INSERT INTO t1 VALUES(GeomFromText('POINT(877267982 54722420)'));
  248. INSERT INTO t1 VALUES(GeomFromText('POINT(362642540 104419188)'));
  249. INSERT INTO t1 VALUES(GeomFromText('POINT(851693067 642705127)'));
  250. INSERT INTO t1 VALUES(GeomFromText('POINT(201949080 833902916)'));
  251. INSERT INTO t1 VALUES(GeomFromText('POINT(786092225 410737872)'));
  252. INSERT INTO t1 VALUES(GeomFromText('POINT(698291409 615419376)'));
  253. INSERT INTO t1 VALUES(GeomFromText('POINT(27455201 897628096)'));
  254. INSERT INTO t1 VALUES(GeomFromText('POINT(756176576 661205925)'));
  255. INSERT INTO t1 VALUES(GeomFromText('POINT(38478189 385577496)'));
  256. INSERT INTO t1 VALUES(GeomFromText('POINT(163302328 264496186)'));
  257. INSERT INTO t1 VALUES(GeomFromText('POINT(234313922 192216735)'));
  258. INSERT INTO t1 VALUES(GeomFromText('POINT(413942141 490550373)'));
  259. INSERT INTO t1 VALUES(GeomFromText('POINT(394308025 117809834)'));
  260. INSERT INTO t1 VALUES(GeomFromText('POINT(941051732 266369530)'));
  261. INSERT INTO t1 VALUES(GeomFromText('POINT(599161319 313172256)'));
  262. INSERT INTO t1 VALUES(GeomFromText('POINT(5899948 476429301)'));
  263. INSERT INTO t1 VALUES(GeomFromText('POINT(367894677 368542487)'));
  264. INSERT INTO t1 VALUES(GeomFromText('POINT(580848489 219587743)'));
  265. INSERT INTO t1 VALUES(GeomFromText('POINT(11247614 782797569)'));
  266. drop table t1;
  267. create table t1 select GeomFromWKB(POINT(1,3));
  268. show create table t1;
  269. drop table t1;
  270. CREATE TABLE `t1` (`object_id` bigint(20) unsigned NOT NULL default '0', `geo`
  271. geometry NOT NULL default '') ENGINE=MyISAM ;
  272. insert into t1 values ('85984',GeomFromText('MULTIPOLYGON(((-115.006363
  273. 36.305435,-114.992394 36.305202,-114.991219 36.305975,-114.991163
  274. 36.306845,-114.989432 36.309452,-114.978275 36.312642,-114.977363
  275. 36.311978,-114.975327 36.312344,-114.96502 36.31597,-114.963364
  276. 36.313629,-114.961723 36.313721,-114.956398 36.316057,-114.951882
  277. 36.320979,-114.947073 36.323475,-114.945207 36.326451,-114.945207
  278. 36.326451,-114.944132 36.326061,-114.94003 36.326588,-114.924017
  279. 36.334484,-114.923281 36.334146,-114.92564 36.331504,-114.94072
  280. 36.319282,-114.945348 36.314812,-114.948091 36.314762,-114.951755
  281. 36.316211,-114.952446 36.313883,-114.952644 36.309488,-114.944725
  282. 36.313083,-114.93706 36.32043,-114.932478 36.323497,-114.924556
  283. 36.327708,-114.922608 36.329715,-114.92009 36.328695,-114.912105
  284. 36.323566,-114.901647 36.317952,-114.897436 36.313968,-114.895344
  285. 36.309573,-114.891699 36.304398,-114.890569 36.303551,-114.886356
  286. 36.302702,-114.885141 36.301351,-114.885709 36.297391,-114.892499
  287. 36.290893,-114.902142 36.288974,-114.904941 36.288838,-114.905308
  288. 36.289845,-114.906325 36.290395,-114.909916 36.289549,-114.914527
  289. 36.287535,-114.918797 36.284423,-114.922982 36.279731,-114.924113
  290. 36.277282,-114.924057 36.275817,-114.927733 36.27053,-114.929354
  291. 36.269029,-114.929354 36.269029,-114.950856 36.268715,-114.950768
  292. 36.264324,-114.960206 36.264293,-114.960301 36.268943,-115.006662
  293. 36.268929,-115.008583 36.265619,-115.00665 36.264247,-115.006659
  294. 36.246873,-115.006659 36.246873,-115.006838 36.247697,-115.010764
  295. 36.247774,-115.015609 36.25113,-115.015765 36.254505,-115.029517
  296. 36.254619,-115.038573 36.249317,-115.038573 36.249317,-115.023403
  297. 36.25841,-115.023873 36.258994,-115.031845 36.259829,-115.03183
  298. 36.261053,-115.025561 36.261095,-115.036417 36.274632,-115.033729
  299. 36.276041,-115.032217 36.274851,-115.029845 36.273959,-115.029934
  300. 36.274966,-115.025763 36.274896,-115.025406 36.281044,-115.028731
  301. 36.284471,-115.036497 36.290377,-115.042071 36.291039,-115.026759
  302. 36.298478,-115.008995 36.301966,-115.006363 36.305435),(-115.079835
  303. 36.244369,-115.079735 36.260186,-115.076435 36.262369,-115.069758
  304. 36.265,-115.070235 36.268757,-115.064542 36.268655,-115.061843
  305. 36.269857,-115.062676 36.270693,-115.06305 36.272344,-115.059051
  306. 36.281023,-115.05918 36.283008,-115.060591 36.285246,-115.061913
  307. 36.290022,-115.062499 36.306353,-115.062499 36.306353,-115.060918
  308. 36.30642,-115.06112 36.289779,-115.05713 36.2825,-115.057314
  309. 36.279446,-115.060779 36.274659,-115.061366 36.27209,-115.057858
  310. 36.26557,-115.055805 36.262883,-115.054688 36.262874,-115.047335
  311. 36.25037,-115.044234 36.24637,-115.052434 36.24047,-115.061734
  312. 36.23507,-115.061934 36.22677,-115.061934 36.22677,-115.061491
  313. 36.225267,-115.062024 36.218194,-115.060134 36.218278,-115.060133
  314. 36.210771,-115.057833 36.210771,-115.057433 36.196271,-115.062233
  315. 36.196271,-115.062233 36.190371,-115.062233 36.190371,-115.065533
  316. 36.190371,-115.071333 36.188571,-115.098331 36.188275,-115.098331
  317. 36.188275,-115.098435 36.237569,-115.097535 36.240369,-115.097535
  318. 36.240369,-115.093235 36.240369,-115.089135 36.240469,-115.083135
  319. 36.240569,-115.083135 36.240569,-115.079835
  320. 36.244369)))')),('85998',GeomFromText('MULTIPOLYGON(((-115.333107
  321. 36.264587,-115.333168 36.280638,-115.333168 36.280638,-115.32226
  322. 36.280643,-115.322538 36.274311,-115.327222 36.274258,-115.32733
  323. 36.263026,-115.330675 36.262984,-115.332132 36.264673,-115.333107
  324. 36.264587),(-115.247239 36.247066,-115.247438 36.218267,-115.247438
  325. 36.218267,-115.278525 36.219263,-115.278525 36.219263,-115.301545
  326. 36.219559,-115.332748 36.219197,-115.332757 36.220041,-115.332757
  327. 36.220041,-115.332895 36.233514,-115.349023 36.233479,-115.351489
  328. 36.234475,-115.353681 36.237021,-115.357106 36.239789,-115.36519
  329. 36.243331,-115.368156 36.243487,-115.367389 36.244902,-115.364553
  330. 36.246014,-115.359219 36.24616,-115.356186 36.248025,-115.353347
  331. 36.248004,-115.350813 36.249507,-115.339673 36.25387,-115.333069
  332. 36.255018,-115.333069 36.255018,-115.333042 36.247767,-115.279039
  333. 36.248666,-115.263639 36.247466,-115.263839 36.252766,-115.261439
  334. 36.252666,-115.261439 36.247366,-115.247239 36.247066)))'));
  335. # Expected results are 115.2970604672862 and 36.23335610879993, but IA64 returns
  336. # slightly different values due to fused multiply-add instructions.
  337. --replace_result 115.29706047613604 115.2970604672862 36.23335611157958 36.23335610879993
  338. select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
  339. t1 where object_id=85998;
  340. # Expected result is 36.34725218253213, but IA64 returns 36.34725217627852
  341. # due to fused multiply-add instructions.
  342. --replace_result 36.34725217627852 36.34725218253213 -114.86854470090232 -114.86854472054372
  343. select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
  344. t1 where object_id=85984;
  345. drop table t1;
  346. create table t1 (fl geometry not null);
  347. --error 1416
  348. insert into t1 values (1);
  349. --error 1416
  350. insert into t1 values (1.11);
  351. --error 1416
  352. insert into t1 values ("qwerty");
  353. --error 1048
  354. insert into t1 values (pointfromtext('point(1,1)'));
  355. drop table t1;
  356. #enable after MDEV-32456
  357. --disable_view_protocol
  358. select (asWKT(geomfromwkb((0x000000000140240000000000004024000000000000)))) as exp;
  359. select (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440)))) as exp;
  360. --enable_view_protocol
  361. --enable_metadata
  362. --disable_view_protocol
  363. #check after fix MDEV-31540
  364. --disable_cursor_protocol
  365. create table t1 (g GEOMETRY);
  366. select * from t1;
  367. select asbinary(g) from t1;
  368. --enable_cursor_protocol
  369. --enable_view_protocol
  370. --disable_metadata
  371. drop table t1;
  372. create table t1 (a TEXT, b GEOMETRY NOT NULL, SPATIAL KEY(b));
  373. alter table t1 disable keys;
  374. --error 1263
  375. load data infile '../../std_data/bad_gis_data.dat' into table t1;
  376. alter table t1 enable keys;
  377. drop table t1;
  378. #
  379. # Bug #26038: is null and bad data
  380. #
  381. create table t1 (a int, b blob);
  382. insert into t1 values (1, ''), (2, NULL), (3, '1');
  383. select * from t1;
  384. --error ER_ILLEGAL_VALUE_FOR_TYPE
  385. select
  386. geometryfromtext(b) IS NULL, geometryfromwkb(b) IS NULL, astext(b) IS NULL,
  387. aswkb(b) IS NULL, geometrytype(b) IS NULL, centroid(b) IS NULL,
  388. envelope(b) IS NULL, startpoint(b) IS NULL, endpoint(b) IS NULL,
  389. exteriorring(b) IS NULL, pointn(b, 1) IS NULL, geometryn(b, 1) IS NULL,
  390. interiorringn(b, 1) IS NULL, multipoint(b) IS NULL, isempty(b) IS NULL,
  391. issimple(b) IS NULL, isclosed(b) IS NULL, dimension(b) IS NULL,
  392. numgeometries(b) IS NULL, numinteriorrings(b) IS NULL, numpoints(b) IS NULL,
  393. area(b) IS NULL, glength(b) IS NULL, srid(b) IS NULL, x(b) IS NULL,
  394. y(b) IS NULL
  395. from t1;
  396. select
  397. within(b, b) IS NULL, contains(b, b) IS NULL, overlaps(b, b) IS NULL,
  398. equals(b, b) IS NULL, disjoint(b, b) IS NULL, touches(b, b) IS NULL,
  399. intersects(b, b) IS NULL, crosses(b, b) IS NULL
  400. from t1;
  401. --error ER_ILLEGAL_VALUE_FOR_TYPE
  402. select
  403. point(b, b) IS NULL, linestring(b) IS NULL, polygon(b) IS NULL, multipoint(b) IS NULL,
  404. multilinestring(b) IS NULL, multipolygon(b) IS NULL,
  405. geometrycollection(b) IS NULL
  406. from t1;
  407. drop table t1;
  408. #
  409. # Bug #27164: Crash when mixing InnoDB and MyISAM Geospatial tables
  410. #
  411. CREATE TABLE t1(a POINT) ENGINE=MyISAM;
  412. INSERT INTO t1 VALUES (NULL);
  413. SELECT * FROM t1;
  414. DROP TABLE t1;
  415. #
  416. # Bug #30955 geomfromtext() crasher
  417. #
  418. CREATE TABLE `t1` ( `col9` set('a'), `col89` date);
  419. INSERT INTO `t1` VALUES ('','0000-00-00');
  420. select geomfromtext(col9,col89) as a from t1;
  421. DROP TABLE t1;
  422. #
  423. # Bug #31158 Spatial, Union, LONGBLOB vs BLOB bug (crops data)
  424. #
  425. CREATE TABLE t1 (
  426. geomdata polygon NOT NULL,
  427. SPATIAL KEY index_geom (geomdata)
  428. ) ENGINE=MyISAM DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED;
  429. CREATE TABLE t2 (
  430. geomdata polygon NOT NULL,
  431. SPATIAL KEY index_geom (geomdata)
  432. ) ENGINE=MyISAM DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED;
  433. CREATE TABLE t3
  434. select
  435. aswkb(ws.geomdata) AS geomdatawkb
  436. from
  437. t1 ws
  438. union
  439. select
  440. aswkb(ws.geomdata) AS geomdatawkb
  441. from
  442. t2 ws;
  443. describe t3;
  444. drop table t1;
  445. drop table t2;
  446. drop table t3;
  447. #
  448. # Bug #30284 spatial key corruption
  449. #
  450. create table t1(col1 geometry default null,col15 geometrycollection not
  451. null,spatial index(col15),index(col1(15)))engine=myisam;
  452. insert into t1 set col15 = GeomFromText('POINT(6 5)');
  453. insert into t1 set col15 = GeomFromText('POINT(6 5)');
  454. check table t1 extended;
  455. drop table t1;
  456. --echo End of 4.1 tests
  457. #
  458. # Bug #12281 (Geometry: crash in trigger)
  459. #
  460. create table t1 (s1 geometry not null,s2 char(100));
  461. create trigger t1_bu before update on t1 for each row set new.s1 = null;
  462. --error 1048
  463. insert into t1 values (null,null);
  464. drop table t1;
  465. #
  466. # Bug #10499 (function creation with GEOMETRY datatype)
  467. #
  468. --disable_warnings
  469. drop procedure if exists fn3;
  470. --enable_warnings
  471. create function fn3 () returns point deterministic return GeomFromText("point(1 1)");
  472. show create function fn3;
  473. select astext(fn3());
  474. drop function fn3;
  475. #
  476. # Bug #12267 (primary key over GIS)
  477. #
  478. create table t1(pt POINT);
  479. alter table t1 add primary key pti(pt);
  480. drop table t1;
  481. create table t1(pt GEOMETRY);
  482. --error 1170
  483. alter table t1 add primary key pti(pt);
  484. alter table t1 add primary key pti(pt(20));
  485. drop table t1;
  486. create table t1 select GeomFromText('point(1 1)');
  487. desc t1;
  488. drop table t1;
  489. #
  490. # Bug #20691 (DEFAULT over NOT NULL field)
  491. #
  492. create table t1 (g geometry not null);
  493. --error ER_CANT_CREATE_GEOMETRY_OBJECT
  494. insert into t1 values(default);
  495. drop table t1;
  496. #
  497. # Bug #27300: create view with geometry functions lost columns types
  498. #
  499. CREATE TABLE t1 (a GEOMETRY);
  500. CREATE VIEW v1 AS SELECT GeomFromwkb(ASBINARY(a)) FROM t1;
  501. CREATE VIEW v2 AS SELECT a FROM t1;
  502. DESCRIBE v1;
  503. DESCRIBE v2;
  504. DROP VIEW v1,v2;
  505. DROP TABLE t1;
  506. #
  507. # Bug#24563: MBROverlaps does not seem to function propertly
  508. # Bug#54888: MBROverlaps missing in 5.1?
  509. #
  510. # Test all MBR* functions and their non-MBR-prefixed aliases,
  511. # using shifted squares to verify the spatial relations.
  512. create table t1 (name VARCHAR(100), square GEOMETRY);
  513. INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
  514. INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
  515. INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
  516. INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
  517. INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
  518. INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
  519. INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
  520. INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
  521. INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
  522. INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
  523. INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
  524. INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
  525. INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
  526. INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
  527. INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
  528. 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;
  529. 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;
  530. 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;
  531. 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;
  532. 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;
  533. 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;
  534. 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;
  535. 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;
  536. 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;
  537. 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;
  538. 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;
  539. 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;
  540. 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;
  541. 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;
  542. # Overlaps needs a few more tests, with point and line dimensions
  543. SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
  544. SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
  545. SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
  546. SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
  547. SET @point1 = GeomFromText('POLYGON ((0 0))');
  548. SET @point2 = GeomFromText('POLYGON ((-2 0))');
  549. SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
  550. SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
  551. SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
  552. SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
  553. SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
  554. SELECT Overlaps(@horiz1, @point1) FROM DUAL;
  555. SELECT Overlaps(@horiz1, @point2) FROM DUAL;
  556. DROP TABLE t1;
  557. #
  558. # Bug#28763: Selecting geometry fields in UNION caused server crash.
  559. #
  560. create table t1(f1 geometry, f2 linestring, f3 linestring);
  561. select f1 from t1 union select f1 from t1;
  562. insert into t1 (f2,f3) values (GeomFromText('LINESTRING(1 1, 2 2)'),
  563. GeomFromText('LINESTRING(0 0,1 1,2 2)'));
  564. select AsText(f2),AsText(f3) from t1;
  565. select AsText(a) from (select f2 as a from t1 union select f3 from t1) t;
  566. create table t2 as select f2 as a from t1 union select f3 from t1;
  567. desc t2;
  568. select AsText(a) from t2;
  569. drop table t1, t2;
  570. #
  571. # Bug #29166: MYsql crash when query is run
  572. #
  573. # The test query itself is not logged : too large output.
  574. # The real test is the second query : see if the first hasn't crashed the
  575. # server
  576. --disable_query_log
  577. --disable_result_log
  578. SELECT AsText(GeometryFromText(CONCAT(
  579. 'MULTIPOLYGON(((',
  580. REPEAT ('-0.00000000001234567890123456789012 -0.123456789012345678,', 1000),
  581. '-0.00000000001234567890123456789012 -0.123456789012345678',
  582. ')))'
  583. ))) AS a;
  584. --enable_result_log
  585. --enable_query_log
  586. SELECT 1;
  587. -- source include/gis_keys.inc
  588. #
  589. # Bug #31155 gis types in union'd select cause crash
  590. #
  591. create table `t1` (`col002` point)engine=myisam;
  592. insert into t1 values (),(),();
  593. select min(`col002`) from t1 union select `col002` from t1;
  594. drop table t1;
  595. --echo #
  596. --echo # Bug #47780: crash when comparing GIS items from subquery
  597. --echo #
  598. CREATE TABLE t1(a INT, b MULTIPOLYGON);
  599. INSERT INTO t1 VALUES
  600. (0,
  601. GEOMFROMTEXT(
  602. 'multipolygon(((1 2,3 4,5 6,7 8,9 8),(7 6,5 4,3 2,1 2,3 4)))'));
  603. --echo # must not crash
  604. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  605. SELECT 1 FROM t1 WHERE a <> (SELECT GEOMETRYCOLLECTIONFROMWKB(b) FROM t1);
  606. DROP TABLE t1;
  607. --echo #
  608. --echo # Bug #49250 : spatial btree index corruption and crash
  609. --echo # Part one : spatial syntax check
  610. --echo #
  611. --error ER_PARSE_ERROR
  612. CREATE TABLE t1(col1 MULTIPOLYGON NOT NULL,
  613. SPATIAL INDEX USING BTREE (col1));
  614. CREATE TABLE t2(col1 MULTIPOLYGON NOT NULL);
  615. --error ER_PARSE_ERROR
  616. CREATE SPATIAL INDEX USING BTREE ON t2(col);
  617. --error ER_PARSE_ERROR
  618. ALTER TABLE t2 ADD SPATIAL INDEX USING BTREE (col1);
  619. DROP TABLE t2;
  620. --echo End of 5.0 tests
  621. #
  622. # Bug #11335 View redefines column types
  623. #
  624. create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
  625. create view v1 as select * from t1;
  626. desc v1;
  627. drop view v1;
  628. drop table t1;
  629. #
  630. # Bug#44684: valgrind reports invalid reads in
  631. # Item_func_spatial_collection::val_str
  632. #
  633. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  634. SELECT MultiPoint(12345,'');
  635. #SELECT MultiPoint(123451,'');
  636. #SELECT MultiPoint(1234512,'');
  637. #SELECT MultiPoint(12345123,'');
  638. --error ER_ILLEGAL_VALUE_FOR_TYPE
  639. #SELECT MultiLineString(12345,'');
  640. #SELECT MultiLineString(123451,'');
  641. #SELECT MultiLineString(1234512,'');
  642. #SELECT MultiLineString(12345123,'');
  643. --error ER_ILLEGAL_VALUE_FOR_TYPE
  644. #SELECT LineString(12345,'');
  645. #SELECT LineString(123451,'');
  646. #SELECT LineString(1234512,'');
  647. #SELECT LineString(12345123,'');
  648. --error ER_ILLEGAL_VALUE_FOR_TYPE
  649. #SELECT Polygon(12345,'');
  650. #SELECT Polygon(123451,'');
  651. #SELECT Polygon(1234512,'');
  652. #SELECT Polygon(12345123,'');
  653. #
  654. # Bug55531 crash with conversions of geometry types / strings
  655. #
  656. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  657. SELECT 1 FROM (SELECT GREATEST(1,GEOMETRYCOLLECTION('00000','00000')) b FROM DUAL) AS d WHERE (LINESTRING(d.b));
  658. --echo #
  659. --echo # BUG#51875: crash when loading data into geometry function polyfromwkb
  660. --echo #
  661. SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440;
  662. SET @a=POLYFROMWKB(@a);
  663. SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440;
  664. SET @a=POLYFROMWKB(@a);
  665. #
  666. # Bug #57321 crashes and valgrind errors from spatial types
  667. #
  668. #The SELECT statement cannot contain a subquery in the FROM clause
  669. #fore --view-protocol
  670. --disable_view_protocol
  671. create table t1(a geometry NOT NULL)engine=myisam;
  672. insert into t1 values (geomfromtext("point(0 1)"));
  673. insert into t1 values (geomfromtext("point(1 0)"));
  674. select * from (select polygon(t1.a) as p from t1 order by t1.a) d;
  675. drop table t1;
  676. --enable_view_protocol
  677. --echo #
  678. --echo # Test for bug #59888 "debug assertion when attempt to create spatial index
  679. --echo # on char > 31 bytes".
  680. --echo #
  681. create table t1(a char(32) not null) engine=myisam;
  682. --error ER_WRONG_ARGUMENTS
  683. create spatial index i on t1 (a);
  684. drop table t1;
  685. #
  686. # Bug#11767480 - SPATIAL INDEXES ON NON-SPATIAL COLUMNS CAUSE CRASHES.
  687. #
  688. CREATE TABLE t0 (a BINARY(32) NOT NULL);
  689. --error ER_WRONG_ARGUMENTS
  690. CREATE SPATIAL INDEX i on t0 (a);
  691. INSERT INTO t0 VALUES (1);
  692. --error ER_WRONG_ARGUMENTS
  693. CREATE TABLE t1(
  694. col0 BINARY NOT NULL,
  695. col2 TIMESTAMP,
  696. SPATIAL INDEX i1 (col0)
  697. ) ENGINE=MyISAM;
  698. # Test other ways to add indices
  699. CREATE TABLE t1 (
  700. col0 BINARY NOT NULL,
  701. col2 TIMESTAMP
  702. ) ENGINE=MyISAM;
  703. --error ER_WRONG_ARGUMENTS
  704. CREATE SPATIAL INDEX idx0 ON t1(col0);
  705. --error ER_WRONG_ARGUMENTS
  706. ALTER TABLE t1 ADD SPATIAL INDEX i1 (col0);
  707. CREATE TABLE t2 (
  708. col0 INTEGER NOT NULL,
  709. col1 POINT,
  710. col2 POINT
  711. );
  712. --error ER_WRONG_ARGUMENTS
  713. CREATE SPATIAL INDEX idx0 ON t2 (col1, col2);
  714. --error ER_WRONG_ARGUMENTS
  715. CREATE TABLE t3 (
  716. col0 INTEGER NOT NULL,
  717. col1 POINT,
  718. col2 LINESTRING,
  719. SPATIAL INDEX i1 (col1, col2)
  720. );
  721. # cleanup
  722. DROP TABLE t0, t1, t2;
  723. --echo #
  724. --echo # BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS
  725. --echo #
  726. SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)));
  727. --echo #
  728. --echo # BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN
  729. --echo # GEOMETRY FUNCTION ARGUMENTS
  730. --echo #
  731. --replace_regex /non geometric .* value/non geometric '' value/
  732. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  733. SELECT GEOMETRYCOLLECTION((SELECT @@OLD));
  734. --echo #
  735. --echo # MDEV-4252 geometry query crashes server
  736. --echo #
  737. select astext(0x0100000000030000000100000000000010);
  738. select astext(st_centroid(0x0100000000030000000100000000000010));
  739. select astext(st_exteriorring(0x0100000000030000000100000000000010));
  740. select envelope(0x0100000000030000000100000000000010);
  741. select geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1) as exp;
  742. select geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1) as exp;
  743. --echo #
  744. --echo # MDEV-4296 Assertion `n_linear_rings > 0' fails in Gis_polygon::centroid_xy
  745. --echo #
  746. SELECT Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) ))) as exp;
  747. --echo #
  748. --echo # MDEV-4295 Server crashes in get_point on a query with Area, AsBinary, MultiPoint
  749. --echo #
  750. SELECT Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2)))) as exp;
  751. --echo End of 5.1 tests
  752. #bug 850775 ST_AREA does not work on GEOMETRYCOLLECTIONs in maria-5.3-gis
  753. 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))')) as exp;
  754. #bug 855336 ST_LENGTH does not work on GEOMETRYCOLLECTIONs
  755. select ST_LENGTH(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 100 30, 20 30), POINT(3 3), LINESTRING(20 20, 30 20))')) as exp;
  756. # Conformance tests
  757. #
  758. # C.3.3 Geometry types and functions
  759. #
  760. --disable_warnings
  761. DROP DATABASE IF EXISTS gis_ogs;
  762. --enable_warnings
  763. CREATE DATABASE gis_ogs;
  764. USE gis_ogs;
  765. --echo #
  766. --echo # C.3.3.1 Geometry types and functions schema construction
  767. --echo #
  768. # TODO: WL#2377
  769. #CREATE TABLE spatial_ref_sys (
  770. #srid INTEGER NOT NULL PRIMARY KEY,
  771. #auth_name CHARACTER VARYING,
  772. #auth_srid INTEGER,
  773. #srtext CHARACTER VARYING(2048));
  774. CREATE TABLE lakes (
  775. fid INTEGER NOT NULL PRIMARY KEY,
  776. name CHARACTER VARYING(64),
  777. shore POLYGON);
  778. CREATE TABLE road_segments (
  779. fid INTEGER NOT NULL PRIMARY KEY,
  780. name CHARACTER VARYING(64),
  781. aliases CHARACTER VARYING(64),
  782. num_lanes INTEGER,
  783. centerline LINESTRING);
  784. CREATE TABLE divided_routes (
  785. fid INTEGER NOT NULL PRIMARY KEY,
  786. name CHARACTER VARYING(64),
  787. num_lanes INTEGER,
  788. centerlines MULTILINESTRING);
  789. CREATE TABLE forests (
  790. fid INTEGER NOT NULL PRIMARY KEY,
  791. name CHARACTER VARYING(64),
  792. boundary MULTIPOLYGON);
  793. CREATE TABLE bridges (
  794. fid INTEGER NOT NULL PRIMARY KEY,
  795. name CHARACTER VARYING(64),
  796. position POINT);
  797. CREATE TABLE streams (
  798. fid INTEGER NOT NULL PRIMARY KEY,
  799. name CHARACTER VARYING(64),
  800. centerline LINESTRING);
  801. CREATE TABLE buildings (
  802. fid INTEGER NOT NULL PRIMARY KEY,
  803. address CHARACTER VARYING(64),
  804. position POINT,
  805. footprint POLYGON);
  806. CREATE TABLE ponds (
  807. fid INTEGER NOT NULL PRIMARY KEY,
  808. name CHARACTER VARYING(64),
  809. type CHARACTER VARYING(64),
  810. shores MULTIPOLYGON);
  811. CREATE TABLE named_places (
  812. fid INTEGER NOT NULL PRIMARY KEY,
  813. name CHARACTER VARYING(64),
  814. boundary POLYGON);
  815. CREATE TABLE map_neatlines (
  816. fid INTEGER NOT NULL PRIMARY KEY,
  817. neatline POLYGON);
  818. --echo #
  819. --echo # C.3.3.2 Geometry types and functions schema data loading
  820. --echo #
  821. # TODO: WL#2377
  822. #-- Spatial Reference System
  823. #INSERT INTO spatial_ref_sys VALUES
  824. #(101, 'POSC', 32214, 'PROJCS["UTM_ZONE_14N",
  825. #GEOGCS["World Geodetic System 72",
  826. #DATUM["WGS_72",
  827. #ELLIPSOID["NWL_10D", 6378135, 298.26]],
  828. #PRIMEM["Greenwich", 0],
  829. #UNIT["Meter", 1.0]],
  830. #PROJECTION["Transverse_Mercator"],
  831. #PARAMETER["False_Easting", 500000.0],
  832. #PARAMETER["False_Northing", 0.0],
  833. #PARAMETER["Central_Meridian", -99.0],
  834. #PARAMETER["Scale_Factor", 0.9996],
  835. #PARAMETER["Latitude_of_origin", 0.0],
  836. #UNIT["Meter", 1.0]]');
  837. --echo # Lakes
  838. INSERT INTO lakes VALUES (
  839. 101, 'BLUE LAKE',
  840. PolyFromText(
  841. 'POLYGON(
  842. (52 18,66 23,73 9,48 6,52 18),
  843. (59 18,67 18,67 13,59 13,59 18)
  844. )',
  845. 101));
  846. --echo # Road Segments
  847. INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2,
  848. LineFromText(
  849. 'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101));
  850. INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4,
  851. LineFromText(
  852. 'LINESTRING( 44 31, 56 34, 70 38 )' ,101));
  853. INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2,
  854. LineFromText(
  855. 'LINESTRING( 70 38, 72 48 )' ,101));
  856. INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4,
  857. LineFromText(
  858. 'LINESTRING( 70 38, 84 42 )' ,101));
  859. INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL,
  860. 1,
  861. LineFromText(
  862. 'LINESTRING( 28 26, 28 0 )',101));
  863. --echo # DividedRoutes
  864. INSERT INTO divided_routes VALUES(119, 'Route 75', 4,
  865. MLineFromText(
  866. 'MULTILINESTRING((10 48,10 21,10 0),
  867. (16 0,16 23,16 48))', 101));
  868. --echo # Forests
  869. INSERT INTO forests VALUES(109, 'Green Forest',
  870. MPolyFromText(
  871. 'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),
  872. (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))',
  873. 101));
  874. --echo # Bridges
  875. INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText(
  876. 'POINT( 44 31 )', 101));
  877. --echo # Streams
  878. INSERT INTO streams VALUES(111, 'Cam Stream',
  879. LineFromText(
  880. 'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101));
  881. INSERT INTO streams VALUES(112, NULL,
  882. LineFromText(
  883. 'LINESTRING( 76 0, 78 4, 73 9 )', 101));
  884. --echo # Buildings
  885. INSERT INTO buildings VALUES(113, '123 Main Street',
  886. PointFromText(
  887. 'POINT( 52 30 )', 101),
  888. PolyFromText(
  889. 'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101));
  890. INSERT INTO buildings VALUES(114, '215 Main Street',
  891. PointFromText(
  892. 'POINT( 64 33 )', 101),
  893. PolyFromText(
  894. 'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101));
  895. --echo # Ponds
  896. INSERT INTO ponds VALUES(120, NULL, 'Stock Pond',
  897. MPolyFromText(
  898. 'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ),
  899. ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101));
  900. --echo # Named Places
  901. INSERT INTO named_places VALUES(117, 'Ashton',
  902. PolyFromText(
  903. 'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101));
  904. INSERT INTO named_places VALUES(118, 'Goose Island',
  905. PolyFromText(
  906. 'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101));
  907. --echo # Map Neatlines
  908. INSERT INTO map_neatlines VALUES(115,
  909. PolyFromText(
  910. 'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101));
  911. --echo #
  912. --echo # C.3.3.3 Geometry types and functions schema test queries
  913. --echo
  914. # TODO: WL#2377
  915. #--echo # Conformance Item T1
  916. #SELECT f_table_name
  917. #FROM geometry_columns;
  918. #
  919. #--echo # Conformance Item T2
  920. #SELECT f_geometry_column
  921. #FROM geometry_columns
  922. #WHERE f_table_name = 'streams';
  923. #
  924. #--echo # Conformance Item T3
  925. #SELECT coord_dimension
  926. #FROM geometry_columns
  927. #WHERE f_table_name = 'streams';
  928. #
  929. #--echo # Conformance Item T4
  930. #
  931. #SELECT srid
  932. #FROM geometry_columns
  933. #WHERE f_table_name = 'streams';
  934. #
  935. #--echo # Conformance Item T5
  936. #
  937. #SELECT srtext
  938. #FROM SPATIAL_REF_SYS
  939. #WHERE SRID = 101;
  940. #
  941. --echo # Conformance Item T6
  942. # TODO: ST_Dimension() alias
  943. SELECT Dimension(shore)
  944. FROM lakes
  945. WHERE name = 'Blue Lake';
  946. --echo # Conformance Item T7
  947. # TODO: ST_GeometryType() alias
  948. SELECT GeometryType(centerlines)
  949. FROM divided_routes
  950. WHERE name = 'Route 75';
  951. --echo # Conformance Item T8
  952. # TODO: ST_AsText() alias
  953. SELECT AsText(boundary)
  954. FROM named_places
  955. WHERE name = 'Goose Island';
  956. --echo # Conformance Item T9
  957. # TODO: ST_AsBinary(), ST_PolyFromWKB() aliases
  958. SELECT AsText(PolyFromWKB(AsBinary(boundary),101))
  959. FROM named_places
  960. WHERE name = 'Goose Island';
  961. --echo # Conformance Item T10
  962. SELECT SRID(boundary)
  963. FROM named_places
  964. WHERE name = 'Goose Island';
  965. --echo # Conformance Item T11
  966. SELECT IsEmpty(centerline)
  967. FROM road_segments
  968. WHERE name = 'Route 5'
  969. AND aliases = 'Main Street';
  970. --echo # Conformance Item T12
  971. SELECT IsSimple(shore)
  972. FROM lakes
  973. WHERE name = 'Blue Lake';
  974. --echo # Conformance Item T13
  975. SELECT AsText(ST_Boundary(boundary))
  976. FROM named_places
  977. WHERE name = 'Goose Island';
  978. --echo # Conformance Item T14
  979. # FIXME: we get anticlockwise, GIS suggests clockwise
  980. SELECT AsText(Envelope(boundary))
  981. FROM named_places
  982. WHERE name = 'Goose Island';
  983. --echo # Conformance Item T15
  984. # TODO: ST_X() alias
  985. SELECT X(position)
  986. FROM bridges
  987. WHERE name = 'Cam Bridge';
  988. --echo # Conformance Item T16
  989. # TODO: ST_Y() alias
  990. SELECT Y(position)
  991. FROM bridges
  992. WHERE name = 'Cam Bridge';
  993. --echo # Conformance Item T17
  994. # TODO: ST_StartPoint() alias
  995. SELECT AsText(StartPoint(centerline))
  996. FROM road_segments
  997. WHERE fid = 102;
  998. --echo # Conformance Item T18
  999. SELECT AsText(EndPoint(centerline))
  1000. FROM road_segments
  1001. WHERE fid = 102;
  1002. SELECT IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) as exp
  1003. FROM named_places
  1004. WHERE name = 'Goose Island';
  1005. --echo # Conformance Item T20
  1006. SELECT IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) as exp
  1007. FROM named_places
  1008. WHERE name = 'Goose Island';
  1009. --echo # Conformance Item T21
  1010. SELECT GLength(centerline)
  1011. FROM road_segments
  1012. WHERE fid = 106;
  1013. --echo # Conformance Item T22
  1014. SELECT NumPoints(centerline)
  1015. FROM road_segments
  1016. WHERE fid = 102;
  1017. --echo # Conformance Item T23
  1018. SELECT AsText(PointN(centerline, 1))
  1019. FROM road_segments
  1020. WHERE fid = 102;
  1021. --echo # Conformance Item T24
  1022. SELECT AsText(Centroid(boundary))
  1023. FROM named_places
  1024. WHERE name = 'Goose Island';
  1025. SELECT ST_Contains(boundary, PointOnSurface(boundary))
  1026. FROM named_places
  1027. WHERE name = 'Goose Island';
  1028. --echo # Conformance Item T26
  1029. SELECT Area(boundary)
  1030. FROM named_places
  1031. WHERE name = 'Goose Island';
  1032. --echo # Conformance Item T27
  1033. SELECT AsText(ExteriorRing(shore))
  1034. FROM lakes
  1035. WHERE name = 'Blue Lake';
  1036. --echo # Conformance Item T28
  1037. SELECT NumInteriorRings(shore)
  1038. FROM lakes
  1039. WHERE name = 'Blue Lake';
  1040. --echo # Conformance Item T29
  1041. SELECT AsText(InteriorRingN(shore, 1))
  1042. FROM lakes
  1043. WHERE name = 'Blue Lake';
  1044. --echo # Conformance Item T30
  1045. SELECT NumGeometries(centerlines)
  1046. FROM divided_routes
  1047. WHERE name = 'Route 75';
  1048. --echo # Conformance Item T31
  1049. SELECT AsText(GeometryN(centerlines, 2))
  1050. FROM divided_routes
  1051. WHERE name = 'Route 75';
  1052. --echo # Conformance Item T32
  1053. SELECT IsClosed(centerlines)
  1054. FROM divided_routes
  1055. WHERE name = 'Route 75';
  1056. --echo # Conformance Item T33
  1057. SELECT GLength(centerlines)
  1058. FROM divided_routes
  1059. WHERE name = 'Route 75';
  1060. --echo # Conformance Item T34
  1061. SELECT AsText(Centroid(shores))
  1062. FROM ponds
  1063. WHERE fid = 120;
  1064. # TODO: WL#2377
  1065. --echo # Conformance Item T35
  1066. SELECT Contains(shores, PointOnSurface(shores))
  1067. FROM ponds
  1068. WHERE fid = 120;
  1069. --echo # Conformance Item T36
  1070. SELECT Area(shores)
  1071. FROM ponds
  1072. WHERE fid = 120;
  1073. --echo # Conformance Item T37
  1074. SELECT ST_Equals(boundary,
  1075. PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) as exp
  1076. FROM named_places
  1077. WHERE name = 'Goose Island';
  1078. --echo # Conformance Item T38
  1079. SELECT ST_Disjoint(centerlines, boundary)
  1080. FROM divided_routes, named_places
  1081. WHERE divided_routes.name = 'Route 75'
  1082. AND named_places.name = 'Ashton';
  1083. --echo # Conformance Item T39
  1084. SELECT ST_Touches(centerline, shore)
  1085. FROM streams, lakes
  1086. WHERE streams.name = 'Cam Stream'
  1087. AND lakes.name = 'Blue Lake';
  1088. --echo # Conformance Item T40
  1089. SELECT ST_Within(footprint, boundary)
  1090. FROM named_places, buildings
  1091. WHERE named_places.name = 'Ashton'
  1092. AND buildings.address = '215 Main Street';
  1093. --echo # Conformance Item T41
  1094. SELECT ST_Overlaps(forests.boundary, named_places.boundary)
  1095. FROM forests, named_places
  1096. WHERE forests.name = 'Green Forest'
  1097. AND named_places.name = 'Ashton';
  1098. --echo # Conformance Item T42
  1099. SELECT Crosses(road_segments.centerline, divided_routes.centerlines)
  1100. FROM road_segments, divided_routes
  1101. WHERE road_segments.fid = 102
  1102. AND divided_routes.name = 'Route 75';
  1103. --echo # Conformance Item T43
  1104. SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines) as exp
  1105. FROM road_segments, divided_routes
  1106. WHERE road_segments.fid = 102
  1107. AND divided_routes.name = 'Route 75';
  1108. --echo # Conformance Item T44
  1109. SELECT ST_Contains(forests.boundary, named_places.boundary)
  1110. FROM forests, named_places
  1111. WHERE forests.name = 'Green Forest'
  1112. AND named_places.name = 'Ashton';
  1113. --echo # Conformance Item T45
  1114. SELECT ST_Relate(forests.boundary, named_places.boundary, 'TTTTTTTTT')
  1115. FROM forests, named_places
  1116. WHERE forests.name = 'Green Forest'
  1117. AND named_places.name = 'Ashton';
  1118. --echo # Conformance Item T46
  1119. SELECT ST_Distance(position, boundary)
  1120. FROM bridges, named_places
  1121. WHERE bridges.name = 'Cam Bridge'
  1122. AND named_places.name = 'Ashton';
  1123. --echo # Conformance Item T47
  1124. SELECT AsText(ST_Intersection(centerline, shore))
  1125. FROM streams, lakes
  1126. WHERE streams.name = 'Cam Stream'
  1127. AND lakes.name = 'Blue Lake';
  1128. --echo # Conformance Item T48
  1129. SELECT AsText(ST_Difference(named_places.boundary, forests.boundary))
  1130. FROM named_places, forests
  1131. WHERE named_places.name = 'Ashton'
  1132. AND forests.name = 'Green Forest';
  1133. #--echo # Conformance Item T49
  1134. SELECT AsText(ST_Union(shore, boundary))
  1135. FROM lakes, named_places
  1136. WHERE lakes.name = 'Blue Lake'
  1137. AND named_places.name = 'Goose Island';
  1138. --echo # Conformance Item T50
  1139. SELECT AsText(ST_SymDifference(shore, boundary))
  1140. FROM lakes, named_places
  1141. WHERE lakes.name = 'Blue Lake'
  1142. AND named_places.name = 'Ashton';
  1143. --echo # Conformance Item T51
  1144. SELECT count(*)
  1145. FROM buildings, bridges
  1146. WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
  1147. --echo # Conformance Item T52
  1148. SELECT AsText(ConvexHull(shore))
  1149. FROM lakes
  1150. WHERE lakes.name = 'Blue Lake';
  1151. DROP DATABASE gis_ogs;
  1152. USE test;
  1153. --echo #
  1154. --echo # BUG #1043845 st_distance() results are incorrect depending on variable order
  1155. --echo #
  1156. select st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
  1157. -95.9673057475387 36.1344478941074,
  1158. -95.9673063519371 36.134484524621,
  1159. -95.9673049102515 36.1343976584193)'),
  1160. geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)')) as exp ;
  1161. select st_distance(geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)'),
  1162. geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
  1163. -95.9673057475387 36.1344478941074,
  1164. -95.9673063519371 36.134484524621,
  1165. -95.9673049102515 36.1343976584193) ')) as exp ;
  1166. --echo #
  1167. --echo # MDEV-4310 geometry function equals hangs forever.
  1168. --echo #
  1169. create table t1(a geometry not null)engine=myisam;
  1170. insert into t1 values(geomfromtext("POINT(0 0)"));
  1171. insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)"));
  1172. insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)"));
  1173. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1174. select equals(`a`,convert(`a` using utf8)) from `t1`;
  1175. select equals(`a`,left(`a`,23)) from `t1`;
  1176. drop table t1;
  1177. --echo #
  1178. --echo # MDEV-6883 ST_WITHIN crashes server if (0,0) is matched to POLYGON((0 0))
  1179. --echo #
  1180. select st_within(GeomFromText('Polygon((0 0))'), Point(0,0));
  1181. --echo End of 5.3 tests
  1182. --echo #
  1183. --echo # Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE
  1184. --echo #
  1185. CREATE TABLE g1
  1186. (a geometry NOT NULL, UNIQUE KEY i (a(151))) engine=myisam;
  1187. INSERT INTO g1 VALUES (geomfromtext('point(1 1)'));
  1188. INSERT INTO g1 VALUES (geomfromtext('point(1 2)'));
  1189. FLUSH TABLES;
  1190. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1191. SELECT 1 FROM g1
  1192. FORCE INDEX(i) WHERE a = date_sub(now(), interval 2808.4 year_month)
  1193. ;
  1194. DROP TABLE g1;
  1195. --echo #
  1196. --echo # Bug#13013970 MORE CRASHES IN FIELD_BLOB::GET_KEY_IMAGE
  1197. --echo #
  1198. CREATE TABLE g1(a TEXT NOT NULL, KEY(a(255)));
  1199. INSERT INTO g1 VALUES ('a'),('a');
  1200. SELECT 1 FROM g1 WHERE a >= ANY
  1201. (SELECT 1 FROM g1 WHERE a = geomfromtext('') OR a) ;
  1202. DROP TABLE g1;
  1203. --echo #
  1204. --echo # Bug#16451878 GEOMETRY QUERY CRASHES SERVER
  1205. --echo #
  1206. --echo # should not crash
  1207. SELECT ASTEXT(0x0100000000030000000100000000000010);
  1208. --echo #should not crash
  1209. SELECT ENVELOPE(0x0100000000030000000100000000000010);
  1210. --echo #should not crash
  1211. SELECT
  1212. GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffff0000, 1) as exp;
  1213. --echo #should not crash
  1214. SELECT
  1215. GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1) as exp;
  1216. --echo #
  1217. --echo # MDEV-3819 missing constraints for spatial column types
  1218. --echo #
  1219. create table t1 (pt point);
  1220. --error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
  1221. insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))'));
  1222. drop table t1;
  1223. #
  1224. # MDEV-7516 Assertion `!cur_p->event' failed in Gcalc_scan_iterator::arrange_event(int, int)
  1225. #
  1226. SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100)) as exp;
  1227. #
  1228. # MDEV-7779 View definition changes upon creation
  1229. #
  1230. CREATE VIEW v1 AS SELECT POINT(1,1) AS p;
  1231. SHOW CREATE VIEW v1;
  1232. SELECT ASTEXT(p) FROM v1;
  1233. DROP VIEW v1;
  1234. # --echo End of 5.5 tests
  1235. --echo #
  1236. --echo # Start of 10.0 tests
  1237. --echo #
  1238. --echo #
  1239. --echo # MDEV-12495 Conditional jump depends on uninitialised value for: SELECT NULL UNION geom_expression
  1240. --echo #
  1241. SELECT AsText(g) FROM (SELECT NULL AS g UNION SELECT Point(1,1)) AS t1;
  1242. --echo #
  1243. --echo # MDEV-10306 Wrong results with combination of CONCAT, SUBSTR and CONVERT in subquery
  1244. --echo #
  1245. SET @save_optimizer_switch=@@optimizer_switch;
  1246. SET optimizer_switch='derived_merge=on';
  1247. CREATE TABLE t1 (x INT, y INT);
  1248. INSERT INTO t1 VALUES(0,0);
  1249. SELECT LENGTH(t2) c2 FROM (SELECT ST_BUFFER(POINT(x,y), 0) t2 FROM t1) sub;
  1250. SELECT LENGTH(CONCAT(t2,'-',t2)) c2 FROM (SELECT ST_BUFFER(POINT(x,y), 0) t2 FROM t1) sub;
  1251. SELECT LENGTH(CONCAT(t2,'--',t2)) c2 FROM (SELECT ST_BUFFER(POINT(x,y), 0) t2 FROM t1) sub;
  1252. DROP TABLE t1;
  1253. SET optimizer_switch=@save_optimizer_switch;
  1254. --echo #
  1255. --echo # MDEV-16995: ER_CANT_CREATE_GEOMETRY_OBJECT encountered for a query with
  1256. --echo # optimizer_use_condition_selectivity>=3
  1257. --echo #
  1258. CREATE TABLE t1 (a POINT);
  1259. INSERT INTO t1 VALUES (POINT(1,1)),(POINT(1,2)),(POINT(1,3));
  1260. set @save_use_stat_tables= @@use_stat_tables;
  1261. set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
  1262. set @@use_stat_tables= PREFERABLY;
  1263. set @@optimizer_use_condition_selectivity=3;
  1264. SELECT COUNT(*) FROM t1 WHERE a IN ('test','test1');
  1265. set @@use_stat_tables= @save_use_stat_tables;
  1266. set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
  1267. drop table t1;
  1268. --echo #
  1269. --echo # End 10.0 tests
  1270. --echo #
  1271. SHOW CREATE TABLE information_schema.geometry_columns;
  1272. SHOW CREATE TABLE information_schema.spatial_ref_sys;
  1273. create table t1(g GEOMETRY, pt POINT);
  1274. create table t2(g LINESTRING, pl POLYGON);
  1275. --sorted_result
  1276. select * from information_schema.geometry_columns where f_table_schema='test';
  1277. drop table t1, t2;
  1278. --echo 10.1 tests
  1279. create table t1(g GEOMETRY(9,4) REF_SYSTEM_ID=101, pt POINT(8,2), pg GEOMETRY REF_SYSTEM_ID=102);
  1280. SELECT SRID from information_schema.geometry_columns WHERE f_table_schema='test' and G_TABLE_NAME='t1';
  1281. drop table t1;
  1282. -- echo # Expect an int(1) column to be created
  1283. CREATE TABLE t1 AS SELECT CONTAINS(NULL, NULL);
  1284. SHOW CREATE TABLE t1;
  1285. DROP TABLE t1;
  1286. --echo #
  1287. --echo # MDEV-7334 valgrind warning "unitialized bytes" in 10.1.
  1288. --echo #
  1289. CREATE TABLE t1 (
  1290. gp point,
  1291. ln linestring,
  1292. pg polygon,
  1293. mp multipoint,
  1294. mln multilinestring,
  1295. mpg multipolygon,
  1296. gc geometrycollection,
  1297. gm geometry
  1298. );
  1299. ALTER TABLE t1 ADD fid INT NOT NULL;
  1300. select SRID from information_schema.geometry_columns where F_TABLE_NAME='t1';
  1301. drop table t1;
  1302. --echo #
  1303. --echo # MDEV-7510 GIS: IsRing returns false for a primitive triangle.
  1304. --echo #
  1305. select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,0 0)'));
  1306. select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,-10 -10, 0 -10, 0 0)')) as exp;
  1307. --echo #
  1308. --echo # MDEV-7514 GIS: PointOnSurface returns NULL instead of the point.
  1309. --echo #
  1310. 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))'))) as exp;
  1311. --echo #
  1312. --echo # MDEV-7529 GIS: ST_Relate returns unexpected results for POINT relations
  1313. --echo #
  1314. select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'T*F**FFF*') AS equals;
  1315. select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'T*****FF*') AS contains;
  1316. select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'T*F**F***') AS within;
  1317. select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(1 1)'),'FF*FF****') as disjoint;
  1318. select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'FF*FF****') as disjoint;
  1319. --echo #
  1320. --echo # MDEV-7528 GIS: Functions return NULL instead of specified -1 for NULL arguments.
  1321. --echo #
  1322. select ST_IsRing(NULL);
  1323. --echo #
  1324. --echo # MDEV-8675 Different results of GIS functions on NULL vs NOT NULL columns
  1325. --echo #
  1326. CREATE TABLE t1 (g1 GEOMETRY NOT NULL,g2 GEOMETRY NULL);
  1327. CREATE TABLE t2 AS SELECT WITHIN(g1,g1) as w1,WITHIN(g2,g2) AS w2 FROM t1;
  1328. SHOW CREATE TABLE t2;
  1329. DROP TABLE t1,t2;
  1330. #
  1331. # MDEV-3934 Assertion `((keypart_map+1) & keypart_map) == 0' failed in _mi_pack_key with an index on a POINT column
  1332. #
  1333. CREATE TABLE t1 (
  1334. id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  1335. point_data POINT NOT NULL,
  1336. PRIMARY KEY (id),
  1337. KEY idx_point_data(point_data)
  1338. ) ENGINE=MyISAM;
  1339. INSERT t1 (point_data) VALUES
  1340. (GeomFromText('Point(37.0248492 23.8512726)')),
  1341. (GeomFromText('Point(38.0248492 23.8512726)'));
  1342. SELECT id FROM t1
  1343. WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)'));
  1344. DROP TABLE t1;
  1345. --echo #
  1346. --echo # Start of 10.2 tests
  1347. --echo #
  1348. #
  1349. # Item_func_spatial_collection::print()
  1350. #
  1351. create view v1 as select AsWKT(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9))));
  1352. show create view v1;
  1353. select * from v1;
  1354. drop view v1;
  1355. --echo #
  1356. --echo # MDEV-10134 Add full support for DEFAULT
  1357. --echo #
  1358. CREATE TABLE t1 (a POINT, x DOUBLE DEFAULT x(a), y DOUBLE DEFAULT y(a));
  1359. SHOW CREATE TABLE t1;
  1360. INSERT INTO t1 (a) VALUES (Point(1,2));
  1361. SELECT x,y FROM t1;
  1362. DROP TABLE t1;
  1363. CREATE TABLE t1 (g GEOMETRY, area DOUBLE DEFAULT ST_AREA(g));
  1364. SHOW CREATE TABLE t1;
  1365. INSERT INTO t1 (g) VALUES (GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))'));
  1366. SELECT area FROM t1;
  1367. DROP TABLE t1;
  1368. CREATE TABLE t1 (g GEOMETRY, length DOUBLE DEFAULT ST_LENGTH(g));
  1369. SHOW CREATE TABLE t1;
  1370. INSERT INTO t1 (g) VALUES (GeomFromText('LINESTRING(0 0,20 0,20 20,0 20,0 0)'));
  1371. SELECT length FROM t1;
  1372. DROP TABLE t1;
  1373. CREATE TABLE t1 (g POINT, distance DOUBLE DEFAULT ST_DISTANCE(g, POINT(0,0)));
  1374. SHOW CREATE TABLE t1;
  1375. INSERT INTO t1 (g) VALUES (Point(1,0));
  1376. SELECT distance FROM t1;
  1377. DROP TABLE t1;
  1378. CREATE TABLE t1 (a TEXT, g GEOMETRY DEFAULT GeomFromText(a));
  1379. SHOW CREATE TABLE t1;
  1380. INSERT INTO t1 (a) VALUES ('point(1 1)');
  1381. SELECT AsText(g) FROM t1;
  1382. DROP TABLE t1;
  1383. CREATE TABLE t1 (x INT, y INT, g GEOMETRY DEFAULT POINT(x,y));
  1384. SHOW CREATE TABLE t1;
  1385. INSERT INTO t1 (x,y) VALUES (10,20);
  1386. SELECT AsText(g) FROM t1;
  1387. DROP TABLE t1;
  1388. CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT PointN(a,2));
  1389. SHOW CREATE TABLE t1;
  1390. INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,2 2,3 3)'));
  1391. SELECT AsText(b) FROM t1;
  1392. DROP TABLE t1;
  1393. CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT StartPoint(a));
  1394. SHOW CREATE TABLE t1;
  1395. INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,2 2,3 3)'));
  1396. SELECT AsText(b) FROM t1;
  1397. DROP TABLE t1;
  1398. CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c GEOMETRY DEFAULT GeometryCollection(a,b));
  1399. SHOW CREATE TABLE t1;
  1400. INSERT INTO t1 (a,b) VALUES (Point(1,1), Point(2,2));
  1401. SELECT AsText(c) FROM t1;
  1402. DROP TABLE t1;
  1403. CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT GeomFromWKB(AsBinary(a),20));
  1404. SHOW CREATE TABLE t1;
  1405. INSERT INTO t1 (a) VALUES (GeomFromText('POINT(1 1)', 10));
  1406. SELECT AsText(a), SRID(a), AsText(b), SRID(b) FROM t1;
  1407. DROP TABLE t1;
  1408. CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT BOUNDARY(a));
  1409. SHOW CREATE TABLE t1;
  1410. INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))'));
  1411. SELECT AsText(b) FROM t1;
  1412. DROP TABLE t1;
  1413. CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT BUFFER(a,10));
  1414. SHOW CREATE TABLE t1;
  1415. INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))'));
  1416. SELECT GeometryType(b) FROM t1;
  1417. DROP TABLE t1;
  1418. CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT CENTROID(a));
  1419. SHOW CREATE TABLE t1;
  1420. INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))'));
  1421. SELECT AsText(b) FROM t1;
  1422. DROP TABLE t1;
  1423. CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT ENVELOPE(a));
  1424. SHOW CREATE TABLE t1;
  1425. INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,4 4)'));
  1426. SELECT AsText(b) FROM t1;
  1427. DROP TABLE t1;
  1428. CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT PointOnSurface(a));
  1429. SHOW CREATE TABLE t1;
  1430. INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))'));
  1431. SELECT GeometryType(b) FROM t1;
  1432. DROP TABLE t1;
  1433. CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT Point(1,1), c GEOMETRY DEFAULT ST_UNION(a,b));
  1434. SHOW CREATE TABLE t1;
  1435. INSERT INTO t1 (a) VALUES (Point(0,0));
  1436. SELECT AsText(c) FROM t1;
  1437. DROP TABLE t1;
  1438. CREATE TABLE t1 (a GEOMETRY, b VARCHAR(20) DEFAULT GeometryType(a));
  1439. SHOW CREATE TABLE t1;
  1440. INSERT INTO t1 (a) VALUES (Point(0, 0));
  1441. SELECT b FROM t1;
  1442. DROP TABLE t1;
  1443. CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsSimple(a));
  1444. SHOW CREATE TABLE t1;
  1445. INSERT INTO t1 (a) VALUES (Point(0, 0));
  1446. SELECT b FROM t1;
  1447. DROP TABLE t1;
  1448. CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsEmpty(a));
  1449. SHOW CREATE TABLE t1;
  1450. INSERT INTO t1 (a) VALUES (Point(0, 0));
  1451. SELECT b FROM t1;
  1452. DROP TABLE t1;
  1453. CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsRing(a));
  1454. SHOW CREATE TABLE t1;
  1455. INSERT INTO t1 (a) VALUES (GeomFromText('LineString(0 0,0 1,1 1,1 0,0 0)'));
  1456. SELECT b FROM t1;
  1457. DROP TABLE t1;
  1458. CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsClosed(a));
  1459. SHOW CREATE TABLE t1;
  1460. INSERT INTO t1 (a) VALUES (GeomFromText('LineString(0 0,0 1,1 1,1 0,0 0)'));
  1461. SELECT b FROM t1;
  1462. DROP TABLE t1;
  1463. CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT Dimension(a));
  1464. SHOW CREATE TABLE t1;
  1465. INSERT INTO t1 (a) VALUES (Buffer(Point(1,1),1));
  1466. SELECT b FROM t1;
  1467. DROP TABLE t1;
  1468. CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT NumGeometries(a));
  1469. SHOW CREATE TABLE t1;
  1470. INSERT INTO t1 (a) VALUES (ST_UNION(Point(1,1),Point(0,0)));
  1471. SELECT b FROM t1;
  1472. DROP TABLE t1;
  1473. CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT NumInteriorRings(a));
  1474. SHOW CREATE TABLE t1;
  1475. 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))'));
  1476. SELECT b FROM t1;
  1477. DROP TABLE t1;
  1478. CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT NumPoints(a));
  1479. SHOW CREATE TABLE t1;
  1480. INSERT INTO t1 (a) VALUES (LineString(Point(1,1),Point(0,0)));
  1481. SELECT b FROM t1;
  1482. DROP TABLE t1;
  1483. CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT SRID(a));
  1484. SHOW CREATE TABLE t1;
  1485. INSERT INTO t1 (a) VALUES (GeomFromText('Point(1 1)', 100));
  1486. SELECT b FROM t1;
  1487. DROP TABLE t1;
  1488. CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c INT DEFAULT MBRDisjoint(a,b));
  1489. SHOW CREATE TABLE t1;
  1490. INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1));
  1491. SELECT c FROM t1;
  1492. DROP TABLE t1;
  1493. CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c INT DEFAULT ST_Disjoint(a,b));
  1494. SHOW CREATE TABLE t1;
  1495. INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1));
  1496. SELECT c FROM t1;
  1497. DROP TABLE t1;
  1498. CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c INT DEFAULT ST_Relate(a,b,'T*F**FFF*'));
  1499. SHOW CREATE TABLE t1;
  1500. INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1));
  1501. SELECT c FROM t1;
  1502. DROP TABLE t1;
  1503. #
  1504. # MDEV-13923 Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed upon altering table with geometry field
  1505. #
  1506. --error ER_CANT_CREATE_GEOMETRY_OBJECT
  1507. create table t1 (p point default "qwer");
  1508. --error ER_CANT_CREATE_GEOMETRY_OBJECT
  1509. create table t1 (p point default 0);
  1510. --error ER_INVALID_DEFAULT
  1511. create table t1 (p point not null default st_geometryfromtext('point 0)'));
  1512. create table t1 (p point not null default st_geometryfromtext('point(0 0)'));
  1513. insert into t1 values(default);
  1514. select st_astext(p) from t1;
  1515. drop table t1;
  1516. --echo #
  1517. --echo # MDEV-21056 Memory leak after query with DEFAULT on a geometry field
  1518. --echo #
  1519. CREATE TABLE t1 (f POINT DEFAULT ST_GEOMFROMTEXT('Point(0 0)'));
  1520. SELECT ST_GEOMFROMTEXT('Point(1 1)') IN ( DEFAULT( `f` ), ST_GEOMFROMTEXT('Point(2 2)') ) AS x FROM t1;
  1521. DROP TABLE t1;
  1522. --echo #
  1523. --echo # End of 10.2 tests
  1524. --echo #
  1525. --echo #
  1526. --echo # MDEV-11478 Result data type aggregation for pluggable data types
  1527. --echo #
  1528. DELIMITER $$;
  1529. CREATE PROCEDURE p2(query TEXT)
  1530. BEGIN
  1531. DECLARE errcount INT DEFAULT 0;
  1532. DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
  1533. BEGIN
  1534. SET errcount = errcount+1;
  1535. #SHOW WARNINGS;
  1536. GET DIAGNOSTICS CONDITION 1 @p= MESSAGE_TEXT;
  1537. SELECT @p AS `ERROR: `;
  1538. END;
  1539. SELECT query AS ``;
  1540. EXECUTE IMMEDIATE query;
  1541. IF errcount = 0
  1542. THEN
  1543. SHOW CREATE TABLE t2;
  1544. DROP TABLE t2;
  1545. END IF;
  1546. END;
  1547. $$
  1548. CREATE PROCEDURE p1(query TEXT)
  1549. BEGIN
  1550. SELECT query AS `-------------------------------------`;
  1551. EXECUTE IMMEDIATE query;
  1552. CALL p2('CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1');
  1553. CALL p2('CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1');
  1554. CALL p2('CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1');
  1555. CALL p2('CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1');
  1556. CALL p2('CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1');
  1557. DROP TABLE t1;
  1558. END;
  1559. $$
  1560. DELIMITER ;$$
  1561. --disable_query_log
  1562. CALL p1('CREATE TABLE t1 (a CHAR(10), b Point)');
  1563. CALL p1('CREATE TABLE t1 (a VARCHAR(10), b Point)');
  1564. CALL p1('CREATE TABLE t1 (a TINYTEXT, b Point)');
  1565. CALL p1('CREATE TABLE t1 (a TEXT, b Point)');
  1566. CALL p1('CREATE TABLE t1 (a MEDIUMTEXT, b Point)');
  1567. CALL p1('CREATE TABLE t1 (a LONGTEXT, b Point)');
  1568. CALL p1('CREATE TABLE t1 (a TINYINT, b Point)');
  1569. CALL p1('CREATE TABLE t1 (a SMALLINT, b Point)');
  1570. CALL p1('CREATE TABLE t1 (a MEDIUMINT, b Point)');
  1571. CALL p1('CREATE TABLE t1 (a INT, b Point)');
  1572. CALL p1('CREATE TABLE t1 (a BIGINT, b Point)');
  1573. CALL p1('CREATE TABLE t1 (a FLOAT, b Point)');
  1574. CALL p1('CREATE TABLE t1 (a DOUBLE, b Point)');
  1575. CALL p1('CREATE TABLE t1 (a DECIMAL(10,2), b Point)');
  1576. CALL p1('CREATE TABLE t1 (a BIT(8), b Point)');
  1577. CALL p1('CREATE TABLE t1 (a TIME, b Point)');
  1578. CALL p1('CREATE TABLE t1 (a DATE, b Point)');
  1579. CALL p1('CREATE TABLE t1 (a DATETIME, b Point)');
  1580. CALL p1('CREATE TABLE t1 (a TIMESTAMP, b Point)');
  1581. CALL p1('CREATE TABLE t1 (a YEAR, b Point)');
  1582. --echo # This creates BLOB with hybrid functions, but fails on error with UNION (MDEV-11458)
  1583. CALL p1('CREATE TABLE t1 (a ENUM(0x61), b Point)');
  1584. CALL p1('CREATE TABLE t1 (a SET(0x61), b Point)');
  1585. --enable_query_log
  1586. CREATE TABLE t1 AS SELECT COALESCE(NULL, Point(1,1));
  1587. SHOW CREATE TABLE t1;
  1588. DROP TABLE t1;
  1589. CREATE TABLE t1 AS SELECT NULL UNION SELECT Point(1,1);
  1590. SHOW CREATE TABLE t1;
  1591. DROP TABLE t1;
  1592. DROP PROCEDURE p1;
  1593. DROP PROCEDURE p2;
  1594. --echo #
  1595. --echo # MDEV-11692 Comparison data type aggregation for pluggable data types
  1596. --echo #
  1597. DELIMITER $$;
  1598. CREATE PROCEDURE p2(query TEXT)
  1599. BEGIN
  1600. DECLARE errcount INT DEFAULT 0;
  1601. DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
  1602. BEGIN
  1603. SET errcount = errcount+1;
  1604. GET DIAGNOSTICS CONDITION 1 @p= MESSAGE_TEXT;
  1605. SELECT @p AS `ERROR: `;
  1606. END;
  1607. SELECT query AS ``;
  1608. EXECUTE IMMEDIATE query;
  1609. END;
  1610. $$
  1611. CREATE PROCEDURE p1(query TEXT)
  1612. BEGIN
  1613. SELECT query AS `-------------------------------------`;
  1614. EXECUTE IMMEDIATE query;
  1615. CALL p2('SELECT a=b FROM t1');
  1616. CALL p2('SELECT b=a FROM t1');
  1617. CALL p2('SELECT a BETWEEN b AND c FROM t1');
  1618. CALL p2('SELECT a IN (b,c) FROM t1');
  1619. CALL p2('SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1');
  1620. CALL p2('SELECT a=POINT(1,1) FROM t1');
  1621. CALL p2('SELECT POINT(1,1)=a FROM t1');
  1622. CALL p2('SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1');
  1623. CALL p2('SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1');
  1624. CALL p2('SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1');
  1625. DROP TABLE t1;
  1626. END;
  1627. $$
  1628. DELIMITER ;$$
  1629. CALL p1('CREATE TABLE t1 (a CHAR(10), b Point, c Point)');
  1630. CALL p1('CREATE TABLE t1 (a VARCHAR(10), b Point, c Point)');
  1631. CALL p1('CREATE TABLE t1 (a TINYTEXT, b Point, c Point)');
  1632. CALL p1('CREATE TABLE t1 (a TEXT, b Point, c Point)');
  1633. CALL p1('CREATE TABLE t1 (a MEDIUMTEXT, b Point, c Point)');
  1634. CALL p1('CREATE TABLE t1 (a LONGTEXT, b Point, c Point)');
  1635. CALL p1('CREATE TABLE t1 (a ENUM("a","b"), b Point, c Point)');
  1636. CALL p1('CREATE TABLE t1 (a TINYINT, b Point, c Point)');
  1637. CALL p1('CREATE TABLE t1 (a SMALLINT, b Point, c Point)');
  1638. CALL p1('CREATE TABLE t1 (a MEDIUMINT, b Point, c Point)');
  1639. CALL p1('CREATE TABLE t1 (a INT, b Point, c Point)');
  1640. CALL p1('CREATE TABLE t1 (a BIGINT, b Point, c Point)');
  1641. CALL p1('CREATE TABLE t1 (a FLOAT, b Point, c Point)');
  1642. CALL p1('CREATE TABLE t1 (a DOUBLE, b Point, c Point)');
  1643. CALL p1('CREATE TABLE t1 (a DECIMAL(10,2), b Point, c Point)');
  1644. CALL p1('CREATE TABLE t1 (a BIT(8), b Point, c Point)');
  1645. CALL p1('CREATE TABLE t1 (a TIME, b Point, c Point)');
  1646. CALL p1('CREATE TABLE t1 (a DATE, b Point, c Point)');
  1647. CALL p1('CREATE TABLE t1 (a DATETIME, b Point, c Point)');
  1648. CALL p1('CREATE TABLE t1 (a TIMESTAMP, b Point, c Point)');
  1649. CALL p1('CREATE TABLE t1 (a YEAR, b Point, c Point)');
  1650. CALL p1('CREATE TABLE t1 (a Point, b Point, c Point)');
  1651. DROP PROCEDURE p1;
  1652. DROP PROCEDURE p2;
  1653. --echo #
  1654. --echo # MDEV-12506 Split Item_func_min_max::fix_length_and_dec() into methods in Type_handler
  1655. --echo #
  1656. DELIMITER $$;
  1657. CREATE PROCEDURE p2(query TEXT)
  1658. BEGIN
  1659. DECLARE errcount INT DEFAULT 0;
  1660. DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
  1661. BEGIN
  1662. SET errcount = errcount+1;
  1663. #SHOW WARNINGS;
  1664. GET DIAGNOSTICS CONDITION 1 @p= MESSAGE_TEXT;
  1665. SELECT @p AS `ERROR: `;
  1666. END;
  1667. SELECT query AS ``;
  1668. EXECUTE IMMEDIATE query;
  1669. IF errcount = 0
  1670. THEN
  1671. SHOW CREATE TABLE t2;
  1672. DROP TABLE t2;
  1673. END IF;
  1674. END;
  1675. $$
  1676. CREATE PROCEDURE p1(query TEXT)
  1677. BEGIN
  1678. SELECT query AS `-------------------------------------`;
  1679. EXECUTE IMMEDIATE query;
  1680. CALL p2('CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1');
  1681. DROP TABLE t1;
  1682. END;
  1683. $$
  1684. DELIMITER ;$$
  1685. --disable_query_log
  1686. CALL p1('CREATE TABLE t1 (a CHAR(10), b Point)');
  1687. CALL p1('CREATE TABLE t1 (a VARCHAR(10), b Point)');
  1688. CALL p1('CREATE TABLE t1 (a TINYTEXT, b Point)');
  1689. CALL p1('CREATE TABLE t1 (a TEXT, b Point)');
  1690. CALL p1('CREATE TABLE t1 (a MEDIUMTEXT, b Point)');
  1691. CALL p1('CREATE TABLE t1 (a LONGTEXT, b Point)');
  1692. CALL p1('CREATE TABLE t1 (a TINYINT, b Point)');
  1693. CALL p1('CREATE TABLE t1 (a SMALLINT, b Point)');
  1694. CALL p1('CREATE TABLE t1 (a MEDIUMINT, b Point)');
  1695. CALL p1('CREATE TABLE t1 (a INT, b Point)');
  1696. CALL p1('CREATE TABLE t1 (a BIGINT, b Point)');
  1697. CALL p1('CREATE TABLE t1 (a FLOAT, b Point)');
  1698. CALL p1('CREATE TABLE t1 (a DOUBLE, b Point)');
  1699. CALL p1('CREATE TABLE t1 (a DECIMAL(10,2), b Point)');
  1700. CALL p1('CREATE TABLE t1 (a BIT(8), b Point)');
  1701. CALL p1('CREATE TABLE t1 (a TIME, b Point)');
  1702. CALL p1('CREATE TABLE t1 (a DATE, b Point)');
  1703. CALL p1('CREATE TABLE t1 (a DATETIME, b Point)');
  1704. CALL p1('CREATE TABLE t1 (a TIMESTAMP, b Point)');
  1705. CALL p1('CREATE TABLE t1 (a YEAR, b Point)');
  1706. --echo # This LEAST(ENUM,GEOMETRY) creates BLOB, but fails on error with UNION (see MDEV-12503)
  1707. CALL p1('CREATE TABLE t1 (a ENUM(0x61), b Point)');
  1708. CALL p1('CREATE TABLE t1 (a SET(0x61), b Point)');
  1709. --enable_query_log
  1710. CREATE TABLE t1 AS SELECT LEAST(NULL, Point(1,1));
  1711. SHOW CREATE TABLE t1;
  1712. DROP TABLE t1;
  1713. DROP PROCEDURE p1;
  1714. DROP PROCEDURE p2;
  1715. --echo #
  1716. --echo # MDEV-12001 Split Item_func_round::fix_length_and_dec to virtual methods in Type_handler
  1717. --echo #
  1718. CREATE TABLE t1 (a GEOMETRY);
  1719. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1720. SELECT ROUND(a) FROM t1;
  1721. DROP TABLE t1;
  1722. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1723. SELECT ROUND(POINT(1,1));
  1724. --echo #
  1725. --echo # MDEV-12199 Split Item_func_{abs|neg|int_val}::fix_length_and_dec() into methods in Type_handler
  1726. --echo #
  1727. CREATE TABLE t1 (a GEOMETRY);
  1728. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1729. SELECT -a FROM t1;
  1730. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1731. SELECT ABS(a) FROM t1;
  1732. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1733. SELECT CEILING(a) FROM t1;
  1734. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1735. SELECT FLOOR(a) FROM t1;
  1736. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1737. SELECT -COALESCE(a) FROM t1;
  1738. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1739. SELECT ABS(COALESCE(a)) FROM t1;
  1740. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1741. SELECT CEILING(COALESCE(a)) FROM t1;
  1742. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1743. SELECT FLOOR(COALESCE(a)) FROM t1;
  1744. DROP TABLE t1;
  1745. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1746. SELECT -POINT(1,1);
  1747. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1748. SELECT ABS(POINT(1,1));
  1749. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1750. SELECT CEILING(POINT(1,1));
  1751. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1752. SELECT FLOOR(POINT(1,1));
  1753. --echo #
  1754. --echo # MDEV-12239 Add Type_handler::Item_sum_{sum|avg|variance}_fix_length_and_dec()
  1755. --echo #
  1756. CREATE TABLE t1 (a GEOMETRY);
  1757. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1758. SELECT SUM(POINT(1,1)) FROM t1;
  1759. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1760. SELECT SUM(a) FROM t1;
  1761. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1762. SELECT SUM(COALESCE(a)) FROM t1;
  1763. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1764. SELECT AVG(POINT(1,1)) FROM t1;
  1765. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1766. SELECT AVG(a) FROM t1;
  1767. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1768. SELECT AVG(COALESCE(a)) FROM t1;
  1769. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1770. SELECT VARIANCE(POINT(1,1)) FROM t1;
  1771. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1772. SELECT VARIANCE(a) FROM t1;
  1773. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1774. SELECT VARIANCE(COALESCE(a)) FROM t1;
  1775. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1776. SELECT STDDEV(POINT(1,1)) FROM t1;
  1777. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1778. SELECT STDDEV(a) FROM t1;
  1779. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1780. SELECT STDDEV(COALESCE(a)) FROM t1;
  1781. DROP TABLE t1;
  1782. --echo #
  1783. --echo # MDEV-12303 Add Type_handler::Item_xxx_fix_length_and_dec() for CAST classes
  1784. --echo #
  1785. CREATE TABLE t1 (a GEOMETRY);
  1786. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1787. SELECT CAST(POINT(1,1) AS SIGNED) FROM t1;
  1788. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1789. SELECT CAST(POINT(1,1) AS UNSIGNED) FROM t1;
  1790. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1791. SELECT CAST(POINT(1,1) AS FLOAT) FROM t1;
  1792. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1793. SELECT CAST(POINT(1,1) AS DOUBLE) FROM t1;
  1794. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1795. SELECT CAST(POINT(1,1) AS DECIMAL(10,1)) FROM t1;
  1796. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1797. SELECT CAST(POINT(1,1) AS CHAR) FROM t1;
  1798. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1799. SELECT CAST(POINT(1,1) AS TIME) FROM t1;
  1800. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1801. SELECT CAST(POINT(1,1) AS DATE) FROM t1;
  1802. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1803. SELECT CAST(POINT(1,1) AS DATETIME) FROM t1;
  1804. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1805. SELECT CAST(a AS SIGNED) FROM t1;
  1806. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1807. SELECT CAST(a AS UNSIGNED) FROM t1;
  1808. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1809. SELECT CAST(a AS FLOAT) FROM t1;
  1810. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1811. SELECT CAST(a AS DOUBLE) FROM t1;
  1812. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1813. SELECT CAST(a AS DECIMAL(10,1)) FROM t1;
  1814. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1815. SELECT CAST(a AS CHAR) FROM t1;
  1816. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1817. SELECT CAST(a AS TIME) FROM t1;
  1818. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1819. SELECT CAST(a AS DATE) FROM t1;
  1820. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1821. SELECT CAST(a AS DATETIME) FROM t1;
  1822. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1823. SELECT CAST(COALESCE(a) AS SIGNED) FROM t1;
  1824. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1825. SELECT CAST(COALESCE(a) AS UNSIGNED) FROM t1;
  1826. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1827. SELECT CAST(COALESCE(a) AS FLOAT) FROM t1;
  1828. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1829. SELECT CAST(COALESCE(a) AS DOUBLE) FROM t1;
  1830. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1831. SELECT CAST(COALESCE(a) AS DECIMAL(10,1)) FROM t1;
  1832. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1833. SELECT CAST(COALESCE(a) AS CHAR) FROM t1;
  1834. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1835. SELECT CAST(COALESCE(a) AS TIME) FROM t1;
  1836. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1837. SELECT CAST(COALESCE(a) AS DATE) FROM t1;
  1838. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  1839. SELECT CAST(COALESCE(a) AS DATETIME) FROM t1;
  1840. # CAST from GEOMETRY to BINARY is OK
  1841. SELECT LENGTH(CAST(POINT(1,1) AS BINARY)) FROM t1;
  1842. SELECT LENGTH(CAST(a AS BINARY)) FROM t1;
  1843. SELECT LENGTH(CAST(COALESCE(a) AS BINARY)) FROM t1;
  1844. DROP TABLE t1;
  1845. --echo #
  1846. --echo # MDEV-12238 Add Type_handler::Item_func_{plus|minus|mul|div|mod}_fix_length_and_dec()
  1847. --echo #
  1848. CREATE TABLE t1 (a GEOMETRY);
  1849. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1850. SELECT POINT(1,1) + 1;
  1851. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1852. SELECT POINT(1,1) - 1;
  1853. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1854. SELECT POINT(1,1) * 1;
  1855. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1856. SELECT POINT(1,1) / 1;
  1857. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1858. SELECT POINT(1,1) MOD 1;
  1859. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1860. SELECT 1 + POINT(1,1);
  1861. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1862. SELECT 1 - POINT(1,1);
  1863. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1864. SELECT 1 * POINT(1,1);
  1865. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1866. SELECT 1 / POINT(1,1);
  1867. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1868. SELECT 1 MOD POINT(1,1);
  1869. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1870. SELECT a + 1 FROM t1;
  1871. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1872. SELECT a - 1 FROM t1;
  1873. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1874. SELECT a * 1 FROM t1;
  1875. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1876. SELECT a / 1 FROM t1;
  1877. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1878. SELECT a MOD 1 FROM t1;
  1879. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1880. SELECT 1 + a FROM t1;
  1881. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1882. SELECT 1 - a FROM t1;
  1883. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1884. SELECT 1 * a FROM t1;
  1885. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1886. SELECT 1 / a FROM t1;
  1887. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1888. SELECT 1 MOD a FROM t1;
  1889. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1890. SELECT COALESCE(a) + 1 FROM t1;
  1891. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1892. SELECT COALESCE(a) - 1 FROM t1;
  1893. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1894. SELECT COALESCE(a) * 1 FROM t1;
  1895. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1896. SELECT COALESCE(a) / 1 FROM t1;
  1897. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1898. SELECT COALESCE(a) MOD 1 FROM t1;
  1899. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1900. SELECT 1 + COALESCE(a) FROM t1;
  1901. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1902. SELECT 1 - COALESCE(a) FROM t1;
  1903. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1904. SELECT 1 * COALESCE(a) FROM t1;
  1905. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1906. SELECT 1 / COALESCE(a) FROM t1;
  1907. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1908. SELECT 1 MOD COALESCE(a) FROM t1;
  1909. DROP TABLE t1;
  1910. --echo #
  1911. --echo # MDEV-12514 Split Item_temporal_func::fix_length_and_dec()
  1912. --echo #
  1913. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1914. SELECT DATE_ADD(POINT(1,1), INTERVAL 10 DAY);
  1915. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1916. SELECT DATE_SUB(POINT(1,1), INTERVAL 10 DAY);
  1917. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1918. SELECT POINT(1,1) + INTERVAL 10 DAY;
  1919. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1920. SELECT POINT(1,1) - INTERVAL 10 DAY;
  1921. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1922. SELECT INTERVAL 10 DAY + POINT(1,1);
  1923. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1924. SELECT INTERVAL 10 DAY + POINT(1,1);
  1925. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1926. SELECT ADDTIME(POINT(1,1), '10:10:10');
  1927. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1928. SELECT ADDTIME('10:10:10', POINT(1,1));
  1929. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1930. SELECT ADDTIME(POINT(1,1), TIME'10:10:10');
  1931. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1932. SELECT ADDTIME(TIME'10:10:10', POINT(1,1));
  1933. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1934. SELECT ADDTIME(POINT(1,1), TIMESTAMP'2001-01-01 10:10:10');
  1935. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1936. SELECT ADDTIME(TIMESTAMP'2001-01-01 10:10:10', POINT(1,1));
  1937. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1938. SELECT STR_TO_DATE(POINT(1,1),'%M %d,%Y');
  1939. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  1940. SELECT STR_TO_DATE('2001-01-01', POINT(1,1));
  1941. --echo #
  1942. --echo # MDEV-12665 Hybrid functions do not preserve geometry type
  1943. --echo #
  1944. CREATE TABLE t1 AS SELECT
  1945. Point(0,0) AS p0,
  1946. COALESCE(Point(0,0)) AS p1,
  1947. CASE WHEN 0 THEN Point(0,0) ELSE Point(1,1) END AS p2;
  1948. SHOW CREATE TABLE t1;
  1949. DROP TABLE t1;
  1950. CREATE TABLE t1 AS SELECT LEAST(Point(0,0),Point(0,0)) AS p1;
  1951. SHOW CREATE TABLE t1;
  1952. DROP TABLE t1;
  1953. CREATE TABLE t1 (
  1954. c_geometry GEOMETRY,
  1955. c_point POINT,
  1956. c_linestring LINESTRING,
  1957. c_polygon POLYGON,
  1958. c_multipoint MULTIPOINT,
  1959. c_multilinestring MULTILINESTRING,
  1960. c_multipolygon MULTIPOLYGON,
  1961. c_geometrycollection GEOMETRYCOLLECTION
  1962. );
  1963. CREATE TABLE t2 AS SELECT
  1964. COALESCE(NULL, c_geometry),
  1965. COALESCE(NULL, c_point),
  1966. COALESCE(NULL, c_linestring),
  1967. COALESCE(NULL, c_polygon),
  1968. COALESCE(NULL, c_multipoint),
  1969. COALESCE(NULL, c_multilinestring),
  1970. COALESCE(NULL, c_multipolygon),
  1971. COALESCE(NULL, c_geometrycollection)
  1972. FROM t1;
  1973. SHOW CREATE TABLE t2;
  1974. DROP TABLE t2;
  1975. CREATE TABLE t2 AS SELECT
  1976. COALESCE(c_geometry, NULL),
  1977. COALESCE(c_point, NULL),
  1978. COALESCE(c_linestring, NULL),
  1979. COALESCE(c_polygon, NULL),
  1980. COALESCE(c_multipoint, NULL),
  1981. COALESCE(c_multilinestring, NULL),
  1982. COALESCE(c_multipolygon, NULL),
  1983. COALESCE(c_geometrycollection, NULL)
  1984. FROM t1;
  1985. SHOW CREATE TABLE t2;
  1986. DROP TABLE t2;
  1987. CREATE TABLE t2 AS SELECT
  1988. COALESCE(c_geometry, c_geometry),
  1989. COALESCE(c_point, c_point),
  1990. COALESCE(c_linestring, c_linestring),
  1991. COALESCE(c_polygon, c_polygon),
  1992. COALESCE(c_multipoint, c_multipoint),
  1993. COALESCE(c_multilinestring, c_multilinestring),
  1994. COALESCE(c_multipolygon, c_multipolygon),
  1995. COALESCE(c_geometrycollection, c_geometrycollection)
  1996. FROM t1;
  1997. SHOW CREATE TABLE t2;
  1998. DROP TABLE t2;
  1999. DROP TABLE t1;
  2000. --echo #
  2001. --echo # MDEV-12560 Wrong data type for SELECT NULL UNION SELECT Point(1,1)
  2002. --echo #
  2003. CREATE TABLE t1 AS SELECT NULL AS c1 UNION SELECT POINT(1,1);
  2004. SHOW CREATE TABLE t1;
  2005. DROP TABLE t1;
  2006. DELIMITER $$;
  2007. CREATE PROCEDURE p1(name TEXT)
  2008. BEGIN
  2009. EXECUTE IMMEDIATE CONCAT('CREATE TABLE t1 (a ', name, ')');
  2010. CREATE TABLE t2 AS
  2011. SELECT a AS a1, a AS a2, NULL AS a3 FROM t1 UNION
  2012. SELECT a AS a1, NULL AS a2, a AS a3 FROM t1;
  2013. SHOW CREATE TABLE t2;
  2014. DROP TABLE t2;
  2015. DROP TABLE t1;
  2016. END;
  2017. $$
  2018. DELIMITER ;$$
  2019. CALL p1('geometry');
  2020. CALL p1('point');
  2021. CALL p1('linestring');
  2022. CALL p1('polygon');
  2023. CALL p1('multipoint');
  2024. CALL p1('multilinestring');
  2025. CALL p1('multipolygon');
  2026. CALL p1('geometrycollection');
  2027. DROP PROCEDURE p1;
  2028. --echo #
  2029. --echo # MDEV-12798 Item_param does not preserve exact field type in EXECUTE IMMEDIATE 'CREATE TABLE AS SELECT ?' USING POINT(1,1)
  2030. --echo #
  2031. EXECUTE IMMEDIATE 'CREATE TABLE t1 AS SELECT ?' USING POINT(1,1);
  2032. SHOW CREATE TABLE t1;
  2033. DROP TABLE t1;
  2034. PREPARE stmt FROM 'CREATE OR REPLACE TABLE t1 AS SELECT ?';
  2035. EXECUTE stmt USING POINT(1,1);
  2036. SHOW CREATE TABLE t1;
  2037. DROP TABLE t1;
  2038. --echo #
  2039. --echo # MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
  2040. --echo #
  2041. --enable_metadata
  2042. --disable_ps_protocol
  2043. --disable_view_protocol
  2044. SELECT
  2045. ST_ISSIMPLE(POINT(1,1)),
  2046. ST_ISRING(POINT(1,1)),
  2047. ST_ISCLOSED(POINT(1,1)),
  2048. ST_DIMENSION(POINT(1,1)),
  2049. ST_NUMGEOMETRIES(POINT(1,1)),
  2050. ST_NUMINTERIORRINGS(POINT(1,1)),
  2051. ST_NUMPOINTS(POINT(1,1)),
  2052. ST_SRID(POINT(1,1));
  2053. --enable_view_protocol
  2054. --enable_ps_protocol
  2055. --disable_metadata
  2056. --echo #
  2057. --echo # MDEV-12803 Improve function parameter data type control
  2058. --echo #
  2059. --echo #
  2060. --echo # Item_geometry_func_args_geometry
  2061. --echo #
  2062. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2063. SELECT ST_CENTROID(1);
  2064. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2065. SELECT ST_ENVELOPE(1);
  2066. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2067. SELECT ST_BOUNDARY(1);
  2068. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2069. SELECT ST_STARTPOINT(1);
  2070. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2071. SELECT ST_POINTONSURFACE(1);
  2072. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2073. SELECT ST_POINTN(1,1);
  2074. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2075. SELECT ST_POINTN(LineString(Point(1,1)),Point(1,1));
  2076. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2077. SELECT ST_BUFFER(1, 1);
  2078. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2079. SELECT ST_BUFFER(Point(1,1), Point(1,1));
  2080. PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_ENVELOPE(?) AS g';
  2081. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2082. EXECUTE stmt USING 1;
  2083. EXECUTE stmt USING POINT(1,1);
  2084. SHOW CREATE TABLE t1;
  2085. SELECT ST_ASTEXT(g) FROM t1;
  2086. DROP TABLE t1;
  2087. DEALLOCATE PREPARE stmt;
  2088. PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_BUFFER(?,?) AS g';
  2089. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2090. EXECUTE stmt USING 1,1;
  2091. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2092. EXECUTE stmt USING POINT(1,1),POINT(1,1);
  2093. EXECUTE stmt USING POINT(1,1),0;
  2094. SHOW CREATE TABLE t1;
  2095. SELECT ST_GEOMETRYTYPE(g) FROM t1;
  2096. DROP TABLE t1;
  2097. DEALLOCATE PREPARE stmt;
  2098. --echo #
  2099. --echo # Functions created GEOMETRY from non-GEOMETRY
  2100. --echo #
  2101. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2102. SELECT ST_GEOMETRYFROMTEXT(ROW(1,1));
  2103. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2104. SELECT ST_GEOMETRYFROMTEXT(Point(1,1));
  2105. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2106. SELECT ST_GEOMETRYFROMTEXT(Point(1,1), 1);
  2107. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2108. SELECT ST_GEOMETRYFROMTEXT('test', Point(1,1));
  2109. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2110. SELECT ST_GEOMETRYFROMWKB(ROW(1,1));
  2111. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2112. SELECT ST_GEOMETRYFROMWKB(1);
  2113. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2114. SELECT ST_GEOMETRYFROMWKB(1, 1);
  2115. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2116. SELECT ST_GEOMETRYFROMWKB(Point(1,1), Point(1,1));
  2117. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2118. SELECT ST_GEOMFROMGEOJSON(ROW(1,1));
  2119. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2120. SELECT ST_GEOMFROMGEOJSON(1);
  2121. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2122. SELECT ST_GEOMFROMGEOJSON(1,1);
  2123. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2124. SELECT ST_GEOMFROMGEOJSON(Point(1,1), Point(1,1));
  2125. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2126. SELECT POINT(ROW(1,1),1);
  2127. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2128. SELECT POINT(POINT(1,1),1);
  2129. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2130. SELECT POINT(1,ROW(1,1));
  2131. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2132. SELECT POINT(1,POINT(1,1));
  2133. PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_GEOMFROMTEXT(?,?) AS g';
  2134. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2135. EXECUTE stmt USING 1,1;
  2136. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2137. EXECUTE stmt USING POINT(1,1),POINT(1,1);
  2138. EXECUTE stmt USING 'POINT(1 1)',1;
  2139. SHOW CREATE TABLE t1;
  2140. SELECT ST_ASTEXT(g), SRID(g) FROM t1;
  2141. DROP TABLE t1;
  2142. DEALLOCATE PREPARE stmt;
  2143. --echo # Item_func_spatial_collection
  2144. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2145. SELECT GEOMETRYCOLLECTION(ROW(1,1), POINT(1,1));
  2146. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2147. SELECT GEOMETRYCOLLECTION(POINT(1,1), ROW(1,1));
  2148. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2149. SELECT GEOMETRYCOLLECTION(1, POINT(1,1));
  2150. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2151. SELECT GEOMETRYCOLLECTION(POINT(1,1), 1);
  2152. --echo # Item_func_spatial_operation
  2153. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2154. SELECT ST_UNION(ROW(1,1), POINT(1,1));
  2155. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2156. SELECT ST_UNION(POINT(1,1), ROW(1,1));
  2157. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2158. SELECT ST_UNION(1, POINT(1,1));
  2159. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2160. SELECT ST_UNION(POINT(1,1), 1);
  2161. --echo # Item_binary_func_args_geometry
  2162. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2163. SELECT ST_ASWKB(ROW(1,1));
  2164. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2165. SELECT ST_ASWKB(1);
  2166. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2167. SELECT ST_ASWKB('test');
  2168. --echo # Item_real_func_args_geometry
  2169. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2170. SELECT ST_X(ROW(1,1));
  2171. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2172. SELECT ST_X(1);
  2173. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2174. SELECT ST_X('test');
  2175. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2176. SELECT ST_Y(ROW(1,1));
  2177. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2178. SELECT ST_Y(1);
  2179. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2180. SELECT ST_Y('test');
  2181. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2182. SELECT ST_AREA(ROW(1,1));
  2183. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2184. SELECT ST_AREA(1);
  2185. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2186. SELECT ST_AREA('test');
  2187. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2188. SELECT ST_LENGTH(ROW(1,1));
  2189. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2190. SELECT ST_LENGTH(1);
  2191. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2192. SELECT ST_LENGTH('test');
  2193. --echo # Item_real_func_geometry_args_geometry_geometry
  2194. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2195. SELECT ST_DISTANCE(ROW(1,1), 1);
  2196. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2197. SELECT ST_DISTANCE(1, 1);
  2198. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2199. SELECT ST_DISTANCE('test', 1);
  2200. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2201. SELECT ST_DISTANCE(POINT(1,1), ROW(1,1));
  2202. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2203. SELECT ST_DISTANCE(POINT(1,1), 1);
  2204. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2205. SELECT ST_DISTANCE(POINT(1,1), 'test');
  2206. --echo # Item_int_func_args_geometry
  2207. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2208. SELECT ST_ISSIMPLE(ROW(1,1));
  2209. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2210. SELECT ST_ISSIMPLE(1);
  2211. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2212. SELECT ST_ISSIMPLE('test');
  2213. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2214. SELECT ST_ISRING(ROW(1,1));
  2215. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2216. SELECT ST_ISRING(1);
  2217. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2218. SELECT ST_ISRING('test');
  2219. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2220. SELECT ST_ISCLOSED(ROW(1,1));
  2221. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2222. SELECT ST_ISCLOSED(1);
  2223. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2224. SELECT ST_ISCLOSED('test');
  2225. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2226. SELECT ST_DIMENSION(ROW(1,1));
  2227. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2228. SELECT ST_DIMENSION(1);
  2229. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2230. SELECT ST_DIMENSION('test');
  2231. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2232. SELECT ST_NUMGEOMETRIES(ROW(1,1));
  2233. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2234. SELECT ST_NUMGEOMETRIES(1);
  2235. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2236. SELECT ST_NUMGEOMETRIES('test');
  2237. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2238. SELECT ST_NUMINTERIORRINGS(ROW(1,1));
  2239. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2240. SELECT ST_NUMINTERIORRINGS(1);
  2241. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2242. SELECT ST_NUMINTERIORRINGS('test');
  2243. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2244. SELECT ST_NUMPOINTS(ROW(1,1));
  2245. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2246. SELECT ST_NUMPOINTS(1);
  2247. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2248. SELECT ST_NUMPOINTS('test');
  2249. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2250. SELECT ST_SRID(ROW(1,1));
  2251. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2252. SELECT ST_SRID(1);
  2253. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2254. SELECT ST_SRID('test');
  2255. --echo # Item_bool_func_args_geometry
  2256. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2257. SELECT ST_ISEMPTY(ROW(1,1));
  2258. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2259. SELECT ST_ISEMPTY(1);
  2260. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2261. SELECT ST_ISEMPTY('test');
  2262. --echo # Item_bool_func_geometry_args_geometry_geometry
  2263. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2264. SELECT ST_RELATE(ROW(1,1), POINT(1,1), 'T*F**FFF*');
  2265. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2266. SELECT ST_RELATE(POINT(1,1), ROW(1,1), 'T*F**FFF*');
  2267. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2268. SELECT ST_RELATE(1, POINT(1,1), 'T*F**FFF*');
  2269. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2270. SELECT ST_RELATE(POINT(1,1), 1, 'T*F**FFF*');
  2271. SELECT ST_RELATE(Point(1,1),Point(1,1),'T*F**FFF*') AS equals;
  2272. SELECT ST_RELATE(Point(1,1),Point(1,1),NULL);
  2273. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2274. SELECT ST_RELATE(Point(1,1),Point(1,1),ROW(1,1));
  2275. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2276. SELECT ST_RELATE(Point(1,1),Point(1,1),1);
  2277. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2278. SELECT ST_RELATE(Point(1,1),Point(1,1),1.0);
  2279. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2280. SELECT ST_RELATE(Point(1,1),Point(1,1),1e0);
  2281. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2282. SELECT ST_RELATE(Point(1,1),Point(1,1),TIME'10:10:10');
  2283. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2284. SELECT ST_RELATE(Point(1,1),Point(1,1),DATE'2010-01-01');
  2285. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2286. SELECT ST_RELATE(Point(1,1),Point(1,1),TIMESTAMP'2010-01-01 10:10:10');
  2287. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2288. SELECT ST_RELATE(Point(1,1),Point(1,1),Point(1,1));
  2289. --echo # Item_str_ascii_func_args_geometry
  2290. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2291. SELECT ST_ASTEXT(ROW(1,1));
  2292. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2293. SELECT ST_ASTEXT(1);
  2294. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2295. SELECT ST_ASTEXT('test');
  2296. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2297. SELECT ST_GEOMETRYTYPE(ROW(1,1));
  2298. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2299. SELECT ST_GEOMETRYTYPE(1);
  2300. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2301. SELECT ST_GEOMETRYTYPE('test');
  2302. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2303. SELECT ST_ASGEOJSON(ROW(1,1));
  2304. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2305. SELECT ST_ASGEOJSON(1);
  2306. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2307. SELECT ST_ASGEOJSON('test');
  2308. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2309. SELECT ST_ASGEOJSON(POINT(1,1), POINT(1,1));
  2310. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2311. SELECT ST_ASGEOJSON(POINT(1,1), 1, POINT(1,1));
  2312. --echo # Item_func_spatial_rel
  2313. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2314. SELECT ST_TOUCHES(ROW(1,1), POINT(1,1));
  2315. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2316. SELECT ST_TOUCHES(POINT(1,1), ROW(1,1));
  2317. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2318. SELECT ST_TOUCHES(1, POINT(1,1));
  2319. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2320. SELECT ST_TOUCHES(POINT(1,1), 1);
  2321. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2322. SELECT ST_TOUCHES('test', POINT(1,1));
  2323. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2324. SELECT ST_TOUCHES(POINT(1,1), 'test');
  2325. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2326. SELECT MBRTOUCHES(ROW(1,1), POINT(1,1));
  2327. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2328. SELECT MBRTOUCHES(POINT(1,1), ROW(1,1));
  2329. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2330. SELECT MBRTOUCHES(1, POINT(1,1));
  2331. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2332. SELECT MBRTOUCHES(POINT(1,1), 1);
  2333. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2334. SELECT MBRTOUCHES('test', POINT(1,1));
  2335. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2336. SELECT MBRTOUCHES(POINT(1,1), 'test');
  2337. --echo #
  2338. --echo # MDEV-13964 Parameter data type control for Item_real_func
  2339. --echo #
  2340. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2341. SELECT EXP(POINT(1,1));
  2342. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2343. SELECT LN(POINT(1,1));
  2344. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2345. SELECT LOG2(POINT(1,1));
  2346. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2347. SELECT LOG10(POINT(1,1));
  2348. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2349. SELECT SQRT(POINT(1,1));
  2350. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2351. SELECT ACOS(POINT(1,1));
  2352. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2353. SELECT ASIN(POINT(1,1));
  2354. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2355. SELECT COS(POINT(1,1));
  2356. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2357. SELECT SIN(POINT(1,1));
  2358. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2359. SELECT TAN(POINT(1,1));
  2360. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2361. SELECT COT(POINT(1,1));
  2362. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2363. SELECT LOG(POINT(1,1));
  2364. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2365. SELECT LOG(POINT(1,1),POINT(1,1));
  2366. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2367. SELECT LOG(1, POINT(1,1));
  2368. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2369. SELECT ATAN(POINT(1,1));
  2370. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2371. SELECT ATAN(POINT(1,1),POINT(1,1));
  2372. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2373. SELECT ATAN(1, POINT(1,1));
  2374. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2375. SELECT POW(POINT(1,1),POINT(1,1));
  2376. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2377. SELECT RAND(POINT(1,1));
  2378. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2379. SELECT RADIANS(POINT(1,1));
  2380. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2381. SELECT DEGREES(POINT(1,1));
  2382. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2383. SELECT EXP(ROW(1,1));
  2384. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2385. SELECT LN(ROW(1,1));
  2386. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2387. SELECT LOG2(ROW(1,1));
  2388. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2389. SELECT LOG10(ROW(1,1));
  2390. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2391. SELECT SQRT(ROW(1,1));
  2392. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2393. SELECT ACOS(ROW(1,1));
  2394. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2395. SELECT ASIN(ROW(1,1));
  2396. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2397. SELECT COS(ROW(1,1));
  2398. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2399. SELECT SIN(ROW(1,1));
  2400. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2401. SELECT TAN(ROW(1,1));
  2402. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2403. SELECT COT(ROW(1,1));
  2404. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2405. SELECT LOG(ROW(1,1));
  2406. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2407. SELECT LOG(ROW(1,1),ROW(1,1));
  2408. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2409. SELECT LOG(1, ROW(1,1));
  2410. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2411. SELECT ATAN(ROW(1,1));
  2412. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2413. SELECT ATAN(ROW(1,1),ROW(1,1));
  2414. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2415. SELECT ATAN(1, ROW(1,1));
  2416. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2417. SELECT POW(ROW(1,1),ROW(1,1));
  2418. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2419. SELECT RAND(ROW(1,1));
  2420. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2421. SELECT RADIANS(ROW(1,1));
  2422. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2423. SELECT DEGREES(ROW(1,1));
  2424. --echo #
  2425. --echo # MDEV-13965 Parameter data type control for Item_longlong_func
  2426. --echo #
  2427. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2428. SELECT POINT(1,1) | 1;
  2429. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2430. SELECT 1 | POINT(1,1);
  2431. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2432. SELECT POINT(1,1) & 1;
  2433. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2434. SELECT 1 & POINT(1,1);
  2435. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2436. SELECT POINT(1,1) << 1;
  2437. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2438. SELECT 1 << POINT(1,1);
  2439. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2440. SELECT POINT(1,1) >> 1;
  2441. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2442. SELECT 1 >> POINT(1,1);
  2443. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2444. SELECT ~POINT(1,1);
  2445. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2446. SELECT TO_SECONDS(POINT(1,1));
  2447. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2448. SELECT TIMESTAMPDIFF(SECOND,POINT(1,1), 1);
  2449. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2450. SELECT TIMESTAMPDIFF(SECOND,1, POINT(1,1));
  2451. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2452. SELECT INET_ATON(POINT(1,1));
  2453. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2454. SELECT LAST_INSERT_ID(POINT(1,1));
  2455. --echo #
  2456. --echo # MDEV-13966 Parameter data type control for Item_temporal_func
  2457. --echo #
  2458. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2459. SELECT FROM_DAYS(POINT(1,1));
  2460. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2461. SELECT MAKEDATE(POINT(1,1),1);
  2462. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2463. SELECT MAKEDATE(1, POINT(1,1));
  2464. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2465. SELECT LAST_DAY(POINT(1,1));
  2466. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2467. SELECT SEC_TO_TIME(POINT(1,1));
  2468. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2469. SELECT TIMEDIFF(POINT(1,1),1);
  2470. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2471. SELECT TIMEDIFF(1, POINT(1,1));
  2472. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2473. SELECT MAKETIME(POINT(1,1),1,1);
  2474. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2475. SELECT MAKETIME(1, POINT(1,1), 1);
  2476. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2477. SELECT MAKETIME(1, 1, POINT(1,1));
  2478. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2479. SELECT FROM_UNIXTIME(POINT(1,1));
  2480. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2481. SELECT CONVERT_TZ(POINT(1,1),1,1);
  2482. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2483. SELECT CONVERT_TZ(1, POINT(1,1), 1);
  2484. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2485. SELECT CONVERT_TZ(1, 1, POINT(1,1));
  2486. --echo #
  2487. --echo # MDEV-13967 Parameter data type control for Item_long_func
  2488. --echo #
  2489. SELECT STRCMP(POINT(1,1),POINT(1,1));
  2490. SELECT CHAR_LENGTH(POINT(1,1));
  2491. SELECT OCTET_LENGTH(POINT(1,1));
  2492. SELECT UNCOMPRESSED_LENGTH(POINT(1,1));
  2493. SELECT COERCIBILITY(POINT(1,1));
  2494. SELECT ASCII(POINT(1,1));
  2495. SELECT CRC32(POINT(1,1));
  2496. SELECT ORD(POINT(1,1));
  2497. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2498. SELECT SIGN(POINT(1,1));
  2499. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2500. SELECT LOCATE('a','a',POINT(1,1));
  2501. SELECT LOCATE(POINT(1,1),POINT(1,1));
  2502. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2503. SELECT BIT_COUNT(POINT(1,1));
  2504. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2505. SELECT BENCHMARK(POINT(1,1),'');
  2506. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2507. SELECT SLEEP(POINT(1,1));
  2508. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2509. SELECT GET_LOCK('x', POINT(1,1));
  2510. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2511. SELECT PERIOD_ADD(POINT(1,1),1);
  2512. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2513. SELECT PERIOD_ADD(1,POINT(1,1));
  2514. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2515. SELECT PERIOD_DIFF(POINT(1,1),1);
  2516. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2517. SELECT PERIOD_DIFF(1,POINT(1,1));
  2518. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2519. SELECT TO_DAYS(POINT(1,1));
  2520. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2521. SELECT DAYOFMONTH(POINT(1,1));
  2522. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2523. SELECT DAYOFYEAR(POINT(1,1));
  2524. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2525. SELECT QUARTER(POINT(1,1));
  2526. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2527. SELECT YEAR(POINT(1,1));
  2528. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2529. SELECT YEARWEEK(POINT(1,1));
  2530. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2531. SELECT WEEK(POINT(1,1));
  2532. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2533. SELECT WEEK(POINT(1,1),1);
  2534. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2535. SELECT WEEK(1,POINT(1,1));
  2536. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2537. SELECT HOUR(POINT(1,1));
  2538. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2539. SELECT MINUTE(POINT(1,1));
  2540. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2541. SELECT SECOND(POINT(1,1));
  2542. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2543. SELECT MICROSECOND(POINT(1,1));
  2544. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2545. SELECT JSON_DEPTH(POINT(1,1));
  2546. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2547. SELECT JSON_LENGTH(POINT(1,1));
  2548. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2549. SELECT JSON_LENGTH('json', POINT(1,1));
  2550. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2551. SELECT JSON_LENGTH(POINT(1,1), POINT(1,1));
  2552. SELECT REGEXP_INSTR(POINT(1,1),'');
  2553. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2554. SELECT REGEXP_INSTR('',POINT(1,1));
  2555. SELECT FIND_IN_SET(POINT(1,1),'');
  2556. SELECT FIND_IN_SET('',POINT(1,1));
  2557. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2558. SELECT RELEASE_LOCK(POINT(1,1));
  2559. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2560. SELECT IS_FREE_LOCK(POINT(1,1));
  2561. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2562. SELECT IS_USED_LOCK(POINT(1,1));
  2563. --echo #
  2564. --echo # MDEV-26161 crash in Gis_point::calculate_haversine
  2565. --echo #
  2566. #enable after fix MDEV-30229
  2567. --disable_view_protocol
  2568. --error ER_CANT_CREATE_GEOMETRY_OBJECT
  2569. select st_distance_sphere(x'01030000000400000004000000000000', multipoint(point(124,204)), 10);
  2570. --error ER_CANT_CREATE_GEOMETRY_OBJECT
  2571. select st_distance_sphere(x'010300000004000000040000', multipoint(point(124,204)), 10);
  2572. --error ER_CANT_CREATE_GEOMETRY_OBJECT
  2573. select st_distance_sphere(x'010300000001000000040000', multipoint(point(124,204)), 10);
  2574. --enable_view_protocol
  2575. --echo #
  2576. --echo # End of 10.3 tests
  2577. --echo #
  2578. --echo #
  2579. --echo # Start of 10.4 tests
  2580. --echo #
  2581. --echo #
  2582. --echo # MDEV-16351 JSON_OBJECT() treats hybrid functions with boolean arguments as numbers
  2583. --echo #
  2584. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2585. SELECT ST_SRID(TRUE);
  2586. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2587. SELECT ST_SRID(COALESCE(TRUE,TRUE));
  2588. CREATE TABLE t1 (a INT);
  2589. INSERT INTO t1 VALUES (1),(2),(3);
  2590. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2591. SELECT ST_SRID((SELECT MAX(a)>3 FROM t1));
  2592. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2593. SELECT ST_SRID(MAX(a>3)) FROM t1;
  2594. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2595. SELECT ST_SRID((SELECT MAX(a>3) FROM t1));
  2596. DROP TABLE t1;
  2597. --echo #
  2598. --echo # Mixing GEOMETRY with HEX hybrid
  2599. --echo #
  2600. SELECT 0x60=POINT(1,1), POINT(1,1)=0x60;
  2601. CREATE TABLE t1 AS SELECT
  2602. COALESCE(0x60,POINT(1,1)),
  2603. COALESCE(POINT(1,1),0x60),
  2604. LEAST(0x60,POINT(1,1)),
  2605. LEAST(POINT(1,1),0x60);
  2606. SHOW CREATE TABLE t1;
  2607. DROP TABLE t1;
  2608. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  2609. SELECT 0x60+POINT(1,1);
  2610. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  2611. SELECT POINT(1,1)+0x60;
  2612. --echo #
  2613. --echo # MDEV-16454 Bad results for IN with ROW
  2614. --echo #
  2615. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  2616. SELECT (1,0) IN ((POINT(1,1),0),(0,0));
  2617. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  2618. SELECT (1,(0,0)) IN ((1,(POINT(1,1),0)),(0,(0,0)));
  2619. --echo #
  2620. --echo # MDEV-19819 ALTER from POINT to LINESTRING erroneously preserves POINT values
  2621. --echo #
  2622. CREATE TABLE t1 (a POINT) ENGINE=MyISAM;
  2623. INSERT INTO t1 VALUES (Point(0,0));
  2624. --error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
  2625. ALTER TABLE t1 MODIFY a LINESTRING;
  2626. DROP TABLE t1;
  2627. CREATE TABLE t1 (a LINESTRING);
  2628. CREATE TABLE t2 (a POINT);
  2629. INSERT INTO t2 VALUES (POINT(0,0));
  2630. --error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
  2631. INSERT INTO t1 SELECT * FROM t2;
  2632. SELECT AsText(a) FROM t1;
  2633. DROP TABLE t1, t2;
  2634. --echo #
  2635. --echo # End of 10.4 tests
  2636. --echo #
  2637. --echo #
  2638. --echo # Start of 10.5 tests
  2639. --echo #
  2640. --echo #
  2641. --echo # MDEV-19994 Add class Function_collection
  2642. --echo #
  2643. --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
  2644. SELECT CONTAINS();
  2645. --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
  2646. SELECT CONTAINS(POINT(1,1));
  2647. --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
  2648. SELECT CONTAINS(POINT(1,1), POINT(1,1), POINT(1,1));
  2649. --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
  2650. SELECT WITHIN();
  2651. --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
  2652. SELECT WITHIN(POINT(1,1));
  2653. --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
  2654. SELECT WITHIN(POINT(1,1), POINT(1,1), POINT(1,1));
  2655. --echo #
  2656. --echo # MDEV-20009 Add CAST(expr AS pluggable_type)
  2657. --echo #
  2658. --error ER_UNKNOWN_OPERATOR
  2659. SELECT CAST(1 AS GEOMETRY);
  2660. --error ER_UNKNOWN_OPERATOR
  2661. SELECT CAST(1 AS GEOMETRYCOLLECTION);
  2662. --error ER_UNKNOWN_OPERATOR
  2663. SELECT CAST(1 AS POINT);
  2664. --error ER_UNKNOWN_OPERATOR
  2665. SELECT CAST(1 AS LINESTRING);
  2666. --error ER_UNKNOWN_OPERATOR
  2667. SELECT CAST(1 AS POLYGON);
  2668. --error ER_UNKNOWN_OPERATOR
  2669. SELECT CAST(1 AS MULTIPOINT);
  2670. --error ER_UNKNOWN_OPERATOR
  2671. SELECT CAST(1 AS MULTILINESTRING);
  2672. --error ER_UNKNOWN_OPERATOR
  2673. SELECT CAST(1 AS MULTIPOLYGON);
  2674. --error ER_UNKNOWN_OPERATOR
  2675. SELECT CONVERT(1, GEOMETRY);
  2676. --error ER_UNKNOWN_OPERATOR
  2677. SELECT CONVERT(1, GEOMETRYCOLLECTION);
  2678. --error ER_UNKNOWN_OPERATOR
  2679. SELECT CONVERT(1, POINT);
  2680. --error ER_UNKNOWN_OPERATOR
  2681. SELECT CONVERT(1, LINESTRING);
  2682. --error ER_UNKNOWN_OPERATOR
  2683. SELECT CONVERT(1, POLYGON);
  2684. --error ER_UNKNOWN_OPERATOR
  2685. SELECT CONVERT(1, MULTIPOINT);
  2686. --error ER_UNKNOWN_OPERATOR
  2687. SELECT CONVERT(1, MULTILINESTRING);
  2688. --error ER_UNKNOWN_OPERATOR
  2689. SELECT CONVERT(1, MULTIPOLYGON);
  2690. --echo #
  2691. --echo # MDEV-17832 Protocol: extensions for Pluggable types and JSON, GEOMETRY
  2692. --echo #
  2693. SET NAMES utf8;
  2694. CREATE TABLE t1 (
  2695. p POINT,
  2696. ls LINESTRING,
  2697. pl POLYGON,
  2698. mp MULTIPOINT,
  2699. mls MULTILINESTRING,
  2700. mpl MULTIPOLYGON,
  2701. gc GEOMETRYCOLLECTION,
  2702. g GEOMETRY
  2703. ) CHARACTER SET utf8;
  2704. #check after fix MDEV-31540
  2705. --disable_cursor_protocol
  2706. --disable_view_protocol
  2707. --enable_metadata
  2708. SELECT * FROM t1;
  2709. SELECT
  2710. COALESCE(p) AS p,
  2711. COALESCE(ls) AS ls,
  2712. COALESCE(pl) AS pl,
  2713. COALESCE(mp) AS mp,
  2714. COALESCE(mls) AS mls,
  2715. COALESCE(mpl) AS mpl,
  2716. COALESCE(gc) AS gc,
  2717. COALESCE(g) AS g
  2718. FROM t1;
  2719. SELECT
  2720. COALESCE(p,p),
  2721. COALESCE(p,ls),
  2722. COALESCE(p,pl),
  2723. COALESCE(p,mp),
  2724. COALESCE(p,mls),
  2725. COALESCE(p,mpl),
  2726. COALESCE(p,g),
  2727. COALESCE(p,gc)
  2728. FROM t1;
  2729. SELECT
  2730. COALESCE(ls,p),
  2731. COALESCE(ls,ls),
  2732. COALESCE(ls,pl),
  2733. COALESCE(ls,mp),
  2734. COALESCE(ls,mls),
  2735. COALESCE(ls,mpl),
  2736. COALESCE(ls,g),
  2737. COALESCE(ls,gc)
  2738. FROM t1;
  2739. SELECT
  2740. COALESCE(pl,p),
  2741. COALESCE(pl,ls),
  2742. COALESCE(pl,pl),
  2743. COALESCE(pl,mp),
  2744. COALESCE(pl,mls),
  2745. COALESCE(pl,mpl),
  2746. COALESCE(pl,g),
  2747. COALESCE(pl,gc)
  2748. FROM t1;
  2749. SELECT
  2750. COALESCE(mp,p),
  2751. COALESCE(mp,ls),
  2752. COALESCE(mp,pl),
  2753. COALESCE(mp,mp),
  2754. COALESCE(mp,mls),
  2755. COALESCE(mp,mpl),
  2756. COALESCE(mp,g),
  2757. COALESCE(mp,gc)
  2758. FROM t1;
  2759. SELECT
  2760. COALESCE(mls,p),
  2761. COALESCE(mls,ls),
  2762. COALESCE(mls,pl),
  2763. COALESCE(mls,mp),
  2764. COALESCE(mls,mls),
  2765. COALESCE(mls,mpl),
  2766. COALESCE(mls,g),
  2767. COALESCE(mls,gc)
  2768. FROM t1;
  2769. SELECT
  2770. COALESCE(mpl,p),
  2771. COALESCE(mpl,ls),
  2772. COALESCE(mpl,pl),
  2773. COALESCE(mpl,mp),
  2774. COALESCE(mpl,mls),
  2775. COALESCE(mpl,mpl),
  2776. COALESCE(mpl,g),
  2777. COALESCE(mpl,gc)
  2778. FROM t1;
  2779. SELECT
  2780. COALESCE(g,p),
  2781. COALESCE(g,ls),
  2782. COALESCE(g,pl),
  2783. COALESCE(g,mp),
  2784. COALESCE(g,mls),
  2785. COALESCE(g,mpl),
  2786. COALESCE(g,g),
  2787. COALESCE(g,gc)
  2788. FROM t1;
  2789. SELECT
  2790. COALESCE(gc,p),
  2791. COALESCE(gc,ls),
  2792. COALESCE(gc,pl),
  2793. COALESCE(gc,mp),
  2794. COALESCE(gc,mls),
  2795. COALESCE(gc,mpl),
  2796. COALESCE(gc,g),
  2797. COALESCE(gc,gc)
  2798. FROM t1;
  2799. --disable_metadata
  2800. --enable_view_protocol
  2801. --enable_cursor_protocol
  2802. DROP TABLE t1;
  2803. --echo #
  2804. --echo # MDEV-20809 EXTRACT from INET6 value does not produce any warnings
  2805. --echo #
  2806. CREATE TABLE t1 (a GEOMETRY);
  2807. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2808. SELECT EXTRACT(DAY FROM a) FROM t1;
  2809. DROP TABLE t1;
  2810. --echo #
  2811. --echo # MDEV-21765 Possibly inconsistent behavior of BIT_xx functions with INET6 field
  2812. --echo #
  2813. CREATE TABLE t1 (a GEOMETRY);
  2814. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2815. SELECT BIT_AND(a) FROM t1;
  2816. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2817. SELECT BIT_OR(a) FROM t1;
  2818. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2819. SELECT BIT_XOR(a) FROM t1;
  2820. DROP TABLE t1;
  2821. --echo #
  2822. --echo # MDEV-27666 User variable not parsed as geometry variable in geometry function.
  2823. --echo #
  2824. set @g= point(1, 1);
  2825. select ST_AsWKT(GeometryCollection(Point(44, 6), @g));
  2826. set @g= "just a string";
  2827. --error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
  2828. select ST_AsWKT(GeometryCollection(Point(44, 6), @g));
  2829. SET @g= LineString(Point(0,0), Point(0,1));
  2830. SELECT AsText(PointN(@g, 1));
  2831. SELECT AsText(PointN(@g, 2));
  2832. SET @g= Point(1, 1);
  2833. CREATE TABLE t1 AS SELECT @g AS g;
  2834. SHOW CREATE TABLE t1;
  2835. SELECT AsText(g) FROM t1;
  2836. DROP TABLE t1;
  2837. SET @g= MultiPoint(Point(1, 1), Point(-1,-1));
  2838. CREATE TABLE t1 AS SELECT @g AS g;
  2839. SHOW CREATE TABLE t1;
  2840. SELECT AsText(g) FROM t1;
  2841. DROP TABLE t1;
  2842. SET @g= LineString(Point(1, 1), Point(2,2));
  2843. CREATE TABLE t1 AS SELECT @g AS g;
  2844. SHOW CREATE TABLE t1;
  2845. SELECT AsText(g) FROM t1;
  2846. DROP TABLE t1;
  2847. SET @g= MultiLineString(LineString(Point(1, 1), Point(2,2)),
  2848. LineString(Point(-1, -1), Point(-2,-2)));
  2849. CREATE TABLE t1 AS SELECT @g AS g;
  2850. SHOW CREATE TABLE t1;
  2851. SELECT AsText(g) FROM t1;
  2852. DROP TABLE t1;
  2853. SET @g= Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)));
  2854. CREATE TABLE t1 AS SELECT @g AS g;
  2855. SHOW CREATE TABLE t1;
  2856. SELECT AsText(g) FROM t1;
  2857. DROP TABLE t1;
  2858. SET @g= MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3),
  2859. Point(3, 0), Point(0, 3))));
  2860. CREATE TABLE t1 AS SELECT @g AS g;
  2861. SHOW CREATE TABLE t1;
  2862. SELECT AsText(g) FROM t1;
  2863. DROP TABLE t1;
  2864. SET @g= GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)));
  2865. CREATE TABLE t1 AS SELECT @g AS g;
  2866. SHOW CREATE TABLE t1;
  2867. SELECT AsText(g) FROM t1;
  2868. DROP TABLE t1;
  2869. SET @g= GeometryFromText('POINT(1 1)');
  2870. CREATE TABLE t1 AS SELECT @g AS g;
  2871. SHOW CREATE TABLE t1;
  2872. SELECT AsText(g) FROM t1;
  2873. DROP TABLE t1;
  2874. --echo #
  2875. --echo # MDEV-16699 heap-use-after-free in group_concat with compressed or GIS columns
  2876. --echo #
  2877. create table t1 (c polygon);
  2878. insert into t1 values
  2879. (PolygonFromText('POLYGON((1 2,1 2))')),
  2880. (PolygonFromText('POLYGON((0 0,1 1,0 0))'));
  2881. select length(group_concat(c, c order by 1,2)) from t1;
  2882. create table t2 as select group_concat(c, c order by 1,2), concat(c), c from t1;
  2883. show create table t2;
  2884. drop table t1, t2;
  2885. --echo #
  2886. --echo # MDEV-33987 Server crashes at Item_func_as_wkt::val_str_ascii
  2887. --echo #
  2888. SELECT ST_ASTEXT(BOUNDARY(INET6_ATON('255.255.255.255'))) AS c1;
  2889. --echo #
  2890. --echo # Server crash in DTCollation::set_repertoire_from_charset
  2891. --echo #
  2892. CREATE TABLE t (f POINT, KEY(f));
  2893. --error ER_CANT_CREATE_GEOMETRY_OBJECT
  2894. DELETE FROM t WHERE f NOT IN (NULL,'x');
  2895. DROP TABLE t;
  2896. --echo #
  2897. --echo # MDEV-31219 Assertion `fixed' failed in Item_func_hybrid_field_type / Frame_positional_cursor
  2898. --echo #
  2899. CREATE TABLE t (a INT, b POINT);
  2900. INSERT INTO t VALUES (1,POINT(0,0)),(2,POINT(0,0));
  2901. --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
  2902. SELECT NTH_VALUE(a,b) OVER () FROM t;
  2903. DROP TABLE t;
  2904. --echo #
  2905. --echo # MDEV-32619 Settng SRID on geometry with ST_*FromWKKB(g, srid)
  2906. --echo #
  2907. SELECT
  2908. ST_SRID(g1),
  2909. ST_SRID(ST_GeomFromWKB(g1, 4326)),
  2910. ST_SRID(ST_GeomFromWKB(g1)),
  2911. ST_AsText(g1),
  2912. ST_SRID(ST_PointFromWKB(g2, 4326)),
  2913. ST_SRID(g2),
  2914. ST_SRID(ST_LineStringFromWKB(g3, 3)),
  2915. ST_SRID(ST_PolygonFromWKB(g4, 4)),
  2916. ST_SRID(ST_MultiPointFromWKB(g5, 5)),
  2917. ST_SRID(ST_MultiLineStringFromWKB(g6, 6)),
  2918. ST_SRID(ST_MultiPolygonFromWKB(g7, 7))
  2919. FROM (
  2920. SELECT
  2921. POINT(1, 2) AS g1,
  2922. POINT(4, 3) AS g2,
  2923. LINESTRING(POINT(4, 3), POINT(4, 4)) AS g3,
  2924. POLYGON(LINESTRING(POINT(4, 3), POINT(4, 4), POINT(3, 4), POINT(4, 3))) AS g4,
  2925. MULTIPOINT(POINT(4, 3)) AS g5,
  2926. MULTILINESTRING(LINESTRING(POINT(4, 3), POINT(4, 4))) AS g6,
  2927. MULTIPOLYGON(POLYGON(LINESTRING(POINT(4, 3), POINT(4, 4), POINT(3, 4), POINT(4, 3)))) AS g7
  2928. ) AS t;
  2929. --echo #
  2930. --echo # MDEV-35117 Error message "ERROR 1815 (HY000): Internal error: st_distance_sphere' could be improved
  2931. --echo #
  2932. --error ER_GIS_UNSUPPORTED_ARGUMENT
  2933. SELECT ST_DISTANCE_SPHERE(st_geomfromtext('linestring( 2 2, 2 8) '), ST_GeomFromText('POINT(18.413076 43.856258)')) ;
  2934. --echo # End of 10.5 tests