From 97cdd9df8a67a26335fba3ffbb9daca7b2877b10 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 11 Jul 2006 17:28:50 -0700 Subject: Bug #17766: The server accepts to create MERGE tables which cannot work Changed the error reporting (and a crash) when inserting data into a MERGE table that has no underlying tables or no INSERT_METHOD specified by reporting that it is read-only. include/my_base.h: Add new handler error mysql-test/r/merge.result: Update results mysql-test/t/merge.test: Add new regression test sql/ha_myisammrg.cc: When trying to insert into a MERGE table with no underlying tables or no INSERT_METHOD, report that it is read-only. sql/handler.cc: Handle new error message --- mysql-test/t/merge.test | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index 400279a826b..9a1980968c5 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -399,4 +399,19 @@ create table tm (b bit(1)) engine = merge union = (t1,t2); select * from tm; drop table tm, t1, t2; -# End of 5.0 tests +# +# Bug #17766: The server accepts to create MERGE tables which cannot work +# +create table t1 (a int) insert_method = last engine = merge; +--error ER_OPEN_AS_READONLY +insert into t1 values (1); +create table t2 (a int) engine = myisam; +alter table t1 union (t2); +insert into t1 values (1); +alter table t1 insert_method = no; +--error ER_OPEN_AS_READONLY +insert into t1 values (1); +drop table t2; +drop table t1; + +--echo End of 5.0 tests -- cgit v1.2.1 From abbf7ad01461284d8c92fbc385caa4b37fa50765 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 12 Jul 2006 16:33:29 -0700 Subject: Bug #17608: String literals lost during INSERT query on FEDERATED table The Federated storage engine used Field methods that had arbitrary limits on the amount of data they could process, which caused problems with data over that limit (4K). By removing those Field methods and just using features of the String class, we can avoid this problem. mysql-test/r/federated.result: Add new results mysql-test/t/federated.test: Add new regression test sql/field.cc: Remove unnecessary methods sql/field.h: Remove unnecessary methods sql/ha_federated.cc: Remove use of quote_data, use String::print() to get escaping of strings, and don't bother with needs_quotes, just always quote values. --- mysql-test/t/federated.test | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test index 773c9121af0..f504fec1c96 100644 --- a/mysql-test/t/federated.test +++ b/mysql-test/t/federated.test @@ -1425,4 +1425,22 @@ drop table t1; connection master; drop table t1; +# +# Bug #17608: String literals lost during INSERT query on FEDERATED table +# +connection slave; +create table t1 (a longblob not null); +connection master; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create table t1 + (a longblob not null) engine=federated + connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1'; +insert into t1 values (repeat('a',5000)); +select length(a) from t1; +connection slave; +select length(a) from t1; +drop table t1; +connection master; +drop table t1; + source include/federated_cleanup.inc; -- cgit v1.2.1 From 469813c7f3022035a1e577abbd21c44827b4cf6c Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Jul 2006 16:45:04 -0700 Subject: "BUG #18764: Delete conditions causing inconsistencies in Federated tables" Removed logic in ha_federated::write_row, which checks field query ids in the loop which builds the query to run on the remote server. mysql-test/r/federated.result: "BUG #18764: Delete conditions causing inconsistencies in Federated tables" New test results for test that verifies that one can insert to rows using "insert into... select * from..", delete them by id, then immediately insert them in the same way they were originally inserted. mysql-test/t/federated.test: "BUG #18764: Delete conditions causing inconsistencies in Federated tables" New test that verifies that one can insert to rows using "insert into... select * from..", delete them by id, then immediately insert them in the same way they were originally inserted. sql/ha_federated.cc: "BUG #18764: Delete conditions causing inconsistencies in Federated tables" Removed the logic in ha_federated::write_row which checked the query id of each field and compared it to the thread query id. Each field has a query id, and the problem used to be that if I did an insert no fields specified, the field value would contain the last inserted value for that field. The way to work around this was to see if the query id for that field was the same as the current query id or of the rest of the field query ids. If it wasn't, that told me the query didn't have the field value specified. Somewhere from when I wrote that code to now the problem went away, and there was no longer the need for this logic. Also removed the bool "has_fields", which needs not exist and using table->s->fields is sufficient. --- mysql-test/t/federated.test | 57 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'mysql-test/t') diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test index a8b16edc80a..d6efb870e55 100644 --- a/mysql-test/t/federated.test +++ b/mysql-test/t/federated.test @@ -1365,4 +1365,61 @@ drop table federated.t1, federated.t2; connection slave; drop table federated.t1, federated.t2; +# +# BUG #18764: Delete conditions causing inconsistencies in Federated tables +# +connection slave; +--disable_warnings +DROP TABLE IF EXISTS federated.test; +--enable_warnings +CREATE TABLE federated.test ( + `id` int(11) NOT NULL, + `val1` varchar(255) NOT NULL, + `val2` varchar(255) NOT NULL, + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +connection master; +--disable_warnings +DROP TABLE IF EXISTS federated.test_local; +DROP TABLE IF EXISTS federated.test_remote; +--enable_warnings +CREATE TABLE federated.test_local ( + `id` int(11) NOT NULL, + `val1` varchar(255) NOT NULL, + `val2` varchar(255) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +INSERT INTO federated.test_local VALUES (1, 'foo', 'bar'), +(2, 'bar', 'foo'); + +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.test_remote ( + `id` int(11) NOT NULL, + `val1` varchar(255) NOT NULL, + `val2` varchar(255) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=FEDERATED DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/test'; + +insert into federated.test_remote select * from federated.test_local; + +select * from federated.test_remote; + +delete from federated.test_remote where id in (1,2); + +insert into federated.test_remote select * from federated.test_local; + +select * from federated.test_remote; +--disable_warnings +DROP TABLE federated.test_local; +DROP TABLE federated.test_remote; +--enable_warnings + +connection slave; +--disable_warnings +DROP TABLE federated.test; +--enable_warnings + source include/federated_cleanup.inc; -- cgit v1.2.1 From 9378fc627ecaf22d47bfd0de1c192953c96d5159 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 18 Jul 2006 18:41:36 -0700 Subject: "BUG #18764: Delete conditions causing inconsistencies in Federated tables" Post merge changes. --- mysql-test/t/federated.test | 1 - 1 file changed, 1 deletion(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test index bed168f5b8f..38beab605fd 100644 --- a/mysql-test/t/federated.test +++ b/mysql-test/t/federated.test @@ -1416,7 +1416,6 @@ select * from federated.test_remote; DROP TABLE federated.test_local; DROP TABLE federated.test_remote; --enable_warnings - connection slave; --disable_warnings DROP TABLE federated.test; -- cgit v1.2.1