mirror of
https://github.com/MariaDB/server.git
synced 2025-01-26 00:34:18 +01:00
merge from 5.1 main
This commit is contained in:
commit
15f50ffb03
161 changed files with 3786 additions and 1785 deletions
12
configure.in
12
configure.in
|
@ -12,7 +12,7 @@ dnl
|
|||
dnl When changing the major version number please also check the switch
|
||||
dnl statement in mysqlbinlog::check_master_version(). You may also need
|
||||
dnl to update version.c in ndb.
|
||||
AC_INIT([MySQL Server], [5.1.58], [], [mysql])
|
||||
AC_INIT([MySQL Server], [5.1.59], [], [mysql])
|
||||
|
||||
AC_CONFIG_SRCDIR([sql/mysqld.cc])
|
||||
AC_CANONICAL_SYSTEM
|
||||
|
@ -2042,12 +2042,7 @@ MYSQL_TYPE_QSORT
|
|||
AC_FUNC_UTIME_NULL
|
||||
AC_FUNC_VPRINTF
|
||||
|
||||
AC_CHECK_DECLS([fdatasync],,,
|
||||
[
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
])
|
||||
AC_CHECK_DECLS([fdatasync, bzero])
|
||||
|
||||
AC_CHECK_FUNCS(alarm bfill bmove bsearch bzero \
|
||||
chsize cuserid fchmod fcntl \
|
||||
|
@ -2066,7 +2061,8 @@ AC_CHECK_FUNCS(alarm bfill bmove bsearch bzero \
|
|||
sighold sigset sigthreadmask port_create sleep \
|
||||
snprintf socket stpcpy strcasecmp strerror strsignal strnlen strpbrk strstr \
|
||||
strtol strtoll strtoul strtoull tell tempnam thr_setconcurrency vidattr \
|
||||
posix_fallocate backtrace backtrace_symbols backtrace_symbols_fd printstack)
|
||||
posix_fallocate backtrace backtrace_symbols backtrace_symbols_fd printstack \
|
||||
fedisableexcept)
|
||||
|
||||
#
|
||||
#
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2000-2005 MySQL AB & Innobase Oy
|
||||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -128,7 +128,7 @@ void SetErrorString(unsigned long error, char* buffer)
|
|||
break;
|
||||
|
||||
case badVersion_error :
|
||||
strncpy(buffer, "protocl version mismatch", max);
|
||||
strncpy(buffer, "protocol version mismatch", max);
|
||||
break;
|
||||
|
||||
case compress_error :
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
# define bfill(A,B,C) memset((A),(C),(B))
|
||||
#endif
|
||||
|
||||
#if !defined(bzero) && !defined(HAVE_BZERO)
|
||||
#if !defined(bzero) && (!defined(HAVE_BZERO) || !defined(HAVE_DECL_BZERO))
|
||||
# define bzero(A,B) memset((A),0,(B))
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2002-2004 MySQL AB
|
||||
/* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -11,7 +11,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
#ifndef _my_getopt_h
|
||||
#define _my_getopt_h
|
||||
|
@ -59,7 +59,9 @@ struct my_option
|
|||
};
|
||||
|
||||
typedef my_bool (*my_get_one_option)(int, const struct my_option *, char *);
|
||||
typedef void (*my_error_reporter)(enum loglevel level, const char *format, ...);
|
||||
typedef void (*my_error_reporter)(enum loglevel level, const char *format, ...)
|
||||
ATTRIBUTE_FORMAT_FPTR(printf, 2, 3);
|
||||
|
||||
/**
|
||||
Used to retrieve a reference to the object (variable) that holds the value
|
||||
for the given option. For example, if var_type is GET_UINT, the function
|
||||
|
|
|
@ -51,6 +51,23 @@ extern "C" void unireg_clear(int exit_code)
|
|||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
/*
|
||||
Wrapper error handler for embedded server to call client/server error
|
||||
handler based on whether thread is in client/server context
|
||||
*/
|
||||
|
||||
static int embedded_error_handler(uint error, const char *str, myf MyFlags)
|
||||
{
|
||||
DBUG_ENTER("embedded_error_handler");
|
||||
|
||||
/*
|
||||
If current_thd is NULL, it means restore_global has been called and
|
||||
thread is in client context, then call client error handler else call
|
||||
server error handler.
|
||||
*/
|
||||
DBUG_RETURN(current_thd ? my_message_sql(error, str, MyFlags):
|
||||
my_message_no_curses(error, str, MyFlags));
|
||||
}
|
||||
|
||||
/*
|
||||
Reads error information from the MYSQL_DATA and puts
|
||||
|
@ -107,7 +124,8 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
|
|||
if (mysql->status != MYSQL_STATUS_READY)
|
||||
{
|
||||
set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate);
|
||||
return 1;
|
||||
result= 1;
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* Clear result variables */
|
||||
|
@ -147,6 +165,9 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command,
|
|||
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
|
||||
thd->profiling.finish_current_query();
|
||||
#endif
|
||||
|
||||
end:
|
||||
thd->restore_globals();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -525,7 +546,10 @@ int init_embedded_server(int argc, char **argv, char **groups)
|
|||
return 1;
|
||||
}
|
||||
|
||||
error_handler_hook = my_message_sql;
|
||||
/*
|
||||
set error_handler_hook to embedded_error_handler wrapper.
|
||||
*/
|
||||
error_handler_hook= embedded_error_handler;
|
||||
|
||||
acl_error= 0;
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
# in alphabetical order. This also helps with merge conflict resolution.
|
||||
|
||||
binlog.binlog_multi_engine # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
binlog.binlog_bug23533 # skozlov: BUG#12371924
|
||||
|
||||
|
||||
funcs_1.charset_collation_1 # depends on compile-time decisions
|
||||
|
@ -14,21 +13,22 @@ funcs_1.ndb* # joro : NDB tests marked as experiment
|
|||
|
||||
funcs_2.ndb_charset # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
|
||||
innodb_plugin.* @solaris # Bug#56063 InnoDB Plugin mysql-tests fail on Solaris
|
||||
innodb_plugin.* @solaris # Bug#11763366 InnoDB Plugin mysql-tests fail on Solaris
|
||||
|
||||
main.ctype_gbk_binlog @solaris # Bug#11754407: main.ctype_gbk_binlog fails sporadically : Table 't2' already exists
|
||||
main.func_str @solaris # joro: Bug#11750406
|
||||
main.sp @solaris # joro : Bug#11761625
|
||||
main.query_cache_28249 # Bug#12584161 2009-03-25 main.query_cache_28249 fails sporadically
|
||||
|
||||
main.ctype_gbk_binlog @solaris # Bug#46010: main.ctype_gbk_binlog fails sporadically : Table 't2' already exists
|
||||
main.func_str @solaris # joro: Bug#40928
|
||||
main.sp @solaris # joro : Bug#54138
|
||||
main.outfile_loaddata @solaris # joro : Bug #46895
|
||||
|
||||
ndb.* # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
|
||||
rpl.rpl_innodb_bug28430 @solaris # Bug#46029
|
||||
rpl.rpl_row_sp011 @solaris # Joro : Bug #45445
|
||||
rpl.rpl_innodb_bug28430 @solaris # Bug#11754425
|
||||
rpl.rpl_row_sp011 @solaris # Joro : Bug #11753919
|
||||
rpl.rpl_stop_slave # Sven : BUG#12345981
|
||||
|
||||
rpl_ndb.* # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
rpl_ndb.rpl_ndb_log # Bug#38998
|
||||
rpl_ndb.rpl_ndb_log # Bug#11749433
|
||||
|
||||
stress.ddl_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
|
||||
|
@ -46,6 +46,3 @@ parts.partition_mgm_lc1_ndb # joro : NDB tests marked as experiment
|
|||
parts.partition_mgm_lc2_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
parts.partition_syntax_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
parts.partition_value_ndb # joro : NDB tests marked as experimental as agreed with bochklin
|
||||
main.gis-rtree # svoj: due to BUG#38965
|
||||
main.type_float # svoj: due to BUG#38965
|
||||
main.type_newdecimal # svoj: due to BUG#38965
|
||||
|
|
|
@ -1345,4 +1345,33 @@ DROP TABLE t1;
|
|||
CREATE TABLE t1 (a TEXT, id INT, b INT);
|
||||
ALTER TABLE t1 DROP COLUMN a, ADD COLUMN c TEXT FIRST;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Test for bug #12652385 - "61493: REORDERING COLUMNS TO POSITION
|
||||
# FIRST CAN CAUSE DATA TO BE CORRUPTED".
|
||||
#
|
||||
drop table if exists t1;
|
||||
# Use MyISAM engine as the fact that InnoDB doesn't support
|
||||
# in-place ALTER TABLE in cases when columns are being renamed
|
||||
# hides some bugs.
|
||||
create table t1 (i int, j int) engine=myisam;
|
||||
insert into t1 value (1, 2);
|
||||
# First, test for original problem described in the bug report.
|
||||
select * from t1;
|
||||
i j
|
||||
1 2
|
||||
# Change of column order by the below ALTER TABLE statement should
|
||||
# affect both column names and column contents.
|
||||
alter table t1 modify column j int first;
|
||||
select * from t1;
|
||||
j i
|
||||
2 1
|
||||
# Now test for similar problem with the same root.
|
||||
# The below ALTER TABLE should change not only the name but
|
||||
# also the value for the last column of the table.
|
||||
alter table t1 drop column i, add column k int default 0;
|
||||
select * from t1;
|
||||
j k
|
||||
2 0
|
||||
# Clean-up.
|
||||
drop table t1;
|
||||
End of 5.1 tests
|
||||
|
|
12
mysql-test/r/archive_debug.result
Normal file
12
mysql-test/r/archive_debug.result
Normal file
|
@ -0,0 +1,12 @@
|
|||
#
|
||||
# BUG#12402794 - 60976: CRASH, VALGRIND WARNING AND MEMORY LEAK
|
||||
# WITH PARTITIONED ARCHIVE TABLES
|
||||
#
|
||||
CREATE TABLE t1(a INT) ENGINE=ARCHIVE;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
SET SESSION debug='d,simulate_archive_open_failure';
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check error Corrupt
|
||||
SET SESSION debug=DEFAULT;
|
||||
DROP TABLE t1;
|
|
@ -419,7 +419,7 @@ SET TIME_ZONE= '+04:00';
|
|||
ALTER EVENT e1 DO SELECT 2;
|
||||
SHOW EVENTS;
|
||||
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
|
||||
events_test e1 root@localhost -03:00 RECURRING NULL 1 DAY 2005-12-31 20:58:59 2030-01-03 00:00:00 ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
events_test e1 root@localhost -03:00 RECURRING NULL 1 DAY 2005-12-31 20:58:59 2030-01-03 00:00:00 DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
DROP EVENT e1;
|
||||
SET TIME_ZONE='+05:00';
|
||||
CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO
|
||||
|
@ -535,6 +535,7 @@ DROP EVENT e3;
|
|||
DROP EVENT e2;
|
||||
DROP EVENT e1;
|
||||
SET TIME_ZONE=@save_time_zone;
|
||||
SET TIMESTAMP=DEFAULT;
|
||||
drop event if exists new_event;
|
||||
CREATE EVENT new_event ON SCHEDULE EVERY 0 SECOND DO SELECT 1;
|
||||
ERROR HY000: INTERVAL is either not positive or too big
|
||||
|
@ -756,6 +757,59 @@ SHOW EVENTS;
|
|||
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
|
||||
DROP DATABASE event_test1;
|
||||
DROP DATABASE event_test12;
|
||||
#
|
||||
# Bug#12546938 (formerly known as bug#61005):
|
||||
# CREATE IF NOT EXIST EVENT WILL CREATE MULTIPLE RUNNING EVENTS
|
||||
#
|
||||
USE events_test;
|
||||
SET GLOBAL event_scheduler = ON;
|
||||
DROP TABLE IF EXISTS table_bug12546938;
|
||||
DROP EVENT IF EXISTS event_Bug12546938;
|
||||
CREATE TABLE table_bug12546938 (i INT);
|
||||
# Create an event which will be executed with a small delay
|
||||
# and won't be automatically dropped after that.
|
||||
CREATE EVENT event_Bug12546938
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND ON COMPLETION PRESERVE
|
||||
ENABLE DO
|
||||
BEGIN
|
||||
INSERT INTO table_bug12546938 VALUES(1);
|
||||
END
|
||||
|
|
||||
# Now try to create the same event using CREATE EVENT IF NOT EXISTS.
|
||||
# A warning should be emitted. A new event should not be created nor
|
||||
# the old event should be re-executed.
|
||||
CREATE EVENT IF NOT EXISTS event_bug12546938
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND ON COMPLETION PRESERVE
|
||||
ENABLE DO
|
||||
BEGIN
|
||||
INSERT INTO table_bug12546938 VALUES (1);
|
||||
END
|
||||
|
|
||||
Warnings:
|
||||
Note 1537 Event 'event_bug12546938' already exists
|
||||
# Wait until at least one instance of event is executed.
|
||||
# Check that only one instance of our event was executed.
|
||||
SELECT COUNT(*) FROM table_bug12546938;
|
||||
COUNT(*)
|
||||
1
|
||||
# Clean-up.
|
||||
DROP EVENT IF EXISTS event_Bug12546938;
|
||||
DROP TABLE table_bug12546938;
|
||||
SET GLOBAL EVENT_SCHEDULER = OFF;
|
||||
DROP DATABASE IF EXISTS event_test11764334;
|
||||
CREATE DATABASE event_test11764334;
|
||||
USE event_test11764334;
|
||||
CREATE EVENT ev1 ON SCHEDULE EVERY 3 SECOND DISABLE DO SELECT 1;
|
||||
SHOW EVENTS IN event_test11764334 WHERE NAME='ev1';
|
||||
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
|
||||
event_test11764334 ev1 root@localhost SYSTEM RECURRING NULL 3 SECOND # # DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
ALTER EVENT ev1 ON SCHEDULE EVERY 4 SECOND;
|
||||
SHOW EVENTS IN event_test11764334 WHERE NAME='ev1';
|
||||
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
|
||||
event_test11764334 ev1 root@localhost SYSTEM RECURRING NULL 4 SECOND # # DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
DROP EVENT ev1;
|
||||
DROP DATABASE event_test11764334;
|
||||
USE test;
|
||||
DROP DATABASE events_test;
|
||||
SET GLOBAL event_scheduler= 'ON';
|
||||
SET @@global.concurrent_insert= @concurrent_insert;
|
||||
|
|
|
@ -540,4 +540,10 @@ ROUND(LEAST(15, -4939092, 0.2704), STDDEV('a'))
|
|||
-4939092.0000
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'a'
|
||||
#
|
||||
# Bug#12392636 ASSERTION FAILED: SCALE >= 0 && PRECISION > 0 && SCALE <= PRECISION
|
||||
#
|
||||
SELECT SUM(DISTINCT (TRUNCATE((.1), NULL)));
|
||||
SUM(DISTINCT (TRUNCATE((.1), NULL)))
|
||||
NULL
|
||||
End of 5.1 tests
|
||||
|
|
|
@ -1417,4 +1417,13 @@ NULL
|
|||
SELECT DATE_FORMAT('0000-00-11', '%w');
|
||||
DATE_FORMAT('0000-00-11', '%w')
|
||||
NULL
|
||||
#
|
||||
# Bug#12403504 AFTER FIX FOR #11889186 : ASSERTION FAILED: DELSUM+(INT) Y/4-TEMP > 0
|
||||
#
|
||||
SELECT MAKEDATE(11111111,1);
|
||||
MAKEDATE(11111111,1)
|
||||
NULL
|
||||
SELECT WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1);
|
||||
WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1)
|
||||
NULL
|
||||
End of 5.1 tests
|
||||
|
|
|
@ -1549,3 +1549,30 @@ HANDLER t1 READ a NEXT;
|
|||
HANDLER t1 CLOSE;
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests.
|
||||
#
|
||||
# Bug #57323/11764487: myisam corruption with insert ignore
|
||||
# and invalid spatial data
|
||||
#
|
||||
CREATE TABLE t1(a LINESTRING NOT NULL, b GEOMETRY NOT NULL,
|
||||
SPATIAL KEY(a), SPATIAL KEY(b)) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES(GEOMFROMTEXT("point (0 0)"), GEOMFROMTEXT("point (1 1)"));
|
||||
INSERT IGNORE INTO t1 SET a=GEOMFROMTEXT("point (-6 0)"), b=GEOMFROMTEXT("error");
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
||||
INSERT IGNORE INTO t1 SET a=GEOMFROMTEXT("point (-6 0)"), b=NULL;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
||||
SELECT ASTEXT(a), ASTEXT(b) FROM t1;
|
||||
ASTEXT(a) ASTEXT(b)
|
||||
POINT(0 0) POINT(1 1)
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a INT NOT NULL, b GEOMETRY NOT NULL,
|
||||
KEY(a), SPATIAL KEY(b)) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES(0, GEOMFROMTEXT("point (1 1)"));
|
||||
INSERT IGNORE INTO t1 SET a=0, b=GEOMFROMTEXT("error");
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
||||
INSERT IGNORE INTO t1 SET a=1, b=NULL;
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
||||
SELECT a, ASTEXT(b) FROM t1;
|
||||
a ASTEXT(b)
|
||||
0 POINT(1 1)
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
|
366
mysql-test/r/implicit_char_to_num_conversion.result
Normal file
366
mysql-test/r/implicit_char_to_num_conversion.result
Normal file
|
@ -0,0 +1,366 @@
|
|||
DROP TABLE IF EXISTS t5;
|
||||
CREATE TABLE t5(c1 BIT(2) PRIMARY KEY) ENGINE = <default_engine>;
|
||||
INSERT INTO t5 VALUES (0), (1), (2);
|
||||
SELECT HEX(c1) FROM t5 ORDER BY c1;
|
||||
HEX(c1)
|
||||
0
|
||||
1
|
||||
2
|
||||
SELECT HEX(c1) FROM t5 WHERE c1 = b'1' ORDER BY c1;
|
||||
HEX(c1)
|
||||
1
|
||||
SELECT HEX(c1) FROM t5 WHERE c1 <=> b'1' ORDER BY c1;
|
||||
HEX(c1)
|
||||
1
|
||||
SELECT HEX(c1) FROM t5 WHERE c1 != b'1' ORDER BY c1;
|
||||
HEX(c1)
|
||||
0
|
||||
2
|
||||
SELECT HEX(c1) FROM t5 WHERE c1 >= '1' ORDER BY c1;
|
||||
HEX(c1)
|
||||
1
|
||||
2
|
||||
SELECT HEX(c1) FROM t5 WHERE c1 <= '1' ORDER BY c1;
|
||||
HEX(c1)
|
||||
0
|
||||
1
|
||||
SELECT HEX(c1) FROM t5 WHERE c1 < '1' ORDER BY c1;
|
||||
HEX(c1)
|
||||
0
|
||||
SELECT HEX(c1) FROM t5 WHERE c1 > '0' ORDER BY c1;
|
||||
HEX(c1)
|
||||
1
|
||||
2
|
||||
DROP TABLE t5;
|
||||
CREATE TABLE t5(c1 FLOAT(5,2) PRIMARY KEY) ENGINE = <default_engine>;
|
||||
INSERT INTO t5 VALUES (95.95), (-10.10), (1), (0);
|
||||
SELECT c1 FROM t5 ORDER BY c1;
|
||||
c1
|
||||
-10.10
|
||||
0.00
|
||||
1.00
|
||||
95.95
|
||||
SELECT c1 FROM t5 WHERE c1 >= '95' ORDER BY c1;
|
||||
c1
|
||||
95.95
|
||||
SELECT c1 FROM t5 WHERE c1 <= '10.10' ORDER BY c1;
|
||||
c1
|
||||
-10.10
|
||||
0.00
|
||||
1.00
|
||||
SELECT c1 FROM t5 WHERE c1 != '1' ORDER BY c1;
|
||||
c1
|
||||
-10.10
|
||||
0.00
|
||||
95.95
|
||||
SELECT c1 FROM t5 WHERE c1 < '1' ORDER BY c1;
|
||||
c1
|
||||
-10.10
|
||||
0.00
|
||||
SELECT c1 FROM t5 WHERE c1 > '0' ORDER BY c1;
|
||||
c1
|
||||
1.00
|
||||
95.95
|
||||
DROP TABLE t5;
|
||||
CREATE TABLE t5(c1 TINYINT PRIMARY KEY) ENGINE = <default_engine>;
|
||||
INSERT INTO t5 VALUES (95), (10),(11),(-8);
|
||||
SELECT c1 FROM t5 ORDER BY c1;
|
||||
c1
|
||||
-8
|
||||
10
|
||||
11
|
||||
95
|
||||
SELECT c1 FROM t5 WHERE c1 = '10' ORDER BY c1;
|
||||
c1
|
||||
10
|
||||
SELECT c1 FROM t5 WHERE c1 <=> '10' ORDER BY c1;
|
||||
c1
|
||||
10
|
||||
SELECT c1 FROM t5 WHERE c1 >= '95' ORDER BY c1;
|
||||
c1
|
||||
95
|
||||
SELECT c1 FROM t5 WHERE c1 <= '11' ORDER BY c1;
|
||||
c1
|
||||
-8
|
||||
10
|
||||
11
|
||||
SELECT c1 FROM t5 WHERE c1 != '-8' ORDER BY c1;
|
||||
c1
|
||||
10
|
||||
11
|
||||
95
|
||||
SELECT c1 FROM t5 WHERE c1 < '11' ORDER BY c1;
|
||||
c1
|
||||
-8
|
||||
10
|
||||
SELECT c1 FROM t5 WHERE c1 > '10' ORDER BY c1;
|
||||
c1
|
||||
11
|
||||
95
|
||||
DROP TABLE t5;
|
||||
CREATE TABLE t5(c1 SMALLINT PRIMARY KEY) ENGINE = <default_engine>;
|
||||
INSERT INTO t5 VALUES (395), (-200), (100), (111);
|
||||
SELECT c1 FROM t5 ORDER BY c1;
|
||||
c1
|
||||
-200
|
||||
100
|
||||
111
|
||||
395
|
||||
SELECT c1 FROM t5 WHERE c1 = '100' ORDER BY c1;
|
||||
c1
|
||||
100
|
||||
SELECT c1 FROM t5 WHERE c1 <=> '100' ORDER BY c1;
|
||||
c1
|
||||
100
|
||||
SELECT c1 FROM t5 WHERE c1 >= '395' ORDER BY c1;
|
||||
c1
|
||||
395
|
||||
SELECT c1 FROM t5 WHERE c1 <= '-200' ORDER BY c1;
|
||||
c1
|
||||
-200
|
||||
SELECT c1 FROM t5 WHERE c1 != '100' ORDER BY c1;
|
||||
c1
|
||||
-200
|
||||
111
|
||||
395
|
||||
SELECT c1 FROM t5 WHERE c1 < '111' ORDER BY c1;
|
||||
c1
|
||||
-200
|
||||
100
|
||||
SELECT c1 FROM t5 WHERE c1 > '111' ORDER BY c1;
|
||||
c1
|
||||
395
|
||||
DROP TABLE t5;
|
||||
CREATE TABLE t5(c1 MEDIUMINT PRIMARY KEY) ENGINE = <default_engine>;
|
||||
INSERT INTO t5 VALUES (-8388607), (311),(215),(88608);
|
||||
SELECT c1 FROM t5 ORDER BY c1;
|
||||
c1
|
||||
-8388607
|
||||
215
|
||||
311
|
||||
88608
|
||||
SELECT c1 FROM t5 WHERE c1 = '311' ORDER BY c1;
|
||||
c1
|
||||
311
|
||||
SELECT c1 FROM t5 WHERE c1 <=> '311' ORDER BY c1;
|
||||
c1
|
||||
311
|
||||
SELECT c1 FROM t5 WHERE c1 >= '215' ORDER BY c1;
|
||||
c1
|
||||
215
|
||||
311
|
||||
88608
|
||||
SELECT c1 FROM t5 WHERE c1 <= '88608' ORDER BY c1;
|
||||
c1
|
||||
-8388607
|
||||
215
|
||||
311
|
||||
88608
|
||||
SELECT c1 FROM t5 WHERE c1 != '-8388607' ORDER BY c1;
|
||||
c1
|
||||
215
|
||||
311
|
||||
88608
|
||||
SELECT c1 FROM t5 WHERE c1 < '215' ORDER BY c1;
|
||||
c1
|
||||
-8388607
|
||||
SELECT c1 FROM t5 WHERE c1 > '215' ORDER BY c1;
|
||||
c1
|
||||
311
|
||||
88608
|
||||
DROP TABLE t5;
|
||||
CREATE TABLE t5(c1 INT PRIMARY KEY) ENGINE = <default_engine>;
|
||||
INSERT INTO t5 VALUES (-2147483647), (1011),(15),(9388607);
|
||||
SELECT c1 FROM t5 ORDER BY c1;
|
||||
c1
|
||||
-2147483647
|
||||
15
|
||||
1011
|
||||
9388607
|
||||
SELECT c1 FROM t5 WHERE c1 = '9388607' ORDER BY c1;
|
||||
c1
|
||||
9388607
|
||||
SELECT c1 FROM t5 WHERE c1 <=> '9388607' ORDER BY c1;
|
||||
c1
|
||||
9388607
|
||||
SELECT c1 FROM t5 WHERE c1 >= '15' ORDER BY c1;
|
||||
c1
|
||||
15
|
||||
1011
|
||||
9388607
|
||||
SELECT c1 FROM t5 WHERE c1 <= '1011' ORDER BY c1;
|
||||
c1
|
||||
-2147483647
|
||||
15
|
||||
1011
|
||||
SELECT c1 FROM t5 WHERE c1 != '-2147483647' ORDER BY c1;
|
||||
c1
|
||||
15
|
||||
1011
|
||||
9388607
|
||||
SELECT c1 FROM t5 WHERE c1 < '15' ORDER BY c1;
|
||||
c1
|
||||
-2147483647
|
||||
SELECT c1 FROM t5 WHERE c1 > '15' ORDER BY c1;
|
||||
c1
|
||||
1011
|
||||
9388607
|
||||
DROP TABLE t5;
|
||||
CREATE TABLE t5(c1 BIGINT PRIMARY KEY) ENGINE = <default_engine>;
|
||||
INSERT INTO t5 VALUES (-9223372036854775807), (12011),(500),(3372036854775808);
|
||||
SELECT c1 FROM t5 ORDER BY c1;
|
||||
c1
|
||||
-9223372036854775807
|
||||
500
|
||||
12011
|
||||
3372036854775808
|
||||
SELECT c1 FROM t5 WHERE c1 = '-9223372036854775807' ORDER BY c1;
|
||||
c1
|
||||
-9223372036854775807
|
||||
SELECT c1 FROM t5 WHERE c1 <=> '-9223372036854775807' ORDER BY c1;
|
||||
c1
|
||||
-9223372036854775807
|
||||
SELECT c1 FROM t5 WHERE c1 >= '12011' ORDER BY c1;
|
||||
c1
|
||||
12011
|
||||
3372036854775808
|
||||
SELECT c1 FROM t5 WHERE c1 <= '500' ORDER BY c1;
|
||||
c1
|
||||
-9223372036854775807
|
||||
500
|
||||
SELECT c1 FROM t5 WHERE c1 != '3372036854775808' ORDER BY c1;
|
||||
c1
|
||||
-9223372036854775807
|
||||
500
|
||||
12011
|
||||
SELECT c1 FROM t5 WHERE c1 < '12011' ORDER BY c1;
|
||||
c1
|
||||
-9223372036854775807
|
||||
500
|
||||
SELECT c1 FROM t5 WHERE c1 > '12011' ORDER BY c1;
|
||||
c1
|
||||
3372036854775808
|
||||
DROP TABLE t5;
|
||||
CREATE TABLE t5(c1 DOUBLE(5,2) PRIMARY KEY) ENGINE = <default_engine>;
|
||||
INSERT INTO t5 VALUES (95.95), (11.11),(5),(-908.92);
|
||||
SELECT c1 FROM t5 ORDER BY c1;
|
||||
c1
|
||||
-908.92
|
||||
5.00
|
||||
11.11
|
||||
95.95
|
||||
SELECT c1 FROM t5 WHERE c1 = '11.11' ORDER BY c1;
|
||||
c1
|
||||
11.11
|
||||
SELECT c1 FROM t5 WHERE c1 <=> '11.11' ORDER BY c1;
|
||||
c1
|
||||
11.11
|
||||
SELECT c1 FROM t5 WHERE c1 >= '5' ORDER BY c1;
|
||||
c1
|
||||
5.00
|
||||
11.11
|
||||
95.95
|
||||
SELECT c1 FROM t5 WHERE c1 <= '95.95' ORDER BY c1;
|
||||
c1
|
||||
-908.92
|
||||
5.00
|
||||
11.11
|
||||
95.95
|
||||
SELECT c1 FROM t5 WHERE c1 != '-908.92' ORDER BY c1;
|
||||
c1
|
||||
5.00
|
||||
11.11
|
||||
95.95
|
||||
SELECT c1 FROM t5 WHERE c1 < '95.95' ORDER BY c1;
|
||||
c1
|
||||
-908.92
|
||||
5.00
|
||||
11.11
|
||||
SELECT c1 FROM t5 WHERE c1 > '-908.92' ORDER BY c1;
|
||||
c1
|
||||
5.00
|
||||
11.11
|
||||
95.95
|
||||
DROP TABLE t5;
|
||||
CREATE TABLE t5(c1 NUMERIC(5,2) PRIMARY KEY) ENGINE = <default_engine>;
|
||||
INSERT INTO t5 VALUES (95.95), (11.11),(5),(-908.92);
|
||||
SELECT c1 FROM t5 ORDER BY c1;
|
||||
c1
|
||||
-908.92
|
||||
5.00
|
||||
11.11
|
||||
95.95
|
||||
SELECT c1 FROM t5 WHERE c1 = '11.11' ORDER BY c1;
|
||||
c1
|
||||
11.11
|
||||
SELECT c1 FROM t5 WHERE c1 <=> '11.11' ORDER BY c1;
|
||||
c1
|
||||
11.11
|
||||
SELECT c1 FROM t5 WHERE c1 >= '5' ORDER BY c1;
|
||||
c1
|
||||
5.00
|
||||
11.11
|
||||
95.95
|
||||
SELECT c1 FROM t5 WHERE c1 <= '95.95' ORDER BY c1;
|
||||
c1
|
||||
-908.92
|
||||
5.00
|
||||
11.11
|
||||
95.95
|
||||
SELECT c1 FROM t5 WHERE c1 != '-908.92' ORDER BY c1;
|
||||
c1
|
||||
5.00
|
||||
11.11
|
||||
95.95
|
||||
SELECT c1 FROM t5 WHERE c1 < '95.95' ORDER BY c1;
|
||||
c1
|
||||
-908.92
|
||||
5.00
|
||||
11.11
|
||||
SELECT c1 FROM t5 WHERE c1 > '-908.92' ORDER BY c1;
|
||||
c1
|
||||
5.00
|
||||
11.11
|
||||
95.95
|
||||
DROP TABLE t5;
|
||||
CREATE TABLE t5(c1 DECIMAL(5,2) PRIMARY KEY) ENGINE = <default_engine>;
|
||||
INSERT INTO t5 VALUES (95.95), (11.11),(5),(-908.92);
|
||||
SELECT c1 FROM t5 ORDER BY c1;
|
||||
c1
|
||||
-908.92
|
||||
5.00
|
||||
11.11
|
||||
95.95
|
||||
SELECT c1 FROM t5 WHERE c1 = '11.11' ORDER BY c1;
|
||||
c1
|
||||
11.11
|
||||
SELECT c1 FROM t5 WHERE c1 <=> '11.11' ORDER BY c1;
|
||||
c1
|
||||
11.11
|
||||
SELECT c1 FROM t5 WHERE c1 >= '5' ORDER BY c1;
|
||||
c1
|
||||
5.00
|
||||
11.11
|
||||
95.95
|
||||
SELECT c1 FROM t5 WHERE c1 <= '95.95' ORDER BY c1;
|
||||
c1
|
||||
-908.92
|
||||
5.00
|
||||
11.11
|
||||
95.95
|
||||
SELECT c1 FROM t5 WHERE c1 != '-908.92' ORDER BY c1;
|
||||
c1
|
||||
5.00
|
||||
11.11
|
||||
95.95
|
||||
SELECT c1 FROM t5 WHERE c1 < '95.95' ORDER BY c1;
|
||||
c1
|
||||
-908.92
|
||||
5.00
|
||||
11.11
|
||||
SELECT c1 FROM t5 WHERE c1 > '-908.92' ORDER BY c1;
|
||||
c1
|
||||
5.00
|
||||
11.11
|
||||
95.95
|
||||
DROP TABLE t5;
|
|
@ -1,5 +1,34 @@
|
|||
drop table if exists t1, t2;
|
||||
#
|
||||
# Bug#11765667: bug#58655: ASSERTION FAILED,
|
||||
# SERVER CRASHES WITH MYSQLD GOT SIGNAL 6
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
id MEDIUMINT NOT NULL AUTO_INCREMENT,
|
||||
dt DATE, st VARCHAR(255), uid INT,
|
||||
id2nd LONGBLOB, filler VARCHAR(255), PRIMARY KEY(id, dt)
|
||||
);
|
||||
INSERT INTO t1 (dt, st, uid, id2nd, filler) VALUES
|
||||
('1991-03-14', 'Initial Insert', 200, 1234567, 'No Data'),
|
||||
('1991-02-26', 'Initial Insert', 201, 1234567, 'No Data'),
|
||||
('1992-03-16', 'Initial Insert', 234, 1234567, 'No Data'),
|
||||
('1992-07-02', 'Initial Insert', 287, 1234567, 'No Data'),
|
||||
('1991-05-26', 'Initial Insert', 256, 1234567, 'No Data'),
|
||||
('1991-04-25', 'Initial Insert', 222, 1234567, 'No Data'),
|
||||
('1993-03-12', 'Initial Insert', 267, 1234567, 'No Data'),
|
||||
('1993-03-14', 'Initial Insert', 291, 1234567, 'No Data'),
|
||||
('1991-12-20', 'Initial Insert', 298, 1234567, 'No Data'),
|
||||
('1994-10-31', 'Initial Insert', 220, 1234567, 'No Data');
|
||||
ALTER TABLE t1 PARTITION BY LIST (YEAR(dt)) (
|
||||
PARTITION d1 VALUES IN (1991, 1994),
|
||||
PARTITION d2 VALUES IN (1993),
|
||||
PARTITION d3 VALUES IN (1992, 1995, 1996)
|
||||
);
|
||||
INSERT INTO t1 (dt, st, uid, id2nd, filler) VALUES
|
||||
('1991-07-14', 'After Partitioning Insert', 299, 1234567, 'Insert row');
|
||||
UPDATE t1 SET filler='Updating the row' WHERE uid=298;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#59297: Can't find record in 'tablename' on update inner join
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Tests of syncronization of stored procedure execution.
|
||||
Tests of synchronization of stored procedure execution.
|
||||
#
|
||||
# Bug#48157: crash in Item_field::used_tables
|
||||
#
|
||||
|
@ -20,4 +20,16 @@ SET DEBUG_SYNC = 'now SIGNAL go';
|
|||
# code, this test statement will hang.
|
||||
DROP TABLE t1, t2;
|
||||
DROP PROCEDURE p1;
|
||||
#
|
||||
# test for bug#11756013
|
||||
#
|
||||
DROP SCHEMA IF EXISTS s1;
|
||||
CREATE SCHEMA s1;
|
||||
CREATE PROCEDURE s1.p1() BEGIN END;
|
||||
SET DEBUG_SYNC='before_db_dir_check SIGNAL check_db WAIT_FOR dropped_schema';
|
||||
CALL s1.p1;
|
||||
SET DEBUG_SYNC='now WAIT_FOR check_db';
|
||||
DROP SCHEMA s1;
|
||||
SET DEBUG_SYNC='now SIGNAL dropped_schema';
|
||||
ERROR 42000: Unknown database 's1'
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
|
|
|
@ -43,3 +43,101 @@ DROP TABLE t2;
|
|||
DROP USER mysqltest_dfn@localhost;
|
||||
DROP USER mysqltest_inv@localhost;
|
||||
DROP DATABASE mysqltest_db1;
|
||||
USE test;
|
||||
#
|
||||
# Bug#45235: 5.1 does not support 5.0-only syntax triggers in any way
|
||||
#
|
||||
DROP TABLE IF EXISTS t1, t2, t3;
|
||||
CREATE TABLE t1 ( a INT );
|
||||
CREATE TABLE t2 ( a INT );
|
||||
CREATE TABLE t3 ( a INT );
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
INSERT INTO t2 VALUES (1), (2), (3);
|
||||
INSERT INTO t3 VALUES (1), (2), (3);
|
||||
# We simulate importing a trigger from 5.0 by writing a .TRN file for
|
||||
# each trigger plus a .TRG file the way MySQL 5.0 would have done it,
|
||||
# with syntax allowed in 5.0 only.
|
||||
#
|
||||
# Note that in 5.0 the following lines are missing from t1.TRG:
|
||||
#
|
||||
# client_cs_names='latin1'
|
||||
# connection_cl_names='latin1_swedish_ci'
|
||||
# db_cl_names='latin1_swedish_ci'
|
||||
# We will get parse errors for most DDL and DML statements when the table
|
||||
# has broken triggers. The parse error refers to the first broken
|
||||
# trigger.
|
||||
CREATE TRIGGER tr16 AFTER UPDATE ON t1 FOR EACH ROW INSERT INTO t1 VALUES (1);
|
||||
ERROR 42000: Trigger 'tr13' has an error in its body: '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 'a USING t1 a' at line 1'
|
||||
CREATE TRIGGER tr22 BEFORE INSERT ON t2 FOR EACH ROW DELETE FROM non_existing_table;
|
||||
ERROR 42000: Unknown trigger has an error in its body: '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 'Not allowed syntax here, and trigger name cant be extracted either.' at line 1'
|
||||
SHOW TRIGGERS;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
||||
tr11 INSERT t1 DELETE FROM t3 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
tr12 INSERT t1 DELETE FROM t3 AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
tr14 DELETE t1 DELETE FROM non_existing_table AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
Warnings:
|
||||
Warning 1603 Triggers for table `test`.`t1` have no creation context
|
||||
Warning 1603 Triggers for table `test`.`t2` have no creation context
|
||||
INSERT INTO t1 VALUES (1);
|
||||
ERROR 42000: Trigger 'tr13' has an error in its body: '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 'a USING t1 a' at line 1'
|
||||
INSERT INTO t2 VALUES (1);
|
||||
ERROR 42000: Unknown trigger has an error in its body: '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 'Not allowed syntax here, and trigger name cant be extracted either.' at line 1'
|
||||
DELETE FROM t1;
|
||||
ERROR 42000: Trigger 'tr13' has an error in its body: '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 'a USING t1 a' at line 1'
|
||||
UPDATE t1 SET a = 1 WHERE a = 1;
|
||||
ERROR 42000: Trigger 'tr13' has an error in its body: '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 'a USING t1 a' at line 1'
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
RENAME TABLE t1 TO t1_2;
|
||||
ERROR 42000: Trigger 'tr13' has an error in its body: '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 'a USING t1 a' at line 1'
|
||||
SHOW TRIGGERS;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
||||
tr11 INSERT t1 DELETE FROM t3 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
tr12 INSERT t1 DELETE FROM t3 AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
tr14 DELETE t1 DELETE FROM non_existing_table AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
Warnings:
|
||||
Warning 1603 Triggers for table `test`.`t1` have no creation context
|
||||
DROP TRIGGER tr11;
|
||||
Warnings:
|
||||
Warning 1603 Triggers for table `test`.`t1` have no creation context
|
||||
DROP TRIGGER tr12;
|
||||
DROP TRIGGER tr13;
|
||||
DROP TRIGGER tr14;
|
||||
DROP TRIGGER tr15;
|
||||
SHOW TRIGGERS;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
||||
# Make sure there is no trigger file left.
|
||||
# We write the same trigger files one more time to test DROP TABLE.
|
||||
DROP TABLE t1;
|
||||
Warnings:
|
||||
Warning 1603 Triggers for table `test`.`t1` have no creation context
|
||||
DROP TABLE t2;
|
||||
Warnings:
|
||||
Warning 1603 Triggers for table `test`.`t2` have no creation context
|
||||
DROP TABLE t3;
|
||||
# Make sure there is no trigger file left.
|
||||
CREATE TABLE t1 ( a INT );
|
||||
CREATE TABLE t2 ( a INT );
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
INSERT INTO t2 VALUES (1), (2), (3);
|
||||
# We write three trigger files. First trigger is syntaxically incorrect, next trigger is correct
|
||||
# and last trigger is broken.
|
||||
# Next we try to execute SHOW CREATE TRGGIR command for broken trigger and then try to drop one.
|
||||
FLUSH TABLE t1;
|
||||
SHOW CREATE TRIGGER tr12;
|
||||
Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
|
||||
tr12 CREATE DEFINER=`root`@`localhost` TRIGGER tr12 BEFORE INSERT ON t1 FOR EACH ROW DELETE FROM t2 latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
Warnings:
|
||||
Warning 1603 Triggers for table `test`.`t1` have no creation context
|
||||
SHOW CREATE TRIGGER tr11;
|
||||
Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
|
||||
tr11 CREATE DEFINER=`root`@`localhost` TRIGGER tr11 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
DROP TRIGGER tr12;
|
||||
Warnings:
|
||||
Warning 1603 Triggers for table `test`.`t1` have no creation context
|
||||
DROP TRIGGER tr11;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
|
|
|
@ -2134,10 +2134,8 @@ CREATE TRIGGER trg1 BEFORE INSERT ON t2 FOR EACH ROW INSERT/*!INTO*/t1 VALUES (1
|
|||
# Used to crash
|
||||
SHOW TRIGGERS IN db1;
|
||||
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
|
||||
Warnings:
|
||||
Warning 1064 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 'VALUES (1)' at line 1
|
||||
INSERT INTO t2 VALUES (1);
|
||||
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 'VALUES (1)' at line 1
|
||||
ERROR 42000: Trigger 'trg1' has an error in its body: '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 'VALUES (1)' at line 1'
|
||||
SELECT * FROM t1;
|
||||
b
|
||||
# Work around Bug#45235
|
||||
|
|
1
mysql-test/suite/binlog/r/binlog_reset_master.result
Normal file
1
mysql-test/suite/binlog/r/binlog_reset_master.result
Normal file
|
@ -0,0 +1 @@
|
|||
RESET MASTER;
|
26
mysql-test/suite/binlog/t/binlog_reset_master.test
Normal file
26
mysql-test/suite/binlog/t/binlog_reset_master.test
Normal file
|
@ -0,0 +1,26 @@
|
|||
# ==== Purpose ====
|
||||
#
|
||||
# Test bugs in RESET MASTER.
|
||||
|
||||
--source include/have_debug.inc
|
||||
--source include/have_log_bin.inc
|
||||
|
||||
#######################################################################
|
||||
# BUG#12574820: binlog.binlog_tmp_table timing out in daily and weekly trunk run
|
||||
# Problem: MYSQL_BIN_LOG::reset_logs acquired LOCK_thread_count and
|
||||
# LOCK_log in the wrong order. This could cause a deadlock when
|
||||
# RESET MASTER was run concurrently with a disconnecting thread.
|
||||
#######################################################################
|
||||
|
||||
# We use sleep, not debug_sync, because the sync point needs to be in
|
||||
# the thread shut down code after the debug sync facility has been
|
||||
# shut down.
|
||||
--let $write_var= SET DEBUG="+d,sleep_after_lock_thread_count_before_delete_thd"; CREATE TEMPORARY TABLE test.t1 (a INT);
|
||||
--let $write_to_file= GENERATE
|
||||
--disable_query_log
|
||||
--source include/write_var_to_file.inc
|
||||
--enable_query_log
|
||||
|
||||
--exec $MYSQL < $write_to_file
|
||||
RESET MASTER;
|
||||
--remove_file $write_to_file
|
|
@ -9,5 +9,5 @@
|
|||
# Do not use any TAB characters for whitespace.
|
||||
#
|
||||
##############################################################################
|
||||
binlog_truncate_innodb : BUG#57291 2010-10-20 anitha Originally disabled due to BUG#42643. Product bug fixed, but test changes needed
|
||||
binlog_row_failure_mixing_engines : BUG#58416 2010-11-23 ramil Fails on win x86 debug_max
|
||||
binlog_truncate_innodb : BUG#11764459 2010-10-20 anitha Originally disabled due to BUG#42643. Product bug fixed, but test changes needed
|
||||
binlog_row_failure_mixing_engines : BUG#11765446 2010-11-23 ramil Fails on win x86 debug_max
|
||||
|
|
|
@ -9,4 +9,4 @@
|
|||
# Do not use any TAB characters for whitespace.
|
||||
#
|
||||
##############################################################################
|
||||
federated_transactions : Bug#29523 Transactions do not work
|
||||
federated_transactions : Bug#11746899 Transactions do not work
|
||||
|
|
|
@ -10,4 +10,4 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
ndb_trig_1011ext: Bug#32656 NDB: Duplicate key error aborts transaction in handler. Doesn't talk back to SQL
|
||||
ndb_trig_1011ext: Bug#11747493 NDB: Duplicate key error aborts transaction in handler. Doesn't talk back to SQL
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Disabled by hhunger (2008-03-03) due to WL4204
|
||||
innodb_charset : Bug#20447 Problem with prefix keys with contractions and expansions
|
||||
myisam_charset : Bug#20447 Problem with prefix keys with contractions and expansions
|
||||
memory_charset : Bug#20447 Problem with prefix keys with contractions and expansions
|
||||
ndb_charset : Bug#20447 Problem with prefix keys with contractions and expansions
|
||||
innodb_charset : Bug#11745840 Problem with prefix keys with contractions and expansions
|
||||
myisam_charset : Bug#11745840 Problem with prefix keys with contractions and expansions
|
||||
memory_charset : Bug#11745840 Problem with prefix keys with contractions and expansions
|
||||
ndb_charset : Bug#11745840 Problem with prefix keys with contractions and expansions
|
||||
|
||||
|
|
|
@ -2639,7 +2639,6 @@ COUNT(*)
|
|||
1537
|
||||
SET SESSION sort_buffer_size = DEFAULT;
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
#
|
||||
# Test for bug #39932 "create table fails if column for FK is in different
|
||||
# case than in corr index".
|
||||
|
@ -2668,3 +2667,20 @@ DROP TABLE IF EXISTS t1, t2;
|
|||
CREATE TABLE t1 (a INT, INDEX(a)) engine=innodb;
|
||||
ALTER TABLE t1 RENAME TO t2, DISABLE KEYS;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
#
|
||||
# Test for bug #11762012 - "54553: INNODB ASSERTS IN HA_INNOBASE::
|
||||
# UPDATE_ROW, TEMPORARY TABLE, TABLE LOCK".
|
||||
#
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TEMPORARY TABLE t1 (c int) ENGINE = InnoDB;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
LOCK TABLES t1 READ;
|
||||
# Even though temporary table was locked for READ we
|
||||
# still allow writes to it to be compatible with MyISAM.
|
||||
# This is possible since due to fact that temporary tables
|
||||
# are specific to connection and therefore locking for them
|
||||
# is irrelevant.
|
||||
UPDATE t1 SET c = 5;
|
||||
UNLOCK TABLES;
|
||||
DROP TEMPORARY TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
|
|
@ -868,9 +868,6 @@ SET SESSION sort_buffer_size = DEFAULT;
|
|||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Test for bug #39932 "create table fails if column for FK is in different
|
||||
--echo # case than in corr index".
|
||||
|
@ -900,3 +897,25 @@ CREATE TABLE t1 (a INT, INDEX(a)) engine=innodb;
|
|||
ALTER TABLE t1 RENAME TO t2, DISABLE KEYS;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
--enable_warnings
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Test for bug #11762012 - "54553: INNODB ASSERTS IN HA_INNOBASE::
|
||||
--echo # UPDATE_ROW, TEMPORARY TABLE, TABLE LOCK".
|
||||
--echo #
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
CREATE TEMPORARY TABLE t1 (c int) ENGINE = InnoDB;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
LOCK TABLES t1 READ;
|
||||
--echo # Even though temporary table was locked for READ we
|
||||
--echo # still allow writes to it to be compatible with MyISAM.
|
||||
--echo # This is possible since due to fact that temporary tables
|
||||
--echo # are specific to connection and therefore locking for them
|
||||
--echo # is irrelevant.
|
||||
UPDATE t1 SET c = 5;
|
||||
UNLOCK TABLES;
|
||||
DROP TEMPORARY TABLE t1;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
|
|
@ -2438,4 +2438,20 @@ COUNT(*)
|
|||
1537
|
||||
SET SESSION sort_buffer_size = DEFAULT;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Test for bug #11762012 - "54553: INNODB ASSERTS IN HA_INNOBASE::
|
||||
# UPDATE_ROW, TEMPORARY TABLE, TABLE LOCK".
|
||||
#
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TEMPORARY TABLE t1 (c int) ENGINE = InnoDB;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
LOCK TABLES t1 READ;
|
||||
# Even though temporary table was locked for READ we
|
||||
# still allow writes to it to be compatible with MyISAM.
|
||||
# This is possible since due to fact that temporary tables
|
||||
# are specific to connection and therefore locking for them
|
||||
# is irrelevant.
|
||||
UPDATE t1 SET c = 5;
|
||||
UNLOCK TABLES;
|
||||
DROP TEMPORARY TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
|
|
@ -689,4 +689,24 @@ SET SESSION sort_buffer_size = DEFAULT;
|
|||
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Test for bug #11762012 - "54553: INNODB ASSERTS IN HA_INNOBASE::
|
||||
--echo # UPDATE_ROW, TEMPORARY TABLE, TABLE LOCK".
|
||||
--echo #
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
CREATE TEMPORARY TABLE t1 (c int) ENGINE = InnoDB;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
LOCK TABLES t1 READ;
|
||||
--echo # Even though temporary table was locked for READ we
|
||||
--echo # still allow writes to it to be compatible with MyISAM.
|
||||
--echo # This is possible since due to fact that temporary tables
|
||||
--echo # are specific to connection and therefore locking for them
|
||||
--echo # is irrelevant.
|
||||
UPDATE t1 SET c = 5;
|
||||
UNLOCK TABLES;
|
||||
DROP TEMPORARY TABLE t1;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
|
|
@ -10,6 +10,6 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
ndb_partition_error2 : Bug#40989 ndb_partition_error2 needs maintenance
|
||||
ndb_partition_error2 : Bug#11750448 ndb_partition_error2 needs maintenance
|
||||
|
||||
# the below testcase have been reworked to avoid the bug, test contains comment, keep bug open
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
# Do not use any TAB characters for whitespace.
|
||||
#
|
||||
##############################################################################
|
||||
ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
|
||||
ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
|
||||
ndb_autodiscover : BUG#11745709 2006-02-16 jmiller Needs to be fixed w.r.t binlog
|
||||
ndb_autodiscover2 : BUG#11745709 2006-02-16 jmiller Needs to be fixed w.r.t binlog
|
||||
|
||||
# the below testcase have been reworked to avoid the bug, test contains comment, keep bug open
|
||||
#ndb_autodiscover3 : bug#21806
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
partition_basic_ndb : Bug#19899 Crashing the server
|
||||
partition_basic_ndb : Bug#11745782 Crashing the server
|
||||
# http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-limitations-syntax.html
|
||||
partition_syntax_ndb : Bug#36735 Not supported
|
||||
partition_syntax_ndb : Bug#11748568 Not supported
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
include/master-slave.inc
|
||||
[connection master]
|
||||
stop slave;
|
||||
include/stop_slave.inc
|
||||
create table t1 (a int);
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
|
@ -8,10 +8,8 @@ drop table t1;
|
|||
reset slave;
|
||||
start slave io_thread;
|
||||
include/wait_for_slave_param.inc [Slave_IO_State]
|
||||
stop slave io_thread;
|
||||
include/stop_slave_io.inc
|
||||
reset slave;
|
||||
start slave;
|
||||
select master_pos_wait('master-bin.001',200,6)=-1;
|
||||
master_pos_wait('master-bin.001',200,6)=-1
|
||||
0
|
||||
include/start_slave.inc
|
||||
include/assert.inc [Assert that master_pos_wait does not timeout nor it returns NULL]
|
||||
include/rpl_end.inc
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
rpl_row_create_table : Bug#51574 Feb 27 2010 andrei failed different way than earlier with bug#45576
|
||||
rpl_get_master_version_and_clock : Bug#59178 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock
|
||||
rpl_row_create_table : Bug#11759274 Feb 27 2010 andrei failed different way than earlier with bug#45576
|
||||
rpl_get_master_version_and_clock : Bug#11766137 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock
|
||||
rpl_row_until : BUG#59543 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out
|
||||
rpl_stm_until : BUG#59543 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
# to force the deadlock after one event.
|
||||
|
||||
source include/master-slave.inc;
|
||||
--let $master_log_file= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
connection slave;
|
||||
stop slave;
|
||||
--source include/stop_slave.inc
|
||||
connection master;
|
||||
# This will generate a master's binlog > 10 bytes
|
||||
create table t1 (a int);
|
||||
|
@ -19,20 +20,33 @@ let $slave_param_value= Waiting for the slave SQL thread to free enough relay lo
|
|||
source include/wait_for_slave_param.inc;
|
||||
|
||||
# A bug caused the I/O thread to refuse stopping.
|
||||
stop slave io_thread;
|
||||
--source include/stop_slave_io.inc
|
||||
reset slave;
|
||||
start slave;
|
||||
# The I/O thread stops filling the relay log when
|
||||
# it's >10b. And the SQL thread cannot purge this relay log
|
||||
# as purge is done only when the SQL thread switches to another
|
||||
# relay log, which does not exist here.
|
||||
# So we should have a deadlock.
|
||||
# if it is not resolved automatically we'll detect
|
||||
# it with master_pos_wait that waits for farther than 1Ob;
|
||||
# it will timeout after 10 seconds;
|
||||
# also the slave will probably not cooperate to shutdown
|
||||
# (as 2 threads are locked)
|
||||
select master_pos_wait('master-bin.001',200,6)=-1;
|
||||
--source include/start_slave.inc
|
||||
|
||||
# The I/O thread stops filling the relay log when it's >10b. And the
|
||||
# SQL thread cannot purge this relay log as purge is done only when
|
||||
# the SQL thread switches to another relay log, which does not exist
|
||||
# here. So we should have a deadlock. If it is not resolved
|
||||
# automatically we'll detect it with master_pos_wait that waits for
|
||||
# farther than 1Ob; it will timeout after 300 seconds (which is inline
|
||||
# with the default used for sync_slave_with_master and will protect us
|
||||
# against slow test envs); also the slave will probably not cooperate
|
||||
# to shutdown (as 2 threads are locked)
|
||||
--let $outcome= `SELECT MASTER_POS_WAIT('$master_log_file',200,300) AS mpw;`
|
||||
|
||||
# master_pos_wait returns:
|
||||
#
|
||||
# * >= 0, the number of events the slave had to wait to advance to the
|
||||
# position
|
||||
#
|
||||
# * -1, if there was a timeout
|
||||
#
|
||||
# * NULL, if an error occurred, or the SQL thread was not started,
|
||||
# slave master info is not initialized, the arguments are incorrect
|
||||
--let $assert_text= Assert that master_pos_wait does not timeout nor it returns NULL
|
||||
--let $assert_cond= $outcome IS NOT NULL AND $outcome <> -1
|
||||
--source include/assert.inc
|
||||
|
||||
# End of 4.1 tests
|
||||
--source include/rpl_end.inc
|
||||
|
|
|
@ -11,4 +11,4 @@
|
|||
##############################################################################
|
||||
|
||||
# the below testcase have been reworked to avoid the bug, test contains comment, keep bug open
|
||||
rpl_ndb_2ndb : Bug#45974: rpl_ndb_2ndb fails sporadically
|
||||
rpl_ndb_2ndb : Bug#11754374 : rpl_ndb_2ndb fails sporadically
|
||||
|
|
|
@ -9,5 +9,5 @@
|
|||
# Do not use any TAB characters for whitespace.
|
||||
#
|
||||
##############################################################################
|
||||
sys_vars.max_binlog_cache_size_basic_64 : bug#56408 2010-08-31 Horst
|
||||
sys_vars.max_binlog_cache_size_basic_32 : bug#56408 2010-08-31 Horst
|
||||
sys_vars.max_binlog_cache_size_basic_64 : bug#11763668 2010-08-31 Horst
|
||||
sys_vars.max_binlog_cache_size_basic_32 : bug#11763668 2010-08-31 Horst
|
||||
|
|
|
@ -1073,4 +1073,31 @@ ALTER TABLE t1 DROP COLUMN a, ADD COLUMN c TEXT FIRST;
|
|||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Test for bug #12652385 - "61493: REORDERING COLUMNS TO POSITION
|
||||
--echo # FIRST CAN CAUSE DATA TO BE CORRUPTED".
|
||||
--echo #
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
--echo # Use MyISAM engine as the fact that InnoDB doesn't support
|
||||
--echo # in-place ALTER TABLE in cases when columns are being renamed
|
||||
--echo # hides some bugs.
|
||||
create table t1 (i int, j int) engine=myisam;
|
||||
insert into t1 value (1, 2);
|
||||
--echo # First, test for original problem described in the bug report.
|
||||
select * from t1;
|
||||
--echo # Change of column order by the below ALTER TABLE statement should
|
||||
--echo # affect both column names and column contents.
|
||||
alter table t1 modify column j int first;
|
||||
select * from t1;
|
||||
--echo # Now test for similar problem with the same root.
|
||||
--echo # The below ALTER TABLE should change not only the name but
|
||||
--echo # also the value for the last column of the table.
|
||||
alter table t1 drop column i, add column k int default 0;
|
||||
select * from t1;
|
||||
--echo # Clean-up.
|
||||
drop table t1;
|
||||
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
|
13
mysql-test/t/archive_debug.test
Normal file
13
mysql-test/t/archive_debug.test
Normal file
|
@ -0,0 +1,13 @@
|
|||
--source include/have_archive.inc
|
||||
--source include/have_debug.inc
|
||||
|
||||
--echo #
|
||||
--echo # BUG#12402794 - 60976: CRASH, VALGRIND WARNING AND MEMORY LEAK
|
||||
--echo # WITH PARTITIONED ARCHIVE TABLES
|
||||
--echo #
|
||||
CREATE TABLE t1(a INT) ENGINE=ARCHIVE;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
SET SESSION debug='d,simulate_archive_open_failure';
|
||||
CHECK TABLE t1;
|
||||
SET SESSION debug=DEFAULT;
|
||||
DROP TABLE t1;
|
|
@ -9,7 +9,7 @@
|
|||
# Do not use any TAB characters for whitespace.
|
||||
#
|
||||
##############################################################################
|
||||
kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild.
|
||||
query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
|
||||
log_tables-big : Bug#48646 2010-11-15 mattiasj report already exists
|
||||
read_many_rows_innodb : Bug#37635 2010-11-15 mattiasj report already exists
|
||||
kill : Bug#11748945 2008-12-03 HHunger need some changes to be robust enough for pushbuild.
|
||||
read_many_rows_innodb : Bug#11748886 2010-11-15 mattiasj report already exists
|
||||
main.log_tables-big : Bug#11756699 2010-11-15 mattiasj report already exists
|
||||
|
||||
|
|
|
@ -857,6 +857,7 @@ DROP EVENT e2;
|
|||
DROP EVENT e1;
|
||||
|
||||
SET TIME_ZONE=@save_time_zone;
|
||||
SET TIMESTAMP=DEFAULT;
|
||||
|
||||
#
|
||||
# START - BUG#28666 CREATE EVENT ... EVERY 0 SECOND let server crash
|
||||
|
@ -1235,7 +1236,73 @@ SHOW EVENTS;
|
|||
DROP DATABASE event_test1;
|
||||
DROP DATABASE event_test12;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#12546938 (formerly known as bug#61005):
|
||||
--echo # CREATE IF NOT EXIST EVENT WILL CREATE MULTIPLE RUNNING EVENTS
|
||||
--echo #
|
||||
USE events_test;
|
||||
SET GLOBAL event_scheduler = ON;
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS table_bug12546938;
|
||||
DROP EVENT IF EXISTS event_Bug12546938;
|
||||
--enable_warnings
|
||||
CREATE TABLE table_bug12546938 (i INT);
|
||||
|
||||
delimiter |;
|
||||
|
||||
--echo # Create an event which will be executed with a small delay
|
||||
--echo # and won't be automatically dropped after that.
|
||||
CREATE EVENT event_Bug12546938
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND ON COMPLETION PRESERVE
|
||||
ENABLE DO
|
||||
BEGIN
|
||||
INSERT INTO table_bug12546938 VALUES(1);
|
||||
END
|
||||
|
|
||||
|
||||
--echo # Now try to create the same event using CREATE EVENT IF NOT EXISTS.
|
||||
--echo # A warning should be emitted. A new event should not be created nor
|
||||
--echo # the old event should be re-executed.
|
||||
CREATE EVENT IF NOT EXISTS event_bug12546938
|
||||
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND ON COMPLETION PRESERVE
|
||||
ENABLE DO
|
||||
BEGIN
|
||||
INSERT INTO table_bug12546938 VALUES (1);
|
||||
END
|
||||
|
|
||||
|
||||
delimiter ;|
|
||||
|
||||
--echo # Wait until at least one instance of event is executed.
|
||||
let $wait_condition= SELECT COUNT(*) FROM table_bug12546938;
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--echo # Check that only one instance of our event was executed.
|
||||
SELECT COUNT(*) FROM table_bug12546938;
|
||||
|
||||
--echo # Clean-up.
|
||||
DROP EVENT IF EXISTS event_Bug12546938;
|
||||
DROP TABLE table_bug12546938;
|
||||
SET GLOBAL EVENT_SCHEDULER = OFF;
|
||||
|
||||
#
|
||||
# Bug#11764334 - 57156: ALTER EVENT CHANGES THE EVENT STATUS
|
||||
#
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS event_test11764334;
|
||||
--enable_warnings
|
||||
CREATE DATABASE event_test11764334;
|
||||
USE event_test11764334;
|
||||
CREATE EVENT ev1 ON SCHEDULE EVERY 3 SECOND DISABLE DO SELECT 1;
|
||||
--replace_column 9 # 10 #
|
||||
SHOW EVENTS IN event_test11764334 WHERE NAME='ev1';
|
||||
ALTER EVENT ev1 ON SCHEDULE EVERY 4 SECOND;
|
||||
--replace_column 9 # 10 #
|
||||
SHOW EVENTS IN event_test11764334 WHERE NAME='ev1';
|
||||
DROP EVENT ev1;
|
||||
DROP DATABASE event_test11764334;
|
||||
USE test;
|
||||
###########################################################################
|
||||
#
|
||||
# End of tests
|
||||
|
|
|
@ -349,4 +349,10 @@ DROP TABLE t1;
|
|||
|
||||
SELECT ROUND(LEAST(15, -4939092, 0.2704), STDDEV('a'));
|
||||
|
||||
--echo #
|
||||
--echo # Bug#12392636 ASSERTION FAILED: SCALE >= 0 && PRECISION > 0 && SCALE <= PRECISION
|
||||
--echo #
|
||||
|
||||
SELECT SUM(DISTINCT (TRUNCATE((.1), NULL)));
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
|
|
@ -921,4 +921,11 @@ SELECT DATE_FORMAT('0000-00-11', '%W');
|
|||
SELECT DATE_FORMAT('0000-00-11', '%a');
|
||||
SELECT DATE_FORMAT('0000-00-11', '%w');
|
||||
|
||||
--echo #
|
||||
--echo # Bug#12403504 AFTER FIX FOR #11889186 : ASSERTION FAILED: DELSUM+(INT) Y/4-TEMP > 0
|
||||
--echo #
|
||||
|
||||
SELECT MAKEDATE(11111111,1);
|
||||
SELECT WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1);
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
|
|
@ -928,3 +928,31 @@ DROP TABLE t1;
|
|||
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Bug #57323/11764487: myisam corruption with insert ignore
|
||||
--echo # and invalid spatial data
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1(a LINESTRING NOT NULL, b GEOMETRY NOT NULL,
|
||||
SPATIAL KEY(a), SPATIAL KEY(b)) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES(GEOMFROMTEXT("point (0 0)"), GEOMFROMTEXT("point (1 1)"));
|
||||
--error ER_CANT_CREATE_GEOMETRY_OBJECT
|
||||
INSERT IGNORE INTO t1 SET a=GEOMFROMTEXT("point (-6 0)"), b=GEOMFROMTEXT("error");
|
||||
--error ER_CANT_CREATE_GEOMETRY_OBJECT
|
||||
INSERT IGNORE INTO t1 SET a=GEOMFROMTEXT("point (-6 0)"), b=NULL;
|
||||
SELECT ASTEXT(a), ASTEXT(b) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(a INT NOT NULL, b GEOMETRY NOT NULL,
|
||||
KEY(a), SPATIAL KEY(b)) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES(0, GEOMFROMTEXT("point (1 1)"));
|
||||
--error ER_CANT_CREATE_GEOMETRY_OBJECT
|
||||
INSERT IGNORE INTO t1 SET a=0, b=GEOMFROMTEXT("error");
|
||||
--error ER_CANT_CREATE_GEOMETRY_OBJECT
|
||||
INSERT IGNORE INTO t1 SET a=1, b=NULL;
|
||||
SELECT a, ASTEXT(b) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
|
174
mysql-test/t/implicit_char_to_num_conversion.test
Normal file
174
mysql-test/t/implicit_char_to_num_conversion.test
Normal file
|
@ -0,0 +1,174 @@
|
|||
########### implicit_char_to_num_conversion.test #######################
|
||||
# #
|
||||
# This test aims at using string/char literal in comparison operators #
|
||||
# without explicit type-cast. This is a bug test for Bug#11766521 #
|
||||
# - Incorrect result is returned if string/char literal is used with #
|
||||
# comparision operator and bit data type column. Test is extended to #
|
||||
# include numeric data type comparison with string/char literal #
|
||||
# #
|
||||
# #
|
||||
# Creation: #
|
||||
# 2011-05-10 vfisrekar Implement this test as part of Bug#11766521 #
|
||||
# #
|
||||
########################################################################
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t5;
|
||||
--enable_warnings
|
||||
|
||||
let $default_engine = `select @@SESSION.storage_engine`;
|
||||
|
||||
# Bug#11766521 - BIT Datatype comparison in where clause return incorrect
|
||||
# result for '=' , '<=>' operators
|
||||
--replace_result $default_engine <default_engine>
|
||||
eval CREATE TABLE t5(c1 BIT(2) PRIMARY KEY) ENGINE = $default_engine;
|
||||
INSERT INTO t5 VALUES (0), (1), (2);
|
||||
SELECT HEX(c1) FROM t5 ORDER BY c1;
|
||||
# Enable Following two select after Bug#11766521 fix
|
||||
# SELECT HEX(c1) FROM t5 WHERE c1 = '1' ORDER BY c1;
|
||||
# SELECT HEX(c1) FROM t5 WHERE c1 <=> '1' ORDER BY c1;
|
||||
SELECT HEX(c1) FROM t5 WHERE c1 = b'1' ORDER BY c1;
|
||||
SELECT HEX(c1) FROM t5 WHERE c1 <=> b'1' ORDER BY c1;
|
||||
SELECT HEX(c1) FROM t5 WHERE c1 != b'1' ORDER BY c1;
|
||||
SELECT HEX(c1) FROM t5 WHERE c1 >= '1' ORDER BY c1;
|
||||
SELECT HEX(c1) FROM t5 WHERE c1 <= '1' ORDER BY c1;
|
||||
SELECT HEX(c1) FROM t5 WHERE c1 < '1' ORDER BY c1;
|
||||
SELECT HEX(c1) FROM t5 WHERE c1 > '0' ORDER BY c1;
|
||||
DROP TABLE t5;
|
||||
|
||||
# FLOAT Data-type
|
||||
--replace_result $default_engine <default_engine>
|
||||
eval CREATE TABLE t5(c1 FLOAT(5,2) PRIMARY KEY) ENGINE = $default_engine;
|
||||
INSERT INTO t5 VALUES (95.95), (-10.10), (1), (0);
|
||||
SELECT c1 FROM t5 ORDER BY c1;
|
||||
# Compare with string literal
|
||||
# Following two queries does not return result may be due to Bug#11766521.
|
||||
# Enable them after Bug#11766521 fix.
|
||||
# SELECT c1 FROM t5 WHERE c1 = '10.10' ORDER BY c1;
|
||||
# SELECT c1 FROM t5 WHERE c2 <=> '11.11' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 >= '95' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 <= '10.10' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 != '1' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 < '1' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 > '0' ORDER BY c1;
|
||||
DROP TABLE t5;
|
||||
|
||||
# TINYINT Datatype
|
||||
--replace_result $default_engine <default_engine>
|
||||
eval CREATE TABLE t5(c1 TINYINT PRIMARY KEY) ENGINE = $default_engine;
|
||||
INSERT INTO t5 VALUES (95), (10),(11),(-8);
|
||||
SELECT c1 FROM t5 ORDER BY c1;
|
||||
# Compare with string literal
|
||||
SELECT c1 FROM t5 WHERE c1 = '10' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 <=> '10' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 >= '95' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 <= '11' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 != '-8' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 < '11' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 > '10' ORDER BY c1;
|
||||
DROP TABLE t5;
|
||||
|
||||
# SMALLINT Datatype
|
||||
--replace_result $default_engine <default_engine>
|
||||
eval CREATE TABLE t5(c1 SMALLINT PRIMARY KEY) ENGINE = $default_engine;
|
||||
INSERT INTO t5 VALUES (395), (-200), (100), (111);
|
||||
SELECT c1 FROM t5 ORDER BY c1;
|
||||
# Compare with string literal
|
||||
SELECT c1 FROM t5 WHERE c1 = '100' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 <=> '100' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 >= '395' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 <= '-200' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 != '100' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 < '111' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 > '111' ORDER BY c1;
|
||||
DROP TABLE t5;
|
||||
|
||||
# MEDIUMINT Datatype
|
||||
--replace_result $default_engine <default_engine>
|
||||
eval CREATE TABLE t5(c1 MEDIUMINT PRIMARY KEY) ENGINE = $default_engine;
|
||||
INSERT INTO t5 VALUES (-8388607), (311),(215),(88608);
|
||||
SELECT c1 FROM t5 ORDER BY c1;
|
||||
# Compare with string literal
|
||||
SELECT c1 FROM t5 WHERE c1 = '311' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 <=> '311' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 >= '215' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 <= '88608' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 != '-8388607' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 < '215' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 > '215' ORDER BY c1;
|
||||
DROP TABLE t5;
|
||||
|
||||
# INT Datatype
|
||||
--replace_result $default_engine <default_engine>
|
||||
eval CREATE TABLE t5(c1 INT PRIMARY KEY) ENGINE = $default_engine;
|
||||
INSERT INTO t5 VALUES (-2147483647), (1011),(15),(9388607);
|
||||
SELECT c1 FROM t5 ORDER BY c1;
|
||||
# Compare with string literal
|
||||
SELECT c1 FROM t5 WHERE c1 = '9388607' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 <=> '9388607' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 >= '15' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 <= '1011' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 != '-2147483647' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 < '15' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 > '15' ORDER BY c1;
|
||||
DROP TABLE t5;
|
||||
|
||||
# BIGINT Data-type
|
||||
--replace_result $default_engine <default_engine>
|
||||
eval CREATE TABLE t5(c1 BIGINT PRIMARY KEY) ENGINE = $default_engine;
|
||||
INSERT INTO t5 VALUES (-9223372036854775807), (12011),(500),(3372036854775808);
|
||||
SELECT c1 FROM t5 ORDER BY c1;
|
||||
# Compare with string literal
|
||||
SELECT c1 FROM t5 WHERE c1 = '-9223372036854775807' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 <=> '-9223372036854775807' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 >= '12011' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 <= '500' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 != '3372036854775808' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 < '12011' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 > '12011' ORDER BY c1;
|
||||
DROP TABLE t5;
|
||||
|
||||
# DOUBLE Datatype
|
||||
--replace_result $default_engine <default_engine>
|
||||
eval CREATE TABLE t5(c1 DOUBLE(5,2) PRIMARY KEY) ENGINE = $default_engine;
|
||||
INSERT INTO t5 VALUES (95.95), (11.11),(5),(-908.92);
|
||||
SELECT c1 FROM t5 ORDER BY c1;
|
||||
# Compare with string literal
|
||||
SELECT c1 FROM t5 WHERE c1 = '11.11' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 <=> '11.11' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 >= '5' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 <= '95.95' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 != '-908.92' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 < '95.95' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 > '-908.92' ORDER BY c1;
|
||||
DROP TABLE t5;
|
||||
|
||||
# NUMERIC Datatype
|
||||
--replace_result $default_engine <default_engine>
|
||||
eval CREATE TABLE t5(c1 NUMERIC(5,2) PRIMARY KEY) ENGINE = $default_engine;
|
||||
INSERT INTO t5 VALUES (95.95), (11.11),(5),(-908.92);
|
||||
SELECT c1 FROM t5 ORDER BY c1;
|
||||
# Compare with string literal
|
||||
SELECT c1 FROM t5 WHERE c1 = '11.11' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 <=> '11.11' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 >= '5' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 <= '95.95' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 != '-908.92' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 < '95.95' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 > '-908.92' ORDER BY c1;
|
||||
DROP TABLE t5;
|
||||
|
||||
# DECIMAL Datatype
|
||||
--replace_result $default_engine <default_engine>
|
||||
eval CREATE TABLE t5(c1 DECIMAL(5,2) PRIMARY KEY) ENGINE = $default_engine;
|
||||
INSERT INTO t5 VALUES (95.95), (11.11),(5),(-908.92);
|
||||
SELECT c1 FROM t5 ORDER BY c1;
|
||||
# Compare with string literal
|
||||
SELECT c1 FROM t5 WHERE c1 = '11.11' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 <=> '11.11' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 >= '5' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 <= '95.95' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 != '-908.92' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 < '95.95' ORDER BY c1;
|
||||
SELECT c1 FROM t5 WHERE c1 > '-908.92' ORDER BY c1;
|
||||
DROP TABLE t5;
|
|
@ -14,6 +14,37 @@
|
|||
drop table if exists t1, t2;
|
||||
--enable_warnings
|
||||
|
||||
--echo #
|
||||
--echo # Bug#11765667: bug#58655: ASSERTION FAILED,
|
||||
--echo # SERVER CRASHES WITH MYSQLD GOT SIGNAL 6
|
||||
--echo #
|
||||
CREATE TABLE t1 (
|
||||
id MEDIUMINT NOT NULL AUTO_INCREMENT,
|
||||
dt DATE, st VARCHAR(255), uid INT,
|
||||
id2nd LONGBLOB, filler VARCHAR(255), PRIMARY KEY(id, dt)
|
||||
);
|
||||
INSERT INTO t1 (dt, st, uid, id2nd, filler) VALUES
|
||||
('1991-03-14', 'Initial Insert', 200, 1234567, 'No Data'),
|
||||
('1991-02-26', 'Initial Insert', 201, 1234567, 'No Data'),
|
||||
('1992-03-16', 'Initial Insert', 234, 1234567, 'No Data'),
|
||||
('1992-07-02', 'Initial Insert', 287, 1234567, 'No Data'),
|
||||
('1991-05-26', 'Initial Insert', 256, 1234567, 'No Data'),
|
||||
('1991-04-25', 'Initial Insert', 222, 1234567, 'No Data'),
|
||||
('1993-03-12', 'Initial Insert', 267, 1234567, 'No Data'),
|
||||
('1993-03-14', 'Initial Insert', 291, 1234567, 'No Data'),
|
||||
('1991-12-20', 'Initial Insert', 298, 1234567, 'No Data'),
|
||||
('1994-10-31', 'Initial Insert', 220, 1234567, 'No Data');
|
||||
ALTER TABLE t1 PARTITION BY LIST (YEAR(dt)) (
|
||||
PARTITION d1 VALUES IN (1991, 1994),
|
||||
PARTITION d2 VALUES IN (1993),
|
||||
PARTITION d3 VALUES IN (1992, 1995, 1996)
|
||||
);
|
||||
INSERT INTO t1 (dt, st, uid, id2nd, filler) VALUES
|
||||
('1991-07-14', 'After Partitioning Insert', 299, 1234567, 'Insert row');
|
||||
UPDATE t1 SET filler='Updating the row' WHERE uid=298;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#59297: Can't find record in 'tablename' on update inner join
|
||||
--echo #
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
# This test should work in embedded server after mysqltest is fixed
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--echo Tests of syncronization of stored procedure execution.
|
||||
# Save the initial number of concurrent sessions
|
||||
--source include/count_sessions.inc
|
||||
|
||||
--echo Tests of synchronization of stored procedure execution.
|
||||
|
||||
--source include/have_debug_sync.inc
|
||||
|
||||
|
@ -54,5 +57,31 @@ connection default;
|
|||
DROP TABLE t1, t2;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
--echo #
|
||||
--echo # test for bug#11756013
|
||||
--echo #
|
||||
--disable_warnings
|
||||
DROP SCHEMA IF EXISTS s1;
|
||||
--enable_warnings
|
||||
CREATE SCHEMA s1;
|
||||
CREATE PROCEDURE s1.p1() BEGIN END;
|
||||
|
||||
connect (con3, localhost, root);
|
||||
SET DEBUG_SYNC='before_db_dir_check SIGNAL check_db WAIT_FOR dropped_schema';
|
||||
--send CALL s1.p1
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC='now WAIT_FOR check_db';
|
||||
DROP SCHEMA s1;
|
||||
SET DEBUG_SYNC='now SIGNAL dropped_schema';
|
||||
|
||||
connection con3;
|
||||
--error ER_BAD_DB_ERROR
|
||||
--reap
|
||||
connection default;
|
||||
disconnect con3;
|
||||
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
|
||||
# Wait till we reached the initial number of concurrent sessions
|
||||
--source include/wait_until_count_sessions.inc
|
||||
|
|
|
@ -106,4 +106,178 @@ DROP TABLE t2;
|
|||
DROP USER mysqltest_dfn@localhost;
|
||||
DROP USER mysqltest_inv@localhost;
|
||||
DROP DATABASE mysqltest_db1;
|
||||
USE test;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Bug#45235: 5.1 does not support 5.0-only syntax triggers in any way
|
||||
--echo #
|
||||
let $MYSQLD_DATADIR=`SELECT @@datadir`;
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1, t2, t3;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 ( a INT );
|
||||
CREATE TABLE t2 ( a INT );
|
||||
CREATE TABLE t3 ( a INT );
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
INSERT INTO t2 VALUES (1), (2), (3);
|
||||
INSERT INTO t3 VALUES (1), (2), (3);
|
||||
|
||||
--echo # We simulate importing a trigger from 5.0 by writing a .TRN file for
|
||||
--echo # each trigger plus a .TRG file the way MySQL 5.0 would have done it,
|
||||
--echo # with syntax allowed in 5.0 only.
|
||||
--echo #
|
||||
--echo # Note that in 5.0 the following lines are missing from t1.TRG:
|
||||
--echo #
|
||||
--echo # client_cs_names='latin1'
|
||||
--echo # connection_cl_names='latin1_swedish_ci'
|
||||
--echo # db_cl_names='latin1_swedish_ci'
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/tr11.TRN
|
||||
TYPE=TRIGGERNAME
|
||||
trigger_table=t1
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/tr12.TRN
|
||||
TYPE=TRIGGERNAME
|
||||
trigger_table=t1
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/tr13.TRN
|
||||
TYPE=TRIGGERNAME
|
||||
trigger_table=t1
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/tr14.TRN
|
||||
TYPE=TRIGGERNAME
|
||||
trigger_table=t1
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/tr15.TRN
|
||||
TYPE=TRIGGERNAME
|
||||
trigger_table=t1
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/t1.TRG
|
||||
TYPE=TRIGGERS
|
||||
triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr11 BEFORE INSERT ON t1 FOR EACH ROW DELETE FROM t3' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr12 AFTER INSERT ON t1 FOR EACH ROW DELETE FROM t3' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr13 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr14 AFTER DELETE ON t1 FOR EACH ROW DELETE FROM non_existing_table' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr15 BEFORE UPDATE ON t1 FOR EACH ROW DELETE FROM non_existing_table a USING non_existing_table a'
|
||||
sql_modes=0 0 0 0 0
|
||||
definers='root@localhost' 'root@localhost' 'root@localhost' 'root@localhost' 'root@localhost'
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/t2.TRG
|
||||
TYPE=TRIGGERS
|
||||
triggers='Not allowed syntax here, and trigger name cant be extracted either.'
|
||||
sql_modes=0
|
||||
definers='root@localhost'
|
||||
EOF
|
||||
|
||||
--echo # We will get parse errors for most DDL and DML statements when the table
|
||||
--echo # has broken triggers. The parse error refers to the first broken
|
||||
--echo # trigger.
|
||||
--error ER_PARSE_ERROR
|
||||
CREATE TRIGGER tr16 AFTER UPDATE ON t1 FOR EACH ROW INSERT INTO t1 VALUES (1);
|
||||
--error ER_PARSE_ERROR
|
||||
CREATE TRIGGER tr22 BEFORE INSERT ON t2 FOR EACH ROW DELETE FROM non_existing_table;
|
||||
SHOW TRIGGERS;
|
||||
--error ER_PARSE_ERROR
|
||||
INSERT INTO t1 VALUES (1);
|
||||
--error ER_PARSE_ERROR
|
||||
INSERT INTO t2 VALUES (1);
|
||||
--error ER_PARSE_ERROR
|
||||
DELETE FROM t1;
|
||||
--error ER_PARSE_ERROR
|
||||
UPDATE t1 SET a = 1 WHERE a = 1;
|
||||
SELECT * FROM t1;
|
||||
--error ER_PARSE_ERROR
|
||||
RENAME TABLE t1 TO t1_2;
|
||||
SHOW TRIGGERS;
|
||||
|
||||
DROP TRIGGER tr11;
|
||||
DROP TRIGGER tr12;
|
||||
DROP TRIGGER tr13;
|
||||
DROP TRIGGER tr14;
|
||||
DROP TRIGGER tr15;
|
||||
|
||||
SHOW TRIGGERS;
|
||||
|
||||
--echo # Make sure there is no trigger file left.
|
||||
--list_files $MYSQLD_DATADIR/test/ tr*
|
||||
|
||||
--echo # We write the same trigger files one more time to test DROP TABLE.
|
||||
--write_file $MYSQLD_DATADIR/test/tr11.TRN
|
||||
TYPE=TRIGGERNAME
|
||||
trigger_table=t1
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/tr12.TRN
|
||||
TYPE=TRIGGERNAME
|
||||
trigger_table=t1
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/tr13.TRN
|
||||
TYPE=TRIGGERNAME
|
||||
trigger_table=t1
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/tr14.TRN
|
||||
TYPE=TRIGGERNAME
|
||||
trigger_table=t1
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/tr15.TRN
|
||||
TYPE=TRIGGERNAME
|
||||
trigger_table=t1
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/t1.TRG
|
||||
TYPE=TRIGGERS
|
||||
triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr11 BEFORE INSERT ON t1 FOR EACH ROW DELETE FROM t3' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr12 AFTER INSERT ON t1 FOR EACH ROW DELETE FROM t3' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr13 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr14 AFTER DELETE ON t1 FOR EACH ROW DELETE FROM non_existing_table' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr15 BEFORE UPDATE ON t1 FOR EACH ROW DELETE FROM non_existing_table a USING non_existing_table a'
|
||||
sql_modes=0 0 0 0 0
|
||||
definers='root@localhost' 'root@localhost' 'root@localhost' 'root@localhost' 'root@localhost'
|
||||
EOF
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
||||
|
||||
--echo # Make sure there is no trigger file left.
|
||||
|
||||
--list_files $MYSQLD_DATADIR/test/ tr*
|
||||
|
||||
CREATE TABLE t1 ( a INT );
|
||||
CREATE TABLE t2 ( a INT );
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
INSERT INTO t2 VALUES (1), (2), (3);
|
||||
|
||||
--echo # We write three trigger files. First trigger is syntaxically incorrect, next trigger is correct
|
||||
--echo # and last trigger is broken.
|
||||
--echo # Next we try to execute SHOW CREATE TRGGIR command for broken trigger and then try to drop one.
|
||||
--write_file $MYSQLD_DATADIR/test/tr11.TRN
|
||||
TYPE=TRIGGERNAME
|
||||
trigger_table=t1
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/tr12.TRN
|
||||
TYPE=TRIGGERNAME
|
||||
trigger_table=t1
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLD_DATADIR/test/t1.TRG
|
||||
TYPE=TRIGGERS
|
||||
triggers='CREATE the wrongest trigger_in_the_world' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr11 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr12 BEFORE INSERT ON t1 FOR EACH ROW DELETE FROM t2'
|
||||
sql_modes=0 0 0
|
||||
definers='root@localhost' 'root@localhost' 'root@localhost'
|
||||
EOF
|
||||
|
||||
FLUSH TABLE t1;
|
||||
|
||||
SHOW CREATE TRIGGER tr12;
|
||||
SHOW CREATE TRIGGER tr11;
|
||||
DROP TRIGGER tr12;
|
||||
DROP TRIGGER tr11;
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2000-2005 MySQL AB
|
||||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -11,8 +11,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
/**
|
||||
@file
|
||||
|
@ -96,7 +95,6 @@ static bool read_texts(const char *file_name,const char ***point,
|
|||
char name[FN_REFLEN];
|
||||
uchar *buff;
|
||||
uchar head[32],*pos;
|
||||
const char *errmsg;
|
||||
DBUG_ENTER("read_texts");
|
||||
|
||||
LINT_INIT(buff);
|
||||
|
@ -168,18 +166,9 @@ Check that the above file is the right version for this program!",
|
|||
DBUG_RETURN(0);
|
||||
|
||||
err:
|
||||
switch (funktpos) {
|
||||
case 2:
|
||||
errmsg= "Not enough memory for messagefile '%s'";
|
||||
break;
|
||||
case 1:
|
||||
errmsg= "Can't read from messagefile '%s'";
|
||||
break;
|
||||
default:
|
||||
errmsg= "Can't find messagefile '%s'";
|
||||
break;
|
||||
}
|
||||
sql_print_error(errmsg, name);
|
||||
sql_print_error((funktpos == 2) ? "Not enough memory for messagefile '%s'" :
|
||||
((funktpos == 1) ? "Can't read from messagefile '%s'" :
|
||||
"Can't find messagefile '%s'"), name);
|
||||
err1:
|
||||
if (file != FERR)
|
||||
VOID(my_close(file,MYF(MY_WME)));
|
||||
|
|
|
@ -226,9 +226,16 @@ mysql_event_fill_row(THD *thd,
|
|||
if (fields[f_num= ET_FIELD_NAME]->store(et->name.str, et->name.length, scs))
|
||||
goto err_truncate;
|
||||
|
||||
/* both ON_COMPLETION and STATUS are NOT NULL thus not calling set_notnull()*/
|
||||
/* ON_COMPLETION field is NOT NULL thus not calling set_notnull()*/
|
||||
rs|= fields[ET_FIELD_ON_COMPLETION]->store((longlong)et->on_completion, TRUE);
|
||||
rs|= fields[ET_FIELD_STATUS]->store((longlong)et->status, TRUE);
|
||||
|
||||
/*
|
||||
Set STATUS value unconditionally in case of CREATE EVENT.
|
||||
For ALTER EVENT set it only if value of this field was changed.
|
||||
Since STATUS field is NOT NULL call to set_notnull() is not needed.
|
||||
*/
|
||||
if (!is_update || et->status_changed)
|
||||
rs|= fields[ET_FIELD_STATUS]->store((longlong)et->status, TRUE);
|
||||
rs|= fields[ET_FIELD_ORIGINATOR]->store((longlong)et->originator, TRUE);
|
||||
|
||||
/*
|
||||
|
@ -604,18 +611,21 @@ Event_db_repository::open_event_table(THD *thd, enum thr_lock_type lock_type,
|
|||
only creates a record on disk.
|
||||
@pre The thread handle has no open tables.
|
||||
|
||||
@param[in,out] thd THD
|
||||
@param[in] parse_data Parsed event definition
|
||||
@param[in] create_if_not TRUE if IF NOT EXISTS clause was provided
|
||||
to CREATE EVENT statement
|
||||
|
||||
@param[in,out] thd THD
|
||||
@param[in] parse_data Parsed event definition
|
||||
@param[in] create_if_not TRUE if IF NOT EXISTS clause was provided
|
||||
to CREATE EVENT statement
|
||||
@param[out] event_already_exists When method is completed successfully
|
||||
set to true if event already exists else
|
||||
set to false
|
||||
@retval FALSE success
|
||||
@retval TRUE error
|
||||
*/
|
||||
|
||||
bool
|
||||
Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
|
||||
my_bool create_if_not)
|
||||
bool create_if_not,
|
||||
bool *event_already_exists)
|
||||
{
|
||||
int ret= 1;
|
||||
TABLE *table= NULL;
|
||||
|
@ -641,6 +651,7 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
|
|||
{
|
||||
if (create_if_not)
|
||||
{
|
||||
*event_already_exists= true;
|
||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
|
||||
ER_EVENT_ALREADY_EXISTS, ER(ER_EVENT_ALREADY_EXISTS),
|
||||
parse_data->name.str);
|
||||
|
@ -648,8 +659,10 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
|
|||
}
|
||||
else
|
||||
my_error(ER_EVENT_ALREADY_EXISTS, MYF(0), parse_data->name.str);
|
||||
|
||||
goto end;
|
||||
}
|
||||
} else
|
||||
*event_already_exists= false;
|
||||
|
||||
DBUG_PRINT("info", ("non-existent, go forward"));
|
||||
|
||||
|
@ -688,8 +701,6 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
|
|||
if (mysql_event_fill_row(thd, table, parse_data, sp, saved_mode, FALSE))
|
||||
goto end;
|
||||
|
||||
table->field[ET_FIELD_STATUS]->store((longlong)parse_data->status, TRUE);
|
||||
|
||||
if ((ret= table->file->ha_write_row(table->record[0])))
|
||||
{
|
||||
table->file->print_error(ret, MYF(0));
|
||||
|
|
|
@ -73,7 +73,8 @@ public:
|
|||
Event_db_repository(){}
|
||||
|
||||
bool
|
||||
create_event(THD *thd, Event_parse_data *parse_data, my_bool create_if_not);
|
||||
create_event(THD *thd, Event_parse_data *parse_data, bool create_if_not,
|
||||
bool *event_already_exists);
|
||||
|
||||
bool
|
||||
update_event(THD *thd, Event_parse_data *parse_data, LEX_STRING *new_dbname,
|
||||
|
|
|
@ -46,9 +46,8 @@ Event_parse_data::new_instance(THD *thd)
|
|||
|
||||
Event_parse_data::Event_parse_data()
|
||||
:on_completion(Event_parse_data::ON_COMPLETION_DEFAULT),
|
||||
status(Event_parse_data::ENABLED),
|
||||
do_not_create(FALSE),
|
||||
body_changed(FALSE),
|
||||
status(Event_parse_data::ENABLED), status_changed(false),
|
||||
do_not_create(FALSE), body_changed(FALSE),
|
||||
item_starts(NULL), item_ends(NULL), item_execute_at(NULL),
|
||||
starts_null(TRUE), ends_null(TRUE), execute_at_null(TRUE),
|
||||
item_expression(NULL), expression(0)
|
||||
|
@ -140,6 +139,7 @@ Event_parse_data::check_if_in_the_past(THD *thd, my_time_t ltime_utc)
|
|||
else if (status == Event_parse_data::ENABLED)
|
||||
{
|
||||
status= Event_parse_data::DISABLED;
|
||||
status_changed= true;
|
||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
|
||||
ER_EVENT_EXEC_TIME_IN_THE_PAST,
|
||||
ER(ER_EVENT_EXEC_TIME_IN_THE_PAST));
|
||||
|
@ -569,7 +569,10 @@ void Event_parse_data::check_originator_id(THD *thd)
|
|||
DBUG_PRINT("info", ("Invoked object status set to SLAVESIDE_DISABLED."));
|
||||
if ((status == Event_parse_data::ENABLED) ||
|
||||
(status == Event_parse_data::DISABLED))
|
||||
status = Event_parse_data::SLAVESIDE_DISABLED;
|
||||
{
|
||||
status= Event_parse_data::SLAVESIDE_DISABLED;
|
||||
status_changed= true;
|
||||
}
|
||||
originator = thd->server_id;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -49,6 +49,7 @@ public:
|
|||
|
||||
int on_completion;
|
||||
int status;
|
||||
bool status_changed;
|
||||
longlong originator;
|
||||
/*
|
||||
do_not_create will be set if STARTS time is in the past and
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2004-2006 MySQL AB
|
||||
/* Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -11,7 +11,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
#include "mysql_priv.h"
|
||||
#include "events.h"
|
||||
|
@ -370,6 +370,7 @@ create_query_string(THD *thd, String *buf)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Create a new event.
|
||||
|
||||
|
@ -390,8 +391,8 @@ bool
|
|||
Events::create_event(THD *thd, Event_parse_data *parse_data,
|
||||
bool if_not_exists)
|
||||
{
|
||||
int ret;
|
||||
bool save_binlog_row_based;
|
||||
bool ret;
|
||||
bool save_binlog_row_based, event_already_exists;
|
||||
DBUG_ENTER("Events::create_event");
|
||||
|
||||
/*
|
||||
|
@ -440,28 +441,32 @@ Events::create_event(THD *thd, Event_parse_data *parse_data,
|
|||
pthread_mutex_lock(&LOCK_event_metadata);
|
||||
|
||||
/* On error conditions my_error() is called so no need to handle here */
|
||||
if (!(ret= db_repository->create_event(thd, parse_data, if_not_exists)))
|
||||
if (!(ret= db_repository->create_event(thd, parse_data, if_not_exists,
|
||||
&event_already_exists)))
|
||||
{
|
||||
Event_queue_element *new_element;
|
||||
bool dropped= 0;
|
||||
|
||||
if (!(new_element= new Event_queue_element()))
|
||||
ret= TRUE; // OOM
|
||||
else if ((ret= db_repository->load_named_event(thd, parse_data->dbname,
|
||||
parse_data->name,
|
||||
new_element)))
|
||||
if (!event_already_exists)
|
||||
{
|
||||
if (!db_repository->drop_event(thd, parse_data->dbname, parse_data->name,
|
||||
TRUE))
|
||||
dropped= 1;
|
||||
delete new_element;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* TODO: do not ignore the out parameter and a possible OOM error! */
|
||||
bool created;
|
||||
if (event_queue)
|
||||
event_queue->create_event(thd, new_element, &created);
|
||||
if (!(new_element= new Event_queue_element()))
|
||||
ret= TRUE; // OOM
|
||||
else if ((ret= db_repository->load_named_event(thd, parse_data->dbname,
|
||||
parse_data->name,
|
||||
new_element)))
|
||||
{
|
||||
if (!db_repository->drop_event(thd, parse_data->dbname, parse_data->name,
|
||||
TRUE))
|
||||
dropped= 1;
|
||||
delete new_element;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* TODO: do not ignore the out parameter and a possible OOM error! */
|
||||
bool created;
|
||||
if (event_queue)
|
||||
event_queue->create_event(thd, new_element, &created);
|
||||
}
|
||||
}
|
||||
/*
|
||||
binlog the create event unless it's been successfully dropped
|
||||
|
@ -475,13 +480,14 @@ Events::create_event(THD *thd, Event_parse_data *parse_data,
|
|||
{
|
||||
sql_print_error("Event Error: An error occurred while creating query string, "
|
||||
"before writing it into binary log.");
|
||||
/* Restore the state of binlog format */
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
DBUG_RETURN(TRUE);
|
||||
ret= true;
|
||||
}
|
||||
/* If the definer is not set or set to CURRENT_USER, the value of CURRENT_USER
|
||||
will be written into the binary log as the definer for the SQL thread. */
|
||||
ret= write_bin_log(thd, TRUE, log_query.c_ptr(), log_query.length());
|
||||
else
|
||||
/*
|
||||
If the definer is not set or set to CURRENT_USER, the value of CURRENT_USER
|
||||
will be written into the binary log as the definer for the SQL thread.
|
||||
*/
|
||||
ret= write_bin_log(thd, TRUE, log_query.c_ptr(), log_query.length());
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&LOCK_event_metadata);
|
||||
|
@ -547,7 +553,7 @@ Events::update_event(THD *thd, Event_parse_data *parse_data,
|
|||
!sortcmp_lex_string(parse_data->name, *new_name,
|
||||
system_charset_info))
|
||||
{
|
||||
my_error(ER_EVENT_SAME_NAME, MYF(0), parse_data->name.str);
|
||||
my_error(ER_EVENT_SAME_NAME, MYF(0));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
|
@ -1150,7 +1156,7 @@ Events::switch_event_scheduler_state(enum_opt_event_scheduler new_state)
|
|||
|
||||
if (ret)
|
||||
{
|
||||
my_error(ER_EVENT_SET_VAR_ERROR, MYF(0));
|
||||
my_error(ER_EVENT_SET_VAR_ERROR, MYF(0), 0);
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
|
13
sql/field.cc
13
sql/field.cc
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -11,8 +11,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
/**
|
||||
@file
|
||||
|
@ -9585,7 +9584,7 @@ bool Create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
|
|||
if (decimals >= NOT_FIXED_DEC)
|
||||
{
|
||||
my_error(ER_TOO_BIG_SCALE, MYF(0), decimals, fld_name,
|
||||
NOT_FIXED_DEC-1);
|
||||
static_cast<ulong>(NOT_FIXED_DEC - 1));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
|
@ -9655,8 +9654,8 @@ bool Create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
|
|||
my_decimal_trim(&length, &decimals);
|
||||
if (length > DECIMAL_MAX_PRECISION)
|
||||
{
|
||||
my_error(ER_TOO_BIG_PRECISION, MYF(0), length, fld_name,
|
||||
DECIMAL_MAX_PRECISION);
|
||||
my_error(ER_TOO_BIG_PRECISION, MYF(0), static_cast<int>(length),
|
||||
fld_name, static_cast<ulong>(DECIMAL_MAX_PRECISION));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if (length < decimals)
|
||||
|
@ -9881,7 +9880,7 @@ bool Create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
|
|||
if (length > MAX_BIT_FIELD_LENGTH)
|
||||
{
|
||||
my_error(ER_TOO_BIG_DISPLAYWIDTH, MYF(0), fld_name,
|
||||
MAX_BIT_FIELD_LENGTH);
|
||||
static_cast<ulong>(MAX_BIT_FIELD_LENGTH));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
pack_length= (length + 7) / 8;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2000-2003 MySQL AB
|
||||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -11,8 +11,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
/**
|
||||
@file
|
||||
|
@ -8411,7 +8410,7 @@ NDB_SHARE *ndbcluster_get_share(const char *key, TABLE *table,
|
|||
DBUG_PRINT("error", ("get_share: failed to alloc share"));
|
||||
if (!have_lock)
|
||||
pthread_mutex_unlock(&ndbcluster_mutex);
|
||||
my_error(ER_OUTOFMEMORY, MYF(0), sizeof(*share));
|
||||
my_error(ER_OUTOFMEMORY, MYF(0), static_cast<int>(sizeof(*share)));
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2000-2003 MySQL AB
|
||||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -11,8 +11,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
#include "mysql_priv.h"
|
||||
#include "sql_show.h"
|
||||
|
@ -1198,12 +1197,14 @@ ndbcluster_update_slock(THD *thd,
|
|||
}
|
||||
|
||||
if (ndb_error)
|
||||
{
|
||||
char buf[1024];
|
||||
my_snprintf(buf, sizeof(buf), "Could not release lock on '%s.%s'",
|
||||
db, table_name);
|
||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
|
||||
ER_GET_ERRMSG, ER(ER_GET_ERRMSG),
|
||||
ndb_error->code,
|
||||
ndb_error->message,
|
||||
"Could not release lock on '%s.%s'",
|
||||
db, table_name);
|
||||
ndb_error->code, ndb_error->message, buf);
|
||||
}
|
||||
if (trans)
|
||||
ndb->closeTransaction(trans);
|
||||
ndb->setDatabaseName(save_db);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright 2005-2008 MySQL AB, 2008 Sun Microsystems, Inc.
|
||||
/* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -11,7 +11,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
/*
|
||||
This handler was developed by Mikael Ronstrom for version 5.1 of MySQL.
|
||||
|
@ -1023,6 +1023,10 @@ static int handle_opt_part(THD *thd, HA_CHECK_OPT *check_opt,
|
|||
(modelled after mi_check_print_msg)
|
||||
TODO: move this into the handler, or rewrite mysql_admin_table.
|
||||
*/
|
||||
static bool print_admin_msg(THD* thd, const char* msg_type,
|
||||
const char* db_name, const char* table_name,
|
||||
const char* op_name, const char *fmt, ...)
|
||||
ATTRIBUTE_FORMAT(printf, 6, 7);
|
||||
static bool print_admin_msg(THD* thd, const char* msg_type,
|
||||
const char* db_name, const char* table_name,
|
||||
const char* op_name, const char *fmt, ...)
|
||||
|
@ -3403,15 +3407,19 @@ int ha_partition::update_row(const uchar *old_data, uchar *new_data)
|
|||
|
||||
exit:
|
||||
/*
|
||||
if updating an auto_increment column, update
|
||||
If updating an auto_increment column, update
|
||||
table_share->ha_data->next_auto_inc_val if needed.
|
||||
(not to be used if auto_increment on secondary field in a multi-column
|
||||
index)
|
||||
mysql_update does not set table->next_number_field, so we use
|
||||
table->found_next_number_field instead.
|
||||
Also checking that the field is marked in the write set.
|
||||
*/
|
||||
if (table->found_next_number_field && new_data == table->record[0] &&
|
||||
!table->s->next_number_keypart)
|
||||
if (table->found_next_number_field &&
|
||||
new_data == table->record[0] &&
|
||||
!table->s->next_number_keypart &&
|
||||
bitmap_is_set(table->write_set,
|
||||
table->found_next_number_field->field_index))
|
||||
{
|
||||
HA_DATA_PARTITION *ha_data= (HA_DATA_PARTITION*) table_share->ha_data;
|
||||
if (!ha_data->auto_inc_initialized)
|
||||
|
@ -3974,6 +3982,7 @@ void ha_partition::position(const uchar *record)
|
|||
void ha_partition::column_bitmaps_signal()
|
||||
{
|
||||
handler::column_bitmaps_signal();
|
||||
/* Must read all partition fields to make position() call possible */
|
||||
bitmap_union(table->read_set, &m_part_info->full_part_field_set);
|
||||
}
|
||||
|
||||
|
|
|
@ -275,7 +275,7 @@ handler *get_ha_partition(partition_info *part_info)
|
|||
}
|
||||
else
|
||||
{
|
||||
my_error(ER_OUTOFMEMORY, MYF(0), sizeof(ha_partition));
|
||||
my_error(ER_OUTOFMEMORY, MYF(0), static_cast<int>(sizeof(ha_partition)));
|
||||
}
|
||||
DBUG_RETURN(((handler*) partition));
|
||||
}
|
||||
|
@ -1604,7 +1604,8 @@ int ha_recover(HASH *commit_list)
|
|||
}
|
||||
if (!info.list)
|
||||
{
|
||||
sql_print_error(ER(ER_OUTOFMEMORY), info.len*sizeof(XID));
|
||||
sql_print_error(ER(ER_OUTOFMEMORY),
|
||||
static_cast<int>(info.len*sizeof(XID)));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2000, 2010 Oracle and/or its affiliates. All rights reserved.
|
||||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -11,7 +11,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
/**
|
||||
@file
|
||||
|
@ -5083,8 +5083,8 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
|
|||
decoded_size= strtoul(c_len, NULL, 10);
|
||||
if (errno != 0)
|
||||
{
|
||||
my_error(ER_TOO_BIG_PRECISION, MYF(0), c_len, a->name,
|
||||
DECIMAL_MAX_PRECISION);
|
||||
my_error(ER_TOO_BIG_PRECISION, MYF(0), INT_MAX, a->name,
|
||||
static_cast<ulong>(DECIMAL_MAX_PRECISION));
|
||||
return NULL;
|
||||
}
|
||||
len= decoded_size;
|
||||
|
@ -5097,8 +5097,8 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
|
|||
decoded_size= strtoul(c_dec, NULL, 10);
|
||||
if ((errno != 0) || (decoded_size > UINT_MAX))
|
||||
{
|
||||
my_error(ER_TOO_BIG_SCALE, MYF(0), c_dec, a->name,
|
||||
DECIMAL_MAX_SCALE);
|
||||
my_error(ER_TOO_BIG_SCALE, MYF(0), INT_MAX, a->name,
|
||||
static_cast<ulong>(DECIMAL_MAX_SCALE));
|
||||
return NULL;
|
||||
}
|
||||
dec= decoded_size;
|
||||
|
@ -5111,14 +5111,14 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
|
|||
}
|
||||
if (len > DECIMAL_MAX_PRECISION)
|
||||
{
|
||||
my_error(ER_TOO_BIG_PRECISION, MYF(0), len, a->name,
|
||||
DECIMAL_MAX_PRECISION);
|
||||
my_error(ER_TOO_BIG_PRECISION, MYF(0), static_cast<int>(len), a->name,
|
||||
static_cast<ulong>(DECIMAL_MAX_PRECISION));
|
||||
return 0;
|
||||
}
|
||||
if (dec > DECIMAL_MAX_SCALE)
|
||||
{
|
||||
my_error(ER_TOO_BIG_SCALE, MYF(0), dec, a->name,
|
||||
DECIMAL_MAX_SCALE);
|
||||
static_cast<ulong>(DECIMAL_MAX_SCALE));
|
||||
return 0;
|
||||
}
|
||||
res= new (thd->mem_root) Item_decimal_typecast(a, len, dec);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -11,8 +11,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
/**
|
||||
@file
|
||||
|
@ -1066,7 +1065,7 @@ err:
|
|||
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
|
||||
ER_WARN_DATA_OUT_OF_RANGE,
|
||||
ER(ER_WARN_DATA_OUT_OF_RANGE),
|
||||
name, 1);
|
||||
name, 1L);
|
||||
return dec;
|
||||
}
|
||||
|
||||
|
@ -1973,6 +1972,9 @@ void Item_func_round::fix_length_and_dec()
|
|||
}
|
||||
|
||||
val1= args[1]->val_int();
|
||||
if ((null_value= args[1]->is_null()))
|
||||
return;
|
||||
|
||||
val1_unsigned= args[1]->unsigned_flag;
|
||||
if (val1 < 0)
|
||||
decimals_to_set= val1_unsigned ? INT_MAX : 0;
|
||||
|
@ -2851,7 +2853,7 @@ udf_handler::fix_fields(THD *thd, Item_result_field *func,
|
|||
|
||||
if (!tmp_udf)
|
||||
{
|
||||
my_error(ER_CANT_FIND_UDF, MYF(0), u_d->name.str, errno);
|
||||
my_error(ER_CANT_FIND_UDF, MYF(0), u_d->name.str);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
u_d=tmp_udf;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2000-2006 MySQL AB
|
||||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -11,8 +11,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
/**
|
||||
@file
|
||||
|
@ -3465,7 +3464,8 @@ String *Item_func_uncompress::val_str(String *str)
|
|||
push_warning_printf(current_thd,MYSQL_ERROR::WARN_LEVEL_ERROR,
|
||||
ER_TOO_BIG_FOR_UNCOMPRESS,
|
||||
ER(ER_TOO_BIG_FOR_UNCOMPRESS),
|
||||
current_thd->variables.max_allowed_packet);
|
||||
static_cast<int>(current_thd->variables.
|
||||
max_allowed_packet));
|
||||
goto err;
|
||||
}
|
||||
if (buffer.realloc((uint32)new_size))
|
||||
|
|
|
@ -1519,6 +1519,11 @@ bool Item_func_from_days::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
|
|||
return 1;
|
||||
bzero(ltime, sizeof(MYSQL_TIME));
|
||||
get_date_from_daynr((long) value, <ime->year, <ime->month, <ime->day);
|
||||
|
||||
if ((null_value= (fuzzy_date & TIME_NO_ZERO_DATE) &&
|
||||
(ltime->year == 0 || ltime->month == 0 || ltime->day == 0)))
|
||||
return TRUE;
|
||||
|
||||
ltime->time_type= MYSQL_TIMESTAMP_DATE;
|
||||
return 0;
|
||||
}
|
||||
|
@ -2697,7 +2702,7 @@ String *Item_func_makedate::val_str(String *str)
|
|||
long days;
|
||||
|
||||
if (args[0]->null_value || args[1]->null_value ||
|
||||
year < 0 || daynr <= 0)
|
||||
year < 0 || year > 9999 || daynr <= 0)
|
||||
goto err;
|
||||
|
||||
if (year < 100)
|
||||
|
@ -2740,7 +2745,7 @@ longlong Item_func_makedate::val_int()
|
|||
long days;
|
||||
|
||||
if (args[0]->null_value || args[1]->null_value ||
|
||||
year < 0 || daynr <= 0)
|
||||
year < 0 || year > 9999 || daynr <= 0)
|
||||
goto err;
|
||||
|
||||
if (year < 100)
|
||||
|
|
15
sql/log.cc
15
sql/log.cc
|
@ -2989,12 +2989,6 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd)
|
|||
DBUG_ENTER("reset_logs");
|
||||
|
||||
ha_reset_logs(thd);
|
||||
/*
|
||||
We need to get both locks to be sure that no one is trying to
|
||||
write to the index log file.
|
||||
*/
|
||||
pthread_mutex_lock(&LOCK_log);
|
||||
pthread_mutex_lock(&LOCK_index);
|
||||
|
||||
/*
|
||||
The following mutex is needed to ensure that no threads call
|
||||
|
@ -3002,7 +2996,14 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd)
|
|||
thread. If the transaction involved MyISAM tables, it should go
|
||||
into binlog even on rollback.
|
||||
*/
|
||||
VOID(pthread_mutex_lock(&LOCK_thread_count));
|
||||
pthread_mutex_lock(&LOCK_thread_count);
|
||||
|
||||
/*
|
||||
We need to get both locks to be sure that no one is trying to
|
||||
write to the index log file.
|
||||
*/
|
||||
pthread_mutex_lock(&LOCK_log);
|
||||
pthread_mutex_lock(&LOCK_index);
|
||||
|
||||
/* Save variables so that we can reopen the log */
|
||||
save_name=name;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
|
||||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -11,7 +11,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
/**
|
||||
@file
|
||||
|
@ -670,6 +670,10 @@ enum enum_check_fields
|
|||
extern "C" THD *_current_thd_noinline();
|
||||
#define _current_thd() _current_thd_noinline()
|
||||
#else
|
||||
/*
|
||||
THR_THD is a key which will be used to set/get THD* for a thread,
|
||||
using my_pthread_setspecific_ptr()/my_thread_getspecific_ptr().
|
||||
*/
|
||||
extern pthread_key(THD*, THR_THD);
|
||||
inline THD *_current_thd(void)
|
||||
{
|
||||
|
@ -829,7 +833,7 @@ void sql_print_warning(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
|
|||
void sql_print_information(const char *format, ...)
|
||||
ATTRIBUTE_FORMAT(printf, 1, 2);
|
||||
typedef void (*sql_print_message_func)(const char *format, ...)
|
||||
ATTRIBUTE_FORMAT(printf, 1, 2);
|
||||
ATTRIBUTE_FORMAT_FPTR(printf, 1, 2);
|
||||
extern sql_print_message_func sql_print_message_handlers[];
|
||||
|
||||
int error_log_print(enum loglevel level, const char *format,
|
||||
|
@ -2022,6 +2026,10 @@ extern TABLE_LIST general_log, slow_log;
|
|||
extern FILE *bootstrap_file;
|
||||
extern int bootstrap_error;
|
||||
extern FILE *stderror_file;
|
||||
/*
|
||||
THR_MALLOC is a key which will be used to set/get MEM_ROOT** for a thread,
|
||||
using my_pthread_setspecific_ptr()/my_thread_getspecific_ptr().
|
||||
*/
|
||||
extern pthread_key(MEM_ROOT**,THR_MALLOC);
|
||||
extern pthread_mutex_t LOCK_mysql_create_db,LOCK_Acl,LOCK_open, LOCK_lock_db,
|
||||
LOCK_mapped_file,LOCK_user_locks, LOCK_status,
|
||||
|
|
|
@ -171,12 +171,12 @@ static void getvolumeID(BYTE *volumeName);
|
|||
int initgroups(const char *,unsigned int);
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H)
|
||||
#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H) && !defined(HAVE_FEDISABLEEXCEPT)
|
||||
#include <ieeefp.h>
|
||||
#ifdef HAVE_FP_EXCEPT // Fix type conflict
|
||||
typedef fp_except fp_except_t;
|
||||
#endif
|
||||
#endif /* __FreeBSD__ && HAVE_IEEEFP_H */
|
||||
#endif /* __FreeBSD__ && HAVE_IEEEFP_H && !HAVE_FEDISABLEEXCEPT */
|
||||
#ifdef HAVE_SYS_FPU_H
|
||||
/* for IRIX to use set_fpc_csr() */
|
||||
#include <sys/fpu.h>
|
||||
|
@ -202,19 +202,24 @@ extern "C" my_bool reopen_fstreams(const char *filename,
|
|||
|
||||
inline void setup_fpu()
|
||||
{
|
||||
#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H)
|
||||
#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H) && !defined(HAVE_FEDISABLEEXCEPT)
|
||||
/* We can't handle floating point exceptions with threads, so disable
|
||||
this on freebsd
|
||||
Don't fall for overflow, underflow,divide-by-zero or loss of precision
|
||||
Don't fall for overflow, underflow,divide-by-zero or loss of precision.
|
||||
fpsetmask() is deprecated in favor of fedisableexcept() in C99.
|
||||
*/
|
||||
#if defined(__i386__)
|
||||
#if defined(FP_X_DNML)
|
||||
fpsetmask(~(FP_X_INV | FP_X_DNML | FP_X_OFL | FP_X_UFL | FP_X_DZ |
|
||||
FP_X_IMP));
|
||||
#else
|
||||
fpsetmask(~(FP_X_INV | FP_X_OFL | FP_X_UFL | FP_X_DZ |
|
||||
FP_X_IMP));
|
||||
#endif /* __i386__ */
|
||||
#endif /* __FreeBSD__ && HAVE_IEEEFP_H */
|
||||
#endif /* FP_X_DNML */
|
||||
#endif /* __FreeBSD__ && HAVE_IEEEFP_H && !HAVE_FEDISABLEEXCEPT */
|
||||
|
||||
#ifdef HAVE_FEDISABLEEXCEPT
|
||||
fedisableexcept(FE_ALL_EXCEPT);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FESETROUND
|
||||
/* Set FPU rounding mode to "round-to-nearest" */
|
||||
|
@ -1903,6 +1908,12 @@ void unlink_thd(THD *thd)
|
|||
pthread_mutex_unlock(&LOCK_connection_count);
|
||||
|
||||
(void) pthread_mutex_lock(&LOCK_thread_count);
|
||||
/*
|
||||
Used by binlog_reset_master. It would be cleaner to use
|
||||
DEBUG_SYNC here, but that's not possible because the THD's debug
|
||||
sync feature has been shut down at this point.
|
||||
*/
|
||||
DBUG_EXECUTE_IF("sleep_after_lock_thread_count_before_delete_thd", sleep(5););
|
||||
thread_count--;
|
||||
delete thd;
|
||||
DBUG_VOID_RETURN;
|
||||
|
|
|
@ -204,21 +204,16 @@ void scramble_323(char *to, const char *message, const char *password)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
Check scrambled message
|
||||
Used in pre 4.1 password handling
|
||||
SYNOPSIS
|
||||
check_scramble_323()
|
||||
scrambled scrambled message to check.
|
||||
message original random message which was used for scrambling; must
|
||||
be exactly SCRAMBLED_LENGTH_323 bytes long and
|
||||
NULL-terminated.
|
||||
hash_pass password which should be used for scrambling
|
||||
All params are IN.
|
||||
/**
|
||||
Check scrambled message. Used in pre 4.1 password handling.
|
||||
|
||||
RETURN VALUE
|
||||
0 - password correct
|
||||
!0 - password invalid
|
||||
@param scrambled Scrambled message to check.
|
||||
@param message Original random message which was used for scrambling.
|
||||
@param hash_pass Password which should be used for scrambling.
|
||||
|
||||
@remark scrambled and message must be SCRAMBLED_LENGTH_323 bytes long.
|
||||
|
||||
@return FALSE if password is correct, TRUE otherwise.
|
||||
*/
|
||||
|
||||
my_bool
|
||||
|
@ -227,9 +222,16 @@ check_scramble_323(const char *scrambled, const char *message,
|
|||
{
|
||||
struct rand_struct rand_st;
|
||||
ulong hash_message[2];
|
||||
char buff[16],*to,extra; /* Big enough for check */
|
||||
/* Big enough for checks. */
|
||||
char buff[16], scrambled_buff[SCRAMBLE_LENGTH_323 + 1];
|
||||
char *to, extra;
|
||||
const char *pos;
|
||||
|
||||
/* Ensure that the scrambled message is null-terminated. */
|
||||
memcpy(scrambled_buff, scrambled, SCRAMBLE_LENGTH_323);
|
||||
scrambled_buff[SCRAMBLE_LENGTH_323]= '\0';
|
||||
scrambled= scrambled_buff;
|
||||
|
||||
hash_password(hash_message, message, SCRAMBLE_LENGTH_323);
|
||||
randominit(&rand_st,hash_pass[0] ^ hash_message[0],
|
||||
hash_pass[1] ^ hash_message[1]);
|
||||
|
|
42
sql/sp.cc
42
sql/sp.cc
|
@ -708,6 +708,37 @@ Silence_deprecated_warning::handle_error(uint sql_errno, const char *message,
|
|||
}
|
||||
|
||||
|
||||
class Bad_db_error_handler : public Internal_error_handler
|
||||
{
|
||||
public:
|
||||
Bad_db_error_handler()
|
||||
:m_error_caught(false)
|
||||
{}
|
||||
|
||||
virtual bool handle_error(uint sql_errno, const char *message,
|
||||
MYSQL_ERROR::enum_warning_level level,
|
||||
THD *thd);
|
||||
|
||||
bool error_caught() const { return m_error_caught; }
|
||||
|
||||
private:
|
||||
bool m_error_caught;
|
||||
};
|
||||
|
||||
bool
|
||||
Bad_db_error_handler::handle_error(uint sql_errno, const char *message,
|
||||
MYSQL_ERROR::enum_warning_level level,
|
||||
THD *thd)
|
||||
{
|
||||
if (sql_errno == ER_BAD_DB_ERROR)
|
||||
{
|
||||
m_error_caught= true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
|
||||
ulong sql_mode, const char *params, const char *returns,
|
||||
|
@ -725,7 +756,7 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
|
|||
ha_rows old_select_limit= thd->variables.select_limit;
|
||||
sp_rcontext *old_spcont= thd->spcont;
|
||||
Silence_deprecated_warning warning_handler;
|
||||
|
||||
Bad_db_error_handler db_not_exists_handler;
|
||||
char definer_user_name_holder[USERNAME_LENGTH + 1];
|
||||
LEX_STRING definer_user_name= { definer_user_name_holder,
|
||||
USERNAME_LENGTH };
|
||||
|
@ -766,6 +797,7 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
|
|||
goto end;
|
||||
}
|
||||
|
||||
thd->push_internal_handler(&db_not_exists_handler);
|
||||
/*
|
||||
Change the current database (if needed).
|
||||
|
||||
|
@ -776,9 +808,17 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
|
|||
&cur_db_changed))
|
||||
{
|
||||
ret= SP_INTERNAL_ERROR;
|
||||
thd->pop_internal_handler();
|
||||
goto end;
|
||||
}
|
||||
thd->pop_internal_handler();
|
||||
if (db_not_exists_handler.error_caught())
|
||||
{
|
||||
ret= SP_INTERNAL_ERROR;
|
||||
my_error(ER_BAD_DB_ERROR, MYF(0), name->m_db.str);
|
||||
|
||||
goto end;
|
||||
}
|
||||
thd->spcont= NULL;
|
||||
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright 2002-2008 MySQL AB, 2008 Sun Microsystems, Inc.
|
||||
/* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -11,7 +11,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
#include "mysql_priv.h"
|
||||
#ifdef USE_PRAGMA_IMPLEMENTATION
|
||||
|
@ -1060,7 +1060,7 @@ void sp_head::recursion_level_error(THD *thd)
|
|||
if (m_type == TYPE_ENUM_PROCEDURE)
|
||||
{
|
||||
my_error(ER_SP_RECURSION_LIMIT, MYF(0),
|
||||
thd->variables.max_sp_recursion_depth,
|
||||
static_cast<int>(thd->variables.max_sp_recursion_depth),
|
||||
m_name.str);
|
||||
}
|
||||
else
|
||||
|
@ -2354,6 +2354,21 @@ void
|
|||
sp_head::restore_thd_mem_root(THD *thd)
|
||||
{
|
||||
DBUG_ENTER("sp_head::restore_thd_mem_root");
|
||||
|
||||
/*
|
||||
In some cases our parser detects a syntax error and calls
|
||||
LEX::cleanup_lex_after_parse_error() method only after
|
||||
finishing parsing the whole routine. In such a situation
|
||||
sp_head::restore_thd_mem_root() will be called twice - the
|
||||
first time as part of normal parsing process and the second
|
||||
time by cleanup_lex_after_parse_error().
|
||||
To avoid ruining active arena/mem_root state in this case we
|
||||
skip restoration of old arena/mem_root if this method has been
|
||||
already called for this routine.
|
||||
*/
|
||||
if (!m_thd)
|
||||
DBUG_VOID_RETURN;
|
||||
|
||||
Item *flist= free_list; // The old list
|
||||
set_query_arena(thd); // Get new free_list and mem_root
|
||||
state= INITIALIZED_FOR_SP;
|
||||
|
|
|
@ -1970,13 +1970,12 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
|
|||
*/
|
||||
else if (!password_len && no_auto_create)
|
||||
{
|
||||
my_error(ER_PASSWORD_NO_MATCH, MYF(0), combo.user.str, combo.host.str);
|
||||
my_error(ER_PASSWORD_NO_MATCH, MYF(0));
|
||||
goto end;
|
||||
}
|
||||
else if (!can_create_user)
|
||||
{
|
||||
my_error(ER_CANT_CREATE_USER_WITH_GRANT, MYF(0),
|
||||
thd->security_ctx->user, thd->security_ctx->host_or_ip);
|
||||
my_error(ER_CANT_CREATE_USER_WITH_GRANT, MYF(0));
|
||||
goto end;
|
||||
}
|
||||
old_row_exists = 0;
|
||||
|
|
|
@ -4008,7 +4008,7 @@ retry:
|
|||
{
|
||||
/* Give right error message */
|
||||
thd->clear_error();
|
||||
my_error(ER_NOT_KEYFILE, MYF(0), share->table_name.str, my_errno);
|
||||
my_error(ER_NOT_KEYFILE, MYF(0), share->table_name.str);
|
||||
sql_print_error("Couldn't repair table: %s.%s", share->db.str,
|
||||
share->table_name.str);
|
||||
if (entry->file)
|
||||
|
@ -7686,7 +7686,7 @@ bool setup_tables(THD *thd, Name_resolution_context *context,
|
|||
}
|
||||
if (tablenr > MAX_TABLES)
|
||||
{
|
||||
my_error(ER_TOO_MANY_TABLES,MYF(0),MAX_TABLES);
|
||||
my_error(ER_TOO_MANY_TABLES, MYF(0), static_cast<int>(MAX_TABLES));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
for (table_list= tables;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2005-2006 MySQL AB
|
||||
/* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -232,7 +232,7 @@ void mysql_client_binlog_statement(THD* thd)
|
|||
TODO: Maybe a better error message since the BINLOG statement
|
||||
now contains several events.
|
||||
*/
|
||||
my_error(ER_UNKNOWN_ERROR, MYF(0), "Error executing BINLOG statement");
|
||||
my_error(ER_UNKNOWN_ERROR, MYF(0));
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
|
||||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -11,8 +11,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
/*****************************************************************************
|
||||
**
|
||||
|
@ -1196,6 +1195,25 @@ bool THD::store_globals()
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Remove the thread specific info (THD and mem_root pointer) stored during
|
||||
store_global call for this thread.
|
||||
*/
|
||||
bool THD::restore_globals()
|
||||
{
|
||||
/*
|
||||
Assert that thread_stack is initialized: it's necessary to be able
|
||||
to track stack overrun.
|
||||
*/
|
||||
DBUG_ASSERT(thread_stack);
|
||||
|
||||
/* Undocking the thread specific data. */
|
||||
my_pthread_setspecific_ptr(THR_THD, NULL);
|
||||
my_pthread_setspecific_ptr(THR_MALLOC, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Cleanup after query.
|
||||
|
@ -2040,7 +2058,7 @@ bool select_export::send_data(List<Item> &items)
|
|||
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
|
||||
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
|
||||
"string", printable_buff,
|
||||
item->name, row_count);
|
||||
item->name, static_cast<long>(row_count));
|
||||
}
|
||||
else if (from_end_pos < res->ptr() + res->length())
|
||||
{
|
||||
|
@ -2049,7 +2067,7 @@ bool select_export::send_data(List<Item> &items)
|
|||
*/
|
||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
WARN_DATA_TRUNCATED, ER(WARN_DATA_TRUNCATED),
|
||||
item->full_name(), row_count);
|
||||
item->full_name(), static_cast<long>(row_count));
|
||||
}
|
||||
cvt_str.length(bytes);
|
||||
res= &cvt_str;
|
||||
|
|
|
@ -1943,6 +1943,7 @@ public:
|
|||
void cleanup(void);
|
||||
void cleanup_after_query();
|
||||
bool store_globals();
|
||||
bool restore_globals();
|
||||
#ifdef SIGNAL_WITH_VIO_CLOSE
|
||||
inline void set_active_vio(Vio* vio)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2007 MySQL AB
|
||||
/* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -11,8 +11,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
/*
|
||||
Functions to autenticate and handle reqests for a connection
|
||||
|
@ -342,7 +341,7 @@ check_user(THD *thd, enum enum_server_command command,
|
|||
passwd_len != SCRAMBLE_LENGTH &&
|
||||
passwd_len != SCRAMBLE_LENGTH_323)
|
||||
{
|
||||
my_error(ER_HANDSHAKE_ERROR, MYF(0), thd->main_security_ctx.host_or_ip);
|
||||
my_error(ER_HANDSHAKE_ERROR, MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
|
@ -373,7 +372,7 @@ check_user(THD *thd, enum enum_server_command command,
|
|||
my_net_read(net) != SCRAMBLE_LENGTH_323 + 1)
|
||||
{
|
||||
inc_host_errors(&thd->remote.sin_addr);
|
||||
my_error(ER_HANDSHAKE_ERROR, MYF(0), thd->main_security_ctx.host_or_ip);
|
||||
my_error(ER_HANDSHAKE_ERROR, MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
/* Final attempt to check the user based on reply */
|
||||
|
@ -654,14 +653,21 @@ bool init_new_connection_handler_thread()
|
|||
}
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
/**
|
||||
Get a null character terminated string from a user-supplied buffer.
|
||||
|
||||
@param buffer[in, out] Pointer to the buffer to be scanned.
|
||||
/** Get a string according to the protocol of the underlying buffer. */
|
||||
typedef char * (*get_proto_string_func_t) (char **, size_t *, size_t *);
|
||||
|
||||
/**
|
||||
Get a string formatted according to the 4.1 version of the MySQL protocol.
|
||||
|
||||
@param buffer[in, out] Pointer to the user-supplied buffer to be scanned.
|
||||
@param max_bytes_available[in, out] Limit the bytes to scan.
|
||||
@param string_length[out] The number of characters scanned not including
|
||||
the null character.
|
||||
|
||||
@remark Strings are always null character terminated in this version of the
|
||||
protocol.
|
||||
|
||||
@remark The string_length does not include the terminating null character.
|
||||
However, after the call, the buffer is increased by string_length+1
|
||||
bytes, beyond the null character if there still available bytes to
|
||||
|
@ -672,9 +678,9 @@ bool init_new_connection_handler_thread()
|
|||
*/
|
||||
|
||||
static
|
||||
char *get_null_terminated_string(char **buffer,
|
||||
size_t *max_bytes_available,
|
||||
size_t *string_length)
|
||||
char *get_41_protocol_string(char **buffer,
|
||||
size_t *max_bytes_available,
|
||||
size_t *string_length)
|
||||
{
|
||||
char *str= (char *)memchr(*buffer, '\0', *max_bytes_available);
|
||||
|
||||
|
@ -684,7 +690,60 @@ char *get_null_terminated_string(char **buffer,
|
|||
*string_length= (size_t)(str - *buffer);
|
||||
*max_bytes_available-= *string_length + 1;
|
||||
str= *buffer;
|
||||
*buffer += *string_length + 1;
|
||||
*buffer += *string_length + 1;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Get a string formatted according to the 4.0 version of the MySQL protocol.
|
||||
|
||||
@param buffer[in, out] Pointer to the user-supplied buffer to be scanned.
|
||||
@param max_bytes_available[in, out] Limit the bytes to scan.
|
||||
@param string_length[out] The number of characters scanned not including
|
||||
the null character.
|
||||
|
||||
@remark If there are not enough bytes left after the current position of
|
||||
the buffer to satisfy the current string, the string is considered
|
||||
to be empty and a pointer to empty_c_string is returned.
|
||||
|
||||
@remark A string at the end of the packet is not null terminated.
|
||||
|
||||
@return Pointer to beginning of the string scanned, or a pointer to a empty
|
||||
string.
|
||||
*/
|
||||
static
|
||||
char *get_40_protocol_string(char **buffer,
|
||||
size_t *max_bytes_available,
|
||||
size_t *string_length)
|
||||
{
|
||||
char *str;
|
||||
size_t len;
|
||||
|
||||
/* No bytes to scan left, treat string as empty. */
|
||||
if ((*max_bytes_available) == 0)
|
||||
{
|
||||
*string_length= 0;
|
||||
return empty_c_string;
|
||||
}
|
||||
|
||||
str= (char *) memchr(*buffer, '\0', *max_bytes_available);
|
||||
|
||||
/*
|
||||
If the string was not null terminated by the client,
|
||||
the remainder of the packet is the string. Otherwise,
|
||||
advance the buffer past the end of the null terminated
|
||||
string.
|
||||
*/
|
||||
if (str == NULL)
|
||||
len= *string_length= *max_bytes_available;
|
||||
else
|
||||
len= (*string_length= (size_t)(str - *buffer)) + 1;
|
||||
|
||||
str= *buffer;
|
||||
*buffer+= len;
|
||||
*max_bytes_available-= len;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
@ -696,7 +755,7 @@ char *get_null_terminated_string(char **buffer,
|
|||
@param buffer[in, out] The buffer to scan; updates position after scan.
|
||||
@param max_bytes_available[in, out] Limit the number of bytes to scan
|
||||
@param string_length[out] Number of characters scanned
|
||||
|
||||
|
||||
@remark In case the length is zero, then the total size of the string is
|
||||
considered to be 1 byte; the size byte.
|
||||
|
||||
|
@ -773,7 +832,7 @@ static int check_connection(THD *thd)
|
|||
|
||||
if (vio_peer_addr(net->vio, ip, &thd->peer_port))
|
||||
{
|
||||
my_error(ER_BAD_HOST_ERROR, MYF(0), thd->main_security_ctx.host_or_ip);
|
||||
my_error(ER_BAD_HOST_ERROR, MYF(0));
|
||||
return 1;
|
||||
}
|
||||
if (!(thd->main_security_ctx.ip= my_strdup(ip,MYF(MY_WME))))
|
||||
|
@ -855,7 +914,7 @@ static int check_connection(THD *thd)
|
|||
part at the end of packet.
|
||||
*/
|
||||
end= strmake(end, thd->scramble, SCRAMBLE_LENGTH_323) + 1;
|
||||
|
||||
|
||||
int2store(end, server_capabilites);
|
||||
/* write server characteristics: up to 16 bytes allowed */
|
||||
end[2]=(char) default_charset_info->number;
|
||||
|
@ -873,8 +932,7 @@ static int check_connection(THD *thd)
|
|||
pkt_len < MIN_HANDSHAKE_SIZE)
|
||||
{
|
||||
inc_host_errors(&thd->remote.sin_addr);
|
||||
my_error(ER_HANDSHAKE_ERROR, MYF(0),
|
||||
thd->main_security_ctx.host_or_ip);
|
||||
my_error(ER_HANDSHAKE_ERROR, MYF(0));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -918,7 +976,7 @@ static int check_connection(THD *thd)
|
|||
if (!ssl_acceptor_fd)
|
||||
{
|
||||
inc_host_errors(&thd->remote.sin_addr);
|
||||
my_error(ER_HANDSHAKE_ERROR, MYF(0), thd->main_security_ctx.host_or_ip);
|
||||
my_error(ER_HANDSHAKE_ERROR, MYF(0));
|
||||
return 1;
|
||||
}
|
||||
DBUG_PRINT("info", ("IO layer change in progress..."));
|
||||
|
@ -926,7 +984,7 @@ static int check_connection(THD *thd)
|
|||
{
|
||||
DBUG_PRINT("error", ("Failed to accept new SSL connection"));
|
||||
inc_host_errors(&thd->remote.sin_addr);
|
||||
my_error(ER_HANDSHAKE_ERROR, MYF(0), thd->main_security_ctx.host_or_ip);
|
||||
my_error(ER_HANDSHAKE_ERROR, MYF(0));
|
||||
return 1;
|
||||
}
|
||||
DBUG_PRINT("info", ("Reading user information over SSL layer"));
|
||||
|
@ -936,7 +994,7 @@ static int check_connection(THD *thd)
|
|||
DBUG_PRINT("error", ("Failed to read user information (pkt_len= %lu)",
|
||||
pkt_len));
|
||||
inc_host_errors(&thd->remote.sin_addr);
|
||||
my_error(ER_HANDSHAKE_ERROR, MYF(0), thd->main_security_ctx.host_or_ip);
|
||||
my_error(ER_HANDSHAKE_ERROR, MYF(0));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -945,7 +1003,7 @@ static int check_connection(THD *thd)
|
|||
if (end > (char *)net->read_pos + pkt_len)
|
||||
{
|
||||
inc_host_errors(&thd->remote.sin_addr);
|
||||
my_error(ER_HANDSHAKE_ERROR, MYF(0), thd->main_security_ctx.host_or_ip);
|
||||
my_error(ER_HANDSHAKE_ERROR, MYF(0));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -954,7 +1012,20 @@ static int check_connection(THD *thd)
|
|||
if ((thd->client_capabilities & CLIENT_TRANSACTIONS) &&
|
||||
opt_using_transactions)
|
||||
net->return_status= &thd->server_status;
|
||||
|
||||
|
||||
/*
|
||||
The 4.0 and 4.1 versions of the protocol differ on how strings
|
||||
are terminated. In the 4.0 version, if a string is at the end
|
||||
of the packet, the string is not null terminated. Do not assume
|
||||
that the returned string is always null terminated.
|
||||
*/
|
||||
get_proto_string_func_t get_string;
|
||||
|
||||
if (thd->client_capabilities & CLIENT_PROTOCOL_41)
|
||||
get_string= get_41_protocol_string;
|
||||
else
|
||||
get_string= get_40_protocol_string;
|
||||
|
||||
/*
|
||||
In order to safely scan a head for '\0' string terminators
|
||||
we must keep track of how many bytes remain in the allocated
|
||||
|
@ -963,12 +1034,11 @@ static int check_connection(THD *thd)
|
|||
size_t bytes_remaining_in_packet= pkt_len - (end - (char *)net->read_pos);
|
||||
|
||||
size_t user_len;
|
||||
char *user= get_null_terminated_string(&end, &bytes_remaining_in_packet,
|
||||
&user_len);
|
||||
char *user= get_string(&end, &bytes_remaining_in_packet, &user_len);
|
||||
if (user == NULL)
|
||||
{
|
||||
inc_host_errors(&thd->remote.sin_addr);
|
||||
my_error(ER_HANDSHAKE_ERROR, MYF(0), thd->main_security_ctx.host_or_ip);
|
||||
my_error(ER_HANDSHAKE_ERROR, MYF(0));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -993,14 +1063,13 @@ static int check_connection(THD *thd)
|
|||
/*
|
||||
Old passwords are zero terminated strings.
|
||||
*/
|
||||
passwd= get_null_terminated_string(&end, &bytes_remaining_in_packet,
|
||||
&passwd_len);
|
||||
passwd= get_string(&end, &bytes_remaining_in_packet, &passwd_len);
|
||||
}
|
||||
|
||||
if (passwd == NULL)
|
||||
{
|
||||
inc_host_errors(&thd->remote.sin_addr);
|
||||
my_error(ER_HANDSHAKE_ERROR, MYF(0), thd->main_security_ctx.host_or_ip);
|
||||
my_error(ER_HANDSHAKE_ERROR, MYF(0));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1009,12 +1078,11 @@ static int check_connection(THD *thd)
|
|||
|
||||
if (thd->client_capabilities & CLIENT_CONNECT_WITH_DB)
|
||||
{
|
||||
db= get_null_terminated_string(&end, &bytes_remaining_in_packet,
|
||||
&db_len);
|
||||
db= get_string(&end, &bytes_remaining_in_packet, &db_len);
|
||||
if (db == NULL)
|
||||
{
|
||||
inc_host_errors(&thd->remote.sin_addr);
|
||||
my_error(ER_HANDSHAKE_ERROR, MYF(0), thd->main_security_ctx.host_or_ip);
|
||||
my_error(ER_HANDSHAKE_ERROR, MYF(0));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -1023,19 +1091,24 @@ static int check_connection(THD *thd)
|
|||
char user_buff[USERNAME_LENGTH + 1]; // buffer to store user in utf8
|
||||
uint dummy_errors;
|
||||
|
||||
/* Since 4.1 all database names are stored in utf8 */
|
||||
/*
|
||||
Copy and convert the user and database names to the character set used
|
||||
by the server. Since 4.1 all database names are stored in UTF-8. Also,
|
||||
ensure that the names are properly null-terminated as this is relied
|
||||
upon later.
|
||||
*/
|
||||
if (db)
|
||||
{
|
||||
db_buff[copy_and_convert(db_buff, sizeof(db_buff)-1,
|
||||
system_charset_info,
|
||||
db, db_len,
|
||||
thd->charset(), &dummy_errors)]= 0;
|
||||
db_len= copy_and_convert(db_buff, sizeof(db_buff)-1, system_charset_info,
|
||||
db, db_len, thd->charset(), &dummy_errors);
|
||||
db_buff[db_len]= '\0';
|
||||
db= db_buff;
|
||||
}
|
||||
|
||||
user_buff[user_len= copy_and_convert(user_buff, sizeof(user_buff)-1,
|
||||
system_charset_info, user, user_len,
|
||||
thd->charset(), &dummy_errors)]= '\0';
|
||||
user_len= copy_and_convert(user_buff, sizeof(user_buff)-1,
|
||||
system_charset_info, user, user_len,
|
||||
thd->charset(), &dummy_errors);
|
||||
user_buff[user_len]= '\0';
|
||||
user= user_buff;
|
||||
|
||||
/* If username starts and ends in "'", chop them off */
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#ifdef __WIN__
|
||||
#include <direct.h>
|
||||
#endif
|
||||
#include "debug_sync.h"
|
||||
|
||||
#define MAX_DROP_TABLE_Q_LEN 1024
|
||||
|
||||
|
@ -1702,6 +1703,8 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch)
|
|||
}
|
||||
#endif
|
||||
|
||||
DEBUG_SYNC(thd, "before_db_dir_check");
|
||||
|
||||
if (check_db_dir_existence(new_db_file_name.str))
|
||||
{
|
||||
if (force_switch)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
|
||||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -11,8 +11,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
/* Insert of records */
|
||||
|
||||
|
@ -3780,7 +3779,7 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
|
|||
|
||||
if (table->s->fields < values.elements)
|
||||
{
|
||||
my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), 1);
|
||||
my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), 1L);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -11,7 +11,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
#define MYSQL_LEX 1
|
||||
#include "mysql_priv.h"
|
||||
|
@ -3981,8 +3981,7 @@ end_with_restore_list:
|
|||
hostname_requires_resolving(user->host.str))
|
||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_WARN_HOSTNAME_WONT_WORK,
|
||||
ER(ER_WARN_HOSTNAME_WONT_WORK),
|
||||
user->host.str);
|
||||
ER(ER_WARN_HOSTNAME_WONT_WORK));
|
||||
// Are we trying to change a password of another user
|
||||
DBUG_ASSERT(user->host.str != 0);
|
||||
if (strcmp(thd->security_ctx->user, user->user.str) ||
|
||||
|
@ -5889,7 +5888,7 @@ mysql_new_select(LEX *lex, bool move_down)
|
|||
lex->nest_level++;
|
||||
if (lex->nest_level > (int) MAX_SELECT_NESTING)
|
||||
{
|
||||
my_error(ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT,MYF(0),MAX_SELECT_NESTING);
|
||||
my_error(ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT, MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
select_lex->nest_level= lex->nest_level;
|
||||
|
@ -6936,7 +6935,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
|
|||
When an error is returned, my_message may have not been called and
|
||||
the client will hang waiting for a response.
|
||||
*/
|
||||
my_error(ER_UNKNOWN_ERROR, MYF(0), "FLUSH PRIVILEGES failed");
|
||||
my_error(ER_UNKNOWN_ERROR, MYF(0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7973,10 +7972,14 @@ bool parse_sql(THD *thd,
|
|||
|
||||
bool mysql_parse_status= MYSQLparse(thd) != 0;
|
||||
|
||||
/* Check that if MYSQLparse() failed, thd->is_error() is set. */
|
||||
/*
|
||||
Check that if MYSQLparse() failed, thd->is_error() is set (unless
|
||||
we have an error handler installed, which might have silenced error).
|
||||
*/
|
||||
|
||||
DBUG_ASSERT(!mysql_parse_status ||
|
||||
(mysql_parse_status && thd->is_error()));
|
||||
(mysql_parse_status && thd->is_error()) ||
|
||||
(mysql_parse_status && thd->get_internal_handler()));
|
||||
|
||||
/* Reset parser state. */
|
||||
|
||||
|
|
|
@ -6571,7 +6571,7 @@ void set_key_field_ptr(KEY *key_info, const uchar *new_buf,
|
|||
|
||||
void mem_alloc_error(size_t size)
|
||||
{
|
||||
my_error(ER_OUTOFMEMORY, MYF(0), size);
|
||||
my_error(ER_OUTOFMEMORY, MYF(0), static_cast<int>(size));
|
||||
}
|
||||
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2005 MySQL AB
|
||||
/* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -11,7 +11,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
#include "mysql_priv.h"
|
||||
#include <my_pthread.h>
|
||||
|
@ -495,9 +495,11 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
|
|||
{
|
||||
free_plugin_mem(&plugin_dl);
|
||||
if (report & REPORT_TO_USER)
|
||||
my_error(ER_OUTOFMEMORY, MYF(0), plugin_dl.dl.length);
|
||||
my_error(ER_OUTOFMEMORY, MYF(0),
|
||||
static_cast<int>(plugin_dl.dl.length));
|
||||
if (report & REPORT_TO_LOG)
|
||||
sql_print_error(ER(ER_OUTOFMEMORY), plugin_dl.dl.length);
|
||||
sql_print_error(ER(ER_OUTOFMEMORY),
|
||||
static_cast<int>(plugin_dl.dl.length));
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
/*
|
||||
|
@ -520,9 +522,10 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
|
|||
{
|
||||
free_plugin_mem(&plugin_dl);
|
||||
if (report & REPORT_TO_USER)
|
||||
my_error(ER_OUTOFMEMORY, MYF(0), plugin_dl.dl.length);
|
||||
my_error(ER_OUTOFMEMORY, MYF(0), static_cast<int>(plugin_dl.dl.length));
|
||||
if (report & REPORT_TO_LOG)
|
||||
sql_print_error(ER(ER_OUTOFMEMORY), plugin_dl.dl.length);
|
||||
sql_print_error(ER(ER_OUTOFMEMORY),
|
||||
static_cast<int>(plugin_dl.dl.length));
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
plugin_dl.dl.length= copy_and_convert(plugin_dl.dl.str, plugin_dl.dl.length,
|
||||
|
@ -534,9 +537,11 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
|
|||
{
|
||||
free_plugin_mem(&plugin_dl);
|
||||
if (report & REPORT_TO_USER)
|
||||
my_error(ER_OUTOFMEMORY, MYF(0), sizeof(struct st_plugin_dl));
|
||||
my_error(ER_OUTOFMEMORY, MYF(0),
|
||||
static_cast<int>(sizeof(struct st_plugin_dl)));
|
||||
if (report & REPORT_TO_LOG)
|
||||
sql_print_error(ER(ER_OUTOFMEMORY), sizeof(struct st_plugin_dl));
|
||||
sql_print_error(ER(ER_OUTOFMEMORY),
|
||||
static_cast<int>(sizeof(struct st_plugin_dl)));
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
DBUG_RETURN(tmp);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
/* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -11,7 +11,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
/**
|
||||
@file
|
||||
|
@ -1375,7 +1375,7 @@ static int mysql_test_select(Prepared_statement *stmt,
|
|||
|
||||
if (!lex->result && !(lex->result= new (stmt->mem_root) select_send))
|
||||
{
|
||||
my_error(ER_OUTOFMEMORY, MYF(0), sizeof(select_send));
|
||||
my_error(ER_OUTOFMEMORY, MYF(0), static_cast<int>(sizeof(select_send)));
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -2478,7 +2478,7 @@ void mysqld_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
|
|||
if (!(stmt= find_prepared_statement(thd, stmt_id)))
|
||||
{
|
||||
char llbuf[22];
|
||||
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), sizeof(llbuf),
|
||||
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), static_cast<int>(sizeof(llbuf)),
|
||||
llstr(stmt_id, llbuf), "mysqld_stmt_execute");
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
@ -2536,7 +2536,7 @@ void mysql_sql_stmt_execute(THD *thd)
|
|||
if (!(stmt= (Prepared_statement*) thd->stmt_map.find_by_name(name)))
|
||||
{
|
||||
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0),
|
||||
name->length, name->str, "EXECUTE");
|
||||
static_cast<int>(name->length), name->str, "EXECUTE");
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
@ -2578,7 +2578,7 @@ void mysqld_stmt_fetch(THD *thd, char *packet, uint packet_length)
|
|||
if (!(stmt= find_prepared_statement(thd, stmt_id)))
|
||||
{
|
||||
char llbuf[22];
|
||||
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), sizeof(llbuf),
|
||||
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), static_cast<int>(sizeof(llbuf)),
|
||||
llstr(stmt_id, llbuf), "mysqld_stmt_fetch");
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
@ -2645,7 +2645,7 @@ void mysqld_stmt_reset(THD *thd, char *packet)
|
|||
if (!(stmt= find_prepared_statement(thd, stmt_id)))
|
||||
{
|
||||
char llbuf[22];
|
||||
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), sizeof(llbuf),
|
||||
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), static_cast<int>(sizeof(llbuf)),
|
||||
llstr(stmt_id, llbuf), "mysqld_stmt_reset");
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
@ -2720,7 +2720,7 @@ void mysql_sql_stmt_close(THD *thd)
|
|||
|
||||
if (! (stmt= (Prepared_statement*) thd->stmt_map.find_by_name(name)))
|
||||
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0),
|
||||
name->length, name->str, "DEALLOCATE PREPARE");
|
||||
static_cast<int>(name->length), name->str, "DEALLOCATE PREPARE");
|
||||
else if (stmt->is_in_use())
|
||||
my_error(ER_PS_NO_RECURSION, MYF(0));
|
||||
else
|
||||
|
|
316
sql/sql_show.cc
316
sql/sql_show.cc
|
@ -2428,12 +2428,11 @@ bool schema_table_store_record(THD *thd, TABLE *table)
|
|||
}
|
||||
|
||||
|
||||
int make_table_list(THD *thd, SELECT_LEX *sel,
|
||||
LEX_STRING *db_name, LEX_STRING *table_name)
|
||||
static int make_table_list(THD *thd, SELECT_LEX *sel,
|
||||
LEX_STRING *db_name, LEX_STRING *table_name)
|
||||
{
|
||||
Table_ident *table_ident;
|
||||
table_ident= new Table_ident(thd, *db_name, *table_name, 1);
|
||||
sel->init_query();
|
||||
if (!sel->add_table_to_list(thd, table_ident, 0, 0, TL_READ))
|
||||
return 1;
|
||||
return 0;
|
||||
|
@ -3003,79 +3002,179 @@ make_table_name_list(THD *thd, List<LEX_STRING> *table_names, LEX *lex,
|
|||
|
||||
|
||||
/**
|
||||
@brief Fill I_S table for SHOW COLUMNS|INDEX commands
|
||||
Fill I_S table with data obtained by performing full-blown table open.
|
||||
|
||||
@param[in] thd thread handler
|
||||
@param[in] tables TABLE_LIST for I_S table
|
||||
@param[in] schema_table pointer to I_S structure
|
||||
@param[in] open_tables_state_backup pointer to Open_tables_state object
|
||||
which is used to save|restore original
|
||||
status of variables related to
|
||||
open tables state
|
||||
@param thd Thread handler.
|
||||
@param is_show_fields_or_keys Indicates whether it is a legacy SHOW
|
||||
COLUMNS or SHOW KEYS statement.
|
||||
@param table TABLE object for I_S table to be filled.
|
||||
@param schema_table I_S table description structure.
|
||||
@param orig_db_name Database name.
|
||||
@param orig_table_name Table name.
|
||||
@param open_tables_state_backup Open_tables_state object which is used
|
||||
to save/restore original status of
|
||||
variables related to open tables state.
|
||||
|
||||
@return Operation status
|
||||
@retval 0 success
|
||||
@retval 1 error
|
||||
@retval FALSE - Success.
|
||||
@retval TRUE - Failure.
|
||||
*/
|
||||
|
||||
static int
|
||||
fill_schema_show_cols_or_idxs(THD *thd, TABLE_LIST *tables,
|
||||
ST_SCHEMA_TABLE *schema_table,
|
||||
Open_tables_state *open_tables_state_backup)
|
||||
static bool
|
||||
fill_schema_table_by_open(THD *thd, bool is_show_fields_or_keys,
|
||||
TABLE *table, ST_SCHEMA_TABLE *schema_table,
|
||||
LEX_STRING *orig_db_name,
|
||||
LEX_STRING *orig_table_name,
|
||||
Open_tables_state *open_tables_state_backup)
|
||||
{
|
||||
LEX *lex= thd->lex;
|
||||
bool res;
|
||||
LEX_STRING tmp_lex_string, tmp_lex_string1, *db_name, *table_name;
|
||||
enum_sql_command save_sql_command= lex->sql_command;
|
||||
TABLE_LIST *show_table_list= tables->schema_select_lex->table_list.first;
|
||||
TABLE *table= tables->table;
|
||||
int error= 1;
|
||||
DBUG_ENTER("fill_schema_show");
|
||||
Query_arena i_s_arena(thd->mem_root,
|
||||
Query_arena::CONVENTIONAL_EXECUTION),
|
||||
backup_arena, *old_arena;
|
||||
LEX *old_lex= thd->lex, temp_lex, *lex;
|
||||
LEX_STRING db_name, table_name;
|
||||
TABLE_LIST *table_list;
|
||||
bool result= true;
|
||||
|
||||
lex->all_selects_list= tables->schema_select_lex;
|
||||
/*
|
||||
Restore thd->temporary_tables to be able to process
|
||||
temporary tables(only for 'show index' & 'show columns').
|
||||
This should be changed when processing of temporary tables for
|
||||
I_S tables will be done.
|
||||
When a view is opened its structures are allocated on a permanent
|
||||
statement arena and linked into the LEX tree for the current statement
|
||||
(this happens even in cases when view is handled through TEMPTABLE
|
||||
algorithm).
|
||||
|
||||
To prevent this process from unnecessary hogging of memory in the permanent
|
||||
arena of our I_S query and to avoid damaging its LEX we use temporary
|
||||
arena and LEX for table/view opening.
|
||||
|
||||
Use temporary arena instead of statement permanent arena. Also make
|
||||
it active arena and save original one for successive restoring.
|
||||
*/
|
||||
thd->temporary_tables= open_tables_state_backup->temporary_tables;
|
||||
old_arena= thd->stmt_arena;
|
||||
thd->stmt_arena= &i_s_arena;
|
||||
thd->set_n_backup_active_arena(&i_s_arena, &backup_arena);
|
||||
|
||||
/* Prepare temporary LEX. */
|
||||
thd->lex= lex= &temp_lex;
|
||||
lex_start(thd);
|
||||
|
||||
/* Disable constant subquery evaluation as we won't be locking tables. */
|
||||
lex->context_analysis_only= CONTEXT_ANALYSIS_ONLY_VIEW;
|
||||
|
||||
/*
|
||||
Some of process_table() functions rely on wildcard being passed from
|
||||
old LEX (or at least being initialized).
|
||||
*/
|
||||
lex->wild= old_lex->wild;
|
||||
|
||||
/*
|
||||
Since make_table_list() might change database and table name passed
|
||||
to it we create copies of orig_db_name and orig_table_name here.
|
||||
These copies are used for make_table_list() while unaltered values
|
||||
are passed to process_table() functions.
|
||||
*/
|
||||
if (!thd->make_lex_string(&db_name, orig_db_name->str,
|
||||
orig_db_name->length, FALSE) ||
|
||||
!thd->make_lex_string(&table_name, orig_table_name->str,
|
||||
orig_table_name->length, FALSE))
|
||||
goto end;
|
||||
|
||||
/*
|
||||
Create table list element for table to be open. Link it with the
|
||||
temporary LEX. The latter is required to correctly open views and
|
||||
produce table describing their structure.
|
||||
*/
|
||||
if (make_table_list(thd, &lex->select_lex, &db_name, &table_name))
|
||||
goto end;
|
||||
|
||||
table_list= lex->select_lex.table_list.first;
|
||||
|
||||
if (is_show_fields_or_keys)
|
||||
{
|
||||
/*
|
||||
Restore thd->temporary_tables to be able to process
|
||||
temporary tables (only for 'show index' & 'show columns').
|
||||
This should be changed when processing of temporary tables for
|
||||
I_S tables will be done.
|
||||
*/
|
||||
thd->temporary_tables= open_tables_state_backup->temporary_tables;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
Apply optimization flags for table opening which are relevant for
|
||||
this I_S table. We can't do this for SHOW COLUMNS/KEYS because of
|
||||
backward compatibility.
|
||||
*/
|
||||
table_list->i_s_requested_object= schema_table->i_s_requested_object;
|
||||
}
|
||||
|
||||
/*
|
||||
Let us set fake sql_command so views won't try to merge
|
||||
themselves into main statement. If we don't do this,
|
||||
SELECT * from information_schema.xxxx will cause problems.
|
||||
SQLCOM_SHOW_FIELDS is used because it satisfies 'only_view_structure()'
|
||||
SQLCOM_SHOW_FIELDS is used because it satisfies
|
||||
'only_view_structure()'.
|
||||
*/
|
||||
lex->sql_command= SQLCOM_SHOW_FIELDS;
|
||||
res= open_normal_and_derived_tables(thd, show_table_list,
|
||||
MYSQL_LOCK_IGNORE_FLUSH);
|
||||
lex->sql_command= save_sql_command;
|
||||
|
||||
result= open_normal_and_derived_tables(thd, table_list,
|
||||
MYSQL_LOCK_IGNORE_FLUSH);
|
||||
|
||||
/*
|
||||
get_all_tables() returns 1 on failure and 0 on success thus
|
||||
return only these and not the result code of ::process_table()
|
||||
|
||||
We should use show_table_list->alias instead of
|
||||
show_table_list->table_name because table_name
|
||||
could be changed during opening of I_S tables. It's safe
|
||||
to use alias because alias contains original table name
|
||||
in this case(this part of code is used only for
|
||||
'show columns' & 'show statistics' commands).
|
||||
Restore old value of sql_command back as it is being looked at in
|
||||
process_table() function.
|
||||
*/
|
||||
table_name= thd->make_lex_string(&tmp_lex_string1, show_table_list->alias,
|
||||
strlen(show_table_list->alias), FALSE);
|
||||
if (!show_table_list->view)
|
||||
db_name= thd->make_lex_string(&tmp_lex_string, show_table_list->db,
|
||||
show_table_list->db_length, FALSE);
|
||||
else
|
||||
db_name= &show_table_list->view_db;
|
||||
|
||||
lex->sql_command= old_lex->sql_command;
|
||||
|
||||
error= test(schema_table->process_table(thd, show_table_list,
|
||||
table, res, db_name,
|
||||
table_name));
|
||||
thd->temporary_tables= 0;
|
||||
close_tables_for_reopen(thd, &show_table_list);
|
||||
DBUG_RETURN(error);
|
||||
/*
|
||||
XXX: show_table_list has a flag i_is_requested,
|
||||
and when it's set, open_normal_and_derived_tables()
|
||||
can return an error without setting an error message
|
||||
in THD, which is a hack. This is why we have to
|
||||
check for res, then for thd->is_error() and only then
|
||||
for thd->main_da.sql_errno().
|
||||
|
||||
Again we don't do this for SHOW COLUMNS/KEYS because
|
||||
of backward compatibility.
|
||||
*/
|
||||
if (!is_show_fields_or_keys && result && thd->is_error() &&
|
||||
thd->main_da.sql_errno() == ER_NO_SUCH_TABLE)
|
||||
{
|
||||
/*
|
||||
Hide error for a non-existing table.
|
||||
For example, this error can occur when we use a where condition
|
||||
with a db name and table, but the table does not exist.
|
||||
*/
|
||||
result= 0;
|
||||
thd->clear_error();
|
||||
}
|
||||
else
|
||||
{
|
||||
result= schema_table->process_table(thd, table_list,
|
||||
table, result,
|
||||
orig_db_name,
|
||||
orig_table_name);
|
||||
}
|
||||
|
||||
end:
|
||||
lex->unit.cleanup();
|
||||
|
||||
/* Restore original LEX value, statement's arena and THD arena values. */
|
||||
lex_end(thd->lex);
|
||||
|
||||
if (i_s_arena.free_list)
|
||||
i_s_arena.free_items();
|
||||
|
||||
/*
|
||||
For safety reset list of open temporary tables before closing
|
||||
all tables open within this Open_tables_state.
|
||||
*/
|
||||
thd->temporary_tables= NULL;
|
||||
close_thread_tables(thd);
|
||||
thd->lex= old_lex;
|
||||
|
||||
thd->stmt_arena= old_arena;
|
||||
thd->restore_active_arena(&i_s_arena, &backup_arena);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3300,11 +3399,8 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
|
|||
{
|
||||
LEX *lex= thd->lex;
|
||||
TABLE *table= tables->table;
|
||||
SELECT_LEX *old_all_select_lex= lex->all_selects_list;
|
||||
enum_sql_command save_sql_command= lex->sql_command;
|
||||
SELECT_LEX *lsel= tables->schema_select_lex;
|
||||
ST_SCHEMA_TABLE *schema_table= tables->schema_table;
|
||||
SELECT_LEX sel;
|
||||
LOOKUP_FIELD_VALUES lookup_field_vals;
|
||||
LEX_STRING *db_name, *table_name;
|
||||
bool with_i_schema;
|
||||
|
@ -3312,20 +3408,14 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
|
|||
List<LEX_STRING> db_names;
|
||||
List_iterator_fast<LEX_STRING> it(db_names);
|
||||
COND *partial_cond= 0;
|
||||
uint derived_tables= lex->derived_tables;
|
||||
int error= 1;
|
||||
Open_tables_state open_tables_state_backup;
|
||||
uint8 save_context_analysis_only= lex->context_analysis_only;
|
||||
Query_tables_list query_tables_list_backup;
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
Security_context *sctx= thd->security_ctx;
|
||||
#endif
|
||||
uint table_open_method;
|
||||
DBUG_ENTER("get_all_tables");
|
||||
|
||||
lex->context_analysis_only|= CONTEXT_ANALYSIS_ONLY_VIEW;
|
||||
lex->reset_n_backup_query_tables_list(&query_tables_list_backup);
|
||||
|
||||
/*
|
||||
We should not introduce deadlocks even if we already have some
|
||||
tables open and locked, since we won't lock tables which we will
|
||||
|
@ -3340,8 +3430,18 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
|
|||
*/
|
||||
if (lsel && lsel->table_list.first)
|
||||
{
|
||||
error= fill_schema_show_cols_or_idxs(thd, tables, schema_table,
|
||||
&open_tables_state_backup);
|
||||
LEX_STRING db_name, table_name;
|
||||
|
||||
db_name.str= lsel->table_list.first->db;
|
||||
db_name.length= lsel->table_list.first->db_length;
|
||||
|
||||
table_name.str= lsel->table_list.first->table_name;
|
||||
table_name.length= lsel->table_list.first->table_name_length;
|
||||
|
||||
error= fill_schema_table_by_open(thd, TRUE,
|
||||
table, schema_table,
|
||||
&db_name, &table_name,
|
||||
&open_tables_state_backup);
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -3399,12 +3499,6 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
|
|||
it.rewind(); /* To get access to new elements in basis list */
|
||||
while ((db_name= it++))
|
||||
{
|
||||
LEX_STRING orig_db_name;
|
||||
|
||||
/* db_name can be changed in make_table_list() func */
|
||||
if (!thd->make_lex_string(&orig_db_name, db_name->str,
|
||||
db_name->length, FALSE))
|
||||
goto err;
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
if (!(check_access(thd,SELECT_ACL, db_name->str,
|
||||
&thd->col_access, 0, 1, with_i_schema) ||
|
||||
|
@ -3466,64 +3560,14 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
|
|||
continue;
|
||||
}
|
||||
|
||||
int res;
|
||||
LEX_STRING tmp_lex_string;
|
||||
/*
|
||||
Set the parent lex of 'sel' because it is needed by
|
||||
sel.init_query() which is called inside make_table_list.
|
||||
*/
|
||||
thd->no_warnings_for_error= 1;
|
||||
sel.parent_lex= lex;
|
||||
if (make_table_list(thd, &sel, db_name, table_name))
|
||||
goto err;
|
||||
TABLE_LIST *show_table_list= sel.table_list.first;
|
||||
lex->all_selects_list= &sel;
|
||||
lex->derived_tables= 0;
|
||||
lex->sql_command= SQLCOM_SHOW_FIELDS;
|
||||
show_table_list->i_s_requested_object=
|
||||
schema_table->i_s_requested_object;
|
||||
|
||||
DEBUG_SYNC(thd, "before_open_in_get_all_tables");
|
||||
res= open_normal_and_derived_tables(thd, show_table_list,
|
||||
MYSQL_LOCK_IGNORE_FLUSH);
|
||||
lex->sql_command= save_sql_command;
|
||||
/*
|
||||
XXX: show_table_list has a flag i_is_requested,
|
||||
and when it's set, open_normal_and_derived_tables()
|
||||
can return an error without setting an error message
|
||||
in THD, which is a hack. This is why we have to
|
||||
check for res, then for thd->is_error() only then
|
||||
for thd->main_da.sql_errno().
|
||||
*/
|
||||
if (res && thd->is_error() &&
|
||||
thd->main_da.sql_errno() == ER_NO_SUCH_TABLE)
|
||||
{
|
||||
/*
|
||||
Hide error for not existing table.
|
||||
This error can occur for example when we use
|
||||
where condition with db name and table name and this
|
||||
table does not exist.
|
||||
*/
|
||||
res= 0;
|
||||
thd->clear_error();
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
We should use show_table_list->alias instead of
|
||||
show_table_list->table_name because table_name
|
||||
could be changed during opening of I_S tables. It's safe
|
||||
to use alias because alias contains original table name
|
||||
in this case.
|
||||
*/
|
||||
thd->make_lex_string(&tmp_lex_string, show_table_list->alias,
|
||||
strlen(show_table_list->alias), FALSE);
|
||||
res= schema_table->process_table(thd, show_table_list, table,
|
||||
res, &orig_db_name,
|
||||
&tmp_lex_string);
|
||||
close_tables_for_reopen(thd, &show_table_list);
|
||||
}
|
||||
DBUG_ASSERT(!lex->query_tables_own_last);
|
||||
if (res)
|
||||
|
||||
if (fill_schema_table_by_open(thd, FALSE,
|
||||
table, schema_table,
|
||||
db_name, table_name,
|
||||
&open_tables_state_backup))
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
@ -3539,11 +3583,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
|
|||
error= 0;
|
||||
err:
|
||||
thd->restore_backup_open_tables_state(&open_tables_state_backup);
|
||||
lex->restore_backup_query_tables_list(&query_tables_list_backup);
|
||||
lex->derived_tables= derived_tables;
|
||||
lex->all_selects_list= old_all_select_lex;
|
||||
lex->context_analysis_only= save_context_analysis_only;
|
||||
lex->sql_command= save_sql_command;
|
||||
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
|
@ -7150,7 +7190,7 @@ static TABLE_LIST *get_trigger_table_impl(
|
|||
|
||||
if (!(table= (TABLE_LIST *)thd->calloc(sizeof(TABLE_LIST))))
|
||||
{
|
||||
my_error(ER_OUTOFMEMORY, MYF(0), sizeof(TABLE_LIST));
|
||||
my_error(ER_OUTOFMEMORY, MYF(0), static_cast<int>(sizeof(TABLE_LIST)));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -2452,7 +2452,8 @@ int prepare_create_field(Create_field *sql_field,
|
|||
MAX_FIELD_CHARLENGTH)
|
||||
{
|
||||
my_printf_error(ER_TOO_BIG_FIELDLENGTH, ER(ER_TOO_BIG_FIELDLENGTH),
|
||||
MYF(0), sql_field->field_name, MAX_FIELD_CHARLENGTH);
|
||||
MYF(0), sql_field->field_name,
|
||||
static_cast<ulong>(MAX_FIELD_CHARLENGTH));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
}
|
||||
|
@ -3504,7 +3505,8 @@ static bool prepare_blob_field(THD *thd, Create_field *sql_field)
|
|||
MODE_STRICT_ALL_TABLES)))
|
||||
{
|
||||
my_error(ER_TOO_BIG_FIELDLENGTH, MYF(0), sql_field->field_name,
|
||||
MAX_FIELD_VARCHARLENGTH / sql_field->charset->mbmaxlen);
|
||||
static_cast<ulong>(MAX_FIELD_VARCHARLENGTH /
|
||||
sql_field->charset->mbmaxlen));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
sql_field->sql_type= MYSQL_TYPE_BLOB;
|
||||
|
@ -6168,6 +6170,12 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
|||
if (drop)
|
||||
{
|
||||
drop_it.remove();
|
||||
/*
|
||||
ALTER TABLE DROP COLUMN always changes table data even in cases
|
||||
when new version of the table has the same structure as the old
|
||||
one.
|
||||
*/
|
||||
alter_info->change_level= ALTER_TABLE_DATA_CHANGED;
|
||||
continue;
|
||||
}
|
||||
/* Check if field is changed */
|
||||
|
@ -6245,7 +6253,14 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
|||
if (!def->after)
|
||||
new_create_list.push_back(def);
|
||||
else if (def->after == first_keyword)
|
||||
{
|
||||
new_create_list.push_front(def);
|
||||
/*
|
||||
Re-ordering columns in table can't be done using in-place algorithm
|
||||
as it always changes table data.
|
||||
*/
|
||||
alter_info->change_level= ALTER_TABLE_DATA_CHANGED;
|
||||
}
|
||||
else
|
||||
{
|
||||
Create_field *find;
|
||||
|
@ -6261,6 +6276,10 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
|||
goto err;
|
||||
}
|
||||
find_it.after(def); // Put element after this
|
||||
/*
|
||||
Re-ordering columns in table can't be done using in-place algorithm
|
||||
as it always changes table data.
|
||||
*/
|
||||
alter_info->change_level= ALTER_TABLE_DATA_CHANGED;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "sp_head.h"
|
||||
#include "sql_trigger.h"
|
||||
#include "parse_file.h"
|
||||
#include <mysys_err.h>
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
|
@ -292,6 +293,52 @@ private:
|
|||
};
|
||||
|
||||
|
||||
/**
|
||||
An error handler that catches all non-OOM errors which can occur during
|
||||
parsing of trigger body. Such errors are ignored and corresponding error
|
||||
message is used to construct a more verbose error message which contains
|
||||
name of problematic trigger. This error message is later emitted when
|
||||
one tries to perform DML or some of DDL on this table.
|
||||
Also, if possible, grabs name of the trigger being parsed so it can be
|
||||
used to correctly drop problematic trigger.
|
||||
*/
|
||||
class Deprecated_trigger_syntax_handler : public Internal_error_handler
|
||||
{
|
||||
private:
|
||||
|
||||
char m_message[MYSQL_ERRMSG_SIZE];
|
||||
LEX_STRING *m_trigger_name;
|
||||
|
||||
public:
|
||||
|
||||
Deprecated_trigger_syntax_handler() : m_trigger_name(NULL) {}
|
||||
|
||||
virtual bool handle_error(uint sql_errno, const char *message,
|
||||
MYSQL_ERROR::enum_warning_level level, THD *thd)
|
||||
{
|
||||
if (sql_errno != EE_OUTOFMEMORY &&
|
||||
sql_errno != ER_OUT_OF_RESOURCES)
|
||||
{
|
||||
if(thd->lex->spname)
|
||||
m_trigger_name= &thd->lex->spname->m_name;
|
||||
if (m_trigger_name)
|
||||
my_snprintf(m_message, sizeof(m_message),
|
||||
"Trigger '%s' has an error in its body: '%s'",
|
||||
m_trigger_name->str, message);
|
||||
else
|
||||
my_snprintf(m_message, sizeof(m_message),
|
||||
"Unknown trigger has an error in its body: '%s'",
|
||||
message);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
LEX_STRING *get_trigger_name() { return m_trigger_name; }
|
||||
char *get_error_message() { return m_message; }
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Create or drop trigger for table.
|
||||
|
||||
|
@ -575,6 +622,8 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
|
|||
LEX_STRING *trg_connection_cl_name;
|
||||
LEX_STRING *trg_db_cl_name;
|
||||
|
||||
if (check_for_broken_triggers())
|
||||
return true;
|
||||
|
||||
/* Trigger must be in the same schema as target table. */
|
||||
if (my_strcasecmp(table_alias_charset, table->s->db.str,
|
||||
|
@ -848,7 +897,7 @@ static bool rm_trigger_file(char *path, const char *db,
|
|||
@param path char buffer of size FN_REFLEN to be used
|
||||
for constructing path to .TRN file.
|
||||
@param db trigger's database name
|
||||
@param table_name trigger's name
|
||||
@param trigger_name trigger's name
|
||||
|
||||
@retval
|
||||
False success
|
||||
|
@ -1312,12 +1361,11 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
|
|||
lex_start(thd);
|
||||
thd->spcont= NULL;
|
||||
|
||||
if (parse_sql(thd, & parser_state, creation_ctx))
|
||||
{
|
||||
/* Currently sphead is always deleted in case of a parse error */
|
||||
DBUG_ASSERT(lex.sphead == 0);
|
||||
goto err_with_lex_cleanup;
|
||||
}
|
||||
Deprecated_trigger_syntax_handler error_handler;
|
||||
thd->push_internal_handler(&error_handler);
|
||||
bool parse_error= parse_sql(thd, & parser_state, creation_ctx);
|
||||
thd->pop_internal_handler();
|
||||
|
||||
/*
|
||||
Not strictly necessary to invoke this method here, since we know
|
||||
that we've parsed CREATE TRIGGER and not an
|
||||
|
@ -1328,6 +1376,52 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
|
|||
*/
|
||||
lex.set_trg_event_type_for_tables();
|
||||
|
||||
if (parse_error)
|
||||
{
|
||||
if (!triggers->m_has_unparseable_trigger)
|
||||
triggers->set_parse_error_message(error_handler.get_error_message());
|
||||
/* Currently sphead is always set to NULL in case of a parse error */
|
||||
DBUG_ASSERT(lex.sphead == 0);
|
||||
if (error_handler.get_trigger_name())
|
||||
{
|
||||
LEX_STRING *trigger_name;
|
||||
const LEX_STRING *orig_trigger_name= error_handler.get_trigger_name();
|
||||
|
||||
if (!(trigger_name= alloc_lex_string(&table->mem_root)) ||
|
||||
!(trigger_name->str= strmake_root(&table->mem_root,
|
||||
orig_trigger_name->str,
|
||||
orig_trigger_name->length)))
|
||||
goto err_with_lex_cleanup;
|
||||
|
||||
trigger_name->length= orig_trigger_name->length;
|
||||
|
||||
if (triggers->names_list.push_back(trigger_name,
|
||||
&table->mem_root))
|
||||
goto err_with_lex_cleanup;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
The Table_triggers_list is not constructed as a list of
|
||||
trigger objects as one would expect, but rather of lists of
|
||||
properties of equal length. Thus, even if we don't get the
|
||||
trigger name, we still fill all in all the lists with
|
||||
placeholders as we might otherwise create a skew in the
|
||||
lists. Obviously, this has to be refactored.
|
||||
*/
|
||||
LEX_STRING *empty= alloc_lex_string(&table->mem_root);
|
||||
if (!empty)
|
||||
goto err_with_lex_cleanup;
|
||||
|
||||
empty->str= const_cast<char*>("");
|
||||
empty->length= 0;
|
||||
if (triggers->names_list.push_back(empty, &table->mem_root))
|
||||
goto err_with_lex_cleanup;
|
||||
}
|
||||
lex_end(&lex);
|
||||
continue;
|
||||
}
|
||||
|
||||
lex.sphead->set_info(0, 0, &lex.sp_chistics, (ulong) *trg_sql_mode);
|
||||
|
||||
int event= lex.trg_chistics.event;
|
||||
|
@ -1368,8 +1462,8 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
|
|||
|
||||
if (triggers->names_list.push_back(&lex.sphead->m_name,
|
||||
&table->mem_root))
|
||||
goto err_with_lex_cleanup;
|
||||
|
||||
goto err_with_lex_cleanup;
|
||||
|
||||
if (!(on_table_name= alloc_lex_string(&table->mem_root)))
|
||||
goto err_with_lex_cleanup;
|
||||
|
||||
|
@ -1394,9 +1488,8 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
|
|||
char fname[NAME_LEN + 1];
|
||||
DBUG_ASSERT((!my_strcasecmp(table_alias_charset, lex.query_tables->db, db) ||
|
||||
(check_n_cut_mysql50_prefix(db, fname, sizeof(fname)) &&
|
||||
!my_strcasecmp(table_alias_charset, lex.query_tables->db, fname))) &&
|
||||
(!my_strcasecmp(table_alias_charset, lex.query_tables->table_name,
|
||||
table_name) ||
|
||||
!my_strcasecmp(table_alias_charset, lex.query_tables->db, fname))));
|
||||
DBUG_ASSERT((!my_strcasecmp(table_alias_charset, lex.query_tables->table_name, table_name) ||
|
||||
(check_n_cut_mysql50_prefix(table_name, fname, sizeof(fname)) &&
|
||||
!my_strcasecmp(table_alias_charset, lex.query_tables->table_name, fname))));
|
||||
#endif
|
||||
|
@ -1680,6 +1773,13 @@ bool Table_triggers_list::drop_all_triggers(THD *thd, char *db, char *name)
|
|||
|
||||
while ((trigger= it_name++))
|
||||
{
|
||||
/*
|
||||
Trigger, which body we failed to parse during call
|
||||
Table_triggers_list::check_n_load(), might be missing name.
|
||||
Such triggers have zero-length name and are skipped here.
|
||||
*/
|
||||
if (trigger->length == 0)
|
||||
continue;
|
||||
if (rm_trigname_file(path, db, trigger->str))
|
||||
{
|
||||
/*
|
||||
|
@ -1903,6 +2003,11 @@ bool Table_triggers_list::change_table_name(THD *thd, const char *db,
|
|||
}
|
||||
if (table.triggers)
|
||||
{
|
||||
if (table.triggers->check_for_broken_triggers())
|
||||
{
|
||||
result= 1;
|
||||
goto end;
|
||||
}
|
||||
LEX_STRING old_table_name= { (char *) old_table, strlen(old_table) };
|
||||
LEX_STRING new_table_name= { (char *) new_table, strlen(new_table) };
|
||||
/*
|
||||
|
@ -1991,6 +2096,9 @@ bool Table_triggers_list::process_triggers(THD *thd,
|
|||
sp_head *sp_trigger= bodies[event][time_type];
|
||||
SELECT_LEX *save_current_select;
|
||||
|
||||
if (check_for_broken_triggers())
|
||||
return true;
|
||||
|
||||
if (sp_trigger == NULL)
|
||||
return FALSE;
|
||||
|
||||
|
@ -2069,6 +2177,22 @@ void Table_triggers_list::mark_fields_used(trg_event_type event)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Signals to the Table_triggers_list that a parse error has occured when
|
||||
reading a trigger from file. This makes the Table_triggers_list enter an
|
||||
error state flagged by m_has_unparseable_trigger == true. The error message
|
||||
will be used whenever a statement invoking or manipulating triggers is
|
||||
issued against the Table_triggers_list's table.
|
||||
|
||||
@param error_message The error message thrown by the parser.
|
||||
*/
|
||||
void Table_triggers_list::set_parse_error_message(char *error_message)
|
||||
{
|
||||
m_has_unparseable_trigger= true;
|
||||
strcpy(m_parse_error_message, error_message);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Trigger BUG#14090 compatibility hook.
|
||||
|
||||
|
|
|
@ -62,6 +62,27 @@ class Table_triggers_list: public Sql_alloc
|
|||
*/
|
||||
GRANT_INFO subject_table_grants[TRG_EVENT_MAX][TRG_ACTION_MAX];
|
||||
|
||||
/**
|
||||
This flag indicates that one of the triggers was not parsed successfully,
|
||||
and as a precaution the object has entered a state where all trigger
|
||||
access results in errors until all such triggers are dropped. It is not
|
||||
safe to add triggers since we don't know if the broken trigger has the
|
||||
same name or event type. Nor is it safe to invoke any trigger for the
|
||||
aforementioned reasons. The only safe operations are drop_trigger and
|
||||
drop_all_triggers.
|
||||
|
||||
@see Table_triggers_list::set_parse_error
|
||||
*/
|
||||
bool m_has_unparseable_trigger;
|
||||
|
||||
/**
|
||||
This error will be displayed when the user tries to manipulate or invoke
|
||||
triggers on a table that has broken triggers. It will get set only once
|
||||
per statement and thus will contain the first parse error encountered in
|
||||
the trigger file.
|
||||
*/
|
||||
char m_parse_error_message[MYSQL_ERRMSG_SIZE];
|
||||
|
||||
public:
|
||||
/**
|
||||
Field responsible for storing triggers definitions in file.
|
||||
|
@ -84,7 +105,7 @@ public:
|
|||
/* End of character ser context. */
|
||||
|
||||
Table_triggers_list(TABLE *table_arg):
|
||||
record1_field(0), trigger_table(table_arg)
|
||||
record1_field(0), trigger_table(table_arg), m_has_unparseable_trigger(false)
|
||||
{
|
||||
bzero((char *)bodies, sizeof(bodies));
|
||||
bzero((char *)trigger_fields, sizeof(trigger_fields));
|
||||
|
@ -140,6 +161,8 @@ public:
|
|||
|
||||
void mark_fields_used(trg_event_type event);
|
||||
|
||||
void set_parse_error_message(char *error_message);
|
||||
|
||||
friend class Item_trigger_field;
|
||||
friend int sp_cache_routines_and_add_tables_for_triggers(THD *thd, LEX *lex,
|
||||
TABLE_LIST *table);
|
||||
|
@ -155,6 +178,16 @@ private:
|
|||
const char *new_db_name,
|
||||
LEX_STRING *old_table_name,
|
||||
LEX_STRING *new_table_name);
|
||||
|
||||
bool check_for_broken_triggers()
|
||||
{
|
||||
if (m_has_unparseable_trigger)
|
||||
{
|
||||
my_message(ER_PARSE_ERROR, m_parse_error_message, MYF(0));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
extern const LEX_STRING trg_action_time_type_names[];
|
||||
|
|
|
@ -2024,16 +2024,19 @@ opt_ev_status:
|
|||
| ENABLE_SYM
|
||||
{
|
||||
Lex->event_parse_data->status= Event_parse_data::ENABLED;
|
||||
Lex->event_parse_data->status_changed= true;
|
||||
$$= 1;
|
||||
}
|
||||
| DISABLE_SYM ON SLAVE
|
||||
{
|
||||
Lex->event_parse_data->status= Event_parse_data::SLAVESIDE_DISABLED;
|
||||
Lex->event_parse_data->status_changed= true;
|
||||
$$= 1;
|
||||
}
|
||||
| DISABLE_SYM
|
||||
{
|
||||
Lex->event_parse_data->status= Event_parse_data::DISABLED;
|
||||
Lex->event_parse_data->status_changed= true;
|
||||
$$= 1;
|
||||
}
|
||||
;
|
||||
|
|
|
@ -2265,7 +2265,7 @@ void open_table_error(TABLE_SHARE *share, int error, int db_errno, int errarg)
|
|||
default: /* Better wrong error than none */
|
||||
case 4:
|
||||
strxmov(buff, share->normalized_path.str, reg_ext, NullS);
|
||||
my_error(ER_NOT_FORM_FILE, errortype, buff, 0);
|
||||
my_error(ER_NOT_FORM_FILE, errortype, buff);
|
||||
break;
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
|
@ -2835,7 +2835,8 @@ Table_check_intact::check(TABLE *table, const TABLE_FIELD_DEF *table_def)
|
|||
report_error(ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE,
|
||||
ER(ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE),
|
||||
table->alias, table_def->count, table->s->fields,
|
||||
table->s->mysql_version, MYSQL_VERSION_ID);
|
||||
static_cast<int>(table->s->mysql_version),
|
||||
MYSQL_VERSION_ID);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
else if (MYSQL_VERSION_ID == table->s->mysql_version)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2000-2006 MySQL AB
|
||||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -11,8 +11,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
/*
|
||||
Functions to create a unireg form-file from a FIELD and a fieldname-fieldinfo
|
||||
|
@ -237,13 +236,14 @@ bool mysql_create_frm(THD *thd, const char *file_name,
|
|||
if ((thd->variables.sql_mode &
|
||||
(MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)))
|
||||
{
|
||||
my_error(ER_TOO_LONG_TABLE_COMMENT, MYF(0), table, tmp_len);
|
||||
my_error(ER_TOO_LONG_TABLE_COMMENT, MYF(0), table,
|
||||
static_cast<ulong>(tmp_len));
|
||||
goto err;
|
||||
}
|
||||
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_TOO_LONG_TABLE_COMMENT,
|
||||
ER(ER_TOO_LONG_TABLE_COMMENT),
|
||||
table, tmp_len);
|
||||
table, static_cast<ulong>(tmp_len));
|
||||
create_info->comment.length= tmp_len;
|
||||
}
|
||||
|
||||
|
@ -621,13 +621,14 @@ static bool pack_header(uchar *forminfo, enum legacy_db_type table_type,
|
|||
if ((current_thd->variables.sql_mode &
|
||||
(MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)))
|
||||
{
|
||||
my_error(ER_TOO_LONG_FIELD_COMMENT, MYF(0), field->field_name, tmp_len);
|
||||
my_error(ER_TOO_LONG_FIELD_COMMENT, MYF(0), field->field_name,
|
||||
static_cast<ulong>(tmp_len));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_TOO_LONG_FIELD_COMMENT,
|
||||
ER(ER_TOO_LONG_FIELD_COMMENT),
|
||||
field->field_name, tmp_len);
|
||||
field->field_name, static_cast<ulong>(tmp_len));
|
||||
field->comment.length= tmp_len;
|
||||
}
|
||||
|
||||
|
@ -711,7 +712,7 @@ static bool pack_header(uchar *forminfo, enum legacy_db_type table_type,
|
|||
|
||||
if (reclength > (ulong) file->max_record_length())
|
||||
{
|
||||
my_error(ER_TOO_BIG_ROWSIZE, MYF(0), (uint) file->max_record_length());
|
||||
my_error(ER_TOO_BIG_ROWSIZE, MYF(0), static_cast<long>(file->max_record_length()));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
/* Hack to avoid bugs with small static rows in MySQL */
|
||||
|
|
|
@ -114,6 +114,15 @@ int az_open (azio_stream *s, const char *path, int Flags, File fd)
|
|||
|
||||
errno = 0;
|
||||
s->file = fd < 0 ? my_open(path, Flags, MYF(0)) : fd;
|
||||
DBUG_EXECUTE_IF("simulate_archive_open_failure",
|
||||
{
|
||||
if (s->file >= 0)
|
||||
{
|
||||
my_close(s->file, MYF(0));
|
||||
s->file= -1;
|
||||
my_errno= EMFILE;
|
||||
}
|
||||
});
|
||||
|
||||
if (s->file < 0 )
|
||||
{
|
||||
|
|
|
@ -1586,11 +1586,12 @@ int ha_archive::check(THD* thd, HA_CHECK_OPT* check_opt)
|
|||
azflush(&(share->archive_write), Z_SYNC_FLUSH);
|
||||
pthread_mutex_unlock(&share->mutex);
|
||||
|
||||
if (init_archive_reader())
|
||||
DBUG_RETURN(HA_ADMIN_CORRUPT);
|
||||
/*
|
||||
Now we will rewind the archive file so that we are positioned at the
|
||||
start of the file.
|
||||
*/
|
||||
init_archive_reader();
|
||||
read_data_header(&archive);
|
||||
while (!(rc= get_row(&archive, table->record[0])))
|
||||
count--;
|
||||
|
|
|
@ -1937,7 +1937,7 @@ btr_node_ptr_delete(
|
|||
ut_a(err == DB_SUCCESS);
|
||||
|
||||
if (!compressed) {
|
||||
btr_cur_compress_if_useful(&cursor, mtr);
|
||||
btr_cur_compress_if_useful(&cursor, FALSE, mtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1945,9 +1945,10 @@ btr_node_ptr_delete(
|
|||
If page is the only on its level, this function moves its records to the
|
||||
father page, thus reducing the tree height. */
|
||||
static
|
||||
void
|
||||
page_t*
|
||||
btr_lift_page_up(
|
||||
/*=============*/
|
||||
/* out: father page */
|
||||
dict_index_t* index, /* in: index tree */
|
||||
page_t* page, /* in: page which is the only on its level;
|
||||
must not be empty: use
|
||||
|
@ -2023,6 +2024,8 @@ btr_lift_page_up(
|
|||
ibuf_reset_free_bits(index, father_page);
|
||||
ut_ad(page_validate(father_page, index));
|
||||
ut_ad(btr_check_node_ptr(index, father_page, mtr));
|
||||
|
||||
return(father_page);
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
|
@ -2039,11 +2042,13 @@ enough free extents so that the compression will always succeed if done! */
|
|||
void
|
||||
btr_compress(
|
||||
/*=========*/
|
||||
btr_cur_t* cursor, /* in: cursor on the page to merge or lift;
|
||||
the page must not be empty: in record delete
|
||||
use btr_discard_page if the page would become
|
||||
empty */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
btr_cur_t* cursor, /* in/out: cursor on the page to merge
|
||||
or lift; the page must not be empty:
|
||||
when deleting records, use btr_discard_page()
|
||||
if the page would become empty */
|
||||
ibool adjust, /* in: TRUE if should adjust the
|
||||
cursor position even if compression occurs */
|
||||
mtr_t* mtr) /* in/out: mini-transaction */
|
||||
{
|
||||
dict_index_t* index;
|
||||
ulint space;
|
||||
|
@ -2058,6 +2063,7 @@ btr_compress(
|
|||
rec_t* node_ptr;
|
||||
ulint data_size;
|
||||
ulint n_recs;
|
||||
ulint nth_rec = 0; /* remove bogus warning */
|
||||
ulint max_ins_size;
|
||||
ulint max_ins_size_reorg;
|
||||
ulint comp;
|
||||
|
@ -2065,6 +2071,7 @@ btr_compress(
|
|||
page = btr_cur_get_page(cursor);
|
||||
index = btr_cur_get_index(cursor);
|
||||
comp = page_is_comp(page);
|
||||
|
||||
ut_a((ibool)!!comp == dict_table_is_comp(index->table));
|
||||
|
||||
ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
|
||||
|
@ -2086,6 +2093,10 @@ btr_compress(
|
|||
father_page = buf_frame_align(node_ptr);
|
||||
ut_a(comp == page_is_comp(father_page));
|
||||
|
||||
if (adjust) {
|
||||
nth_rec = page_rec_get_n_recs_before(btr_cur_get_rec(cursor));
|
||||
}
|
||||
|
||||
/* Decide the page to which we try to merge and which will inherit
|
||||
the locks */
|
||||
|
||||
|
@ -2110,9 +2121,8 @@ btr_compress(
|
|||
} else {
|
||||
/* The page is the only one on the level, lift the records
|
||||
to the father */
|
||||
btr_lift_page_up(index, page, mtr);
|
||||
|
||||
return;
|
||||
merge_page = btr_lift_page_up(index, page, mtr);
|
||||
goto func_exit;
|
||||
}
|
||||
|
||||
n_recs = page_get_n_recs(page);
|
||||
|
@ -2188,6 +2198,10 @@ btr_compress(
|
|||
index, mtr);
|
||||
|
||||
lock_update_merge_left(merge_page, orig_pred, page);
|
||||
|
||||
if (adjust) {
|
||||
nth_rec += page_rec_get_n_recs_before(orig_pred);
|
||||
}
|
||||
} else {
|
||||
orig_succ = page_rec_get_next(
|
||||
page_get_infimum_rec(merge_page));
|
||||
|
@ -2208,6 +2222,12 @@ btr_compress(
|
|||
btr_page_free(index, page, mtr);
|
||||
|
||||
ut_ad(btr_check_node_ptr(index, merge_page, mtr));
|
||||
|
||||
func_exit:
|
||||
if (adjust) {
|
||||
btr_cur_position(index, page_rec_get_nth(merge_page, nth_rec),
|
||||
cursor);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
|
|
|
@ -31,6 +31,7 @@ Created 10/16/1994 Heikki Tuuri
|
|||
#include "btr0sea.h"
|
||||
#include "row0upd.h"
|
||||
#include "trx0rec.h"
|
||||
#include "trx0roll.h" /* trx_roll_crash_recv_trx */
|
||||
#include "que0que.h"
|
||||
#include "row0row.h"
|
||||
#include "srv0srv.h"
|
||||
|
@ -73,6 +74,13 @@ this many index pages */
|
|||
+ not_empty) \
|
||||
/ (BTR_KEY_VAL_ESTIMATE_N_PAGES + ext_size))
|
||||
|
||||
#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
|
||||
/* A BLOB field reference full of zero, for use in assertions and tests.
|
||||
Initially, BLOB field references are set to zero, in
|
||||
dtuple_convert_big_rec(). */
|
||||
const byte field_ref_zero[BTR_EXTERN_FIELD_REF_SIZE];
|
||||
#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
|
||||
|
||||
/***********************************************************************
|
||||
Marks all extern fields in a record as owned by the record. This function
|
||||
should be called if the delete mark of a record is removed: a not delete
|
||||
|
@ -1572,7 +1580,6 @@ btr_cur_optimistic_update(
|
|||
ulint old_rec_size;
|
||||
dtuple_t* new_entry;
|
||||
dulint roll_ptr;
|
||||
trx_t* trx;
|
||||
mem_heap_t* heap;
|
||||
ibool reorganized = FALSE;
|
||||
ulint i;
|
||||
|
@ -1585,6 +1592,10 @@ btr_cur_optimistic_update(
|
|||
|
||||
heap = mem_heap_create(1024);
|
||||
offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap);
|
||||
#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
|
||||
ut_a(!rec_offs_any_null_extern(rec, offsets)
|
||||
|| thr_get_trx(thr) == trx_roll_crash_recv_trx);
|
||||
#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
if (btr_cur_print_record_ops && thr) {
|
||||
|
@ -1691,13 +1702,11 @@ btr_cur_optimistic_update(
|
|||
|
||||
page_cur_move_to_prev(page_cursor);
|
||||
|
||||
trx = thr_get_trx(thr);
|
||||
|
||||
if (!(flags & BTR_KEEP_SYS_FLAG)) {
|
||||
row_upd_index_entry_sys_field(new_entry, index, DATA_ROLL_PTR,
|
||||
roll_ptr);
|
||||
row_upd_index_entry_sys_field(new_entry, index, DATA_TRX_ID,
|
||||
trx->id);
|
||||
thr_get_trx(thr)->id);
|
||||
}
|
||||
|
||||
rec = btr_cur_insert_if_possible(cursor, new_entry, &reorganized, mtr);
|
||||
|
@ -1781,7 +1790,9 @@ btr_cur_pessimistic_update(
|
|||
/* out: DB_SUCCESS or error code */
|
||||
ulint flags, /* in: undo logging, locking, and rollback
|
||||
flags */
|
||||
btr_cur_t* cursor, /* in: cursor on the record to update */
|
||||
btr_cur_t* cursor, /* in/out: cursor on the record to update;
|
||||
cursor may become invalid if *big_rec == NULL
|
||||
|| !(flags & BTR_KEEP_POS_FLAG) */
|
||||
big_rec_t** big_rec,/* out: big rec vector whose fields have to
|
||||
be stored externally by the caller, or NULL */
|
||||
upd_t* update, /* in: update vector; this is allowed also
|
||||
|
@ -1916,6 +1927,10 @@ btr_cur_pessimistic_update(
|
|||
err = DB_TOO_BIG_RECORD;
|
||||
goto return_after_reservations;
|
||||
}
|
||||
|
||||
ut_ad(index->type & DICT_CLUSTERED);
|
||||
ut_ad(btr_page_get_level(page, mtr) == 0);
|
||||
ut_ad(flags & BTR_KEEP_POS_FLAG);
|
||||
}
|
||||
|
||||
page_cursor = btr_cur_get_page_cur(cursor);
|
||||
|
@ -1942,6 +1957,8 @@ btr_cur_pessimistic_update(
|
|||
ut_a(rec || optim_err != DB_UNDERFLOW);
|
||||
|
||||
if (rec) {
|
||||
page_cursor->rec = rec;
|
||||
|
||||
lock_rec_restore_from_page_infimum(rec, page);
|
||||
rec_set_field_extern_bits(rec, index,
|
||||
ext_vect, n_ext_vect, mtr);
|
||||
|
@ -1955,12 +1972,30 @@ btr_cur_pessimistic_update(
|
|||
btr_cur_unmark_extern_fields(rec, mtr, offsets);
|
||||
}
|
||||
|
||||
btr_cur_compress_if_useful(cursor, mtr);
|
||||
btr_cur_compress_if_useful(
|
||||
cursor,
|
||||
big_rec_vec != NULL && (flags & BTR_KEEP_POS_FLAG),
|
||||
mtr);
|
||||
|
||||
err = DB_SUCCESS;
|
||||
goto return_after_reservations;
|
||||
}
|
||||
|
||||
if (big_rec_vec) {
|
||||
ut_ad(index->type & DICT_CLUSTERED);
|
||||
ut_ad(btr_page_get_level(page, mtr) == 0);
|
||||
ut_ad(flags & BTR_KEEP_POS_FLAG);
|
||||
|
||||
/* btr_page_split_and_insert() in
|
||||
btr_cur_pessimistic_insert() invokes
|
||||
mtr_memo_release(mtr, index->lock, MTR_MEMO_X_LOCK).
|
||||
We must keep the index->lock when we created a
|
||||
big_rec, so that row_upd_clust_rec() can store the
|
||||
big_rec in the same mini-transaction. */
|
||||
|
||||
mtr_x_lock(dict_index_get_lock(index), mtr);
|
||||
}
|
||||
|
||||
if (page_cur_is_before_first(page_cursor)) {
|
||||
/* The record to be updated was positioned as the first user
|
||||
record on its page */
|
||||
|
@ -1981,6 +2016,7 @@ btr_cur_pessimistic_update(
|
|||
ut_a(rec);
|
||||
ut_a(err == DB_SUCCESS);
|
||||
ut_a(dummy_big_rec == NULL);
|
||||
page_cursor->rec = rec;
|
||||
|
||||
rec_set_field_extern_bits(rec, index, ext_vect, n_ext_vect, mtr);
|
||||
offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap);
|
||||
|
@ -2015,6 +2051,43 @@ return_after_reservations:
|
|||
return(err);
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
Commits and restarts a mini-transaction so that it will retain an
|
||||
x-lock on index->lock and the cursor page. */
|
||||
|
||||
void
|
||||
btr_cur_mtr_commit_and_start(
|
||||
/*=========================*/
|
||||
btr_cur_t* cursor, /* in: cursor */
|
||||
mtr_t* mtr) /* in/out: mini-transaction */
|
||||
{
|
||||
buf_block_t* block;
|
||||
|
||||
block = buf_block_align(btr_cur_get_rec(cursor));
|
||||
|
||||
ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(cursor->index),
|
||||
MTR_MEMO_X_LOCK));
|
||||
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
|
||||
/* Keep the locks across the mtr_commit(mtr). */
|
||||
rw_lock_x_lock(dict_index_get_lock(cursor->index));
|
||||
rw_lock_x_lock(&block->lock);
|
||||
mutex_enter(&block->mutex);
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
buf_block_buf_fix_inc_debug(block, __FILE__, __LINE__);
|
||||
#else
|
||||
buf_block_buf_fix_inc(block);
|
||||
#endif
|
||||
mutex_exit(&block->mutex);
|
||||
/* Write out the redo log. */
|
||||
mtr_commit(mtr);
|
||||
mtr_start(mtr);
|
||||
/* Reassociate the locks with the mini-transaction.
|
||||
They will be released on mtr_commit(mtr). */
|
||||
mtr_memo_push(mtr, dict_index_get_lock(cursor->index),
|
||||
MTR_MEMO_X_LOCK);
|
||||
mtr_memo_push(mtr, block, MTR_MEMO_PAGE_X_FIX);
|
||||
}
|
||||
|
||||
/*==================== B-TREE DELETE MARK AND UNMARK ===============*/
|
||||
|
||||
/********************************************************************
|
||||
|
@ -2382,30 +2455,6 @@ btr_cur_del_unmark_for_ibuf(
|
|||
|
||||
/*==================== B-TREE RECORD REMOVE =========================*/
|
||||
|
||||
/*****************************************************************
|
||||
Tries to compress a page of the tree on the leaf level. It is assumed
|
||||
that mtr holds an x-latch on the tree and on the cursor page. To avoid
|
||||
deadlocks, mtr must also own x-latches to brothers of page, if those
|
||||
brothers exist. NOTE: it is assumed that the caller has reserved enough
|
||||
free extents so that the compression will always succeed if done! */
|
||||
|
||||
void
|
||||
btr_cur_compress(
|
||||
/*=============*/
|
||||
btr_cur_t* cursor, /* in: cursor on the page to compress;
|
||||
cursor does not stay valid */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
{
|
||||
ut_ad(mtr_memo_contains(mtr,
|
||||
dict_index_get_lock(btr_cur_get_index(cursor)),
|
||||
MTR_MEMO_X_LOCK));
|
||||
ut_ad(mtr_memo_contains(mtr, buf_block_align(btr_cur_get_rec(cursor)),
|
||||
MTR_MEMO_PAGE_X_FIX));
|
||||
ut_ad(btr_page_get_level(btr_cur_get_page(cursor), mtr) == 0);
|
||||
|
||||
btr_compress(cursor, mtr);
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
Tries to compress a page of the tree if it seems useful. It is assumed
|
||||
that mtr holds an x-latch on the tree and on the cursor page. To avoid
|
||||
|
@ -2417,10 +2466,12 @@ ibool
|
|||
btr_cur_compress_if_useful(
|
||||
/*=======================*/
|
||||
/* out: TRUE if compression occurred */
|
||||
btr_cur_t* cursor, /* in: cursor on the page to compress;
|
||||
cursor does not stay valid if compression
|
||||
occurs */
|
||||
mtr_t* mtr) /* in: mtr */
|
||||
btr_cur_t* cursor, /* in/out: cursor on the page to compress;
|
||||
cursor does not stay valid if !adjust and
|
||||
compression occurs */
|
||||
ibool adjust, /* in: TRUE if should adjust the
|
||||
cursor position even if compression occurs */
|
||||
mtr_t* mtr) /* in/out: mini-transaction */
|
||||
{
|
||||
ut_ad(mtr_memo_contains(mtr,
|
||||
dict_index_get_lock(btr_cur_get_index(cursor)),
|
||||
|
@ -2430,7 +2481,7 @@ btr_cur_compress_if_useful(
|
|||
|
||||
if (btr_cur_compress_recommendation(cursor, mtr)) {
|
||||
|
||||
btr_compress(cursor, mtr);
|
||||
btr_compress(cursor, adjust, mtr);
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
@ -2643,7 +2694,7 @@ return_after_reservations:
|
|||
mem_heap_free(heap);
|
||||
|
||||
if (ret == FALSE) {
|
||||
ret = btr_cur_compress_if_useful(cursor, mtr);
|
||||
ret = btr_cur_compress_if_useful(cursor, FALSE, mtr);
|
||||
}
|
||||
|
||||
if (n_extents > 0) {
|
||||
|
|
|
@ -454,9 +454,11 @@ dict_load_report_deleted_index(
|
|||
/************************************************************************
|
||||
Loads definitions for index fields. */
|
||||
static
|
||||
void
|
||||
ulint
|
||||
dict_load_fields(
|
||||
/*=============*/
|
||||
/* out: DB_SUCCESS if ok, DB_CORRUPTION
|
||||
if failed */
|
||||
dict_table_t* table, /* in: table */
|
||||
dict_index_t* index, /* in: index whose fields to load */
|
||||
mem_heap_t* heap) /* in: memory heap for temporary storage */
|
||||
|
@ -474,6 +476,7 @@ dict_load_fields(
|
|||
byte* buf;
|
||||
ulint i;
|
||||
mtr_t mtr;
|
||||
ulint error = DB_SUCCESS;
|
||||
|
||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||
|
||||
|
@ -535,6 +538,26 @@ dict_load_fields(
|
|||
|
||||
field = rec_get_nth_field_old(rec, 4, &len);
|
||||
|
||||
if (prefix_len >= DICT_MAX_INDEX_COL_LEN) {
|
||||
fprintf(stderr, "InnoDB: Error: load index"
|
||||
" '%s' failed.\n"
|
||||
"InnoDB: index field '%s' has a prefix"
|
||||
" length of %lu bytes,\n"
|
||||
"InnoDB: which exceeds the"
|
||||
" maximum limit of %lu bytes.\n"
|
||||
"InnoDB: Please use server that"
|
||||
" supports long index prefix\n"
|
||||
"InnoDB: or turn on"
|
||||
" innodb_force_recovery to load"
|
||||
" the table\n",
|
||||
index->name, mem_heap_strdupl(
|
||||
heap, (char*) field, len),
|
||||
(ulong) prefix_len,
|
||||
(ulong) (DICT_MAX_INDEX_COL_LEN - 1));
|
||||
error = DB_CORRUPTION;
|
||||
goto func_exit;
|
||||
}
|
||||
|
||||
dict_mem_index_add_field(index,
|
||||
mem_heap_strdupl(heap,
|
||||
(char*) field, len),
|
||||
|
@ -543,8 +566,10 @@ dict_load_fields(
|
|||
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
|
||||
}
|
||||
|
||||
func_exit:
|
||||
btr_pcur_close(&pcur);
|
||||
mtr_commit(&mtr);
|
||||
return(error);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
|
@ -701,10 +726,28 @@ dict_load_indexes(
|
|||
space, type, n_fields);
|
||||
index->id = id;
|
||||
|
||||
dict_load_fields(table, index, heap);
|
||||
error = dict_load_fields(table, index, heap);
|
||||
|
||||
if (error != DB_SUCCESS) {
|
||||
fprintf(stderr, "InnoDB: Error: load index '%s'"
|
||||
" for table '%s' failed\n",
|
||||
index->name, table->name);
|
||||
|
||||
/* If the force recovery flag is set, and
|
||||
if the failed index is not the primary index, we
|
||||
will continue and open other indexes */
|
||||
if (srv_force_recovery
|
||||
&& !(index->type & DICT_CLUSTERED)) {
|
||||
error = DB_SUCCESS;
|
||||
goto next_rec;
|
||||
} else {
|
||||
goto func_exit;
|
||||
}
|
||||
}
|
||||
|
||||
dict_index_add_to_cache(table, index, page_no);
|
||||
}
|
||||
|
||||
next_rec:
|
||||
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
|
||||
}
|
||||
|
||||
|
@ -881,9 +924,18 @@ err_exit:
|
|||
} else {
|
||||
table->fk_max_recusive_level = 0;
|
||||
}
|
||||
} else if (!srv_force_recovery) {
|
||||
dict_table_remove_from_cache(table);
|
||||
table = NULL;
|
||||
} else {
|
||||
dict_index_t* index;
|
||||
|
||||
/* Make sure that at least the clustered index was loaded.
|
||||
Otherwise refuse to load the table */
|
||||
index = dict_table_get_first_index(table);
|
||||
|
||||
if (!srv_force_recovery || !index
|
||||
|| !(index->type & DICT_CLUSTERED)) {
|
||||
dict_table_remove_from_cache(table);
|
||||
table = NULL;
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
if (err != DB_SUCCESS && table != NULL) {
|
||||
|
|
|
@ -7325,10 +7325,18 @@ ha_innobase::external_lock(
|
|||
|
||||
reset_template(prebuilt);
|
||||
|
||||
if (lock_type == F_WRLCK) {
|
||||
if (lock_type == F_WRLCK
|
||||
|| (table->s->tmp_table
|
||||
&& thd_sql_command(thd) == SQLCOM_LOCK_TABLES)) {
|
||||
|
||||
/* If this is a SELECT, then it is in UPDATE TABLE ...
|
||||
or SELECT ... FOR UPDATE */
|
||||
or SELECT ... FOR UPDATE
|
||||
|
||||
For temporary tables which are locked for READ by LOCK TABLES
|
||||
updates are still allowed by SQL-layer. In order to accomodate
|
||||
for such a situation we always request X-lock for such table
|
||||
at LOCK TABLES time.
|
||||
*/
|
||||
prebuilt->select_lock_type = LOCK_X;
|
||||
prebuilt->stored_select_lock_type = LOCK_X;
|
||||
}
|
||||
|
|
|
@ -312,11 +312,13 @@ enough free extents so that the compression will always succeed if done! */
|
|||
void
|
||||
btr_compress(
|
||||
/*=========*/
|
||||
btr_cur_t* cursor, /* in: cursor on the page to merge or lift;
|
||||
the page must not be empty: in record delete
|
||||
use btr_discard_page if the page would become
|
||||
empty */
|
||||
mtr_t* mtr); /* in: mtr */
|
||||
btr_cur_t* cursor, /* in/out: cursor on the page to merge
|
||||
or lift; the page must not be empty:
|
||||
when deleting records, use btr_discard_page()
|
||||
if the page would become empty */
|
||||
ibool adjust, /* in: TRUE if should adjust the
|
||||
cursor position even if compression occurs */
|
||||
mtr_t* mtr); /* in/out: mini-transaction */
|
||||
/*****************************************************************
|
||||
Discards a page from a B-tree. This is used to remove the last record from
|
||||
a B-tree page: the whole page must be removed at the same time. This cannot
|
||||
|
|
|
@ -23,6 +23,9 @@ Created 10/16/1994 Heikki Tuuri
|
|||
#define BTR_NO_LOCKING_FLAG 2 /* do no record lock checking */
|
||||
#define BTR_KEEP_SYS_FLAG 4 /* sys fields will be found from the
|
||||
update vector or inserted entry */
|
||||
#define BTR_KEEP_POS_FLAG 8 /* btr_cur_pessimistic_update()
|
||||
must keep cursor position when
|
||||
moving columns to big_rec */
|
||||
|
||||
#define BTR_CUR_ADAPT
|
||||
#define BTR_CUR_HASH_ADAPT
|
||||
|
@ -237,7 +240,9 @@ btr_cur_pessimistic_update(
|
|||
/* out: DB_SUCCESS or error code */
|
||||
ulint flags, /* in: undo logging, locking, and rollback
|
||||
flags */
|
||||
btr_cur_t* cursor, /* in: cursor on the record to update */
|
||||
btr_cur_t* cursor, /* in/out: cursor on the record to update;
|
||||
cursor may become invalid if *big_rec == NULL
|
||||
|| !(flags & BTR_KEEP_POS_FLAG) */
|
||||
big_rec_t** big_rec,/* out: big rec vector whose fields have to
|
||||
be stored externally by the caller, or NULL */
|
||||
upd_t* update, /* in: update vector; this is allowed also
|
||||
|
@ -247,6 +252,15 @@ btr_cur_pessimistic_update(
|
|||
updates */
|
||||
que_thr_t* thr, /* in: query thread */
|
||||
mtr_t* mtr); /* in: mtr */
|
||||
/*****************************************************************
|
||||
Commits and restarts a mini-transaction so that it will retain an
|
||||
x-lock on index->lock and the cursor page. */
|
||||
|
||||
void
|
||||
btr_cur_mtr_commit_and_start(
|
||||
/*=========================*/
|
||||
btr_cur_t* cursor, /* in: cursor */
|
||||
mtr_t* mtr); /* in/out: mini-transaction */
|
||||
/***************************************************************
|
||||
Marks a clustered index record deleted. Writes an undo log record to
|
||||
undo log on this delete marking. Writes in the trx id field the id
|
||||
|
@ -286,19 +300,6 @@ btr_cur_del_unmark_for_ibuf(
|
|||
rec_t* rec, /* in: record to delete unmark */
|
||||
mtr_t* mtr); /* in: mtr */
|
||||
/*****************************************************************
|
||||
Tries to compress a page of the tree on the leaf level. It is assumed
|
||||
that mtr holds an x-latch on the tree and on the cursor page. To avoid
|
||||
deadlocks, mtr must also own x-latches to brothers of page, if those
|
||||
brothers exist. NOTE: it is assumed that the caller has reserved enough
|
||||
free extents so that the compression will always succeed if done! */
|
||||
|
||||
void
|
||||
btr_cur_compress(
|
||||
/*=============*/
|
||||
btr_cur_t* cursor, /* in: cursor on the page to compress;
|
||||
cursor does not stay valid */
|
||||
mtr_t* mtr); /* in: mtr */
|
||||
/*****************************************************************
|
||||
Tries to compress a page of the tree if it seems useful. It is assumed
|
||||
that mtr holds an x-latch on the tree and on the cursor page. To avoid
|
||||
deadlocks, mtr must also own x-latches to brothers of page, if those
|
||||
|
@ -309,10 +310,12 @@ ibool
|
|||
btr_cur_compress_if_useful(
|
||||
/*=======================*/
|
||||
/* out: TRUE if compression occurred */
|
||||
btr_cur_t* cursor, /* in: cursor on the page to compress;
|
||||
cursor does not stay valid if compression
|
||||
occurs */
|
||||
mtr_t* mtr); /* in: mtr */
|
||||
btr_cur_t* cursor, /* in/out: cursor on the page to compress;
|
||||
cursor does not stay valid if !adjust and
|
||||
compression occurs */
|
||||
ibool adjust, /* in: TRUE if should adjust the
|
||||
cursor position even if compression occurs */
|
||||
mtr_t* mtr); /* in/out: mini-transaction */
|
||||
/***********************************************************
|
||||
Removes the record on which the tree cursor is positioned. It is assumed
|
||||
that the mtr has an x-latch on the page where the cursor is positioned,
|
||||
|
|
|
@ -18,4 +18,9 @@ typedef struct btr_pcur_struct btr_pcur_t;
|
|||
typedef struct btr_cur_struct btr_cur_t;
|
||||
typedef struct btr_search_struct btr_search_t;
|
||||
|
||||
#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
|
||||
#define BTR_EXTERN_FIELD_REF_SIZE 20
|
||||
extern const byte field_ref_zero[BTR_EXTERN_FIELD_REF_SIZE];
|
||||
#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -682,6 +682,25 @@ buf_page_address_fold(
|
|||
/* out: the folded value */
|
||||
ulint space, /* in: space id */
|
||||
ulint offset);/* in: offset of the page within space */
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
/***********************************************************************
|
||||
Increments the bufferfix count. */
|
||||
UNIV_INLINE
|
||||
void
|
||||
buf_block_buf_fix_inc_debug(
|
||||
/*========================*/
|
||||
buf_block_t* block, /* in: block to bufferfix */
|
||||
const char* file __attribute__ ((unused)), /* in: file name */
|
||||
ulint line __attribute__ ((unused))); /* in: line */
|
||||
#else /* UNIV_SYNC_DEBUG */
|
||||
/***********************************************************************
|
||||
Increments the bufferfix count. */
|
||||
UNIV_INLINE
|
||||
void
|
||||
buf_block_buf_fix_inc(
|
||||
/*==================*/
|
||||
buf_block_t* block); /* in: block to bufferfix */
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
/**********************************************************************
|
||||
Returns the control block of a file page, NULL if not found. */
|
||||
UNIV_INLINE
|
||||
|
|
|
@ -660,6 +660,6 @@ buf_page_dbg_add_level(
|
|||
ulint level __attribute__((unused))) /* in: latching order
|
||||
level */
|
||||
{
|
||||
sync_thread_add_level(&(buf_block_align(frame)->lock), level);
|
||||
sync_thread_add_level(&(buf_block_align(frame)->lock), level, FALSE);
|
||||
}
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
|
|
@ -234,10 +234,21 @@ page_get_supremum_rec(
|
|||
/*==================*/
|
||||
/* out: the last record in record list */
|
||||
page_t* page); /* in: page which must have record(s) */
|
||||
/****************************************************************
|
||||
Returns the middle record of record list. If there are an even number
|
||||
of records in the list, returns the first record of upper half-list. */
|
||||
/************************************************************//**
|
||||
Returns the nth record of the record list.
|
||||
This is the inverse function of page_rec_get_n_recs_before(). */
|
||||
|
||||
rec_t*
|
||||
page_rec_get_nth(
|
||||
/*=============*/
|
||||
/* out: nth record */
|
||||
page_t* page, /* in: page */
|
||||
ulint nth); /* in: nth record */
|
||||
/*****************************************************************
|
||||
Returns the middle record of the records on the page. If there is an
|
||||
even number of records in the list, returns the first record of the
|
||||
upper half-list. */
|
||||
UNIV_INLINE
|
||||
rec_t*
|
||||
page_get_middle_rec(
|
||||
/*================*/
|
||||
|
@ -280,7 +291,8 @@ page_get_n_recs(
|
|||
page_t* page); /* in: index page */
|
||||
/*******************************************************************
|
||||
Returns the number of records before the given record in chain.
|
||||
The number includes infimum and supremum records. */
|
||||
The number includes infimum and supremum records.
|
||||
This is the inverse function of page_rec_get_nth(). */
|
||||
|
||||
ulint
|
||||
page_rec_get_n_recs_before(
|
||||
|
|
|
@ -340,6 +340,22 @@ page_rec_is_infimum(
|
|||
return(page_rec_is_infimum_low(page_offset(rec)));
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
Returns the middle record of the records on the page. If there is an
|
||||
even number of records in the list, returns the first record of the
|
||||
upper half-list. */
|
||||
UNIV_INLINE
|
||||
rec_t*
|
||||
page_get_middle_rec(
|
||||
/*================*/
|
||||
/* out: middle record */
|
||||
page_t* page) /* in: page */
|
||||
{
|
||||
ulint middle = (page_get_n_recs(page) + 2) / 2;
|
||||
|
||||
return(page_rec_get_nth(page, middle));
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
Compares a data tuple to a physical record. Differs from the function
|
||||
cmp_dtuple_rec_with_match in the way that the record must reside on an
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue