diff options
| author | Monty <monty@mariadb.org> | 2022-06-30 14:02:53 +0300 |
|---|---|---|
| committer | Sergei Petrunia <sergey@mariadb.com> | 2023-02-02 23:08:23 +0300 |
| commit | 013ba37ae23040ca804c1ac2c293cab4ccb5731e (patch) | |
| tree | a2d50f7da82e20b67631efc71ba57b1353c39b67 /mysql-test | |
| parent | 59193ef67361354e8a5702ade8ce69d8b0ffe014 (diff) | |
| download | mariadb-git-013ba37ae23040ca804c1ac2c293cab4ccb5731e.tar.gz | |
Fix cost calculation in test_if_cheaper_ordering() to be cost based
The original code was mostly rule based and preferred clustered or
covering indexed independent of cost.
There where a few test changes:
- Some test changed from using filesort to index or table scan. This
happened when most of the rows had to be sorted and the ORDER BY could
use covering or a clustered index (innodb_mysql, create_spatial_index).
- Some test changed range to filesort. This where mainly because the range
was scanning most of the rows or using index scan + row lookup and
filesort with table scan is cheaper. (order_by).
- Change in join_cache was because sorting 2 rows is faster than retrieving
10 rows.
- In selectivity_innodb.test one test changed to use a cheaper index.
Diffstat (limited to 'mysql-test')
| -rw-r--r-- | mysql-test/main/join_cache.result | 4 | ||||
| -rw-r--r-- | mysql-test/main/opt_trace.result | 85 | ||||
| -rw-r--r-- | mysql-test/main/opt_trace.test | 5 | ||||
| -rw-r--r-- | mysql-test/main/order_by.result | 59 | ||||
| -rw-r--r-- | mysql-test/main/order_by.test | 12 | ||||
| -rw-r--r-- | mysql-test/main/rowid_filter_innodb.result | 2 | ||||
| -rw-r--r-- | mysql-test/main/selectivity_innodb.result | 4 | ||||
| -rw-r--r-- | mysql-test/suite/innodb/r/innodb_mysql.result | 10 | ||||
| -rw-r--r-- | mysql-test/suite/innodb/r/partition_locking.result | 2 | ||||
| -rw-r--r-- | mysql-test/suite/innodb/t/partition_locking.test | 2 | ||||
| -rw-r--r-- | mysql-test/suite/innodb_gis/r/create_spatial_index.result | 63 | ||||
| -rw-r--r-- | mysql-test/suite/innodb_gis/t/create_spatial_index.test | 95 |
12 files changed, 232 insertions, 111 deletions
diff --git a/mysql-test/main/join_cache.result b/mysql-test/main/join_cache.result index fe40178a8da..2c5323a7795 100644 --- a/mysql-test/main/join_cache.result +++ b/mysql-test/main/join_cache.result @@ -5153,7 +5153,7 @@ SET SESSION optimizer_switch = 'index_condition_pushdown=off'; EXPLAIN SELECT * FROM t1,t2 WHERE t2.f3 = t1.f2 AND t1.f1 IN (9, 0, 100) ORDER BY t1.f2 LIMIT 1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range f1,f2 f2 13 NULL 10 Using where +1 SIMPLE t1 range f1,f2 f1 5 NULL 3 Using where; Rowid-ordered scan; Using filesort 1 SIMPLE t2 ref f3 f3 67 test.t1.f2 2 Using where; Using index SELECT * FROM t1,t2 WHERE t2.f3 = t1.f2 AND t1.f1 IN (9, 0 ,100) ORDER BY t1.f2 LIMIT 1; @@ -5163,7 +5163,7 @@ SET SESSION optimizer_switch = 'index_condition_pushdown=on'; EXPLAIN SELECT * FROM t1,t2 WHERE t2.f3 = t1.f2 AND t1.f1 IN (9, 0 ,100) ORDER BY t1.f2 LIMIT 1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range f1,f2 f2 13 NULL 10 Using where +1 SIMPLE t1 range f1,f2 f1 5 NULL 3 Using index condition; Using where; Rowid-ordered scan; Using filesort 1 SIMPLE t2 ref f3 f3 67 test.t1.f2 2 Using where; Using index SELECT * FROM t1,t2 WHERE t2.f3 = t1.f2 AND t1.f1 IN (9, 0 ,100) ORDER BY t1.f2 LIMIT 1; diff --git a/mysql-test/main/opt_trace.result b/mysql-test/main/opt_trace.result index 121794cde92..19a1f607810 100644 --- a/mysql-test/main/opt_trace.result +++ b/mysql-test/main/opt_trace.result @@ -1709,18 +1709,20 @@ EXPLAIN SELECT MIN(d) FROM t1 where b=2 and c=3 group by a { { "reconsidering_access_paths_for_index_ordering": { "clause": "GROUP BY", - "fanout": 1, - "read_time": 2.084226263, "table": "t1", - "rows_estimation": 7, + "rows_estimation": 1, + "read_cost": 2.147624763, + "filesort_cost": 0.0633985, + "filesort_type": "priority_queue with addon fields", + "fanout": 1, "possible_keys": [ { "index": "a", "can_resolve_order": true, "direction": 1, - "updated_limit": 7, - "index_scan_cost": 2.084226263, - "rows": 7, + "rows_to_examine": 7, + "range_scan": false, + "scan_cost": 2.084226263, "chosen": true } ] @@ -2168,7 +2170,7 @@ a int, b int, c int, filler char(100), -KEY a_a(c), +KEY c(c), KEY a_c(a,c), KEY a_b(a,b) ); @@ -2183,6 +2185,10 @@ test.t1 analyze status OK set optimizer_trace='enabled=on'; explain select * from t1 where a=1 and b=2 order by c limit 1; id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a_c,a_b a_b 10 const,const 21 Using where; Using filesort +update t1 set b=2 where pk between 20 and 40; +explain select * from t1 where a=1 and b=2 order by c limit 1; +id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range a_c,a_b a_c 5 NULL 180 Using where select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES @@ -2268,7 +2274,7 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 { }, "potential_range_indexes": [ { - "index": "a_a", + "index": "c", "usable": false, "cause": "not applicable" }, @@ -2302,8 +2308,8 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 { "rowid_ordered": true, "using_mrr": false, "index_only": false, - "rows": 21, - "cost": 16.28742739, + "rows": 41, + "cost": 31.3040249, "chosen": true } ], @@ -2320,11 +2326,11 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 { "range_access_plan": { "type": "range_scan", "index": "a_b", - "rows": 21, + "rows": 41, "ranges": ["(1,2) <= (a,b) <= (1,2)"] }, - "rows_for_plan": 21, - "cost_for_plan": 16.28742739, + "rows_for_plan": 41, + "cost_for_plan": 31.3040249, "chosen": true } } @@ -2334,8 +2340,8 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 { "rowid_filters": [ { "key": "a_b", - "build_cost": 1.127362357, - "rows": 21 + "build_cost": 1.752281351, + "rows": 41 }, { "key": "a_c", @@ -2348,7 +2354,7 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 { "selectivity_for_indexes": [ { "index_name": "a_b", - "selectivity_from_index": 0.021 + "selectivity_from_index": 0.041 } ], "selectivity_for_columns": [ @@ -2363,7 +2369,7 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 { "selectivity_from_histogram": 0.021 } ], - "cond_selectivity": 0.021 + "cond_selectivity": 0.041 } ] }, @@ -2391,8 +2397,8 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 { "access_type": "ref", "index": "a_b", "used_range_estimates": true, - "rows": 21, - "cost": 16.26742739, + "rows": 41, + "cost": 31.2840249, "chosen": true }, { @@ -2403,9 +2409,9 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 { ], "chosen_access_method": { "type": "ref", - "records_read": 21, - "records_out": 21, - "cost": 16.26742739, + "records_read": 41, + "records_out": 41, + "cost": 31.2840249, "uses_join_buffering": false } } @@ -2415,15 +2421,15 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 { { "plan_prefix": [], "table": "t1", - "rows_for_plan": 21, - "cost_for_plan": 16.26742739 + "rows_for_plan": 41, + "cost_for_plan": 31.2840249 } ] }, { "best_join_order": ["t1"], - "rows": 21, - "cost": 16.26742739 + "rows": 41, + "cost": 31.2840249 }, { "substitute_best_equal": { @@ -2445,28 +2451,29 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 { { "reconsidering_access_paths_for_index_ordering": { "clause": "ORDER BY", - "fanout": 1, - "read_time": 16.26742739, "table": "t1", - "rows_estimation": 21, + "rows_estimation": 41, + "read_cost": 32.58369415, + "filesort_cost": 1.299669251, + "filesort_type": "priority_queue with addon fields", + "fanout": 1, "possible_keys": [ { - "index": "a_a", + "index": "c", "can_resolve_order": true, "direction": 1, - "updated_limit": 47, - "index_scan_cost": 35.77753234, - "usable": false, - "cause": "cost" + "rows_to_examine": 24, + "range_scan": false, + "scan_cost": 18.51405907, + "chosen": true }, { "index": "a_c", "can_resolve_order": true, "direction": 1, - "updated_limit": 47, - "index_scan_cost": 35.78900415, - "range_scan_cost": 6.375520747, - "rows": 180, + "rows_to_examine": 4, + "range_scan": true, + "scan_cost": 10.5218905, "chosen": true }, { @@ -2486,7 +2493,7 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 { }, "potential_range_indexes": [ { - "index": "a_a", + "index": "c", "usable": false, "cause": "not applicable" }, diff --git a/mysql-test/main/opt_trace.test b/mysql-test/main/opt_trace.test index cf54c8771d0..e9ff91dce43 100644 --- a/mysql-test/main/opt_trace.test +++ b/mysql-test/main/opt_trace.test @@ -148,7 +148,7 @@ create table t1 ( b int, c int, filler char(100), - KEY a_a(c), + KEY c(c), KEY a_c(a,c), KEY a_b(a,b) ); @@ -160,6 +160,9 @@ update t1 set b=2 where pk between 0 and 20; analyze table t1; set optimizer_trace='enabled=on'; explain select * from t1 where a=1 and b=2 order by c limit 1; + +update t1 set b=2 where pk between 20 and 40; +explain select * from t1 where a=1 and b=2 order by c limit 1; select * from INFORMATION_SCHEMA.OPTIMIZER_TRACE; drop table t1,ten,one_k; diff --git a/mysql-test/main/order_by.result b/mysql-test/main/order_by.result index 6db2b942e44..b59089bee80 100644 --- a/mysql-test/main/order_by.result +++ b/mysql-test/main/order_by.result @@ -1552,16 +1552,71 @@ UNIQUE KEY a_c (a,c), KEY (a)); INSERT INTO t1 VALUES (1, 10), (2, NULL); # Must use ref-or-null on the a_c index +ANALYZE FORMAT=JSON +SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c; +ANALYZE +{ + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, + "query_block": { + "select_id": 1, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "nested_loop": [ + { + "read_sorted_file": { + "r_rows": 1, + "filesort": { + "sort_key": "t1.c", + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "r_used_priority_queue": false, + "r_output_rows": 1, + "r_buffer_size": "REPLACED", + "r_sort_mode": "sort_key,addon_fields", + "table": { + "table_name": "t1", + "access_type": "index", + "possible_keys": ["a_c", "a"], + "key": "a_c", + "key_length": "10", + "used_key_parts": ["a", "c"], + "r_loops": 1, + "rows": 2, + "r_rows": 2, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "filtered": 50, + "r_filtered": 50, + "attached_condition": "t1.a = 2 and (t1.c = 10 or t1.c is null)", + "using_index": true + } + } + } + } + ] + } +} EXPLAIN SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a_c,a a_c 10 NULL 2 Using where; Using index +1 SIMPLE t1 index a_c,a a_c 10 NULL 2 Using where; Using index; Using filesort # Must return 1 row SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c; col 1 +# With more rows "filesort" is removed +INSERT INTO t1 select seq,seq from seq_1_to_2; +EXPLAIN +SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a_c,a a_c 10 NULL 2 Using where; Using index +SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c; +col +1 # With more rows "range" changes to "ref_or_null" -INSERT INTO t1 select seq,seq from seq_1_to_10; +INSERT INTO t1 select seq,seq from seq_3_to_10; EXPLAIN SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c; id select_type table type possible_keys key key_len ref rows Extra diff --git a/mysql-test/main/order_by.test b/mysql-test/main/order_by.test index 81924a9b230..917f2737eec 100644 --- a/mysql-test/main/order_by.test +++ b/mysql-test/main/order_by.test @@ -912,13 +912,23 @@ CREATE TABLE t1 ( INSERT INTO t1 VALUES (1, 10), (2, NULL); --echo # Must use ref-or-null on the a_c index +--source include/analyze-format.inc +ANALYZE FORMAT=JSON +SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c; EXPLAIN SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c; + --echo # Must return 1 row SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c; +--echo # With more rows "filesort" is removed +INSERT INTO t1 select seq,seq from seq_1_to_2; +EXPLAIN +SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c; +SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c; + --echo # With more rows "range" changes to "ref_or_null" -INSERT INTO t1 select seq,seq from seq_1_to_10; +INSERT INTO t1 select seq,seq from seq_3_to_10; EXPLAIN SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c; diff --git a/mysql-test/main/rowid_filter_innodb.result b/mysql-test/main/rowid_filter_innodb.result index 90b60c6023c..c4258cfe057 100644 --- a/mysql-test/main/rowid_filter_innodb.result +++ b/mysql-test/main/rowid_filter_innodb.result @@ -3601,7 +3601,7 @@ SELECT * FROM t1 WHERE (a BETWEEN 9 AND 10 OR a IS NULL) AND (b BETWEEN 9 AND 10 OR b = 9) ORDER BY pk LIMIT 1; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index a,b PRIMARY 4 NULL 75 100.00 Using where +1 SIMPLE t1 index a,b PRIMARY 4 NULL 73 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`a` between 9 and 10 or `test`.`t1`.`a` is null) and (`test`.`t1`.`b` between 9 and 10 or `test`.`t1`.`b` = 9) order by `test`.`t1`.`pk` limit 1 ANALYZE diff --git a/mysql-test/main/selectivity_innodb.result b/mysql-test/main/selectivity_innodb.result index 780cc8f5100..3797de29935 100644 --- a/mysql-test/main/selectivity_innodb.result +++ b/mysql-test/main/selectivity_innodb.result @@ -334,7 +334,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY customer eq_ref PRIMARY PRIMARY 4 dbt3_s001.orders.o_custkey 1 100.00 1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 dbt3_s001.orders.o_orderkey 1 100.00 1 PRIMARY lineitem ref PRIMARY,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey_quantity 4 dbt3_s001.orders.o_orderkey 4 100.00 Using index -2 MATERIALIZED lineitem index NULL PRIMARY 8 NULL 6005 100.00 +2 MATERIALIZED lineitem index NULL i_l_orderkey_quantity 13 NULL 6005 100.00 Using index Warnings: Note 1003 /* select#1 */ select `dbt3_s001`.`customer`.`c_name` AS `c_name`,`dbt3_s001`.`customer`.`c_custkey` AS `c_custkey`,`dbt3_s001`.`orders`.`o_orderkey` AS `o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE` AS `o_orderdate`,`dbt3_s001`.`orders`.`o_totalprice` AS `o_totalprice`,sum(`dbt3_s001`.`lineitem`.`l_quantity`) AS `sum(l_quantity)` from <materialize> (/* select#2 */ select `dbt3_s001`.`lineitem`.`l_orderkey` from `dbt3_s001`.`lineitem` group by `dbt3_s001`.`lineitem`.`l_orderkey` having sum(`dbt3_s001`.`lineitem`.`l_quantity`) > 250) join `dbt3_s001`.`customer` join `dbt3_s001`.`orders` join `dbt3_s001`.`lineitem` where `dbt3_s001`.`customer`.`c_custkey` = `dbt3_s001`.`orders`.`o_custkey` and `<subquery2>`.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey` and `dbt3_s001`.`lineitem`.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey` group by `dbt3_s001`.`customer`.`c_name`,`dbt3_s001`.`customer`.`c_custkey`,`dbt3_s001`.`orders`.`o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE`,`dbt3_s001`.`orders`.`o_totalprice` order by `dbt3_s001`.`orders`.`o_totalprice` desc,`dbt3_s001`.`orders`.`o_orderDATE` select @@ -368,7 +368,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY customer eq_ref PRIMARY PRIMARY 4 dbt3_s001.orders.o_custkey 1 100.00 1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 dbt3_s001.orders.o_orderkey 1 100.00 1 PRIMARY lineitem ref PRIMARY,i_l_orderkey,i_l_orderkey_quantity i_l_orderkey_quantity 4 dbt3_s001.orders.o_orderkey 4 100.00 Using index -2 MATERIALIZED lineitem index NULL PRIMARY 8 NULL 6005 100.00 +2 MATERIALIZED lineitem index NULL i_l_orderkey_quantity 13 NULL 6005 100.00 Using index Warnings: Note 1003 /* select#1 */ select `dbt3_s001`.`customer`.`c_name` AS `c_name`,`dbt3_s001`.`customer`.`c_custkey` AS `c_custkey`,`dbt3_s001`.`orders`.`o_orderkey` AS `o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE` AS `o_orderdate`,`dbt3_s001`.`orders`.`o_totalprice` AS `o_totalprice`,sum(`dbt3_s001`.`lineitem`.`l_quantity`) AS `sum(l_quantity)` from <materialize> (/* select#2 */ select `dbt3_s001`.`lineitem`.`l_orderkey` from `dbt3_s001`.`lineitem` group by `dbt3_s001`.`lineitem`.`l_orderkey` having sum(`dbt3_s001`.`lineitem`.`l_quantity`) > 250) join `dbt3_s001`.`customer` join `dbt3_s001`.`orders` join `dbt3_s001`.`lineitem` where `dbt3_s001`.`customer`.`c_custkey` = `dbt3_s001`.`orders`.`o_custkey` and `<subquery2>`.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey` and `dbt3_s001`.`lineitem`.`l_orderkey` = `dbt3_s001`.`orders`.`o_orderkey` group by `dbt3_s001`.`customer`.`c_name`,`dbt3_s001`.`customer`.`c_custkey`,`dbt3_s001`.`orders`.`o_orderkey`,`dbt3_s001`.`orders`.`o_orderDATE`,`dbt3_s001`.`orders`.`o_totalprice` order by `dbt3_s001`.`orders`.`o_totalprice` desc,`dbt3_s001`.`orders`.`o_orderDATE` select diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result index 7dbbd9079b5..cc25045767a 100644 --- a/mysql-test/suite/innodb/r/innodb_mysql.result +++ b/mysql-test/suite/innodb/r/innodb_mysql.result @@ -1407,13 +1407,13 @@ EXPLAIN SELECT * FROM t2 WHERE b=1 ORDER BY a; id 1 select_type SIMPLE table t2 -type ref +type index possible_keys bkey -key bkey -key_len 5 -ref const +key PRIMARY +key_len 4 +ref NULL rows 16 -Extra Using where; Using index; Using filesort +Extra Using where SELECT * FROM t2 WHERE b=1 ORDER BY a; a b c 1 1 1 diff --git a/mysql-test/suite/innodb/r/partition_locking.result b/mysql-test/suite/innodb/r/partition_locking.result index f25b8a15a24..b5e96f965b3 100644 --- a/mysql-test/suite/innodb/r/partition_locking.result +++ b/mysql-test/suite/innodb/r/partition_locking.result @@ -148,7 +148,7 @@ a b c d e 03 03 343 7 03_03_343 03 06 343 8 03_06_343 03 07 343 9 03_07_343 -SELECT a,count(b) FROM t1 GROUP BY a ORDER BY a LOCK IN SHARE MODE SKIP LOCKED; +SELECT a,count(b) FROM t1 force index (a) GROUP BY a ORDER BY a LOCK IN SHARE MODE SKIP LOCKED; a count(b) 01 5 03 3 diff --git a/mysql-test/suite/innodb/t/partition_locking.test b/mysql-test/suite/innodb/t/partition_locking.test index 13457c1d9be..c4e6bff9bbb 100644 --- a/mysql-test/suite/innodb/t/partition_locking.test +++ b/mysql-test/suite/innodb/t/partition_locking.test @@ -104,7 +104,7 @@ SELECT * FROM t1 LOCK IN SHARE MODE; --error ER_LOCK_WAIT_TIMEOUT SELECT * FROM t1 LOCK IN SHARE MODE NOWAIT; SELECT * FROM t1 ORDER BY d LOCK IN SHARE MODE SKIP LOCKED; -SELECT a,count(b) FROM t1 GROUP BY a ORDER BY a LOCK IN SHARE MODE SKIP LOCKED; +SELECT a,count(b) FROM t1 force index (a) GROUP BY a ORDER BY a LOCK IN SHARE MODE SKIP LOCKED; SELECT d,a,b,c FROM t1 partition (p1,p9,p11,p17) ORDER BY d LOCK IN SHARE MODE SKIP LOCKED; SELECT d,a,b,c FROM t1 ORDER BY d LOCK IN SHARE MODE SKIP LOCKED; diff --git a/mysql-test/suite/innodb_gis/r/create_spatial_index.result b/mysql-test/suite/innodb_gis/r/create_spatial_index.result index d3c69294c10..86634acaa01 100644 --- a/mysql-test/suite/innodb_gis/r/create_spatial_index.result +++ b/mysql-test/suite/innodb_gis/r/create_spatial_index.result @@ -57,6 +57,7 @@ ANALYZE TABLE tab; Table Op Msg_type Msg_text test.tab analyze status Engine-independent statistics collected test.tab analyze status OK +# Test the MBRContains SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -85,6 +86,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the MBRWithin SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -99,6 +101,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the ST_Crosses SET @g1 = ST_GeomFromText('POLYGON((100 200,200 300,400 500,500 300,300 200,100 300,100 200))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -127,6 +130,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the MBRDisjoint SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -149,6 +153,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where +# Test the MBREquals SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -166,7 +171,7 @@ id select_type table type possible_keys key key_len ref rows Extra SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort +1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) @@ -194,6 +199,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the Overelaps SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -222,10 +228,11 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where +# Test the ST_Touches SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort +1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) @@ -250,6 +257,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the MBRContains SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -278,6 +286,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the MBRDisjoint SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -300,6 +309,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where +# Test the MBREquals SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -314,10 +324,11 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the MBRintersects SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort +1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) @@ -345,6 +356,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the MBROverelaps SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -359,10 +371,11 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the MBRTouches SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort +1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) @@ -373,6 +386,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBRTouches(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +# Test with Procedure CREATE PROCEDURE proc_wl6968() BEGIN SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); @@ -388,6 +402,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the Delete & Update SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) @@ -486,6 +501,7 @@ ANALYZE TABLE tab; Table Op Msg_type Msg_text test.tab analyze status Engine-independent statistics collected test.tab analyze status OK +# Test the MBRContains SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -514,6 +530,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the MBRWithin SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -528,6 +545,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the ST_Crosses SET @g1 = ST_GeomFromText('POLYGON((100 200,200 300,400 500,500 300,300 200,100 300,100 200))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -556,6 +574,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the MBRDisjoint SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -578,6 +597,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where +# Test the MBREquals SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -592,6 +612,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the MBRintersects SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -623,6 +644,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the Overelaps SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -651,6 +673,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where +# Test the ST_Touches SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -679,6 +702,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the MBRContains SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -707,6 +731,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the MBRDisjoint SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -729,6 +754,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where +# Test the MBREquals SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -743,6 +769,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the MBRintersects SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -774,6 +801,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the MBROverelaps SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -788,6 +816,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the MBRTouches SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -802,6 +831,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBRTouches(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +# Test with Procedure CREATE PROCEDURE proc_wl6968() BEGIN SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); @@ -817,6 +847,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the Delete & Update SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) @@ -904,6 +935,7 @@ ANALYZE TABLE tab; Table Op Msg_type Msg_text test.tab analyze status Engine-independent statistics collected test.tab analyze status OK +# Test the MBRContains SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -932,6 +964,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the MBRWithin SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -946,6 +979,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the ST_Crosses SET @g1 = ST_GeomFromText('POLYGON((100 200,200 300,400 500,500 300,300 200,100 300,100 200))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -974,6 +1008,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the MBRDisjoint SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -996,6 +1031,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where +# Test the MBREquals SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -1010,10 +1046,11 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the MBRintersects SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort +1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) @@ -1041,6 +1078,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the Overelaps SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -1069,10 +1107,11 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where +# Test the ST_Touches SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort +1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) @@ -1097,6 +1136,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the MBRContains SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -1125,6 +1165,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the MBRDisjoint SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -1147,6 +1188,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab ALL idx3 NULL NULL NULL 10 Using where +# Test the MBREquals SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -1161,10 +1203,11 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the MBRintersects SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort +1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) @@ -1192,6 +1235,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the MBROverelaps SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra @@ -1206,10 +1250,11 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where +# Test the MBRTouches SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where; Using filesort +1 SIMPLE tab index idx3 PRIMARY 4 NULL 10 Using where SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) @@ -1220,6 +1265,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN DELETE FROM tab WHERE MBRTouches(tab.c4, @g1); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tab range idx3 idx3 34 NULL 2 Using where +# Test the Delete & Update SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) @@ -1243,6 +1289,7 @@ CHECK TABLE tab; Table Op Msg_type Msg_text test.tab check status OK DROP TABLE tab; +# Test check constraint on spatial column CREATE TABLE tab(c1 POINT NOT NULL,CONSTRAINT tab_const check(c1 > 0) ) ENGINE=InnoDB; ERROR HY000: Illegal parameter data types point and int for operation '>' CREATE TABLE tab(c1 POINT NOT NULL,CONSTRAINT tab_const check(CAST(c1 AS BINARY) > 0) ) ENGINE=InnoDB; diff --git a/mysql-test/suite/innodb_gis/t/create_spatial_index.test b/mysql-test/suite/innodb_gis/t/create_spatial_index.test index 5278292b56c..cdf317503d1 100644 --- a/mysql-test/suite/innodb_gis/t/create_spatial_index.test +++ b/mysql-test/suite/innodb_gis/t/create_spatial_index.test @@ -94,7 +94,7 @@ ANALYZE TABLE tab; # Check the spatial relationship between 2 GIS shapes -# Test the MBRContains +--echo # Test the MBRContains SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; @@ -117,7 +117,7 @@ WHERE MBRContains(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); -# Test the MBRWithin +--echo # Test the MBRWithin SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; @@ -129,7 +129,7 @@ WHERE MBRWithin(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); -# Test the ST_Crosses +--echo # Test the ST_Crosses SET @g1 = ST_GeomFromText('POLYGON((100 200,200 300,400 500,500 300,300 200,100 300,100 200))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; @@ -152,7 +152,7 @@ WHERE ST_Crosses(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); -# Test the MBRDisjoint +--echo # Test the MBRDisjoint SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; @@ -164,7 +164,7 @@ WHERE MBRDisjoint(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); -# Test the MBREquals +--echo # Test the MBREquals SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; @@ -176,7 +176,6 @@ WHERE MBREquals(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); -# Test the MBRintersects SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; @@ -199,7 +198,7 @@ WHERE MBRintersects(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); -# Test the Overelaps +--echo # Test the Overelaps SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; @@ -222,7 +221,7 @@ WHERE MBROverlaps(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); -# Test the ST_Touches +--echo # Test the ST_Touches SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; @@ -245,7 +244,7 @@ WHERE ST_Touches(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); -# Test the MBRContains +--echo # Test the MBRContains SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; @@ -268,7 +267,7 @@ WHERE MBRWithin(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); -# Test the MBRDisjoint +--echo # Test the MBRDisjoint SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; @@ -280,7 +279,7 @@ WHERE MBRDisjoint(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); -# Test the MBREquals +--echo # Test the MBREquals SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; @@ -292,7 +291,7 @@ WHERE MBREquals(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); -# Test the MBRintersects +--echo # Test the MBRintersects SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; @@ -315,7 +314,7 @@ WHERE MBRintersects(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); -# Test the MBROverelaps +--echo # Test the MBROverelaps SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; @@ -327,7 +326,7 @@ WHERE MBROverlaps(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); -# Test the MBRTouches +--echo # Test the MBRTouches SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; @@ -339,7 +338,7 @@ WHERE MBRTouches(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBRTouches(tab.c4, @g1); -# Test with Procedure +--echo # Test with Procedure delimiter |; CREATE PROCEDURE proc_wl6968() @@ -357,7 +356,7 @@ delimiter ;| CALL proc_wl6968(); -# Test the Delete & Update +--echo # Test the Delete & Update SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; @@ -478,7 +477,7 @@ ANALYZE TABLE tab; # Check the spatial relationship between 2 GIS shapes -# Test the MBRContains +--echo # Test the MBRContains SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; @@ -501,7 +500,7 @@ WHERE MBRContains(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); -# Test the MBRWithin +--echo # Test the MBRWithin SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; @@ -513,7 +512,7 @@ WHERE MBRWithin(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); -# Test the ST_Crosses +--echo # Test the ST_Crosses SET @g1 = ST_GeomFromText('POLYGON((100 200,200 300,400 500,500 300,300 200,100 300,100 200))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; @@ -536,7 +535,7 @@ WHERE ST_Crosses(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); -# Test the MBRDisjoint +--echo # Test the MBRDisjoint SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; @@ -548,7 +547,7 @@ WHERE MBRDisjoint(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); -# Test the MBREquals +--echo # Test the MBREquals SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; @@ -560,7 +559,7 @@ WHERE MBREquals(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); -# Test the MBRintersects +--echo # Test the MBRintersects SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; @@ -583,7 +582,7 @@ WHERE MBRintersects(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); -# Test the Overelaps +--echo # Test the Overelaps SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; @@ -606,7 +605,7 @@ WHERE MBROverlaps(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); -# Test the ST_Touches +--echo # Test the ST_Touches SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; @@ -629,7 +628,7 @@ WHERE ST_Touches(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); -# Test the MBRContains +--echo # Test the MBRContains SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; @@ -652,7 +651,7 @@ WHERE MBRWithin(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); -# Test the MBRDisjoint +--echo # Test the MBRDisjoint SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; @@ -664,7 +663,7 @@ WHERE MBRDisjoint(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); -# Test the MBREquals +--echo # Test the MBREquals SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; @@ -676,7 +675,7 @@ WHERE MBREquals(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); -# Test the MBRintersects +--echo # Test the MBRintersects SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; @@ -699,7 +698,7 @@ WHERE MBRintersects(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); -# Test the MBROverelaps +--echo # Test the MBROverelaps SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; @@ -711,7 +710,7 @@ WHERE MBROverlaps(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); -# Test the MBRTouches +--echo # Test the MBRTouches SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; @@ -723,7 +722,7 @@ WHERE MBRTouches(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBRTouches(tab.c4, @g1); -# Test with Procedure +--echo # Test with Procedure delimiter |; CREATE PROCEDURE proc_wl6968() @@ -741,7 +740,7 @@ delimiter ;| CALL proc_wl6968(); -# Test the Delete & Update +--echo # Test the Delete & Update SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; @@ -850,7 +849,7 @@ ANALYZE TABLE tab; # Check the spatial relationship between 2 GIS shapes -# Test the MBRContains +--echo # Test the MBRContains SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; @@ -873,7 +872,7 @@ WHERE MBRContains(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); -# Test the MBRWithin +--echo # Test the MBRWithin SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; @@ -885,7 +884,7 @@ WHERE MBRWithin(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); -# Test the ST_Crosses +--echo # Test the ST_Crosses SET @g1 = ST_GeomFromText('POLYGON((100 200,200 300,400 500,500 300,300 200,100 300,100 200))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; @@ -908,7 +907,7 @@ WHERE ST_Crosses(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); -# Test the MBRDisjoint +--echo # Test the MBRDisjoint SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; @@ -920,7 +919,7 @@ WHERE MBRDisjoint(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); -# Test the MBREquals +--echo # Test the MBREquals SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; @@ -932,7 +931,7 @@ WHERE MBREquals(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); -# Test the MBRintersects +--echo # Test the MBRintersects SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; @@ -955,7 +954,7 @@ WHERE MBRintersects(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); -# Test the Overelaps +--echo # Test the Overelaps SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; @@ -978,7 +977,7 @@ WHERE MBROverlaps(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); -# Test the ST_Touches +--echo # Test the ST_Touches SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; @@ -1001,7 +1000,7 @@ WHERE ST_Touches(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); -# Test the MBRContains +--echo # Test the MBRContains SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; @@ -1024,7 +1023,7 @@ WHERE MBRWithin(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); -# Test the MBRDisjoint +--echo # Test the MBRDisjoint SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; @@ -1036,7 +1035,7 @@ WHERE MBRDisjoint(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); -# Test the MBREquals +--echo # Test the MBREquals SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; @@ -1048,7 +1047,7 @@ WHERE MBREquals(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); -# Test the MBRintersects +--echo # Test the MBRintersects SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; @@ -1071,7 +1070,7 @@ WHERE MBRintersects(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); -# Test the MBROverelaps +--echo # Test the MBROverelaps SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; @@ -1083,7 +1082,7 @@ WHERE MBROverlaps(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); -# Test the MBRTouches +--echo # Test the MBRTouches SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; @@ -1095,7 +1094,7 @@ WHERE MBRTouches(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBRTouches(tab.c4, @g1); -# Test the Delete & Update +--echo # Test the Delete & Update SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; @@ -1124,7 +1123,7 @@ DROP TABLE tab; # End of Testcase compress table with Auto_increment -# Test check constraint on spatial column +--echo # Test check constraint on spatial column --error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION CREATE TABLE tab(c1 POINT NOT NULL,CONSTRAINT tab_const check(c1 > 0) ) ENGINE=InnoDB; CREATE TABLE tab(c1 POINT NOT NULL,CONSTRAINT tab_const check(CAST(c1 AS BINARY) > 0) ) ENGINE=InnoDB; |
