2732 Georgi Kodinov 2008-12-02
moved the version to 5.0-main
modified:
.bzr-mysql/default.conf
2731 Georgi Kodinov 2008-12-01
addendum to the fix for bug #39920 : post-merge test suite fixes
modified:
mysql-test/r/timezone2.result
2730 Georgi Kodinov 2008-12-01 [merge]
merged 5.0-main into 5.0-bugteam
modified:
configure.in
=== modified file 'client/mysqlcheck.c'
--- a/client/mysqlcheck.c 2008-01-23 16:37:46 +0000
+++ b/client/mysqlcheck.c 2008-11-14 07:40:46 +0000
@@ -488,9 +488,14 @@ static int process_all_tables_in_db(char
LINT_INIT(res);
if (use_db(database))
return 1;
- if (mysql_query(sock, "SHOW /*!50002 FULL*/ TABLES") ||
- !((res= mysql_store_result(sock))))
+ if ((mysql_query(sock, "SHOW /*!50002 FULL*/ TABLES") &&
+ mysql_query(sock, "SHOW TABLES")) ||
+ !(res= mysql_store_result(sock)))
+ {
+ my_printf_error(0, "Error: Couldn't get table list for database %s: %s",
+ MYF(0), database, mysql_error(sock));
return 1;
+ }
num_columns= mysql_num_fields(res);
=== modified file 'extra/perror.c'
--- a/extra/perror.c 2007-03-28 17:46:42 +0000
+++ b/extra/perror.c 2008-11-27 12:33:40 +0000
@@ -185,11 +185,36 @@ static const char *get_ha_error_msg(int
}
+#if defined(__WIN__)
+static my_bool print_win_error_msg(DWORD error, my_bool verbose)
+{
+ LPTSTR s;
+ if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, error, 0, (LPTSTR)&s, 0,
+ NULL))
+ {
+ if (verbose)
+ printf("Win32 error code %d: %s", error, s);
+ else
+ puts(s);
+ LocalFree(s);
+ return 0;
+ }
+ return 1;
+}
+#endif
+
+
+
int main(int argc,char *argv[])
{
int error,code,found;
const char *msg;
char *unknown_error = 0;
+#if defined(__WIN__)
+ my_bool skip_win_message= 0;
+#endif
MY_INIT(argv[0]);
if (get_options(&argc,&argv))
@@ -286,8 +311,15 @@ int main(int argc,char *argv[])
/* Error message still not found, look in handler error codes */
if (!(msg=get_ha_error_msg(code)))
{
- fprintf(stderr,"Illegal error code: %d\n",code);
- error=1;
+#if defined(__WIN__)
+ if (!(skip_win_message= !print_win_error_msg((DWORD)code, verbose)))
+ {
+#endif
+ fprintf(stderr,"Illegal error code: %d\n",code);
+ error=1;
+#if defined(__WIN__)
+ }
+#endif
}
else
{
@@ -298,6 +330,10 @@ int main(int argc,char *argv[])
puts(msg);
}
}
+#if defined(__WIN__)
+ if (!skip_win_message)
+ print_win_error_msg((DWORD)code, verbose);
+#endif
}
}
=== modified file 'mysql-test/include/check-testcase.test'
--- a/mysql-test/include/check-testcase.test 2006-01-26 16:54:34 +0000
+++ b/mysql-test/include/check-testcase.test 2008-11-24 21:53:32 +0000
@@ -11,12 +11,12 @@
#
# Dump all global variables
#
-show global variables;
+SHOW GLOBAL VARIABLES WHERE variable_name != 'timestamp';
#
# Dump all databases
#
-show databases;
+SHOW DATABASES;
#
# Dump the "test" database, all it's tables and their data
@@ -29,23 +29,23 @@ show databases;
#
--exec $MYSQL_DUMP --skip-comments --no-data mysql
use mysql;
-select * from columns_priv;
-select * from db order by host, db, user;
-select * from func;
-select * from help_category;
-select * from help_keyword;
-select * from help_relation;
-select * from help_relation;
-select * from host;
-select * from proc;
-select * from procs_priv;
-select * from tables_priv;
-select * from time_zone;
-select * from time_zone_leap_second;
-select * from time_zone_name;
-select * from time_zone_transition;
-select * from time_zone_transition_type;
-select * from user;
+SELECT * FROM columns_priv;
+SELECT * FROM db ORDER BY host, db, user;
+SELECT * FROM func;
+SELECT * FROM help_category;
+SELECT * FROM help_keyword;
+SELECT * FROM help_relation;
+SELECT * FROM help_relation;
+SELECT * FROM host;
+SELECT * FROM proc;
+SELECT * FROM procs_priv;
+SELECT * FROM tables_priv;
+SELECT * FROM time_zone;
+SELECT * FROM time_zone_leap_second;
+SELECT * FROM time_zone_name;
+SELECT * FROM time_zone_transition;
+SELECT * FROM time_zone_transition_type;
+SELECT * FROM user;
=== added file 'mysql-test/r/ctype_filesystem.result'
--- a/mysql-test/r/ctype_filesystem.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/ctype_filesystem.result 2008-12-01 11:34:53 +0000
@@ -0,0 +1,11 @@
+SET CHARACTER SET utf8;
+SHOW VARIABLES like 'character_sets_dir';
+Variable_name Value
+character_sets_dir MYSQL_TEST_DIR/ß/
+SHOW VARIABLES like 'character_set_filesystem';
+Variable_name Value
+character_set_filesystem latin1
+SHOW VARIABLES like 'character_set_client';
+Variable_name Value
+character_set_client utf8
+SET CHARACTER SET default;
=== modified file 'mysql-test/r/ctype_utf8.result'
--- a/mysql-test/r/ctype_utf8.result 2007-10-30 08:21:44 +0000
+++ b/mysql-test/r/ctype_utf8.result 2008-11-21 09:48:22 +0000
@@ -1813,3 +1813,35 @@ select hex(_utf8 B'001111111111');
ERROR HY000: Invalid utf8 character string: 'FF'
select (_utf8 X'616263FF');
ERROR HY000: Invalid utf8 character string: 'FF'
+CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL);
+INSERT INTO t1 VALUES (70000, 1092), (70001, 1085), (70002, 1065);
+SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
+CONVERT(a, CHAR) CONVERT(b, CHAR)
+70002 1065
+70001 1085
+70000 1092
+SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1;
+CONVERT(a, CHAR) CONVERT(b, CHAR)
+70000 1092
+70001 1085
+70002 1065
+ALTER TABLE t1 ADD UNIQUE (b);
+SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
+CONVERT(a, CHAR) CONVERT(b, CHAR)
+70002 1065
+70001 1085
+70000 1092
+DROP INDEX b ON t1;
+SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
+CONVERT(a, CHAR) CONVERT(b, CHAR)
+70002 1065
+70001 1085
+70000 1092
+ALTER TABLE t1 ADD INDEX (b);
+SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) from t1 GROUP BY b;
+CONVERT(a, CHAR) CONVERT(b, CHAR)
+70002 1065
+70001 1085
+70000 1092
+DROP TABLE t1;
+End of 5.0 tests
=== modified file 'mysql-test/r/federated.result'
--- a/mysql-test/r/federated.result 2008-09-16 17:05:30 +0000
+++ b/mysql-test/r/federated.result 2008-11-14 07:42:29 +0000
@@ -2085,6 +2085,15 @@ Table Checksum
test.t1 2465757603
DROP TABLE t1;
DROP TABLE t1;
+CREATE TABLE t1 (a TEXT, b TEXT, KEY(b(1)));
+INSERT INTO t1 VALUES (NULL, NULL), (NULL, NULL), (NULL, NULL), (NULL, NULL);
+CREATE TABLE t1
+(a TEXT, b TEXT, KEY(b(1))) ENGINE=FEDERATED
+CONNECTION='mysql://root@stripped:SLAVE_PORT/test/t1';
+SELECT t1.a FROM t1, t1 as t2 WHERE t2.b NOT LIKE t1.b;
+a
+DROP TABLE t1;
+DROP TABLE t1;
End of 5.0 tests
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_MASTER_CONCURRENT_INSERT;
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT;
=== modified file 'mysql-test/r/fulltext.result'
--- a/mysql-test/r/fulltext.result 2007-11-02 08:58:20 +0000
+++ b/mysql-test/r/fulltext.result 2008-11-11 09:10:51 +0000
@@ -469,3 +469,31 @@ SELECT * FROM t1 WHERE MATCH(a) AGAINST
a
aaaaa aaaa
DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(255), b INT, FULLTEXT(a), KEY(b));
+INSERT INTO t1 VALUES('test', 1),('test', 1),('test', 1),('test', 1),
+('test', 1),('test', 2),('test', 3),('test', 4);
+EXPLAIN SELECT * FROM t1
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext b,a a 0 1 Using where
+EXPLAIN SELECT * FROM t1 USE INDEX(a)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext a a 0 1 Using where
+EXPLAIN SELECT * FROM t1 FORCE INDEX(a)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 fulltext a a 0 1 Using where
+EXPLAIN SELECT * FROM t1 IGNORE INDEX(a)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref b b 5 const 4 Using where
+EXPLAIN SELECT * FROM t1 USE INDEX(b)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref b b 5 const 4 Using where
+EXPLAIN SELECT * FROM t1 FORCE INDEX(b)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref b b 5 const 4 Using where
+DROP TABLE t1;
=== modified file 'mysql-test/r/func_group.result'
--- a/mysql-test/r/func_group.result 2008-03-06 15:19:47 +0000
+++ b/mysql-test/r/func_group.result 2008-11-24 15:30:47 +0000
@@ -1425,4 +1425,27 @@ SELECT AVG(a), CAST(AVG(a) AS DECIMAL) F
AVG(a) CAST(AVG(a) AS DECIMAL)
15 15
DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES (1,1), (1,2), (1,3);
+SET SQL_MODE='ONLY_FULL_GROUP_BY';
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+3
+SELECT COUNT(*) FROM t1 where a=1;
+COUNT(*)
+3
+SELECT COUNT(*),a FROM t1;
+ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
+SELECT COUNT(*) FROM t1 a JOIN t1 b ON a.a= b.a;
+COUNT(*)
+9
+SELECT COUNT(*), (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a)
+FROM t1 outr;
+ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
+SELECT COUNT(*) FROM t1 a JOIN t1 outr
+ON a.a= (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a);
+COUNT(*)
+0
+SET SQL_MODE=default;
+DROP TABLE t1;
End of 5.0 tests
=== modified file 'mysql-test/r/func_sapdb.result'
--- a/mysql-test/r/func_sapdb.result 2007-10-23 13:51:43 +0000
+++ b/mysql-test/r/func_sapdb.result 2008-11-26 08:28:17 +0000
@@ -256,3 +256,15 @@ a
select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f");
str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f")
2003-01-02 10:11:12.001200
+select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10'),time('00:00:00');
+timediff('2008-09-29 20:10:10','2008-09-30 20:10:10') time('00:00:00')
+-24:00:00 00:00:00
+select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00');
+timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00')
+0
+select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')<time('00:00:00');
+timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')<time('00:00:00')
+1
+SELECT CAST(time('-73:42:12') AS DECIMAL);
+CAST(time('-73:42:12') AS DECIMAL)
+-734212
=== modified file 'mysql-test/r/innodb_mysql.result'
--- a/mysql-test/r/innodb_mysql.result 2008-07-23 11:25:00 +0000
+++ b/mysql-test/r/innodb_mysql.result 2008-11-27 14:54:23 +0000
@@ -1261,4 +1261,10 @@ a b c
5 1 1
4 1 1
DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a char(50)) ENGINE=InnoDB;
+CREATE INDEX i1 on t1 (a(3));
+SELECT * FROM t1 WHERE a = 'abcde';
+a
+DROP TABLE t1;
End of 5.0 tests
=== modified file 'mysql-test/r/multi_update.result'
--- a/mysql-test/r/multi_update.result 2008-03-27 05:42:34 +0000
+++ b/mysql-test/r/multi_update.result 2008-11-19 18:17:26 +0000
@@ -378,29 +378,6 @@ where 0=1;
delete t1, t2 from t2,t1
where t1.id1=t2.id2 and 0=1;
drop table t1,t2;
-create table t1 ( a int not null, b int not null) ;
-alter table t1 add index i1(a);
-delete from t1 where a > 2000000;
-create table t2 like t1;
-insert into t2 select * from t1;
-select 't2 rows before small delete', count(*) from t1;
-t2 rows before small delete count(*)
-t2 rows before small delete 2000000
-delete t1,t2 from t1,t2 where t1.b=t2.a and t1.a < 2;
-select 't2 rows after small delete', count(*) from t2;
-t2 rows after small delete count(*)
-t2 rows after small delete 1999999
-select 't1 rows after small delete', count(*) from t1;
-t1 rows after small delete count(*)
-t1 rows after small delete 1999999
-delete t1,t2 from t1,t2 where t1.b=t2.a and t1.a < 100*1000;
-select 't2 rows after big delete', count(*) from t2;
-t2 rows after big delete count(*)
-t2 rows after big delete 1900001
-select 't1 rows after big delete', count(*) from t1;
-t1 rows after big delete count(*)
-t1 rows after big delete 1900001
-drop table t1,t2;
CREATE TABLE t1 ( a int );
CREATE TABLE t2 ( a int );
DELETE t1 FROM t1, t2 AS t3;
=== added file 'mysql-test/r/multi_update2.result'
--- a/mysql-test/r/multi_update2.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/multi_update2.result 2008-11-19 18:17:26 +0000
@@ -0,0 +1,25 @@
+DROP TABLE IF EXISTS t1,t2;
+CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL) ;
+# The protocolling of many inserts into t1 is suppressed.
+ALTER TABLE t1 ADD INDEX i1(a);
+DELETE FROM t1 WHERE a > 2000000;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 SELECT * FROM t1;
+SELECT 't2 rows before small delete', COUNT(*) FROM t1;
+t2 rows before small delete COUNT(*)
+t2 rows before small delete 2000000
+DELETE t1,t2 FROM t1,t2 WHERE t1.b=t2.a AND t1.a < 2;
+SELECT 't2 rows after small delete', COUNT(*) FROM t2;
+t2 rows after small delete COUNT(*)
+t2 rows after small delete 1999999
+SELECT 't1 rows after small delete', COUNT(*) FROM t1;
+t1 rows after small delete COUNT(*)
+t1 rows after small delete 1999999
+DELETE t1,t2 FROM t1,t2 WHERE t1.b=t2.a AND t1.a < 100*1000;
+SELECT 't2 rows after big delete', COUNT(*) FROM t2;
+t2 rows after big delete COUNT(*)
+t2 rows after big delete 1900001
+SELECT 't1 rows after big delete', COUNT(*) FROM t1;
+t1 rows after big delete COUNT(*)
+t1 rows after big delete 1900001
+DROP TABLE t1,t2;
=== modified file 'mysql-test/r/mysqlcheck.result'
--- a/mysql-test/r/mysqlcheck.result 2008-01-27 21:28:50 +0000
+++ b/mysql-test/r/mysqlcheck.result 2008-11-14 07:40:46 +0000
@@ -57,4 +57,17 @@ drop view v_bug25347;
drop table t_bug25347;
drop database d_bug25347;
use test;
+create view v1 as select * from information_schema.routines;
+check table v1, information_schema.routines;
+Table Op Msg_type Msg_text
+test.v1 check status OK
+information_schema.routines check note The storage engine for the table doesn't support check
+drop view v1;
+CREATE TABLE t1(a INT);
+CREATE TABLE t2(a INT);
+test.t1
+Error : Incorrect information in file: './test/t1.frm'
+error : Corrupt
+test.t2 OK
+DROP TABLE t1, t2;
End of 5.0 tests
=== added file 'mysql-test/r/perror-win.result'
--- a/mysql-test/r/perror-win.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/perror-win.result 2008-11-28 13:12:43 +0000
@@ -0,0 +1,6 @@
+MySQL error code 150: Foreign key constraint is incorrectly formed
+Win32 error code 150: System trace information was not specified in your CONFIG.SYS file, or tracing is disallowed.
+OS error code 23: Too many open files in system
+Win32 error code 23: Data error (cyclic redundancy check).
+Win32 error code 1062: The service has not been started.
+Illegal error code: 30000
=== modified file 'mysql-test/r/subselect.result'
--- a/mysql-test/r/subselect.result 2008-07-26 20:44:07 +0000
+++ b/mysql-test/r/subselect.result 2008-11-27 13:57:34 +0000
@@ -4407,4 +4407,49 @@ pk a
3 30
2 20
DROP TABLE t1,t2;
+CREATE TABLE t1 (s1 char(1));
+INSERT INTO t1 VALUES ('a');
+SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
+s1
+a
+DROP TABLE t1;
+CREATE TABLE t1(id BIGINT);
+CREATE TABLE t2(id1 BIGINT, id2 BIGINT);
+INSERT INTO t1 VALUES (1),(2),(3);
+INSERT INTO t2 VALUES (2,1),(3,1);
+SELECT * FROM t1 i WHERE 1 IN (SELECT l.id2 FROM t2 l WHERE i.id=l.id1);
+id
+2
+3
+DROP TABLE t1, t2;
+CREATE TABLE t1 (id int);
+CREATE TABLE t2 (id int, c int);
+INSERT INTO t1 (id) VALUES (1);
+INSERT INTO t2 (id) VALUES (1);
+INSERT INTO t1 (id) VALUES (1);
+INSERT INTO t2 (id) VALUES (1);
+CREATE VIEW v1 AS
+SELECT t2.c AS c FROM t1, t2
+WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+UPDATE v1 SET c=1;
+CREATE VIEW v2 (a,b) AS
+SELECT t2.id, t2.c AS c FROM t1, t2
+WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+INSERT INTO v2(a,b) VALUES (2,2);
+ERROR HY000: CHECK OPTION failed 'test.v2'
+INSERT INTO v2(a,b) VALUES (1,2);
+SELECT * FROM v1;
+c
+1
+1
+1
+1
+2
+2
+CREATE VIEW v3 AS
+SELECT t2.c AS c FROM t2
+WHERE 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+DELETE FROM v3;
+DROP VIEW v1,v2,v3;
+DROP TABLE t1,t2;
End of 5.0 tests.
=== modified file 'mysql-test/r/timezone2.result'
--- a/mysql-test/r/timezone2.result 2006-11-01 14:35:35 +0000
+++ b/mysql-test/r/timezone2.result 2008-12-01 15:41:06 +0000
@@ -110,7 +110,7 @@ i ts
362793610 1981-07-01 04:00:00
select from_unixtime(362793609);
from_unixtime(362793609)
-1981-07-01 03:59:60
+1981-07-01 03:59:59
drop table t1;
create table t1 (ts timestamp);
set time_zone='UTC';
=== modified file 'mysql-test/r/timezone3.result'
--- a/mysql-test/r/timezone3.result 2004-11-12 15:44:17 +0000
+++ b/mysql-test/r/timezone3.result 2008-12-01 14:18:35 +0000
@@ -17,6 +17,9 @@ insert into t1 values
insert into t1 values
(unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
(unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00');
+insert into t1 values
+(unix_timestamp('2009-01-01 02:59:59'),'2009-01-01 02:59:59'),
+(unix_timestamp('2009-01-01 03:00:00'),'2009-01-01 03:00:00');
select i, from_unixtime(i), c from t1;
i from_unixtime(i) c
1072904422 2004-01-01 00:00:00 2004-01-01 00:00:00
@@ -31,6 +34,8 @@ i from_unixtime(i) c
1099180821 2004-10-31 02:59:59 2004-10-31 02:59:59
362793608 1981-07-01 03:59:59 1981-07-01 03:59:59
362793610 1981-07-01 04:00:00 1981-07-01 04:00:00
+1230768022 2009-01-01 02:59:59 2009-01-01 02:59:59
+1230768024 2009-01-01 03:00:00 2009-01-01 03:00:00
drop table t1;
create table t1 (ts timestamp);
insert into t1 values (19730101235900), (20040101235900);
@@ -39,3 +44,6 @@ ts
1973-01-01 23:59:00
2004-01-01 23:59:00
drop table t1;
+SELECT FROM_UNIXTIME(1230768022), FROM_UNIXTIME(1230768023), FROM_UNIXTIME(1230768024);
+FROM_UNIXTIME(1230768022) FROM_UNIXTIME(1230768023) FROM_UNIXTIME(1230768024)
+2009-01-01 02:59:59 2009-01-01 02:59:59 2009-01-01 03:00:00
=== modified file 'mysql-test/r/type_newdecimal.result'
--- a/mysql-test/r/type_newdecimal.result 2008-08-15 19:46:21 +0000
+++ b/mysql-test/r/type_newdecimal.result 2008-11-17 15:41:09 +0000
@@ -1524,4 +1524,19 @@ select (1.20396873 * 0.89550000 * 0.6800
(1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 *
1.01500000 * 1.01500000 * 0.99500000)
0.812988073953673124592306939480
+create table t1 as select 5.05 / 0.014;
+Warnings:
+Note 1265 Data truncated for column '5.05 / 0.014' at row 1
+show warnings;
+Level Code Message
+Note 1265 Data truncated for column '5.05 / 0.014' at row 1
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `5.05 / 0.014` decimal(10,6) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+5.05 / 0.014
+360.714286
+DROP TABLE t1;
End of 5.0 tests
=== modified file 'mysql-test/r/view.result'
--- a/mysql-test/r/view.result 2008-10-27 10:22:38 +0000
+++ b/mysql-test/r/view.result 2008-11-28 16:13:12 +0000
@@ -625,7 +625,7 @@ drop table t1;
create table t1 (a int, b int);
create view v1 as select a, sum(b) from t1 group by a;
select b from v1 use index (some_index) where b=1;
-ERROR HY000: Incorrect usage of USE INDEX and VIEW
+ERROR HY000: Key 'some_index' doesn't exist in table 'v1'
drop view v1;
drop table t1;
create table t1 (col1 char(5),col2 char(5));
@@ -3567,11 +3567,11 @@ CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE VIEW v1 AS SELECT * FROM t1;
SELECT * FROM v1 USE KEY(non_existant);
-ERROR HY000: Incorrect usage of USE INDEX and VIEW
+ERROR HY000: Key 'non_existant' doesn't exist in table 'v1'
SELECT * FROM v1 FORCE KEY(non_existant);
-ERROR HY000: Incorrect usage of FORCE INDEX and VIEW
+ERROR HY000: Key 'non_existant' doesn't exist in table 'v1'
SELECT * FROM v1 IGNORE KEY(non_existant);
-ERROR HY000: Incorrect usage of IGNORE INDEX and VIEW
+ERROR HY000: Key 'non_existant' doesn't exist in table 'v1'
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b INT NOT NULL DEFAULT 0,
@@ -3679,6 +3679,31 @@ DROP VIEW v1;
CREATE VIEW v1 AS SELECT 1;
DROP VIEW v1;
+CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, INDEX (c2));
+INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
+SELECT * FROM t1 USE INDEX (PRIMARY) WHERE c1=2;
+c1 c2
+2 2
+SELECT * FROM t1 USE INDEX (c2) WHERE c2=2;
+c1 c2
+2 2
+CREATE VIEW v1 AS SELECT c1, c2 FROM t1;
+SHOW INDEX FROM v1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+SELECT * FROM v1 USE INDEX (PRIMARY) WHERE c1=2;
+ERROR HY000: Key 'PRIMARY' doesn't exist in table 'v1'
+SELECT * FROM v1 FORCE INDEX (PRIMARY) WHERE c1=2;
+ERROR HY000: Key 'PRIMARY' doesn't exist in table 'v1'
+SELECT * FROM v1 IGNORE INDEX (PRIMARY) WHERE c1=2;
+ERROR HY000: Key 'PRIMARY' doesn't exist in table 'v1'
+SELECT * FROM v1 USE INDEX (c2) WHERE c2=2;
+ERROR HY000: Key 'c2' doesn't exist in table 'v1'
+SELECT * FROM v1 FORCE INDEX (c2) WHERE c2=2;
+ERROR HY000: Key 'c2' doesn't exist in table 'v1'
+SELECT * FROM v1 IGNORE INDEX (c2) WHERE c2=2;
+ERROR HY000: Key 'c2' doesn't exist in table 'v1'
+DROP VIEW v1;
+DROP TABLE t1;
# -----------------------------------------------------------------
# -- End of 5.0 tests.
# -----------------------------------------------------------------
=== modified file 'mysql-test/std_data/Moscow_leap'
Binary files a/mysql-test/std_data/Moscow_leap 2004-11-03 17:59:03 +0000 and b/mysql-test/std_data/Moscow_leap 2008-12-01 14:18:35 +0000 differ
=== added file 'mysql-test/t/ctype_filesystem-master.opt'
--- a/mysql-test/t/ctype_filesystem-master.opt 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/ctype_filesystem-master.opt 2008-12-01 11:34:53 +0000
@@ -0,0 +1,2 @@
+--character-sets-dir=$MYSQL_TEST_DIR/�+--character-set-filesystem=latin1
=== added file 'mysql-test/t/ctype_filesystem.test'
--- a/mysql-test/t/ctype_filesystem.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/ctype_filesystem.test 2008-12-01 11:34:53 +0000
@@ -0,0 +1,6 @@
+SET CHARACTER SET utf8;
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+SHOW VARIABLES like 'character_sets_dir';
+SHOW VARIABLES like 'character_set_filesystem';
+SHOW VARIABLES like 'character_set_client';
+SET CHARACTER SET default;
=== modified file 'mysql-test/t/ctype_utf8.test'
--- a/mysql-test/t/ctype_utf8.test 2007-10-30 08:21:44 +0000
+++ b/mysql-test/t/ctype_utf8.test 2008-11-21 09:48:22 +0000
@@ -1437,3 +1437,20 @@ select hex(_utf8 X'616263FF');
select hex(_utf8 B'001111111111');
--error ER_INVALID_CHARACTER_STRING
select (_utf8 X'616263FF');
+
+#
+# Bug #36772: When using UTF8, CONVERT with GROUP BY returns truncated results
+#
+CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL);
+INSERT INTO t1 VALUES (70000, 1092), (70001, 1085), (70002, 1065);
+SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
+SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1;
+ALTER TABLE t1 ADD UNIQUE (b);
+SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
+DROP INDEX b ON t1;
+SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
+ALTER TABLE t1 ADD INDEX (b);
+SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) from t1 GROUP BY b;
+DROP TABLE t1;
+
+--echo End of 5.0 tests
=== modified file 'mysql-test/t/federated.test'
--- a/mysql-test/t/federated.test 2008-09-16 17:05:30 +0000
+++ b/mysql-test/t/federated.test 2008-11-14 07:42:29 +0000
@@ -1824,6 +1824,25 @@ DROP TABLE t1;
connection master;
DROP TABLE t1;
+
+#
+# Bug #34774 key prefix on text field in federated tables can cause
+# server to crash!
+#
+connection slave;
+CREATE TABLE t1 (a TEXT, b TEXT, KEY(b(1)));
+INSERT INTO t1 VALUES (NULL, NULL), (NULL, NULL), (NULL, NULL), (NULL, NULL);
+connection master;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE t1
+ (a TEXT, b TEXT, KEY(b(1))) ENGINE=FEDERATED
+ CONNECTION='mysql://root@stripped:$SLAVE_MYPORT/test/t1';
+SELECT t1.a FROM t1, t1 as t2 WHERE t2.b NOT LIKE t1.b;
+connection slave;
+DROP TABLE t1;
+connection master;
+DROP TABLE t1;
+
connection default;
--echo End of 5.0 tests
=== modified file 'mysql-test/t/federated_innodb.test'
--- a/mysql-test/t/federated_innodb.test 2007-06-28 23:03:01 +0000
+++ b/mysql-test/t/federated_innodb.test 2008-11-13 21:01:01 +0000
@@ -1,5 +1,10 @@
-source include/federated.inc;
+# NOTE: Keep any include/ files that will kill / skip a test BEFORE any others
+# having federated.inc before have_innodb.inc allows for an orphaned database
+# that can cause other tests to fail.
+# See Bug #40645 Test main.federated_innodb does not always clean up after itself
+
source include/have_innodb.inc;
+source include/federated.inc;
#
# Bug#25513 Federated transaction failures
=== modified file 'mysql-test/t/fulltext.test'
--- a/mysql-test/t/fulltext.test 2007-11-02 08:58:20 +0000
+++ b/mysql-test/t/fulltext.test 2008-11-11 09:10:51 +0000
@@ -396,3 +396,30 @@ SELECT * FROM t1 WHERE MATCH(a) AGAINST
DROP TABLE t1;
# End of 4.1 tests
+
+#
+# BUG#38842 - Fix for 25951 seems incorrect
+#
+CREATE TABLE t1 (a VARCHAR(255), b INT, FULLTEXT(a), KEY(b));
+INSERT INTO t1 VALUES('test', 1),('test', 1),('test', 1),('test', 1),
+ ('test', 1),('test', 2),('test', 3),('test', 4);
+
+EXPLAIN SELECT * FROM t1
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+
+EXPLAIN SELECT * FROM t1 USE INDEX(a)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+
+EXPLAIN SELECT * FROM t1 FORCE INDEX(a)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+
+EXPLAIN SELECT * FROM t1 IGNORE INDEX(a)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+
+EXPLAIN SELECT * FROM t1 USE INDEX(b)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+
+EXPLAIN SELECT * FROM t1 FORCE INDEX(b)
+WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
+
+DROP TABLE t1;
=== modified file 'mysql-test/t/func_group.test'
--- a/mysql-test/t/func_group.test 2008-03-06 15:19:47 +0000
+++ b/mysql-test/t/func_group.test 2008-11-24 15:30:47 +0000
@@ -926,5 +926,34 @@ SELECT AVG(a), CAST(AVG(a) AS DECIMAL) F
DROP TABLE t1;
+#
+# Bug #39656: Behaviour different for agg functions with & without where -
+# ONLY_FULL_GROUP_BY
+#
+
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES (1,1), (1,2), (1,3);
+
+SET SQL_MODE='ONLY_FULL_GROUP_BY';
+
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(*) FROM t1 where a=1;
+
+--error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
+SELECT COUNT(*),a FROM t1;
+
+SELECT COUNT(*) FROM t1 a JOIN t1 b ON a.a= b.a;
+
+--error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
+SELECT COUNT(*), (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a)
+ FROM t1 outr;
+
+SELECT COUNT(*) FROM t1 a JOIN t1 outr
+ ON a.a= (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a);
+
+SET SQL_MODE=default;
+DROP TABLE t1;
+
+
###
--echo End of 5.0 tests
=== modified file 'mysql-test/t/func_sapdb.test'
--- a/mysql-test/t/func_sapdb.test 2007-10-12 09:46:48 +0000
+++ b/mysql-test/t/func_sapdb.test 2008-11-26 08:28:17 +0000
@@ -135,3 +135,20 @@ select str_to_date("2003-01-02 10:11:12.
--enable_ps_protocol
# End of 4.1 tests
+
+
+
+#
+# Bug#37553: MySql Error Compare TimeDiff & Time
+#
+
+# calculations involving negative time values ignored sign
+select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10'),time('00:00:00');
+select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00');
+select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')<time('00:00:00');
+
+# show that conversion to DECIMAL no longer drops sign
+SELECT CAST(time('-73:42:12') AS DECIMAL);
+
+
+# End of 5.0 tests
=== modified file 'mysql-test/t/innodb_mysql.test'
--- a/mysql-test/t/innodb_mysql.test 2008-07-23 11:25:00 +0000
+++ b/mysql-test/t/innodb_mysql.test 2008-11-27 14:54:23 +0000
@@ -1014,4 +1014,15 @@ SELECT a, b, c FROM t1 WHERE b = 1 ORDER
DROP TABLE t1;
+#
+# Bug#37284 Crash in Field_string::type()
+#
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+CREATE TABLE t1 (a char(50)) ENGINE=InnoDB;
+CREATE INDEX i1 on t1 (a(3));
+SELECT * FROM t1 WHERE a = 'abcde';
+DROP TABLE t1;
+
--echo End of 5.0 tests
=== modified file 'mysql-test/t/multi_update.test'
--- a/mysql-test/t/multi_update.test 2007-10-13 12:49:42 +0000
+++ b/mysql-test/t/multi_update.test 2008-11-19 18:17:26 +0000
@@ -9,9 +9,9 @@
drop table if exists t1,t2,t3;
drop database if exists mysqltest;
drop view if exists v1;
---error 0,1141,1147
+--error 0,ER_NONEXISTING_GRANT,ER_NONEXISTING_TABLE_GRANT
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
---error 0,1141,1147
+--error 0,ER_NONEXISTING_GRANT,ER_NONEXISTING_TABLE_GRANT
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
delete from mysql.user where user=_binary'mysqltest_1';
--enable_warnings
@@ -159,9 +159,9 @@ create table t2 (n int(10) not null prim
insert into t1 values(1,1);
insert into t2 values(1,10),(2,20);
LOCK TABLES t1 write, t2 read;
---error 1099
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
DELETE t1.*, t2.* FROM t1,t2 where t1.n=t2.n;
---error 1099
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
unlock tables;
@@ -182,7 +182,7 @@ create table t1 (n int(10), d int(10));
create table t2 (n int(10), d int(10));
insert into t1 values(1,1);
insert into t2 values(1,10),(2,20);
---error 1175
+--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
set sql_safe_updates=0;
drop table t1,t2;
@@ -195,7 +195,7 @@ set timestamp=1038000000;
UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
select n,d,unix_timestamp(t) from t1;
select n,d,unix_timestamp(t) from t2;
---error 1064
+--error ER_PARSE_ERROR
UPDATE t1,t2 SET 1=2 WHERE t1.n=t2.n;
drop table t1,t2;
set timestamp=0;
@@ -323,41 +323,6 @@ delete t1, t2 from t2,t1
drop table t1,t2;
#
-# Test for bug #1820.
-#
-
-create table t1 ( a int not null, b int not null) ;
---disable_query_log
-insert into t1 values (1,1),(2,2),(3,3),(4,4);
-let $1=19;
-set @d=4;
-while ($1)
-{
- eval insert into t1 select a+@d,b+@d from t1;
- eval set @d=@d*2;
- dec $1;
-}
-
---enable_query_log
-alter table t1 add index i1(a);
-delete from t1 where a > 2000000;
-create table t2 like t1;
-insert into t2 select * from t1;
-
-select 't2 rows before small delete', count(*) from t1;
-delete t1,t2 from t1,t2 where t1.b=t2.a and t1.a < 2;
-select 't2 rows after small delete', count(*) from t2;
-select 't1 rows after small delete', count(*) from t1;
-
-## Try deleting many rows
-
-delete t1,t2 from t1,t2 where t1.b=t2.a and t1.a < 100*1000;
-select 't2 rows after big delete', count(*) from t2;
-select 't1 rows after big delete', count(*) from t1;
-
-drop table t1,t2;
-
-#
# Test alias (this is not correct in 4.0)
#
@@ -366,7 +331,7 @@ CREATE TABLE t2 ( a int );
DELETE t1 FROM t1, t2 AS t3;
DELETE t4 FROM t1, t1 AS t4;
DELETE t3 FROM t1 AS t3, t1 AS t4;
---error 1109
+--error ER_UNKNOWN_TABLE
DELETE t1 FROM t1 AS t3, t2 AS t4;
INSERT INTO t1 values (1),(2);
INSERT INTO t2 values (1),(2);
@@ -421,7 +386,7 @@ drop database mysqltest;
create table t1 (a int, primary key (a));
create table t2 (a int, primary key (a));
create table t3 (a int, primary key (a));
--- error 1109
+-- error ER_UNKNOWN_TABLE
delete t1,t3 from t1,t2 where t1.a=t2.a and t2.a=(select t3.a from t3 where t1.a=t3.a);
drop table t1, t2, t3;
@@ -430,9 +395,9 @@ drop table t1, t2, t3;
#
create table t1 (col1 int);
create table t2 (col1 int);
--- error 1093
+-- error ER_UPDATE_TABLE_USED
update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
--- error 1093
+-- error ER_UPDATE_TABLE_USED
delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1;
drop table t1,t2;
@@ -457,7 +422,7 @@ drop table t1, t2;
#
create table t1(a int);
create table t2(a int);
---error 1093
+--error ER_UPDATE_TABLE_USED
delete from t1,t2 using t1,t2 where t1.a=(select a from t1);
drop table t1, t2;
# End of 4.1 tests
=== added file 'mysql-test/t/multi_update2-master.opt'
--- a/mysql-test/t/multi_update2-master.opt 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/multi_update2-master.opt 2008-11-19 18:17:26 +0000
@@ -0,0 +1 @@
+--set-variable=tmp_table_size=1024
=== added file 'mysql-test/t/multi_update2.test'
--- a/mysql-test/t/multi_update2.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/multi_update2.test 2008-11-19 18:17:26 +0000
@@ -0,0 +1,43 @@
+#
+# Test of update statement that uses many tables.
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+--enable_warnings
+
+#
+# Bug#1820 Rows not deleted from second table on multi-table delete
+#
+
+CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL) ;
+--echo # The protocolling of many inserts into t1 is suppressed.
+--disable_query_log
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4);
+let $1=19;
+set @d=4;
+while ($1)
+{
+ eval INSERT INTO t1 SELECT a+@d,b+@d FROM t1;
+ eval SET @d=@d*2;
+ dec $1;
+}
+
+--enable_query_log
+ALTER TABLE t1 ADD INDEX i1(a);
+DELETE FROM t1 WHERE a > 2000000;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 SELECT * FROM t1;
+
+SELECT 't2 rows before small delete', COUNT(*) FROM t1;
+DELETE t1,t2 FROM t1,t2 WHERE t1.b=t2.a AND t1.a < 2;
+SELECT 't2 rows after small delete', COUNT(*) FROM t2;
+SELECT 't1 rows after small delete', COUNT(*) FROM t1;
+
+## Try deleting many rows
+
+DELETE t1,t2 FROM t1,t2 WHERE t1.b=t2.a AND t1.a < 100*1000;
+SELECT 't2 rows after big delete', COUNT(*) FROM t2;
+SELECT 't1 rows after big delete', COUNT(*) FROM t1;
+
+DROP TABLE t1,t2;
=== modified file 'mysql-test/t/mysqlcheck.test'
--- a/mysql-test/t/mysqlcheck.test 2008-01-27 21:28:50 +0000
+++ b/mysql-test/t/mysqlcheck.test 2008-11-14 07:40:46 +0000
@@ -58,4 +58,31 @@ drop table t_bug25347;
drop database d_bug25347;
use test;
+#
+# Bug#39541 CHECK TABLE on information_schema myisam tables produces error
+#
+create view v1 as select * from information_schema.routines;
+check table v1, information_schema.routines;
+drop view v1;
+
+
+#
+# Bug#37527: mysqlcheck fails to report entire database
+# when frm file corruption
+#
+CREATE TABLE t1(a INT);
+CREATE TABLE t2(a INT);
+# backup then null t1.frm
+--copy_file $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.frm.bak
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
+--write_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
+EOF
+--exec $MYSQL_CHECK test
+# restore t1.frm
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
+--copy_file $MYSQLTEST_VARDIR/master-data/test/t1.frm.bak $MYSQLTEST_VARDIR/master-data/test/t1.frm
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm.bak
+DROP TABLE t1, t2;
+
+
--echo End of 5.0 tests
=== added file 'mysql-test/t/perror-win.test'
--- a/mysql-test/t/perror-win.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/perror-win.test 2008-11-28 13:12:43 +0000
@@ -0,0 +1,14 @@
+# Windows-specific tests
+--source include/windows.inc
+--require r/have_perror.require
+disable_query_log;
+eval select LENGTH("$MY_PERROR") > 0 as "have_perror";
+enable_query_log;
+
+
+--exec $MY_PERROR 150 2>&1
+--exec $MY_PERROR 23 2>&1
+--exec $MY_PERROR 1062 2>&1
+--error 1
+--exec $MY_PERROR 30000 2>&1
+
=== modified file 'mysql-test/t/subselect.test'
--- a/mysql-test/t/subselect.test 2008-07-26 20:44:07 +0000
+++ b/mysql-test/t/subselect.test 2008-11-27 13:57:34 +0000
@@ -3307,5 +3307,57 @@ SELECT * FROM t1
WHERE EXISTS (SELECT DISTINCT a FROM t2 WHERE t1.a < t2.a ORDER BY b);
DROP TABLE t1,t2;
---echo End of 5.0 tests.
+#
+# Bug#20835 (literal string with =any values)
+#
+CREATE TABLE t1 (s1 char(1));
+INSERT INTO t1 VALUES ('a');
+SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
+DROP TABLE t1;
+
+#
+# Bug#40519 Subselect query using bigint fails
+#
+CREATE TABLE t1(id BIGINT);
+CREATE TABLE t2(id1 BIGINT, id2 BIGINT);
+INSERT INTO t1 VALUES (1),(2),(3);
+INSERT INTO t2 VALUES (2,1),(3,1);
+SELECT * FROM t1 i WHERE 1 IN (SELECT l.id2 FROM t2 l WHERE i.id=l.id1);
+DROP TABLE t1, t2;
+
+#
+# Bug#37460 Assertion failed:
+# !table->file || table->file->inited == handler::NONE
+#
+CREATE TABLE t1 (id int);
+CREATE TABLE t2 (id int, c int);
+
+INSERT INTO t1 (id) VALUES (1);
+INSERT INTO t2 (id) VALUES (1);
+INSERT INTO t1 (id) VALUES (1);
+INSERT INTO t2 (id) VALUES (1);
+
+CREATE VIEW v1 AS
+ SELECT t2.c AS c FROM t1, t2
+ WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+UPDATE v1 SET c=1;
+
+CREATE VIEW v2 (a,b) AS
+ SELECT t2.id, t2.c AS c FROM t1, t2
+ WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+--error 1369
+INSERT INTO v2(a,b) VALUES (2,2);
+INSERT INTO v2(a,b) VALUES (1,2);
+SELECT * FROM v1;
+
+CREATE VIEW v3 AS
+ SELECT t2.c AS c FROM t2
+ WHERE 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+
+DELETE FROM v3;
+
+DROP VIEW v1,v2,v3;
+DROP TABLE t1,t2;
+
+--echo End of 5.0 tests.
=== modified file 'mysql-test/t/timezone3.test'
--- a/mysql-test/t/timezone3.test 2005-07-28 00:22:47 +0000
+++ b/mysql-test/t/timezone3.test 2008-12-01 14:18:35 +0000
@@ -45,6 +45,10 @@ insert into t1 values
(unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
(unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00');
+insert into t1 values
+ (unix_timestamp('2009-01-01 02:59:59'),'2009-01-01 02:59:59'),
+ (unix_timestamp('2009-01-01 03:00:00'),'2009-01-01 03:00:00');
+
select i, from_unixtime(i), c from t1;
drop table t1;
@@ -58,4 +62,12 @@ insert into t1 values (19730101235900),
select * from t1;
drop table t1;
+#
+# Test Bug #39920: MySQL cannot deal with Leap Second expression in string
+# literal
+#
+
+# 2009-01-01 02:59:59, 2009-01-01 02:59:60 and 2009-01-01 03:00:00
+SELECT FROM_UNIXTIME(1230768022), FROM_UNIXTIME(1230768023), FROM_UNIXTIME(1230768024);
+
# End of 4.1 tests
=== modified file 'mysql-test/t/type_newdecimal.test'
--- a/mysql-test/t/type_newdecimal.test 2008-08-15 19:46:21 +0000
+++ b/mysql-test/t/type_newdecimal.test 2008-11-17 15:41:09 +0000
@@ -1225,4 +1225,14 @@ DROP TABLE t1;
select (1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 *
1.01500000 * 1.01500000 * 0.99500000);
+#
+# Bug #31616 div_precision_increment description looks wrong
+#
+
+create table t1 as select 5.05 / 0.014;
+show warnings;
+show create table t1;
+select * from t1;
+DROP TABLE t1;
+
--echo End of 5.0 tests
=== modified file 'mysql-test/t/view.test'
--- a/mysql-test/t/view.test 2008-10-27 10:22:38 +0000
+++ b/mysql-test/t/view.test 2008-11-28 16:13:12 +0000
@@ -510,7 +510,7 @@ drop table t1;
#
create table t1 (a int, b int);
create view v1 as select a, sum(b) from t1 group by a;
---error ER_WRONG_USAGE
+--error ER_KEY_DOES_NOT_EXITS
select b from v1 use index (some_index) where b=1;
drop view v1;
drop table t1;
@@ -3424,11 +3424,11 @@ drop table t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE VIEW v1 AS SELECT * FROM t1;
---error ER_WRONG_USAGE
+--error ER_KEY_DOES_NOT_EXITS
SELECT * FROM v1 USE KEY(non_existant);
---error ER_WRONG_USAGE
+--error ER_KEY_DOES_NOT_EXITS
SELECT * FROM v1 FORCE KEY(non_existant);
---error ER_WRONG_USAGE
+--error ER_KEY_DOES_NOT_EXITS
SELECT * FROM v1 IGNORE KEY(non_existant);
DROP VIEW v1;
@@ -3568,6 +3568,32 @@ DROP VIEW v1;
CREATE VIEW v1 AS SELECT 1;
DROP VIEW v1;
+#
+# Bug #33461: SELECT ... FROM <view> USE INDEX (...) throws an error
+#
+
+CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, INDEX (c2));
+INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
+SELECT * FROM t1 USE INDEX (PRIMARY) WHERE c1=2;
+SELECT * FROM t1 USE INDEX (c2) WHERE c2=2;
+
+CREATE VIEW v1 AS SELECT c1, c2 FROM t1;
+SHOW INDEX FROM v1;
+--error ER_KEY_DOES_NOT_EXITS
+SELECT * FROM v1 USE INDEX (PRIMARY) WHERE c1=2;
+--error ER_KEY_DOES_NOT_EXITS
+SELECT * FROM v1 FORCE INDEX (PRIMARY) WHERE c1=2;
+--error ER_KEY_DOES_NOT_EXITS
+SELECT * FROM v1 IGNORE INDEX (PRIMARY) WHERE c1=2;
+--error ER_KEY_DOES_NOT_EXITS
+SELECT * FROM v1 USE INDEX (c2) WHERE c2=2;
+--error ER_KEY_DOES_NOT_EXITS
+SELECT * FROM v1 FORCE INDEX (c2) WHERE c2=2;
+--error ER_KEY_DOES_NOT_EXITS
+SELECT * FROM v1 IGNORE INDEX (c2) WHERE c2=2;
+
+DROP VIEW v1;
+DROP TABLE t1;
--echo # -----------------------------------------------------------------
--echo # -- End of 5.0 tests.
=== modified file 'mysys/my_init.c'
--- a/mysys/my_init.c 2007-10-02 18:44:37 +0000
+++ b/mysys/my_init.c 2008-11-10 20:18:04 +0000
@@ -305,8 +305,6 @@ static void my_win_init(void)
const char *targetKey = "Software\\MySQL" ;
DBUG_ENTER("my_win_init");
- setlocale(LC_CTYPE, ""); /* To get right sortorder */
-
#if defined(_MSC_VER)
#if _MSC_VER < 1300
/*
=== modified file 'sql/field.cc'
--- a/sql/field.cc 2008-09-20 08:51:03 +0000
+++ b/sql/field.cc 2008-11-27 12:41:25 +0000
@@ -5372,6 +5372,7 @@ int Field_newdate::store_time(MYSQL_TIME
{
char buff[MAX_DATE_STRING_REP_LENGTH];
String str(buff, sizeof(buff), &my_charset_latin1);
+ tmp= 0;
make_date((DATE_TIME_FORMAT *) 0, ltime, &str);
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED,
str.ptr(), str.length(), MYSQL_TIMESTAMP_DATE, 1);
@@ -5608,6 +5609,7 @@ int Field_datetime::store_time(MYSQL_TIM
{
char buff[MAX_DATE_STRING_REP_LENGTH];
String str(buff, sizeof(buff), &my_charset_latin1);
+ tmp= 0;
make_datetime((DATE_TIME_FORMAT *) 0, ltime, &str);
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED,
str.ptr(), str.length(), MYSQL_TIMESTAMP_DATETIME,1);
=== modified file 'sql/ha_federated.cc'
--- a/sql/ha_federated.cc 2008-08-15 06:40:05 +0000
+++ b/sql/ha_federated.cc 2008-11-20 10:08:36 +0000
@@ -1320,6 +1320,14 @@ static FEDERATED_SHARE *get_share(const
thr_lock_init(&share->lock);
pthread_mutex_init(&share->mutex, MY_MUTEX_INIT_FAST);
}
+ else
+ {
+ /*
+ Free tmp_share.scheme allocated in the parse_url()
+ as we found share in the hash and tmp_share isn't needed anymore.
+ */
+ my_free((gptr) tmp_share.scheme, MYF(MY_ALLOW_ZERO_PTR));
+ }
share->use_count++;
pthread_mutex_unlock(&federated_mutex);
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2008-10-23 20:56:03 +0000
+++ b/sql/handler.cc 2008-11-25 06:22:02 +0000
@@ -1957,8 +1957,53 @@ bool handler::get_error_message(int erro
}
+/**
+ Check for incompatible collation changes.
+
+ @retval
+ HA_ADMIN_NEEDS_UPGRADE Table may have data requiring upgrade.
+ @retval
+ 0 No upgrade required.
+*/
+
+int handler::check_collation_compatibility()
+{
+ ulong mysql_version= table->s->mysql_version;
+
+ if (mysql_version < 50048)
+ {
+ KEY *key= table->key_info;
+ KEY *key_end= key + table->s->keys;
+ for (; key < key_end; key++)
+ {
+ KEY_PART_INFO *key_part= key->key_part;
+ KEY_PART_INFO *key_part_end= key_part + key->key_parts;
+ for (; key_part < key_part_end; key_part++)
+ {
+ if (!key_part->fieldnr)
+ continue;
+ Field *field= table->field[key_part->fieldnr - 1];
+ uint cs_number= field->charset()->number;
+ if (mysql_version < 50048 &&
+ (cs_number == 11 || /* ascii_general_ci - bug #29499, bug #27562 */
+ cs_number == 41 || /* latin7_general_ci - bug #29461 */
+ cs_number == 42 || /* latin7_general_cs - bug #29461 */
+ cs_number == 20 || /* latin7_estonian_cs - bug #29461 */
+ cs_number == 21 || /* latin2_hungarian_ci - bug #29461 */
+ cs_number == 22 || /* koi8u_general_ci - bug #29461 */
+ cs_number == 23 || /* cp1251_ukrainian_ci - bug #29461 */
+ cs_number == 26)) /* cp1250_general_ci - bug #29461 */
+ return HA_ADMIN_NEEDS_UPGRADE;
+ }
+ }
+ }
+ return 0;
+}
+
+
int handler::ha_check_for_upgrade(HA_CHECK_OPT *check_opt)
{
+ int error;
KEY *keyinfo, *keyend;
KEY_PART_INFO *keypart, *keypartend;
@@ -1987,6 +2032,10 @@ int handler::ha_check_for_upgrade(HA_CHE
}
if (table->s->frm_version != FRM_VER_TRUE_VARCHAR)
return HA_ADMIN_NEEDS_ALTER;
+
+ if ((error= check_collation_compatibility()))
+ return error;
+
return check_for_upgrade(check_opt);
}
=== modified file 'sql/handler.h'
--- a/sql/handler.h 2008-03-21 15:23:17 +0000
+++ b/sql/handler.h 2008-11-25 06:22:02 +0000
@@ -787,6 +787,7 @@ protected:
virtual int check_for_upgrade(HA_CHECK_OPT *check_opt)
{ return 0; }
public:
+ int check_collation_compatibility();
int ha_check_for_upgrade(HA_CHECK_OPT *check_opt);
int check_old_types();
/* to be actually called to get 'check()' functionality*/
=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc 2008-09-09 15:05:27 +0000
+++ b/sql/item_cmpfunc.cc 2008-11-26 08:28:17 +0000
@@ -745,11 +745,11 @@ Arg_comparator::can_compare_as_dates(Ite
obtained value
*/
-ulonglong
+longlong
get_time_value(THD *thd, Item ***item_arg, Item **cache_arg,
Item *warn_item, bool *is_null)
{
- ulonglong value;
+ longlong value;
Item *item= **item_arg;
MYSQL_TIME ltime;
@@ -761,7 +761,7 @@ get_time_value(THD *thd, Item ***item_ar
else
{
*is_null= item->get_time(<ime);
- value= !*is_null ? TIME_to_ulonglong_datetime(<ime) : 0;
+ value= !*is_null ? (longlong) TIME_to_ulonglong_datetime(<ime) : 0;
}
/*
Do not cache GET_USER_VAR() function as its const_item() may return TRUE
@@ -886,11 +886,11 @@ void Arg_comparator::set_datetime_cmp_fu
obtained value
*/
-ulonglong
+longlong
get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
Item *warn_item, bool *is_null)
{
- ulonglong value= 0;
+ longlong value= 0;
String buf, *str= 0;
Item *item= **item_arg;
@@ -925,7 +925,7 @@ get_datetime_value(THD *thd, Item ***ite
enum_field_types f_type= warn_item->field_type();
timestamp_type t_type= f_type ==
MYSQL_TYPE_DATE ? MYSQL_TIMESTAMP_DATE : MYSQL_TIMESTAMP_DATETIME;
- value= get_date_from_str(thd, str, t_type, warn_item->name, &error);
+ value= (longlong) get_date_from_str(thd, str, t_type, warn_item->name, &error);
/*
If str did not contain a valid date according to the current
SQL_MODE, get_date_from_str() has already thrown a warning,
@@ -979,7 +979,7 @@ get_datetime_value(THD *thd, Item ***ite
int Arg_comparator::compare_datetime()
{
bool a_is_null, b_is_null;
- ulonglong a_value, b_value;
+ longlong a_value, b_value;
/* Get DATE/DATETIME/TIME value of the 'a' item. */
a_value= (*get_value_func)(thd, &a, &a_cache, *b, &a_is_null);
@@ -1434,7 +1434,8 @@ bool Item_in_optimizer::fix_left(THD *th
}
not_null_tables_cache= args[0]->not_null_tables();
with_sum_func= args[0]->with_sum_func;
- const_item_cache= args[0]->const_item();
+ if ((const_item_cache= args[0]->const_item()))
+ cache->store(args[0]);
return 0;
}
=== modified file 'sql/item_cmpfunc.h'
--- a/sql/item_cmpfunc.h 2008-09-05 08:30:01 +0000
+++ b/sql/item_cmpfunc.h 2008-11-26 08:28:17 +0000
@@ -42,8 +42,8 @@ class Arg_comparator: public Sql_alloc
bool is_nulls_eq; // TRUE <=> compare for the EQUAL_FUNC
enum enum_date_cmp_type { CMP_DATE_DFLT= 0, CMP_DATE_WITH_DATE,
CMP_DATE_WITH_STR, CMP_STR_WITH_DATE };
- ulonglong (*get_value_func)(THD *thd, Item ***item_arg, Item **cache_arg,
- Item *warn_item, bool *is_null);
+ longlong (*get_value_func)(THD *thd, Item ***item_arg, Item **cache_arg,
+ Item *warn_item, bool *is_null);
public:
DTCollation cmp_collation;
@@ -1028,7 +1028,7 @@ public:
*/
class cmp_item_datetime :public cmp_item
{
- ulonglong value;
+ longlong value;
public:
THD *thd;
/* Item used for issuing warnings. */
=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc 2008-07-30 11:07:37 +0000
+++ b/sql/item_func.cc 2008-11-28 10:50:13 +0000
@@ -1316,8 +1316,10 @@ my_decimal *Item_func_div::decimal_op(my
void Item_func_div::result_precision()
{
- uint arg_prec= args[0]->decimal_precision() + prec_increment;
- uint precision=min(arg_prec, DECIMAL_MAX_PRECISION);
+ uint precision=min(args[0]->decimal_precision() +
+ args[1]->decimals + prec_increment,
+ DECIMAL_MAX_PRECISION);
+
/* Integer operations keep unsigned_flag if one of arguments is unsigned */
if (result_type() == INT_RESULT)
unsigned_flag= args[0]->unsigned_flag | args[1]->unsigned_flag;
@@ -2273,7 +2275,7 @@ void Item_func_min_max::fix_length_and_d
uint Item_func_min_max::cmp_datetimes(ulonglong *value)
{
- ulonglong min_max;
+ longlong min_max;
uint min_max_idx= 0;
LINT_INIT(min_max);
@@ -2281,7 +2283,7 @@ uint Item_func_min_max::cmp_datetimes(ul
{
Item **arg= args + i;
bool is_null;
- ulonglong res= get_datetime_value(thd, &arg, 0, datetime_item, &is_null);
+ longlong res= get_datetime_value(thd, &arg, 0, datetime_item, &is_null);
if ((null_value= args[i]->null_value))
return 0;
if (i == 0 || (res < min_max ? cmp_sign : -cmp_sign) > 0)
@@ -5022,7 +5024,9 @@ bool Item_func_match::fix_index()
for (keynr=0 ; keynr < table->s->keys ; keynr++)
{
if ((table->key_info[keynr].flags & HA_FULLTEXT) &&
- (table->s->keys_in_use.is_set(keynr)))
+ (flags & FT_BOOL ? table->keys_in_use_for_query.is_set(keynr) :
+ table->s->keys_in_use.is_set(keynr)))
+
{
ft_to_key[fts]=keynr;
ft_cnt[fts]=0;
=== modified file 'sql/item_timefunc.cc'
--- a/sql/item_timefunc.cc 2008-01-23 18:48:29 +0000
+++ b/sql/item_timefunc.cc 2008-11-21 09:48:22 +0000
@@ -2550,6 +2550,8 @@ void Item_char_typecast::fix_length_and_
and thus avoid unnecessary character set conversion.
- If the argument is not a number, then from_cs is set to
the argument's charset.
+
+ Note (TODO): we could use repertoire technique here.
*/
from_cs= (args[0]->result_type() == INT_RESULT ||
args[0]->result_type() == DECIMAL_RESULT ||
@@ -2557,12 +2559,13 @@ void Item_char_typecast::fix_length_and_
(cast_cs->mbminlen == 1 ? cast_cs : &my_charset_latin1) :
args[0]->collation.collation;
charset_conversion= (cast_cs->mbmaxlen > 1) ||
- !my_charset_same(from_cs, cast_cs) &&
- from_cs != &my_charset_bin &&
- cast_cs != &my_charset_bin;
+ (!my_charset_same(from_cs, cast_cs) &&
+ from_cs != &my_charset_bin &&
+ cast_cs != &my_charset_bin);
collation.set(cast_cs, DERIVATION_IMPLICIT);
- char_length= (cast_length >= 0) ? cast_length :
- args[0]->max_length/from_cs->mbmaxlen;
+ char_length= (cast_length >= 0) ?
+ cast_length :
+ args[0]->max_length / args[0]->collation.collation->mbmaxlen;
max_length= char_length * cast_cs->mbmaxlen;
}
=== modified file 'sql/item_timefunc.h'
--- a/sql/item_timefunc.h 2008-01-07 16:55:05 +0000
+++ b/sql/item_timefunc.h 2008-11-26 08:28:17 +0000
@@ -408,6 +408,7 @@ public:
{
return save_time_in_field(field);
}
+ bool result_as_longlong() { return TRUE; }
};
=== modified file 'sql/my_decimal.cc'
--- a/sql/my_decimal.cc 2007-10-05 07:38:57 +0000
+++ b/sql/my_decimal.cc 2008-11-26 08:28:17 +0000
@@ -216,7 +216,7 @@ my_decimal *date2my_decimal(MYSQL_TIME *
date = (ltime->year*100L + ltime->month)*100L + ltime->day;
if (ltime->time_type > MYSQL_TIMESTAMP_DATE)
date= ((date*100L + ltime->hour)*100L+ ltime->minute)*100L + ltime->second;
- if (int2my_decimal(E_DEC_FATAL_ERROR, date, FALSE, dec))
+ if (int2my_decimal(E_DEC_FATAL_ERROR, ltime->neg ? -date : date, FALSE, dec))
return dec;
if (ltime->second_part)
{
=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h 2008-10-02 11:57:52 +0000
+++ b/sql/mysql_priv.h 2008-11-27 16:17:16 +0000
@@ -435,6 +435,7 @@ MY_LOCALE *my_locale_by_number(uint numb
#define UNCACHEABLE_PREPARE 16
/* For uncorrelated SELECT in an UNION with some correlated SELECTs */
#define UNCACHEABLE_UNITED 32
+#define UNCACHEABLE_CHECKOPTION 64
/* Used to check GROUP BY list in the MODE_ONLY_FULL_GROUP_BY mode */
#define UNDEF_POS (-1)
@@ -1556,8 +1557,8 @@ void make_date(const DATE_TIME_FORMAT *f
String *str);
void make_time(const DATE_TIME_FORMAT *format, const MYSQL_TIME *l_time,
String *str);
-ulonglong get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
- Item *warn_item, bool *is_null);
+longlong get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
+ Item *warn_item, bool *is_null);
int test_if_number(char *str,int *res,bool allow_wildcards);
void change_byte(byte *,uint,char,char);
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2008-10-09 07:26:42 +0000
+++ b/sql/mysqld.cc 2008-11-28 14:32:04 +0000
@@ -3035,12 +3035,14 @@ static int init_common_variables(const c
sys_init_connect.value_length= strlen(opt_init_connect);
else
sys_init_connect.value=my_strdup("",MYF(0));
+ sys_init_connect.is_os_charset= TRUE;
sys_init_slave.value_length= 0;
if ((sys_init_slave.value= opt_init_slave))
sys_init_slave.value_length= strlen(opt_init_slave);
else
sys_init_slave.value=my_strdup("",MYF(0));
+ sys_init_slave.is_os_charset= TRUE;
if (use_temp_pool && bitmap_init(&temp_pool,0,1024,1))
return 1;
@@ -3840,6 +3842,9 @@ we force server id to 2, but this MySQL
: mysqld_unix_port),
mysqld_port,
MYSQL_COMPILATION_COMMENT);
+#if defined(_WIN32) && !defined(EMBEDDED_LIBRARY)
+ Service.SetRunning();
+#endif
#if defined(__NT__) || defined(HAVE_SMEM)
handle_connections_methods();
=== modified file 'sql/nt_servc.cc'
--- a/sql/nt_servc.cc 2004-03-25 21:29:45 +0000
+++ b/sql/nt_servc.cc 2008-11-14 01:01:41 +0000
@@ -245,10 +245,6 @@ void NTService::ServiceMain(DWORD argc,
if (!pService->StartService())
goto error;
- // Check that the service is now running.
- if (!pService->SetStatus(SERVICE_RUNNING,NO_ERROR, 0, 0, 0))
- goto error;
-
// wait for exit event
WaitForSingleObject (pService->hExitEvent, INFINITE);
@@ -264,6 +260,14 @@ error:
return;
}
+
+void NTService::SetRunning()
+{
+ if (pService)
+ pService->SetStatus(SERVICE_RUNNING,NO_ERROR, 0, 0, 0);
+}
+
+
/* ------------------------------------------------------------------------
StartService() - starts the appliaction thread
-------------------------------------------------------------------------- */
=== modified file 'sql/nt_servc.h'
--- a/sql/nt_servc.h 2005-02-09 20:02:48 +0000
+++ b/sql/nt_servc.h 2008-11-14 01:01:41 +0000
@@ -56,7 +56,19 @@ class NTService
BOOL IsService(LPCSTR ServiceName);
BOOL got_service_option(char **argv, char *service_option);
BOOL is_super_user();
- void Stop(void); //to be called from app. to stop service
+
+ /*
+ SetRunning() is to be called by the application
+ when initialization completes and it can accept
+ stop request
+ */
+ void SetRunning(void);
+
+ /*
+ Stop() is to be called by the application to stop
+ the service
+ */
+ void Stop(void);
protected:
LPSTR ServiceName;
=== modified file 'sql/parse_file.cc'
--- a/sql/parse_file.cc 2008-09-30 12:50:28 +0000
+++ b/sql/parse_file.cc 2008-11-14 17:25:57 +0000
@@ -88,7 +88,6 @@ write_escaped_string(IO_CACHE *file, LEX
file pointer to IO_CACHE structure for writing
base pointer to data structure
parameter pointer to parameter descriptor
- old_version for returning back old version number value
RETURN
FALSE - OK
@@ -96,8 +95,7 @@ write_escaped_string(IO_CACHE *file, LEX
*/
static my_bool
-write_parameter(IO_CACHE *file, gptr base, File_option *parameter,
- ulonglong *old_version)
+write_parameter(IO_CACHE *file, gptr base, File_option *parameter)
{
char num_buf[20]; // buffer for numeric operations
// string for numeric operations
@@ -125,15 +123,6 @@ write_parameter(IO_CACHE *file, gptr bas
DBUG_RETURN(TRUE);
break;
}
- case FILE_OPTIONS_REV:
- {
- ulonglong *val_i= (ulonglong *)(base + parameter->offset);
- *old_version= (*val_i)++;
- num.set(*val_i, &my_charset_bin);
- if (my_b_append(file, (const byte *)num.ptr(), num.length()))
- DBUG_RETURN(TRUE);
- break;
- }
case FILE_OPTIONS_TIMESTAMP:
{
/* string have to be allocated already */
@@ -205,7 +194,6 @@ write_parameter(IO_CACHE *file, gptr bas
base base address for parameter reading (structure like
TABLE)
parameters parameters description
- max_versions number of versions to save
RETURN
FALSE - OK
@@ -215,13 +203,11 @@ write_parameter(IO_CACHE *file, gptr bas
my_bool
sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
const LEX_STRING *type,
- gptr base, File_option *parameters,
- uint max_versions)
+ gptr base, File_option *parameters)
{
File handler;
IO_CACHE file;
char path[FN_REFLEN+1]; // +1 to put temporary file name for sure
- ulonglong old_version= ULONGLONG_MAX;
int path_end;
File_option *param;
DBUG_ENTER("sql_create_definition_file");
@@ -255,7 +241,7 @@ sql_create_definition_file(const LEX_STR
if (my_b_append(&file, (const byte *)param->name.str,
param->name.length) ||
my_b_append(&file, (const byte *)STRING_WITH_LEN("=")) ||
- write_parameter(&file, base, param, &old_version) ||
+ write_parameter(&file, base, param) ||
my_b_append(&file, (const byte *)STRING_WITH_LEN("\n")))
goto err_w_cache;
}
@@ -269,55 +255,6 @@ sql_create_definition_file(const LEX_STR
}
path[path_end]='\0';
-#ifdef FRM_ARCHIVE
- // archive copies management: disabled unused feature (see bug #17823).
- if (!access(path, F_OK))
- {
- if (old_version != ULONGLONG_MAX && max_versions != 0)
- {
- // save backup
- char path_arc[FN_REFLEN];
- // backup old version
- char path_to[FN_REFLEN];
-
- // check archive directory existence
- fn_format(path_arc, "arc", dir->str, "", MY_UNPACK_FILENAME);
- if (access(path_arc, F_OK))
- {
- if (my_mkdir(path_arc, 0777, MYF(MY_WME)))
- {
- DBUG_RETURN(TRUE);
- }
- }
-
- my_snprintf(path_to, FN_REFLEN, "%s/%s-%04lu",
- path_arc, file_name->str, (ulong) old_version);
- if (my_rename(path, path_to, MYF(MY_WME)))
- {
- DBUG_RETURN(TRUE);
- }
-
- // remove very old version
- if (old_version > max_versions)
- {
- my_snprintf(path_to, FN_REFLEN, "%s/%s-%04lu",
- path_arc, file_name->str,
- (ulong)(old_version - max_versions));
- if (!access(path_arc, F_OK) && my_delete(path_to, MYF(MY_WME)))
- {
- DBUG_RETURN(TRUE);
- }
- }
- }
- else
- {
- if (my_delete(path, MYF(MY_WME))) // no backups
- {
- DBUG_RETURN(TRUE);
- }
- }
- }
-#endif//FRM_ARCHIVE
{
// rename temporary file
@@ -346,8 +283,6 @@ err_w_file:
schema name of given schema
old_name original file name
new_name new file name
- revision revision number
- num_view_backups number of backups
RETURN
0 - OK
@@ -356,8 +291,7 @@ err_w_file:
*/
my_bool rename_in_schema_file(THD *thd,
const char *schema, const char *old_name,
- const char *new_name, ulonglong revision,
- uint num_view_backups)
+ const char *new_name)
{
char old_path[FN_REFLEN], new_path[FN_REFLEN], arc_path[FN_REFLEN];
@@ -376,23 +310,6 @@ my_bool rename_in_schema_file(THD *thd,
strxnmov(arc_path, FN_REFLEN, mysql_data_home, "/", schema, "/arc", NullS);
(void) unpack_filename(arc_path, arc_path);
-#ifdef FRM_ARCHIVE
- if (revision > 0 && !access(arc_path, F_OK))
- {
- ulonglong limit= ((revision > num_view_backups) ?
- revision - num_view_backups : 0);
- for (; revision > limit ; revision--)
- {
- my_snprintf(old_path, FN_REFLEN, "%s/%s%s-%04lu",
- arc_path, old_name, reg_ext, (ulong)revision);
- (void) unpack_filename(old_path, old_path);
- my_snprintf(new_path, FN_REFLEN, "%s/%s%s-%04lu",
- arc_path, new_name, reg_ext, (ulong)revision);
- (void) unpack_filename(new_path, new_path);
- my_rename(old_path, new_path, MYF(0));
- }
- }
-#else//FRM_ARCHIVE
{ // remove obsolete 'arc' directory and files if any
MY_DIR *new_dirp;
if ((new_dirp = my_dir(arc_path, MYF(MY_DONT_SORT))))
@@ -401,7 +318,6 @@ my_bool rename_in_schema_file(THD *thd,
(void) mysql_rm_arc_files(thd, new_dirp, arc_path);
}
}
-#endif//FRM_ARCHIVE
return 0;
}
@@ -838,7 +754,6 @@ File_parser::parse(gptr base, MEM_ROOT *
break;
}
case FILE_OPTIONS_ULONGLONG:
- case FILE_OPTIONS_REV:
if (!(eol= strchr(ptr, '\n')))
{
my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0),
=== modified file 'sql/parse_file.h'
--- a/sql/parse_file.h 2008-09-30 12:50:28 +0000
+++ b/sql/parse_file.h 2008-11-14 17:25:57 +0000
@@ -23,7 +23,6 @@ enum file_opt_type {
FILE_OPTIONS_STRING, /* String (LEX_STRING) */
FILE_OPTIONS_ESTRING, /* Escaped string (LEX_STRING) */
FILE_OPTIONS_ULONGLONG, /* ulonglong parameter (ulonglong) */
- FILE_OPTIONS_REV, /* Revision version number (ulonglong) */
FILE_OPTIONS_TIMESTAMP, /* timestamp (LEX_STRING have to be
allocated with length 20 (19+1) */
FILE_OPTIONS_STRLIST, /* list of escaped strings
@@ -81,11 +80,10 @@ File_parser *sql_parse_prepare(const LEX
my_bool
sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
const LEX_STRING *type,
- gptr base, File_option *parameters, uint versions);
+ gptr base, File_option *parameters);
my_bool rename_in_schema_file(THD *thd,
const char *schema, const char *old_name,
- const char *new_name, ulonglong revision,
- uint num_view_backups);
+ const char *new_name);
class File_parser: public Sql_alloc
{
=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc 2008-08-25 12:11:59 +0000
+++ b/sql/set_var.cc 2008-11-28 14:25:16 +0000
@@ -138,7 +138,7 @@ sys_var_thd_ulong sys_auto_increment_off
sys_var_bool_ptr sys_automatic_sp_privileges("automatic_sp_privileges",
&sp_automatic_privileges);
-sys_var_const_str sys_basedir("basedir", mysql_home);
+sys_var_const_os_str sys_basedir("basedir", mysql_home);
sys_var_long_ptr sys_binlog_cache_size("binlog_cache_size",
&binlog_cache_size);
sys_var_thd_ulong sys_bulk_insert_buff_size("bulk_insert_buffer_size",
@@ -151,6 +151,8 @@ sys_var_character_set_client sys_charac
sys_var_character_set_connection sys_character_set_connection("character_set_connection");
sys_var_character_set_results sys_character_set_results("character_set_results");
sys_var_character_set_filesystem sys_character_set_filesystem("character_set_filesystem");
+sys_var_const_os_str sys_character_sets_dir("character_sets_dir",
+ mysql_charsets_dir);
sys_var_thd_ulong sys_completion_type("completion_type",
&SV::completion_type,
check_completion_type,
@@ -162,7 +164,7 @@ sys_var_long_ptr sys_concurrent_insert("
&myisam_concurrent_insert);
sys_var_long_ptr sys_connect_timeout("connect_timeout",
&connect_timeout);
-sys_var_const_str sys_datadir("datadir", mysql_real_data_home);
+sys_var_const_os_str sys_datadir("datadir", mysql_real_data_home);
sys_var_enum sys_delay_key_write("delay_key_write",
&delay_key_write_options,
&delay_key_write_typelib,
@@ -311,6 +313,7 @@ sys_var_thd_ulong sys_optimizer_pr
&SV::optimizer_prune_level);
sys_var_thd_ulong sys_optimizer_search_depth("optimizer_search_depth",
&SV::optimizer_search_depth);
+sys_var_const_os_str sys_plugin_dir("plugin_dir", opt_plugin_dir);
sys_var_thd_ulong sys_preload_buff_size("preload_buffer_size",
&SV::preload_buff_size);
sys_var_thd_ulong sys_read_buff_size("read_buffer_size",
@@ -338,7 +341,7 @@ sys_var_thd_ulong sys_query_alloc_block_
sys_var_thd_ulong sys_query_prealloc_size("query_prealloc_size",
&SV::query_prealloc_size,
0, fix_thd_mem_root);
-sys_var_readonly sys_tmpdir("tmpdir", OPT_GLOBAL, SHOW_CHAR, get_tmpdir);
+sys_var_readonly_os sys_tmpdir("tmpdir", OPT_GLOBAL, SHOW_CHAR, get_tmpdir);
sys_var_thd_ulong sys_trans_alloc_block_size("transaction_alloc_block_size",
&SV::trans_alloc_block_size,
0, fix_trans_mem_root);
@@ -363,9 +366,11 @@ sys_var_bool_ptr sys_secure_auth("secure
sys_var_const_str_ptr sys_secure_file_priv("secure_file_priv",
&opt_secure_file_priv);
sys_var_long_ptr sys_server_id("server_id", &server_id, fix_server_id);
+#ifdef HAVE_REPLICATION
sys_var_bool_ptr sys_slave_compressed_protocol("slave_compressed_protocol",
&opt_slave_compressed_protocol);
-#ifdef HAVE_REPLICATION
+sys_var_const_os_str_ptr sys_slave_load_tmpdir("slave_load_tmpdir",
+ &slave_load_tmpdir);
sys_var_long_ptr sys_slave_net_timeout("slave_net_timeout",
&slave_net_timeout);
sys_var_long_ptr sys_slave_trans_retries("slave_transaction_retries",
@@ -380,17 +385,17 @@ sys_var_thd_sql_mode sys_sql_mode("sq
#ifdef HAVE_OPENSSL
extern char *opt_ssl_ca, *opt_ssl_capath, *opt_ssl_cert, *opt_ssl_cipher,
*opt_ssl_key;
-sys_var_const_str_ptr sys_ssl_ca("ssl_ca", &opt_ssl_ca);
-sys_var_const_str_ptr sys_ssl_capath("ssl_capath", &opt_ssl_capath);
-sys_var_const_str_ptr sys_ssl_cert("ssl_cert", &opt_ssl_cert);
-sys_var_const_str_ptr sys_ssl_cipher("ssl_cipher", &opt_ssl_cipher);
-sys_var_const_str_ptr sys_ssl_key("ssl_key", &opt_ssl_key);
+sys_var_const_os_str_ptr sys_ssl_ca("ssl_ca", &opt_ssl_ca);
+sys_var_const_os_str_ptr sys_ssl_capath("ssl_capath", &opt_ssl_capath);
+sys_var_const_os_str_ptr sys_ssl_cert("ssl_cert", &opt_ssl_cert);
+sys_var_const_os_str_ptr sys_ssl_cipher("ssl_cipher", &opt_ssl_cipher);
+sys_var_const_os_str_ptr sys_ssl_key("ssl_key", &opt_ssl_key);
#else
-sys_var_const_str sys_ssl_ca("ssl_ca", NULL);
-sys_var_const_str sys_ssl_capath("ssl_capath", NULL);
-sys_var_const_str sys_ssl_cert("ssl_cert", NULL);
-sys_var_const_str sys_ssl_cipher("ssl_cipher", NULL);
-sys_var_const_str sys_ssl_key("ssl_key", NULL);
+sys_var_const_os_str sys_ssl_ca("ssl_ca", NULL);
+sys_var_const_os_str sys_ssl_capath("ssl_capath", NULL);
+sys_var_const_os_str sys_ssl_cert("ssl_cert", NULL);
+sys_var_const_os_str sys_ssl_cipher("ssl_cipher", NULL);
+sys_var_const_os_str sys_ssl_key("ssl_key", NULL);
#endif
sys_var_thd_enum
sys_updatable_views_with_limit("updatable_views_with_limit",
@@ -460,6 +465,14 @@ sys_var_long_ptr sys_innodb_commit_conc
sys_var_long_ptr sys_innodb_flush_log_at_trx_commit(
"innodb_flush_log_at_trx_commit",
&srv_flush_log_at_trx_commit);
+sys_var_const_os_str_ptr sys_innodb_data_file_path("innodb_data_file_path",
+ &innobase_data_file_path);
+sys_var_const_os_str_ptr sys_innodb_data_home_dir("innodb_data_home_dir",
+ &innobase_data_home_dir);
+sys_var_const_os_str_ptr sys_innodb_log_arch_dir("innodb_log_arch_dir",
+ &innobase_log_arch_dir);
+sys_var_const_os_str_ptr sys_innodb_log_group_home_dir("innodb_log_group_home_dir",
+ &innobase_log_group_home_dir);
#endif
/* Condition pushdown to storage engine */
@@ -844,7 +857,7 @@ struct show_var_st init_vars[]= {
{sys_character_set_results.name,(char*) &sys_character_set_results, SHOW_SYS},
{sys_character_set_server.name, (char*) &sys_character_set_server,SHOW_SYS},
{sys_charset_system.name, (char*) &sys_charset_system, SHOW_SYS},
- {"character_sets_dir", mysql_charsets_dir, SHOW_CHAR},
+ {sys_character_sets_dir.name, (char *) &sys_character_sets_dir, SHOW_SYS},
{sys_collation_connection.name,(char*) &sys_collation_connection, SHOW_SYS},
{sys_collation_database.name,(char*) &sys_collation_database, SHOW_SYS},
{sys_collation_server.name,(char*) &sys_collation_server, SHOW_SYS},
@@ -905,8 +918,8 @@ struct show_var_st init_vars[]= {
{"innodb_checksums", (char*) &innobase_use_checksums, SHOW_MY_BOOL},
{sys_innodb_commit_concurrency.name, (char*) &sys_innodb_commit_concurrency, SHOW_SYS},
{sys_innodb_concurrency_tickets.name, (char*) &sys_innodb_concurrency_tickets, SHOW_SYS},
- {"innodb_data_file_path", (char*) &innobase_data_file_path, SHOW_CHAR_PTR},
- {"innodb_data_home_dir", (char*) &innobase_data_home_dir, SHOW_CHAR_PTR},
+ {sys_innodb_data_file_path.name, (char*) &sys_innodb_data_file_path, SHOW_SYS},
+ {sys_innodb_data_home_dir.name, (char*) &sys_innodb_data_home_dir, SHOW_SYS},
{"innodb_adaptive_hash_index", (char*) &innobase_adaptive_hash_index, SHOW_MY_BOOL},
{"innodb_doublewrite", (char*) &innobase_use_doublewrite, SHOW_MY_BOOL},
{sys_innodb_fast_shutdown.name,(char*) &sys_innodb_fast_shutdown, SHOW_SYS},
@@ -917,12 +930,12 @@ struct show_var_st init_vars[]= {
{"innodb_force_recovery", (char*) &innobase_force_recovery, SHOW_LONG },
{"innodb_lock_wait_timeout", (char*) &innobase_lock_wait_timeout, SHOW_LONG },
{"innodb_locks_unsafe_for_binlog", (char*) &innobase_locks_unsafe_for_binlog, SHOW_MY_BOOL},
- {"innodb_log_arch_dir", (char*) &innobase_log_arch_dir, SHOW_CHAR_PTR},
+ {sys_innodb_log_arch_dir.name, (char*) &sys_innodb_log_arch_dir, SHOW_SYS},
{"innodb_log_archive", (char*) &innobase_log_archive, SHOW_MY_BOOL},
{"innodb_log_buffer_size", (char*) &innobase_log_buffer_size, SHOW_LONG },
{"innodb_log_file_size", (char*) &innobase_log_file_size, SHOW_LONGLONG},
{"innodb_log_files_in_group", (char*) &innobase_log_files_in_group, SHOW_LONG},
- {"innodb_log_group_home_dir", (char*) &innobase_log_group_home_dir, SHOW_CHAR_PTR},
+ {sys_innodb_log_group_home_dir.name, (char*) &sys_innodb_log_group_home_dir, SHOW_SYS},
{sys_innodb_max_dirty_pages_pct.name, (char*) &sys_innodb_max_dirty_pages_pct, SHOW_SYS},
{sys_innodb_max_purge_lag.name, (char*) &sys_innodb_max_purge_lag, SHOW_SYS},
{"innodb_mirrored_log_groups", (char*) &innobase_mirrored_log_groups, SHOW_LONG},
@@ -1026,7 +1039,7 @@ struct show_var_st init_vars[]= {
{sys_optimizer_search_depth.name,(char*) &sys_optimizer_search_depth,
SHOW_SYS},
{"pid_file", (char*) pidfile_name, SHOW_CHAR},
- {"plugin_dir", (char*) opt_plugin_dir, SHOW_CHAR},
+ {sys_plugin_dir.name, (char*) &sys_plugin_dir, SHOW_SYS},
{"port", (char*) &mysqld_port, SHOW_INT},
{sys_preload_buff_size.name, (char*) &sys_preload_buff_size, SHOW_SYS},
{"protocol_version", (char*) &protocol_version, SHOW_INT},
@@ -1068,7 +1081,7 @@ struct show_var_st init_vars[]= {
#ifdef HAVE_REPLICATION
{sys_slave_compressed_protocol.name,
(char*) &sys_slave_compressed_protocol, SHOW_SYS},
- {"slave_load_tmpdir", (char*) &slave_load_tmpdir, SHOW_CHAR_PTR},
+ {sys_slave_load_tmpdir.name,(char*) &sys_slave_load_tmpdir, SHOW_SYS},
{sys_slave_net_timeout.name,(char*) &sys_slave_net_timeout, SHOW_SYS},
{"slave_skip_errors", (char*) &slave_error_mask, SHOW_SLAVE_SKIP_ERRORS},
{sys_slave_trans_retries.name,(char*) &sys_slave_trans_retries, SHOW_SYS},
@@ -1175,6 +1188,7 @@ bool update_sys_var_str(sys_var_str *var
old_value= var_str->value;
var_str->value= res;
var_str->value_length= new_length;
+ var_str->is_os_charset= FALSE;
rw_unlock(var_mutex);
my_free(old_value, MYF(MY_ALLOW_ZERO_PTR));
return 0;
@@ -1914,11 +1928,11 @@ Item *sys_var::item(THD *thd, enum_var_t
char *str= (char*) value_ptr(thd, var_type, base);
if (str)
tmp= new Item_string(str, strlen(str),
- system_charset_info, DERIVATION_SYSCONST);
+ charset(thd), DERIVATION_SYSCONST);
else
{
tmp= new Item_null();
- tmp->collation.set(system_charset_info, DERIVATION_SYSCONST);
+ tmp->collation.set(charset(thd), DERIVATION_SYSCONST);
}
pthread_mutex_unlock(&LOCK_global_system_variables);
return tmp;
@@ -1930,6 +1944,13 @@ Item *sys_var::item(THD *thd, enum_var_t
}
+CHARSET_INFO *sys_var::charset(THD *thd)
+{
+ return is_os_charset ? thd->variables.character_set_filesystem :
+ system_charset_info;
+}
+
+
bool sys_var_thd_enum::update(THD *thd, set_var *var)
{
if (var->type == OPT_GLOBAL)
=== modified file 'sql/set_var.h'
--- a/sql/set_var.h 2008-01-23 15:03:58 +0000
+++ b/sql/set_var.h 2008-11-28 14:25:16 +0000
@@ -46,9 +46,17 @@ public:
sys_after_update_func after_update;
bool no_support_one_shot;
+ /*
+ true if the value is in character_set_filesystem,
+ false otherwise.
+ Note that we can't use a pointer to the charset as the system var is
+ instantiated in global scope and the charset pointers are initialized
+ later.
+ */
+ bool is_os_charset;
sys_var(const char *name_arg, sys_after_update_func func= NULL)
:name(name_arg), after_update(func)
- , no_support_one_shot(1)
+ , no_support_one_shot(1), is_os_charset(FALSE)
{}
virtual ~sys_var() {}
virtual bool check(THD *thd, set_var *var);
@@ -68,6 +76,7 @@ public:
Item *item(THD *thd, enum_var_type type, LEX_STRING *base);
virtual bool is_struct() { return 0; }
virtual bool is_readonly() const { return 0; }
+ CHARSET_INFO *charset(THD *thd);
};
@@ -247,6 +256,17 @@ public:
};
+class sys_var_const_os_str: public sys_var_const_str
+{
+public:
+ sys_var_const_os_str(const char *name_arg, const char *value_arg)
+ :sys_var_const_str(name_arg, value_arg)
+ {
+ is_os_charset= TRUE;
+ }
+};
+
+
class sys_var_const_str_ptr :public sys_var
{
public:
@@ -276,6 +296,17 @@ public:
};
+class sys_var_const_os_str_ptr :public sys_var_const_str_ptr
+{
+public:
+ sys_var_const_os_str_ptr(const char *name_arg, char **value_arg)
+ :sys_var_const_str_ptr(name_arg, value_arg)
+ {
+ is_os_charset= TRUE;
+ }
+};
+
+
class sys_var_enum :public sys_var
{
uint *value;
@@ -791,6 +822,20 @@ public:
bool is_readonly() const { return 1; }
};
+
+class sys_var_readonly_os: public sys_var_readonly
+{
+public:
+ sys_var_readonly_os(const char *name_arg, enum_var_type type,
+ SHOW_TYPE show_type_arg,
+ sys_value_ptr_func value_ptr_func_arg)
+ :sys_var_readonly(name_arg, type, show_type_arg, value_ptr_func_arg)
+ {
+ is_os_charset= TRUE;
+ }
+};
+
+
class sys_var_thd_time_zone :public sys_var_thd
{
public:
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc 2008-10-17 14:55:06 +0000
+++ b/sql/sql_base.cc 2008-11-27 14:54:23 +0000
@@ -2102,7 +2102,10 @@ bool reopen_table(TABLE *table,bool lock
for (key=0 ; key < table->s->keys ; key++)
{
for (part=0 ; part < table->key_info[key].usable_key_parts ; part++)
+ {
table->key_info[key].key_part[part].field->table= table;
+ table->key_info[key].key_part[part].field->orig_table= table;
+ }
}
if (table->triggers)
table->triggers->set_table(table);
=== modified file 'sql/sql_db.cc'
--- a/sql/sql_db.cc 2008-09-30 12:50:28 +0000
+++ b/sql/sql_db.cc 2008-11-14 17:25:57 +0000
@@ -909,7 +909,6 @@ static long mysql_rm_known_files(THD *th
/* .frm archive:
Those archives are obsolete, but following code should
exist to remove existent "arc" directories.
- See #ifdef FRM_ARCHIVE directives for obsolete code.
*/
char newpath[FN_REFLEN];
MY_DIR *new_dirp;
@@ -1069,7 +1068,6 @@ static my_bool rm_dir_w_symlink(const ch
NOTE
A support of "arc" directories is obsolete, however this
function should exist to remove existent "arc" directories.
- See #ifdef FRM_ARCHIVE directives for obsolete code.
*/
long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, const char *org_path)
{
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2008-11-03 09:50:32 +0000
+++ b/sql/sql_select.cc 2008-11-24 15:30:47 +0000
@@ -390,11 +390,21 @@ inline int setup_without_group(THD *thd,
{
int res;
nesting_map save_allow_sum_func=thd->lex->allow_sum_func ;
+ /*
+ Need to save the value, so we can turn off only the new NON_AGG_FIELD
+ additions coming from the WHERE
+ */
+ uint8 saved_flag= thd->lex->current_select->full_group_by_flag;
DBUG_ENTER("setup_without_group");
thd->lex->allow_sum_func&= ~(1 << thd->lex->current_select->nest_level);
res= setup_conds(thd, tables, leaves, conds);
+ /* it's not wrong to have non-aggregated columns in a WHERE */
+ if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY)
+ thd->lex->current_select->full_group_by_flag= saved_flag |
+ (thd->lex->current_select->full_group_by_flag & ~NON_AGG_FIELD_USED);
+
thd->lex->allow_sum_func|= 1 << thd->lex->current_select->nest_level;
res= res || setup_order(thd, ref_pointer_array, tables, fields, all_fields,
order);
=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc 2008-10-15 10:06:44 +0000
+++ b/sql/sql_show.cc 2008-11-28 14:25:16 +0000
@@ -1441,6 +1441,7 @@ static bool show_status_array(THD *thd,
char name_buffer[80];
int len;
LEX_STRING null_lex_str;
+ CHARSET_INFO *charset= system_charset_info;
DBUG_ENTER("show_status_array");
null_lex_str.str= 0; // For sys_var->value_ptr()
@@ -1469,9 +1470,10 @@ static bool show_status_array(THD *thd,
long nr;
if (show_type == SHOW_SYS)
{
- show_type= ((sys_var*) value)->show_type();
- value= (char*) ((sys_var*) value)->value_ptr(thd, value_type,
- &null_lex_str);
+ sys_var *var= ((sys_var *) value);
+ show_type= var->show_type();
+ value= (char*) var->value_ptr(thd, value_type, &null_lex_str);
+ charset= var->charset(thd);
}
pos= end= buff;
@@ -1794,7 +1796,7 @@ static bool show_status_array(THD *thd,
restore_record(table, s->default_values);
table->field[0]->store(name_buffer, strlen(name_buffer),
system_charset_info);
- table->field[1]->store(pos, (uint32) (end - pos), system_charset_info);
+ table->field[1]->store(pos, (uint32) (end - pos), charset);
if (schema_table_store_record(thd, table))
DBUG_RETURN(TRUE);
}
=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc 2008-07-15 14:13:21 +0000
+++ b/sql/sql_table.cc 2008-11-13 13:06:48 +0000
@@ -2322,6 +2322,12 @@ static bool mysql_admin_table(THD* thd,
goto send_result;
}
+ if (table->schema_table)
+ {
+ result_code= HA_ADMIN_NOT_IMPLEMENTED;
+ goto send_result;
+ }
+
if ((table->table->db_stat & HA_READ_ONLY) && open_for_modify)
{
char buff[FN_REFLEN + MYSQL_ERRMSG_SIZE];
=== modified file 'sql/sql_trigger.cc'
--- a/sql/sql_trigger.cc 2008-07-14 21:41:30 +0000
+++ b/sql/sql_trigger.cc 2008-11-14 17:25:57 +0000
@@ -479,7 +479,7 @@ bool Table_triggers_list::create_trigger
trigname.trigger_table.length= tables->table_name_length;
if (sql_create_definition_file(&dir, &trigname_file, &trigname_file_type,
- (gptr)&trigname, trigname_file_parameters, 0))
+ (gptr)&trigname, trigname_file_parameters))
return 1;
/*
@@ -569,7 +569,7 @@ bool Table_triggers_list::create_trigger
/* Create trigger definition file. */
if (!sql_create_definition_file(&dir, &file, &triggers_file_type,
- (gptr)this, triggers_file_parameters, 0))
+ (gptr)this, triggers_file_parameters))
return 0;
err_with_cleanup:
@@ -656,7 +656,7 @@ static bool save_trigger_file(Table_trig
file.str= file_buff;
return sql_create_definition_file(&dir, &file, &triggers_file_type,
- (gptr)triggers, triggers_file_parameters, 0);
+ (gptr)triggers, triggers_file_parameters);
}
@@ -1427,7 +1427,7 @@ Table_triggers_list::change_table_name_i
trigname.trigger_table= *new_table_name;
if (sql_create_definition_file(&dir, &trigname_file, &trigname_file_type,
- (gptr)&trigname, trigname_file_parameters, 0))
+ (gptr)&trigname, trigname_file_parameters))
return trigger;
}
=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc 2008-10-09 15:24:31 +0000
+++ b/sql/sql_update.cc 2008-11-27 13:57:34 +0000
@@ -1249,6 +1249,32 @@ multi_update::initialize_tables(JOIN *jo
}
}
+ /*
+ enable uncacheable flag if we update a view with check option
+ and check option has a subselect, otherwise, the check option
+ can be evaluated after the subselect was freed as independent
+ (See full_local in JOIN::join_free()).
+ */
+ if (table_ref->check_option && !join->select_lex->uncacheable)
+ {
+ SELECT_LEX_UNIT *tmp_unit;
+ SELECT_LEX *sl;
+ for (tmp_unit= join->select_lex->first_inner_unit();
+ tmp_unit;
+ tmp_unit= tmp_unit->next_unit())
+ {
+ for (sl= tmp_unit->first_select(); sl; sl= sl->next_select())
+ {
+ if (sl->master_unit()->item)
+ {
+ join->select_lex->uncacheable|= UNCACHEABLE_CHECKOPTION;
+ goto loop_end;
+ }
+ }
+ }
+ }
+loop_end:
+
if (table == first_table_for_update && table_ref->check_option)
{
table_map unupdated_tables= table_ref->check_option->used_tables() &
=== modified file 'sql/sql_view.cc'
--- a/sql/sql_view.cc 2008-10-27 10:22:38 +0000
+++ b/sql/sql_view.cc 2008-12-01 08:14:02 +0000
@@ -660,7 +660,7 @@ bool mysql_create_view(THD *thd, TABLE_L
}
VOID(pthread_mutex_unlock(&LOCK_open));
- if (view->revision != 1)
+ if (mode != VIEW_CREATE_NEW)
query_cache_invalidate3(thd, view, 0);
start_waiting_global_read_lock(thd);
if (res)
@@ -678,12 +678,8 @@ err:
}
-/* index of revision number in following table */
-static const int revision_number_position= 8;
-/* index of last required parameter for making view */
-static const int required_view_parameters= 10;
-/* number of backups */
-static const int num_view_backups= 3;
+/* number of required parameters for making view */
+static const int required_view_parameters= 9;
/*
table of VIEW .frm field descriptors
@@ -716,9 +712,6 @@ static File_option view_parameters[]=
{{(char*) STRING_WITH_LEN("with_check_option")},
my_offsetof(TABLE_LIST, with_check),
FILE_OPTIONS_ULONGLONG},
- {{(char*) STRING_WITH_LEN("revision")},
- my_offsetof(TABLE_LIST, revision),
- FILE_OPTIONS_REV},
{{(char*) STRING_WITH_LEN("timestamp")},
my_offsetof(TABLE_LIST, timestamp),
FILE_OPTIONS_TIMESTAMP},
@@ -880,18 +873,9 @@ loop_out:
}
/*
- read revision number
-
TODO: read dependence list, too, to process cascade/restrict
TODO: special cascade/restrict procedure for alter?
*/
- if (parser->parse((gptr)view, thd->mem_root,
- view_parameters + revision_number_position, 1,
- &file_parser_dummy_hook))
- {
- error= thd->net.report_error? -1 : 0;
- goto err;
- }
}
else
{
@@ -933,7 +917,7 @@ loop_out:
}
if (sql_create_definition_file(&dir, &file, view_file_type,
- (gptr)view, view_parameters, num_view_backups))
+ (gptr)view, view_parameters))
{
error= thd->net.report_error? -1 : 1;
goto err;
@@ -996,13 +980,14 @@ bool mysql_make_view(THD *thd, File_pars
DBUG_RETURN(0);
}
- if (table->use_index || table->ignore_index)
- {
- my_error(ER_WRONG_USAGE, MYF(0),
- table->ignore_index ? "IGNORE INDEX" :
- (table->force_index ? "FORCE INDEX" : "USE INDEX"),
- "VIEW");
- DBUG_RETURN(TRUE);
+ List<String> *index_list= table->use_index ? table->use_index
+ : table->ignore_index;
+ if (index_list)
+ {
+ DBUG_ASSERT(index_list->head()); // should never fail
+ my_error(ER_KEY_DOES_NOT_EXITS, MYF(0), index_list->head()->c_ptr(),
+ table->table_name);
+ DBUG_RETURN(TRUE);
}
/* check loop via view definition */
@@ -1868,8 +1853,7 @@ mysql_rename_view(THD *thd,
goto err;
/* rename view and it's backups */
- if (rename_in_schema_file(thd, view->db, view->table_name, new_name,
- view_def.revision - 1, num_view_backups))
+ if (rename_in_schema_file(thd, view->db, view->table_name, new_name))
goto err;
strxnmov(dir_buff, FN_REFLEN, mysql_data_home, "/", view->db, "/", NullS);
@@ -1883,12 +1867,10 @@ mysql_rename_view(THD *thd,
- file_buff);
if (sql_create_definition_file(&pathstr, &file, view_file_type,
- (gptr)&view_def, view_parameters,
- num_view_backups))
+ (gptr)&view_def, view_parameters))
{
/* restore renamed view in case of error */
- rename_in_schema_file(thd, view->db, new_name, view->table_name,
- view_def.revision - 1, num_view_backups);
+ rename_in_schema_file(thd, view->db, new_name, view->table_name);
goto err;
}
} else
=== modified file 'sql/table.h'
--- a/sql/table.h 2008-10-07 21:34:00 +0000
+++ b/sql/table.h 2008-11-14 17:25:57 +0000
@@ -657,7 +657,6 @@ struct TABLE_LIST
st_lex_user definer; /* definer of view */
ulonglong file_version; /* version of file's field set */
ulonglong updatable_view; /* VIEW can be updated */
- ulonglong revision; /* revision control number */
ulonglong algorithm; /* 0 any, 1 tmp tables , 2 merging */
ulonglong view_suid; /* view is suid (TRUE dy default) */
ulonglong with_check; /* WITH CHECK OPTION */
=== modified file 'sql/tztime.cc'
--- a/sql/tztime.cc 2008-04-03 17:19:55 +0000
+++ b/sql/tztime.cc 2008-12-01 14:18:35 +0000
@@ -1073,6 +1073,7 @@ Time_zone_system::gmt_sec_to_TIME(MYSQL_
localtime_r(&tmp_t, &tmp_tm);
localtime_to_TIME(tmp, &tmp_tm);
tmp->time_type= MYSQL_TIMESTAMP_DATETIME;
+ adjust_leap_second(tmp);
}
@@ -1157,6 +1158,7 @@ Time_zone_utc::gmt_sec_to_TIME(MYSQL_TIM
gmtime_r(&tmp_t, &tmp_tm);
localtime_to_TIME(tmp, &tmp_tm);
tmp->time_type= MYSQL_TIMESTAMP_DATETIME;
+ adjust_leap_second(tmp);
}
@@ -1260,6 +1262,7 @@ void
Time_zone_db::gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const
{
::gmt_sec_to_TIME(tmp, t, tz_info);
+ adjust_leap_second(tmp);
}
@@ -2373,6 +2376,25 @@ Time_zone *my_tz_find_with_opening_tz_ta
DBUG_RETURN(tz);
}
+
+/**
+ Convert leap seconds into non-leap
+
+ This function will convert the leap seconds added by the OS to
+ non-leap seconds, e.g. 23:59:59, 23:59:60 -> 23:59:59, 00:00:01 ...
+ This check is not checking for years on purpose : although it's not a
+ complete check this way it doesn't require looking (and having installed)
+ the leap seconds table.
+
+ @param[in,out] broken down time structure as filled in by the OS
+*/
+
+void Time_zone::adjust_leap_second(MYSQL_TIME *t)
+{
+ if (t->second == 60 || t->second == 61)
+ t->second= 59;
+}
+
#endif /* !defined(TESTTIME) && !defined(TZINFO2SQL) */
=== modified file 'sql/tztime.h'
--- a/sql/tztime.h 2007-05-16 08:44:59 +0000
+++ b/sql/tztime.h 2008-12-01 14:18:35 +0000
@@ -55,6 +55,9 @@ public:
allocated on MEM_ROOT and should not require destruction.
*/
virtual ~Time_zone() {};
+
+protected:
+ static inline void adjust_leap_second(MYSQL_TIME *t);
};
extern Time_zone * my_tz_UTC;
=== modified file 'tests/mysql_client_test.c'
--- a/tests/mysql_client_test.c 2008-08-20 09:49:28 +0000
+++ b/tests/mysql_client_test.c 2008-11-27 14:26:22 +0000
@@ -16218,7 +16218,87 @@ static void test_bug38486(void)
DBUG_VOID_RETURN;
}
+static void test_bug40365(void)
+{
+ uint rc, i;
+ MYSQL_STMT *stmt= 0;
+ MYSQL_BIND my_bind[2];
+ my_bool is_null[2]= {0};
+ MYSQL_TIME tm[2];
+
+ DBUG_ENTER("test_bug40365");
+
+ rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
+ myquery(rc);
+ rc= mysql_query(mysql, "CREATE TABLE t1(c1 DATETIME, \
+ c2 DATE)");
+ myquery(rc);
+
+ stmt= mysql_simple_prepare(mysql, "INSERT INTO t1 VALUES(?, ?)");
+ check_stmt(stmt);
+ verify_param_count(stmt, 2);
+
+ bzero((char*) my_bind, sizeof(my_bind));
+ my_bind[0].buffer_type= MYSQL_TYPE_DATETIME;
+ my_bind[1].buffer_type= MYSQL_TYPE_DATE;
+ for (i= 0; i < (int) array_elements(my_bind); i++)
+ {
+ my_bind[i].buffer= (void *) &tm[i];
+ my_bind[i].is_null= &is_null[i];
+ }
+
+ rc= mysql_stmt_bind_param(stmt, my_bind);
+ check_execute(stmt, rc);
+
+ for (i= 0; i < (int) array_elements(my_bind); i++)
+ {
+ tm[i].neg= 0;
+ tm[i].second_part= 0;
+ tm[i].year= 2009;
+ tm[i].month= 2;
+ tm[i].day= 29;
+ tm[i].hour= 0;
+ tm[i].minute= 0;
+ tm[i].second= 0;
+ }
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+
+ rc= mysql_commit(mysql);
+ myquery(rc);
+ mysql_stmt_close(stmt);
+
+ stmt= mysql_simple_prepare(mysql, "SELECT * FROM t1");
+ check_stmt(stmt);
+
+ rc= mysql_stmt_bind_result(stmt, my_bind);
+ check_execute(stmt, rc);
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_store_result(stmt);
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_fetch(stmt);
+ check_execute(stmt, rc);
+
+ if (!opt_silent)
+ fprintf(stdout, "\n");
+
+ for (i= 0; i < array_elements(my_bind); i++)
+ {
+ if (!opt_silent)
+ fprintf(stdout, "\ntime[%d]: %02d-%02d-%02d ",
+ i, tm[i].year, tm[i].month, tm[i].day);
+ DIE_UNLESS(tm[i].year == 0);
+ DIE_UNLESS(tm[i].month == 0);
+ DIE_UNLESS(tm[i].day == 0);
+ }
+ mysql_stmt_close(stmt);
+
+ DBUG_VOID_RETURN;
+}
/*
Read and parse arguments and MySQL options from my.cnf
*/
@@ -16514,6 +16594,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug31669", test_bug31669 },
{ "test_bug32265", test_bug32265 },
{ "test_bug38486", test_bug38486 },
+ { "test_bug40365", test_bug40365 },
{ 0, 0 }
};
| Thread |
|---|
| • bzr push into mysql-5.0 branch (kgeorge:2730 to 2732) | Georgi Kodinov | 2 Dec |