merge to 5.0-bugteam
This commit is contained in:
commit
b1d74c9b5c
@ -2643,7 +2643,7 @@ static void get_current_db()
|
||||
(res= mysql_use_result(&mysql)))
|
||||
{
|
||||
MYSQL_ROW row= mysql_fetch_row(res);
|
||||
if (row[0])
|
||||
if (row && row[0])
|
||||
current_db= my_strdup(row[0], MYF(MY_WME));
|
||||
mysql_free_result(res);
|
||||
}
|
||||
|
@ -6665,7 +6665,7 @@ void init_re_comp(my_regex_t *re, const char* str)
|
||||
char erbuf[100];
|
||||
size_t len= my_regerror(err, re, erbuf, sizeof(erbuf));
|
||||
die("error %s, %d/%d `%s'\n",
|
||||
re_eprint(err), len, (int)sizeof(erbuf), erbuf);
|
||||
re_eprint(err), (int)len, (int)sizeof(erbuf), erbuf);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6721,7 +6721,7 @@ int match_re(my_regex_t *re, char *str)
|
||||
char erbuf[100];
|
||||
size_t len= my_regerror(err, re, erbuf, sizeof(erbuf));
|
||||
die("error %s, %d/%d `%s'\n",
|
||||
re_eprint(err), len, (int)sizeof(erbuf), erbuf);
|
||||
re_eprint(err), (int)len, (int)sizeof(erbuf), erbuf);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ case $FLAG in
|
||||
cat $FILES | $AWK '
|
||||
BEGIN {
|
||||
printf("/* Automatically generated file, do not edit */\n");
|
||||
printf("#include \"sys.h\"\n#include \"el.h\"\n");
|
||||
printf("#include \"config.h\"\n#include \"el.h\"\n");
|
||||
printf("private const struct el_bindings_t el_func_help[] = {\n");
|
||||
low = "abcdefghijklmnopqrstuvwxyz_";
|
||||
high = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_";
|
||||
@ -169,7 +169,7 @@ case $FLAG in
|
||||
cat $FILES | $AWK '/el_action_t/ { print $3 }' | sort | $AWK '
|
||||
BEGIN {
|
||||
printf("/* Automatically generated file, do not edit */\n");
|
||||
printf("#include \"sys.h\"\n#include \"el.h\"\n");
|
||||
printf("#include \"config.h\"\n#include \"el.h\"\n");
|
||||
printf("private const el_func_t el_func[] = {");
|
||||
maxlen = 80;
|
||||
needn = 1;
|
||||
|
@ -51,13 +51,10 @@
|
||||
#else
|
||||
#include "np/vis.h"
|
||||
#endif
|
||||
#ifdef HAVE_ALLOCA_H
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
#include "readline/readline.h"
|
||||
#include "el.h"
|
||||
#include "fcns.h" /* for EL_NUM_FCNS */
|
||||
#include "histedit.h"
|
||||
#include "readline/readline.h"
|
||||
#include "filecomplete.h"
|
||||
|
||||
void rl_prep_terminal(int);
|
||||
|
@ -66,7 +66,7 @@ typedef KEYMAP_ENTRY *Keymap;
|
||||
|
||||
#ifndef CTRL
|
||||
#include <sys/ioctl.h>
|
||||
#if !defined(__sun__) && !defined(__hpux__)
|
||||
#if !defined(__sun) && !defined(__hpux) && !defined(_AIX) && !defined(__QNXNTO__) && !defined(__USLC__)
|
||||
#include <sys/ttydefaults.h>
|
||||
#endif
|
||||
#ifndef CTRL
|
||||
|
@ -914,14 +914,14 @@ vi_comment_out(EditLine *el, int c)
|
||||
* NB: posix implies that we should enter insert mode, however
|
||||
* this is against historical precedent...
|
||||
*/
|
||||
#ifdef __weak_reference
|
||||
#if defined(__weak_reference) && !defined(__FreeBSD__)
|
||||
extern char *get_alias_text(const char *) __weak_reference(get_alias_text);
|
||||
#endif
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
vi_alias(EditLine *el, int c)
|
||||
{
|
||||
#ifdef __weak_reference
|
||||
#if defined(__weak_reference) && !defined(__FreeBSD__)
|
||||
char alias_name[3];
|
||||
char *alias_text;
|
||||
|
||||
|
@ -358,16 +358,19 @@ esac
|
||||
AC_DEFUN([MYSQL_CHECK_LIB_TERMCAP],
|
||||
[
|
||||
AC_CACHE_VAL(mysql_cv_termcap_lib,
|
||||
[AC_CHECK_LIB(ncurses, tgetent, mysql_cv_termcap_lib=libncurses,
|
||||
[AC_CHECK_LIB(curses, tgetent, mysql_cv_termcap_lib=libcurses,
|
||||
[AC_CHECK_LIB(termcap, tgetent, mysql_cv_termcap_lib=libtermcap,
|
||||
[AC_CHECK_LIB(tinfo, tgetent, mysql_cv_termcap_lib=libtinfo,
|
||||
mysql_cv_termcap_lib=NOT_FOUND)])])])])
|
||||
[AC_CHECK_LIB(ncursesw, tgetent, mysql_cv_termcap_lib=libncursesw,
|
||||
[AC_CHECK_LIB(ncurses, tgetent, mysql_cv_termcap_lib=libncurses,
|
||||
[AC_CHECK_LIB(curses, tgetent, mysql_cv_termcap_lib=libcurses,
|
||||
[AC_CHECK_LIB(termcap, tgetent, mysql_cv_termcap_lib=libtermcap,
|
||||
[AC_CHECK_LIB(tinfo, tgetent, mysql_cv_termcap_lib=libtinfo,
|
||||
mysql_cv_termcap_lib=NOT_FOUND)])])])])])
|
||||
AC_MSG_CHECKING(for termcap functions library)
|
||||
if test "$mysql_cv_termcap_lib" = "NOT_FOUND"; then
|
||||
AC_MSG_ERROR([No curses/termcap library found])
|
||||
elif test "$mysql_cv_termcap_lib" = "libtermcap"; then
|
||||
TERMCAP_LIB=-ltermcap
|
||||
elif test "$mysql_cv_termcap_lib" = "libncursesw"; then
|
||||
TERMCAP_LIB=-lncursesw
|
||||
elif test "$mysql_cv_termcap_lib" = "libncurses"; then
|
||||
TERMCAP_LIB=-lncurses
|
||||
elif test "$mysql_cv_termcap_lib" = "libtinfo"; then
|
||||
|
21
configure.in
21
configure.in
@ -2094,6 +2094,27 @@ esac
|
||||
AC_MSG_CHECKING(for isinf in <math.h>)
|
||||
AC_TRY_LINK([#include <math.h>], [float f = 0.0; int r = isinf(f); return r],
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_MSG_CHECKING(whether isinf() is safe to use in C code)
|
||||
AC_TRY_RUN([
|
||||
#include <math.h>
|
||||
int main()
|
||||
{
|
||||
double a= 10.0;
|
||||
double b= 1e308;
|
||||
|
||||
return !isinf(a * b);
|
||||
}
|
||||
],
|
||||
[AC_MSG_RESULT(yes)],
|
||||
[AC_MSG_RESULT(no)
|
||||
AC_DEFINE([HAVE_BROKEN_ISINF], [1],
|
||||
[Define to 1 if isinf() uses 80-bit register for intermediate values])
|
||||
],
|
||||
[
|
||||
# Let's be optimistic when cross-compiling, since the only compiler known
|
||||
# to be affected by this isinf() bug is GCC 4.3 on 32-bit x86.
|
||||
AC_MSG_RESULT([[cross-compiling, assuming 'yes']])
|
||||
])
|
||||
AC_MSG_CHECKING(whether isinf() can be used in C++ code)
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
|
@ -486,40 +486,6 @@ typedef unsigned short ushort;
|
||||
#define test_all_bits(a,b) (((a) & (b)) == (b))
|
||||
#define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1))
|
||||
#define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0])))
|
||||
#ifndef HAVE_RINT
|
||||
/**
|
||||
All integers up to this number can be represented exactly as double precision
|
||||
values (DBL_MANT_DIG == 53 for IEEE 754 hardware).
|
||||
*/
|
||||
#define MAX_EXACT_INTEGER ((1LL << DBL_MANT_DIG) - 1)
|
||||
|
||||
/**
|
||||
rint(3) implementation for platforms that do not have it.
|
||||
Always rounds to the nearest integer with ties being rounded to the nearest
|
||||
even integer to mimic glibc's rint() behavior in the "round-to-nearest"
|
||||
FPU mode. Hardware-specific optimizations are possible (frndint on x86).
|
||||
Unlike this implementation, hardware will also honor the FPU rounding mode.
|
||||
*/
|
||||
|
||||
static inline double rint(double x)
|
||||
{
|
||||
double f, i;
|
||||
f = modf(x, &i);
|
||||
/*
|
||||
All doubles with absolute values > MAX_EXACT_INTEGER are even anyway,
|
||||
no need to check it.
|
||||
*/
|
||||
if (x > 0.0)
|
||||
i += (double) ((f > 0.5) || (f == 0.5 &&
|
||||
i <= (double) MAX_EXACT_INTEGER &&
|
||||
(longlong) i % 2));
|
||||
else
|
||||
i -= (double) ((f < -0.5) || (f == -0.5 &&
|
||||
i >= (double) -MAX_EXACT_INTEGER &&
|
||||
(longlong) i % 2));
|
||||
return i;
|
||||
}
|
||||
#endif /* HAVE_RINT */
|
||||
|
||||
/* Define some general constants */
|
||||
#ifndef TRUE
|
||||
@ -831,9 +797,19 @@ typedef SOCKET_SIZE_TYPE size_socket;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ISINF
|
||||
/* isinf() can be used in both C and C++ code */
|
||||
#define my_isinf(X) isinf(X)
|
||||
/* Check if C compiler is affected by GCC bug #39228 */
|
||||
#if !defined(__cplusplus) && defined(HAVE_BROKEN_ISINF)
|
||||
/* Force store/reload of the argument to/from a 64-bit double */
|
||||
static inline double my_isinf(double x)
|
||||
{
|
||||
volatile double t= x;
|
||||
return isinf(t);
|
||||
}
|
||||
#else
|
||||
/* System-provided isinf() is available and safe to use */
|
||||
#define my_isinf(X) isinf(X)
|
||||
#endif
|
||||
#else /* !HAVE_ISINF */
|
||||
#define my_isinf(X) (!finite(X) && !isnan(X))
|
||||
#endif
|
||||
|
||||
@ -1391,4 +1367,39 @@ do { doubleget_union _tmp; \
|
||||
|
||||
#define MY_INT64_NUM_DECIMAL_DIGITS 21
|
||||
|
||||
#ifndef HAVE_RINT
|
||||
/**
|
||||
All integers up to this number can be represented exactly as double precision
|
||||
values (DBL_MANT_DIG == 53 for IEEE 754 hardware).
|
||||
*/
|
||||
#define MAX_EXACT_INTEGER ((1LL << DBL_MANT_DIG) - 1)
|
||||
|
||||
/**
|
||||
rint(3) implementation for platforms that do not have it.
|
||||
Always rounds to the nearest integer with ties being rounded to the nearest
|
||||
even integer to mimic glibc's rint() behavior in the "round-to-nearest"
|
||||
FPU mode. Hardware-specific optimizations are possible (frndint on x86).
|
||||
Unlike this implementation, hardware will also honor the FPU rounding mode.
|
||||
*/
|
||||
|
||||
static inline double rint(double x)
|
||||
{
|
||||
double f, i;
|
||||
f = modf(x, &i);
|
||||
/*
|
||||
All doubles with absolute values > MAX_EXACT_INTEGER are even anyway,
|
||||
no need to check it.
|
||||
*/
|
||||
if (x > 0.0)
|
||||
i += (double) ((f > 0.5) || (f == 0.5 &&
|
||||
i <= (double) MAX_EXACT_INTEGER &&
|
||||
(longlong) i % 2));
|
||||
else
|
||||
i -= (double) ((f < -0.5) || (f == -0.5 &&
|
||||
i >= (double) -MAX_EXACT_INTEGER &&
|
||||
(longlong) i % 2));
|
||||
return i;
|
||||
}
|
||||
#endif /* HAVE_RINT */
|
||||
|
||||
#endif /* my_global_h */
|
||||
|
@ -41,6 +41,8 @@ TARGET_LINK_LIBRARIES(myisamlog myisam mysys debug dbug strings zlib wsock32)
|
||||
ADD_EXECUTABLE(myisampack myisampack.c)
|
||||
TARGET_LINK_LIBRARIES(myisampack myisam mysys debug dbug strings zlib wsock32)
|
||||
|
||||
SET_TARGET_PROPERTIES(myisamchk myisampack PROPERTIES LINK_FLAGS "setargv.obj")
|
||||
|
||||
IF(EMBED_MANIFESTS)
|
||||
MYSQL_EMBED_MANIFEST("myisam_ftdump" "asInvoker")
|
||||
MYSQL_EMBED_MANIFEST("myisamchk" "asInvoker")
|
||||
|
@ -1430,6 +1430,32 @@ static void fill_buffer(MI_BIT_BUFF *bit_buff)
|
||||
bit_buff->current_byte=0;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint len= 0;
|
||||
uint i= 0;
|
||||
/*
|
||||
Check if the remaining buffer/record to read is less than the word size.
|
||||
If so read byte by byte
|
||||
|
||||
Note: if this branch becomes a bottleneck it can be removed, assuming
|
||||
that the second memory segment allocates 7 extra bytes (see
|
||||
_mi_read_pack_info()).
|
||||
*/
|
||||
len= bit_buff->end - bit_buff->pos;
|
||||
if (len < (BITS_SAVED / 8))
|
||||
{
|
||||
bit_buff->current_byte= 0;
|
||||
for (i=0 ; i < len ; i++)
|
||||
{
|
||||
bit_buff->current_byte+= (((uint) ((uchar) bit_buff->pos[len - i - 1]))
|
||||
<< (8 * i));
|
||||
}
|
||||
bit_buff->pos= bit_buff->end;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#if BITS_SAVED == 64
|
||||
bit_buff->current_byte= ((((uint) ((uchar) bit_buff->pos[7]))) +
|
||||
(((uint) ((uchar) bit_buff->pos[6])) << 8) +
|
||||
|
21
mysql-test/include/wait_until_disconnected.inc
Normal file
21
mysql-test/include/wait_until_disconnected.inc
Normal file
@ -0,0 +1,21 @@
|
||||
#
|
||||
# Include this script to wait until the connection to the
|
||||
# server has been dropped
|
||||
--disable_result_log
|
||||
--disable_query_log
|
||||
let $counter= 500;
|
||||
let $mysql_errno= 0;
|
||||
while (!$mysql_errno)
|
||||
{
|
||||
--error 0,1053,2002,2006,2013
|
||||
show status;
|
||||
|
||||
dec $counter;
|
||||
if (!$counter)
|
||||
{
|
||||
--die Server failed to dissapear
|
||||
}
|
||||
--sleep 0.1
|
||||
}
|
||||
--enable_query_log
|
||||
--enable_result_log
|
@ -604,6 +604,8 @@ END//
|
||||
CALL p1();
|
||||
c1 c2 c3 d1 d2 d3
|
||||
utf8_general_ci utf8_unicode_ci utf8_unicode_ci 2 2 2
|
||||
Warnings:
|
||||
Warning 1105 Invoked routine ran a statement that may cause problems with binary log, see 'NAME_CONST issues' in 'Binary Logging of Stored Programs' section of the manual.
|
||||
SHOW BINLOG EVENTS FROM 1285;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 1285 Query 1 1483 use `bug39182`; CREATE TEMPORARY TABLE tmp1
|
||||
@ -613,4 +615,42 @@ DROP PROCEDURE p1;
|
||||
DROP TABLE t1;
|
||||
DROP DATABASE bug39182;
|
||||
USE test;
|
||||
CREATE PROCEDURE p1(IN v1 INT)
|
||||
BEGIN
|
||||
CREATE TABLE t1 SELECT v1;
|
||||
DROP TABLE t1;
|
||||
END//
|
||||
CREATE PROCEDURE p2()
|
||||
BEGIN
|
||||
DECLARE v1 INT;
|
||||
CREATE TABLE t1 SELECT v1+1;
|
||||
DROP TABLE t1;
|
||||
END//
|
||||
CREATE PROCEDURE p3(IN v1 INT)
|
||||
BEGIN
|
||||
CREATE TABLE t1 SELECT 1 FROM DUAL WHERE v1!=0;
|
||||
DROP TABLE t1;
|
||||
END//
|
||||
CREATE PROCEDURE p4(IN v1 INT)
|
||||
BEGIN
|
||||
DECLARE v2 INT;
|
||||
CREATE TABLE t1 SELECT 1, v1, v2;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 SELECT 1, v1+1, v2;
|
||||
DROP TABLE t1;
|
||||
END//
|
||||
CALL p1(1);
|
||||
CALL p2();
|
||||
Warnings:
|
||||
Warning 1105 Invoked routine ran a statement that may cause problems with binary log, see 'NAME_CONST issues' in 'Binary Logging of Stored Programs' section of the manual.
|
||||
CALL p3(0);
|
||||
Warnings:
|
||||
Warning 1105 Invoked routine ran a statement that may cause problems with binary log, see 'NAME_CONST issues' in 'Binary Logging of Stored Programs' section of the manual.
|
||||
CALL p4(0);
|
||||
Warnings:
|
||||
Warning 1105 Invoked routine ran a statement that may cause problems with binary log, see 'NAME_CONST issues' in 'Binary Logging of Stored Programs' section of the manual.
|
||||
DROP PROCEDURE p1;
|
||||
DROP PROCEDURE p2;
|
||||
DROP PROCEDURE p3;
|
||||
DROP PROCEDURE p4;
|
||||
End of 5.0 tests
|
||||
|
@ -1448,4 +1448,41 @@ COUNT(*)
|
||||
0
|
||||
SET SQL_MODE=default;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE derived1 (a bigint(21));
|
||||
INSERT INTO derived1 VALUES (2);
|
||||
CREATE TABLE D (
|
||||
pk int(11) NOT NULL AUTO_INCREMENT,
|
||||
int_nokey int(11) DEFAULT NULL,
|
||||
int_key int(11) DEFAULT NULL,
|
||||
filler blob,
|
||||
PRIMARY KEY (pk),
|
||||
KEY int_key (int_key)
|
||||
);
|
||||
INSERT INTO D VALUES
|
||||
(39,40,4,repeat(' X', 42)),
|
||||
(43,56,4,repeat(' X', 42)),
|
||||
(47,12,4,repeat(' X', 42)),
|
||||
(71,28,4,repeat(' X', 42)),
|
||||
(76,54,4,repeat(' X', 42)),
|
||||
(83,45,4,repeat(' X', 42)),
|
||||
(105,53,12,NULL);
|
||||
SELECT
|
||||
(SELECT COUNT( int_nokey )
|
||||
FROM derived1 AS X
|
||||
WHERE
|
||||
X.int_nokey < 61
|
||||
GROUP BY pk
|
||||
LIMIT 1)
|
||||
FROM D AS X
|
||||
WHERE X.int_key < 13
|
||||
GROUP BY int_nokey LIMIT 1;
|
||||
(SELECT COUNT( int_nokey )
|
||||
FROM derived1 AS X
|
||||
WHERE
|
||||
X.int_nokey < 61
|
||||
GROUP BY pk
|
||||
LIMIT 1)
|
||||
1
|
||||
DROP TABLE derived1;
|
||||
DROP TABLE D;
|
||||
End of 5.0 tests
|
||||
|
@ -324,4 +324,7 @@ SELECT * FROM t1 WHERE a = NAME_CONST('reportDate',
|
||||
_binary'2009-01-09' COLLATE 'binary');
|
||||
a
|
||||
DROP TABLE t1;
|
||||
select NAME_CONST('_id',1234) as id;
|
||||
id
|
||||
1234
|
||||
End of 5.0 tests
|
||||
|
@ -1267,4 +1267,28 @@ CREATE INDEX i1 on t1 (a(3));
|
||||
SELECT * FROM t1 WHERE a = 'abcde';
|
||||
a
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# BUG #26288: savepoint are not deleted on comit, if the transaction
|
||||
# was otherwise empty
|
||||
#
|
||||
BEGIN;
|
||||
SAVEPOINT s1;
|
||||
COMMIT;
|
||||
RELEASE SAVEPOINT s1;
|
||||
ERROR 42000: SAVEPOINT s1 does not exist
|
||||
BEGIN;
|
||||
SAVEPOINT s2;
|
||||
COMMIT;
|
||||
ROLLBACK TO SAVEPOINT s2;
|
||||
ERROR 42000: SAVEPOINT s2 does not exist
|
||||
BEGIN;
|
||||
SAVEPOINT s3;
|
||||
ROLLBACK;
|
||||
RELEASE SAVEPOINT s3;
|
||||
ERROR 42000: SAVEPOINT s3 does not exist
|
||||
BEGIN;
|
||||
SAVEPOINT s4;
|
||||
ROLLBACK;
|
||||
ROLLBACK TO SAVEPOINT s4;
|
||||
ERROR 42000: SAVEPOINT s4 does not exist
|
||||
End of 5.0 tests
|
||||
|
19
mysql-test/r/lock_multi_bug38499.result
Normal file
19
mysql-test/r/lock_multi_bug38499.result
Normal file
@ -0,0 +1,19 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1( a INT, b INT );
|
||||
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4);
|
||||
# 1. test regular tables
|
||||
# 1.1. test altering of columns that multiupdate doesn't use
|
||||
# 1.1.1. normal mode
|
||||
# 1.1.2. PS mode
|
||||
# 1.2. test altering of columns that multiupdate uses
|
||||
# 1.2.1. normal mode
|
||||
# 1.2.2. PS mode
|
||||
ALTER TABLE t1 ADD COLUMN a INT;
|
||||
# 2. test UNIONs
|
||||
# 2.1. test altering of columns that multiupdate doesn't use
|
||||
# 2.1.1. normal mode
|
||||
# 2.1.2. PS mode
|
||||
# 2.2. test altering of columns that multiupdate uses
|
||||
# 2.2.1. normal mode
|
||||
# 2.2.2. PS mode
|
||||
DROP TABLE t1;
|
17
mysql-test/r/lock_multi_bug38691.result
Normal file
17
mysql-test/r/lock_multi_bug38691.result
Normal file
@ -0,0 +1,17 @@
|
||||
DROP TABLE IF EXISTS t1,t2,t3;
|
||||
CREATE TABLE t1 (
|
||||
a int(11) unsigned default NULL,
|
||||
b varchar(255) default NULL,
|
||||
UNIQUE KEY a (a),
|
||||
KEY b (b)
|
||||
);
|
||||
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3);
|
||||
CREATE TABLE t2 SELECT * FROM t1;
|
||||
CREATE TABLE t3 SELECT * FROM t1;
|
||||
# test altering of columns that multiupdate doesn't use
|
||||
# normal mode
|
||||
# PS mode
|
||||
# test altering of columns that multiupdate uses
|
||||
# normal mode
|
||||
# PS mode
|
||||
DROP TABLE t1, t2, t3;
|
@ -27,3 +27,14 @@ CHECK TABLE t1 EXTENDED;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# BUG#41541 - Valgrind warnings on packed MyISAM table
|
||||
#
|
||||
CREATE TABLE t1(f1 VARCHAR(200), f2 TEXT);
|
||||
INSERT INTO t1 VALUES ('foo', 'foo1'), ('bar', 'bar1');
|
||||
FLUSH TABLE t1;
|
||||
# Compress the table using MYISAMPACK tool
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
1024
|
||||
DROP TABLE t1;
|
||||
|
10
mysql-test/r/mysql-bug41486.result
Normal file
10
mysql-test/r/mysql-bug41486.result
Normal file
@ -0,0 +1,10 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
SET @old_max_allowed_packet= @@global.max_allowed_packet;
|
||||
SET @@global.max_allowed_packet = 2 * 1024 * 1024 + 1024;
|
||||
CREATE TABLE t1(data LONGBLOB);
|
||||
INSERT INTO t1 SELECT REPEAT('1', 2*1024*1024);
|
||||
SELECT LENGTH(data) FROM t1;
|
||||
LENGTH(data)
|
||||
2097152
|
||||
DROP TABLE t1;
|
||||
SET @@global.max_allowed_packet = @old_max_allowed_packet;
|
@ -192,13 +192,4 @@ delimiter
|
||||
1
|
||||
1
|
||||
1
|
||||
set @old_max_allowed_packet = @@global.max_allowed_packet;
|
||||
set @@global.max_allowed_packet = 2 * 1024 * 1024 + 1024;
|
||||
CREATE TABLE t1(data LONGBLOB);
|
||||
INSERT INTO t1 SELECT REPEAT('1', 2*1024*1024);
|
||||
SELECT LENGTH(data) FROM t1;
|
||||
LENGTH(data)
|
||||
2097152
|
||||
DROP TABLE t1;
|
||||
set @@global.max_allowed_packet = @old_max_allowed_packet;
|
||||
End of 5.0 tests
|
||||
|
@ -418,17 +418,17 @@ prepare stmt3 from ' lock tables t1 read ' ;
|
||||
ERROR HY000: This command is not supported in the prepared statement protocol yet
|
||||
prepare stmt3 from ' unlock tables ' ;
|
||||
ERROR HY000: This command is not supported in the prepared statement protocol yet
|
||||
prepare stmt1 from ' load data infile ''data.txt''
|
||||
into table t1 fields terminated by ''\t'' ';
|
||||
prepare stmt1 from ' load data infile ''<MYSQLTEST_VARDIR>/tmp/data.txt''
|
||||
into table t1 fields terminated by ''\t'' ';
|
||||
ERROR HY000: This command is not supported in the prepared statement protocol yet
|
||||
prepare stmt1 from ' select * into outfile ''data.txt'' from t1 ';
|
||||
prepare stmt1 from ' select * into outfile ''<MYSQLTEST_VARDIR>/tmp/data.txt'' from t1 ';
|
||||
execute stmt1 ;
|
||||
prepare stmt1 from ' optimize table t1 ' ;
|
||||
prepare stmt1 from ' analyze table t1 ' ;
|
||||
prepare stmt1 from ' checksum table t1 ' ;
|
||||
ERROR HY000: This command is not supported in the prepared statement protocol yet
|
||||
prepare stmt1 from ' repair table t1 ' ;
|
||||
prepare stmt1 from ' restore table t1 from ''data.txt'' ' ;
|
||||
prepare stmt1 from ' restore table t1 from ''<MYSQLTEST_VARDIR>/tmp/data.txt'' ' ;
|
||||
ERROR HY000: This command is not supported in the prepared statement protocol yet
|
||||
prepare stmt1 from ' handler t1 open ';
|
||||
ERROR HY000: This command is not supported in the prepared statement protocol yet
|
||||
|
28
mysql-test/r/rpl_name_const.result
Normal file
28
mysql-test/r/rpl_name_const.result
Normal file
@ -0,0 +1,28 @@
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
==== Initialize ====
|
||||
[on master]
|
||||
create table t1 (id int);
|
||||
==== create a procedure that has a column aliase in a subquery ====
|
||||
drop procedure if exists test_procedure;
|
||||
create procedure test_procedure(_id int)
|
||||
begin
|
||||
insert into t1 (id)
|
||||
select a.id
|
||||
from
|
||||
( select _id as id ) a;
|
||||
end;$$
|
||||
==== enable the binary log, then call the procedure ====
|
||||
call test_procedure(1234);
|
||||
[on slave]
|
||||
select * from t1 order by id;
|
||||
id
|
||||
1234
|
||||
==== Clean up ====
|
||||
[on master]
|
||||
drop table t1;
|
||||
drop procedure test_procedure;
|
@ -153,4 +153,23 @@ a b
|
||||
SET @@session.time_zone = default;
|
||||
DROP TABLE t1;
|
||||
SET @@session.time_zone = default;
|
||||
reset master;
|
||||
CREATE TABLE t1 (date timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, a int(11) default NULL);
|
||||
SET @@session.time_zone='+01:00';
|
||||
insert into t1 values('2008-12-23 19:39:39',1);
|
||||
SET @@session.time_zone='+02:00';
|
||||
insert delayed into t1 values ('2008-12-23 19:39:39',2);
|
||||
flush table t1;
|
||||
flush logs;
|
||||
select * from t1;
|
||||
date a
|
||||
2008-12-23 20:39:39 1
|
||||
2008-12-23 19:39:39 2
|
||||
DROP TABLE t1;
|
||||
select * from t1 order by a;
|
||||
date a
|
||||
2008-12-23 20:39:39 1
|
||||
2008-12-23 19:39:39 2
|
||||
DROP TABLE t1;
|
||||
SET @@session.time_zone = default;
|
||||
End of 5.0 tests
|
||||
|
@ -2152,4 +2152,11 @@ Warnings:
|
||||
Warning 1052 Column 'kundentyp' in group statement is ambiguous
|
||||
drop table t1;
|
||||
mysqld is alive
|
||||
SET @max_allowed_packet= @@global.max_allowed_packet;
|
||||
SET @net_buffer_length= @@global.net_buffer_length;
|
||||
SET GLOBAL max_allowed_packet= 1024;
|
||||
SET GLOBAL net_buffer_length= 1024;
|
||||
ERROR 1153 (08S01) at line 1: Got a packet bigger than 'max_allowed_packet' bytes
|
||||
SET GLOBAL max_allowed_packet= @max_allowed_packet;
|
||||
SET GLOBAL net_buffer_length= @net_buffer_length;
|
||||
End of 5.0 tests.
|
||||
|
@ -4390,9 +4390,9 @@ drop procedure if exists bug13012|
|
||||
create procedure bug13012()
|
||||
BEGIN
|
||||
REPAIR TABLE t1;
|
||||
BACKUP TABLE t1 to '../tmp';
|
||||
BACKUP TABLE t1 to '<MYSQLTEST_VARDIR>/tmp/';
|
||||
DROP TABLE t1;
|
||||
RESTORE TABLE t1 FROM '../tmp';
|
||||
RESTORE TABLE t1 FROM '<MYSQLTEST_VARDIR>/tmp/';
|
||||
END|
|
||||
call bug13012()|
|
||||
Table Op Msg_type Msg_text
|
||||
|
@ -1961,4 +1961,24 @@ select * from t2;
|
||||
s1
|
||||
drop table t1;
|
||||
drop temporary table t2;
|
||||
#------------------------------------------------------------------------
|
||||
# Bug#39953 Triggers are not working properly with multi table updates
|
||||
#------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TRIGGER IF EXISTS t_insert;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
CREATE TABLE t1 (a int, date_insert timestamp, PRIMARY KEY (a));
|
||||
INSERT INTO t1 (a) VALUES (2),(5);
|
||||
CREATE TABLE t2 (a int, b int, PRIMARY KEY (a));
|
||||
CREATE TRIGGER t_insert AFTER INSERT ON t2 FOR EACH ROW BEGIN UPDATE t1,t2 SET
|
||||
date_insert=NOW() WHERE t1.a=t2.b AND t2.a=NEW.a; END |
|
||||
INSERT INTO t2 (a,b) VALUES (1,2);
|
||||
DROP TRIGGER t_insert;
|
||||
CREATE TRIGGER t_insert AFTER INSERT ON t2 FOR EACH ROW BEGIN UPDATE t1,t2 SET
|
||||
date_insert=NOW(),b=b+1 WHERE t1.a=t2.b AND t2.a=NEW.a; END |
|
||||
INSERT INTO t2 (a,b) VALUES (3,5);
|
||||
ERROR HY000: Can't update table 't2' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
|
||||
DROP TABLE t1;
|
||||
DROP TRIGGER t_insert;
|
||||
DROP TABLE t2;
|
||||
End of 5.0 tests
|
||||
|
@ -1506,4 +1506,16 @@ DESC t6;
|
||||
Field Type Null Key Default Extra
|
||||
NULL int(11) YES NULL
|
||||
DROP TABLE t1, t2, t3, t4, t5, t6;
|
||||
CREATE TABLE t1 (f FLOAT(9,6));
|
||||
CREATE TABLE t2 AS SELECT f FROM t1 UNION SELECT f FROM t1;
|
||||
SHOW FIELDS FROM t2;
|
||||
Field Type Null Key Default Extra
|
||||
f float(9,6) YES NULL
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1(d DOUBLE(9,6));
|
||||
CREATE TABLE t2 AS SELECT d FROM t1 UNION SELECT d FROM t1;
|
||||
SHOW FIELDS FROM t2;
|
||||
Field Type Null Key Default Extra
|
||||
d double(9,6) YES NULL
|
||||
DROP TABLE t1, t2;
|
||||
End of 5.0 tests
|
||||
|
@ -1,24 +1,20 @@
|
||||
set session transaction_prealloc_size=1024*1024*1024*1;
|
||||
show processlist;
|
||||
SET SESSION transaction_prealloc_size=1024*1024*1024*1;
|
||||
SHOW PROCESSLIST;
|
||||
Id User Host db Command Time State Info
|
||||
6 root localhost test Query 0 NULL show processlist
|
||||
set session transaction_prealloc_size=1024*1024*1024*2;
|
||||
show processlist;
|
||||
<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
|
||||
SET SESSION transaction_prealloc_size=1024*1024*1024*2;
|
||||
SHOW PROCESSLIST;
|
||||
Id User Host db Command Time State Info
|
||||
6 root localhost test Query 1 NULL show processlist
|
||||
set session transaction_prealloc_size=1024*1024*1024*3;
|
||||
show processlist;
|
||||
<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
|
||||
SET SESSION transaction_prealloc_size=1024*1024*1024*3;
|
||||
SHOW PROCESSLIST;
|
||||
Id User Host db Command Time State Info
|
||||
6 root localhost test Query 0 NULL show processlist
|
||||
set session transaction_prealloc_size=1024*1024*1024*4;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect transaction_prealloc_size value: '4294967296'
|
||||
show processlist;
|
||||
<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
|
||||
SET SESSION transaction_prealloc_size=1024*1024*1024*4;
|
||||
SHOW PROCESSLIST;
|
||||
Id User Host db Command Time State Info
|
||||
6 root localhost test Query 0 NULL show processlist
|
||||
set session transaction_prealloc_size=1024*1024*1024*5;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect transaction_prealloc_size value: '5368709120'
|
||||
show processlist;
|
||||
<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
|
||||
SET SESSION transaction_prealloc_size=1024*1024*1024*5;
|
||||
SHOW PROCESSLIST;
|
||||
Id User Host db Command Time State Info
|
||||
6 root localhost test Query 0 NULL show processlist
|
||||
<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
|
||||
|
@ -161,4 +161,44 @@ DROP TABLE t1;
|
||||
DROP DATABASE bug39182;
|
||||
USE test;
|
||||
|
||||
#
|
||||
# Bug#35383: binlog playback and replication breaks due to
|
||||
# name_const substitution
|
||||
#
|
||||
DELIMITER //;
|
||||
CREATE PROCEDURE p1(IN v1 INT)
|
||||
BEGIN
|
||||
CREATE TABLE t1 SELECT v1;
|
||||
DROP TABLE t1;
|
||||
END//
|
||||
CREATE PROCEDURE p2()
|
||||
BEGIN
|
||||
DECLARE v1 INT;
|
||||
CREATE TABLE t1 SELECT v1+1;
|
||||
DROP TABLE t1;
|
||||
END//
|
||||
CREATE PROCEDURE p3(IN v1 INT)
|
||||
BEGIN
|
||||
CREATE TABLE t1 SELECT 1 FROM DUAL WHERE v1!=0;
|
||||
DROP TABLE t1;
|
||||
END//
|
||||
CREATE PROCEDURE p4(IN v1 INT)
|
||||
BEGIN
|
||||
DECLARE v2 INT;
|
||||
CREATE TABLE t1 SELECT 1, v1, v2;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 SELECT 1, v1+1, v2;
|
||||
DROP TABLE t1;
|
||||
END//
|
||||
DELIMITER ;//
|
||||
|
||||
CALL p1(1);
|
||||
CALL p2();
|
||||
CALL p3(0);
|
||||
CALL p4(0);
|
||||
DROP PROCEDURE p1;
|
||||
DROP PROCEDURE p2;
|
||||
DROP PROCEDURE p3;
|
||||
DROP PROCEDURE p4;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -955,5 +955,45 @@ SET SQL_MODE=default;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
#
|
||||
# Bug #37348: Crash in or immediately after JOIN::make_sum_func_list
|
||||
#
|
||||
|
||||
CREATE TABLE derived1 (a bigint(21));
|
||||
INSERT INTO derived1 VALUES (2);
|
||||
|
||||
|
||||
CREATE TABLE D (
|
||||
pk int(11) NOT NULL AUTO_INCREMENT,
|
||||
int_nokey int(11) DEFAULT NULL,
|
||||
int_key int(11) DEFAULT NULL,
|
||||
filler blob,
|
||||
PRIMARY KEY (pk),
|
||||
KEY int_key (int_key)
|
||||
);
|
||||
|
||||
INSERT INTO D VALUES
|
||||
(39,40,4,repeat(' X', 42)),
|
||||
(43,56,4,repeat(' X', 42)),
|
||||
(47,12,4,repeat(' X', 42)),
|
||||
(71,28,4,repeat(' X', 42)),
|
||||
(76,54,4,repeat(' X', 42)),
|
||||
(83,45,4,repeat(' X', 42)),
|
||||
(105,53,12,NULL);
|
||||
|
||||
SELECT
|
||||
(SELECT COUNT( int_nokey )
|
||||
FROM derived1 AS X
|
||||
WHERE
|
||||
X.int_nokey < 61
|
||||
GROUP BY pk
|
||||
LIMIT 1)
|
||||
FROM D AS X
|
||||
WHERE X.int_key < 13
|
||||
GROUP BY int_nokey LIMIT 1;
|
||||
|
||||
DROP TABLE derived1;
|
||||
DROP TABLE D;
|
||||
|
||||
###
|
||||
--echo End of 5.0 tests
|
||||
|
@ -445,5 +445,10 @@ SELECT * FROM t1 WHERE a = NAME_CONST('reportDate',
|
||||
_binary'2009-01-09' COLLATE 'binary');
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#35515: Aliases of variables in binary log are ignored with NAME_CONST
|
||||
#
|
||||
select NAME_CONST('_id',1234) as id;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
|
@ -1025,4 +1025,33 @@ CREATE INDEX i1 on t1 (a(3));
|
||||
SELECT * FROM t1 WHERE a = 'abcde';
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # BUG #26288: savepoint are not deleted on comit, if the transaction
|
||||
--echo # was otherwise empty
|
||||
--echo #
|
||||
BEGIN;
|
||||
SAVEPOINT s1;
|
||||
COMMIT;
|
||||
--error 1305
|
||||
RELEASE SAVEPOINT s1;
|
||||
|
||||
BEGIN;
|
||||
SAVEPOINT s2;
|
||||
COMMIT;
|
||||
--error 1305
|
||||
ROLLBACK TO SAVEPOINT s2;
|
||||
|
||||
BEGIN;
|
||||
SAVEPOINT s3;
|
||||
ROLLBACK;
|
||||
--error 1305
|
||||
RELEASE SAVEPOINT s3;
|
||||
|
||||
BEGIN;
|
||||
SAVEPOINT s4;
|
||||
ROLLBACK;
|
||||
--error 1305
|
||||
ROLLBACK TO SAVEPOINT s4;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -84,8 +84,6 @@ insert into t1 values(2,2);
|
||||
insert into t2 values(1,2);
|
||||
lock table t1 read;
|
||||
connection writer;
|
||||
# mleich: IMHO the "send is not necessary because the update should not block.
|
||||
# But it will save some runtime in case we block because of an error.
|
||||
send
|
||||
update t1,t2 set c=a where b=d;
|
||||
connection reader;
|
||||
@ -191,8 +189,8 @@ connection locker;
|
||||
USE mysql;
|
||||
LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE;
|
||||
FLUSH TABLES;
|
||||
--sleep 1
|
||||
#
|
||||
|
||||
|
||||
connection reader;
|
||||
USE mysql;
|
||||
# Note: This must be a multi-table select, otherwise the deadlock will not occur
|
||||
|
221
mysql-test/t/lock_multi_bug38499.test
Normal file
221
mysql-test/t/lock_multi_bug38499.test
Normal file
@ -0,0 +1,221 @@
|
||||
# Bug38499 flush tables and multitable table update with derived table cause crash
|
||||
# MySQL >= 5.0
|
||||
#
|
||||
|
||||
# Save the initial number of concurrent sessions
|
||||
--source include/count_sessions.inc
|
||||
|
||||
connect (locker,localhost,root,,);
|
||||
connect (writer,localhost,root,,);
|
||||
|
||||
--connection default
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
CREATE TABLE t1( a INT, b INT );
|
||||
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4);
|
||||
|
||||
--echo # 1. test regular tables
|
||||
--echo # 1.1. test altering of columns that multiupdate doesn't use
|
||||
--echo # 1.1.1. normal mode
|
||||
|
||||
--disable_query_log
|
||||
let $i = 100;
|
||||
while ($i) {
|
||||
--dec $i
|
||||
|
||||
--connection writer
|
||||
send UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0;
|
||||
|
||||
--connection locker
|
||||
ALTER TABLE t1 ADD COLUMN (c INT);
|
||||
ALTER TABLE t1 DROP COLUMN c;
|
||||
|
||||
--connection writer
|
||||
--reap
|
||||
}
|
||||
|
||||
--echo # 1.1.2. PS mode
|
||||
|
||||
--connection writer
|
||||
PREPARE stmt FROM 'UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0';
|
||||
|
||||
let $i = 100;
|
||||
while ($i) {
|
||||
--dec $i
|
||||
|
||||
--connection writer
|
||||
--send EXECUTE stmt
|
||||
|
||||
--connection locker
|
||||
ALTER TABLE t1 ADD COLUMN (c INT);
|
||||
ALTER TABLE t1 DROP COLUMN c;
|
||||
|
||||
--connection writer
|
||||
--reap
|
||||
}
|
||||
--enable_query_log
|
||||
|
||||
--echo # 1.2. test altering of columns that multiupdate uses
|
||||
--echo # 1.2.1. normal mode
|
||||
|
||||
--connection default
|
||||
|
||||
--disable_query_log
|
||||
let $i = 100;
|
||||
while ($i) {
|
||||
dec $i;
|
||||
|
||||
--connection locker
|
||||
--error 0,ER_DUP_FIELDNAME
|
||||
ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL;
|
||||
UPDATE t1 SET a=b;
|
||||
|
||||
--connection writer
|
||||
--send UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0;
|
||||
|
||||
--connection locker
|
||||
--error 0,ER_CANT_DROP_FIELD_OR_KEY
|
||||
ALTER TABLE t1 DROP COLUMN a;
|
||||
|
||||
--connection writer
|
||||
--error 0,ER_BAD_FIELD_ERROR # unknown column error
|
||||
--reap
|
||||
}
|
||||
--enable_query_log
|
||||
|
||||
--echo # 1.2.2. PS mode
|
||||
|
||||
--disable_query_log
|
||||
let $i = 100;
|
||||
while ($i) {
|
||||
dec $i;
|
||||
|
||||
--connection locker
|
||||
--error 0,ER_DUP_FIELDNAME
|
||||
ALTER TABLE t1 ADD COLUMN a INT;
|
||||
UPDATE t1 SET a=b;
|
||||
|
||||
--connection writer
|
||||
PREPARE stmt FROM 'UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0';
|
||||
--send EXECUTE stmt
|
||||
|
||||
--connection locker
|
||||
--error 0,ER_CANT_DROP_FIELD_OR_KEY
|
||||
ALTER TABLE t1 DROP COLUMN a;
|
||||
|
||||
--connection writer
|
||||
--error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
|
||||
--reap
|
||||
}
|
||||
--enable_query_log
|
||||
--connection default
|
||||
ALTER TABLE t1 ADD COLUMN a INT;
|
||||
|
||||
--echo # 2. test UNIONs
|
||||
--echo # 2.1. test altering of columns that multiupdate doesn't use
|
||||
--echo # 2.1.1. normal mode
|
||||
|
||||
--disable_query_log
|
||||
let $i = 100;
|
||||
while ($i) {
|
||||
--dec $i
|
||||
|
||||
--connection writer
|
||||
send UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0;
|
||||
|
||||
--connection locker
|
||||
ALTER TABLE t1 ADD COLUMN (c INT);
|
||||
ALTER TABLE t1 DROP COLUMN c;
|
||||
|
||||
--connection writer
|
||||
--reap
|
||||
}
|
||||
|
||||
--echo # 2.1.2. PS mode
|
||||
|
||||
--connection writer
|
||||
PREPARE stmt FROM 'UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0';
|
||||
|
||||
let $i = 100;
|
||||
while ($i) {
|
||||
--dec $i
|
||||
|
||||
--connection writer
|
||||
--send EXECUTE stmt
|
||||
|
||||
--connection locker
|
||||
ALTER TABLE t1 ADD COLUMN (c INT);
|
||||
ALTER TABLE t1 DROP COLUMN c;
|
||||
|
||||
--connection writer
|
||||
--reap
|
||||
}
|
||||
--enable_query_log
|
||||
|
||||
--echo # 2.2. test altering of columns that multiupdate uses
|
||||
--echo # 2.2.1. normal mode
|
||||
|
||||
--connection default
|
||||
|
||||
--disable_query_log
|
||||
let $i = 100;
|
||||
while ($i) {
|
||||
dec $i;
|
||||
|
||||
--connection locker
|
||||
--error 0,ER_DUP_FIELDNAME
|
||||
ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL;
|
||||
UPDATE t1 SET a=b;
|
||||
|
||||
--connection writer
|
||||
--send UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0;
|
||||
|
||||
--connection locker
|
||||
--error 0,ER_CANT_DROP_FIELD_OR_KEY
|
||||
ALTER TABLE t1 DROP COLUMN a;
|
||||
|
||||
--connection writer
|
||||
--error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
|
||||
--reap
|
||||
}
|
||||
--enable_query_log
|
||||
|
||||
--echo # 2.2.2. PS mode
|
||||
|
||||
--disable_query_log
|
||||
let $i = 100;
|
||||
while ($i) {
|
||||
dec $i;
|
||||
|
||||
--connection locker
|
||||
--error 0,ER_DUP_FIELDNAME
|
||||
ALTER TABLE t1 ADD COLUMN a INT;
|
||||
UPDATE t1 SET a=b;
|
||||
|
||||
--connection writer
|
||||
PREPARE stmt FROM 'UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0';
|
||||
--send EXECUTE stmt
|
||||
|
||||
--connection locker
|
||||
--error 0,ER_CANT_DROP_FIELD_OR_KEY
|
||||
ALTER TABLE t1 DROP COLUMN a;
|
||||
|
||||
--connection writer
|
||||
--error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
|
||||
--reap
|
||||
}
|
||||
--enable_query_log
|
||||
--connection default
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
# Close connections
|
||||
--disconnect locker
|
||||
--disconnect writer
|
||||
|
||||
# End of 5.0 tests
|
||||
|
||||
# Wait till all disconnects are completed
|
||||
--source include/wait_until_count_sessions.inc
|
||||
|
141
mysql-test/t/lock_multi_bug38691.test
Normal file
141
mysql-test/t/lock_multi_bug38691.test
Normal file
@ -0,0 +1,141 @@
|
||||
#
|
||||
# Bug#38691 segfault/abort in ``UPDATE ...JOIN'' while
|
||||
# ``FLUSH TABLES WITH READ LOCK''
|
||||
# MySQL >= 5.0
|
||||
#
|
||||
|
||||
|
||||
# Save the initial number of concurrent sessions
|
||||
--source include/count_sessions.inc
|
||||
|
||||
# Test to see if select will get the lock ahead of low priority update
|
||||
|
||||
connect (locker,localhost,root,,);
|
||||
connect (writer,localhost,root,,);
|
||||
|
||||
--connection default
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1,t2,t3;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (
|
||||
a int(11) unsigned default NULL,
|
||||
b varchar(255) default NULL,
|
||||
UNIQUE KEY a (a),
|
||||
KEY b (b)
|
||||
);
|
||||
|
||||
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3);
|
||||
CREATE TABLE t2 SELECT * FROM t1;
|
||||
CREATE TABLE t3 SELECT * FROM t1;
|
||||
|
||||
--echo # test altering of columns that multiupdate doesn't use
|
||||
|
||||
--echo # normal mode
|
||||
|
||||
--disable_query_log
|
||||
let $i = 100;
|
||||
while ($i) {
|
||||
--dec $i
|
||||
|
||||
--connection writer
|
||||
send UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a)
|
||||
SET a = NULL WHERE t1.b <> t2.b;
|
||||
|
||||
--connection locker
|
||||
ALTER TABLE t2 ADD COLUMN (c INT);
|
||||
ALTER TABLE t2 DROP COLUMN c;
|
||||
|
||||
--connection writer
|
||||
--reap
|
||||
}
|
||||
|
||||
--echo # PS mode
|
||||
|
||||
--connection writer
|
||||
PREPARE stmt FROM 'UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a)
|
||||
SET a = NULL WHERE t1.b <> t2.b';
|
||||
|
||||
let $i = 100;
|
||||
while ($i) {
|
||||
--dec $i
|
||||
|
||||
--connection writer
|
||||
--send EXECUTE stmt
|
||||
|
||||
--connection locker
|
||||
ALTER TABLE t2 ADD COLUMN (c INT);
|
||||
ALTER TABLE t2 DROP COLUMN c;
|
||||
|
||||
--connection writer
|
||||
--reap
|
||||
}
|
||||
--enable_query_log
|
||||
|
||||
|
||||
--echo # test altering of columns that multiupdate uses
|
||||
|
||||
--echo # normal mode
|
||||
|
||||
--connection default
|
||||
|
||||
--disable_query_log
|
||||
let $i = 100;
|
||||
while ($i) {
|
||||
dec $i;
|
||||
|
||||
--connection locker
|
||||
--error 0,ER_DUP_FIELDNAME
|
||||
ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL;
|
||||
UPDATE t2 SET a=b;
|
||||
|
||||
--connection writer
|
||||
--send UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a) SET a = NULL WHERE t1.b <> t2.b
|
||||
|
||||
--connection locker
|
||||
--error 0,ER_CANT_DROP_FIELD_OR_KEY
|
||||
ALTER TABLE t2 DROP COLUMN a;
|
||||
|
||||
--connection writer
|
||||
--error 0,ER_BAD_FIELD_ERROR
|
||||
--reap
|
||||
}
|
||||
--enable_query_log
|
||||
|
||||
--echo # PS mode
|
||||
|
||||
--disable_query_log
|
||||
let $i = 100;
|
||||
while ($i) {
|
||||
dec $i;
|
||||
|
||||
--connection locker
|
||||
--error 0,ER_DUP_FIELDNAME
|
||||
ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL;
|
||||
UPDATE t2 SET a=b;
|
||||
|
||||
--connection writer
|
||||
PREPARE stmt FROM 'UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a) SET a = NULL WHERE t1.b <> t2.b';
|
||||
--send EXECUTE stmt
|
||||
|
||||
--connection locker
|
||||
--error 0,ER_CANT_DROP_FIELD_OR_KEY
|
||||
ALTER TABLE t2 DROP COLUMN a;
|
||||
|
||||
--connection writer
|
||||
--error 0,ER_BAD_FIELD_ERROR
|
||||
--reap
|
||||
|
||||
}
|
||||
--enable_query_log
|
||||
--connection default
|
||||
DROP TABLE t1, t2, t3;
|
||||
|
||||
|
||||
# Close connections
|
||||
--disconnect locker
|
||||
--disconnect writer
|
||||
|
||||
# Wait till all disconnects are completed
|
||||
--source include/wait_until_count_sessions.inc
|
||||
|
@ -31,3 +31,22 @@ FLUSH TABLES;
|
||||
--exec $MYISAMCHK -s --unpack $MYSQLTEST_VARDIR/master-data/test/t1
|
||||
CHECK TABLE t1 EXTENDED;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # BUG#41541 - Valgrind warnings on packed MyISAM table
|
||||
--echo #
|
||||
CREATE TABLE t1(f1 VARCHAR(200), f2 TEXT);
|
||||
INSERT INTO t1 VALUES ('foo', 'foo1'), ('bar', 'bar1');
|
||||
let $i=9;
|
||||
--disable_query_log
|
||||
while ($i)
|
||||
{
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
dec $i;
|
||||
}
|
||||
--enable_query_log
|
||||
FLUSH TABLE t1;
|
||||
--echo # Compress the table using MYISAMPACK tool
|
||||
--exec $MYISAMPACK $MYSQLTEST_VARDIR/master-data/test/t1
|
||||
SELECT COUNT(*) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
45
mysql-test/t/mysql-bug41486.test
Normal file
45
mysql-test/t/mysql-bug41486.test
Normal file
@ -0,0 +1,45 @@
|
||||
#
|
||||
# Bug#41486 extra character appears in BLOB for every ~40Mb after
|
||||
# mysqldump/import
|
||||
#
|
||||
# This test consumes a significant amount of resources.
|
||||
# Therefore it should be kept separated from other tests.
|
||||
# Otherwise we might suffer from problems like
|
||||
# Bug#43801 mysql.test takes too long, fails due to expired timeout
|
||||
# on debx86-b in PB
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
# Have to change the global variable as the session variable is
|
||||
# read-only.
|
||||
SET @old_max_allowed_packet= @@global.max_allowed_packet;
|
||||
# 2 MB blob length + some space for the rest of INSERT query
|
||||
SET @@global.max_allowed_packet = 2 * 1024 * 1024 + 1024;
|
||||
|
||||
# Create a new connection since the global max_allowed_packet
|
||||
# has no effect for the current connection
|
||||
connect (con1, localhost, root,,);
|
||||
|
||||
CREATE TABLE t1(data LONGBLOB);
|
||||
INSERT INTO t1 SELECT REPEAT('1', 2*1024*1024);
|
||||
|
||||
let $outfile= $MYSQLTEST_VARDIR/tmp/bug41486.sql;
|
||||
--error 0,1
|
||||
remove_file $outfile;
|
||||
--exec $MYSQL_DUMP test t1 > $outfile
|
||||
# Check that the mysql client does not insert extra newlines when loading
|
||||
# strings longer than client's max_allowed_packet
|
||||
--exec $MYSQL --max_allowed_packet=1M test < $outfile 2>&1
|
||||
SELECT LENGTH(data) FROM t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
# Cleanup
|
||||
disconnect con1;
|
||||
--source include/wait_until_disconnected.inc
|
||||
remove_file $outfile;
|
||||
connection default;
|
||||
SET @@global.max_allowed_packet = @old_max_allowed_packet;
|
@ -341,37 +341,4 @@ EOF
|
||||
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/bug31060.sql;
|
||||
|
||||
#
|
||||
# Bug #41486: extra character appears in BLOB for every ~40Mb after
|
||||
# mysqldump/import
|
||||
#
|
||||
|
||||
# Have to change the global variable as the session variable is
|
||||
# read-only.
|
||||
set @old_max_allowed_packet = @@global.max_allowed_packet;
|
||||
# 2 MB blob length + some space for the rest of INSERT query
|
||||
set @@global.max_allowed_packet = 2 * 1024 * 1024 + 1024;
|
||||
|
||||
# Create a new connection since the global max_allowed_packet
|
||||
# has no effect for the current connection
|
||||
connect (con1, localhost, root,,);
|
||||
connection con1;
|
||||
|
||||
CREATE TABLE t1(data LONGBLOB);
|
||||
INSERT INTO t1 SELECT REPEAT('1', 2*1024*1024);
|
||||
|
||||
--exec $MYSQL_DUMP test t1 >$MYSQLTEST_VARDIR/tmp/bug41486.sql
|
||||
# Check that the mysql client does not insert extra newlines when loading
|
||||
# strings longer than client's max_allowed_packet
|
||||
--exec $MYSQL --max_allowed_packet=1M test < $MYSQLTEST_VARDIR/tmp/bug41486.sql 2>&1
|
||||
SELECT LENGTH(data) FROM t1;
|
||||
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/bug41486.sql;
|
||||
DROP TABLE t1;
|
||||
|
||||
connection default;
|
||||
disconnect con1;
|
||||
|
||||
set @@global.max_allowed_packet = @old_max_allowed_packet;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -70,71 +70,71 @@ prepare stmt1 from ' select 1 as my_col ' ;
|
||||
# prepare with parameter
|
||||
prepare stmt1 from ' select ? as my_col ' ;
|
||||
# prepare must fail (incomplete statements/wrong syntax)
|
||||
--error 1064
|
||||
--error ER_PARSE_ERROR
|
||||
prepare ;
|
||||
--error 1064
|
||||
--error ER_PARSE_ERROR
|
||||
prepare stmt1 ;
|
||||
--error 1064
|
||||
--error ER_PARSE_ERROR
|
||||
prepare stmt1 from ;
|
||||
--error 1064
|
||||
--error ER_PARSE_ERROR
|
||||
prepare_garbage stmt1 from ' select 1 ' ;
|
||||
--error 1064
|
||||
--error ER_PARSE_ERROR
|
||||
prepare stmt1 from_garbage ' select 1 ' ;
|
||||
--error 1064
|
||||
--error ER_PARSE_ERROR
|
||||
prepare stmt1 from ' select_garbage 1 ' ;
|
||||
--error 1064
|
||||
--error ER_PARSE_ERROR
|
||||
prepare from ' select 1 ' ;
|
||||
--error 1064
|
||||
--error ER_PARSE_ERROR
|
||||
prepare stmt1 ' select 1 ' ;
|
||||
--error 1064
|
||||
--error ER_PARSE_ERROR
|
||||
prepare ? from ' select ? as my_col ' ;
|
||||
# statement in variable
|
||||
set @arg00='select 1 as my_col';
|
||||
prepare stmt1 from @arg00;
|
||||
# prepare must fail (query variable is empty)
|
||||
set @arg00='';
|
||||
--error 1065
|
||||
--error ER_EMPTY_QUERY
|
||||
prepare stmt1 from @arg00;
|
||||
set @arg00=NULL;
|
||||
# prepare must fail (query variable is NULL)
|
||||
--error 1064
|
||||
--error ER_PARSE_ERROR
|
||||
prepare stmt1 from @arg01;
|
||||
|
||||
prepare stmt1 from ' select * from t1 where a <= 2 ' ;
|
||||
# prepare must fail (column x does not exist)
|
||||
--error 1054
|
||||
--error ER_BAD_FIELD_ERROR
|
||||
prepare stmt1 from ' select * from t1 where x <= 2 ' ;
|
||||
# cases derived from client_test.c: test_null()
|
||||
# prepare must fail (column x does not exist)
|
||||
--error 1054
|
||||
--error ER_BAD_FIELD_ERROR
|
||||
prepare stmt1 from ' insert into t1(a,x) values(?,?) ' ;
|
||||
--error 1054
|
||||
--error ER_BAD_FIELD_ERROR
|
||||
prepare stmt1 from ' insert into t1(x,a) values(?,?) ' ;
|
||||
--disable_warnings
|
||||
drop table if exists not_exist ;
|
||||
--enable_warnings
|
||||
# prepare must fail (table does not exist)
|
||||
--error 1146
|
||||
--error ER_NO_SUCH_TABLE
|
||||
prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
|
||||
|
||||
# case derived from client_test.c: test_prepare_syntax()
|
||||
# prepare must fail (incomplete statement)
|
||||
--error 1064
|
||||
--error ER_PARSE_ERROR
|
||||
prepare stmt1 from ' insert into t1 values(? ' ;
|
||||
--error 1064
|
||||
--error ER_PARSE_ERROR
|
||||
prepare stmt1 from ' select a, b from t1
|
||||
where a=? and where ' ;
|
||||
|
||||
################ EXECUTE ################
|
||||
# execute must fail (statement never_prepared never prepared)
|
||||
--error 1243
|
||||
--error ER_UNKNOWN_STMT_HANDLER
|
||||
execute never_prepared ;
|
||||
# execute must fail (prepare stmt1 just failed,
|
||||
# but there was a successful prepare of stmt1 before)
|
||||
prepare stmt1 from ' select * from t1 where a <= 2 ' ;
|
||||
--error 1146
|
||||
--error ER_NO_SUCH_TABLE
|
||||
prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
|
||||
--error 1243
|
||||
--error ER_UNKNOWN_STMT_HANDLER
|
||||
execute stmt1 ;
|
||||
|
||||
# drop the table between prepare and execute
|
||||
@ -149,7 +149,7 @@ prepare stmt2 from ' select * from t5 ' ;
|
||||
execute stmt2 ;
|
||||
drop table t5 ;
|
||||
# execute must fail (table was dropped after prepare)
|
||||
--error 1146
|
||||
--error ER_NO_SUCH_TABLE
|
||||
execute stmt2 ;
|
||||
# cases derived from client_test.c: test_select_prepare()
|
||||
# 1. drop + create table (same column names/types/order)
|
||||
@ -218,7 +218,7 @@ create table t5
|
||||
f3 int
|
||||
);
|
||||
insert into t5( f1, f2, f3) values( 9, 'recreated table', 9);
|
||||
--error 1054
|
||||
--error ER_BAD_FIELD_ERROR
|
||||
execute stmt2 ;
|
||||
drop table t5 ;
|
||||
|
||||
@ -231,24 +231,24 @@ set @arg01='two' ;
|
||||
prepare stmt1 from ' select * from t1 where a <= ? ' ;
|
||||
execute stmt1 using @arg00;
|
||||
# execute must fail (too small number of parameters)
|
||||
--error 1210
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
execute stmt1 ;
|
||||
# execute must fail (too big number of parameters)
|
||||
--error 1210
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
execute stmt1 using @arg00, @arg01;
|
||||
# execute must fail (parameter is not set)
|
||||
execute stmt1 using @not_set;
|
||||
|
||||
################ DEALLOCATE ################
|
||||
# deallocate must fail (the statement 'never_prepared' was never prepared)
|
||||
--error 1243
|
||||
--error ER_UNKNOWN_STMT_HANDLER
|
||||
deallocate prepare never_prepared ;
|
||||
# deallocate must fail (prepare stmt1 just failed,
|
||||
# but there was a successful prepare before)
|
||||
prepare stmt1 from ' select * from t1 where a <= 2 ' ;
|
||||
--error 1146
|
||||
--error ER_NO_SUCH_TABLE
|
||||
prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
|
||||
--error 1243
|
||||
--error ER_UNKNOWN_STMT_HANDLER
|
||||
deallocate prepare stmt1;
|
||||
create table t5
|
||||
(
|
||||
@ -330,17 +330,17 @@ prepare stmt4 from ' show engine bdb logs ';
|
||||
execute stmt4;
|
||||
--enable_result_log
|
||||
prepare stmt4 from ' show grants for user ';
|
||||
--error 1295
|
||||
--error ER_UNSUPPORTED_PS
|
||||
prepare stmt4 from ' show create table t2 ';
|
||||
--error 1295
|
||||
--error ER_UNSUPPORTED_PS
|
||||
prepare stmt4 from ' show master status ';
|
||||
--error 1295
|
||||
--error ER_UNSUPPORTED_PS
|
||||
prepare stmt4 from ' show master logs ';
|
||||
--error 1295
|
||||
--error ER_UNSUPPORTED_PS
|
||||
prepare stmt4 from ' show slave status ';
|
||||
--error 1295
|
||||
--error ER_UNSUPPORTED_PS
|
||||
prepare stmt4 from ' show warnings limit 20 ';
|
||||
--error 1295
|
||||
--error ER_UNSUPPORTED_PS
|
||||
prepare stmt4 from ' show errors limit 20 ';
|
||||
prepare stmt4 from ' show storage engines ';
|
||||
--replace_column 2 YES/NO
|
||||
@ -355,7 +355,7 @@ drop table if exists t5;
|
||||
prepare stmt1 from ' drop table if exists t5 ' ;
|
||||
execute stmt1 ;
|
||||
prepare stmt1 from ' drop table t5 ' ;
|
||||
--error 1051
|
||||
--error ER_BAD_TABLE_ERROR
|
||||
execute stmt1 ;
|
||||
|
||||
## SELECT @@version
|
||||
@ -428,14 +428,14 @@ prepare stmt1 from ' deallocate prepare never_prepared ' ;
|
||||
prepare stmt1 from 'alter view v1 as select 2';
|
||||
|
||||
## switch the database connection
|
||||
--error 1295
|
||||
--error ER_UNSUPPORTED_PS
|
||||
prepare stmt4 from ' use test ' ;
|
||||
|
||||
## create/drop database
|
||||
--error 1295
|
||||
--error ER_UNSUPPORTED_PS
|
||||
prepare stmt3 from ' create database mysqltest ';
|
||||
create database mysqltest ;
|
||||
--error 1295
|
||||
--error ER_UNSUPPORTED_PS
|
||||
prepare stmt3 from ' drop database mysqltest ';
|
||||
drop database mysqltest ;
|
||||
|
||||
@ -444,29 +444,40 @@ drop database mysqltest ;
|
||||
prepare stmt3 from ' describe t2 ';
|
||||
execute stmt3;
|
||||
drop table t2 ;
|
||||
--error 1146
|
||||
--error ER_NO_SUCH_TABLE
|
||||
execute stmt3;
|
||||
## lock/unlock
|
||||
--error 1295
|
||||
--error ER_UNSUPPORTED_PS
|
||||
prepare stmt3 from ' lock tables t1 read ' ;
|
||||
--error 1295
|
||||
--error ER_UNSUPPORTED_PS
|
||||
prepare stmt3 from ' unlock tables ' ;
|
||||
## Load/Unload table contents
|
||||
--error 1295
|
||||
prepare stmt1 from ' load data infile ''data.txt''
|
||||
into table t1 fields terminated by ''\t'' ';
|
||||
prepare stmt1 from ' select * into outfile ''data.txt'' from t1 ';
|
||||
execute stmt1 ;
|
||||
|
||||
--let $datafile = $MYSQLTEST_VARDIR/tmp/data.txt
|
||||
--error 0,1
|
||||
--remove_file $datafile
|
||||
|
||||
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
|
||||
--error ER_UNSUPPORTED_PS
|
||||
eval prepare stmt1 from ' load data infile ''$datafile''
|
||||
into table t1 fields terminated by ''\t'' ';
|
||||
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
|
||||
eval prepare stmt1 from ' select * into outfile ''$datafile'' from t1 ';
|
||||
execute stmt1 ;
|
||||
##
|
||||
prepare stmt1 from ' optimize table t1 ' ;
|
||||
prepare stmt1 from ' analyze table t1 ' ;
|
||||
--error 1295
|
||||
--error ER_UNSUPPORTED_PS
|
||||
prepare stmt1 from ' checksum table t1 ' ;
|
||||
prepare stmt1 from ' repair table t1 ' ;
|
||||
--error 1295
|
||||
prepare stmt1 from ' restore table t1 from ''data.txt'' ' ;
|
||||
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
|
||||
--error ER_UNSUPPORTED_PS
|
||||
eval prepare stmt1 from ' restore table t1 from ''$datafile'' ' ;
|
||||
--remove_file $datafile
|
||||
|
||||
|
||||
## handler
|
||||
--error 1295
|
||||
--error ER_UNSUPPORTED_PS
|
||||
prepare stmt1 from ' handler t1 open ';
|
||||
|
||||
|
||||
@ -492,11 +503,11 @@ SET sql_mode=ansi;
|
||||
execute stmt5;
|
||||
SET sql_mode="";
|
||||
|
||||
--error 1295
|
||||
--error ER_UNSUPPORTED_PS
|
||||
prepare stmt1 from ' flush local privileges ' ;
|
||||
--error 1295
|
||||
--error ER_UNSUPPORTED_PS
|
||||
prepare stmt1 from ' reset query cache ' ;
|
||||
--error 1295
|
||||
--error ER_UNSUPPORTED_PS
|
||||
prepare stmt1 from ' KILL 0 ';
|
||||
|
||||
## simple explain
|
||||
@ -582,7 +593,7 @@ drop table if exists new_t2;
|
||||
--enable_warnings
|
||||
prepare stmt3 from ' rename table t2 to new_t2 ';
|
||||
execute stmt3;
|
||||
--error 1050
|
||||
--error ER_TABLE_EXISTS_ERROR
|
||||
execute stmt3;
|
||||
rename table new_t2 to t2;
|
||||
drop table t2;
|
||||
@ -593,13 +604,13 @@ create table t5 (a int) ;
|
||||
# rename must fail, t7 does not exist
|
||||
# Clean up the filename here because embedded server reports whole path
|
||||
--replace_result \\ / $MYSQLTEST_VARDIR . /master-data/ / t7.frm t7
|
||||
--error 1017
|
||||
--error ER_FILE_NOT_FOUND
|
||||
execute stmt1 ;
|
||||
create table t7 (a int) ;
|
||||
# rename, t5 -> t6 and t7 -> t8
|
||||
execute stmt1 ;
|
||||
# rename must fail, t5 and t7 does not exist t6 and t8 already exist
|
||||
--error 1050
|
||||
--error ER_TABLE_EXISTS_ERROR
|
||||
execute stmt1 ;
|
||||
rename table t6 to t5, t8 to t7 ;
|
||||
# rename, t5 -> t6 and t7 -> t8
|
||||
|
47
mysql-test/t/rpl_name_const.test
Normal file
47
mysql-test/t/rpl_name_const.test
Normal file
@ -0,0 +1,47 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Test that aliases of variables in binary log aren't ignored with NAME_CONST.
|
||||
#
|
||||
# ==== Method ====
|
||||
#
|
||||
# Create a procedure with aliases of variables, then replicate it to slave.
|
||||
# BUG#35515 Aliases of variables in binary log are ignored with NAME_CONST.
|
||||
#
|
||||
|
||||
source include/master-slave.inc;
|
||||
|
||||
--echo ==== Initialize ====
|
||||
|
||||
--echo [on master]
|
||||
--connection master
|
||||
|
||||
create table t1 (id int);
|
||||
|
||||
--echo ==== create a procedure that has a column aliase in a subquery ====
|
||||
--disable_warnings
|
||||
drop procedure if exists test_procedure;
|
||||
--enable_warnings
|
||||
delimiter $$;
|
||||
create procedure test_procedure(_id int)
|
||||
begin
|
||||
insert into t1 (id)
|
||||
select a.id
|
||||
from
|
||||
( select _id as id ) a;
|
||||
end;$$
|
||||
delimiter ;$$
|
||||
|
||||
--echo ==== enable the binary log, then call the procedure ====
|
||||
call test_procedure(1234);
|
||||
|
||||
|
||||
--echo [on slave]
|
||||
sync_slave_with_master;
|
||||
select * from t1 order by id;
|
||||
|
||||
--echo ==== Clean up ====
|
||||
|
||||
--echo [on master]
|
||||
connection master;
|
||||
drop table t1;
|
||||
drop procedure test_procedure;
|
@ -154,5 +154,31 @@ connection master;
|
||||
DROP TABLE t1;
|
||||
SET @@session.time_zone = default;
|
||||
|
||||
# Bug#41719 delayed INSERT into timestamp col needs set time_zone for concurrent binlogging
|
||||
# To test that time_zone is correctly binloging for 'insert delayed' statement
|
||||
# Insert 2 values into timestamp col with different time_zone. Check result.
|
||||
|
||||
--connection master
|
||||
reset master;
|
||||
CREATE TABLE t1 (date timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, a int(11) default NULL);
|
||||
|
||||
SET @@session.time_zone='+01:00';
|
||||
insert into t1 values('2008-12-23 19:39:39',1);
|
||||
|
||||
--connection master1
|
||||
SET @@session.time_zone='+02:00';
|
||||
insert delayed into t1 values ('2008-12-23 19:39:39',2);
|
||||
# Forces table t1 to be closed and flushes the query cache.
|
||||
# This makes sure that 'delayed insert' is executed before next statement.
|
||||
flush table t1;
|
||||
flush logs;
|
||||
select * from t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 | $MYSQL
|
||||
--connection master1
|
||||
select * from t1 order by a;
|
||||
DROP TABLE t1;
|
||||
SET @@session.time_zone = default;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -16,4 +16,23 @@ if (`SELECT '$shm' != 'ON'`){
|
||||
#
|
||||
--exec $MYSQLADMIN --no-defaults --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --shared-memory-base-name=HeyMrBaseNameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ping
|
||||
|
||||
#
|
||||
# Bug #33899: Deadlock in mysql_real_query with shared memory connections
|
||||
#
|
||||
|
||||
let $name= query_get_value("SHOW GLOBAL VARIABLES LIKE 'shared_memory_base_name'", Value, 1);
|
||||
let $stmt= `SELECT REPEAT('a', 2048)`;
|
||||
|
||||
SET @max_allowed_packet= @@global.max_allowed_packet;
|
||||
SET @net_buffer_length= @@global.net_buffer_length;
|
||||
|
||||
SET GLOBAL max_allowed_packet= 1024;
|
||||
SET GLOBAL net_buffer_length= 1024;
|
||||
|
||||
--error 1
|
||||
--exec echo SELECT '$stmt'| $MYSQL --protocol=memory --shared-memory-base-name=$name 2>&1
|
||||
|
||||
SET GLOBAL max_allowed_packet= @max_allowed_packet;
|
||||
SET GLOBAL net_buffer_length= @net_buffer_length;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
@ -1271,7 +1271,7 @@ select *, f8() from v1|
|
||||
|
||||
# Let us test what will happen if function is missing
|
||||
drop function f1|
|
||||
--error 1356
|
||||
--error ER_VIEW_INVALID
|
||||
select * from v1|
|
||||
|
||||
# And what will happen if we have recursion which involves
|
||||
@ -1310,9 +1310,9 @@ select f0()|
|
||||
select * from v0|
|
||||
select *, f0() from v0, (select 123) as d1|
|
||||
# But these should not !
|
||||
--error 1100
|
||||
--error ER_TABLE_NOT_LOCKED
|
||||
select id, f3() from t1|
|
||||
--error 1100
|
||||
--error ER_TABLE_NOT_LOCKED
|
||||
select f4()|
|
||||
unlock tables|
|
||||
|
||||
@ -1322,9 +1322,9 @@ lock tables v2 read, mysql.proc read|
|
||||
select * from v2|
|
||||
select * from v1|
|
||||
# These should not work as we have too little instances of tables locked
|
||||
--error 1100
|
||||
--error ER_TABLE_NOT_LOCKED
|
||||
select * from v1, t1|
|
||||
--error 1100
|
||||
--error ER_TABLE_NOT_LOCKED
|
||||
select f4()|
|
||||
unlock tables|
|
||||
|
||||
@ -4501,14 +4501,14 @@ begin
|
||||
select bug12379();
|
||||
end|
|
||||
|
||||
--error 1062
|
||||
--error ER_DUP_ENTRY
|
||||
select bug12379()|
|
||||
select 1|
|
||||
call bug12379_1()|
|
||||
select 2|
|
||||
call bug12379_2()|
|
||||
select 3|
|
||||
--error 1062
|
||||
--error ER_DUP_ENTRY
|
||||
call bug12379_3()|
|
||||
select 4|
|
||||
|
||||
@ -5235,18 +5235,29 @@ drop procedure bug5967|
|
||||
#
|
||||
# Bug#13012 "SP: REPAIR/BACKUP/RESTORE TABLE crashes the server"
|
||||
#
|
||||
--let $backupdir = $MYSQLTEST_VARDIR/tmp/
|
||||
--error 0,1
|
||||
--remove_file $backupdir/t1.frm
|
||||
--error 0,1
|
||||
--remove_file $backupdir/t1.MYD
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists bug13012|
|
||||
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
|
||||
--enable_warnings
|
||||
create procedure bug13012()
|
||||
BEGIN
|
||||
REPAIR TABLE t1;
|
||||
BACKUP TABLE t1 to '../tmp';
|
||||
DROP TABLE t1;
|
||||
RESTORE TABLE t1 FROM '../tmp';
|
||||
END|
|
||||
eval create procedure bug13012()
|
||||
BEGIN
|
||||
REPAIR TABLE t1;
|
||||
BACKUP TABLE t1 to '$backupdir';
|
||||
DROP TABLE t1;
|
||||
RESTORE TABLE t1 FROM '$backupdir';
|
||||
END|
|
||||
call bug13012()|
|
||||
|
||||
--remove_file $backupdir/t1.frm
|
||||
--remove_file $backupdir/t1.MYD
|
||||
drop procedure bug13012|
|
||||
|
||||
create view v1 as select * from t1|
|
||||
create procedure bug13012()
|
||||
BEGIN
|
||||
|
@ -2217,4 +2217,37 @@ select * from t1;
|
||||
select * from t2;
|
||||
drop table t1;
|
||||
drop temporary table t2;
|
||||
|
||||
--echo #------------------------------------------------------------------------
|
||||
--echo # Bug#39953 Triggers are not working properly with multi table updates
|
||||
--echo #------------------------------------------------------------------------
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TRIGGER IF EXISTS t_insert;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (a int, date_insert timestamp, PRIMARY KEY (a));
|
||||
INSERT INTO t1 (a) VALUES (2),(5);
|
||||
CREATE TABLE t2 (a int, b int, PRIMARY KEY (a));
|
||||
DELIMITER |;
|
||||
CREATE TRIGGER t_insert AFTER INSERT ON t2 FOR EACH ROW BEGIN UPDATE t1,t2 SET
|
||||
date_insert=NOW() WHERE t1.a=t2.b AND t2.a=NEW.a; END |
|
||||
DELIMITER ;|
|
||||
INSERT INTO t2 (a,b) VALUES (1,2);
|
||||
|
||||
DROP TRIGGER t_insert;
|
||||
|
||||
DELIMITER |;
|
||||
CREATE TRIGGER t_insert AFTER INSERT ON t2 FOR EACH ROW BEGIN UPDATE t1,t2 SET
|
||||
date_insert=NOW(),b=b+1 WHERE t1.a=t2.b AND t2.a=NEW.a; END |
|
||||
DELIMITER ;|
|
||||
--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
|
||||
INSERT INTO t2 (a,b) VALUES (3,5);
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TRIGGER t_insert;
|
||||
DROP TABLE t2;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -1023,4 +1023,19 @@ SELECT * FROM (SELECT * FROM (SELECT NULL)a) b UNION SELECT a FROM t1;
|
||||
DESC t6;
|
||||
|
||||
DROP TABLE t1, t2, t3, t4, t5, t6;
|
||||
|
||||
#
|
||||
# Bug #43432: Union on floats does unnecessary rounding
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (f FLOAT(9,6));
|
||||
CREATE TABLE t2 AS SELECT f FROM t1 UNION SELECT f FROM t1;
|
||||
SHOW FIELDS FROM t2;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
CREATE TABLE t1(d DOUBLE(9,6));
|
||||
CREATE TABLE t2 AS SELECT d FROM t1 UNION SELECT d FROM t1;
|
||||
SHOW FIELDS FROM t2;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -5,16 +5,51 @@
|
||||
--source include/big_test.inc
|
||||
|
||||
#
|
||||
# Bug #27322 failure to allocate transaction_prealloc_size causes crash
|
||||
# Bug#27322 failure to allocate transaction_prealloc_size causes crash
|
||||
#
|
||||
#
|
||||
# Manual (6.0):
|
||||
# Platform Bit Size Range Default
|
||||
# 32 1024-4294967295 (4 Gi - 1) 4096
|
||||
# 64 1024-18446744073709547520 4096
|
||||
#
|
||||
# Observation(mleich):
|
||||
# 1. - Linux 64 Bit, MySQL 64 Bit, 4 GiB RAM, 8 GiB swap
|
||||
# - SET SESSION transaction_prealloc_size=1099511627776;
|
||||
# SHOW PROCESSLIST;
|
||||
# Id User ... Info
|
||||
# <Id> root ... SHOW PROCESSLIST
|
||||
# SELECT @@session.transaction_prealloc_size;
|
||||
# @@session.transaction_prealloc_size
|
||||
# 1099511627776
|
||||
# very short runtime in 5.0
|
||||
# excessive resource consumption + long runtime in 5.1 and 6.0
|
||||
# 2. - Win in VM, slightly older version of this test, MySQL 5.0
|
||||
# - testcase timeout after 900s
|
||||
# analyze-timeout-mysqld.1.err :
|
||||
# Id User ... Time Info
|
||||
# 83 root ... 542 set session transaction_prealloc_size=1024*1024*1024*2
|
||||
# 84 root ... 1 SHOW PROCESSLIST
|
||||
#
|
||||
# There is a significant probablitity that this tests fails with testcase
|
||||
# timeout if the testing box is not powerful enough.
|
||||
#
|
||||
|
||||
set session transaction_prealloc_size=1024*1024*1024*1;
|
||||
show processlist;
|
||||
set session transaction_prealloc_size=1024*1024*1024*2;
|
||||
show processlist;
|
||||
set session transaction_prealloc_size=1024*1024*1024*3;
|
||||
show processlist;
|
||||
set session transaction_prealloc_size=1024*1024*1024*4;
|
||||
show processlist;
|
||||
set session transaction_prealloc_size=1024*1024*1024*5;
|
||||
show processlist;
|
||||
--disable_warnings
|
||||
SET SESSION transaction_prealloc_size=1024*1024*1024*1;
|
||||
--replace_column 1 <Id> 6 <Time>
|
||||
SHOW PROCESSLIST;
|
||||
SET SESSION transaction_prealloc_size=1024*1024*1024*2;
|
||||
--replace_column 1 <Id> 6 <Time>
|
||||
SHOW PROCESSLIST;
|
||||
SET SESSION transaction_prealloc_size=1024*1024*1024*3;
|
||||
--replace_column 1 <Id> 6 <Time>
|
||||
SHOW PROCESSLIST;
|
||||
SET SESSION transaction_prealloc_size=1024*1024*1024*4;
|
||||
--replace_column 1 <Id> 6 <Time>
|
||||
SHOW PROCESSLIST;
|
||||
SET SESSION transaction_prealloc_size=1024*1024*1024*5;
|
||||
--replace_column 1 <Id> 6 <Time>
|
||||
SHOW PROCESSLIST;
|
||||
--enable_warnings
|
||||
|
||||
|
@ -8587,16 +8587,16 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
|
||||
else if (tmp_length > PRECISION_FOR_FLOAT)
|
||||
{
|
||||
sql_type= FIELD_TYPE_DOUBLE;
|
||||
length= DBL_DIG+7; /* -[digits].E+### */
|
||||
length= MAX_DOUBLE_STR_LENGTH;
|
||||
}
|
||||
else
|
||||
length= FLT_DIG+6; /* -[digits].E+## */
|
||||
length= MAX_FLOAT_STR_LENGTH;
|
||||
decimals= NOT_FIXED_DEC;
|
||||
break;
|
||||
}
|
||||
if (!fld_length && !fld_decimals)
|
||||
{
|
||||
length= FLT_DIG+6;
|
||||
length= MAX_FLOAT_STR_LENGTH;
|
||||
decimals= NOT_FIXED_DEC;
|
||||
}
|
||||
if (length < decimals &&
|
||||
|
@ -730,6 +730,16 @@ end:
|
||||
if (is_real_trans)
|
||||
start_waiting_global_read_lock(thd);
|
||||
}
|
||||
else if (all)
|
||||
{
|
||||
/*
|
||||
A COMMIT of an empty transaction. There may be savepoints.
|
||||
Destroy them. If the transaction is not empty
|
||||
savepoints are cleared in ha_commit_one_phase()
|
||||
or ha_rollback_trans().
|
||||
*/
|
||||
thd->transaction.cleanup();
|
||||
}
|
||||
#endif /* USING_TRANSACTIONS */
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
@ -825,11 +835,11 @@ int ha_rollback_trans(THD *thd, bool all)
|
||||
thd->transaction.xid_state.xid.null();
|
||||
}
|
||||
if (all)
|
||||
{
|
||||
thd->variables.tx_isolation=thd->session_tx_isolation;
|
||||
thd->transaction.cleanup();
|
||||
}
|
||||
}
|
||||
/* Always cleanup. Even if there nht==0. There may be savepoints. */
|
||||
if (all)
|
||||
thd->transaction.cleanup();
|
||||
#endif /* USING_TRANSACTIONS */
|
||||
if (all)
|
||||
thd->transaction_rollback_request= FALSE;
|
||||
|
36
sql/item.cc
36
sql/item.cc
@ -1282,7 +1282,10 @@ bool Item_name_const::fix_fields(THD *thd, Item **ref)
|
||||
my_error(ER_RESERVED_SYNTAX, MYF(0), "NAME_CONST");
|
||||
return TRUE;
|
||||
}
|
||||
set_name(item_name->ptr(), (uint) item_name->length(), system_charset_info);
|
||||
if (is_autogenerated_name)
|
||||
{
|
||||
set_name(item_name->ptr(), (uint) item_name->length(), system_charset_info);
|
||||
}
|
||||
collation.set(value_item->collation.collation, DERIVATION_IMPLICIT);
|
||||
max_length= value_item->max_length;
|
||||
decimals= value_item->decimals;
|
||||
@ -1320,6 +1323,7 @@ public:
|
||||
else
|
||||
Item_ident::print(str);
|
||||
}
|
||||
virtual Ref_Type ref_type() { return AGGREGATE_REF; }
|
||||
};
|
||||
|
||||
|
||||
@ -6966,18 +6970,26 @@ bool Item_type_holder::join_types(THD *thd, Item *item)
|
||||
{
|
||||
if (decimals != NOT_FIXED_DEC)
|
||||
{
|
||||
int delta1= max_length_orig - decimals_orig;
|
||||
int delta2= item->max_length - item->decimals;
|
||||
max_length= max(delta1, delta2) + decimals;
|
||||
if (fld_type == MYSQL_TYPE_FLOAT && max_length > FLT_DIG + 2)
|
||||
/*
|
||||
For FLOAT(M,D)/DOUBLE(M,D) do not change precision
|
||||
if both fields have the same M and D
|
||||
*/
|
||||
if (item->max_length != max_length_orig ||
|
||||
item->decimals != decimals_orig)
|
||||
{
|
||||
max_length= FLT_DIG + 6;
|
||||
decimals= NOT_FIXED_DEC;
|
||||
}
|
||||
if (fld_type == MYSQL_TYPE_DOUBLE && max_length > DBL_DIG + 2)
|
||||
{
|
||||
max_length= DBL_DIG + 7;
|
||||
decimals= NOT_FIXED_DEC;
|
||||
int delta1= max_length_orig - decimals_orig;
|
||||
int delta2= item->max_length - item->decimals;
|
||||
max_length= max(delta1, delta2) + decimals;
|
||||
if (fld_type == MYSQL_TYPE_FLOAT && max_length > FLT_DIG + 2)
|
||||
{
|
||||
max_length= MAX_FLOAT_STR_LENGTH;
|
||||
decimals= NOT_FIXED_DEC;
|
||||
}
|
||||
else if (fld_type == MYSQL_TYPE_DOUBLE && max_length > DBL_DIG + 2)
|
||||
{
|
||||
max_length= MAX_DOUBLE_STR_LENGTH;
|
||||
decimals= NOT_FIXED_DEC;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1899,7 +1899,7 @@ class Item_ref :public Item_ident
|
||||
protected:
|
||||
void set_properties();
|
||||
public:
|
||||
enum Ref_Type { REF, DIRECT_REF, VIEW_REF, OUTER_REF };
|
||||
enum Ref_Type { REF, DIRECT_REF, VIEW_REF, OUTER_REF, AGGREGATE_REF };
|
||||
Field *result_field; /* Save result here */
|
||||
Item **ref;
|
||||
Item_ref(Name_resolution_context *context_arg,
|
||||
|
@ -251,6 +251,11 @@ MY_LOCALE *my_locale_by_number(uint number);
|
||||
#define PRECISION_FOR_DOUBLE 53
|
||||
#define PRECISION_FOR_FLOAT 24
|
||||
|
||||
/* -[digits].E+## */
|
||||
#define MAX_FLOAT_STR_LENGTH (FLT_DIG + 6)
|
||||
/* -[digits].E+### */
|
||||
#define MAX_DOUBLE_STR_LENGTH (DBL_DIG + 7)
|
||||
|
||||
/*
|
||||
Default time to wait before aborting a new client connection
|
||||
that does not respond to "initial server greeting" timely
|
||||
|
@ -894,6 +894,8 @@ subst_spvars(THD *thd, sp_instr *instr, LEX_STRING *query_str)
|
||||
qbuf.length(0);
|
||||
cur= query_str->str;
|
||||
prev_pos= res= 0;
|
||||
thd->query_name_consts= 0;
|
||||
|
||||
for (Item_splocal **splocal= sp_vars_uses.front();
|
||||
splocal < sp_vars_uses.back(); splocal++)
|
||||
{
|
||||
@ -927,6 +929,8 @@ subst_spvars(THD *thd, sp_instr *instr, LEX_STRING *query_str)
|
||||
res|= qbuf.append(')');
|
||||
if (res)
|
||||
break;
|
||||
|
||||
thd->query_name_consts++;
|
||||
}
|
||||
res|= qbuf.append(cur + prev_pos, query_str->length - prev_pos);
|
||||
if (res)
|
||||
@ -2621,6 +2625,7 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
|
||||
*nextp= m_ip+1;
|
||||
thd->query= query;
|
||||
thd->query_length= query_length;
|
||||
thd->query_name_consts= 0;
|
||||
}
|
||||
DBUG_RETURN(res);
|
||||
}
|
||||
|
@ -1596,27 +1596,11 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
|
||||
{ // Using table locks
|
||||
TABLE *best_table= 0;
|
||||
int best_distance= INT_MIN;
|
||||
bool check_if_used= thd->prelocked_mode &&
|
||||
((int) table_list->lock_type >=
|
||||
(int) TL_WRITE_ALLOW_WRITE);
|
||||
for (table=thd->open_tables; table ; table=table->next)
|
||||
{
|
||||
if (table->s->key_length == key_length &&
|
||||
!memcmp(table->s->table_cache_key, key, key_length))
|
||||
{
|
||||
if (check_if_used && table->query_id &&
|
||||
table->query_id != thd->query_id)
|
||||
{
|
||||
/*
|
||||
If we are in stored function or trigger we should ensure that
|
||||
we won't change table that is already used by calling statement.
|
||||
So if we are opening table for writing, we should check that it
|
||||
is not already open by some calling stamement.
|
||||
*/
|
||||
my_error(ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG, MYF(0),
|
||||
table->s->table_name);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
if (!my_strcasecmp(system_charset_info, table->alias, alias) &&
|
||||
table->query_id != thd->query_id && /* skip tables already used */
|
||||
!(thd->prelocked_mode && table->query_id))
|
||||
@ -1640,13 +1624,13 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
|
||||
{
|
||||
best_distance= distance;
|
||||
best_table= table;
|
||||
if (best_distance == 0 && !check_if_used)
|
||||
if (best_distance == 0)
|
||||
{
|
||||
/*
|
||||
If we have found perfect match and we don't need to check that
|
||||
table is not used by one of calling statements (assuming that
|
||||
we are inside of function or trigger) we can finish iterating
|
||||
through open tables list.
|
||||
We have found a perfect match and can finish iterating
|
||||
through open tables list. Check for table use conflict
|
||||
between calling statement and SP/trigger is done in
|
||||
lock_tables().
|
||||
*/
|
||||
break;
|
||||
}
|
||||
@ -2944,9 +2928,9 @@ static bool check_lock_and_start_stmt(THD *thd, TABLE *table,
|
||||
lock_type Lock to use for open
|
||||
|
||||
NOTE
|
||||
This function don't do anything like SP/SF/views/triggers analysis done
|
||||
in open_tables(). It is intended for opening of only one concrete table.
|
||||
And used only in special contexts.
|
||||
This function doesn't do anything like SP/SF/views/triggers analysis done
|
||||
in open_tables()/lock_tables(). It is intended for opening of only one
|
||||
concrete table. And used only in special contexts.
|
||||
|
||||
RETURN VALUES
|
||||
table Opened table
|
||||
@ -3262,8 +3246,36 @@ int lock_tables(THD *thd, TABLE_LIST *tables, uint count, bool *need_reopen)
|
||||
TABLE_LIST *first_not_own= thd->lex->first_not_own_table();
|
||||
for (table= tables; table != first_not_own; table= table->next_global)
|
||||
{
|
||||
if (!table->placeholder() &&
|
||||
check_lock_and_start_stmt(thd, table->table, table->lock_type))
|
||||
if (table->placeholder())
|
||||
continue;
|
||||
|
||||
/*
|
||||
In a stored function or trigger we should ensure that we won't change
|
||||
a table that is already used by the calling statement.
|
||||
*/
|
||||
if (thd->prelocked_mode &&
|
||||
table->lock_type >= TL_WRITE_ALLOW_WRITE)
|
||||
{
|
||||
for (TABLE* opentab= thd->open_tables; opentab; opentab= opentab->next)
|
||||
{
|
||||
/*
|
||||
issue an error if the tables are the same (by key comparison),
|
||||
but query_id isn't
|
||||
*/
|
||||
if (opentab->query_id &&
|
||||
table->table->query_id != opentab->query_id &&
|
||||
table->table->s->key_length == opentab->s->key_length &&
|
||||
!memcmp(table->table->s->table_cache_key,
|
||||
opentab->s->table_cache_key, opentab->s->key_length))
|
||||
{
|
||||
my_error(ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG, MYF(0),
|
||||
table->table->s->table_name);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (check_lock_and_start_stmt(thd, table->table, table->lock_type))
|
||||
{
|
||||
ha_rollback_stmt(thd);
|
||||
DBUG_RETURN(-1);
|
||||
|
@ -219,6 +219,7 @@ THD::THD()
|
||||
one_shot_set= 0;
|
||||
file_id = 0;
|
||||
query_id= 0;
|
||||
query_name_consts= 0;
|
||||
warn_id= 0;
|
||||
db_charset= global_system_variables.collation_database;
|
||||
bzero(ha_data, sizeof(ha_data));
|
||||
@ -2144,6 +2145,13 @@ void Security_context::skip_grants()
|
||||
}
|
||||
|
||||
|
||||
bool Security_context::user_matches(Security_context *them)
|
||||
{
|
||||
return ((user != NULL) && (them->user != NULL) &&
|
||||
!strcmp(user, them->user));
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
Handling of open and locked tables states.
|
||||
|
||||
|
@ -985,6 +985,7 @@ public:
|
||||
{
|
||||
return (*priv_host ? priv_host : (char *)"%");
|
||||
}
|
||||
bool user_matches(Security_context *);
|
||||
};
|
||||
|
||||
|
||||
@ -1556,6 +1557,9 @@ public:
|
||||
sp_cache *sp_proc_cache;
|
||||
sp_cache *sp_func_cache;
|
||||
|
||||
/** number of name_const() substitutions, see sp_head.cc:subst_spvars() */
|
||||
uint query_name_consts;
|
||||
|
||||
/*
|
||||
If we do a purge of binary logs, log index info of the threads
|
||||
that are currently reading it needs to be adjusted. To do that
|
||||
|
@ -1605,10 +1605,13 @@ public:
|
||||
ulong auto_increment_increment;
|
||||
ulong auto_increment_offset;
|
||||
timestamp_auto_set_type timestamp_field_type;
|
||||
Time_zone *time_zone;
|
||||
uint query_length;
|
||||
|
||||
delayed_row(enum_duplicates dup_arg, bool ignore_arg, bool log_query_arg)
|
||||
:record(0), query(0), dup(dup_arg), ignore(ignore_arg), log_query(log_query_arg) {}
|
||||
:record(0), query(0), dup(dup_arg), ignore(ignore_arg),
|
||||
log_query(log_query_arg), time_zone(0)
|
||||
{}
|
||||
~delayed_row()
|
||||
{
|
||||
x_free(record);
|
||||
@ -2062,6 +2065,19 @@ int write_delayed(THD *thd,TABLE *table,enum_duplicates duplic, bool ignore,
|
||||
row->last_insert_id= thd->last_insert_id;
|
||||
row->timestamp_field_type= table->timestamp_field_type;
|
||||
|
||||
/* Add session variable timezone
|
||||
Time_zone object will not be freed even the thread is ended.
|
||||
So we can get time_zone object from thread which handling delayed statement.
|
||||
See the comment of my_tz_find() for detail.
|
||||
*/
|
||||
if (thd->time_zone_used)
|
||||
{
|
||||
row->time_zone = thd->variables.time_zone;
|
||||
}
|
||||
else
|
||||
{
|
||||
row->time_zone = NULL;
|
||||
}
|
||||
/* The session variable settings can always be copied. */
|
||||
row->auto_increment_increment= thd->variables.auto_increment_increment;
|
||||
row->auto_increment_offset= thd->variables.auto_increment_offset;
|
||||
@ -2515,8 +2531,19 @@ bool Delayed_insert::handle_inserts(void)
|
||||
}
|
||||
if (row->query && row->log_query && using_bin_log)
|
||||
{
|
||||
bool backup_time_zone_used = thd.time_zone_used;
|
||||
Time_zone *backup_time_zone = thd.variables.time_zone;
|
||||
if (row->time_zone != NULL)
|
||||
{
|
||||
thd.time_zone_used = true;
|
||||
thd.variables.time_zone = row->time_zone;
|
||||
}
|
||||
|
||||
Query_log_event qinfo(&thd, row->query, row->query_length, 0, FALSE);
|
||||
mysql_bin_log.write(&qinfo);
|
||||
|
||||
thd.time_zone_used = backup_time_zone_used;
|
||||
thd.variables.time_zone = backup_time_zone;
|
||||
}
|
||||
if (table->s->blob_fields)
|
||||
free_delayed_insert_blobs(table);
|
||||
|
@ -3211,6 +3211,42 @@ mysql_execute_command(THD *thd)
|
||||
}
|
||||
if (select_lex->item_list.elements) // With select
|
||||
{
|
||||
/*
|
||||
If:
|
||||
a) we inside an SP and there was NAME_CONST substitution,
|
||||
b) binlogging is on,
|
||||
c) we log the SP as separate statements
|
||||
raise a warning, as it may cause problems
|
||||
(see 'NAME_CONST issues' in 'Binary Logging of Stored Programs')
|
||||
*/
|
||||
if (thd->query_name_consts &&
|
||||
mysql_bin_log.is_open() &&
|
||||
!mysql_bin_log.is_query_in_union(thd, thd->query_id))
|
||||
{
|
||||
List_iterator_fast<Item> it(select_lex->item_list);
|
||||
Item *item;
|
||||
uint splocal_refs= 0;
|
||||
/* Count SP local vars in the top-level SELECT list */
|
||||
while ((item= it++))
|
||||
{
|
||||
if (item->is_splocal())
|
||||
splocal_refs++;
|
||||
}
|
||||
/*
|
||||
If it differs from number of NAME_CONST substitution applied,
|
||||
we may have a SOME_FUNC(NAME_CONST()) in the SELECT list,
|
||||
that may cause a problem with binary log (see BUG#35383),
|
||||
raise a warning.
|
||||
*/
|
||||
if (splocal_refs != thd->query_name_consts)
|
||||
push_warning(thd,
|
||||
MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_UNKNOWN_ERROR,
|
||||
"Invoked routine ran a statement that may cause problems with "
|
||||
"binary log, see 'NAME_CONST issues' in 'Binary Logging of Stored Programs' "
|
||||
"section of the manual.");
|
||||
}
|
||||
|
||||
select_result *sel_result;
|
||||
|
||||
select_lex->options|= SELECT_NO_UNLOCK;
|
||||
@ -7386,8 +7422,26 @@ void kill_one_thread(THD *thd, ulong id, bool only_kill_query)
|
||||
VOID(pthread_mutex_unlock(&LOCK_thread_count));
|
||||
if (tmp)
|
||||
{
|
||||
|
||||
/*
|
||||
If we're SUPER, we can KILL anything, including system-threads.
|
||||
No further checks.
|
||||
|
||||
KILLer: thd->security_ctx->user could in theory be NULL while
|
||||
we're still in "unauthenticated" state. This is a theoretical
|
||||
case (the code suggests this could happen, so we play it safe).
|
||||
|
||||
KILLee: tmp->security_ctx->user will be NULL for system threads.
|
||||
We need to check so Jane Random User doesn't crash the server
|
||||
when trying to kill a) system threads or b) unauthenticated users'
|
||||
threads (Bug#43748).
|
||||
|
||||
If user of both killer and killee are non-NULL, proceed with
|
||||
slayage if both are string-equal.
|
||||
*/
|
||||
|
||||
if ((thd->security_ctx->master_access & SUPER_ACL) ||
|
||||
!strcmp(thd->security_ctx->user, tmp->security_ctx->user))
|
||||
thd->security_ctx->user_matches(tmp->security_ctx))
|
||||
{
|
||||
tmp->awake(only_kill_query ? THD::KILL_QUERY : THD::KILL_CONNECTION);
|
||||
error=0;
|
||||
|
@ -14205,6 +14205,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
|
||||
Item *pos;
|
||||
List_iterator_fast<Item> li(all_fields);
|
||||
Copy_field *copy= NULL;
|
||||
IF_DBUG(Copy_field *copy_start);
|
||||
res_selected_fields.empty();
|
||||
res_all_fields.empty();
|
||||
List_iterator_fast<Item> itr(res_all_fields);
|
||||
@ -14217,12 +14218,19 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
|
||||
goto err2;
|
||||
|
||||
param->copy_funcs.empty();
|
||||
IF_DBUG(copy_start= copy);
|
||||
for (i= 0; (pos= li++); i++)
|
||||
{
|
||||
Field *field;
|
||||
char *tmp;
|
||||
Item *real_pos= pos->real_item();
|
||||
if (real_pos->type() == Item::FIELD_ITEM)
|
||||
/*
|
||||
Aggregate functions can be substituted for fields (by e.g. temp tables).
|
||||
We need to filter those substituted fields out.
|
||||
*/
|
||||
if (real_pos->type() == Item::FIELD_ITEM &&
|
||||
!(real_pos != pos &&
|
||||
((Item_ref *)pos)->ref_type() == Item_ref::AGGREGATE_REF))
|
||||
{
|
||||
Item_field *item;
|
||||
if (!(item= new Item_field(thd, ((Item_field*) real_pos))))
|
||||
@ -14270,6 +14278,7 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
|
||||
goto err;
|
||||
if (copy)
|
||||
{
|
||||
DBUG_ASSERT (param->field_count > (uint) (copy - copy_start));
|
||||
copy->set(tmp, item->result_field);
|
||||
item->result_field->move_field(copy->to_ptr,copy->to_null_ptr,1);
|
||||
#ifdef HAVE_purify
|
||||
|
@ -52,7 +52,7 @@ EXTRA_DIST = ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc
|
||||
bmove_upp-sparc.s strappend-sparc.s strend-sparc.s \
|
||||
strinstr-sparc.s strmake-sparc.s strmov-sparc.s \
|
||||
strnmov-sparc.s strstr-sparc.s strxmov-sparc.s \
|
||||
t_ctype.h CMakeLists.txt
|
||||
t_ctype.h CMakeLists.txt CHARSET_INFO.txt
|
||||
|
||||
libmystrings_a_LIBADD=
|
||||
conf_to_src_SOURCES = conf_to_src.c xml.c ctype.c bcmp.c
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2000-2007 MySQL AB
|
||||
# Copyright (C) 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
|
||||
#
|
||||
# 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
|
||||
@ -87,7 +87,7 @@ is intended for mission-critical, heavy-load production systems as well
|
||||
as for embedding into mass-deployed software. MySQL is a trademark of
|
||||
MySQL AB.
|
||||
|
||||
Copyright (C) 2000-2007 MySQL AB
|
||||
Copyright (C) 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
|
||||
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
|
||||
and you are welcome to modify and redistribute it under the GPL license.
|
||||
|
||||
@ -109,7 +109,7 @@ is intended for mission-critical, heavy-load production systems as well
|
||||
as for embedding into mass-deployed software. MySQL is a trademark of
|
||||
MySQL AB.
|
||||
|
||||
Copyright (C) 2000-2007 MySQL AB
|
||||
Copyright (C) 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
|
||||
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
|
||||
and you are welcome to modify and redistribute it under the GPL license.
|
||||
|
||||
@ -320,8 +320,12 @@ do
|
||||
# We are in a subshell, so we can modify variables just for one run.
|
||||
if test "$servertype" != ' '
|
||||
then
|
||||
CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]* //' -e 's/-unroll2 //' -e 's/-ip //'`
|
||||
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-O[0-9]* //' -e 's/-unroll2 //' -e 's/-ip //'`
|
||||
CFLAGS=`echo " $CFLAGS " | \
|
||||
sed -e 's/ -O[0-9]* / /' -e 's/ -unroll2 / /' -e 's/ -ip / /' \
|
||||
-e 's/^ //' -e 's/ $//'`
|
||||
CXXFLAGS=`echo " $CXXFLAGS " | \
|
||||
sed -e 's/ -O[0-9]* / /' -e 's/ -unroll2 / /' -e 's/ -ip / /' \
|
||||
-e 's/^ //' -e 's/ $//'`
|
||||
fi
|
||||
|
||||
BuildMySQL "\
|
||||
@ -807,6 +811,10 @@ fi
|
||||
# itself - note that they must be ordered by date (important when
|
||||
# merging BK trees)
|
||||
%changelog
|
||||
* Fri Nov 07 2008 Joerg Bruehe <joerg@mysql.com>
|
||||
|
||||
- Correct yesterday's fix, so that it also works for the last flag.
|
||||
|
||||
* Thu Nov 06 2008 Joerg Bruehe <joerg@mysql.com>
|
||||
|
||||
- Modify CFLAGS and CXXFLAGS such that a debug build is not optimized.
|
||||
|
@ -479,26 +479,28 @@ int vio_read_shared_memory(Vio * vio, gptr buf, int size)
|
||||
int length;
|
||||
int remain_local;
|
||||
char *current_postion;
|
||||
HANDLE events[2];
|
||||
|
||||
DBUG_ENTER("vio_read_shared_memory");
|
||||
DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %d", vio->sd, buf, size));
|
||||
|
||||
remain_local = size;
|
||||
current_postion=buf;
|
||||
|
||||
events[0]= vio->event_server_wrote;
|
||||
events[1]= vio->event_conn_closed;
|
||||
|
||||
do
|
||||
{
|
||||
if (vio->shared_memory_remain == 0)
|
||||
{
|
||||
HANDLE events[2];
|
||||
events[0]= vio->event_server_wrote;
|
||||
events[1]= vio->event_conn_closed;
|
||||
/*
|
||||
WaitForMultipleObjects can return next values:
|
||||
WAIT_OBJECT_0+0 - event from vio->event_server_wrote
|
||||
WAIT_OBJECT_0+1 - event from vio->event_conn_closed. We can't read anything
|
||||
WAIT_ABANDONED_0 and WAIT_TIMEOUT - fail. We can't read anything
|
||||
*/
|
||||
if (WaitForMultipleObjects(2, (HANDLE*)&events,FALSE,
|
||||
if (WaitForMultipleObjects(array_elements(events), events, FALSE,
|
||||
vio->net->read_timeout*1000) != WAIT_OBJECT_0)
|
||||
{
|
||||
DBUG_RETURN(-1);
|
||||
@ -537,19 +539,23 @@ int vio_write_shared_memory(Vio * vio, const gptr buf, int size)
|
||||
{
|
||||
int length;
|
||||
uint remain;
|
||||
HANDLE pos;
|
||||
int sz;
|
||||
char *current_postion;
|
||||
HANDLE pos, events[2];
|
||||
|
||||
DBUG_ENTER("vio_write_shared_memory");
|
||||
DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %d", vio->sd, buf, size));
|
||||
|
||||
remain = size;
|
||||
current_postion = buf;
|
||||
|
||||
events[0]= vio->event_server_read;
|
||||
events[1]= vio->event_conn_closed;
|
||||
|
||||
while (remain != 0)
|
||||
{
|
||||
if (WaitForSingleObject(vio->event_server_read, vio->net->write_timeout*1000)
|
||||
!= WAIT_OBJECT_0)
|
||||
if (WaitForMultipleObjects(array_elements(events), events, FALSE,
|
||||
vio->net->write_timeout*1000) != WAIT_OBJECT_0)
|
||||
{
|
||||
DBUG_RETURN(-1);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user