From 4f58bd7e94b86bc88215a68fd896fba5a2b5f909 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 18 May 2005 17:30:11 +0500 Subject: a fix (bug #10539: When inserting out of range value in BIT, different engines behaves differently). sql/field.cc: a fix (bug #10539: When inserting out of range value in BIT, different engines behaves differently). we have to set the first byte only if there is(are) uneven bit(s). --- mysql-test/r/type_bit.result | 8 ++++++++ mysql-test/t/type_bit.test | 9 +++++++++ 2 files changed, 17 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/type_bit.result b/mysql-test/r/type_bit.result index 64c9a11b3cd..4d9bc0c7fe1 100644 --- a/mysql-test/r/type_bit.result +++ b/mysql-test/r/type_bit.result @@ -458,3 +458,11 @@ select h from t1; h a drop table t1; +create table t1 (a bit(8)) engine=heap; +insert into t1 values ('1111100000'); +Warnings: +Warning 1264 Out of range value adjusted for column 'a' at row 1 +select a+0 from t1; +a+0 +255 +drop table t1; diff --git a/mysql-test/t/type_bit.test b/mysql-test/t/type_bit.test index 19d16f95990..2df5f0ed05d 100644 --- a/mysql-test/t/type_bit.test +++ b/mysql-test/t/type_bit.test @@ -162,3 +162,12 @@ create table t1 (a int, b time, c tinyint, d bool, e char(10), f bit(1), insert into t1 set a=1; select h from t1; drop table t1; + +# +# Bug #10539 +# + +create table t1 (a bit(8)) engine=heap; +insert into t1 values ('1111100000'); +select a+0 from t1; +drop table t1; -- cgit v1.2.1 From 77b83ce69a98717b1b354ea7cb062b16a68282d8 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 May 2005 16:48:56 +0200 Subject: ndb - mysqltestrun run ndb_select_all --no-defaults mysql-test/t/ndb_restore.test: run ndb_select_all --no-defaults --- mysql-test/t/ndb_restore.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mysql-test') diff --git a/mysql-test/t/ndb_restore.test b/mysql-test/t/ndb_restore.test index 0c3babd54e4..454171d9938 100644 --- a/mysql-test/t/ndb_restore.test +++ b/mysql-test/t/ndb_restore.test @@ -213,4 +213,4 @@ drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c; # Test BUG#10287 # ---exec $NDB_TOOLS_DIR/ndb_select_all -d sys -D , SYSTAB_0 | grep 520093696 +--exec $NDB_TOOLS_DIR/ndb_select_all --no-defaults -d sys -D , SYSTAB_0 | grep 520093696 -- cgit v1.2.1 From 6ae9eb48d517a096ef5de054b71706f9c5351e65 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 May 2005 12:21:15 -0700 Subject: Increase limit of partial key length in MEMORY storage engine to the same as a full key. (Bug #10566) mysql-test/r/heap.result: Update results mysql-test/t/heap.test: Add test for bug #10566 sql/ha_heap.h: Add max_supported_key_part_length() method. --- mysql-test/r/heap.result | 5 +++++ mysql-test/t/heap.test | 9 +++++++++ 2 files changed, 14 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result index 29207a4ae98..53dec294ef8 100644 --- a/mysql-test/r/heap.result +++ b/mysql-test/r/heap.result @@ -291,3 +291,8 @@ a b 1 7 1 8 drop table t1; +create table t1 (c char(255), primary key(c(90))); +insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); +insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); +ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 1 +drop table t1; diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test index e082993a58e..c0977819487 100644 --- a/mysql-test/t/heap.test +++ b/mysql-test/t/heap.test @@ -224,3 +224,12 @@ insert t1 (a) values (1); insert t1 (a) values (1); select * from t1; drop table t1; + +# +# Bug #10566: Verify that we can create a prefixed key with length > 255 +# +create table t1 (c char(255), primary key(c(90))); +insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); +--error 1062 +insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); +drop table t1; -- cgit v1.2.1 From f0329bfb8c9215272cc176c874f79d14a02d20fa Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 May 2005 18:11:47 -0700 Subject: Fix partial keys when converting VARCHAR to TEXT. (Bug #10543) mysql-test/r/type_varchar.result: Update results mysql-test/t/type_varchar.test: Add new regression test sql/field.cc: Add Field::type_can_have_key_part() static method sql/field.h: Add Field::type_can_have_key_part() signature. sql/sql_table.cc: Only reset the length of a key part when changing from a field type that can't be used partially to a field that can, or vice versa, or when the part is smaller than the length of the field. --- mysql-test/r/type_varchar.result | 23 +++++++++++++++++++++++ mysql-test/t/type_varchar.test | 12 ++++++++++++ 2 files changed, 35 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/type_varchar.result b/mysql-test/r/type_varchar.result index 3bd7fe6b175..fed03cd8d71 100644 --- a/mysql-test/r/type_varchar.result +++ b/mysql-test/r/type_varchar.result @@ -392,3 +392,26 @@ group by t1.b, t1.a; a b min(t1.b) 22 NULL NULL drop table t1, t2; +create table t1 (f1 varchar(65500)); +create index index1 on t1(f1(10)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` varchar(65500) default NULL, + KEY `index1` (`f1`(10)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +alter table t1 modify f1 varchar(255); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` varchar(255) default NULL, + KEY `index1` (`f1`(10)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +alter table t1 modify f1 tinytext; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` tinytext, + KEY `index1` (`f1`(10)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; diff --git a/mysql-test/t/type_varchar.test b/mysql-test/t/type_varchar.test index 2bffca6b889..1a3a93018a4 100644 --- a/mysql-test/t/type_varchar.test +++ b/mysql-test/t/type_varchar.test @@ -118,3 +118,15 @@ insert into t2 values (22), (22); select t1.a, t1.b, min(t1.b) from t1 inner join t2 ON t2.a = t1.a group by t1.b, t1.a; drop table t1, t2; + +# +# Bug #10543: convert varchar with index to text +# +create table t1 (f1 varchar(65500)); +create index index1 on t1(f1(10)); +show create table t1; +alter table t1 modify f1 varchar(255); +show create table t1; +alter table t1 modify f1 tinytext; +show create table t1; +drop table t1; -- cgit v1.2.1 From af8cbbaec5cab3b3bbce3a0af423d9725c33f3f0 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 May 2005 16:41:53 -0700 Subject: Fix '%h', '%I', and '%l' format specifiers in TIME_FORMAT() to handle large time values as documented. (Bug #10590) mysql-test/r/func_time.result: Add new results mysql-test/t/func_time.test: Add new regression test sql/item_timefunc.cc: Fix handling of '%h', '%I', and '%l' format specifiers for TIME_FORMAT() to handle large time values correctly. --- mysql-test/r/func_time.result | 3 +++ mysql-test/t/func_time.test | 6 ++++++ 2 files changed, 9 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 4293ef5bd85..239fca65b67 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -688,3 +688,6 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select timestamp_diff(WEEK,_latin1'2001-02-01',_latin1'2001-05-01') AS `a1`,timestamp_diff(SECOND_FRAC,_latin1'2001-02-01 12:59:59.120000',_latin1'2001-05-01 12:58:58.119999') AS `a2` +select time_format('100:00:00', '%H %k %h %I %l'); +time_format('100:00:00', '%H %k %h %I %l') +100 100 04 04 4 diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 80ddb205110..34da2ae1435 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -336,3 +336,9 @@ DROP TABLE t1; explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1, timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2; + +# +# Bug #10590: %h, %I, and %l format specifies should all return results in +# the 0-11 range +# +select time_format('100:00:00', '%H %k %h %I %l'); -- cgit v1.2.1 From e2285c541b027503e3040a85fc618f9c6357a91e Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 May 2005 20:48:40 +0300 Subject: Fixed bug in multiple-table-delete where some rows was not deleted mysql-test/r/delete.result: Test case for bug in multiple-table-delete where some rows was not deleted mysql-test/t/delete.test: Test case for bug in multiple-table-delete where some rows was not deleted sql/item_subselect.cc: Code cleanup sql/opt_range.cc: Code cleanup sql/sql_delete.cc: Fixed bug in multiple-table-delete where some rows was not deleted This happend when the first table-to-delete-from was not the the table that was scanned. Fixed this by only doing 'delete-on-the-fly' for the first table. Fixed also some wrong error handling in multi-table-delete --- mysql-test/r/delete.result | 22 +++++++++++++++++++++- mysql-test/t/delete.test | 19 ++++++++++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result index 411cd52b4ca..ddfeeac77b5 100644 --- a/mysql-test/r/delete.result +++ b/mysql-test/r/delete.result @@ -1,4 +1,4 @@ -drop table if exists t1,t11,t12,t2; +drop table if exists t1,t2,t3,t11,t12; CREATE TABLE t1 (a tinyint(3), b tinyint(5)); INSERT INTO t1 VALUES (1,1); INSERT LOW_PRIORITY INTO t1 VALUES (1,2); @@ -172,3 +172,23 @@ a 0 2 DROP TABLE t1; +CREATE TABLE t1 (a int not null,b int not null); +CREATE TABLE t2 (a int not null, b int not null, primary key (a,b)); +CREATE TABLE t3 (a int not null, b int not null, primary key (a,b)); +insert into t1 values (1,1),(2,1),(1,3); +insert into t2 values (1,1),(2,2),(3,3); +insert into t3 values (1,1),(2,1),(1,3); +select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b; +a b a b a b +1 1 1 1 1 1 +2 1 2 2 2 1 +1 3 1 1 1 3 +explain select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 +1 SIMPLE t2 index PRIMARY PRIMARY 8 NULL 3 Using where; Using index +1 SIMPLE t3 index PRIMARY PRIMARY 8 NULL 3 Using where; Using index +delete t2.*,t3.* from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b; +select * from t3; +a b +drop table t1,t2,t3; diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test index a6335d77a0c..265089adfa2 100644 --- a/mysql-test/t/delete.test +++ b/mysql-test/t/delete.test @@ -3,7 +3,7 @@ # --disable_warnings -drop table if exists t1,t11,t12,t2; +drop table if exists t1,t2,t3,t11,t12; --enable_warnings CREATE TABLE t1 (a tinyint(3), b tinyint(5)); INSERT INTO t1 VALUES (1,1); @@ -152,3 +152,20 @@ INSERT INTO t1 VALUES (0),(1),(2); DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a LIMIT 1; SELECT * FROM t1; DROP TABLE t1; + +# +# Test of multi-delete where we are not scanning the first table +# + +CREATE TABLE t1 (a int not null,b int not null); +CREATE TABLE t2 (a int not null, b int not null, primary key (a,b)); +CREATE TABLE t3 (a int not null, b int not null, primary key (a,b)); +insert into t1 values (1,1),(2,1),(1,3); +insert into t2 values (1,1),(2,2),(3,3); +insert into t3 values (1,1),(2,1),(1,3); +select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b; +explain select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b; +delete t2.*,t3.* from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b; +# This should be empty +select * from t3; +drop table t1,t2,t3; -- cgit v1.2.1 From 44af4dbdf12f32ee5cb2be6d747c02b32912bf06 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Jun 2005 17:09:46 +0500 Subject: A fix (bug #10568: Function 'LAST_DAY(date)' does not return NULL for invalid argument). sql/item_timefunc.cc: A fix (bug #10568: Function 'LAST_DAY(date)' does not return NULL for invalid argument). Return error for partial dates as well. --- mysql-test/r/func_time.result | 15 +++++++++++++++ mysql-test/t/func_time.test | 8 ++++++++ 2 files changed, 23 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 4293ef5bd85..58f9271dce9 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -688,3 +688,18 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select timestamp_diff(WEEK,_latin1'2001-02-01',_latin1'2001-05-01') AS `a1`,timestamp_diff(SECOND_FRAC,_latin1'2001-02-01 12:59:59.120000',_latin1'2001-05-01 12:58:58.119999') AS `a2` +select last_day('2005-00-00'); +last_day('2005-00-00') +NULL +Warnings: +Warning 1292 Truncated incorrect datetime value: '2005-00-00' +select last_day('2005-00-01'); +last_day('2005-00-01') +NULL +Warnings: +Warning 1292 Truncated incorrect datetime value: '2005-00-01' +select last_day('2005-01-00'); +last_day('2005-01-00') +NULL +Warnings: +Warning 1292 Truncated incorrect datetime value: '2005-01-00' diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 80ddb205110..b44215c97b1 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -336,3 +336,11 @@ DROP TABLE t1; explain extended select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a1, timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a2; + +# +# Bug #10568 +# + +select last_day('2005-00-00'); +select last_day('2005-00-01'); +select last_day('2005-01-00'); -- cgit v1.2.1 From 906b210a4a51a91416d553cb744bc9c22d0bd942 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Jun 2005 16:35:09 +0300 Subject: Code cleanups during code reviews Ensure we get error if INSERT IGNORE ... SELECT fails Fixed wrong key_part->key_length usage in index_merge client/mysql.cc: Code cleanups & simply optimizations mysql-test/r/information_schema.result: Safety mysql-test/t/information_schema.test: Safety sql/ha_ndbcluster.cc: Code cleanups sql/item.cc: Code cleanups sql/item_subselect.cc: Code cleanups sql/item_sum.cc: Code cleanups sql/opt_range.cc: Made get_index_only_read_time() static (instad of inline) to increase portability (function was not declared before use) Simple optimization Fixed wrong key_part->key_length usage in index_merge Removed not used variable n_used_covered Indentation fixes & comment cleanups sql/parse_file.cc: Code cleanups sql/sql_base.cc: Code cleanups sql/sql_bitmap.h: Added missing return sql/sql_insert.cc: Ensure we get error if INSERT IGNORE ... SELECT fails sql/sql_select.cc: Code cleanups sql/sql_show.cc: Safety fix if a LOT of errors are ignored sql/sql_update.cc: Code cleanups sql/table.cc: Code cleanups sql/table.h: Code cleanups sql/uniques.cc: Code cleanups strings/decimal.c: Simple optimization Code cleanups --- mysql-test/r/information_schema.result | 1 + mysql-test/t/information_schema.test | 5 +++++ 2 files changed, 6 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 872d1f6ea7f..de1f265aedf 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -1,3 +1,4 @@ +DROP TABLE IF EXISTS t0,t1,t2; show variables where variable_name like "skip_show_database"; Variable_name Value skip_show_database OFF diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 05dfeb67ccc..1a6e41dba69 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -4,6 +4,11 @@ # Test for information_schema.schemata & # show databases +--disable_warnings +DROP TABLE IF EXISTS t0,t1,t2; +--enable_warnings + + show variables where variable_name like "skip_show_database"; grant select, update, execute on test.* to mysqltest_2@localhost; grant select, update on test.* to mysqltest_1@localhost; -- cgit v1.2.1 From a88d3cc149e4686bcca7b655d3ddaa437c42168e Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 2 Jun 2005 15:33:53 +0500 Subject: Fix for bug#10964: Information Schema:Authorization check on(2nd version, after review) privilege tables is improper added privilege check for USER_PRIVILEGES, SCHEMA_PRIVILEGES, TABLE_PRIVILEGES, COLUMN_PRIVILEGES tables --- mysql-test/r/information_schema.result | 70 ++++++++++++++++++++++++++++++++++ mysql-test/t/information_schema.test | 44 +++++++++++++++++++++ 2 files changed, 114 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 872d1f6ea7f..5caf16c4f25 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -752,3 +752,73 @@ SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHE table_schema count(*) information_schema 15 mysql 17 +create database mysqltest; +create table mysqltest.t1 (f1 int, f2 int); +create table mysqltest.t2 (f1 int); +grant select (f1) on mysqltest.t1 to user1@localhost; +grant select on mysqltest.t2 to user2@localhost; +grant select on mysqltest.* to user3@localhost; +grant select on *.* to user4@localhost; +select * from information_schema.column_privileges; +GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE +'user1'@'localhost' NULL mysqltest t1 f1 SELECT NO +select * from information_schema.table_privileges; +GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE +select * from information_schema.schema_privileges; +GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE +select * from information_schema.user_privileges; +GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE +'user1'@'localhost' NULL USAGE NO +show grants; +Grants for user1@localhost +GRANT USAGE ON *.* TO 'user1'@'localhost' +GRANT SELECT (f1) ON `mysqltest`.`t1` TO 'user1'@'localhost' +select * from information_schema.column_privileges; +GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE +select * from information_schema.table_privileges; +GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE +'user2'@'localhost' NULL mysqltest t2 SELECT NO +select * from information_schema.schema_privileges; +GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE +select * from information_schema.user_privileges; +GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE +'user2'@'localhost' NULL USAGE NO +show grants; +Grants for user2@localhost +GRANT USAGE ON *.* TO 'user2'@'localhost' +GRANT SELECT ON `mysqltest`.`t2` TO 'user2'@'localhost' +select * from information_schema.column_privileges; +GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE +select * from information_schema.table_privileges; +GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE +select * from information_schema.schema_privileges; +GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE +'user3'@'localhost' NULL mysqltest SELECT NO +select * from information_schema.user_privileges; +GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE +'user3'@'localhost' NULL USAGE NO +show grants; +Grants for user3@localhost +GRANT USAGE ON *.* TO 'user3'@'localhost' +GRANT SELECT ON `mysqltest`.* TO 'user3'@'localhost' +select * from information_schema.column_privileges where grantee like '%user%'; +GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE +'user1'@'localhost' NULL mysqltest t1 f1 SELECT NO +select * from information_schema.table_privileges where grantee like '%user%'; +GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE +'user2'@'localhost' NULL mysqltest t2 SELECT NO +select * from information_schema.schema_privileges where grantee like '%user%'; +GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE +'user3'@'localhost' NULL mysqltest SELECT NO +select * from information_schema.user_privileges where grantee like '%user%'; +GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE +'user1'@'localhost' NULL USAGE NO +'user2'@'localhost' NULL USAGE NO +'user3'@'localhost' NULL USAGE NO +'user4'@'localhost' NULL SELECT NO +show grants; +Grants for user4@localhost +GRANT SELECT ON *.* TO 'user4'@'localhost' +drop user user1@localhost, user2@localhost, user3@localhost, user4@localhost; +use test; +drop database mysqltest; diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 05dfeb67ccc..d8cbf3b031f 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -493,3 +493,47 @@ flush privileges; # SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA; +# +# Bug #10964 Information Schema:Authorization check on privilege tables is improper +# + +create database mysqltest; +create table mysqltest.t1 (f1 int, f2 int); +create table mysqltest.t2 (f1 int); +grant select (f1) on mysqltest.t1 to user1@localhost; +grant select on mysqltest.t2 to user2@localhost; +grant select on mysqltest.* to user3@localhost; +grant select on *.* to user4@localhost; + +connect (con1,localhost,user1,,); +connect (con2,localhost,user2,,); +connect (con3,localhost,user3,,); +connect (con4,localhost,user4,,); +connection con1; +select * from information_schema.column_privileges; +select * from information_schema.table_privileges; +select * from information_schema.schema_privileges; +select * from information_schema.user_privileges; +show grants; +connection con2; +select * from information_schema.column_privileges; +select * from information_schema.table_privileges; +select * from information_schema.schema_privileges; +select * from information_schema.user_privileges; +show grants; +connection con3; +select * from information_schema.column_privileges; +select * from information_schema.table_privileges; +select * from information_schema.schema_privileges; +select * from information_schema.user_privileges; +show grants; +connection con4; +select * from information_schema.column_privileges where grantee like '%user%'; +select * from information_schema.table_privileges where grantee like '%user%'; +select * from information_schema.schema_privileges where grantee like '%user%'; +select * from information_schema.user_privileges where grantee like '%user%'; +show grants; +connection default; +drop user user1@localhost, user2@localhost, user3@localhost, user4@localhost; +use test; +drop database mysqltest; -- cgit v1.2.1 From dd8e174fa6a07ebf21a3b0a03883d2be694b827b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 2 Jun 2005 10:00:36 -0700 Subject: Additional tweak to fix for bug #10543, to prevent a change in behavior when extending fields that were fully part of a multi-part key. mysql-test/r/key.result: Update results mysql-test/t/key.test: Add test for behavior of extending fields in a multi-part key that were defined with a partial length the same as their field length. sql/sql_table.cc: Reset key_part_length when old field length was the same as the old key_part_length. --- mysql-test/r/key.result | 25 +++++++++++++++++++++++++ mysql-test/t/key.test | 13 +++++++++++++ 2 files changed, 38 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result index 98e8851bb7e..3ad8571aadd 100644 --- a/mysql-test/r/key.result +++ b/mysql-test/r/key.result @@ -329,3 +329,28 @@ ERROR 42S21: Duplicate column name 'c1' alter table t1 add key (c1,c1,c2); ERROR 42S21: Duplicate column name 'c1' drop table t1; +create table t1 (a varchar(10), b varchar(10), key(a(10),b(10))); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) default NULL, + `b` varchar(10) default NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +alter table t1 modify b varchar(20); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) default NULL, + `b` varchar(20) default NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +alter table t1 modify a varchar(20); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(20) default NULL, + `b` varchar(20) default NULL, + KEY `a` (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; diff --git a/mysql-test/t/key.test b/mysql-test/t/key.test index af3509c8454..9db1523be51 100644 --- a/mysql-test/t/key.test +++ b/mysql-test/t/key.test @@ -324,3 +324,16 @@ alter table t1 add key (c1,c2,c1); --error 1060 alter table t1 add key (c1,c1,c2); drop table t1; + +# +# If we use a partial field for a key that is actually the length of the +# field, and we extend the field, we end up with a key that includes the +# whole new length of the field. +# +create table t1 (a varchar(10), b varchar(10), key(a(10),b(10))); +show create table t1; +alter table t1 modify b varchar(20); +show create table t1; +alter table t1 modify a varchar(20); +show create table t1; +drop table t1; -- cgit v1.2.1 From f956ecd09a4897b5f7e65a0441445a52406a3a8a Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 3 Jun 2005 17:13:43 +0200 Subject: Bug #10901 Analyze table corrupts the state on data_file_length, records, index_file_length... by writing the shared state when there is an updated internal state due to inserts or deletes Fixed by synching the shared state with the internal state before writing it to disk Added test cases of 2 error cases and a normal case in new analyze test case BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- mysql-test/r/analyze.result | 32 ++++++++++++++++++++++++++++++++ mysql-test/t/analyze.test | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 mysql-test/r/analyze.result create mode 100644 mysql-test/t/analyze.test (limited to 'mysql-test') diff --git a/mysql-test/r/analyze.result b/mysql-test/r/analyze.result new file mode 100644 index 00000000000..0b44a502b13 --- /dev/null +++ b/mysql-test/r/analyze.result @@ -0,0 +1,32 @@ +create table t1 (a bigint); +lock tables t1 write; +insert into t1 values(0); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +unlock tables; +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; +create table t1 (a bigint); +insert into t1 values(0); +lock tables t1 write; +delete from t1; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +unlock tables; +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; +create table t1 (a bigint); +insert into t1 values(0); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; diff --git a/mysql-test/t/analyze.test b/mysql-test/t/analyze.test new file mode 100644 index 00000000000..faf30279c68 --- /dev/null +++ b/mysql-test/t/analyze.test @@ -0,0 +1,39 @@ +# +# Bug #10901 Analyze Table on new table destroys table +# This is minimal test case to get error +# The problem was that analyze table wrote the shared state to the file and this +# didn't include the inserts while locked. A check was needed to ensure that +# state information was not updated when executing analyze table for a locked table. +# The analyze table had to be within locks and check table had to be after unlocking +# since then it brings the wrong state from disk rather than from the currently +# correct internal state. The insert is needed since it changes the file state, +# number of records. +# The fix is to synchronise the state of the shared state and the current state before +# calling mi_state_info_write +# +create table t1 (a bigint); +lock tables t1 write; +insert into t1 values(0); +analyze table t1; +unlock tables; +check table t1; + +drop table t1; + +create table t1 (a bigint); +insert into t1 values(0); +lock tables t1 write; +delete from t1; +analyze table t1; +unlock tables; +check table t1; + +drop table t1; + +create table t1 (a bigint); +insert into t1 values(0); +analyze table t1; +check table t1; + +drop table t1; + -- cgit v1.2.1 From 8e0760e7fb46f68b412eac0af5b580ee11c691c6 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 3 Jun 2005 18:20:25 +0200 Subject: - include/config-win.h: removed double HAVE_CHARSET_cp932 #define - mysql-test/Makefile.am: added a pattern match for t/*.sql (t/mysql_delimiter.sql was missing from the source distribution) include/config-win.h: - removed double HAVE_CHARSET_cp932 #define mysql-test/Makefile.am: - added a pattern match for t/*.sql (t/mysql_delimiter.sql was missing from the source distribution) --- mysql-test/Makefile.am | 1 + 1 file changed, 1 insertion(+) (limited to 'mysql-test') diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index 9963074daf5..a5e3f7977ee 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -48,6 +48,7 @@ dist-hook: mkdir -p $(distdir)/t $(distdir)/r $(distdir)/include \ $(distdir)/std_data $(distdir)/lib $(INSTALL_DATA) $(srcdir)/t/*.test $(distdir)/t + $(INSTALL_DATA) $(srcdir)/t/*.sql $(distdir)/t -$(INSTALL_DATA) $(srcdir)/t/*.disabled $(distdir)/t $(INSTALL_DATA) $(srcdir)/t/*.opt $(srcdir)/t/*.sh $(srcdir)/t/*.slave-mi $(distdir)/t $(INSTALL_DATA) $(srcdir)/include/*.inc $(distdir)/include -- cgit v1.2.1 From 7509b50054bbcb6d703f6ce41972d1533614b221 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 3 Jun 2005 21:08:45 +0200 Subject: after merge fixes --- mysql-test/r/create.result | 14 +++++++++++--- mysql-test/t/create.test | 7 +++++-- 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 103bed598ef..a4f5cc517b3 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -497,9 +497,9 @@ drop database mysqltest; select database(); database() NULL -select database(); -database() -NULL +select database(), user(); +database() user() +NULL mysqltest_1@localhost use test; create table t1 (a int, index `primary` (a)); ERROR 42000: Incorrect index name 'primary' @@ -563,3 +563,11 @@ select * from t2; b 1 drop table t1,t2; +create table t1 (a int); +create table t1 select * from t1; +ERROR HY000: You can't specify target table 't1' for update in FROM clause +create table t2 union = (t1) select * from t1; +ERROR HY000: You can't specify target table 't1' for update in FROM clause +flush tables with read lock; +unlock tables; +drop table t1; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 2ba726f29e2..4644d3db5c5 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -403,8 +403,11 @@ drop database mysqltest; select database(); # Connect without a database -connect (user4,localhost,mysqltest_1,,*NO-ONE*); -select database(); +connect (user1,localhost,mysqltest_1,,*NO-ONE*); +connection user1; +select database(), user(); +connection default; +disconnect user1; # # Test for Bug 856 'Naming a key "Primary" causes trouble' -- cgit v1.2.1 From 72dd44b9dede604b0ffc9acb2458ffde405212af Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 3 Jun 2005 23:46:03 +0300 Subject: Move USE_PRAGMA_IMPLEMENTATION to proper place Ensure that 'null_value' is not accessed before val() is called in FIELD() functions Fixed initialization of key maps. This fixes some problems with keys when you have more than 64 keys Fixed that ROLLUP don't always create a temporary table. This fix ensures that func_gconcat.test results are now predictable mysql-test/r/func_gconcat.result: Move innodb specific test to innodb.test Changed table name r2 -> t2 More test to see how ROLLUP was optimized mysql-test/r/innodb.result: Moved test here form func_gconcat mysql-test/r/olap.result: New test results after optimization mysql-test/t/func_gconcat.test: Move innodb specific test to innodb.test Changed table name r2 -> t2 More test to see how ROLLUP was optimized mysql-test/t/innodb.test: Moved test here form func_gconcat sql/field.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/ha_berkeley.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/ha_blackhole.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/ha_heap.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/ha_innodb.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/ha_isam.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/ha_isammrg.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/ha_myisam.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/ha_myisammrg.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/ha_ndbcluster.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/handler.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/hash_filo.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/item.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/item_cmpfunc.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/item_func.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place Ensure that 'null_value' is not accessed before val() is called sql/item_geofunc.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/item_strfunc.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/item_subselect.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/item_sum.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/item_timefunc.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/item_uniq.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/log_event.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/mysql_priv.h: Change key_map_full to not be const as we are giving it a proper value on startup sql/mysqld.cc: Move key_map variables here and initialize key_map_full properly sql/opt_range.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/opt_range.h: Fix that test_quick_select() works with any ammount of keys sql/procedure.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/protocol.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/protocol_cursor.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/set_var.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/sql_analyse.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/sql_class.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/sql_crypt.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/sql_insert.cc: Fixed that max_rows is ulong sql/sql_list.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/sql_map.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/sql_olap.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/sql_select.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place Fixed that ROLLUP don't have to always create a temporary table Added new argument to remove_const() to make above possible Fixed some errors that creapt up when we don't always do a temporary table for ROLLUP sql/sql_string.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/sql_table.cc: Simple optimizations Fixed wrong checking of build_table_path() in undef-ed code sql/sql_udf.cc: Move USE_PRAGMA_IMPLEMENTATION to proper place sql/sql_yacc.yy: removed extra {} --- mysql-test/r/func_gconcat.result | 37 +++++++++++++++++++------------------ mysql-test/r/innodb.result | 12 ++++++++++++ mysql-test/r/olap.result | 2 +- mysql-test/t/func_gconcat.test | 27 +++++++-------------------- mysql-test/t/innodb.test | 15 +++++++++++++++ 5 files changed, 54 insertions(+), 39 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index 057822839fa..7a256edc91a 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -343,18 +343,6 @@ GROUP_CONCAT(b ORDER BY b) First Row Second Row DROP TABLE t1; -CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1; -INSERT INTO t1 VALUES (1),(2),(3); -CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a), -CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1; -INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2); -SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz; -a_id b_list -1 1,2,3 -2 4,5 -3 NULL -DROP TABLE t2; -DROP TABLE t1; CREATE TABLE t1 (A_ID INT NOT NULL,A_DESC CHAR(3) NOT NULL,PRIMARY KEY (A_ID)); INSERT INTO t1 VALUES (1,'ABC'), (2,'EFG'), (3,'HIJ'); CREATE TABLE t2 (A_ID INT NOT NULL,B_DESC CHAR(3) NOT NULL,PRIMARY KEY (A_ID,B_DESC)); @@ -462,15 +450,28 @@ SELECT GROUP_CONCAT(id) AS gc FROM t1 HAVING gc IS NULL; gc NULL DROP TABLE t1; -create table r2 (a int, b int); -insert into r2 values (1,1), (2,2); -select b x, (select group_concat(x) from r2) from r2; -x (select group_concat(x) from r2) +create table t2 (a int, b int); +insert into t2 values (1,1), (2,2); +select b x, (select group_concat(x) from t2) from t2; +x (select group_concat(x) from t2) 1 1,1 2 2,2 -drop table r2; -create table t1 (d int, a int, b int, c int); +drop table t2; +create table t1 (d int not null auto_increment,primary key(d), a int, b int, c int); insert into t1(a,b) values (1,3), (1,4), (1,2), (2,7), (1,1), (1,2), (2,3), (2,3); +select d,a,b from t1 order by a; +d a b +1 1 3 +2 1 4 +3 1 2 +5 1 1 +6 1 2 +4 2 7 +7 2 3 +8 2 3 +explain select a, group_concat(b) from t1 group by a with rollup; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using filesort select a, group_concat(b) from t1 group by a with rollup; a group_concat(b) 1 3,4,2,1,2 diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 4c983014d4b..3d7e99fa7bc 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1647,3 +1647,15 @@ CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB; SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE); ERROR HY000: The used table type doesn't support FULLTEXT indexes DROP TABLE t1; +CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES (1),(2),(3); +CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a), +CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2); +SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz; +a_id b_list +1 1,2,3 +2 4,5 +3 NULL +DROP TABLE t2; +DROP TABLE t1; diff --git a/mysql-test/r/olap.result b/mysql-test/r/olap.result index ab84fa5739a..0c6c4684853 100644 --- a/mysql-test/r/olap.result +++ b/mysql-test/r/olap.result @@ -83,7 +83,7 @@ TV NULL NULL 600 NULL NULL NULL 7785 explain extended select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using temporary; Using filesort +1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using filesort Warnings: Note 1003 select test.t1.product AS `product`,test.t1.country_id AS `country_id`,test.t1.year AS `year`,sum(test.t1.profit) AS `sum(profit)` from test.t1 group by test.t1.product,test.t1.country_id,test.t1.year with rollup select product, country_id , sum(profit) from t1 group by product desc, country_id with rollup; diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index 485e8ba143c..5f02db7707c 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -213,21 +213,6 @@ INSERT INTO t1 VALUES (1,'First Row'), (2,'Second Row'); SELECT GROUP_CONCAT(b ORDER BY b) FROM t1 GROUP BY a; DROP TABLE t1; -# -# check null values #1 -# - ---disable_warnings -CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1; -INSERT INTO t1 VALUES (1),(2),(3); -CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a), - CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1; ---enable_warnings -INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2); -SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz; -DROP TABLE t2; -DROP TABLE t1; - # # check null values #2 # @@ -288,17 +273,19 @@ DROP TABLE t1; # # Bug #8656: Crash with group_concat on alias in outer table # -create table r2 (a int, b int); -insert into r2 values (1,1), (2,2); -select b x, (select group_concat(x) from r2) from r2; -drop table r2; +create table t2 (a int, b int); +insert into t2 values (1,1), (2,2); +select b x, (select group_concat(x) from t2) from t2; +drop table t2; # # Bug #7405: problems with rollup # -create table t1 (d int, a int, b int, c int); +create table t1 (d int not null auto_increment,primary key(d), a int, b int, c int); insert into t1(a,b) values (1,3), (1,4), (1,2), (2,7), (1,1), (1,2), (2,3), (2,3); +select d,a,b from t1 order by a; +explain select a, group_concat(b) from t1 group by a with rollup; select a, group_concat(b) from t1 group by a with rollup; select a, group_concat(distinct b) from t1 group by a with rollup; select a, group_concat(b order by b) from t1 group by a with rollup; diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index 201489c0ddb..1ce95811fc3 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -1187,3 +1187,18 @@ CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB; --error 1214; SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE); DROP TABLE t1; + +# +# check null values #1 +# + +--disable_warnings +CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES (1),(2),(3); +CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a), + CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1; +--enable_warnings +INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2); +SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz; +DROP TABLE t2; +DROP TABLE t1; -- cgit v1.2.1 From 61c12aa299890bfbde8d8726c623c7af4eee5ec6 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 4 Jun 2005 07:15:11 +0200 Subject: after mergemerge --- mysql-test/r/create.result | 8 ++++++++ mysql-test/t/create.test | 4 +--- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index b9dda435b11..de3840447dc 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -563,6 +563,14 @@ select * from t2; b 1 drop table t1,t2; +create table t1 (a int); +create table t1 select * from t1; +ERROR HY000: You can't specify target table 't1' for update in FROM clause +create table t2 union = (t1) select * from t1; +ERROR HY000: You can't specify target table 't1' for update in FROM clause +flush tables with read lock; +unlock tables; +drop table t1; create table t1(column.name int); ERROR 42000: Incorrect table name 'column' create table t1(test.column.name int); diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index a08603f8efb..b73cd28c71c 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -408,12 +408,12 @@ connection user1; select database(), user(); connection default; disconnect user1; +use test; # # Test for Bug 856 'Naming a key "Primary" causes trouble' # -use test; --error 1280 create table t1 (a int, index `primary` (a)); --error 1280 @@ -470,8 +470,6 @@ drop table t1,t2; # This tests two additional possible errors and a hang if # an improper fix is present. # -connection default; -use test; create table t1 (a int); --error 1093 create table t1 select * from t1; -- cgit v1.2.1 From d6e0883b070cbb66a3dc94384816835964025aba Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 4 Jun 2005 14:58:32 +0400 Subject: Fix show warnings limit 0 and show warnings limit 0, 0. Add test coverage for SHOW WARNINGS LIMIT a, b; mysql-test/r/warnings.result: Add test coverage for SHOW WARNINGS LIMIT a,b mysql-test/t/warnings.test: Add test coverage for SHOW WARNINGS LIMIT a,b sql/sql_error.cc: Fix show warnings limit 0 and show warnings limit 0, 0 --- mysql-test/r/warnings.result | 53 ++++++++++++++++++++++++++++++++++++++++++++ mysql-test/t/warnings.test | 22 ++++++++++++++++++ 2 files changed, 75 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index d1d96afa153..e97b309547a 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -179,3 +179,56 @@ drop table t1; set table_type=MYISAM; Warnings: Warning 1287 'table_type' is deprecated; use 'storage_engine' instead +create table t1 (a int); +insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +update t1 set a='abc'; +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +Warning 1265 Data truncated for column 'a' at row 2 +Warning 1265 Data truncated for column 'a' at row 3 +Warning 1265 Data truncated for column 'a' at row 4 +Warning 1265 Data truncated for column 'a' at row 5 +Warning 1265 Data truncated for column 'a' at row 6 +Warning 1265 Data truncated for column 'a' at row 7 +Warning 1265 Data truncated for column 'a' at row 8 +Warning 1265 Data truncated for column 'a' at row 9 +Warning 1265 Data truncated for column 'a' at row 10 +show warnings limit 2, 1; +Level Code Message +Warning 1265 Data truncated for column 'a' at row 3 +show warnings limit 0, 10; +Level Code Message +Warning 1265 Data truncated for column 'a' at row 1 +Warning 1265 Data truncated for column 'a' at row 2 +Warning 1265 Data truncated for column 'a' at row 3 +Warning 1265 Data truncated for column 'a' at row 4 +Warning 1265 Data truncated for column 'a' at row 5 +Warning 1265 Data truncated for column 'a' at row 6 +Warning 1265 Data truncated for column 'a' at row 7 +Warning 1265 Data truncated for column 'a' at row 8 +Warning 1265 Data truncated for column 'a' at row 9 +Warning 1265 Data truncated for column 'a' at row 10 +show warnings limit 9, 1; +Level Code Message +Warning 1265 Data truncated for column 'a' at row 10 +show warnings limit 10, 1; +Level Code Message +show warnings limit 9, 2; +Level Code Message +Warning 1265 Data truncated for column 'a' at row 10 +show warnings limit 0, 0; +Level Code Message +show warnings limit 1; +Level Code Message +Warning 1265 Data truncated for column 'a' at row 1 +show warnings limit 0; +Level Code Message +show warnings limit 1, 0; +Level Code Message +select * from t1 limit 0; +a +select * from t1 limit 1, 0; +a +select * from t1 limit 0, 0; +a +drop table t1; diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test index 2a90f5f637d..6a6d533ad61 100644 --- a/mysql-test/t/warnings.test +++ b/mysql-test/t/warnings.test @@ -133,3 +133,25 @@ drop table t1; # Test for deprecated table_type variable # set table_type=MYISAM; + +# +# Tests for show warnings limit a, b +# +create table t1 (a int); +insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +# should generate 10 warnings +update t1 set a='abc'; +show warnings limit 2, 1; +show warnings limit 0, 10; +show warnings limit 9, 1; +show warnings limit 10, 1; +show warnings limit 9, 2; +show warnings limit 0, 0; +show warnings limit 1; +show warnings limit 0; +show warnings limit 1, 0; +# make sure behaviour is consistent with select ... limit +select * from t1 limit 0; +select * from t1 limit 1, 0; +select * from t1 limit 0, 0; +drop table t1; -- cgit v1.2.1 From b08b3a1555c296e4e396fd968a268b7b3dd58397 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jun 2005 17:01:20 +0300 Subject: Cleanup during review Simple optimization for 2 argument usage to function of variable arguments Fix stack overrun when using 1+1+1+1+1+1+1+.... Update crash-me results for 5.0 Don't call post_open if pre_open() fails (optimization) sql-bench/limits/mysql-4.1.cfg: Rename: sql-bench/limits/mysql.cfg -> sql-bench/limits/mysql-4.1.cfg libmysql/libmysql.c: More portable define mysql-test/mysql-test-run.sh: Write also InnoDB warnings to warnings.log mysql-test/t/type_newdecimal.test: Don't get errors if innodb is not defined mysys/my_alloc.c: Cleanup comments mysys/thr_lock.c: Cleanup comments sql/item.h: Remove not needed initializer sql/item_func.cc: Simple optimization for 2 argument usage to function of variable arguments sql/mysql_priv.h: We use more stackspace with the introduction of int_op() etc. This change ensures we don't run out of stack when doing 1+1+1+1... (Tested on x86, 32 bit) sql/sp_head.cc: Don't call post_open if pre_open() fails sql/sp_rcontext.cc: More comments Change so that post_open() doesn't have to be called if pre_open() fails sql/sql_parse.cc: Fold long lines sql/sql_select.cc: Simple reorganization to reduce number of if's Ensure that table_map is updated for where clause (fixed warning from valgrind) --- mysql-test/mysql-test-run.sh | 2 +- mysql-test/t/type_newdecimal.test | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'mysql-test') diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 45b1e948ac2..bdd92e7941b 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -887,7 +887,7 @@ report_stats () { found_error=0 # Find errors - for i in "^Warning:" "^Error:" "^==.* at 0x" + for i in "^Warning:" "^Error:" "^==.* at 0x" "InnoDB: Warning" do if $GREP "$i" $MY_LOG_DIR/warnings.tmp >> $MY_LOG_DIR/warnings then diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index 9b09c415379..0f7d20ed977 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -911,7 +911,9 @@ DROP TABLE t1; # Bug #10465 # +--disable_warnings CREATE TABLE t1 (GRADE DECIMAL(4) NOT NULL, PRIMARY KEY (GRADE)) ENGINE=INNODB; +--enable_warnings INSERT INTO t1 (GRADE) VALUES (151),(252),(343); SELECT GRADE FROM t1 WHERE GRADE > 160 AND GRADE < 300; SELECT GRADE FROM t1 WHERE GRADE= 151; -- cgit v1.2.1 From bfac85343fde7ad4ffbc0bd54d9f36053d574f69 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Jun 2005 20:10:47 +0200 Subject: mtr_misc.pl, mtr_report.pl: Try kill all children to the mysql-test-run process when exiting mtr_process.pl: Added new function mtr_exit() that try kill all children to the mysql-test-run process when exiting mysql-test-run.pl: Try kill all children to the mysql-test-run process when exiting New --vardir caused problems on Windows Changed faulty calls to error() to mtr_error() mysql-test/mysql-test-run.pl: Try kill all children to the mysql-test-run process when exiting New --vardir caused problems on Windows Changed faulty calls to error() to mtr_error() mysql-test/lib/mtr_report.pl: Try kill all children to the mysql-test-run process when exiting mysql-test/lib/mtr_process.pl: Added new function mtr_exit() that try kill all children to the mysql-test-run process when exiting mysql-test/lib/mtr_misc.pl: Try kill all children to the mysql-test-run process when exiting --- mysql-test/lib/mtr_misc.pl | 2 +- mysql-test/lib/mtr_process.pl | 14 ++++++++++++++ mysql-test/lib/mtr_report.pl | 3 ++- mysql-test/mysql-test-run.pl | 14 ++++++++------ 4 files changed, 25 insertions(+), 8 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl index 5f80864d1f7..efa1b3bec21 100644 --- a/mysql-test/lib/mtr_misc.pl +++ b/mysql-test/lib/mtr_misc.pl @@ -25,7 +25,7 @@ sub mtr_full_hostname () { if ( $hostname !~ /\./ ) { my $address= gethostbyname($hostname) - or die "Couldn't resolve $hostname : $!"; + or mtr_error("Couldn't resolve $hostname : $!"); my $fullname= gethostbyaddr($address, AF_INET); $hostname= $fullname if $fullname; } diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl index 78758e54aa4..7bca422773c 100644 --- a/mysql-test/lib/mtr_process.pl +++ b/mysql-test/lib/mtr_process.pl @@ -17,6 +17,7 @@ sub mtr_spawn ($$$$$$); sub mtr_stop_mysqld_servers ($); sub mtr_kill_leftovers (); sub mtr_record_dead_children (); +sub mtr_exit ($); sub sleep_until_file_created ($$$); # static in C @@ -784,4 +785,17 @@ sub sleep_until_file_created ($$$) { } +############################################################################## +# +# When we exit, we kill off all children +# +############################################################################## + +sub mtr_exit ($) { + my $code= shift; + local $SIG{HUP} = 'IGNORE'; + kill('HUP', -$$); + exit($code); +} + 1; diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl index cb41549422f..a258d139bb1 100644 --- a/mysql-test/lib/mtr_report.pl +++ b/mysql-test/lib/mtr_report.pl @@ -268,7 +268,8 @@ sub mtr_warning (@) { } sub mtr_error (@) { - die "mysql-test-run: *** ERROR: ",join(" ", @_),"\n"; + print STDERR "mysql-test-run: *** ERROR: ",join(" ", @_),"\n"; + mtr_exit(1); } sub mtr_debug (@) { diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 9d809593ea7..d4fb37c2f96 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -398,7 +398,7 @@ sub main () { } } - exit(0); + mtr_exit(0); } ############################################################################## @@ -568,7 +568,9 @@ sub command_line_setup () { $opt_vardir= "$glob_mysql_test_dir/var"; } - if ( $opt_vardir !~ m,^/, ) + # We make the path absolute, as the server will do a chdir() before usage + unless ( $opt_vardir =~ m,^/, or + ($glob_win32 and $opt_vardir =~ m,^[a-z]:/,i) ) { # Make absolute path, relative test dir $opt_vardir= "$glob_mysql_test_dir/$opt_vardir"; @@ -1295,9 +1297,9 @@ sub install_db ($$) { mtr_report("Installing \u$type Databases"); open(IN, $init_db_sql) - or error("Can't open $init_db_sql: $!"); + or mtr_error("Can't open $init_db_sql: $!"); open(OUT, ">", $init_db_sql_tmp) - or error("Can't write to $init_db_sql_tmp: $!"); + or mtr_error("Can't write to $init_db_sql_tmp: $!"); while () { chomp; @@ -1571,7 +1573,7 @@ sub report_failure_and_restart ($) { { stop_masters_slaves(); } - exit(1); + mtr_exit(1); } # FIXME always terminate on failure?! @@ -2270,5 +2272,5 @@ Options not yet described, or that I want to look into more with-openssl HERE - exit(1); + mtr_exit(1); } -- cgit v1.2.1 From cdb905ead54b502d50bd86246939156c64556971 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 6 Jun 2005 14:03:33 +0300 Subject: Fixed wrong key length when using MIN() optimization (non fatal, but caused InnoDB to write warnings to the log file) This fixed bug #11039: InnoDB: Warning: using a partial-field key prefix in search mysql-test/r/innodb.result: Added extra test for bug #11039: InnoDB: Warning: using a partial-field key prefix in search mysql-test/t/innodb.test: Added extra test for bug #11039: InnoDB: Warning: using a partial-field key prefix in search sql/opt_sum.cc: Fixed wrong key length when using MIN() optimization --- mysql-test/r/innodb.result | 9 +++++++++ mysql-test/t/innodb.test | 10 ++++++++++ 2 files changed, 19 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 424543ba4b9..91b01f8e8e6 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -2401,3 +2401,12 @@ CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB; SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE); ERROR HY000: The used table type doesn't support FULLTEXT indexes DROP TABLE t1; +create table t1 (a char(1), b char(1), key(a, b)) engine=innodb; +insert into t1 values ('8', '6'), ('4', '7'); +select min(a) from t1; +min(a) +4 +select min(b) from t1 where a='8'; +min(b) +6 +drop table t1; diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index dc9645a8326..6c685796b2c 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -1319,3 +1319,13 @@ CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB; --error 1214; SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE); DROP TABLE t1; + +# +# BUG#11039 Wrong key length in min() +# + +create table t1 (a char(1), b char(1), key(a, b)) engine=innodb; +insert into t1 values ('8', '6'), ('4', '7'); +select min(a) from t1; +select min(b) from t1 where a='8'; +drop table t1; -- cgit v1.2.1 From e7300f13465e8e218351f61a4bef6b8133ed79b4 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 6 Jun 2005 16:54:15 +0500 Subject: Bug#8610: The ucs2_turkish_ci collation fails with upper('i') UPPER/LOWER now can return a string with different length. mi_test1.c: Adding new arguments. Many files: Changeing caseup/casedn to return a result with different length than argument. sql_string.h: Removing unused method, mysql_priv.h: Removing unused method strings/ctype-big5.c: Changeing caseup/casedn to return a result with different length than argument. strings/ctype-bin.c: Changeing caseup/casedn to return a result with different length than argument. strings/ctype-cp932.c: Changeing caseup/casedn to return a result with different length than argument. strings/ctype-czech.c: Changeing caseup/casedn to return a result with different length than argument. strings/ctype-euc_kr.c: Changeing caseup/casedn to return a result with different length than argument. strings/ctype-extra.c: Changeing caseup/casedn to return a result with different length than argument. strings/ctype-eucjpms.c: Changeing caseup/casedn to return a result with different length than argument. strings/ctype-gb2312.c: Changeing caseup/casedn to return a result with different length than argument. strings/ctype-gbk.c: Changeing caseup/casedn to return a result with different length than argument. strings/ctype-latin1.c: Changeing caseup/casedn to return a result with different length than argument. strings/ctype-mb.c: Changeing caseup/casedn to return a result with different length than argument. strings/ctype-simple.c: Changeing caseup/casedn to return a result with different length than argument. strings/ctype-sjis.c: Changeing caseup/casedn to return a result with different length than argument. strings/ctype-tis620.c: Changeing caseup/casedn to return a result with different length than argument. strings/ctype-uca.c: Changeing caseup/casedn to return a result with different length than argument. strings/ctype-ucs2.c: Changeing caseup/casedn to return a result with different length than argument. strings/ctype-ujis.c: Changeing caseup/casedn to return a result with different length than argument. strings/ctype-utf8.c: Changeing caseup/casedn to return a result with different length than argument. strings/ctype-win1250ch.c: Changeing caseup/casedn to return a result with different length than argument. sql/item_strfunc.cc: Changeing caseup/casedn to return a result with different length than argument. sql/item_strfunc.h: Changeing caseup/casedn to return a result with different length than argument. sql/mysql_priv.h: Removing unused method sql/sql_string.h: Removing unused method, client/sql_string.h: Changeing caseup/casedn to return a result with different length than argument. include/m_ctype.h: Changeing caseup/casedn to return a result with different length than argument. myisam/mi_test1.c: Adding new arguments. mysql-test/r/ctype_uca.result: UPPER/LOWER now can return a string with different length. mysql-test/t/ctype_uca.test: UPPER/LOWER now can return a string with different length. --- mysql-test/r/ctype_uca.result | 24 ++++++++++++++++++++++++ mysql-test/t/ctype_uca.test | 15 +++++++++++++++ 2 files changed, 39 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/ctype_uca.result b/mysql-test/r/ctype_uca.result index c6e803904a3..3803dd932d7 100644 --- a/mysql-test/r/ctype_uca.result +++ b/mysql-test/r/ctype_uca.result @@ -2396,3 +2396,27 @@ utf8_unicode_ci 6109 utf8_unicode_ci 61 utf8_unicode_ci 6120 drop table t1; +CREATE TABLE t1 (id int, a varchar(30) character set utf8); +INSERT INTO t1 VALUES (1, _ucs2 0x01310069), (2, _ucs2 0x01310131); +INSERT INTO t1 VALUES (3, _ucs2 0x00690069), (4, _ucs2 0x01300049); +INSERT INTO t1 VALUES (5, _ucs2 0x01300130), (6, _ucs2 0x00490049); +SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu +FROM t1 ORDER BY id; +a la l ll u lu +ıi 3 ıi 3 II 2 +ıı 4 ıı 4 II 2 +ii 2 ii 2 II 2 +İI 3 ii 2 İI 3 +İİ 4 ii 2 İİ 4 +II 2 ii 2 II 2 +ALTER TABLE t1 MODIFY a VARCHAR(30) character set utf8 collate utf8_turkish_ci; +SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu +FROM t1 ORDER BY id; +a la l ll u lu +ıi 3 ıi 3 Iİ 3 +ıı 4 ıı 4 II 2 +ii 2 ii 2 İİ 4 +İI 3 iı 3 İI 3 +İİ 4 ii 2 İİ 4 +II 2 ıı 4 II 2 +DROP TABLE t1; diff --git a/mysql-test/t/ctype_uca.test b/mysql-test/t/ctype_uca.test index dfca82fa70a..e5c2acc8b4e 100644 --- a/mysql-test/t/ctype_uca.test +++ b/mysql-test/t/ctype_uca.test @@ -455,3 +455,18 @@ drop table t1; SET collation_connection='utf8_unicode_ci'; -- source include/ctype_filesort.inc + +# +# Check UPPER/LOWER changeing length +# +# Result shorter than argument +CREATE TABLE t1 (id int, a varchar(30) character set utf8); +INSERT INTO t1 VALUES (1, _ucs2 0x01310069), (2, _ucs2 0x01310131); +INSERT INTO t1 VALUES (3, _ucs2 0x00690069), (4, _ucs2 0x01300049); +INSERT INTO t1 VALUES (5, _ucs2 0x01300130), (6, _ucs2 0x00490049); +SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu +FROM t1 ORDER BY id; +ALTER TABLE t1 MODIFY a VARCHAR(30) character set utf8 collate utf8_turkish_ci; +SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu +FROM t1 ORDER BY id; +DROP TABLE t1; -- cgit v1.2.1 From 3b808af0fde8ded69be27d430a2594bf6d546776 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 6 Jun 2005 06:05:11 -0700 Subject: sp.test, sp.result: Added a test case for bug #6866. sql_select.cc: Fixed bug #6866. Bug was due to the fact that on_expr was not backed up for the second execution of the stored procedure. sql/sql_select.cc: Fixed bug #6866. Bug was due to the fact that on_expr was not backed up for the second execution of the stored procedure. mysql-test/r/sp.result: Added a test case for bug #6866. mysql-test/t/sp.test: Added a test case for bug #6866. --- mysql-test/r/sp.result | 40 ++++++++++++++++++++++++++++++++++++++++ mysql-test/t/sp.test | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 3c6fa84882f..ff8092d1e01 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -3138,4 +3138,44 @@ x x 3 drop procedure bug10961| +DROP PROCEDURE IF EXISTS bug6866| +DROP VIEW IF EXISTS tv| +Warnings: +Note 1051 Unknown table 'test.tv' +DROP TABLE IF EXISTS tt1,tt2,tt3| +Warnings: +Note 1051 Unknown table 'tt1' +Note 1051 Unknown table 'tt2' +Note 1051 Unknown table 'tt3' +CREATE TABLE tt1 (a1 int, a2 int, a3 int, data varchar(10))| +CREATE TABLE tt2 (a2 int, data2 varchar(10))| +CREATE TABLE tt3 (a3 int, data3 varchar(10))| +INSERT INTO tt1 VALUES (1, 1, 4, 'xx')| +INSERT INTO tt2 VALUES (1, 'a')| +INSERT INTO tt2 VALUES (2, 'b')| +INSERT INTO tt2 VALUES (3, 'c')| +INSERT INTO tt3 VALUES (4, 'd')| +INSERT INTO tt3 VALUES (5, 'e')| +INSERT INTO tt3 VALUES (6, 'f')| +CREATE VIEW tv AS +SELECT tt1.*, tt2.data2, tt3.data3 +FROM tt1 INNER JOIN tt2 ON tt1.a2 = tt2.a2 +LEFT JOIN tt3 ON tt1.a3 = tt3.a3 +ORDER BY tt1.a1, tt2.a2, tt3.a3| +CREATE PROCEDURE bug6866 (_a1 int) +BEGIN +SELECT * FROM tv WHERE a1 = _a1; +END| +CALL bug6866(1)| +a1 a2 a3 data data2 data3 +1 1 4 xx a d +CALL bug6866(1)| +a1 a2 a3 data data2 data3 +1 1 4 xx a d +CALL bug6866(1)| +a1 a2 a3 data data2 data3 +1 1 4 xx a d +DROP PROCEDURE bug6866; +DROP VIEW tv| +DROP TABLE tt1, tt2, tt3| drop table t1,t2; diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 7acd4d81081..57d5d2939e1 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -3848,6 +3848,50 @@ call bug10961()| drop procedure bug10961| +# +# BUG #6866: Second call of a stored procedure using a view with on expressions +# + +--disable_warnings +DROP PROCEDURE IF EXISTS bug6866| +--enable_warnings + +DROP VIEW IF EXISTS tv| +DROP TABLE IF EXISTS tt1,tt2,tt3| + +CREATE TABLE tt1 (a1 int, a2 int, a3 int, data varchar(10))| +CREATE TABLE tt2 (a2 int, data2 varchar(10))| +CREATE TABLE tt3 (a3 int, data3 varchar(10))| + +INSERT INTO tt1 VALUES (1, 1, 4, 'xx')| + +INSERT INTO tt2 VALUES (1, 'a')| +INSERT INTO tt2 VALUES (2, 'b')| +INSERT INTO tt2 VALUES (3, 'c')| + +INSERT INTO tt3 VALUES (4, 'd')| +INSERT INTO tt3 VALUES (5, 'e')| +INSERT INTO tt3 VALUES (6, 'f')| + +CREATE VIEW tv AS +SELECT tt1.*, tt2.data2, tt3.data3 + FROM tt1 INNER JOIN tt2 ON tt1.a2 = tt2.a2 + LEFT JOIN tt3 ON tt1.a3 = tt3.a3 + ORDER BY tt1.a1, tt2.a2, tt3.a3| + +CREATE PROCEDURE bug6866 (_a1 int) +BEGIN +SELECT * FROM tv WHERE a1 = _a1; +END| + +CALL bug6866(1)| +CALL bug6866(1)| +CALL bug6866(1)| + +DROP PROCEDURE bug6866; + +DROP VIEW tv| +DROP TABLE tt1, tt2, tt3| # # BUG#NNNN: New bug synopsis -- cgit v1.2.1 From 936b9319b8219daffab3bc6650a02801bf53c8bd Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 6 Jun 2005 21:22:23 +0500 Subject: ctype_cp1250_ch.result, ctype_cp1250_ch.test: Adding test. ctype-win1250ch.c: Bug #9759 Empty result with 'LIKE' and cp1250_czech_cs Wrong min_sort_char fix. strings/ctype-win1250ch.c: Bug #9759 Empty result with 'LIKE' and cp1250_czech_cs Wrong min_sort_char fix. mysql-test/t/ctype_cp1250_ch.test: Adding test. mysql-test/r/ctype_cp1250_ch.result: Adding test. --- mysql-test/r/ctype_cp1250_ch.result | 12 ++++++++++++ mysql-test/t/ctype_cp1250_ch.test | 12 ++++++++++++ 2 files changed, 24 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/ctype_cp1250_ch.result b/mysql-test/r/ctype_cp1250_ch.result index 62936b84caf..7b2ca7d7e0e 100644 --- a/mysql-test/r/ctype_cp1250_ch.result +++ b/mysql-test/r/ctype_cp1250_ch.result @@ -7,3 +7,15 @@ SELECT a, length(a), a='', a=' ', a=' ' FROM t1; a length(a) a='' a=' ' a=' ' 0 1 1 1 DROP TABLE t1; +CREATE TABLE t1 ( +popisek varchar(30) collate cp1250_general_ci NOT NULL default '', +PRIMARY KEY (`popisek`) +); +INSERT INTO t1 VALUES ('2005-01-1'); +SELECT * FROM t1 WHERE popisek = '2005-01-1'; +popisek +2005-01-1 +SELECT * FROM t1 WHERE popisek LIKE '2005-01-1'; +popisek +2005-01-1 +drop table t1; diff --git a/mysql-test/t/ctype_cp1250_ch.test b/mysql-test/t/ctype_cp1250_ch.test index 06aea7b9979..814da628fb7 100644 --- a/mysql-test/t/ctype_cp1250_ch.test +++ b/mysql-test/t/ctype_cp1250_ch.test @@ -10,3 +10,15 @@ CREATE TABLE t1 (a char(16)) character set cp1250 collate cp1250_czech_cs; INSERT INTO t1 VALUES (''); SELECT a, length(a), a='', a=' ', a=' ' FROM t1; DROP TABLE t1; + +# +# Bug#9759 Empty result with 'LIKE' and cp1250_czech_cs +# +CREATE TABLE t1 ( + popisek varchar(30) collate cp1250_general_ci NOT NULL default '', + PRIMARY KEY (`popisek`) +); +INSERT INTO t1 VALUES ('2005-01-1'); +SELECT * FROM t1 WHERE popisek = '2005-01-1'; +SELECT * FROM t1 WHERE popisek LIKE '2005-01-1'; +drop table t1; -- cgit v1.2.1 From 9595c788f9857d0e712f6659d3a0d85300aa0f7b Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 6 Jun 2005 20:41:52 +0300 Subject: Ensure that we reset auto-increment cache if we have to do an UPDATE becasue of REPLACE This fixes bug #11080: Multi-row REPLACE fails on a duplicate key error mysql-test/r/auto_increment.result: New tests for auto-increment and replace mysql-test/r/innodb.result: New tests for auto-increment and replace mysql-test/t/auto_increment.test: New tests for auto-increment and replace mysql-test/t/innodb.test: New tests for auto-increment and replace mysys/my_alloc.c: More comments --- mysql-test/r/auto_increment.result | 39 +++++++++++++++++++++++++++++++++ mysql-test/r/innodb.result | 39 +++++++++++++++++++++++++++++++++ mysql-test/t/auto_increment.test | 36 ++++++++++++++++++++++++++++++ mysql-test/t/innodb.test | 45 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 159 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result index 4587c675150..61a42b004a9 100644 --- a/mysql-test/r/auto_increment.result +++ b/mysql-test/r/auto_increment.result @@ -355,3 +355,42 @@ CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`)); +insert into t1 (b) values (1); +replace into t1 (b) values (2), (1), (3); +select * from t1; +a b +3 1 +2 2 +4 3 +truncate table t1; +insert into t1 (b) values (1); +replace into t1 (b) values (2); +replace into t1 (b) values (1); +replace into t1 (b) values (3); +select * from t1; +a b +3 1 +2 2 +4 3 +drop table t1; +create table t1 (rowid int not null auto_increment, val int not null,primary +key (rowid), unique(val)); +replace into t1 (val) values ('1'),('2'); +replace into t1 (val) values ('1'),('2'); +insert into t1 (val) values ('1'),('2'); +ERROR 23000: Duplicate entry '1' for key 2 +select * from t1; +rowid val +3 1 +4 2 +drop table t1; +create table t1 (a int not null auto_increment primary key, val int); +insert into t1 (val) values (1); +update t1 set a=2 where a=1; +insert into t1 (val) values (1); +select * from t1; +a val +2 1 +3 1 +drop table t1; diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 91b01f8e8e6..53dbf2a39e1 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -2410,3 +2410,42 @@ select min(b) from t1 where a='8'; min(b) 6 drop table t1; +CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`)) ENGINE=innodb; +insert into t1 (b) values (1); +replace into t1 (b) values (2), (1), (3); +ERROR 23000: Duplicate entry '3' for key 1 +select * from t1; +a b +1 1 +truncate table t1; +insert into t1 (b) values (1); +replace into t1 (b) values (2); +replace into t1 (b) values (1); +replace into t1 (b) values (3); +ERROR 23000: Duplicate entry '3' for key 1 +select * from t1; +a b +3 1 +2 2 +drop table t1; +create table t1 (rowid int not null auto_increment, val int not null,primary +key (rowid), unique(val)) engine=innodb; +replace into t1 (val) values ('1'),('2'); +replace into t1 (val) values ('1'),('2'); +ERROR 23000: Duplicate entry '3' for key 1 +insert into t1 (val) values ('1'),('2'); +ERROR 23000: Duplicate entry '1' for key 2 +select * from t1; +rowid val +1 1 +2 2 +drop table t1; +create table t1 (a int not null auto_increment primary key, val int) engine=InnoDB; +insert into t1 (val) values (1); +update t1 set a=2 where a=1; +insert into t1 (val) values (1); +ERROR 23000: Duplicate entry '2' for key 1 +select * from t1; +a val +2 1 +drop table t1; diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test index ef344df5fb6..afc4c722051 100644 --- a/mysql-test/t/auto_increment.test +++ b/mysql-test/t/auto_increment.test @@ -218,3 +218,39 @@ CHECK TABLE t1; INSERT INTO t1 (b) VALUES ('bbbb'); CHECK TABLE t1; DROP TABLE IF EXISTS t1; + +# +# Bug #11080 & #11005 Multi-row REPLACE fails on a duplicate key error +# + +CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`)); +insert into t1 (b) values (1); +replace into t1 (b) values (2), (1), (3); +select * from t1; +truncate table t1; +insert into t1 (b) values (1); +replace into t1 (b) values (2); +replace into t1 (b) values (1); +replace into t1 (b) values (3); +select * from t1; +drop table t1; + +create table t1 (rowid int not null auto_increment, val int not null,primary +key (rowid), unique(val)); +replace into t1 (val) values ('1'),('2'); +replace into t1 (val) values ('1'),('2'); +--error 1062 +insert into t1 (val) values ('1'),('2'); +select * from t1; +drop table t1; + +# +# Test that update changes internal auto-increment value +# + +create table t1 (a int not null auto_increment primary key, val int); +insert into t1 (val) values (1); +update t1 set a=2 where a=1; +insert into t1 (val) values (1); +select * from t1; +drop table t1; diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index 6c685796b2c..e3edcdfa5fc 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -1329,3 +1329,48 @@ insert into t1 values ('8', '6'), ('4', '7'); select min(a) from t1; select min(b) from t1 where a='8'; drop table t1; + +# +# Bug #11080 & #11005 Multi-row REPLACE fails on a duplicate key error +# + +CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`)) ENGINE=innodb; +insert into t1 (b) values (1); +# We shouldn't get the following error +--error 1062 +replace into t1 (b) values (2), (1), (3); +select * from t1; +truncate table t1; +insert into t1 (b) values (1); +replace into t1 (b) values (2); +replace into t1 (b) values (1); +# We shouldn't get the following error +--error 1062 +replace into t1 (b) values (3); +select * from t1; +drop table t1; + +create table t1 (rowid int not null auto_increment, val int not null,primary +key (rowid), unique(val)) engine=innodb; +replace into t1 (val) values ('1'),('2'); +# We shouldn't get the following error +--error 1062 +replace into t1 (val) values ('1'),('2'); +--error 1062 +insert into t1 (val) values ('1'),('2'); +select * from t1; +drop table t1; + + +# +# Test that update changes internal auto-increment value +# + +create table t1 (a int not null auto_increment primary key, val int) engine=InnoDB; +insert into t1 (val) values (1); +update t1 set a=2 where a=1; +# We shouldn't get the following error +--error 1062 +insert into t1 (val) values (1); +select * from t1; +drop table t1; -- cgit v1.2.1 From e90b64cda4466566db12969a3a40f614a97cc329 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jun 2005 05:43:59 +0300 Subject: After merge fixes mysql-test/r/innodb.result: Update results mysql-test/r/warnings.result: Update results sql/item.cc: Simple optimization sql/item_func.cc: After merge fix sql/item_sum.cc: Fixes for group_concat and rollup (From Ramil) sql/sql_parse.cc: Remove compiler warning sql/sql_select.cc: Fixed problem with rollup --- mysql-test/r/innodb.result | 18 +++++++++++------ mysql-test/r/warnings.result | 48 ++++++++++++++++++++++---------------------- 2 files changed, 36 insertions(+), 30 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 1f26aa7d7f7..de0bc8d3230 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1450,16 +1450,22 @@ test.t3 NULL test.t4 NULL Warnings: Error 1146 Table 'test.t4' doesn't exist -checksum table t1, t2, t3; +checksum table t1, t2, t3, t4; Table Checksum test.t1 2948697075 test.t2 1157260244 test.t3 1157260244 -checksum table t1, t2, t3 extended; +test.t4 NULL +Warnings: +Error 1146 Table 'test.t4' doesn't exist +checksum table t1, t2, t3, t4 extended; Table Checksum test.t1 3092701434 test.t2 1157260244 test.t3 1157260244 +test.t4 NULL +Warnings: +Error 1146 Table 'test.t4' doesn't exist drop table t1,t2,t3; create table t1 (id int, name char(10) not null, name2 char(10) not null) engine=innodb; insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt'); @@ -1632,14 +1638,14 @@ t2 CREATE TABLE `t2` ( drop table t2, t1; show status like "binlog_cache_use"; Variable_name Value -Binlog_cache_use 154 +Binlog_cache_use 153 show status like "binlog_cache_disk_use"; Variable_name Value Binlog_cache_disk_use 0 create table t1 (a int) engine=innodb; show status like "binlog_cache_use"; Variable_name Value -Binlog_cache_use 155 +Binlog_cache_use 154 show status like "binlog_cache_disk_use"; Variable_name Value Binlog_cache_disk_use 1 @@ -1648,7 +1654,7 @@ delete from t1; commit; show status like "binlog_cache_use"; Variable_name Value -Binlog_cache_use 156 +Binlog_cache_use 155 show status like "binlog_cache_disk_use"; Variable_name Value Binlog_cache_disk_use 1 @@ -1738,7 +1744,7 @@ Variable_name Value Innodb_rows_deleted 2070 show status like "Innodb_rows_inserted"; Variable_name Value -Innodb_rows_inserted 31709 +Innodb_rows_inserted 31718 show status like "Innodb_rows_updated"; Variable_name Value Innodb_rows_updated 29530 diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index 6803c3a40ef..fd516996ae8 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -185,44 +185,44 @@ create table t1 (a int); insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); update t1 set a='abc'; Warnings: -Warning 1265 Data truncated for column 'a' at row 1 -Warning 1265 Data truncated for column 'a' at row 2 -Warning 1265 Data truncated for column 'a' at row 3 -Warning 1265 Data truncated for column 'a' at row 4 -Warning 1265 Data truncated for column 'a' at row 5 -Warning 1265 Data truncated for column 'a' at row 6 -Warning 1265 Data truncated for column 'a' at row 7 -Warning 1265 Data truncated for column 'a' at row 8 -Warning 1265 Data truncated for column 'a' at row 9 -Warning 1265 Data truncated for column 'a' at row 10 +Warning 1264 Out of range value adjusted for column 'a' at row 1 +Warning 1264 Out of range value adjusted for column 'a' at row 2 +Warning 1264 Out of range value adjusted for column 'a' at row 3 +Warning 1264 Out of range value adjusted for column 'a' at row 4 +Warning 1264 Out of range value adjusted for column 'a' at row 5 +Warning 1264 Out of range value adjusted for column 'a' at row 6 +Warning 1264 Out of range value adjusted for column 'a' at row 7 +Warning 1264 Out of range value adjusted for column 'a' at row 8 +Warning 1264 Out of range value adjusted for column 'a' at row 9 +Warning 1264 Out of range value adjusted for column 'a' at row 10 show warnings limit 2, 1; Level Code Message -Warning 1265 Data truncated for column 'a' at row 3 +Warning 1264 Out of range value adjusted for column 'a' at row 3 show warnings limit 0, 10; Level Code Message -Warning 1265 Data truncated for column 'a' at row 1 -Warning 1265 Data truncated for column 'a' at row 2 -Warning 1265 Data truncated for column 'a' at row 3 -Warning 1265 Data truncated for column 'a' at row 4 -Warning 1265 Data truncated for column 'a' at row 5 -Warning 1265 Data truncated for column 'a' at row 6 -Warning 1265 Data truncated for column 'a' at row 7 -Warning 1265 Data truncated for column 'a' at row 8 -Warning 1265 Data truncated for column 'a' at row 9 -Warning 1265 Data truncated for column 'a' at row 10 +Warning 1264 Out of range value adjusted for column 'a' at row 1 +Warning 1264 Out of range value adjusted for column 'a' at row 2 +Warning 1264 Out of range value adjusted for column 'a' at row 3 +Warning 1264 Out of range value adjusted for column 'a' at row 4 +Warning 1264 Out of range value adjusted for column 'a' at row 5 +Warning 1264 Out of range value adjusted for column 'a' at row 6 +Warning 1264 Out of range value adjusted for column 'a' at row 7 +Warning 1264 Out of range value adjusted for column 'a' at row 8 +Warning 1264 Out of range value adjusted for column 'a' at row 9 +Warning 1264 Out of range value adjusted for column 'a' at row 10 show warnings limit 9, 1; Level Code Message -Warning 1265 Data truncated for column 'a' at row 10 +Warning 1264 Out of range value adjusted for column 'a' at row 10 show warnings limit 10, 1; Level Code Message show warnings limit 9, 2; Level Code Message -Warning 1265 Data truncated for column 'a' at row 10 +Warning 1264 Out of range value adjusted for column 'a' at row 10 show warnings limit 0, 0; Level Code Message show warnings limit 1; Level Code Message -Warning 1265 Data truncated for column 'a' at row 1 +Warning 1264 Out of range value adjusted for column 'a' at row 1 show warnings limit 0; Level Code Message show warnings limit 1, 0; -- cgit v1.2.1 From c9914ac6ac456386aff36f948fa8036f066612bf Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jun 2005 13:56:42 +0500 Subject: Bug#10253: compound index length and utf8 char set produces invalid query results mi_key.c: well_formed_length should be executed before space trimming, not after. ctype_utf8.test: ctype_utf8.result: adding test. myisam/mi_key.c: Bug#10253: ompound index length and utf8 char set produces invalid query results well_formed_length should be executed before space trimming, not after. mysql-test/r/ctype_utf8.result: adding test. adding test. mysql-test/t/ctype_utf8.test: adding test. --- mysql-test/r/ctype_utf8.result | 11 +++++++++++ mysql-test/t/ctype_utf8.test | 14 ++++++++++++++ 2 files changed, 25 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index b7aa7c68b67..ac421ea1717 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -891,3 +891,14 @@ string create table t1 (a varchar(255)) default character set utf8; insert into t1 values (1.0); drop table t1; +create table t1 ( +id int not null, +city varchar(20) not null, +key (city(7),id) +) character set=utf8; +insert into t1 values (1,'Durban North'); +insert into t1 values (2,'Durban'); +select * from t1 where city = 'Durban'; +id city +2 Durban +drop table t1; diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index bac6e60c302..a281558e5a1 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -731,3 +731,17 @@ select ifnull(NULL, _utf8'string'); create table t1 (a varchar(255)) default character set utf8; insert into t1 values (1.0); drop table t1; + +# +# Bug#10253 compound index length and utf8 char set +# produces invalid query results +# +create table t1 ( + id int not null, + city varchar(20) not null, + key (city(7),id) +) character set=utf8; +insert into t1 values (1,'Durban North'); +insert into t1 values (2,'Durban'); +select * from t1 where city = 'Durban'; +drop table t1; -- cgit v1.2.1 From 092389719bc92937b0bb8427fe19b3fb468ec1ec Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jun 2005 12:27:37 +0300 Subject: innodb.result, innodb.test: Update Monty's tests for AUTO-INC bug #11080 and bug #11005 mysql-test/t/innodb.test: Update Monty's tests for AUTO-INC bug #11080 and bug #11005 mysql-test/r/innodb.result: Update Monty's tests for AUTO-INC bug #11080 and bug #11005 --- mysql-test/r/innodb.result | 11 +++++++++++ mysql-test/t/innodb.test | 13 ++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index de0bc8d3230..ea634c7447d 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -2457,6 +2457,17 @@ rowid val 1 1 2 2 drop table t1; +create table t1 (rowid int not null auto_increment, val int not null,primary +key (rowid), unique(val)) engine=innodb; +replace into t1 (val) values ('1'),('2'); +replace into t1 (val) values ('1'),('2'); +insert into t1 (val) values ('1'),('2'); +ERROR 23000: Duplicate entry '1' for key 2 +select * from t1; +rowid val +3 1 +4 2 +drop table t1; create table t1 (a int not null auto_increment primary key, val int) engine=InnoDB; insert into t1 (val) values (1); update t1 set a=2 where a=1; diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index e2d098618f5..65191f8af8a 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -1350,16 +1350,12 @@ drop table t1; CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`)) ENGINE=innodb; insert into t1 (b) values (1); -# We shouldn't get the following error ---error 1062 replace into t1 (b) values (2), (1), (3); select * from t1; truncate table t1; insert into t1 (b) values (1); replace into t1 (b) values (2); replace into t1 (b) values (1); -# We shouldn't get the following error ---error 1062 replace into t1 (b) values (3); select * from t1; drop table t1; @@ -1367,24 +1363,23 @@ drop table t1; create table t1 (rowid int not null auto_increment, val int not null,primary key (rowid), unique(val)) engine=innodb; replace into t1 (val) values ('1'),('2'); -# We shouldn't get the following error ---error 1062 replace into t1 (val) values ('1'),('2'); ---error 1062 insert into t1 (val) values ('1'),('2'); +--error 1062 select * from t1; drop table t1; # -# Test that update changes internal auto-increment value +# Test that update does not change internal auto-increment value # create table t1 (a int not null auto_increment primary key, val int) engine=InnoDB; insert into t1 (val) values (1); update t1 set a=2 where a=1; -# We shouldn't get the following error +# We should get the following error because InnoDB does not update the counter --error 1062 insert into t1 (val) values (1); +--error 1062 select * from t1; drop table t1; -- cgit v1.2.1 From 44e96d7d2887483597b84845cf7c1cd6deb7a394 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jun 2005 12:29:49 +0300 Subject: innodb.test: Update Monty's tests for AUTO-INC bug #11080 and bug #11005 mysql-test/t/innodb.test: Update Monty's tests for AUTO-INC bug #11080 and bug #11005 --- mysql-test/t/innodb.test | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index 65191f8af8a..7b27d589ec3 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -1364,8 +1364,8 @@ create table t1 (rowid int not null auto_increment, val int not null,primary key (rowid), unique(val)) engine=innodb; replace into t1 (val) values ('1'),('2'); replace into t1 (val) values ('1'),('2'); -insert into t1 (val) values ('1'),('2'); --error 1062 +insert into t1 (val) values ('1'),('2'); select * from t1; drop table t1; @@ -1380,6 +1380,5 @@ update t1 set a=2 where a=1; # We should get the following error because InnoDB does not update the counter --error 1062 insert into t1 (val) values (1); ---error 1062 select * from t1; drop table t1; -- cgit v1.2.1 From e70af5bef09d5aa9e72aaf8146b67128c094da2d Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jun 2005 12:32:39 +0300 Subject: innodb.result: Update Monty's tests for AUTO-INC bug #11080 and bug #11005 mysql-test/r/innodb.result: Update Monty's tests for AUTO-INC bug #11080 and bug #11005 --- mysql-test/r/innodb.result | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index ea634c7447d..31480e32c16 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -2430,32 +2430,21 @@ drop table t1; CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`)) ENGINE=innodb; insert into t1 (b) values (1); replace into t1 (b) values (2), (1), (3); -ERROR 23000: Duplicate entry '3' for key 1 select * from t1; a b -1 1 +3 1 +2 2 +4 3 truncate table t1; insert into t1 (b) values (1); replace into t1 (b) values (2); replace into t1 (b) values (1); replace into t1 (b) values (3); -ERROR 23000: Duplicate entry '3' for key 1 select * from t1; a b 3 1 2 2 -drop table t1; -create table t1 (rowid int not null auto_increment, val int not null,primary -key (rowid), unique(val)) engine=innodb; -replace into t1 (val) values ('1'),('2'); -replace into t1 (val) values ('1'),('2'); -ERROR 23000: Duplicate entry '3' for key 1 -insert into t1 (val) values ('1'),('2'); -ERROR 23000: Duplicate entry '1' for key 2 -select * from t1; -rowid val -1 1 -2 2 +4 3 drop table t1; create table t1 (rowid int not null auto_increment, val int not null,primary key (rowid), unique(val)) engine=innodb; -- cgit v1.2.1 From 4da133cabf43b4c53f33f5d529b2b7d7b43af3d5 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jun 2005 03:05:57 -0700 Subject: sql_select.cc, item_buff.cc, item.h: Fixed bug #11088: a crash for queries with GROUP BY a BLOB column + COUNT(DISTINCT...) due to an attempt to allocate a too large buffer for the BLOB field. Now the size of the buffer is limited by max_sort_length. group_by.test, group_by.result: Added a test case for bug #11088. mysql-test/r/group_by.result: Added a test case for bug #11088. mysql-test/t/group_by.test: Added a test case for bug #11088. sql/item.h: Fixed bug #11088: a crash for queries with GROUP BY a BLOB column + COUNT(DISTINCT...) due to an attempt to allocate a too large buffer for the BLOB fields. Now the size of the buffer is limited by max_sort_length. sql/item_buff.cc: Fixed bug #11088: a crash for queries with GROUP BY a BLOB column + COUNT(DISTINCT...) due to an attempt to allocate a too large buffer for the BLOB fields. Now the size of the buffer is limited by max_sort_length. sql/sql_select.cc: Fixed bug #11088: a crash for queries with GROUP BY a BLOB column + COUNT(DISTINCT...) due to an attempt to allocate a too large buffer for the BLOB fields. Now the size of the buffer is limited by max_sort_length. --- mysql-test/r/group_by.result | 11 +++++++++++ mysql-test/t/group_by.test | 17 +++++++++++++++++ 2 files changed, 28 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index b0c00a51722..3e082fa04e3 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -711,3 +711,14 @@ select min(b) from t1; min(b) 3000000000 drop table t1; +CREATE TABLE t1 (id int PRIMARY KEY, user_id int, hostname longtext); +INSERT INTO t1 VALUES +(1, 7, 'cache-dtc-af05.proxy.aol.com'), +(2, 3, 'what.ever.com'), +(3, 7, 'cache-dtc-af05.proxy.aol.com'), +(4, 7, 'cache-dtc-af05.proxy.aol.com'); +SELECT hostname, COUNT(DISTINCT user_id) as no FROM t1 +WHERE hostname LIKE '%aol%' + GROUP BY hostname; +hostname no +cache-dtc-af05.proxy.aol.com 1 diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index fbd39019e6d..21d5abcc287 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -522,3 +522,20 @@ insert into t1 values(3000000000); select * from t1; select min(b) from t1; drop table t1; + +# +# Test for bug #11088: GROUP BY a BLOB colimn with COUNT(DISTINCT column1) +# + +CREATE TABLE t1 (id int PRIMARY KEY, user_id int, hostname longtext); + +INSERT INTO t1 VALUES + (1, 7, 'cache-dtc-af05.proxy.aol.com'), + (2, 3, 'what.ever.com'), + (3, 7, 'cache-dtc-af05.proxy.aol.com'), + (4, 7, 'cache-dtc-af05.proxy.aol.com'); + +SELECT hostname, COUNT(DISTINCT user_id) as no FROM t1 + WHERE hostname LIKE '%aol%' + GROUP BY hostname; + -- cgit v1.2.1 From 5188f031ae9b8b7eca9092b82d454a567154737a Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jun 2005 14:11:36 +0400 Subject: Patch two (the final one) for Bug#7306 "the server side preparedStatement error for LIMIT placeholder". The patch adds grammar support for LIMIT ?, ? and changes the type of ST_SELECT_LEX::select_limit,offset_limit from ha_rows to Item*, so that it can point to Item_param. mysql-test/include/ps_modify.inc: Fix existing tests: now LIMIT can contain placeholders. mysql-test/include/ps_query.inc: Fix existing tests: now LIMIT can contain placeholders. mysql-test/r/ps.result: Add basic test coverage for LIMIT ?, ? and fix test results. mysql-test/r/ps_2myisam.result: Fix test results: now LIMIT can contain placeholders. mysql-test/r/ps_3innodb.result: Fix test results: now LIMIT can contain placeholders. mysql-test/r/ps_4heap.result: Fix test results: now LIMIT can contain placeholders. mysql-test/r/ps_5merge.result: Fix test results: now LIMIT can contain placeholders. mysql-test/r/ps_6bdb.result: Fix test results: now LIMIT can contain placeholders. mysql-test/r/ps_7ndb.result: Fix test results: now LIMIT can contain placeholders. mysql-test/t/ps.test: Add basic test coverage for LIMIT ?, ?. sql/item.h: Add a short-cut for (ulonglong) val_int() to Item. Add a constructor to Item_int() that accepts ulonglong. Simplify Item_uint constructor by using the c-tor above. sql/item_subselect.cc: Now select_limit has type Item *. We can safely create an Item in Item_exists_subselect::fix_length_and_dec(): it will be allocated in runtime memory root and freed in the end of execution. sql/sp_head.cc: Add a special initalization state for stored procedures to be able to easily distinguish the first execution of a stored procedure from prepared statement prepare. sql/sql_class.h: Introduce new state 'INITIALIZED_FOR_SP' to be able to easily distinguish the first execution of a stored procedure from prepared statement prepare. sql/sql_derived.cc: - use unit->set_limit() to set unit->select_limit_cnt, offset_limit_cnt evreryplace. Add a warning about use of set_limit in mysql_derived_filling. sql/sql_error.cc: - use unit->set_limit() to set unit->select_limit_cnt, offset_limit_cnt evreryplace. - this change is also aware of bug#11095 "show warnings limit 0 returns all rows instead of zero rows", so the one who merges the bugfix from 4.1 can use local version of sql_error.cc. sql/sql_handler.cc: - use unit->set_limit() to initalize unit->select_limit_cnt,offset_limit_cnt everyplace. sql/sql_lex.cc: Now ST_SELECT_LEX::select_limit, offset_limit have type Item * sql/sql_lex.h: Now ST_SELECT_LEX::select_limit, offset_limit have type Item * sql/sql_parse.cc: - use unit->set_limit() to initalize unit->select_limit_cnt,offset_limit_cnt everyplace. - we can create an Item_int to set global limit of a statement: it will be created in the runtime mem root and freed in the end of execution. sql/sql_repl.cc: Use unit->set_limit to initialize limits. sql/sql_select.cc: - select_limit is now Item* so the proper way to check for default value is to compare it with NULL. sql/sql_union.cc: Evaluate offset_limit_cnt using the new type of ST_SELECT_LEX::offset_limit sql/sql_view.cc: Now ST_SELECT_LEX::select_limit, offset_limit have type Item * sql/sql_yacc.yy: Add grammar support for LIMIT ?, ? clause. --- mysql-test/include/ps_modify.inc | 7 ++----- mysql-test/include/ps_query.inc | 6 ++---- mysql-test/r/ps.result | 41 ++++++++++++++++++++++++++++++++++++++++ mysql-test/r/ps_2myisam.result | 13 ++++++------- mysql-test/r/ps_3innodb.result | 13 ++++++------- mysql-test/r/ps_4heap.result | 13 ++++++------- mysql-test/r/ps_5merge.result | 26 ++++++++++++------------- mysql-test/r/ps_6bdb.result | 13 ++++++------- mysql-test/r/ps_7ndb.result | 10 +++------- mysql-test/t/ps.test | 29 ++++++++++++++++++++++++++++ 10 files changed, 113 insertions(+), 58 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/include/ps_modify.inc b/mysql-test/include/ps_modify.inc index 04b9734240b..633c317f4b2 100644 --- a/mysql-test/include/ps_modify.inc +++ b/mysql-test/include/ps_modify.inc @@ -174,11 +174,8 @@ where a=2 limit 1'; execute stmt1 ; select a,b from t1 where b = 'bla' ; -# currently (May 2004, Version 4.1) it is impossible --- error 1064 -prepare stmt1 from 'update t1 set b=''bla'' -where a=2 -limit ?'; +prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?'; +execute stmt1 using @arg00; --disable_query_log select '------ insert tests ------' as test_sequence ; diff --git a/mysql-test/include/ps_query.inc b/mysql-test/include/ps_query.inc index 9a413bff2f3..63504a0fa2b 100644 --- a/mysql-test/include/ps_query.inc +++ b/mysql-test/include/ps_query.inc @@ -300,10 +300,8 @@ set @arg00=1; prepare stmt1 from ' select a,b from t1 order by a limit 1 '; execute stmt1 ; -# currently (May 2004, Version 4.1) it is impossible --- error 1064 -prepare stmt1 from ' select a,b from t1 -limit ? '; +prepare stmt1 from ' select a,b from t1 limit ? '; +execute stmt1 using @arg00; ##### parameter used in many places set @arg00='b' ; diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 8371437d664..496d566a5ee 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -634,3 +634,44 @@ id 3 deallocate prepare stmt; drop table t1, t2; +create table t1 (a int); +insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +prepare stmt from "select * from t1 limit ?, ?"; +set @offset=0, @limit=1; +execute stmt using @offset, @limit; +a +1 +select * from t1 limit 0, 1; +a +1 +set @offset=3, @limit=2; +execute stmt using @offset, @limit; +a +4 +5 +select * from t1 limit 3, 2; +a +4 +5 +prepare stmt from "select * from t1 limit ?"; +execute stmt using @limit; +a +1 +2 +prepare stmt from "select * from t1 where a in (select a from t1 limit ?)"; +ERROR 42000: This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' +prepare stmt from "select * from t1 union all select * from t1 limit ?, ?"; +set @offset=9; +set @limit=2; +execute stmt using @offset, @limit; +a +10 +1 +prepare stmt from "(select * from t1 limit ?, ?) union all + (select * from t1 limit ?, ?) order by a limit ?"; +execute stmt using @offset, @limit, @offset, @limit, @limit; +a +10 +10 +drop table t1; +deallocate prepare stmt; diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result index d6c3d0e78d5..53fb3da8bb9 100644 --- a/mysql-test/r/ps_2myisam.result +++ b/mysql-test/r/ps_2myisam.result @@ -444,9 +444,10 @@ limit 1 '; execute stmt1 ; a b 1 one -prepare stmt1 from ' select a,b from t1 -limit ? '; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 2 +prepare stmt1 from ' select a,b from t1 limit ? '; +execute stmt1 using @arg00; +a b +1 one set @arg00='b' ; set @arg01=0 ; set @arg02=2 ; @@ -1381,10 +1382,8 @@ execute stmt1 ; select a,b from t1 where b = 'bla' ; a b 2 bla -prepare stmt1 from 'update t1 set b=''bla'' -where a=2 -limit ?'; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 3 +prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?'; +execute stmt1 using @arg00; test_sequence ------ insert tests ------ delete from t1 ; diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result index 1bbc1091393..658fd01dd0d 100644 --- a/mysql-test/r/ps_3innodb.result +++ b/mysql-test/r/ps_3innodb.result @@ -444,9 +444,10 @@ limit 1 '; execute stmt1 ; a b 1 one -prepare stmt1 from ' select a,b from t1 -limit ? '; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 2 +prepare stmt1 from ' select a,b from t1 limit ? '; +execute stmt1 using @arg00; +a b +1 one set @arg00='b' ; set @arg01=0 ; set @arg02=2 ; @@ -1364,10 +1365,8 @@ execute stmt1 ; select a,b from t1 where b = 'bla' ; a b 2 bla -prepare stmt1 from 'update t1 set b=''bla'' -where a=2 -limit ?'; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 3 +prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?'; +execute stmt1 using @arg00; test_sequence ------ insert tests ------ delete from t1 ; diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result index 009b642d7e7..f22317974cb 100644 --- a/mysql-test/r/ps_4heap.result +++ b/mysql-test/r/ps_4heap.result @@ -445,9 +445,10 @@ limit 1 '; execute stmt1 ; a b 1 one -prepare stmt1 from ' select a,b from t1 -limit ? '; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 2 +prepare stmt1 from ' select a,b from t1 limit ? '; +execute stmt1 using @arg00; +a b +1 one set @arg00='b' ; set @arg01=0 ; set @arg02=2 ; @@ -1365,10 +1366,8 @@ execute stmt1 ; select a,b from t1 where b = 'bla' ; a b 2 bla -prepare stmt1 from 'update t1 set b=''bla'' -where a=2 -limit ?'; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 3 +prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?'; +execute stmt1 using @arg00; test_sequence ------ insert tests ------ delete from t1 ; diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result index 5bd18078213..2ce7eb34a10 100644 --- a/mysql-test/r/ps_5merge.result +++ b/mysql-test/r/ps_5merge.result @@ -487,9 +487,10 @@ limit 1 '; execute stmt1 ; a b 1 one -prepare stmt1 from ' select a,b from t1 -limit ? '; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 2 +prepare stmt1 from ' select a,b from t1 limit ? '; +execute stmt1 using @arg00; +a b +1 one set @arg00='b' ; set @arg01=0 ; set @arg02=2 ; @@ -1407,10 +1408,8 @@ execute stmt1 ; select a,b from t1 where b = 'bla' ; a b 2 bla -prepare stmt1 from 'update t1 set b=''bla'' -where a=2 -limit ?'; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 3 +prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?'; +execute stmt1 using @arg00; test_sequence ------ insert tests ------ delete from t1 ; @@ -3500,9 +3499,10 @@ limit 1 '; execute stmt1 ; a b 1 one -prepare stmt1 from ' select a,b from t1 -limit ? '; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 2 +prepare stmt1 from ' select a,b from t1 limit ? '; +execute stmt1 using @arg00; +a b +1 one set @arg00='b' ; set @arg01=0 ; set @arg02=2 ; @@ -4420,10 +4420,8 @@ execute stmt1 ; select a,b from t1 where b = 'bla' ; a b 2 bla -prepare stmt1 from 'update t1 set b=''bla'' -where a=2 -limit ?'; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 3 +prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?'; +execute stmt1 using @arg00; test_sequence ------ insert tests ------ delete from t1 ; diff --git a/mysql-test/r/ps_6bdb.result b/mysql-test/r/ps_6bdb.result index 753def70dc0..03b155c6fa4 100644 --- a/mysql-test/r/ps_6bdb.result +++ b/mysql-test/r/ps_6bdb.result @@ -444,9 +444,10 @@ limit 1 '; execute stmt1 ; a b 1 one -prepare stmt1 from ' select a,b from t1 -limit ? '; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 2 +prepare stmt1 from ' select a,b from t1 limit ? '; +execute stmt1 using @arg00; +a b +1 one set @arg00='b' ; set @arg01=0 ; set @arg02=2 ; @@ -1364,10 +1365,8 @@ execute stmt1 ; select a,b from t1 where b = 'bla' ; a b 2 bla -prepare stmt1 from 'update t1 set b=''bla'' -where a=2 -limit ?'; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 3 +prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?'; +execute stmt1 using @arg00; test_sequence ------ insert tests ------ delete from t1 ; diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result index a6da6e169db..3b071d70b93 100644 --- a/mysql-test/r/ps_7ndb.result +++ b/mysql-test/r/ps_7ndb.result @@ -1,6 +1,4 @@ -use test; -drop table if exists t1, t9 ; -create table t1 +use test; drop table if exists t1, t9 ; create table t1 ( a int, b varchar(30), primary key(a) @@ -1364,10 +1362,8 @@ execute stmt1 ; select a,b from t1 where b = 'bla' ; a b 2 bla -prepare stmt1 from 'update t1 set b=''bla'' -where a=2 -limit ?'; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 3 +prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?'; +execute stmt1 using @arg00; test_sequence ------ insert tests ------ delete from t1 ; diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index f4396e41a20..60b77576572 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -664,3 +664,32 @@ select t2.id from t2, t1 where (t1.id=1 and t2.t1_id=t1.id); deallocate prepare stmt; drop table t1, t2; + +# +# Bug#7306 LIMIT ?, ? and also WL#1785 " Prepared statements: implement +# support for placeholders in LIMIT clause." +# Add basic test coverage for the feature. +# +create table t1 (a int); +insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +prepare stmt from "select * from t1 limit ?, ?"; +set @offset=0, @limit=1; +execute stmt using @offset, @limit; +select * from t1 limit 0, 1; +set @offset=3, @limit=2; +execute stmt using @offset, @limit; +select * from t1 limit 3, 2; +prepare stmt from "select * from t1 limit ?"; +execute stmt using @limit; +--error 1235 +prepare stmt from "select * from t1 where a in (select a from t1 limit ?)"; +prepare stmt from "select * from t1 union all select * from t1 limit ?, ?"; +set @offset=9; +set @limit=2; +execute stmt using @offset, @limit; +prepare stmt from "(select * from t1 limit ?, ?) union all + (select * from t1 limit ?, ?) order by a limit ?"; +execute stmt using @offset, @limit, @offset, @limit, @limit; + +drop table t1; +deallocate prepare stmt; -- cgit v1.2.1 From 49357ae8f0643bc7828a57c5f078d8aab4d35e0c Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jun 2005 14:53:08 +0400 Subject: Fix for bug #10015 "Crash in InnoDB if stored routines are used". We should not allow explicit or implicit transaction commits inside of stored functions or triggers (so in autocommit mode we should not do commits after execution of sub-statement). Also since we don't support nested statement transactions in 5.0, we shouldn't commit or rollback stmt transactions while we are inside stored functions or triggers. This should be fixed in later (>=5.1) releases. mysql-test/r/sp_trans.result: Added test for bug #10015 "Crash in InnoDB if stored routines are used" and for general transaction handling inside of functions. mysql-test/t/sp_trans.test: Added test for bug #10015 "Crash in InnoDB if stored routines are used" and for general transaction handling inside of functions. sql/handler.cc: ha_trans_commit()/ha_trans_rollback(): Since we don't support nested statement transactions in 5.0, we can't commit or rollback stmt transactions while we are inside stored functions or triggers. So we simply do nothing now. This should be fixed in later ( >= 5.1) releases. sql/item_func.cc: Item_func_sp::execute(): Set THD::transaction.in_sub_stmt flag to TRUE during stored function execution to prevent commits and rollbacks for statement level transactions, since doing them will ruin such transaction for stateemtn which calls this function. sql/share/errmsg.txt: Added error message which says that statements doing explicit or implicit commits are disallowed in triggers and stored functions. sql/sql_base.cc: close_thread_tables(): Clarified comment about committing of statement transactions in prelocked mode. sql/sql_class.h: THD::transaction: Added in_sub_stmt method which indicates that we are executing statements from trigger or stored function now, and thus statement transaction belongs to statement which invoked this routine and we should not commit or rollback it while executing these sub-statements. sql/sql_parse.cc: end_active_trans()/begin_trans()/end_trans(): We should not commit or rollback global (non-stmt) transaction if we are executing stored function or trigger. These checks will catch situation when we are trying to do commit or rollback in stored procedure which is called from function or trigger. sql/sql_trigger.h: Table_triggers_list::process_triggers(): Set THD::transaction.in_sub_stmt flag to TRUE during trigger execution to prevent commits and rollbacks for statement level transactions, since doing them will ruin such transaction for stateemtn which invokes this trigger. sql/sql_yacc.yy: Prohibited usage of statements which do explicit or implicit commit or rollback inside of stored functions and triggers. --- mysql-test/r/sp_trans.result | 158 +++++++++++++++++++++++++++++++++++++++++++ mysql-test/t/sp_trans.test | 144 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 302 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/sp_trans.result b/mysql-test/r/sp_trans.result index dee87979ff4..047711bb736 100644 --- a/mysql-test/r/sp_trans.result +++ b/mysql-test/r/sp_trans.result @@ -1,3 +1,4 @@ +drop table if exists t1, t2; drop procedure if exists bug8850| create table t1 (a int) engine=innodb| create procedure bug8850() @@ -20,3 +21,160 @@ a 2 drop table t1| drop procedure bug8850| +drop function if exists bug10015_1| +drop function if exists bug10015_2| +drop function if exists bug10015_3| +drop function if exists bug10015_4| +drop function if exists bug10015_5| +drop function if exists bug10015_6| +drop function if exists bug10015_7| +drop procedure if exists bug10015_8| +create table t1 (id int) engine=innodb| +create table t2 (id int primary key, j int) engine=innodb| +insert into t1 values (1),(2),(3)| +create function bug10015_1() returns int return (select count(*) from t1)| +select *, bug10015_1() from t1| +id bug10015_1() +1 3 +2 3 +3 3 +drop function bug10015_1| +create function bug10015_2() returns int +begin +declare i, s int; +set i:= (select min(id) from t1); +set s:= (select max(id) from t1); +return (s - i); +end| +select *, bug10015_2() from t1| +id bug10015_2() +1 2 +2 2 +3 2 +drop function bug10015_2| +create function bug10015_3() returns int +return (select max(a.id - b.id) from t1 as a, t1 as b where a.id >= b.id)| +select *, bug10015_3() from t1| +id bug10015_3() +1 2 +2 2 +3 2 +drop function bug10015_3| +create function bug10015_4(i int) returns int +begin +declare m int; +set m:= (select max(id) from t2); +insert into t2 values (i, m); +return m; +end| +select *, bug10015_4(id) from t1| +id bug10015_4(id) +1 NULL +2 1 +3 2 +select * from t2| +id j +1 NULL +2 1 +3 2 +drop function bug10015_4| +create function bug10015_5(i int) returns int +begin +if (i = 5) then +insert into t2 values (1, 0); +end if; +return i; +end| +insert into t1 values (bug10015_5(4)), (bug10015_5(5))| +ERROR 23000: Duplicate entry '1' for key 1 +select * from t1| +id +1 +2 +3 +drop function bug10015_5| +create function bug10015_6(i int) returns int +begin +declare continue handler for sqlexception set @error_in_func:= 1; +if (i = 5) then +insert into t2 values (4, 0), (1, 0); +end if; +return i; +end| +set @error_in_func:= 0| +insert into t1 values (bug10015_6(5)), (bug10015_6(6))| +select @error_in_func| +@error_in_func +1 +select * from t1| +id +1 +2 +3 +5 +6 +select * from t2| +id j +1 NULL +2 1 +3 2 +4 0 +drop function bug10015_6| +create function bug10015_7() returns int +begin +alter table t1 add k int; +return 1; +end| +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +create function bug10015_7() returns int +begin +start transaction; +return 1; +end| +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +create function bug10015_7() returns int +begin +drop table t1; +return 1; +end| +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +create function bug10015_7() returns int +begin +drop temporary table t1; +return 1; +end| +drop function bug10015_7| +create function bug10015_7() returns int +begin +commit; +return 1; +end| +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +create function bug10015_7() returns int +begin +call bug10015_8(); +return 1; +end| +create procedure bug10015_8() alter table t1 add k int| +select *, bug10015_7() from t1| +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +drop procedure bug10015_8| +create procedure bug10015_8() start transaction| +select *, bug10015_7() from t1| +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +drop procedure bug10015_8| +create procedure bug10015_8() drop temporary table if exists t1_temp| +select *, bug10015_7() from t1| +id bug10015_7() +1 1 +2 1 +3 1 +5 1 +6 1 +drop procedure bug10015_8| +create procedure bug10015_8() commit| +select *, bug10015_7() from t1| +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +drop procedure bug10015_8| +drop function bug10015_7| +drop table t1, t2| diff --git a/mysql-test/t/sp_trans.test b/mysql-test/t/sp_trans.test index f5b38ada674..d860d4818ba 100644 --- a/mysql-test/t/sp_trans.test +++ b/mysql-test/t/sp_trans.test @@ -4,6 +4,10 @@ -- source include/have_innodb.inc +--disable_warnings +drop table if exists t1, t2; +--enable_warnings + delimiter |; # @@ -35,6 +39,146 @@ drop table t1| drop procedure bug8850| +# +# BUG#10015: Crash in InnoDB if stored routines are used +# (crash happens in auto-commit mode) +# +--disable_warnings +drop function if exists bug10015_1| +drop function if exists bug10015_2| +drop function if exists bug10015_3| +drop function if exists bug10015_4| +drop function if exists bug10015_5| +drop function if exists bug10015_6| +drop function if exists bug10015_7| +drop procedure if exists bug10015_8| +--enable_warnings +create table t1 (id int) engine=innodb| +create table t2 (id int primary key, j int) engine=innodb| +insert into t1 values (1),(2),(3)| +create function bug10015_1() returns int return (select count(*) from t1)| +select *, bug10015_1() from t1| +drop function bug10015_1| +# Test couple of a bit more complex cases +create function bug10015_2() returns int + begin + declare i, s int; + set i:= (select min(id) from t1); + set s:= (select max(id) from t1); + return (s - i); + end| +select *, bug10015_2() from t1| +drop function bug10015_2| +create function bug10015_3() returns int + return (select max(a.id - b.id) from t1 as a, t1 as b where a.id >= b.id)| +select *, bug10015_3() from t1| +drop function bug10015_3| +create function bug10015_4(i int) returns int + begin + declare m int; + set m:= (select max(id) from t2); + insert into t2 values (i, m); + return m; + end| +select *, bug10015_4(id) from t1| +select * from t2| +drop function bug10015_4| +# Now let us test how statement rollback works +# This function will cause the whole stmt to be rolled back, +# there should not be any traces left. +create function bug10015_5(i int) returns int + begin + if (i = 5) then + insert into t2 values (1, 0); + end if; + return i; + end| +--error 1062 +insert into t1 values (bug10015_5(4)), (bug10015_5(5))| +select * from t1| +drop function bug10015_5| +# Thanks to error-handler this function should not cause rollback +# of statement calling it. But insert statement in it should be +# rolled back completely and don't leave any traces in t2. +# Unfortunately we can't implement such behavior in 5.0, so it +# is something to be fixed in later 5.* releases (TODO). +create function bug10015_6(i int) returns int + begin + declare continue handler for sqlexception set @error_in_func:= 1; + if (i = 5) then + insert into t2 values (4, 0), (1, 0); + end if; + return i; + end| +set @error_in_func:= 0| +insert into t1 values (bug10015_6(5)), (bug10015_6(6))| +select @error_in_func| +select * from t1| +select * from t2| +drop function bug10015_6| +# Let us test that we don't allow any statements causing transaction +# commit in stored functions (we test only most interesting cases here). +# Cases which can be caught at creation time: +--error 1422 +create function bug10015_7() returns int + begin + alter table t1 add k int; + return 1; + end| +--error 1422 +create function bug10015_7() returns int + begin + start transaction; + return 1; + end| +--error 1422 +create function bug10015_7() returns int + begin + drop table t1; + return 1; + end| +# It should be OK to drop temporary table. +create function bug10015_7() returns int + begin + drop temporary table t1; + return 1; + end| +drop function bug10015_7| +--error 1422 +create function bug10015_7() returns int + begin + commit; + return 1; + end| +# Now let us test cases which we can catch only at run-time: +create function bug10015_7() returns int + begin + call bug10015_8(); + return 1; + end| +create procedure bug10015_8() alter table t1 add k int| +--error 1422 +select *, bug10015_7() from t1| +drop procedure bug10015_8| +create procedure bug10015_8() start transaction| +--error 1422 +select *, bug10015_7() from t1| +drop procedure bug10015_8| +# Again it is OK to drop temporary table +# We are surpressing warnings since they are not essential +create procedure bug10015_8() drop temporary table if exists t1_temp| +--disable_warnings +select *, bug10015_7() from t1| +--enable_warnings +drop procedure bug10015_8| +create procedure bug10015_8() commit| +--error 1422 +select *, bug10015_7() from t1| +drop procedure bug10015_8| +drop function bug10015_7| +drop table t1, t2| + + # # BUG#NNNN: New bug synopsis # -- cgit v1.2.1 From 3dba83b95a142e3b921ed3f8fef319651397aba5 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jun 2005 15:09:49 +0300 Subject: Revert Bar's fix as this causes changes in the key tree that could cause incompatibilites Fix instead wrong call to ha_key_cmp This is related to bug #10741 Inserting double value into utf8 column crashes server myisam/mi_key.c: Revert Bar's fix as this causes changes in the key tree that could cause incompatibilites myisam/mi_rnext_same.c: Fixed wrong arguments to ha_key_cmp() This caused a compare to fail if we first found a key with end space and then same key without end space mysql-test/r/ctype_utf8.result: Additional test mysql-test/t/ctype_utf8.test: Additional test --- mysql-test/r/ctype_utf8.result | 3 +++ mysql-test/t/ctype_utf8.test | 1 + 2 files changed, 4 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index ac421ea1717..29b18f0431c 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -901,4 +901,7 @@ insert into t1 values (2,'Durban'); select * from t1 where city = 'Durban'; id city 2 Durban +select * from t1 where city = 'Durban '; +id city +2 Durban drop table t1; diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index a281558e5a1..3c49b2a47f7 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -744,4 +744,5 @@ create table t1 ( insert into t1 values (1,'Durban North'); insert into t1 values (2,'Durban'); select * from t1 where city = 'Durban'; +select * from t1 where city = 'Durban '; drop table t1; -- cgit v1.2.1 From d499ead64c468cab0fb03b98568e01bfd971f7b3 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jun 2005 06:34:13 -0700 Subject: Many files: Fixed bug #9899: erronious NOT_NULL flag for some attributes in the EXPLAIN table. sql/sql_class.cc: Fixed bug #9899: erronious NOT_NULL flag for some attributes in the EXPLAIN table. mysql-test/r/ps_1general.result: Fixed bug #9899: erronious NOT_NULL flag for some attributes in the EXPLAIN table. mysql-test/r/ps_2myisam.result: Fixed bug #9899: erronious NOT_NULL flag for some attributes in the EXPLAIN table. mysql-test/r/ps_3innodb.result: Fixed bug #9899: erronious NOT_NULL flag for some attributes in the EXPLAIN table. mysql-test/r/ps_4heap.result: Fixed bug #9899: erronious NOT_NULL flag for some attributes in the EXPLAIN table. mysql-test/r/ps_5merge.result: Fixed bug #9899: erronious NOT_NULL flag for some attributes in the EXPLAIN table. --- mysql-test/r/ps_1general.result | 12 ++++++------ mysql-test/r/ps_2myisam.result | 6 +++--- mysql-test/r/ps_3innodb.result | 6 +++--- mysql-test/r/ps_4heap.result | 6 +++--- mysql-test/r/ps_5merge.result | 12 ++++++------ 5 files changed, 21 insertions(+), 21 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result index 68d88a454ff..db8dc2e60af 100644 --- a/mysql-test/r/ps_1general.result +++ b/mysql-test/r/ps_1general.result @@ -468,13 +468,13 @@ execute stmt1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def id 8 3 1 N 32929 0 63 def select_type 253 19 6 N 1 31 8 -def table 253 64 2 N 1 31 8 -def type 253 10 3 N 1 31 8 +def table 253 64 2 Y 0 31 8 +def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 def key_len 8 3 0 Y 32928 0 63 def ref 253 1024 0 Y 0 31 8 -def rows 8 10 1 N 32929 0 63 +def rows 8 10 1 Y 32928 0 63 def Extra 253 255 14 N 1 31 8 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort @@ -484,13 +484,13 @@ execute stmt1 using @arg00; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def id 8 3 1 N 32929 0 63 def select_type 253 19 6 N 1 31 8 -def table 253 64 2 N 1 31 8 -def type 253 10 5 N 1 31 8 +def table 253 64 2 Y 0 31 8 +def type 253 10 5 Y 0 31 8 def possible_keys 253 4096 7 Y 0 31 8 def key 253 64 7 Y 0 31 8 def key_len 8 3 1 Y 32928 0 63 def ref 253 1024 0 Y 0 31 8 -def rows 8 10 1 N 32929 0 63 +def rows 8 10 1 Y 32928 0 63 def Extra 253 255 27 N 1 31 8 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using filesort diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result index fd17dc5b1b5..c569c9842f7 100644 --- a/mysql-test/r/ps_2myisam.result +++ b/mysql-test/r/ps_2myisam.result @@ -1151,13 +1151,13 @@ execute stmt1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def id 8 3 1 N 32929 0 63 def select_type 253 19 6 N 1 31 8 -def table 253 64 2 N 1 31 8 -def type 253 10 3 N 1 31 8 +def table 253 64 2 Y 0 31 8 +def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 def key_len 8 3 0 Y 32928 0 63 def ref 253 1024 0 Y 0 31 8 -def rows 8 10 1 N 32929 0 63 +def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t9 ALL NULL NULL NULL NULL 2 diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result index 50dc580a930..930aea2e381 100644 --- a/mysql-test/r/ps_3innodb.result +++ b/mysql-test/r/ps_3innodb.result @@ -1151,13 +1151,13 @@ execute stmt1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def id 8 3 1 N 32929 0 63 def select_type 253 19 6 N 1 31 8 -def table 253 64 2 N 1 31 8 -def type 253 10 3 N 1 31 8 +def table 253 64 2 Y 0 31 8 +def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 def key_len 8 3 0 Y 32928 0 63 def ref 253 1024 0 Y 0 31 8 -def rows 8 10 1 N 32929 0 63 +def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t9 ALL NULL NULL NULL NULL 2 diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result index 050a63f254c..083a4b221fe 100644 --- a/mysql-test/r/ps_4heap.result +++ b/mysql-test/r/ps_4heap.result @@ -1152,13 +1152,13 @@ execute stmt1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def id 8 3 1 N 32929 0 63 def select_type 253 19 6 N 1 31 8 -def table 253 64 2 N 1 31 8 -def type 253 10 3 N 1 31 8 +def table 253 64 2 Y 0 31 8 +def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 def key_len 8 3 0 Y 32928 0 63 def ref 253 1024 0 Y 0 31 8 -def rows 8 10 1 N 32929 0 63 +def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t9 ALL NULL NULL NULL NULL 2 diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result index c228ec4672f..1edd617ffc6 100644 --- a/mysql-test/r/ps_5merge.result +++ b/mysql-test/r/ps_5merge.result @@ -1194,13 +1194,13 @@ execute stmt1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def id 8 3 1 N 32929 0 63 def select_type 253 19 6 N 1 31 8 -def table 253 64 2 N 1 31 8 -def type 253 10 3 N 1 31 8 +def table 253 64 2 Y 0 31 8 +def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 def key_len 8 3 0 Y 32928 0 63 def ref 253 1024 0 Y 0 31 8 -def rows 8 10 1 N 32929 0 63 +def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t9 ALL NULL NULL NULL NULL 2 @@ -4208,13 +4208,13 @@ execute stmt1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def id 8 3 1 N 32929 0 63 def select_type 253 19 6 N 1 31 8 -def table 253 64 2 N 1 31 8 -def type 253 10 3 N 1 31 8 +def table 253 64 2 Y 0 31 8 +def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 def key_len 8 3 0 Y 32928 0 63 def ref 253 1024 0 Y 0 31 8 -def rows 8 10 1 N 32929 0 63 +def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t9 ALL NULL NULL NULL NULL 2 -- cgit v1.2.1 From 0bc3c6221cbaae56ba444e06603c4afbf11f685e Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jun 2005 22:22:27 +0400 Subject: Enabling back part of sp.test which no longer fails in --ps-protocol mode (Bug which caused its failure before was fixed in the beginning of March by the ChangeSet that introduced improved SP-locking). --- mysql-test/t/sp.test | 8 -------- 1 file changed, 8 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 57d5d2939e1..5bd94f0ca7f 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -3267,12 +3267,6 @@ drop procedure bug8762| # # BUG#5240: Stored procedure crash if function has cursor declaration # -# The following test case fails in --ps-protocol mode due to some bugs -# in algorithm which calculates list of tables to be locked for queries -# using Stored Functions. It is disabled until Dmitri fixes this. -# ---disable_ps_protocol - --disable_warnings drop function if exists bug5240| --enable_warnings @@ -3292,8 +3286,6 @@ insert into t1 values ("answer", 42)| select id, bug5240() from t1| drop function bug5240| ---enable_ps_protocol - # # BUG#5278: Stored procedure packets out of order if SET PASSWORD. # -- cgit v1.2.1 From 575a46a1efe314b69c392482637af17c97c046e0 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Jun 2005 22:43:25 +0200 Subject: bug#5373: handler READ NEXT w/o HANDLER READ [FIRST] check table->file->inited to catch incorrect calling sequence. mysql-test/r/innodb_handler.result: bug#5373: handler READ NEXT w/o HANDLER READ [FIRST] mysql-test/t/innodb_handler.test: bug#5373: handler READ NEXT w/o HANDLER READ [FIRST] sql/sql_handler.cc: cleanup: call index_init *correctly*, not every time. check table->file->inited to catch incorrect calling sequence. --- mysql-test/r/innodb_handler.result | 16 ++++++++++++++++ mysql-test/t/innodb_handler.test | 10 ++++++++++ 2 files changed, 26 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/innodb_handler.result b/mysql-test/r/innodb_handler.result index 7f4960ffa35..7e853a55e37 100644 --- a/mysql-test/r/innodb_handler.result +++ b/mysql-test/r/innodb_handler.result @@ -132,6 +132,22 @@ a b handler t2 read last; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 handler t2 close; +handler t1 open; +handler t1 read a next; +a b +14 aaa +handler t1 read a next; +a b +15 bbb +handler t1 close; +handler t1 open; +handler t1 read a prev; +a b +22 iii +handler t1 read a prev; +a b +21 hhh +handler t1 close; handler t1 open as t2; handler t2 read first; a b diff --git a/mysql-test/t/innodb_handler.test b/mysql-test/t/innodb_handler.test index e8c486caf66..65728519e7b 100644 --- a/mysql-test/t/innodb_handler.test +++ b/mysql-test/t/innodb_handler.test @@ -69,6 +69,16 @@ handler t2 read next; handler t2 read last; handler t2 close; +handler t1 open; +handler t1 read a next; # this used to crash as a bug#5373 +handler t1 read a next; +handler t1 close; + +handler t1 open; +handler t1 read a prev; # this used to crash as a bug#5373 +handler t1 read a prev; +handler t1 close; + handler t1 open as t2; handler t2 read first; alter table t1 engine=innodb; -- cgit v1.2.1 From e523df439d1fc23fa04de158f0d7ccfc0e046333 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Jun 2005 10:44:58 +0400 Subject: Fix ps_7ndb.result wrt working LIMIT clause (due to porting missed ityesterday :() mysql-test/r/ps_7ndb.result: Fix ps_7ndb.result wrt working LIMIT clause. --- mysql-test/r/ps_7ndb.result | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result index 3b071d70b93..d31f8c57513 100644 --- a/mysql-test/r/ps_7ndb.result +++ b/mysql-test/r/ps_7ndb.result @@ -442,9 +442,10 @@ limit 1 '; execute stmt1 ; a b 1 one -prepare stmt1 from ' select a,b from t1 -limit ? '; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 2 +prepare stmt1 from ' select a,b from t1 limit ? '; +execute stmt1 using @arg00; +a b +3 three set @arg00='b' ; set @arg01=0 ; set @arg02=2 ; -- cgit v1.2.1 From 41afcdb6c6855d9e81ddba209362b490230a5aed Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Jun 2005 10:59:40 +0400 Subject: Fix failing ps_6bdb and ps_7ndb tests. The changes are similar to those pushed with a fix for Bug#9899, so my guess is that ps_6dbd and ps_7ndb tests were simply not run then. mysql-test/r/ps_6bdb.result: Fix failing test. mysql-test/r/ps_7ndb.result: Fix failing test. --- mysql-test/r/ps_6bdb.result | 6 +++--- mysql-test/r/ps_7ndb.result | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/ps_6bdb.result b/mysql-test/r/ps_6bdb.result index 03b155c6fa4..92399c3b3b9 100644 --- a/mysql-test/r/ps_6bdb.result +++ b/mysql-test/r/ps_6bdb.result @@ -1152,13 +1152,13 @@ execute stmt1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def id 8 3 1 N 32929 0 63 def select_type 253 19 6 N 1 31 8 -def table 253 64 2 N 1 31 8 -def type 253 10 3 N 1 31 8 +def table 253 64 2 Y 0 31 8 +def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 def key_len 253 4096 0 Y 128 31 63 def ref 253 1024 0 Y 0 31 8 -def rows 8 10 1 N 32929 0 63 +def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t9 ALL NULL NULL NULL NULL 3 diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result index d31f8c57513..c7dabc2016d 100644 --- a/mysql-test/r/ps_7ndb.result +++ b/mysql-test/r/ps_7ndb.result @@ -1,4 +1,6 @@ -use test; drop table if exists t1, t9 ; create table t1 +use test; +drop table if exists t1, t9 ; +create table t1 ( a int, b varchar(30), primary key(a) @@ -1150,13 +1152,13 @@ execute stmt1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def id 8 3 1 N 32929 0 63 def select_type 253 19 6 N 1 31 8 -def table 253 64 2 N 1 31 8 -def type 253 10 3 N 1 31 8 +def table 253 64 2 Y 0 31 8 +def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 def key_len 253 4096 0 Y 128 31 63 def ref 253 1024 0 Y 0 31 8 -def rows 8 10 1 N 32929 0 63 +def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t9 ALL NULL NULL NULL NULL 2 -- cgit v1.2.1 From 54ea60189d1fa37c77388ba34db0927d8e05e046 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Jun 2005 12:25:57 +0500 Subject: Fix for bug #9894 (Negative numbers are allowed to 'unsigned' column) mysql-test/r/type_decimal.result: test result fixed mysql-test/r/type_newdecimal.result: test result fixed mysql-test/t/type_newdecimal.test: test case added sql/field.cc: We need to refuse negative integers when 'unsigned' --- mysql-test/r/type_decimal.result | 12 ++++++------ mysql-test/r/type_newdecimal.result | 7 ++++++- mysql-test/t/type_newdecimal.test | 9 +++++++++ 3 files changed, 21 insertions(+), 7 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result index ab57caacc0f..93467d1d7da 100644 --- a/mysql-test/r/type_decimal.result +++ b/mysql-test/r/type_decimal.result @@ -414,8 +414,8 @@ Warning 1264 Out of range value adjusted for column 'a' at row 2 Warning 1264 Out of range value adjusted for column 'a' at row 7 select * from t1; a -9999999999 -9999999999 +0 +0 1 1 1 @@ -430,8 +430,8 @@ Warning 1264 Out of range value adjusted for column 'a' at row 2 Warning 1264 Out of range value adjusted for column 'a' at row 7 select * from t1; a -9999999999 -9999999999 +0000000000 +0000000000 0000000001 0000000001 0000000001 @@ -446,8 +446,8 @@ Warning 1264 Out of range value adjusted for column 'a' at row 2 Warning 1264 Out of range value adjusted for column 'a' at row 7 select * from t1; a -9999999999 -9999999999 +0000000000 +0000000000 0000000001 0000000001 0000000001 diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index f03f2f5a862..26ea9c2e5d2 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -119,7 +119,7 @@ a 99.99 99.99 99.99 -99.99 +0.00 0.00 0.00 0.00 @@ -891,3 +891,8 @@ NULL select abs(NULL); abs(NULL) NULL +set @@sql_mode='traditional'; +create table t1( d1 decimal(18) unsigned, d2 decimal(20) unsigned, d3 decimal (22) unsigned); +insert into t1 values(1,-1,-1); +ERROR 22003: Out of range value adjusted for column 'd2' at row 1 +drop table t1; diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index 0f7d20ed977..de5fb09186b 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -925,3 +925,12 @@ DROP TABLE t1; select abs(10/0); select abs(NULL); + +# +# Bug #9894 (negative to unsigned column) +# +set @@sql_mode='traditional'; +create table t1( d1 decimal(18) unsigned, d2 decimal(20) unsigned, d3 decimal (22) unsigned); +--error 1264 +insert into t1 values(1,-1,-1); +drop table t1; -- cgit v1.2.1 From 3eb21ef361283d52a5bce7c90ce1e62791d48647 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Jun 2005 13:11:04 +0500 Subject: Fix for bug #8425 (Insufficient precision in the '/' operation) As the bug was already fixed, just testcase added here mysql-test/r/type_newdecimal.result: test result fixed mysql-test/t/type_newdecimal.test: test case added --- mysql-test/r/type_newdecimal.result | 13 +++++++++++++ mysql-test/t/type_newdecimal.test | 12 ++++++++++++ 2 files changed, 25 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index 26ea9c2e5d2..09fbc6b8143 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -896,3 +896,16 @@ create table t1( d1 decimal(18) unsigned, d2 decimal(20) unsigned, d3 decimal (2 insert into t1 values(1,-1,-1); ERROR 22003: Out of range value adjusted for column 'd2' at row 1 drop table t1; +set @@div_precision_increment=15; +create table t1 (col1 int, col2 decimal(30,25), col3 numeric(30,25)); +insert into t1 values (1,0.0123456789012345678912345,0.0123456789012345678912345); +select col2/9999999999 from t1 where col1=1; +col2/9999999999 +0.000000000001234567890246913578 +select 9999999999/col2 from t1 where col1=1; +9999999999/col2 +810000007209.000065537105051 +select 77777777/7777777; +77777777/7777777 +10.000000900000090 +drop table t1; diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index de5fb09186b..6bff6c22abc 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -934,3 +934,15 @@ create table t1( d1 decimal(18) unsigned, d2 decimal(20) unsigned, d3 decimal (2 --error 1264 insert into t1 values(1,-1,-1); drop table t1; + +# +# Bug #8425 (insufficient precision of the division) +# +set @@div_precision_increment=15; +create table t1 (col1 int, col2 decimal(30,25), col3 numeric(30,25)); +insert into t1 values (1,0.0123456789012345678912345,0.0123456789012345678912345); +select col2/9999999999 from t1 where col1=1; +select 9999999999/col2 from t1 where col1=1; +select 77777777/7777777; +drop table t1; + -- cgit v1.2.1 From caa903ef8344d67beb3fcd2e1e40e6e295c1f107 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Jun 2005 11:49:24 +0200 Subject: - make sure to include mysql-test/t/*.sql files in the binary distributions and when "make install" is called (mysql_delimiter.sql was missing) mysql-test/Makefile.am: - make sure to include mysql-test/t/*.sql files in the binary distributions (mysql_delimiter.sql was missing) scripts/make_binary_distribution.sh: - make sure to include mysql-test/t/*.sql files when doing a "make install" (mysql_delimiter.sql was missing) --- mysql-test/Makefile.am | 1 + 1 file changed, 1 insertion(+) (limited to 'mysql-test') diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index a5e3f7977ee..3cd1fb6f996 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -70,6 +70,7 @@ install-data-local: $(DESTDIR)$(testdir)/lib $(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(testdir) $(INSTALL_DATA) $(srcdir)/t/*.test $(DESTDIR)$(testdir)/t + $(INSTALL_DATA) $(srcdir)/t/*.sql $(DESTDIR)$(testdir)/t -$(INSTALL_DATA) $(srcdir)/t/*.disabled $(DESTDIR)$(testdir)/t $(INSTALL_DATA) $(srcdir)/t/*.opt $(DESTDIR)$(testdir)/t $(INSTALL_DATA) $(srcdir)/t/*.sh $(DESTDIR)$(testdir)/t -- cgit v1.2.1 From 4408350b51278b085533050f4ad5ef59955baccd Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Jun 2005 15:49:36 +0500 Subject: Fix for bug #8429 (FORMAT returns incorrect result) mysql-test/r/func_math.result: test result ixed mysql-test/t/func_math.test: test case added sql/item_strfunc.cc: Item_func_format::val_str now handles 'decimal' and 'double' values in different way --- mysql-test/r/func_math.result | 13 +++++++++++++ mysql-test/t/func_math.test | 12 ++++++++++++ 2 files changed, 25 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index 0798a034c3e..e4889289c18 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -130,3 +130,16 @@ Warnings: Note 1003 select degrees(pi()) AS `degrees(pi())`,radians(360) AS `radians(360)` select rand(rand); ERROR 42S22: Unknown column 'rand' in 'field list' +create table t1 (col1 int, col2 decimal(60,30)); +insert into t1 values(1,1234567890.12345); +select format(col2,7) from t1; +format(col2,7) +1,234,567,890.1234500 +select format(col2,8) from t1; +format(col2,8) +1,234,567,890.12345000 +insert into t1 values(7,1234567890123456.12345); +select format(col2,6) from t1 where col1=7; +format(col2,6) +1,234,567,890,123,456.123450 +drop table t1; diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test index 0eac72782a8..b21f38052b6 100644 --- a/mysql-test/t/func_math.test +++ b/mysql-test/t/func_math.test @@ -67,3 +67,15 @@ explain extended select degrees(pi()),radians(360); --error 1054 select rand(rand); + +# +# Bug #8459 (FORMAT returns incorrect result) +# +create table t1 (col1 int, col2 decimal(60,30)); +insert into t1 values(1,1234567890.12345); +select format(col2,7) from t1; +select format(col2,8) from t1; +insert into t1 values(7,1234567890123456.12345); +select format(col2,6) from t1 where col1=7; +drop table t1; + -- cgit v1.2.1 From 2fded7d5c4b371f100368c833faba425a845a8fc Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Jun 2005 20:35:37 +0500 Subject: Fix for bug #9764 (DISTINCT IFNULL truncates data) mysql-test/r/create.result: test result fixed mysql-test/r/distinct.result: test result fixed mysql-test/t/distinct.test: test case added sql/item_cmpfunc.cc: max_length should be calculated differently for DECIMAL_RESULT and others --- mysql-test/r/create.result | 2 +- mysql-test/r/distinct.result | 8 ++++++++ mysql-test/t/distinct.test | 8 ++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) (limited to 'mysql-test') diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index be527630078..9d96cef345f 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -434,7 +434,7 @@ d date YES NULL e varchar(1) NO f datetime YES NULL g time YES NULL -h varbinary(23) NO +h longblob NO dd time YES NULL select * from t2; a b c d e f g h dd diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index 955ea5b8673..3ad2b73f1d3 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -464,3 +464,11 @@ SELECT DISTINCT html,SUM(rout)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin; html prod 1 0.0000 drop table t1; +create table t1 (id int, dsc varchar(50)); +insert into t1 values (1, "line number one"), (2, "line number two"), (3, "line number three"); +select distinct id, IFNULL(dsc, '-') from t1; +id IFNULL(dsc, '-') +1 line number one +2 line number two +3 line number three +drop table t1; diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test index a3862786cc3..057c9bd9239 100644 --- a/mysql-test/t/distinct.test +++ b/mysql-test/t/distinct.test @@ -332,3 +332,11 @@ CREATE TABLE t1 ( INSERT INTO t1 VALUES ('1',1,0); SELECT DISTINCT html,SUM(rout)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin; drop table t1; + +# +# Bug 9784 DISTINCT IFNULL truncates data +# +create table t1 (id int, dsc varchar(50)); +insert into t1 values (1, "line number one"), (2, "line number two"), (3, "line number three"); +select distinct id, IFNULL(dsc, '-') from t1; +drop table t1; -- cgit v1.2.1 From 1c5c678c139e2a2fbcda19a5d52ca35a07ecc7f9 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Jun 2005 21:56:22 +0500 Subject: Fix for bug #10896 (0.00 > -0.00) mysql-test/r/type_newdecimal.result: test result fixed mysql-test/t/type_newdecimal.test: test case added sql/my_decimal.h: we neede to check for zero here not to get -0.00 --- mysql-test/r/type_newdecimal.result | 11 +++++++++++ mysql-test/t/type_newdecimal.test | 11 +++++++++++ 2 files changed, 22 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index 09fbc6b8143..c0693d1585c 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -896,6 +896,8 @@ create table t1( d1 decimal(18) unsigned, d2 decimal(20) unsigned, d3 decimal (2 insert into t1 values(1,-1,-1); ERROR 22003: Out of range value adjusted for column 'd2' at row 1 drop table t1; +set sql_mode=''; +set @sav_dpi= @@div_precision_increment; set @@div_precision_increment=15; create table t1 (col1 int, col2 decimal(30,25), col3 numeric(30,25)); insert into t1 values (1,0.0123456789012345678912345,0.0123456789012345678912345); @@ -909,3 +911,12 @@ select 77777777/7777777; 77777777/7777777 10.000000900000090 drop table t1; +set div_precision_increment= @sav_dpi; +create table t1 (a decimal(4,2)); +insert into t1 values (0.00); +select * from t1 where a > -0.00; +a +select * from t1 where a = -0.00; +a +0.00 +drop table t1; diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index 6bff6c22abc..d1d595285a2 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -934,10 +934,12 @@ create table t1( d1 decimal(18) unsigned, d2 decimal(20) unsigned, d3 decimal (2 --error 1264 insert into t1 values(1,-1,-1); drop table t1; +set sql_mode=''; # # Bug #8425 (insufficient precision of the division) # +set @sav_dpi= @@div_precision_increment; set @@div_precision_increment=15; create table t1 (col1 int, col2 decimal(30,25), col3 numeric(30,25)); insert into t1 values (1,0.0123456789012345678912345,0.0123456789012345678912345); @@ -945,4 +947,13 @@ select col2/9999999999 from t1 where col1=1; select 9999999999/col2 from t1 where col1=1; select 77777777/7777777; drop table t1; +set div_precision_increment= @sav_dpi; +# +# Bug #10896 (0.00 > -0.00) +# +create table t1 (a decimal(4,2)); +insert into t1 values (0.00); +select * from t1 where a > -0.00; +select * from t1 where a = -0.00; +drop table t1; -- cgit v1.2.1 From 4e0bbc1b6eb6716a0774a1678be24b4a2463b8c9 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jun 2005 01:07:52 +0400 Subject: Fix for bug #11158 "Can't perform multi-delete in stored procedure". In order to make multi-delete SP friendly we need to have all table locks for the elements of main statement table list properly set at the end of parsing. Also performed small cleanup: We don't need relink_tables_for_multidelete() any longer since the only case now when TABLE_LIST::correspondent_table is non-zero are tables in auxilary table list of multi-delete and these tables are handled specially in mysql_multi_delete_prepare(). mysql-test/r/sp-threads.result: Added test case for bug #11158 "Can't perform multi-delete in stored procedure". mysql-test/t/sp-threads.test: Added test case for bug #11158 "Can't perform multi-delete in stored procedure". sql/mysql_priv.h: - Removed third argument from the declaration of multi_delete_precheck() as nowdays we calculate number of tables in multi-delete from which we are going to delete rows right at the end of statement parsing. - Introduced definition of multi_delete_set_locks_and_link_aux_tables() which is responsible for propagation of proper table locks from multi-delete's auxilary table list to the main list and binding corresponding tables in these two lists. sql/sql_base.cc: Removed relink_tables_for_multidelete() routine and its invocations. We don't need them in 5.0 since the only case now when TABLE_LIST::correspondent_table is non-zero are tables in auxilary table list of multi-delete and these tables are handled specially in mysql_multi_delete_prepare(). sql/sql_lex.h: LEX::table_count Added description of new role of this LEX member for multi-delete. Now for this statement we store number of tables from which we should delete records there. sql/sql_parse.cc: multi_delete_precheck(): Moved code which is responsible for iterating through auxilary table list and binding its elements with corresponding elements of main table list, and properly updating locks in it to separate function - multi_delete_set_locks_and_link_aux_tables(). This is because in order to make multi-delete SP friendly we need to have all locks set properly at the end of statement parsing. So we are introducing new function which will be called from parser. We also calculate number of tables from which we are going to perform deletions there and store this number for later usage in LEX::table_count. Also removed some no longer needed code. sql/sql_prepare.cc: mysql_test_multidelete(): Now multi_delete_precheck() takes only two arguments, so we don't need to pass fake third parameter. sql/sql_yacc.yy: delete: In order to make multi-delete SP friendly we need to have all table locks for the elements of main statement table list properly set at the end of parsing. --- mysql-test/r/sp-threads.result | 15 +++++++++++++++ mysql-test/t/sp-threads.test | 26 ++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/sp-threads.result b/mysql-test/r/sp-threads.result index a081e520496..a9d50e6e697 100644 --- a/mysql-test/r/sp-threads.result +++ b/mysql-test/r/sp-threads.result @@ -40,3 +40,18 @@ Id User Host db Command Time State Info unlock tables; drop procedure bug9486; drop table t1, t2; +drop procedure if exists bug11158; +create procedure bug11158() delete t1 from t1, t2 where t1.id = t2.id; +create table t1 (id int, j int); +insert into t1 values (1, 1), (2, 2); +create table t2 (id int); +insert into t2 values (1); +call bug11158(); +select * from t1; +id j +2 2 +lock tables t2 read; +call bug11158(); +unlock tables; +drop procedure bug11158; +drop table t1, t2; diff --git a/mysql-test/t/sp-threads.test b/mysql-test/t/sp-threads.test index 608ac3e2ee7..8fec5d14bc1 100644 --- a/mysql-test/t/sp-threads.test +++ b/mysql-test/t/sp-threads.test @@ -84,6 +84,32 @@ reap; drop procedure bug9486; drop table t1, t2; +# +# BUG#11158: Can't perform multi-delete in stored procedure +# +--disable_warnings +drop procedure if exists bug11158; +--enable_warnings +create procedure bug11158() delete t1 from t1, t2 where t1.id = t2.id; +create table t1 (id int, j int); +insert into t1 values (1, 1), (2, 2); +create table t2 (id int); +insert into t2 values (1); +# Procedure should work and cause proper effect (delete only first row) +call bug11158(); +select * from t1; +# Also let us test that we obtain only read (and thus non exclusive) lock +# for table from which we are not going to delete rows. +connection con2root; +lock tables t2 read; +connection con1root; +call bug11158(); +connection con2root; +unlock tables; +connection con1root; +# Clean-up +drop procedure bug11158; +drop table t1, t2; # # BUG#NNNN: New bug synopsis -- cgit v1.2.1 From 3fbdaf36bece421befcc0bc9c2e9e31d6326a4b4 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jun 2005 01:46:30 +0400 Subject: Disable dynamic SQL in stored routines. This is to close Bug#10975, Bug#7115, Bug#10605 This feature will be implemented in a future release. mysql-test/r/sp-error.result: Test results fixed (test coverage for disabled Dynamic SQL in SP). mysql-test/t/sp-error.test: Test coverage to disable Dynamic SQL in stored routines. sql/sql_yacc.yy: Disable dynamic SQL in stored routines. --- mysql-test/r/sp-error.result | 14 ++++++++++++++ mysql-test/t/sp-error.test | 21 +++++++++++++++++++++ 2 files changed, 35 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index 1dc97124a07..b6ba737a8ba 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -672,3 +672,17 @@ select default(t30.s1) from t30; end| drop procedure bug10969| drop table t1| +prepare stmt from "select 1"; +create procedure p() deallocate prepare stmt; +ERROR 0A000: DEALLOCATE is not allowed in stored procedures +create function f() returns int begin deallocate prepare stmt; +ERROR 0A000: DEALLOCATE is not allowed in stored procedures +create procedure p() prepare stmt from "select 1"; +ERROR 0A000: PREPARE is not allowed in stored procedures +create function f() returns int begin prepare stmt from "select 1"; +ERROR 0A000: PREPARE is not allowed in stored procedures +create procedure p() execute stmt; +ERROR 0A000: EXECUTE is not allowed in stored procedures +create function f() returns int begin execute stmt; +ERROR 0A000: EXECUTE is not allowed in stored procedures +deallocate prepare stmt; diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index 891e282e335..faf6d8b4de3 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -965,3 +965,24 @@ drop procedure bug10969| drop table t1| delimiter ;| + +# +# Bug#10975, #10605, #7115: Dynamic SQL by means of +# PREPARE/EXECUTE/DEALLOCATE is not supported yet. +# Check that an error message is returned. +# +prepare stmt from "select 1"; +--error ER_SP_BADSTATEMENT +create procedure p() deallocate prepare stmt; +--error ER_SP_BADSTATEMENT +create function f() returns int begin deallocate prepare stmt; +--error ER_SP_BADSTATEMENT +create procedure p() prepare stmt from "select 1"; +--error ER_SP_BADSTATEMENT +create function f() returns int begin prepare stmt from "select 1"; +--error ER_SP_BADSTATEMENT +create procedure p() execute stmt; +--error ER_SP_BADSTATEMENT +create function f() returns int begin execute stmt; +deallocate prepare stmt; + -- cgit v1.2.1 From 98c2ec75387113c265f4eaa9c66c28577516d51b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jun 2005 12:44:44 +0500 Subject: Fix for bug #8482 (Incorrect rounding) mysql-test/r/type_newdecimal.result: test result fixed mysql-test/t/type_newdecimal.test: test case added strings/decimal.c: in round(999.9, 0) case we have to increase intg --- mysql-test/r/type_newdecimal.result | 8 ++++++++ mysql-test/t/type_newdecimal.test | 7 +++++++ 2 files changed, 15 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index c0693d1585c..b406dbab82f 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -896,6 +896,14 @@ create table t1( d1 decimal(18) unsigned, d2 decimal(20) unsigned, d3 decimal (2 insert into t1 values(1,-1,-1); ERROR 22003: Out of range value adjusted for column 'd2' at row 1 drop table t1; +create table t1 (col1 decimal(5,2), col2 numeric(5,2)); +insert into t1 values (999.999,999.999); +ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +insert into t1 values (-999.999,-999.999); +ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +select * from t1; +col1 col2 +drop table t1; set sql_mode=''; set @sav_dpi= @@div_precision_increment; set @@div_precision_increment=15; diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index d1d595285a2..6199bd34fa9 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -934,6 +934,13 @@ create table t1( d1 decimal(18) unsigned, d2 decimal(20) unsigned, d3 decimal (2 --error 1264 insert into t1 values(1,-1,-1); drop table t1; +create table t1 (col1 decimal(5,2), col2 numeric(5,2)); +--error 1264 +insert into t1 values (999.999,999.999); +--error 1264 +insert into t1 values (-999.999,-999.999); +select * from t1; +drop table t1; set sql_mode=''; # -- cgit v1.2.1 From f160958770ce85fe0d26f3b816d059caaf2fd67d Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jun 2005 14:39:29 +0500 Subject: Fix for bug#10732: Set SQL_MODE to NULL gives garbled error message generate proper error message if we use SET ... = NULL for 'set' variables --- mysql-test/r/sql_mode.result | 2 ++ mysql-test/t/sql_mode.test | 5 +++++ 2 files changed, 7 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/sql_mode.result b/mysql-test/r/sql_mode.result index c18be2df403..652913d1fdb 100644 --- a/mysql-test/r/sql_mode.result +++ b/mysql-test/r/sql_mode.result @@ -138,3 +138,5 @@ t1 CREATE TABLE `t1` ( `min_num` decimal(7,6) default '0.000001' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1 ; +set @@SQL_MODE=NULL; +ERROR 42000: Variable 'sql_mode' can't be set to the value of 'NULL' diff --git a/mysql-test/t/sql_mode.test b/mysql-test/t/sql_mode.test index f841d36e837..985c0853bd2 100644 --- a/mysql-test/t/sql_mode.test +++ b/mysql-test/t/sql_mode.test @@ -80,3 +80,8 @@ create table t1 ( min_num dec(6,6) default .000001); show create table t1; drop table t1 ; +# +# Bug #10732: Set SQL_MODE to NULL gives garbled error message +# +--error 1231 +set @@SQL_MODE=NULL; -- cgit v1.2.1 From 0e54a4e84f11d13421e85b93d1fac51c31f92bf0 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jun 2005 12:26:45 +0200 Subject: update result file for ps7_ndb mysql-test/r/ps_7ndb.result: fix result file --- mysql-test/r/ps_7ndb.result | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result index e7a4ff40e2b..f5750d947b5 100644 --- a/mysql-test/r/ps_7ndb.result +++ b/mysql-test/r/ps_7ndb.result @@ -1151,13 +1151,13 @@ execute stmt1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def id 8 3 1 N 32929 0 63 def select_type 253 19 6 N 1 31 8 -def table 253 64 2 N 1 31 8 -def type 253 10 3 N 1 31 8 +def table 253 64 2 Y 0 31 8 +def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 def key_len 8 3 0 Y 32928 0 63 def ref 253 1024 0 Y 0 31 8 -def rows 8 10 1 N 32929 0 63 +def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t9 ALL NULL NULL NULL NULL 2 -- cgit v1.2.1 From 146893a7a0b632d8fcb90e391c788dc34db84bef Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jun 2005 15:27:26 +0500 Subject: Fix for bug #10083 (round doesn't increase scale) mysql-test/r/func_math.result: test result fixed mysql-test/t/func_math.test: test case added sql/item_func.cc: now we always use decimals_to_set --- mysql-test/r/func_math.result | 3 +++ mysql-test/t/func_math.test | 5 +++++ 2 files changed, 8 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index e4889289c18..c7674c57c8d 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -143,3 +143,6 @@ select format(col2,6) from t1 where col1=7; format(col2,6) 1,234,567,890,123,456.123450 drop table t1; +select round(150, 2); +round(150, 2) +150.00 diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test index b21f38052b6..03057af6911 100644 --- a/mysql-test/t/func_math.test +++ b/mysql-test/t/func_math.test @@ -79,3 +79,8 @@ insert into t1 values(7,1234567890123456.12345); select format(col2,6) from t1 where col1=7; drop table t1; + +# +# Bug #10083 (round doesn't increase decimals) +# +select round(150, 2); -- cgit v1.2.1 From d974ce936e6e54a28f08a349f865554e029c08dc Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jun 2005 18:00:50 +0400 Subject: Fix broken test suite. --- mysql-test/r/ps_6bdb.result | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/ps_6bdb.result b/mysql-test/r/ps_6bdb.result index f69db9c1e42..06be8750cc4 100644 --- a/mysql-test/r/ps_6bdb.result +++ b/mysql-test/r/ps_6bdb.result @@ -1151,13 +1151,13 @@ execute stmt1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def id 8 3 1 N 32929 0 63 def select_type 253 19 6 N 1 31 8 -def table 253 64 2 N 1 31 8 -def type 253 10 3 N 1 31 8 +def table 253 64 2 Y 0 31 8 +def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 def key_len 8 3 0 Y 32928 0 63 def ref 253 1024 0 Y 0 31 8 -def rows 8 10 1 N 32929 0 63 +def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t9 ALL NULL NULL NULL NULL 3 -- cgit v1.2.1 From c995109b699a56e94bbc82754b17622f271ebb39 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jun 2005 16:06:15 +0100 Subject: Bug#11028 Crash on create table like Report error instead of crashing mysql-test/r/create.result: Test for bug 11028 mysql-test/t/create.test: Test for bug 11028 sql/sql_table.cc: fix for null db name --- mysql-test/r/create.result | 6 ++++++ mysql-test/t/create.test | 11 +++++++++++ 2 files changed, 17 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index de3840447dc..4c4b388388a 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -580,3 +580,9 @@ ERROR 42000: Incorrect database name 'xyz' create table t1(t1.name int); create table t2(test.t2.name int); drop table t1,t2; +create database mysqltest; +use mysqltest; +drop database mysqltest; +create table test.t1 like x; +ERROR 42000: Incorrect database name 'NULL' +drop table if exists test.t1; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index b73cd28c71c..ca3446b46fc 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -492,3 +492,14 @@ create table t1(t1.name int); create table t2(test.t2.name int); drop table t1,t2; +# +# Bug#11028: Crash on create table like +# +create database mysqltest; +use mysqltest; +drop database mysqltest; +--error 1102 +create table test.t1 like x; +--disable_warnings +drop table if exists test.t1; +--enable_warnings -- cgit v1.2.1 From 8ab8fca7d54c0f177ef57f8c09e203eb212b05e8 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jun 2005 09:16:16 -0700 Subject: select.test, select.result: Added a test case for bug #10084. sql_yacc.yy: Fixed bug #10084: STRAIGHT_JOIN for expressions with ON was added. sql/sql_yacc.yy: Fixed bug #10084: STRAIGHT_JOIN for expressions with ON was added. mysql-test/r/select.result: Added a test case for bug #10084. mysql-test/t/select.test: Added a test case for bug #10084. --- mysql-test/r/select.result | 17 +++++++++++++++++ mysql-test/t/select.test | 16 ++++++++++++++++ 2 files changed, 33 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index eaed7719673..1c0321ac658 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2682,3 +2682,20 @@ AND FK_firma_id = 2; COUNT(*) 0 drop table t1; +CREATE TABLE t1 (a int); +CREATE TABLE t2 (a int); +INSERT INTO t1 VALUES (1), (2), (3), (4), (5); +INSERT INTO t2 VALUES (2), (4), (6); +SELECT t1.a FROM t1 STRAIGHT_JOIN t2 ON t1.a=t2.a; +a +2 +4 +EXPLAIN SELECT t1.a FROM t1 STRAIGHT_JOIN t2 ON t1.a=t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where +EXPLAIN SELECT t1.a FROM t1 INNER JOIN t2 ON t1.a=t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +DROP TABLE t1,t2; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index b6132d23d02..372325c4cbd 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -2255,3 +2255,19 @@ AND FK_firma_id = 2; drop table t1; +# +# Test for bug #10084: STRAIGHT_JOIN with ON expression +# + +CREATE TABLE t1 (a int); +CREATE TABLE t2 (a int); +INSERT INTO t1 VALUES (1), (2), (3), (4), (5); +INSERT INTO t2 VALUES (2), (4), (6); + +SELECT t1.a FROM t1 STRAIGHT_JOIN t2 ON t1.a=t2.a; + +EXPLAIN SELECT t1.a FROM t1 STRAIGHT_JOIN t2 ON t1.a=t2.a; +EXPLAIN SELECT t1.a FROM t1 INNER JOIN t2 ON t1.a=t2.a; + +DROP TABLE t1,t2; + -- cgit v1.2.1 From a1650deab6a1685dc81535ab332c28fb706ee1c8 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jun 2005 11:01:23 -0700 Subject: Adding auxiliary scripts that allow to display messages in result files from within test files - show_msg.inc - displays a message followed by a line of '-' at the length of the messgae - show_msg80.inc - displays a message followed by a line of '-' with a fixed length of 80 mysql-test/r/mysqltest.result: Updated result file mysql-test/t/mysqltest.test: Added test cases to test the show_msg.inc and show_msg80.inc auxiliary files BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- mysql-test/include/show_msg.inc | 19 +++++++++++++++++++ mysql-test/include/show_msg80.inc | 23 +++++++++++++++++++++++ mysql-test/r/mysqltest.result | 14 ++++++++++++++ mysql-test/t/mysqltest.test | 20 ++++++++++++++++++++ 4 files changed, 76 insertions(+) create mode 100755 mysql-test/include/show_msg.inc create mode 100755 mysql-test/include/show_msg80.inc (limited to 'mysql-test') diff --git a/mysql-test/include/show_msg.inc b/mysql-test/include/show_msg.inc new file mode 100755 index 00000000000..5a29541edcf --- /dev/null +++ b/mysql-test/include/show_msg.inc @@ -0,0 +1,19 @@ +#### include/show_msg.inc +# +# This file writes the value set in @message into the +# a protocol file as part of executing a test sequence +# +# Usage: +# Add the following to any *.test file: +# : +# set @message="This is a message example"; +# --source include/show_msg.inc +# : +# + +--disable_query_log +SET @utf8_message = CONVERT(@message using utf8); +select @utf8_message as "" +union +select repeat(CONVERT('-' using utf8),char_length(@utf8_message)); +--enable_query_log diff --git a/mysql-test/include/show_msg80.inc b/mysql-test/include/show_msg80.inc new file mode 100755 index 00000000000..d9a59c5517a --- /dev/null +++ b/mysql-test/include/show_msg80.inc @@ -0,0 +1,23 @@ +#### include/show_msg80.inc +# +# This file writes the value set in @message into the +# a protocol file as part of executing a test sequence +# with a dash line that is fixed on 80 characters. +# This can be used in the case of long messages, +# multi line messages that exceed 80 or if an 80 char +# line is desired for short messages. +# +# Usage: +# Add the following to any *.test file: +# : +# set @message="This is a message example"; +# --source include/show_msg80.inc +# : +# + +--disable_query_log +SET @utf8_message = CONVERT(@message using utf8); +select @utf8_message as "" +union +select repeat(CONVERT('-' using utf8),80); +--enable_query_log diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index 51e56c21a07..87e2fca970b 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -148,3 +148,17 @@ a'b a"b select 'aaa\\','aa''a',"aa""a"; aaa\ aa'a aa"a aaa\ aa'a aa"a +SET @message = 'Here comes a message'; + +Here comes a message +-------------------- +SET @message = USER(); + +root@localhost +-------------- +SET @message = 'Here comes a very very long message that is longer then 80 characters +on multiple lines'; + +Here comes a very very long message that is longer then 80 characters +on multiple lines +-------------------------------------------------------------------------------- diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 067b0db492f..4e16e57058d 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -295,3 +295,23 @@ select 1 as `a'b`, 2 as `a"b`; # Test escaping of quotes select 'aaa\\','aa''a',"aa""a"; + + + +# +# Check of include/show_msg.inc +# + +# The message contains in most cases a string with the default character set +SET @message = 'Here comes a message'; +--source include/show_msg.inc + +# The message could also contain a string with character set utf8 +SET @message = USER(); +--source include/show_msg.inc + +# The message contains more then 80 characters on multiple lines +SET @message = 'Here comes a very very long message that is longer then 80 characters +on multiple lines'; +--source include/show_msg80.inc + -- cgit v1.2.1 From 751089491c337c436e398e31e79410f7929f8dd3 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jun 2005 21:20:34 -0700 Subject: Update test results. type_varchar changed because the size of the key now gets changed along with the size of the field as long as the original key had the same length as the length of the field (or is unspecified originally, as in the test). mysql-test/r/heap.result: Update results mysql-test/r/type_varchar.result: Update results --- mysql-test/r/heap.result | 2 +- mysql-test/r/type_varchar.result | 54 ++++++++++++++++++++-------------------- 2 files changed, 28 insertions(+), 28 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result index 52bf99d45ea..22304c4a93d 100644 --- a/mysql-test/r/heap.result +++ b/mysql-test/r/heap.result @@ -699,5 +699,5 @@ ERROR 42000: Incorrect table definition; there can be only one auto column and i create table t1 (c char(255), primary key(c(90))); insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); -ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 1 +ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 1 drop table t1; diff --git a/mysql-test/r/type_varchar.result b/mysql-test/r/type_varchar.result index fed03cd8d71..e3b12cc36e3 100644 --- a/mysql-test/r/type_varchar.result +++ b/mysql-test/r/type_varchar.result @@ -126,13 +126,13 @@ Some sample data Some samples explain select * from t1 where v like 'This is a test' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort +1 SIMPLE t1 range v v 258 NULL 3 Using where; Using index explain select * from t1 where v='This is a test' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 257 const 3 Using where +1 SIMPLE t1 ref v v 258 const 3 Using where; Using index explain select * from t1 where v like 'S%' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort +1 SIMPLE t1 range v v 258 NULL 2 Using where; Using index alter table t1 change v v varchar(256); select * from t1 where v like 'This is a test' order by v; v @@ -150,13 +150,13 @@ Some sample data Some samples explain select * from t1 where v like 'This is a test' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort +1 SIMPLE t1 range v v 259 NULL 3 Using where; Using index explain select * from t1 where v='This is a test' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 257 const 3 Using where +1 SIMPLE t1 ref v v 259 const 3 Using where; Using index explain select * from t1 where v like 'S%' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort +1 SIMPLE t1 range v v 259 NULL 2 Using where; Using index alter table t1 change v v varchar(257); select * from t1 where v like 'This is a test' order by v; v @@ -174,13 +174,13 @@ Some sample data Some samples explain select * from t1 where v like 'This is a test' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort +1 SIMPLE t1 range v v 260 NULL 3 Using where; Using index explain select * from t1 where v='This is a test' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 257 const 3 Using where +1 SIMPLE t1 ref v v 260 const 3 Using where; Using index explain select * from t1 where v like 'S%' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort +1 SIMPLE t1 range v v 260 NULL 2 Using where; Using index alter table t1 change v v varchar(258); select * from t1 where v like 'This is a test' order by v; v @@ -198,13 +198,13 @@ Some sample data Some samples explain select * from t1 where v like 'This is a test' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort +1 SIMPLE t1 range v v 261 NULL 3 Using where; Using index explain select * from t1 where v='This is a test' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 257 const 3 Using where +1 SIMPLE t1 ref v v 261 const 3 Using where; Using index explain select * from t1 where v like 'S%' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort +1 SIMPLE t1 range v v 261 NULL 2 Using where; Using index alter table t1 change v v varchar(259); select * from t1 where v like 'This is a test' order by v; v @@ -222,13 +222,13 @@ Some sample data Some samples explain select * from t1 where v like 'This is a test' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort +1 SIMPLE t1 range v v 262 NULL 3 Using where; Using index explain select * from t1 where v='This is a test' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 257 const 3 Using where +1 SIMPLE t1 ref v v 262 const 3 Using where; Using index explain select * from t1 where v like 'S%' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort +1 SIMPLE t1 range v v 262 NULL 2 Using where; Using index alter table t1 change v v varchar(258); select * from t1 where v like 'This is a test' order by v; v @@ -246,13 +246,13 @@ Some sample data Some samples explain select * from t1 where v like 'This is a test' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort +1 SIMPLE t1 range v v 261 NULL 3 Using where; Using index explain select * from t1 where v='This is a test' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 257 const 3 Using where +1 SIMPLE t1 ref v v 261 const 3 Using where; Using index explain select * from t1 where v like 'S%' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort +1 SIMPLE t1 range v v 261 NULL 2 Using where; Using index alter table t1 change v v varchar(257); select * from t1 where v like 'This is a test' order by v; v @@ -270,13 +270,13 @@ Some sample data Some samples explain select * from t1 where v like 'This is a test' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort +1 SIMPLE t1 range v v 260 NULL 3 Using where; Using index explain select * from t1 where v='This is a test' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 257 const 3 Using where +1 SIMPLE t1 ref v v 260 const 3 Using where; Using index explain select * from t1 where v like 'S%' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort +1 SIMPLE t1 range v v 260 NULL 2 Using where; Using index alter table t1 change v v varchar(256); select * from t1 where v like 'This is a test' order by v; v @@ -294,13 +294,13 @@ Some sample data Some samples explain select * from t1 where v like 'This is a test' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort +1 SIMPLE t1 range v v 259 NULL 3 Using where; Using index explain select * from t1 where v='This is a test' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 257 const 3 Using where +1 SIMPLE t1 ref v v 259 const 3 Using where; Using index explain select * from t1 where v like 'S%' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort +1 SIMPLE t1 range v v 259 NULL 2 Using where; Using index alter table t1 change v v varchar(255); select * from t1 where v like 'This is a test' order by v; v @@ -318,13 +318,13 @@ Some sample data Some samples explain select * from t1 where v like 'This is a test' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort +1 SIMPLE t1 range v v 258 NULL 3 Using where; Using index explain select * from t1 where v='This is a test' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 257 const 3 Using where +1 SIMPLE t1 ref v v 258 const 3 Using where; Using index explain select * from t1 where v like 'S%' order by v; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort +1 SIMPLE t1 range v v 258 NULL 2 Using where; Using index alter table t1 change v v varchar(254); select * from t1 where v like 'This is a test' order by v; v -- cgit v1.2.1 From 9b294f596a706b4bd3016516b3e1e13fc8b855bd Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 10 Jun 2005 15:30:16 +0200 Subject: - added missing files std_data/server-cert.pem and std_data/server-key.pem to make the SSL tests pass --- mysql-test/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mysql-test') diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index 75adc45d73a..0480c83296e 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -35,7 +35,8 @@ testdir = $(benchdir_root)/mysql-test EXTRA_SCRIPTS = mysql-test-run.sh mysql-test-run.pl install_test_db.sh EXTRA_DIST = $(EXTRA_SCRIPTS) test_SCRIPTS = mysql-test-run install_test_db -test_DATA = std_data/client-key.pem std_data/client-cert.pem std_data/cacert.pem +test_DATA = std_data/client-key.pem std_data/client-cert.pem std_data/cacert.pem \ + std_data/server-cert.pem std_data/server-key.pem CLEANFILES = $(test_SCRIPTS) $(test_DATA) INCLUDES = -I$(srcdir)/../include -I../include -I.. -- cgit v1.2.1