summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgkodinov@dl145s.mysql.com <>2006-10-19 16:00:06 +0200
committergkodinov@dl145s.mysql.com <>2006-10-19 16:00:06 +0200
commitea8ba0355651d52f692a34a63cde87b412629c52 (patch)
treebbd21ba07f3e7194fe45e8183786bd87b47aeb6d
parent9aa346bb26c76914889ec8b3ee3cea99f1f76925 (diff)
parent6633173d5156797b406e94730cdae2814361d308 (diff)
downloadmariadb-git-ea8ba0355651d52f692a34a63cde87b412629c52.tar.gz
Merge dl145s.mysql.com:/data/bk/team_tree_merge/mysql-5.1
into dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.1-opt
-rw-r--r--mysql-test/r/gis-rtree.result11
-rw-r--r--mysql-test/r/view.result10
-rw-r--r--mysql-test/t/gis-rtree.test10
-rw-r--r--mysql-test/t/view.test16
-rw-r--r--sql/table.cc5
-rw-r--r--storage/myisam/mi_range.c15
6 files changed, 64 insertions, 3 deletions
diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result
index 92fcbfcdc9e..dbd6783fe76 100644
--- a/mysql-test/r/gis-rtree.result
+++ b/mysql-test/r/gis-rtree.result
@@ -862,3 +862,14 @@ CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
+CREATE TABLE t1 (foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) );
+INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,1)));
+INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,0)));
+INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,1)));
+INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,0)));
+SELECT 1 FROM t1 WHERE foo != PointFromWKB(POINT(0,0));
+1
+1
+1
+1
+DROP TABLE t1;
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 2fa467727f1..ed31ade9d33 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -2956,4 +2956,14 @@ View Create View
v1 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`pk` AS `pk` from (`t1` join `t2` on(((`t2`.`fk` = `t1`.`pk`) and (`t2`.`ver` = (select max(`t`.`ver`) AS `MAX(t.ver)` from `t2` `t` where (`t`.`org` = `t2`.`org`))))))
DROP VIEW v1;
DROP TABLE t1, t2;
+CREATE TABLE t1(id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, val INT UNSIGNED NOT NULL);
+CREATE VIEW v1 AS SELECT id, val FROM t1 WHERE val >= 1 AND val <= 5 WITH CHECK OPTION;
+INSERT INTO v1 (val) VALUES (2);
+INSERT INTO v1 (val) VALUES (4);
+INSERT INTO v1 (val) VALUES (6);
+ERROR HY000: CHECK OPTION failed 'test.v1'
+UPDATE v1 SET val=6 WHERE id=2;
+ERROR HY000: CHECK OPTION failed 'test.v1'
+DROP VIEW v1;
+DROP TABLE t1;
End of 5.0 tests.
diff --git a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test
index 163f2806ad2..09cdcb2435e 100644
--- a/mysql-test/t/gis-rtree.test
+++ b/mysql-test/t/gis-rtree.test
@@ -231,4 +231,14 @@ INSERT INTO t1 (c1) VALUES (
CHECK TABLE t1 EXTENDED;
DROP TABLE t1;
+#
+# Bug #21888: Query on GEOMETRY field using PointFromWKB() results in lost connection
+#
+CREATE TABLE t1 (foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) );
+INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,1)));
+INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(1,0)));
+INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,1)));
+INSERT INTO t1 (foo) VALUES (PointFromWKB(POINT(0,0)));
+SELECT 1 FROM t1 WHERE foo != PointFromWKB(POINT(0,0));
+DROP TABLE t1;
# End of 4.1 tests
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 0eadb33c3e1..f6615914005 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -2856,7 +2856,6 @@ EXPLAIN SELECT * FROM v1 t WHERE t.s1+1 < (SELECT MAX(t1.s1) FROM t1);
DROP VIEW v1;
DROP TABLE t1;
-#
# Bug #5505: Wrong error message on INSERT into a view
#
create table t1 (s1 int);
@@ -2884,4 +2883,19 @@ SHOW CREATE VIEW v1;
DROP VIEW v1;
DROP TABLE t1, t2;
+
+#
+# Bug #16813 (WITH CHECK OPTION doesn't work with UPDATE)
+#
+CREATE TABLE t1(id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, val INT UNSIGNED NOT NULL);
+CREATE VIEW v1 AS SELECT id, val FROM t1 WHERE val >= 1 AND val <= 5 WITH CHECK OPTION;
+INSERT INTO v1 (val) VALUES (2);
+INSERT INTO v1 (val) VALUES (4);
+-- error 1369
+INSERT INTO v1 (val) VALUES (6);
+-- error 1369
+UPDATE v1 SET val=6 WHERE id=2;
+DROP VIEW v1;
+DROP TABLE t1;
+
--echo End of 5.0 tests.
diff --git a/sql/table.cc b/sql/table.cc
index 1877e3f926c..8505b15459b 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -2787,12 +2787,13 @@ bool st_table_list::prep_where(THD *thd, Item **conds,
this expression will not be moved to WHERE condition (i.e. will
be clean correctly for PS/SP)
*/
- tbl->on_expr= and_conds(tbl->on_expr, where);
+ tbl->on_expr= and_conds(tbl->on_expr,
+ where->copy_andor_structure(thd));
break;
}
}
if (tbl == 0)
- *conds= and_conds(*conds, where);
+ *conds= and_conds(*conds, where->copy_andor_structure(thd));
if (arena)
thd->restore_active_arena(arena, &backup);
where_processed= TRUE;
diff --git a/storage/myisam/mi_range.c b/storage/myisam/mi_range.c
index e78f3b11625..a28aed81aec 100644
--- a/storage/myisam/mi_range.c
+++ b/storage/myisam/mi_range.c
@@ -71,6 +71,21 @@ ha_rows mi_records_in_range(MI_INFO *info, int inx, key_range *min_key,
uchar * key_buff;
uint start_key_len;
+ /*
+ The problem is that the optimizer doesn't support
+ RTree keys properly at the moment.
+ Hope this will be fixed some day.
+ But now NULL in the min_key means that we
+ didn't make the task for the RTree key
+ and expect BTree functionality from it.
+ As it's not able to handle such request
+ we return the error.
+ */
+ if (!min_key)
+ {
+ res= HA_POS_ERROR;
+ break;
+ }
key_buff= info->lastkey+info->s->base.max_key_length;
start_key_len= _mi_pack_key(info,inx, key_buff,
(uchar*) min_key->key, min_key->length,