mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
Manual merge
configure.in: Auto merged mysql-test/r/func_misc.result: Auto merged mysql-test/r/myisam.result: Auto merged mysql-test/r/partition.result: Auto merged mysql-test/r/partition_symlink.result: Auto merged mysql-test/t/func_misc.test: Auto merged mysql-test/t/partition.test: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/item.cc: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/log.cc: Auto merged sql/mysql_priv.h: Auto merged sql/partition_info.cc: Auto merged sql/partition_info.h: Auto merged sql/rpl_rli.cc: Auto merged sql/sql_plugin.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_parse.cc: Manual merge. Needs later fix. New code in create table was not accepted. Needs to be added to mysql_create_table_no_lock().
This commit is contained in:
commit
e79249f81b
116 changed files with 1802 additions and 437 deletions
|
@ -100,8 +100,10 @@ if [ "x$warning_mode" != "xpedantic" ]; then
|
|||
# C warnings
|
||||
c_warnings="$warnings -Wunused-parameter"
|
||||
# C++ warnings
|
||||
cxx_warnings="$warnings -Woverloaded-virtual -Wsign-promo -Wreorder"
|
||||
cxx_warnings="$warnings -Wctor-dtor-privacy -Wnon-virtual-dtor"
|
||||
cxx_warnings="$warnings"
|
||||
# cxx_warnings="$cxx_warnings -Woverloaded-virtual -Wsign-promo"
|
||||
cxx_warnings="$cxx_warnings -Wreorder"
|
||||
cxx_warnings="$cxx_warnings -Wctor-dtor-privacy -Wnon-virtual-dtor"
|
||||
# Added unless --with-debug=full
|
||||
debug_extra_cflags="-O1 -Wuninitialized"
|
||||
else
|
||||
|
|
|
@ -1126,6 +1126,7 @@ int main(int argc,char *argv[])
|
|||
if (mysql_server_init(embedded_server_arg_count, embedded_server_args,
|
||||
(char**) embedded_server_groups))
|
||||
{
|
||||
put_error(NULL);
|
||||
free_defaults(defaults_argv);
|
||||
my_end(0);
|
||||
exit(1);
|
||||
|
|
|
@ -4306,6 +4306,7 @@ static int do_show_master_status(MYSQL *mysql_con)
|
|||
my_printf_error(0, "Error: Binlogging on server not active",
|
||||
MYF(0));
|
||||
mysql_free_result(master);
|
||||
maybe_exit(EX_MYSQLERR);
|
||||
return 1;
|
||||
}
|
||||
mysql_free_result(master);
|
||||
|
|
|
@ -1031,8 +1031,8 @@ case $SYSTEM_TYPE in
|
|||
;;
|
||||
*hpux11.*)
|
||||
AC_MSG_WARN([Enabling workarounds for hpux 11])
|
||||
CFLAGS="$CFLAGS -DHPUX11 -DSNPRINTF_RETURN_TRUNC -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -DHAVE_BROKEN_GETPASS -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT"
|
||||
CXXFLAGS="$CXXFLAGS -DHPUX11 -DSNPRINTF_RETURN_TRUNC -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -D_INCLUDE_LONGLONG -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT"
|
||||
CFLAGS="$CFLAGS -DHPUX11 -DSNPRINTF_RETURN_TRUNC -DHAVE_BROKEN_PREAD -DHAVE_BROKEN_GETPASS -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT"
|
||||
CXXFLAGS="$CXXFLAGS -DHPUX11 -DSNPRINTF_RETURN_TRUNC -DHAVE_BROKEN_PREAD -D_INCLUDE_LONGLONG -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT"
|
||||
if test "$with_named_thread" = "no"
|
||||
then
|
||||
AC_MSG_WARN([Using --with-named-thread=-lpthread])
|
||||
|
|
|
@ -486,9 +486,6 @@ C_MODE_END
|
|||
#include <sys/stream.h> /* HPUX 10.20 defines ulong here. UGLY !!! */
|
||||
#define HAVE_ULONG
|
||||
#endif
|
||||
#ifdef DONT_USE_FINITE /* HPUX 11.x has is_finite() */
|
||||
#undef HAVE_FINITE
|
||||
#endif
|
||||
#if defined(HPUX10) && defined(_LARGEFILE64_SOURCE) && defined(THREAD)
|
||||
/* Fix bug in setrlimit */
|
||||
#undef setrlimit
|
||||
|
@ -858,9 +855,13 @@ typedef SOCKET_SIZE_TYPE size_socket;
|
|||
#define SIZE_T_MAX ~((size_t) 0)
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_FINITE
|
||||
#ifndef isfinite
|
||||
#ifdef HAVE_FINITE
|
||||
#define isfinite(x) finite(x)
|
||||
#else
|
||||
#define finite(x) (1.0 / fabs(x) > 0.0)
|
||||
#endif
|
||||
#endif /* HAVE_FINITE */
|
||||
#endif /* isfinite */
|
||||
|
||||
#ifndef HAVE_ISNAN
|
||||
#define isnan(x) ((x) != (x))
|
||||
|
@ -870,7 +871,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
|
|||
/* isinf() can be used in both C and C++ code */
|
||||
#define my_isinf(X) isinf(X)
|
||||
#else
|
||||
#define my_isinf(X) (!finite(X) && !isnan(X))
|
||||
#define my_isinf(X) (!isfinite(X) && !isnan(X))
|
||||
#endif
|
||||
|
||||
/* Define missing math constants. */
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
|
||||
extern const char *unknown_sqlstate;
|
||||
extern const char *cant_connect_sqlstate;
|
||||
extern const char *not_error_sqlstate;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1500,7 +1500,7 @@ my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql)
|
|||
|
||||
const char *STDCALL mysql_sqlstate(MYSQL *mysql)
|
||||
{
|
||||
return mysql->net.sqlstate;
|
||||
return mysql ? mysql->net.sqlstate : cant_connect_sqlstate;
|
||||
}
|
||||
|
||||
uint STDCALL mysql_warning_count(MYSQL *mysql)
|
||||
|
|
|
@ -38,6 +38,8 @@ C_MODE_START
|
|||
#include <sql_common.h>
|
||||
#include "embedded_priv.h"
|
||||
|
||||
extern unsigned int mysql_server_last_errno;
|
||||
extern char mysql_server_last_error[MYSQL_ERRMSG_SIZE];
|
||||
static my_bool emb_read_query_result(MYSQL *mysql);
|
||||
|
||||
|
||||
|
@ -1122,3 +1124,12 @@ bool Protocol::net_store_data(const uchar *from, size_t length)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
int vprint_msg_to_log(enum loglevel level __attribute__((unused)),
|
||||
const char *format, va_list argsi)
|
||||
{
|
||||
vsnprintf(mysql_server_last_error, sizeof(mysql_server_last_error),
|
||||
format, argsi);
|
||||
mysql_server_last_errno= CR_UNKNOWN_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -732,6 +732,6 @@ call p_verify_status_increment(0, 0, 0, 0);
|
|||
--echo #
|
||||
--echo # Cleanup
|
||||
--echo #
|
||||
drop table t1;
|
||||
drop table t1, t2, t3;
|
||||
drop procedure p_verify_status_increment;
|
||||
drop function f1;
|
||||
|
|
|
@ -1090,6 +1090,19 @@ SELECT * FROM t1 WHERE id=191 OR id IS NULL ORDER BY d;
|
|||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #34223: Assertion failed: (optp->var_type & 127) == 8,
|
||||
# file .\my_getopt.c, line 830
|
||||
#
|
||||
|
||||
set @my_innodb_autoextend_increment=@@global.innodb_autoextend_increment;
|
||||
set global innodb_autoextend_increment=8;
|
||||
set global innodb_autoextend_increment=@my_innodb_autoextend_increment;
|
||||
|
||||
set @my_innodb_commit_concurrency=@@global.innodb_commit_concurrency;
|
||||
set global innodb_commit_concurrency=0;
|
||||
set global innodb_commit_concurrency=@my_innodb_commit_concurrency;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY
|
||||
|
|
|
@ -386,7 +386,10 @@ sub mtr_report_stats ($) {
|
|||
# rpl_temporary has an error on slave that can be ignored
|
||||
($testname eq 'rpl.rpl_temporary' and
|
||||
(/Slave: Can\'t find record in \'user\' Error_code: 1032/
|
||||
))
|
||||
)) or
|
||||
|
||||
# Test case for Bug#31590 produces the following error:
|
||||
/Out of sort memory; increase server sort buffer size/
|
||||
)
|
||||
{
|
||||
next; # Skip these lines
|
||||
|
|
|
@ -539,7 +539,7 @@ F2E5F1F2
|
|||
drop table t1;
|
||||
create table t1 ( a timestamp );
|
||||
alter table t1 add unique ( a(1) );
|
||||
ERROR HY000: Incorrect sub part key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique sub keys
|
||||
ERROR HY000: Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys
|
||||
drop table t1;
|
||||
drop table if exists t1;
|
||||
create table t1 (a int, key(a));
|
||||
|
@ -953,12 +953,12 @@ t1 CREATE TABLE `t1` (
|
|||
KEY `b_2` (`b`(50))
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
CREATE TABLE t2 (a INT, KEY (a(20)));
|
||||
ERROR HY000: Incorrect sub part key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique sub keys
|
||||
ERROR HY000: Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys
|
||||
ALTER TABLE t1 ADD d INT;
|
||||
ALTER TABLE t1 ADD KEY (d(20));
|
||||
ERROR HY000: Incorrect sub part key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique sub keys
|
||||
ERROR HY000: Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys
|
||||
ALTER TABLE t1 ADD e GEOMETRY NOT NULL, ADD SPATIAL KEY (e(30));
|
||||
ERROR HY000: Incorrect sub part key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique sub keys
|
||||
ERROR HY000: Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (s CHAR(8) BINARY);
|
||||
INSERT INTO t1 VALUES ('test');
|
||||
|
|
|
@ -878,6 +878,6 @@ SUCCESS
|
|||
#
|
||||
# Cleanup
|
||||
#
|
||||
drop table t1;
|
||||
drop table t1, t2, t3;
|
||||
drop procedure p_verify_status_increment;
|
||||
drop function f1;
|
||||
|
|
|
@ -53,3 +53,41 @@ a b
|
|||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: ''
|
||||
drop table if exists t1;
|
||||
CREATE TABLE t1 (b int(2) zerofill, c int(2) zerofill);
|
||||
INSERT INTO t1 (b,c) VALUES (1,2), (1,1), (2,2);
|
||||
SELECT CONCAT(b,c), CONCAT(b,c) = '0101' FROM t1;
|
||||
CONCAT(b,c) CONCAT(b,c) = '0101'
|
||||
0102 0
|
||||
0101 1
|
||||
0202 0
|
||||
EXPLAIN EXTENDED SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101';
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`b` = 1) and (concat('01',`test`.`t1`.`c`) = '0101'))
|
||||
SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101';
|
||||
b c
|
||||
01 01
|
||||
CREATE TABLE t2 (a int);
|
||||
INSERT INTO t2 VALUES (1),(2);
|
||||
SELECT a,
|
||||
(SELECT COUNT(*) FROM t1
|
||||
WHERE b = t2.a AND CONCAT(b,c) = CONCAT('0',t2.a,'01')) x
|
||||
FROM t2 ORDER BY a;
|
||||
a x
|
||||
1 1
|
||||
2 0
|
||||
EXPLAIN EXTENDED
|
||||
SELECT a,
|
||||
(SELECT COUNT(*) FROM t1
|
||||
WHERE b = t2.a AND CONCAT(b,c) = CONCAT('0',t2.a,'01')) x
|
||||
FROM t2 ORDER BY a;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using filesort
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,(select count(0) AS `COUNT(*)` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t2`.`a`) and (concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = concat('0',`test`.`t2`.`a`,'01')))) AS `x` from `test`.`t2` order by `test`.`t2`.`a`
|
||||
DROP TABLE t1,t2;
|
||||
End of 5.0 tests
|
||||
|
|
|
@ -1545,6 +1545,20 @@ Handler_read_prev 0
|
|||
Handler_read_rnd 0
|
||||
Handler_read_rnd_next 7
|
||||
drop table t1,t2;
|
||||
CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1));
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(c1 VARCHAR(33), KEY (c1) USING BTREE);
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1) USING HASH) ENGINE=MEMORY;
|
||||
SHOW INDEX FROM t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 1 c1 1 c1 NULL 0 NULL NULL YES HASH
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(c1 VARCHAR(33), KEY USING HASH (c1) USING BTREE) ENGINE=MEMORY;
|
||||
SHOW INDEX FROM t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 1 c1 1 c1 A NULL NULL NULL YES BTREE
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
insert into t1 values (1,1),(1,2);
|
||||
|
|
|
@ -40,9 +40,9 @@ IN ind DECIMAL(10,2))
|
|||
BEGIN
|
||||
INSERT INTO t4 VALUES (ins1, ins2, ind);
|
||||
END
|
||||
master-bin.000001 783 Query 1 999 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93))
|
||||
master-bin.000001 999 Query 1 1088 use `test`; DROP PROCEDURE bug18293
|
||||
master-bin.000001 1088 Query 1 1167 use `test`; DROP TABLE t4
|
||||
master-bin.000001 783 Query 1 991 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93))
|
||||
master-bin.000001 991 Query 1 1080 use `test`; DROP PROCEDURE bug18293
|
||||
master-bin.000001 1080 Query 1 1159 use `test`; DROP TABLE t4
|
||||
End of 5.0 tests
|
||||
SHOW BINLOG EVENTS FROM 364;
|
||||
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
|
||||
|
|
|
@ -937,4 +937,19 @@ SELECT GROUP_CONCAT(DISTINCT b, a ORDER BY b) FROM t1;
|
|||
GROUP_CONCAT(DISTINCT b, a ORDER BY b)
|
||||
11,22,32
|
||||
DROP TABLE t1, t2, t3;
|
||||
CREATE TABLE t1(a INT);
|
||||
INSERT INTO t1 VALUES (),();
|
||||
SELECT s1.d1 FROM
|
||||
(
|
||||
SELECT
|
||||
t1.a as d1,
|
||||
GROUP_CONCAT(DISTINCT t1.a) AS d2
|
||||
FROM
|
||||
t1 AS t1,
|
||||
t1 AS t2
|
||||
GROUP BY 1
|
||||
) AS s1;
|
||||
d1
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
|
|
@ -408,3 +408,22 @@ a DIV 2
|
|||
0
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
SELECT 1e308 + 1e308;
|
||||
1e308 + 1e308
|
||||
NULL
|
||||
SELECT -1e308 - 1e308;
|
||||
-1e308 - 1e308
|
||||
NULL
|
||||
SELECT 1e300 * 1e300;
|
||||
1e300 * 1e300
|
||||
NULL
|
||||
SELECT 1e300 / 1e-300;
|
||||
1e300 / 1e-300
|
||||
NULL
|
||||
SELECT EXP(750);
|
||||
EXP(750)
|
||||
NULL
|
||||
SELECT POW(10, 309);
|
||||
POW(10, 309)
|
||||
NULL
|
||||
End of 5.1 tests
|
||||
|
|
|
@ -212,6 +212,25 @@ test
|
|||
SELECT NAME_CONST('test', 'test');
|
||||
test
|
||||
test
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
SELECT NAME_CONST('flag',1) * MAX(a) FROM t1;
|
||||
NAME_CONST('flag',1) * MAX(a)
|
||||
3
|
||||
SELECT NAME_CONST('flag',1.5) * MAX(a) FROM t1;
|
||||
NAME_CONST('flag',1.5) * MAX(a)
|
||||
4.5
|
||||
SELECT NAME_CONST('flag',-1) * MAX(a) FROM t1;
|
||||
NAME_CONST('flag',-1) * MAX(a)
|
||||
-3
|
||||
SELECT NAME_CONST('flag',-1.5) * MAX(a) FROM t1;
|
||||
NAME_CONST('flag',-1.5) * MAX(a)
|
||||
-4.5
|
||||
SELECT NAME_CONST('flag', SQRT(4)) * MAX(a) FROM t1;
|
||||
ERROR HY000: Incorrect arguments to NAME_CONST
|
||||
SELECT NAME_CONST('flag',-SQRT(4)) * MAX(a) FROM t1;
|
||||
ERROR HY000: Incorrect arguments to NAME_CONST
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a int);
|
||||
INSERT INTO t1 VALUES (5), (2);
|
||||
SELECT NAME_CONST(x,2) FROM (SELECT a x FROM t1) t;
|
||||
|
|
|
@ -1431,6 +1431,11 @@ benchmark(100, NULL)
|
|||
select benchmark(NULL, 1+1);
|
||||
benchmark(NULL, 1+1)
|
||||
NULL
|
||||
select benchmark(-1, 1);
|
||||
benchmark(-1, 1)
|
||||
NULL
|
||||
Warnings:
|
||||
Error 1411 Incorrect count value: '-1' for function benchmark
|
||||
set @password="password";
|
||||
set @my_data="clear text to encode";
|
||||
select md5(encode(@my_data, "password"));
|
||||
|
|
|
@ -666,6 +666,8 @@ timestampadd(SQL_TSI_SECOND, 1, date)
|
|||
select timestampadd(SQL_TSI_FRAC_SECOND, 1, date) from t1;
|
||||
timestampadd(SQL_TSI_FRAC_SECOND, 1, date)
|
||||
2003-01-02 00:00:00.000001
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 6.2. Please use MICROSECOND instead
|
||||
select timestampdiff(MONTH, '2001-02-01', '2001-05-01') as a;
|
||||
a
|
||||
3
|
||||
|
@ -699,6 +701,8 @@ a
|
|||
select timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a;
|
||||
a
|
||||
7689538999999
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 6.2. Please use MICROSECOND instead
|
||||
select timestampdiff(SQL_TSI_DAY, '1986-02-01', '1986-03-01') as a1,
|
||||
timestampdiff(SQL_TSI_DAY, '1900-02-01', '1900-03-01') as a2,
|
||||
timestampdiff(SQL_TSI_DAY, '1996-02-01', '1996-03-01') as a3,
|
||||
|
@ -1069,6 +1073,7 @@ timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:
|
|||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 6.2. Please use MICROSECOND instead
|
||||
Note 1003 select timestampdiff(WEEK,'2001-02-01','2001-05-01') AS `a1`,timestampdiff(SECOND_FRAC,'2001-02-01 12:59:59.120000','2001-05-01 12:58:58.119999') AS `a2`
|
||||
select time_format('100:00:00', '%H %k %h %I %l');
|
||||
time_format('100:00:00', '%H %k %h %I %l')
|
||||
|
@ -1261,6 +1266,24 @@ DATE_ADD(20071108, INTERVAL 1 DAY)
|
|||
select LAST_DAY('2007-12-06 08:59:19.05') - INTERVAL 1 SECOND;
|
||||
LAST_DAY('2007-12-06 08:59:19.05') - INTERVAL 1 SECOND
|
||||
2007-12-30 23:59:59
|
||||
SELECT TIMESTAMPADD(FRAC_SECOND, 1, '2008-02-18');
|
||||
TIMESTAMPADD(FRAC_SECOND, 1, '2008-02-18')
|
||||
2008-02-18 00:00:00.000001
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 6.2. Please use MICROSECOND instead
|
||||
SELECT TIMESTAMPDIFF(FRAC_SECOND, '2008-02-17', '2008-02-18');
|
||||
TIMESTAMPDIFF(FRAC_SECOND, '2008-02-17', '2008-02-18')
|
||||
86400000000
|
||||
Warnings:
|
||||
Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 6.2. Please use MICROSECOND instead
|
||||
SELECT DATE_ADD('2008-02-18', INTERVAL 1 FRAC_SECOND);
|
||||
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 'FRAC_SECOND)' at line 1
|
||||
SELECT DATE_SUB('2008-02-18', INTERVAL 1 FRAC_SECOND);
|
||||
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 'FRAC_SECOND)' at line 1
|
||||
SELECT '2008-02-18' + INTERVAL 1 FRAC_SECOND;
|
||||
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 'FRAC_SECOND' at line 1
|
||||
SELECT '2008-02-18' - INTERVAL 1 FRAC_SECOND;
|
||||
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 'FRAC_SECOND' at line 1
|
||||
End of 5.0 tests
|
||||
select date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND);
|
||||
date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND)
|
||||
|
|
|
@ -138,3 +138,20 @@ SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by
|
|||
user host db select_priv
|
||||
DROP USER CUser2@localhost;
|
||||
DROP USER CUser2@LOCALHOST;
|
||||
CREATE DATABASE mysqltest_1;
|
||||
CREATE TABLE mysqltest_1.t1 (a INT);
|
||||
CREATE USER 'mysqltest1'@'%';
|
||||
GRANT SELECT, UPDATE ON `mysqltest_1`.* TO 'mysqltest1'@'%';
|
||||
REVOKE SELECT ON `mysqltest_1`.* FROM 'mysqltest1'@'%';
|
||||
GRANT SELECT, UPDATE ON `mysqltest\_1`.* TO 'mysqltest1'@'%';
|
||||
FLUSH PRIVILEGES;
|
||||
SHOW GRANTS;
|
||||
Grants for mysqltest1@%
|
||||
GRANT USAGE ON *.* TO 'mysqltest1'@'%'
|
||||
GRANT SELECT, UPDATE ON `mysqltest\_1`.* TO 'mysqltest1'@'%'
|
||||
GRANT UPDATE ON `mysqltest_1`.* TO 'mysqltest1'@'%'
|
||||
SELECT * FROM mysqltest_1.t1;
|
||||
a
|
||||
DROP USER 'mysqltest1'@'%';
|
||||
DROP DATABASE mysqltest_1;
|
||||
End of 5.0 tests
|
||||
|
|
|
@ -256,6 +256,7 @@ set @a=repeat(' ',20);
|
|||
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'v' at row 1
|
||||
Note 1265 Data truncated for column 'c' at row 1
|
||||
select concat('*',v,'*',c,'*',t,'*') from t1;
|
||||
concat('*',v,'*',c,'*',t,'*')
|
||||
*+ *+*+ *
|
||||
|
|
|
@ -1836,6 +1836,7 @@ set @a=repeat(' ',20);
|
|||
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'v' at row 1
|
||||
Note 1265 Data truncated for column 'c' at row 1
|
||||
select concat('*',v,'*',c,'*',t,'*') from t1;
|
||||
concat('*',v,'*',c,'*',t,'*')
|
||||
*+ *+*+ *
|
||||
|
|
|
@ -1356,6 +1356,12 @@ id type d
|
|||
NULL member 3
|
||||
NULL member 4
|
||||
DROP TABLE t1;
|
||||
set @my_innodb_autoextend_increment=@@global.innodb_autoextend_increment;
|
||||
set global innodb_autoextend_increment=8;
|
||||
set global innodb_autoextend_increment=@my_innodb_autoextend_increment;
|
||||
set @my_innodb_commit_concurrency=@@global.innodb_commit_concurrency;
|
||||
set global innodb_commit_concurrency=0;
|
||||
set global innodb_commit_concurrency=@my_innodb_commit_concurrency;
|
||||
End of 5.0 tests
|
||||
CREATE TABLE `t2` (
|
||||
`k` int(11) NOT NULL auto_increment,
|
||||
|
|
|
@ -1415,6 +1415,7 @@ set @a=repeat(' ',20);
|
|||
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'v' at row 1
|
||||
Note 1265 Data truncated for column 'c' at row 1
|
||||
select concat('*',v,'*',c,'*',t,'*') from t1;
|
||||
concat('*',v,'*',c,'*',t,'*')
|
||||
*+ *+*+ *
|
||||
|
|
|
@ -1086,6 +1086,7 @@ set @a=repeat(' ',20);
|
|||
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'v' at row 1
|
||||
Note 1265 Data truncated for column 'c' at row 1
|
||||
select concat('*',v,'*',c,'*',t,'*') from t1;
|
||||
concat('*',v,'*',c,'*',t,'*')
|
||||
*+ *+*+ *
|
||||
|
|
1
mysql-test/r/mysqldump-no-binlog.result
Normal file
1
mysql-test/r/mysqldump-no-binlog.result
Normal file
|
@ -0,0 +1 @@
|
|||
mysqldump: Error: Binlogging on server not active
|
|
@ -429,3 +429,21 @@ Handler_read_prev 0
|
|||
Handler_read_rnd 0
|
||||
Handler_read_rnd_next 5
|
||||
DROP TABLE t1,t2,t3,t4;
|
||||
CREATE TABLE t1 (
|
||||
a int(11) default NULL,
|
||||
b int(11) default NULL,
|
||||
KEY a (a,b)
|
||||
);
|
||||
INSERT INTO t1 VALUES (0,10),(0,11),(0,12);
|
||||
CREATE TABLE t2 (
|
||||
a int(11) default NULL,
|
||||
b int(11) default NULL,
|
||||
KEY a (a)
|
||||
);
|
||||
INSERT INTO t2 VALUES (3,NULL),(3,11),(3,12);
|
||||
SELECT * FROM t2 inner join t1 WHERE ( t1.a = 0 OR t1.a IS NULL) AND t2.a = 3 AND t2.b = t1.b;
|
||||
a b a b
|
||||
3 11 0 11
|
||||
3 12 0 12
|
||||
drop table t1, t2;
|
||||
End of 5.0 tests
|
||||
|
|
|
@ -1416,3 +1416,15 @@ SELECT @tmp_tables_after = @tmp_tables_before;
|
|||
@tmp_tables_after = @tmp_tables_before
|
||||
1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#31590: Wrong error message on sort buffer being too small.
|
||||
#
|
||||
create table t1(a int, b tinytext);
|
||||
insert into t1 values (1,2),(3,2);
|
||||
set session sort_buffer_size= 30000;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect sort_buffer_size value: '30000'
|
||||
set session max_sort_length= 2180;
|
||||
select * from t1 order by b;
|
||||
ERROR HY001: Out of sort memory; increase server sort buffer size
|
||||
drop table t1;
|
||||
|
|
|
@ -1,16 +1,63 @@
|
|||
create table t1 (a int) engine myisam
|
||||
partition by range (a)
|
||||
subpartition by hash (a)
|
||||
(partition p0 VALUES LESS THAN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/tmpdata' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/tmpinx'
|
||||
(partition p0 VALUES LESS THAN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp'
|
||||
(SUBPARTITION subpart00, SUBPARTITION subpart01));
|
||||
Checking if file exists before alter
|
||||
ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
|
||||
(partition p1 VALUES LESS THAN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/tmpdata' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/tmpinx'
|
||||
(partition p1 VALUES LESS THAN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp'
|
||||
(SUBPARTITION subpart10, SUBPARTITION subpart11),
|
||||
partition p2 VALUES LESS THAN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/tmpdata' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/tmpinx'
|
||||
partition p2 VALUES LESS THAN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/tmp'
|
||||
(SUBPARTITION subpart20, SUBPARTITION subpart21));
|
||||
Checking if file exists after alter
|
||||
drop table t1;
|
||||
set @org_mode=@@sql_mode;
|
||||
set @@sql_mode='NO_DIR_IN_CREATE';
|
||||
select @@sql_mode;
|
||||
@@sql_mode
|
||||
NO_DIR_IN_CREATE
|
||||
create table t1 (i int )
|
||||
partition by range (i)
|
||||
(
|
||||
partition p01 values less than (1000)
|
||||
data directory='/not/existing'
|
||||
index directory='/not/existing'
|
||||
);
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`i` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (i) (PARTITION p01 VALUES LESS THAN (1000) ENGINE = MyISAM) */
|
||||
DROP TABLE t1, t2;
|
||||
set @@sql_mode=@org_mode;
|
||||
CREATE TABLE t1(a INT)
|
||||
PARTITION BY KEY (a)
|
||||
(PARTITION p0 DATA DIRECTORY 'TEST_DIR/master-data/test');
|
||||
ERROR HY000: Incorrect arguments to DATA DIRECORY
|
||||
CREATE TABLE t1(a INT)
|
||||
PARTITION BY KEY (a)
|
||||
(PARTITION p0 INDEX DIRECTORY 'TEST_DIR/master-data/test');
|
||||
ERROR HY000: Incorrect arguments to INDEX DIRECORY
|
||||
CREATE TABLE ts (id INT, purchased DATE)
|
||||
PARTITION BY RANGE(YEAR(purchased))
|
||||
SUBPARTITION BY HASH(TO_DAYS(purchased)) (
|
||||
PARTITION p0 VALUES LESS THAN (1990) (
|
||||
SUBPARTITION s0a
|
||||
DATA DIRECTORY = 'TEST_DIR/master-data/test',
|
||||
SUBPARTITION s0b
|
||||
DATA DIRECTORY = 'TEST_DIR/master-data/test'
|
||||
));
|
||||
ERROR HY000: Incorrect arguments to DATA DIRECORY
|
||||
CREATE TABLE ts (id INT, purchased DATE)
|
||||
PARTITION BY RANGE(YEAR(purchased))
|
||||
SUBPARTITION BY HASH(TO_DAYS(purchased)) (
|
||||
PARTITION p0 VALUES LESS THAN (1990) (
|
||||
SUBPARTITION s0a
|
||||
INDEX DIRECTORY = 'TEST_DIR/master-data/test',
|
||||
SUBPARTITION s0b
|
||||
INDEX DIRECTORY = 'TEST_DIR/master-data/test'
|
||||
));
|
||||
ERROR HY000: Incorrect arguments to INDEX DIRECORY
|
||||
DROP TABLE IF EXISTS `example`;
|
||||
CREATE TABLE `example` (
|
||||
`ID_EXAMPLE` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
|
|
|
@ -13,11 +13,11 @@ USE test;
|
|||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY LIST (a) (
|
||||
PARTITION p0 VALUES IN (0)
|
||||
DATA DIRECTORY 'MYSQLTEST_VARDIR/master-data/mysqltest2'
|
||||
INDEX DIRECTORY 'MYSQLTEST_VARDIR/master-data/mysqltest2',
|
||||
DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
|
||||
INDEX DIRECTORY 'MYSQLTEST_VARDIR/tmp',
|
||||
PARTITION p1 VALUES IN (1)
|
||||
DATA DIRECTORY 'MYSQLTEST_VARDIR/master-data/test'
|
||||
INDEX DIRECTORY 'MYSQLTEST_VARDIR/master-data/test',
|
||||
DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
|
||||
INDEX DIRECTORY 'MYSQLTEST_VARDIR/tmp',
|
||||
PARTITION p2 VALUES IN (2)
|
||||
);
|
||||
# without the patch for bug#32091 this would create
|
||||
|
@ -49,32 +49,32 @@ USE mysqltest2;
|
|||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY LIST (a) (
|
||||
PARTITION p0 VALUES IN (0)
|
||||
DATA DIRECTORY 'MYSQLTEST_VARDIR/master-data/mysqltest2'
|
||||
INDEX DIRECTORY 'MYSQLTEST_VARDIR/master-data/mysqltest2',
|
||||
DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
|
||||
INDEX DIRECTORY 'MYSQLTEST_VARDIR/tmp',
|
||||
PARTITION p1 VALUES IN (1)
|
||||
DATA DIRECTORY 'MYSQLTEST_VARDIR/master-data/test'
|
||||
INDEX DIRECTORY 'MYSQLTEST_VARDIR/master-data/test'
|
||||
DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
|
||||
INDEX DIRECTORY 'MYSQLTEST_VARDIR/tmp'
|
||||
);
|
||||
# user mysqltest_1:
|
||||
USE test;
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY LIST (a) (
|
||||
PARTITION p0 VALUES IN (0)
|
||||
DATA DIRECTORY 'MYSQLTEST_VARDIR/master-data/mysqltest2'
|
||||
INDEX DIRECTORY 'MYSQLTEST_VARDIR/master-data/mysqltest2',
|
||||
DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
|
||||
INDEX DIRECTORY 'MYSQLTEST_VARDIR/tmp',
|
||||
PARTITION p1 VALUES IN (1)
|
||||
DATA DIRECTORY 'MYSQLTEST_VARDIR/master-data/test'
|
||||
INDEX DIRECTORY 'MYSQLTEST_VARDIR/master-data/test'
|
||||
DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
|
||||
INDEX DIRECTORY 'MYSQLTEST_VARDIR/tmp'
|
||||
);
|
||||
Got one of the listed errors
|
||||
CREATE TABLE t1 (a INT)
|
||||
PARTITION BY LIST (a) (
|
||||
PARTITION p0 VALUES IN (0)
|
||||
DATA DIRECTORY 'MYSQLTEST_VARDIR/master-data/test'
|
||||
INDEX DIRECTORY 'MYSQLTEST_VARDIR/master-data/test',
|
||||
DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
|
||||
INDEX DIRECTORY 'MYSQLTEST_VARDIR/tmp',
|
||||
PARTITION p1 VALUES IN (1)
|
||||
DATA DIRECTORY 'MYSQLTEST_VARDIR/master-data/mysqltest2'
|
||||
INDEX DIRECTORY 'MYSQLTEST_VARDIR/master-data/mysqltest2'
|
||||
DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
|
||||
INDEX DIRECTORY 'MYSQLTEST_VARDIR/tmp'
|
||||
);
|
||||
Got one of the listed errors
|
||||
# user root (cleanup):
|
||||
|
|
|
@ -27,3 +27,30 @@ SET GLOBAL example_enum_var= e2;
|
|||
SET GLOBAL example_enum_var= impossible;
|
||||
ERROR 42000: Variable 'enum_var' can't be set to the value of 'impossible'
|
||||
UNINSTALL PLUGIN example;
|
||||
INSTALL PLUGIN example SONAME 'ha_example.so';
|
||||
select @@session.sql_mode into @old_sql_mode;
|
||||
set session sql_mode='';
|
||||
set global example_ulong_var=500;
|
||||
select @@global.example_ulong_var;
|
||||
@@global.example_ulong_var
|
||||
500
|
||||
set global example_ulong_var=1111;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect ulong_var value: '1111'
|
||||
select @@global.example_ulong_var;
|
||||
@@global.example_ulong_var
|
||||
1000
|
||||
set session sql_mode='STRICT_ALL_TABLES';
|
||||
set global example_ulong_var=500;
|
||||
select @@global.example_ulong_var;
|
||||
@@global.example_ulong_var
|
||||
500
|
||||
set global example_ulong_var=1111;
|
||||
ERROR 42000: Variable 'ulong_var' can't be set to the value of '1111'
|
||||
select @@global.example_ulong_var;
|
||||
@@global.example_ulong_var
|
||||
500
|
||||
set session sql_mode=@old_sql_mode;
|
||||
set session old=bla;
|
||||
ERROR HY000: Variable 'old' is a read only variable
|
||||
UNINSTALL PLUGIN example;
|
||||
|
|
|
@ -1153,6 +1153,19 @@ explain select * from t1 where dateval >= '2007-01-01 00:00:00' and dateval <= '
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range dateval dateval 4 NULL 2 Using where
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
a varchar(32), index (a)
|
||||
) DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
|
||||
INSERT INTO t1 VALUES
|
||||
('B'), ('A'), ('A'), ('C'), ('B'), ('A'), ('A');
|
||||
SELECT a FROM t1 WHERE a='b' OR a='B';
|
||||
a
|
||||
B
|
||||
B
|
||||
EXPLAIN SELECT a FROM t1 WHERE a='b' OR a='B';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range a a 35 NULL 3 Using where; Using index
|
||||
DROP TABLE t1;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
create table t2 (a int, b int, filler char(100));
|
||||
|
|
|
@ -434,3 +434,12 @@ SELECT @x;
|
|||
@x
|
||||
99
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT, b INT);
|
||||
INSERT INTO t1 VALUES (1,1);
|
||||
SELECT ROW(a, 1) IN (SELECT SUM(b), 1) FROM t1 GROUP BY a;
|
||||
ROW(a, 1) IN (SELECT SUM(b), 1)
|
||||
1
|
||||
SELECT ROW(a, 1) IN (SELECT SUM(b), 3) FROM t1 GROUP BY a;
|
||||
ROW(a, 1) IN (SELECT SUM(b), 3)
|
||||
0
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -4313,6 +4313,33 @@ SELECT * FROM t1 WHERE c1 > NULL + 1;
|
|||
c1
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (a VARCHAR(10) NOT NULL PRIMARY KEY);
|
||||
INSERT INTO t1 (a) VALUES ('foo0'), ('bar0'), ('baz0');
|
||||
SELECT * FROM t1 WHERE a IN (CONCAT('foo', 0), 'bar');
|
||||
a
|
||||
foo0
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT, b INT);
|
||||
CREATE TABLE t2 (a INT, c INT, KEY(a));
|
||||
INSERT INTO t1 VALUES (1, 1), (2, 2);
|
||||
INSERT INTO t2 VALUES (1, 1), (1, 2), (1, 3), (1, 4), (1, 5),
|
||||
(2, 1), (2, 2), (2, 3), (2, 4), (2, 5),
|
||||
(3, 1), (3, 2), (3, 3), (3, 4), (3, 5),
|
||||
(4, 1), (4, 2), (4, 3), (4, 4), (4, 5);
|
||||
FLUSH STATUS;
|
||||
SELECT DISTINCT b FROM t1 LEFT JOIN t2 USING(a) WHERE c <= 3;
|
||||
b
|
||||
1
|
||||
2
|
||||
SHOW STATUS LIKE 'Handler_read%';
|
||||
Variable_name Value
|
||||
Handler_read_first 0
|
||||
Handler_read_key 2
|
||||
Handler_read_next 0
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_next 6
|
||||
DROP TABLE t1, t2;
|
||||
End of 5.0 tests
|
||||
create table t1(a INT, KEY (a));
|
||||
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
|
||||
|
|
|
@ -6862,6 +6862,23 @@ end//
|
|||
call proc_33618(20);
|
||||
drop table t_33618;
|
||||
drop procedure proc_33618;
|
||||
#
|
||||
# Bug#30787: Stored function ignores user defined alias.
|
||||
#
|
||||
use test;
|
||||
drop function if exists func30787;
|
||||
create table t1(f1 int);
|
||||
insert into t1 values(1),(2);
|
||||
create function func30787(p1 int) returns int
|
||||
begin
|
||||
return p1;
|
||||
end |
|
||||
select (select func30787(f1)) as ttt from t1;
|
||||
ttt
|
||||
1
|
||||
2
|
||||
drop function func30787;
|
||||
drop table t1;
|
||||
# ------------------------------------------------------------------
|
||||
# -- End of 5.0 tests
|
||||
# ------------------------------------------------------------------
|
||||
|
|
|
@ -496,3 +496,13 @@ xb x
|
|||
xcx
|
||||
drop table t1;
|
||||
SET @@SQL_MODE=@OLD_SQL_MODE;
|
||||
create user mysqltest_32753@localhost;
|
||||
set @OLD_SQL_MODE=@@SESSION.SQL_MODE;
|
||||
set session sql_mode='PAD_CHAR_TO_FULL_LENGTH';
|
||||
flush privileges;
|
||||
select current_user();
|
||||
current_user()
|
||||
mysqltest_32753@localhost
|
||||
set session sql_mode=@OLD_SQL_MODE;
|
||||
flush privileges;
|
||||
drop user mysqltest_32753@localhost;
|
||||
|
|
|
@ -895,7 +895,6 @@ ERROR 22003: Out of range value for column 'col1' at row 1
|
|||
INSERT INTO t1 (col2) VALUES ('-1.2E-3');
|
||||
ERROR 22003: Out of range value for column 'col2' at row 1
|
||||
UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0;
|
||||
ERROR 22003: Out of range value for column 'col1' at row 3
|
||||
UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;
|
||||
ERROR 22012: Division by 0
|
||||
UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
|
||||
|
@ -923,10 +922,10 @@ SELECT * FROM t1;
|
|||
col1 col2
|
||||
-2.2e-307 0
|
||||
1e-303 0
|
||||
1.7e+308 1.7e+308
|
||||
NULL 1.7e+308
|
||||
-2.2e-307 0
|
||||
-2e-307 0
|
||||
1.7e+308 1.7e+308
|
||||
NULL 1.7e+308
|
||||
0 NULL
|
||||
2 NULL
|
||||
NULL NULL
|
||||
|
@ -934,6 +933,8 @@ NULL NULL
|
|||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (col1 CHAR(5), col2 VARCHAR(6));
|
||||
INSERT INTO t1 VALUES ('hello', 'hello'),('he', 'he'),('hello ', 'hello ');
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'col1' at row 3
|
||||
INSERT INTO t1 (col1) VALUES ('hellobob');
|
||||
ERROR 22001: Data too long for column 'col1' at row 1
|
||||
INSERT INTO t1 (col2) VALUES ('hellobob');
|
||||
|
|
|
@ -4155,6 +4155,41 @@ SELECT ((a1,a2) IN (SELECT * FROM t2 WHERE b2 > 0)) IS NULL FROM t1;
|
|||
0
|
||||
0
|
||||
DROP TABLE t1, t2;
|
||||
create table t1(a int,b int,key(a),key(b));
|
||||
insert into t1(a,b) values (1,2),(2,1),(2,3),(3,4),(5,4),(5,5),
|
||||
(6,7),(7,4),(5,3);
|
||||
5
|
||||
4
|
||||
3
|
||||
2
|
||||
1
|
||||
26
|
||||
25
|
||||
24
|
||||
23
|
||||
22
|
||||
21
|
||||
20
|
||||
19
|
||||
18
|
||||
17
|
||||
16
|
||||
15
|
||||
14
|
||||
13
|
||||
12
|
||||
11
|
||||
10
|
||||
9
|
||||
8
|
||||
7
|
||||
6
|
||||
5
|
||||
4
|
||||
3
|
||||
2
|
||||
1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (s1 BINARY(5), s2 VARBINARY(5));
|
||||
INSERT INTO t1 VALUES (0x41,0x41), (0x42,0x42), (0x43,0x43);
|
||||
SELECT s1, s2 FROM t1 WHERE s2 IN (SELECT s1 FROM t1);
|
||||
|
|
|
@ -100,23 +100,15 @@ t1 CREATE TABLE `t1` (
|
|||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
CREATE TABLE t1(a INT)
|
||||
DATA DIRECTORY='TEST_DIR/master-data/mysql'
|
||||
INDEX DIRECTORY='TEST_DIR/master-data/mysql';
|
||||
RENAME TABLE t1 TO user;
|
||||
ERROR HY000: Can't create/write to file 'TEST_DIR/master-data/mysql/user.MYI' (Errcode: 17)
|
||||
DROP TABLE t1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`i` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`i` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
DATA DIRECTORY='TEST_DIR/tmp'
|
||||
INDEX DIRECTORY='TEST_DIR/tmp';
|
||||
ERROR HY000: Can't create/write to file 'TEST_DIR/tmp/t1.MYI' (Errcode: 17)
|
||||
CREATE TABLE t2(a INT)
|
||||
DATA DIRECTORY='TEST_DIR/tmp'
|
||||
INDEX DIRECTORY='TEST_DIR/tmp';
|
||||
RENAME TABLE t2 TO t1;
|
||||
ERROR HY000: Can't create/write to file 'TEST_DIR/tmp/t1.MYI' (Errcode: 17)
|
||||
DROP TABLE t2;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TEMPORARY TABLE `t1` (
|
||||
|
@ -139,29 +131,28 @@ a
|
|||
42
|
||||
drop table t1;
|
||||
End of 4.1 tests
|
||||
CREATE DATABASE db1;
|
||||
CREATE DATABASE db2;
|
||||
USE db2;
|
||||
INSERT INTO db2.t1 VALUES (1);
|
||||
SELECT * FROM db2.t1;
|
||||
b
|
||||
1
|
||||
RESET QUERY CACHE;
|
||||
USE db1;
|
||||
SET SESSION keep_files_on_create = TRUE;
|
||||
CREATE TABLE t1 (a INT) ENGINE MYISAM;
|
||||
Got one of the listed errors
|
||||
CREATE TABLE t3 (a INT) Engine=MyISAM;
|
||||
INSERT INTO t3 VALUES (1),(2),(3);
|
||||
TRUNCATE TABLE t3;
|
||||
SELECT * from t3;
|
||||
a
|
||||
SET SESSION keep_files_on_create = DEFAULT;
|
||||
DROP TABLE db2.t1, db1.t3;
|
||||
DROP DATABASE db1;
|
||||
DROP DATABASE db2;
|
||||
USE test;
|
||||
SET SESSION keep_files_on_create = FALSE;
|
||||
CREATE TABLE t1 (a INT) ENGINE MYISAM;
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
CREATE TABLE t1(a INT)
|
||||
INDEX DIRECTORY='TEST_DIR/master-data/mysql';
|
||||
ERROR HY000: Incorrect arguments to INDEX DIRECORY
|
||||
CREATE TABLE t1(a INT)
|
||||
DATA DIRECTORY='TEST_DIR/master-data/test';
|
||||
ERROR HY000: Incorrect arguments to DATA DIRECORY
|
||||
CREATE TABLE t1(a INT)
|
||||
DATA DIRECTORY='TEST_DIR/master-data/';
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a INT)
|
||||
INDEX DIRECTORY='TEST_DIR/master-data';
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a INT)
|
||||
INDEX DIRECTORY='TEST_DIR/master-data_var';
|
||||
ERROR HY000: Can't create/write to file 'TEST_DIR/master-data_var/t1.MYI' (Errcode: 2)
|
||||
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='NO_DIR_IN_CREATE';
|
||||
CREATE TABLE t1(a INT) DATA DIRECTORY='MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY='MYSQLTEST_VARDIR/tmp';
|
||||
Warnings:
|
||||
|
|
|
@ -46,3 +46,12 @@ CREATE TABLE t2 (a int);
|
|||
lock tables t1 write,t1 as b write, t2 write, t2 as c read;
|
||||
drop table t2,t1;
|
||||
unlock tables;
|
||||
create temporary table t1(f1 int);
|
||||
lock tables t1 write;
|
||||
insert into t1 values (1);
|
||||
show columns from t1;
|
||||
Field Type Null Key Default Extra
|
||||
f1 int(11) YES NULL
|
||||
insert into t1 values(2);
|
||||
drop table t1;
|
||||
unlock tables;
|
||||
|
|
|
@ -125,6 +125,7 @@ create table t1 (c char(2), vc varchar(2));
|
|||
insert into t1 values(0x4120, 0x4120);
|
||||
insert into t1 values(0x412020, 0x412020);
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'c' at row 1
|
||||
Note 1265 Data truncated for column 'vc' at row 1
|
||||
drop table t1;
|
||||
set @old_sql_mode= @@sql_mode, sql_mode= 'traditional';
|
||||
|
|
|
@ -85,3 +85,11 @@ t1 CREATE TABLE `t1` (
|
|||
`f1` set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','1') DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
CREATE TABLE t1(c set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64'));
|
||||
INSERT INTO t1 VALUES(7);
|
||||
INSERT INTO t1 VALUES(9223372036854775808);
|
||||
SELECT * FROM t1;
|
||||
c
|
||||
1,2,3
|
||||
64
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -3613,6 +3613,30 @@ ERROR HY000: Field of view 'test.v1' underlying table doesn't have a default val
|
|||
set @@sql_mode=@old_mode;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
create table t1 (a int, key(a));
|
||||
create table t2 (c int);
|
||||
create view v1 as select a b from t1;
|
||||
create view v2 as select 1 a from t2, v1 where c in
|
||||
(select 1 from t1 where b = a);
|
||||
insert into t1 values (1), (1);
|
||||
insert into t2 values (1), (1);
|
||||
prepare stmt from "select * from v2 where a = 1";
|
||||
execute stmt;
|
||||
a
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
drop view v1, v2;
|
||||
drop table t1, t2;
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE VIEW v1 AS SELECT p.a AS a FROM t1 p, t1 q;
|
||||
INSERT INTO t1 VALUES (1), (1);
|
||||
SELECT MAX(a), COUNT(DISTINCT a) FROM v1 GROUP BY a;
|
||||
MAX(a) COUNT(DISTINCT a)
|
||||
1 1
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
# -----------------------------------------------------------------
|
||||
# -- Bug#34337: Server crash when Altering a view using a table name.
|
||||
# -----------------------------------------------------------------
|
||||
|
|
|
@ -276,4 +276,42 @@ DROP TABLE t3;
|
|||
DROP PROCEDURE sp1;
|
||||
DROP PROCEDURE sp2;
|
||||
DROP PROCEDURE sp3;
|
||||
create table t1 (c_char char(255), c_varchar varchar(255), c_tinytext tinytext);
|
||||
create table t2 (c_tinyblob tinyblob);
|
||||
set @c = repeat(' ', 256);
|
||||
set @q = repeat('q', 256);
|
||||
set sql_mode = '';
|
||||
insert into t1 values(@c, @c, @c);
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'c_char' at row 1
|
||||
Note 1265 Data truncated for column 'c_varchar' at row 1
|
||||
Note 1265 Data truncated for column 'c_tinytext' at row 1
|
||||
insert into t2 values(@c);
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'c_tinyblob' at row 1
|
||||
insert into t1 values(@q, @q, @q);
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'c_char' at row 1
|
||||
Warning 1265 Data truncated for column 'c_varchar' at row 1
|
||||
Warning 1265 Data truncated for column 'c_tinytext' at row 1
|
||||
insert into t2 values(@q);
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'c_tinyblob' at row 1
|
||||
set sql_mode = 'traditional';
|
||||
insert into t1 values(@c, @c, @c);
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'c_char' at row 1
|
||||
Note 1265 Data truncated for column 'c_varchar' at row 1
|
||||
Note 1265 Data truncated for column 'c_tinytext' at row 1
|
||||
insert into t2 values(@c);
|
||||
ERROR 22001: Data too long for column 'c_tinyblob' at row 1
|
||||
insert into t1 values(@q, NULL, NULL);
|
||||
ERROR 22001: Data too long for column 'c_char' at row 1
|
||||
insert into t1 values(NULL, @q, NULL);
|
||||
ERROR 22001: Data too long for column 'c_varchar' at row 1
|
||||
insert into t1 values(NULL, NULL, @q);
|
||||
ERROR 22001: Data too long for column 'c_tinytext' at row 1
|
||||
insert into t2 values(@q);
|
||||
ERROR 22001: Data too long for column 'c_tinyblob' at row 1
|
||||
drop table t1, t2;
|
||||
End of 5.0 tests
|
||||
|
|
|
@ -27,8 +27,7 @@ if ($do_file_tests)
|
|||
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1* > $MYSQLTEST_VARDIR/master-data/test/tmp2 || true
|
||||
if ($with_directories)
|
||||
{
|
||||
--exec ls $MYSQLTEST_VARDIR/master-data/test/data/t1* >> $MYSQLTEST_VARDIR/master-data/test/tmp2 || true
|
||||
--exec ls $MYSQLTEST_VARDIR/master-data/test/index/t1* >> $MYSQLTEST_VARDIR/master-data/test/tmp2 || true
|
||||
--exec ls $MYSQLTEST_VARDIR/tmp/t1* >> $MYSQLTEST_VARDIR/master-data/test/tmp2 || true
|
||||
}
|
||||
eval SET @aux = CONCAT('load_file(''$MYSQLTEST_VARDIR','/master-data/test/tmp2'')');
|
||||
let $file_list= `SELECT @aux`;
|
||||
|
@ -65,8 +64,7 @@ if ($found_garbage)
|
|||
--exec rm -f $MYSQLTEST_VARDIR/master-data/test/t1* || true
|
||||
if ($with_directories)
|
||||
{
|
||||
--exec rm -f $MYSQLTEST_VARDIR/master-data/test/data/t1* || true
|
||||
--exec rm -f $MYSQLTEST_VARDIR/master-data/test/index/t1* || true
|
||||
--exec rm -f $MYSQLTEST_VARDIR/tmp/t1* || true
|
||||
}
|
||||
}
|
||||
--enable_query_log
|
||||
|
|
|
@ -38,8 +38,7 @@ if ($do_file_tests)
|
|||
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1* > $MYSQLTEST_VARDIR/master-data/test/tmp2 2>&1 || true
|
||||
if ($with_directories)
|
||||
{
|
||||
--exec ls $MYSQLTEST_VARDIR/master-data/test/data/t1* >> $MYSQLTEST_VARDIR/master-data/test/tmp2 2>&1 || true
|
||||
--exec ls $MYSQLTEST_VARDIR/master-data/test/index/t1* >> $MYSQLTEST_VARDIR/master-data/test/tmp2 2>&1 || true
|
||||
--exec ls $MYSQLTEST_VARDIR/tmp/t1* >> $MYSQLTEST_VARDIR/master-data/test/tmp2 2>&1 || true
|
||||
}
|
||||
eval SET @aux = CONCAT('load_file(''$MYSQLTEST_VARDIR','/master-data/test/tmp2''
|
||||
)');
|
||||
|
|
|
@ -46,3 +46,34 @@ insert into t1 values (0x01,0x01);
|
|||
select * from t1 where a=b;
|
||||
select * from t1 where a=b and b=0x01;
|
||||
drop table if exists t1;
|
||||
|
||||
#
|
||||
# Bug #31887: DML Select statement not returning same results when executed
|
||||
# in version 5
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (b int(2) zerofill, c int(2) zerofill);
|
||||
INSERT INTO t1 (b,c) VALUES (1,2), (1,1), (2,2);
|
||||
|
||||
SELECT CONCAT(b,c), CONCAT(b,c) = '0101' FROM t1;
|
||||
|
||||
EXPLAIN EXTENDED SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101';
|
||||
SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101';
|
||||
|
||||
CREATE TABLE t2 (a int);
|
||||
INSERT INTO t2 VALUES (1),(2);
|
||||
|
||||
SELECT a,
|
||||
(SELECT COUNT(*) FROM t1
|
||||
WHERE b = t2.a AND CONCAT(b,c) = CONCAT('0',t2.a,'01')) x
|
||||
FROM t2 ORDER BY a;
|
||||
|
||||
EXPLAIN EXTENDED
|
||||
SELECT a,
|
||||
(SELECT COUNT(*) FROM t1
|
||||
WHERE b = t2.a AND CONCAT(b,c) = CONCAT('0',t2.a,'01')) x
|
||||
FROM t2 ORDER BY a;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
|
|
@ -1152,6 +1152,30 @@ create table t2 select sql_big_result f1,count(f2) from t1 group by f1;
|
|||
show status like 'handler_read%';
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Bug #25162: Backing up DB from 5.1 adds 'USING BTREE' to KEYs on table creates
|
||||
#
|
||||
|
||||
# Show that the old syntax for index type is supported
|
||||
CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1));
|
||||
DROP TABLE t1;
|
||||
|
||||
# Show that the new syntax for index type is supported
|
||||
CREATE TABLE t1(c1 VARCHAR(33), KEY (c1) USING BTREE);
|
||||
DROP TABLE t1;
|
||||
|
||||
# Show that in case of multiple index type definitions, the last one takes
|
||||
# precedence
|
||||
|
||||
CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1) USING HASH) ENGINE=MEMORY;
|
||||
SHOW INDEX FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(c1 VARCHAR(33), KEY USING HASH (c1) USING BTREE) ENGINE=MEMORY;
|
||||
SHOW INDEX FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
#
|
||||
|
|
|
@ -17,7 +17,6 @@ ctype_big5 : BUG#26711 2007-06-21 Lars Test has never worked on Do
|
|||
federated_transactions : Bug#29523 Transactions do not work
|
||||
lowercase_table3 : Bug#32667 lowercase_table3.test reports to error log
|
||||
innodb_mysql : Bug#32724: innodb_mysql.test fails randomly
|
||||
wait_timeout : Bug#32801 wait_timeout.test fails randomly
|
||||
ctype_create : Bug#32965 main.ctype_create fails
|
||||
status : Bug#32966 main.status fails
|
||||
ps_ddl : Bug#12093 2007-12-14 pending WL#4165 / WL#4166
|
||||
|
|
|
@ -640,4 +640,21 @@ SELECT GROUP_CONCAT(DISTINCT b, a ORDER BY b) FROM t1;
|
|||
|
||||
DROP TABLE t1, t2, t3;
|
||||
|
||||
#
|
||||
# Bug #34747: crash in debug assertion check after derived table
|
||||
#
|
||||
CREATE TABLE t1(a INT);
|
||||
INSERT INTO t1 VALUES (),();
|
||||
SELECT s1.d1 FROM
|
||||
(
|
||||
SELECT
|
||||
t1.a as d1,
|
||||
GROUP_CONCAT(DISTINCT t1.a) AS d2
|
||||
FROM
|
||||
t1 AS t1,
|
||||
t1 AS t2
|
||||
GROUP BY 1
|
||||
) AS s1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
|
|
@ -248,5 +248,17 @@ INSERT INTO t1 VALUES ('a');
|
|||
SELECT a DIV 2 FROM t1 UNION SELECT a DIV 2 FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
#
|
||||
# Bug #31236: Inconsistent division by zero behavior for floating point numbers
|
||||
#
|
||||
|
||||
SELECT 1e308 + 1e308;
|
||||
SELECT -1e308 - 1e308;
|
||||
SELECT 1e300 * 1e300;
|
||||
SELECT 1e300 / 1e-300;
|
||||
SELECT EXP(750);
|
||||
SELECT POW(10, 309);
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
|
|
@ -213,6 +213,24 @@ SELECT NAME_CONST('test', 1.0);
|
|||
SELECT NAME_CONST('test', -1.0);
|
||||
SELECT NAME_CONST('test', 'test');
|
||||
|
||||
#
|
||||
# Bug #34749: Server crash when using NAME_CONST() with an aggregate function
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
# NAME_CONST() + aggregate.
|
||||
SELECT NAME_CONST('flag',1) * MAX(a) FROM t1;
|
||||
SELECT NAME_CONST('flag',1.5) * MAX(a) FROM t1;
|
||||
# Now, wrap the INT_ITEM in Item_func_neg and watch the pretty explosions
|
||||
SELECT NAME_CONST('flag',-1) * MAX(a) FROM t1;
|
||||
SELECT NAME_CONST('flag',-1.5) * MAX(a) FROM t1;
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
SELECT NAME_CONST('flag', SQRT(4)) * MAX(a) FROM t1;
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
SELECT NAME_CONST('flag',-SQRT(4)) * MAX(a) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #27545: erroneous usage of NAME_CONST with a name as the first parameter
|
||||
# resolved against a column name of a derived table hangs the client
|
||||
|
|
|
@ -874,6 +874,13 @@ select benchmark(0, NULL);
|
|||
select benchmark(100, NULL);
|
||||
select benchmark(NULL, 1+1);
|
||||
|
||||
#
|
||||
# Bug #20752: BENCHMARK with many iterations returns too quickly
|
||||
#
|
||||
|
||||
# not a string, but belongs with the above Bug#22684
|
||||
select benchmark(-1, 1);
|
||||
|
||||
#
|
||||
# Please note:
|
||||
# 1) The collation of the password is irrelevant, the encryption uses
|
||||
|
|
|
@ -336,7 +336,7 @@ select date_add(date,INTERVAL "1" QUARTER) from t1;
|
|||
select timestampadd(MINUTE, 1, date) from t1;
|
||||
select timestampadd(WEEK, 1, date) from t1;
|
||||
select timestampadd(SQL_TSI_SECOND, 1, date) from t1;
|
||||
# Prepared statements doesn't support FRAC_SECOND yet
|
||||
# mysqltest.c discards an expected 'deprecated' warning on prepare stage
|
||||
--disable_ps_protocol
|
||||
select timestampadd(SQL_TSI_FRAC_SECOND, 1, date) from t1;
|
||||
--enable_ps_protocol
|
||||
|
@ -351,7 +351,10 @@ select timestampdiff(SQL_TSI_HOUR, '2001-02-01', '2001-05-01') as a;
|
|||
select timestampdiff(SQL_TSI_DAY, '2001-02-01', '2001-05-01') as a;
|
||||
select timestampdiff(SQL_TSI_MINUTE, '2001-02-01 12:59:59', '2001-05-01 12:58:59') as a;
|
||||
select timestampdiff(SQL_TSI_SECOND, '2001-02-01 12:59:59', '2001-05-01 12:58:58') as a;
|
||||
# mysqltest.c discards an expected 'deprecated' warning on prepare stage
|
||||
--disable_ps_protocol
|
||||
select timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a;
|
||||
--enable_ps_protocol
|
||||
|
||||
select timestampdiff(SQL_TSI_DAY, '1986-02-01', '1986-03-01') as a1,
|
||||
timestampdiff(SQL_TSI_DAY, '1900-02-01', '1900-03-01') as a2,
|
||||
|
@ -783,6 +786,28 @@ select DATE_ADD(20071108, INTERVAL 1 DAY);
|
|||
|
||||
select LAST_DAY('2007-12-06 08:59:19.05') - INTERVAL 1 SECOND;
|
||||
|
||||
#
|
||||
# Bug#33834: FRAC_SECOND: Applicability not clear in documentation
|
||||
#
|
||||
# Show that he use of FRAC_SECOND, for anything other than
|
||||
# TIMESTAMPADD / TIMESTAMPDIFF, is a server error.
|
||||
|
||||
# mysqltest.c discards an expected 'deprecated' warning on prepare stage
|
||||
--disable_ps_protocol
|
||||
SELECT TIMESTAMPADD(FRAC_SECOND, 1, '2008-02-18');
|
||||
SELECT TIMESTAMPDIFF(FRAC_SECOND, '2008-02-17', '2008-02-18');
|
||||
--enable_ps_protocol
|
||||
|
||||
--error ER_PARSE_ERROR
|
||||
SELECT DATE_ADD('2008-02-18', INTERVAL 1 FRAC_SECOND);
|
||||
--error ER_PARSE_ERROR
|
||||
SELECT DATE_SUB('2008-02-18', INTERVAL 1 FRAC_SECOND);
|
||||
|
||||
--error ER_PARSE_ERROR
|
||||
SELECT '2008-02-18' + INTERVAL 1 FRAC_SECOND;
|
||||
--error ER_PARSE_ERROR
|
||||
SELECT '2008-02-18' - INTERVAL 1 FRAC_SECOND;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
#
|
||||
|
|
|
@ -134,3 +134,29 @@ SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by
|
|||
|
||||
DROP USER CUser2@localhost;
|
||||
DROP USER CUser2@LOCALHOST;
|
||||
|
||||
|
||||
#
|
||||
# Bug#31194: Privilege ordering does not order properly for wildcard values
|
||||
#
|
||||
|
||||
CREATE DATABASE mysqltest_1;
|
||||
CREATE TABLE mysqltest_1.t1 (a INT);
|
||||
CREATE USER 'mysqltest1'@'%';
|
||||
GRANT SELECT, UPDATE ON `mysqltest_1`.* TO 'mysqltest1'@'%';
|
||||
REVOKE SELECT ON `mysqltest_1`.* FROM 'mysqltest1'@'%';
|
||||
GRANT SELECT, UPDATE ON `mysqltest\_1`.* TO 'mysqltest1'@'%';
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
connect (conn1,localhost,mysqltest1,,);
|
||||
connection conn1;
|
||||
SHOW GRANTS;
|
||||
SELECT * FROM mysqltest_1.t1;
|
||||
disconnect conn1;
|
||||
|
||||
connection default;
|
||||
DROP USER 'mysqltest1'@'%';
|
||||
DROP DATABASE mysqltest_1;
|
||||
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
|
1
mysql-test/t/mysqldump-no-binlog-master.opt
Normal file
1
mysql-test/t/mysqldump-no-binlog-master.opt
Normal file
|
@ -0,0 +1 @@
|
|||
--skip-log-bin
|
6
mysql-test/t/mysqldump-no-binlog.test
Normal file
6
mysql-test/t/mysqldump-no-binlog.test
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Embedded server doesn't support external clients
|
||||
--source include/not_embedded.inc
|
||||
|
||||
--replace_regex /MASTER_LOG_POS=[0-9]+/XX/
|
||||
--error 2
|
||||
--exec $MYSQL_DUMP --compact --master-data=2 test 2>&1
|
|
@ -240,3 +240,26 @@ SHOW STATUS LIKE "handler_read%";
|
|||
|
||||
DROP TABLE t1,t2,t3,t4;
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# BUG#34945 "ref_or_null queries that are null_rejecting and have a null value crash mysql"
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
a int(11) default NULL,
|
||||
b int(11) default NULL,
|
||||
KEY a (a,b)
|
||||
);
|
||||
INSERT INTO t1 VALUES (0,10),(0,11),(0,12);
|
||||
|
||||
CREATE TABLE t2 (
|
||||
a int(11) default NULL,
|
||||
b int(11) default NULL,
|
||||
KEY a (a)
|
||||
);
|
||||
INSERT INTO t2 VALUES (3,NULL),(3,11),(3,12);
|
||||
|
||||
SELECT * FROM t2 inner join t1 WHERE ( t1.a = 0 OR t1.a IS NULL) AND t2.a = 3 AND t2.b = t1.b;
|
||||
|
||||
drop table t1, t2;
|
||||
-- echo End of 5.0 tests
|
||||
|
||||
|
|
|
@ -836,3 +836,14 @@ eval set @tmp_tables_after =
|
|||
SELECT @tmp_tables_after = @tmp_tables_before;
|
||||
|
||||
DROP TABLE t1;
|
||||
--echo #
|
||||
--echo # Bug#31590: Wrong error message on sort buffer being too small.
|
||||
--echo #
|
||||
create table t1(a int, b tinytext);
|
||||
insert into t1 values (1,2),(3,2);
|
||||
set session sort_buffer_size= 30000;
|
||||
set session max_sort_length= 2180;
|
||||
--error 1038
|
||||
select * from t1 order by b;
|
||||
drop table t1;
|
||||
|
||||
|
|
|
@ -12,12 +12,10 @@
|
|||
# doesn't remove old directory
|
||||
|
||||
--disable_query_log
|
||||
--exec mkdir $MYSQLTEST_VARDIR/master-data/tmpdata || true
|
||||
eval SET @data_dir = 'DATA DIRECTORY = ''$MYSQLTEST_VARDIR/master-data/tmpdata''';
|
||||
eval SET @data_dir = 'DATA DIRECTORY = ''$MYSQLTEST_VARDIR/tmp''';
|
||||
let $data_directory = `select @data_dir`;
|
||||
|
||||
--exec mkdir $MYSQLTEST_VARDIR/master-data/tmpinx || true
|
||||
eval SET @inx_dir = 'INDEX DIRECTORY = ''$MYSQLTEST_VARDIR/master-data/tmpinx''';
|
||||
eval SET @inx_dir = 'INDEX DIRECTORY = ''$MYSQLTEST_VARDIR/tmp''';
|
||||
let $inx_directory = `select @inx_dir`;
|
||||
--enable_query_log
|
||||
|
||||
|
@ -35,10 +33,10 @@ subpartition by hash (a)
|
|||
--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0#SP#subpart00.MYI
|
||||
--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0#SP#subpart01.MYD
|
||||
--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0#SP#subpart01.MYI
|
||||
--file_exists $MYSQLTEST_VARDIR/master-data/tmpdata/t1#P#p0#SP#subpart00.MYD
|
||||
--file_exists $MYSQLTEST_VARDIR/master-data/tmpdata/t1#P#p0#SP#subpart01.MYD
|
||||
--file_exists $MYSQLTEST_VARDIR/master-data/tmpinx/t1#P#p0#SP#subpart00.MYI
|
||||
--file_exists $MYSQLTEST_VARDIR/master-data/tmpinx/t1#P#p0#SP#subpart01.MYI
|
||||
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p0#SP#subpart00.MYD
|
||||
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p0#SP#subpart01.MYD
|
||||
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p0#SP#subpart00.MYI
|
||||
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p0#SP#subpart01.MYI
|
||||
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
|
||||
|
@ -58,18 +56,81 @@ eval ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
|
|||
--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p2#SP#subpart20.MYI
|
||||
--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p2#SP#subpart21.MYD
|
||||
--file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p2#SP#subpart21.MYI
|
||||
--file_exists $MYSQLTEST_VARDIR/master-data/tmpdata/t1#P#p1#SP#subpart10.MYD
|
||||
--file_exists $MYSQLTEST_VARDIR/master-data/tmpdata/t1#P#p1#SP#subpart11.MYD
|
||||
--file_exists $MYSQLTEST_VARDIR/master-data/tmpdata/t1#P#p2#SP#subpart20.MYD
|
||||
--file_exists $MYSQLTEST_VARDIR/master-data/tmpdata/t1#P#p2#SP#subpart21.MYD
|
||||
--file_exists $MYSQLTEST_VARDIR/master-data/tmpinx/t1#P#p1#SP#subpart10.MYI
|
||||
--file_exists $MYSQLTEST_VARDIR/master-data/tmpinx/t1#P#p1#SP#subpart11.MYI
|
||||
--file_exists $MYSQLTEST_VARDIR/master-data/tmpinx/t1#P#p2#SP#subpart20.MYI
|
||||
--file_exists $MYSQLTEST_VARDIR/master-data/tmpinx/t1#P#p2#SP#subpart21.MYI
|
||||
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p1#SP#subpart10.MYD
|
||||
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p1#SP#subpart11.MYD
|
||||
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p2#SP#subpart20.MYD
|
||||
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p2#SP#subpart21.MYD
|
||||
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p1#SP#subpart10.MYI
|
||||
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p1#SP#subpart11.MYI
|
||||
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p2#SP#subpart20.MYI
|
||||
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p2#SP#subpart21.MYI
|
||||
|
||||
drop table t1;
|
||||
--exec rmdir $MYSQLTEST_VARDIR/master-data/tmpdata || true
|
||||
--exec rmdir $MYSQLTEST_VARDIR/master-data/tmpinx || true
|
||||
|
||||
#
|
||||
# Bug #24633 SQL MODE "NO_DIR_IN_CREATE" does not work with partitioned tables
|
||||
#
|
||||
disable_query_log;
|
||||
eval create table t2 (i int )
|
||||
partition by range (i)
|
||||
(
|
||||
partition p01 values less than (1000)
|
||||
data directory="$MYSQLTEST_VARDIR/tmp/"
|
||||
index directory="$MYSQLTEST_VARDIR/tmp/"
|
||||
);
|
||||
enable_query_log;
|
||||
|
||||
set @org_mode=@@sql_mode;
|
||||
set @@sql_mode='NO_DIR_IN_CREATE';
|
||||
select @@sql_mode;
|
||||
create table t1 (i int )
|
||||
partition by range (i)
|
||||
(
|
||||
partition p01 values less than (1000)
|
||||
data directory='/not/existing'
|
||||
index directory='/not/existing'
|
||||
);
|
||||
show create table t2;
|
||||
DROP TABLE t1, t2;
|
||||
set @@sql_mode=@org_mode;
|
||||
|
||||
#
|
||||
# Bug#32167: another privilege bypass with DATA/INDEX DIRECTORY
|
||||
#
|
||||
--replace_result $MYSQLTEST_VARDIR TEST_DIR
|
||||
--error 1210
|
||||
eval CREATE TABLE t1(a INT)
|
||||
PARTITION BY KEY (a)
|
||||
(PARTITION p0 DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/test');
|
||||
--replace_result $MYSQLTEST_VARDIR TEST_DIR
|
||||
--error 1210
|
||||
eval CREATE TABLE t1(a INT)
|
||||
PARTITION BY KEY (a)
|
||||
(PARTITION p0 INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/test');
|
||||
|
||||
--replace_result $MYSQLTEST_VARDIR TEST_DIR
|
||||
--error 1210
|
||||
eval CREATE TABLE ts (id INT, purchased DATE)
|
||||
PARTITION BY RANGE(YEAR(purchased))
|
||||
SUBPARTITION BY HASH(TO_DAYS(purchased)) (
|
||||
PARTITION p0 VALUES LESS THAN (1990) (
|
||||
SUBPARTITION s0a
|
||||
DATA DIRECTORY = '$MYSQLTEST_VARDIR/master-data/test',
|
||||
SUBPARTITION s0b
|
||||
DATA DIRECTORY = '$MYSQLTEST_VARDIR/master-data/test'
|
||||
));
|
||||
|
||||
--replace_result $MYSQLTEST_VARDIR TEST_DIR
|
||||
--error 1210
|
||||
eval CREATE TABLE ts (id INT, purchased DATE)
|
||||
PARTITION BY RANGE(YEAR(purchased))
|
||||
SUBPARTITION BY HASH(TO_DAYS(purchased)) (
|
||||
PARTITION p0 VALUES LESS THAN (1990) (
|
||||
SUBPARTITION s0a
|
||||
INDEX DIRECTORY = '$MYSQLTEST_VARDIR/master-data/test',
|
||||
SUBPARTITION s0b
|
||||
INDEX DIRECTORY = '$MYSQLTEST_VARDIR/master-data/test'
|
||||
));
|
||||
|
||||
# End Windows specific test failures.
|
||||
|
||||
|
|
|
@ -26,6 +26,10 @@ DROP DATABASE IF EXISTS mysqltest2;
|
|||
# files, but not the other way around (any db-user can use any
|
||||
# directory or file that the mysqld-process can use, via DATA/INDEX DIR)
|
||||
# this is the security flaw that was used in bug#32091 and bug#32111
|
||||
|
||||
#--exec mkdir $MYSQLTEST_VARDIR/tmp/test || true
|
||||
#--exec mkdir $MYSQLTEST_VARDIR/tmp/mysqltest2 || true
|
||||
|
||||
-- echo # Creating two non colliding tables mysqltest2.t1 and test.t1
|
||||
-- echo # test.t1 have partitions in mysqltest2-directory!
|
||||
-- echo # user root:
|
||||
|
@ -41,11 +45,11 @@ connect(con1,localhost,mysqltest_1,,);
|
|||
eval CREATE TABLE t1 (a INT)
|
||||
PARTITION BY LIST (a) (
|
||||
PARTITION p0 VALUES IN (0)
|
||||
DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/mysqltest2'
|
||||
INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/mysqltest2',
|
||||
DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
|
||||
INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp',
|
||||
PARTITION p1 VALUES IN (1)
|
||||
DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/test'
|
||||
INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/test',
|
||||
DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
|
||||
INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp',
|
||||
PARTITION p2 VALUES IN (2)
|
||||
);
|
||||
-- echo # without the patch for bug#32091 this would create
|
||||
|
@ -76,17 +80,18 @@ connection default;
|
|||
# So it is using/blocking 2 files in (in 2 different directories
|
||||
-- echo # test that symlinks can not overwrite files when CREATE TABLE
|
||||
-- echo # user root:
|
||||
|
||||
CREATE DATABASE mysqltest2;
|
||||
USE mysqltest2;
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
eval CREATE TABLE t1 (a INT)
|
||||
PARTITION BY LIST (a) (
|
||||
PARTITION p0 VALUES IN (0)
|
||||
DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/mysqltest2'
|
||||
INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/mysqltest2',
|
||||
DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
|
||||
INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp',
|
||||
PARTITION p1 VALUES IN (1)
|
||||
DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/test'
|
||||
INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/test'
|
||||
DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
|
||||
INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp'
|
||||
);
|
||||
connection con1;
|
||||
-- echo # user mysqltest_1:
|
||||
|
@ -96,22 +101,22 @@ connection con1;
|
|||
eval CREATE TABLE t1 (a INT)
|
||||
PARTITION BY LIST (a) (
|
||||
PARTITION p0 VALUES IN (0)
|
||||
DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/mysqltest2'
|
||||
INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/mysqltest2',
|
||||
DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
|
||||
INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp',
|
||||
PARTITION p1 VALUES IN (1)
|
||||
DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/test'
|
||||
INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/test'
|
||||
DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
|
||||
INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp'
|
||||
);
|
||||
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
-- error 1,1
|
||||
eval CREATE TABLE t1 (a INT)
|
||||
PARTITION BY LIST (a) (
|
||||
PARTITION p0 VALUES IN (0)
|
||||
DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/test'
|
||||
INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/test',
|
||||
DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
|
||||
INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp',
|
||||
PARTITION p1 VALUES IN (1)
|
||||
DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/mysqltest2'
|
||||
INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/mysqltest2'
|
||||
DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
|
||||
INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp'
|
||||
);
|
||||
connection default;
|
||||
-- echo # user root (cleanup):
|
||||
|
@ -167,3 +172,5 @@ partition by key (a)
|
|||
(partition p0,
|
||||
partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
|
||||
|
||||
#--exec rmdir $MYSQLTEST_VARDIR/tmp/test || true
|
||||
#--exec rmdir $MYSQLTEST_VARDIR/tmp/mysqltest2 || true
|
||||
|
|
|
@ -39,3 +39,38 @@ SET GLOBAL example_enum_var= e2;
|
|||
SET GLOBAL example_enum_var= impossible;
|
||||
|
||||
UNINSTALL PLUGIN example;
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Bug #32757 hang with sql_mode set when setting some global variables
|
||||
#
|
||||
INSTALL PLUGIN example SONAME 'ha_example.so';
|
||||
|
||||
select @@session.sql_mode into @old_sql_mode;
|
||||
|
||||
# first, try normal sql_mode (no error, send OK)
|
||||
set session sql_mode='';
|
||||
set global example_ulong_var=500;
|
||||
select @@global.example_ulong_var;
|
||||
# overflow -- correct value, but throw warning
|
||||
set global example_ulong_var=1111;
|
||||
select @@global.example_ulong_var;
|
||||
|
||||
# now, try STRICT (error occurrs, no message is sent, so send default)
|
||||
set session sql_mode='STRICT_ALL_TABLES';
|
||||
set global example_ulong_var=500;
|
||||
select @@global.example_ulong_var;
|
||||
# overflow -- throw warning, do NOT change value
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
set global example_ulong_var=1111;
|
||||
select @@global.example_ulong_var;
|
||||
|
||||
set session sql_mode=@old_sql_mode;
|
||||
|
||||
# finally, show that conditions that already raised an error are not
|
||||
# adversely affected (error was already sent, do nothing)
|
||||
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
|
||||
set session old=bla;
|
||||
|
||||
UNINSTALL PLUGIN example;
|
||||
|
|
|
@ -955,6 +955,23 @@ explain select * from t1 where dateval >= '2007-01-01 00:00:00' and dateval <= '
|
|||
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #33833: different or-ed predicates were erroneously merged into one that
|
||||
# resulted in ref access instead of range access and a wrong result set
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
a varchar(32), index (a)
|
||||
) DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
|
||||
|
||||
INSERT INTO t1 VALUES
|
||||
('B'), ('A'), ('A'), ('C'), ('B'), ('A'), ('A');
|
||||
|
||||
SELECT a FROM t1 WHERE a='b' OR a='B';
|
||||
EXPLAIN SELECT a FROM t1 WHERE a='b' OR a='B';
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 5.0 tests
|
||||
|
||||
# BUG#22393 fix: Adjust 'ref' estimate if we have 'range' estimate for
|
||||
|
|
|
@ -224,3 +224,16 @@ SET @x:= (SELECT h FROM t1 WHERE (a,b,c,d,e,f,g)=(1,2,3,4,5,6,7));
|
|||
SELECT @x;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #34620: item_row.cc:50: Item_row::illegal_method_call(const char*):
|
||||
# Assertion `0' failed
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a INT, b INT);
|
||||
INSERT INTO t1 VALUES (1,1);
|
||||
|
||||
SELECT ROW(a, 1) IN (SELECT SUM(b), 1) FROM t1 GROUP BY a;
|
||||
SELECT ROW(a, 1) IN (SELECT SUM(b), 3) FROM t1 GROUP BY a;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -3661,6 +3661,35 @@ DROP TABLE t1;
|
|||
|
||||
--echo
|
||||
|
||||
###########################################################################
|
||||
|
||||
#
|
||||
# Bug #33764: Wrong result with IN(), CONCAT() and implicit type conversion
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a VARCHAR(10) NOT NULL PRIMARY KEY);
|
||||
INSERT INTO t1 (a) VALUES ('foo0'), ('bar0'), ('baz0');
|
||||
SELECT * FROM t1 WHERE a IN (CONCAT('foo', 0), 'bar');
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #32942 now() - interval '7200' second is NOT pre-calculated, causing "full table scan"
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a INT, b INT);
|
||||
CREATE TABLE t2 (a INT, c INT, KEY(a));
|
||||
|
||||
INSERT INTO t1 VALUES (1, 1), (2, 2);
|
||||
INSERT INTO t2 VALUES (1, 1), (1, 2), (1, 3), (1, 4), (1, 5),
|
||||
(2, 1), (2, 2), (2, 3), (2, 4), (2, 5),
|
||||
(3, 1), (3, 2), (3, 3), (3, 4), (3, 5),
|
||||
(4, 1), (4, 2), (4, 3), (4, 4), (4, 5);
|
||||
|
||||
FLUSH STATUS;
|
||||
SELECT DISTINCT b FROM t1 LEFT JOIN t2 USING(a) WHERE c <= 3;
|
||||
SHOW STATUS LIKE 'Handler_read%';
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
#
|
||||
|
|
|
@ -7977,6 +7977,25 @@ call proc_33618(20);
|
|||
drop table t_33618;
|
||||
drop procedure proc_33618;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#30787: Stored function ignores user defined alias.
|
||||
--echo #
|
||||
use test;
|
||||
--disable_warnings
|
||||
drop function if exists func30787;
|
||||
--enable_warnings
|
||||
create table t1(f1 int);
|
||||
insert into t1 values(1),(2);
|
||||
delimiter |;
|
||||
create function func30787(p1 int) returns int
|
||||
begin
|
||||
return p1;
|
||||
end |
|
||||
delimiter ;|
|
||||
select (select func30787(f1)) as ttt from t1;
|
||||
drop function func30787;
|
||||
drop table t1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo # ------------------------------------------------------------------
|
||||
|
|
|
@ -279,3 +279,32 @@ select concat('x',b,'x') from t1;
|
|||
drop table t1;
|
||||
|
||||
SET @@SQL_MODE=@OLD_SQL_MODE;
|
||||
|
||||
|
||||
#
|
||||
# Bug #32753: PAD_CHAR_TO_FULL_LENGTH is not documented and interferes
|
||||
# with grant tables
|
||||
#
|
||||
|
||||
create user mysqltest_32753@localhost;
|
||||
|
||||
# try to make the user-table space-padded
|
||||
--connection default
|
||||
set @OLD_SQL_MODE=@@SESSION.SQL_MODE;
|
||||
set session sql_mode='PAD_CHAR_TO_FULL_LENGTH';
|
||||
flush privileges;
|
||||
|
||||
# if user-table is affected by PAD_CHAR_TO_FULL_LENGTH, our connect will fail
|
||||
# --error 1045
|
||||
connect (user_32753,localhost,mysqltest_32753,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
select current_user();
|
||||
|
||||
# clean up
|
||||
--connection default
|
||||
set session sql_mode=@OLD_SQL_MODE;
|
||||
flush privileges;
|
||||
|
||||
--disconnect user_32753
|
||||
|
||||
--connection default
|
||||
drop user mysqltest_32753@localhost;
|
||||
|
|
|
@ -822,7 +822,6 @@ INSERT INTO t1 (col2) VALUES (-1.1E-3);
|
|||
INSERT INTO t1 (col1) VALUES ('+1.8E+309');
|
||||
--error 1264
|
||||
INSERT INTO t1 (col2) VALUES ('-1.2E-3');
|
||||
--error 1264
|
||||
UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0;
|
||||
--error 1365
|
||||
UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;
|
||||
|
|
|
@ -3015,6 +3015,52 @@ INSERT INTO t2 VALUES (103, 203);
|
|||
SELECT ((a1,a2) IN (SELECT * FROM t2 WHERE b2 > 0)) IS NULL FROM t1;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
#
|
||||
# Bug31048: Many nested subqueries may cause server crash.
|
||||
#
|
||||
create table t1(a int,b int,key(a),key(b));
|
||||
insert into t1(a,b) values (1,2),(2,1),(2,3),(3,4),(5,4),(5,5),
|
||||
(6,7),(7,4),(5,3);
|
||||
|
||||
let $nesting= 26;
|
||||
let $should_work_nesting= 5;
|
||||
let $start= select sum(a),a from t1 where a> ( select sum(a) from t1 ;
|
||||
let $end= )group by a ;
|
||||
let $start_app= where a> ( select sum(a) from t1 ;
|
||||
let $end_pre= )group by b limit 1 ;
|
||||
|
||||
--disable_result_log
|
||||
--disable_query_log
|
||||
# At least 4 level nesting should work without errors
|
||||
while ($should_work_nesting)
|
||||
{
|
||||
--echo $should_work_nesting
|
||||
eval $start $end;
|
||||
eval explain $start $end;
|
||||
let $start= $start
|
||||
$start_app;
|
||||
let $end= $end_pre
|
||||
$end;
|
||||
dec $should_work_nesting;
|
||||
}
|
||||
# Other may fail with the 'stack overrun error'
|
||||
while ($nesting)
|
||||
{
|
||||
--echo $nesting
|
||||
--error 0,1436
|
||||
eval $start $end;
|
||||
--error 0,1436
|
||||
eval explain $start $end;
|
||||
let $start= $start
|
||||
$start_app;
|
||||
let $end= $end_pre
|
||||
$end;
|
||||
dec $nesting;
|
||||
}
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #28076: inconsistent binary/varbinary comparison
|
||||
#
|
||||
|
|
|
@ -123,29 +123,22 @@ drop table t1;
|
|||
#
|
||||
# BUG#32111 - Security Breach via DATA/INDEX DIRECORY and RENAME TABLE
|
||||
#
|
||||
--replace_result $MYSQLTEST_VARDIR TEST_DIR
|
||||
eval CREATE TABLE t1(a INT)
|
||||
DATA DIRECTORY='$MYSQLTEST_VARDIR/master-data/mysql'
|
||||
INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data/mysql';
|
||||
--write_file $MYSQLTEST_VARDIR/tmp/t1.MYI
|
||||
EOF
|
||||
--replace_result $MYSQLTEST_VARDIR TEST_DIR
|
||||
--error 1
|
||||
RENAME TABLE t1 TO user;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Test specifying DATA DIRECTORY that is the same as what would normally
|
||||
# have been chosen. (Bug #8707)
|
||||
#
|
||||
disable_query_log;
|
||||
eval create table t1 (i int) data directory = "$MYSQLTEST_VARDIR/master-data/test/";
|
||||
enable_query_log;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
disable_query_log;
|
||||
eval create table t1 (i int) index directory = "$MYSQLTEST_VARDIR/master-data/test/";
|
||||
enable_query_log;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
eval CREATE TABLE t1(a INT)
|
||||
DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp'
|
||||
INDEX DIRECTORY='$MYSQLTEST_VARDIR/tmp';
|
||||
--replace_result $MYSQLTEST_VARDIR TEST_DIR
|
||||
eval CREATE TABLE t2(a INT)
|
||||
DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp'
|
||||
INDEX DIRECTORY='$MYSQLTEST_VARDIR/tmp';
|
||||
--replace_result $MYSQLTEST_VARDIR TEST_DIR
|
||||
--error 1
|
||||
RENAME TABLE t2 TO t1;
|
||||
DROP TABLE t2;
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/t1.MYI
|
||||
|
||||
#
|
||||
# Bug#8706 - temporary table with data directory option fails
|
||||
|
@ -189,45 +182,44 @@ drop table t1;
|
|||
#
|
||||
# Bug #29325: create table overwrites .MYD file of other table (datadir)
|
||||
#
|
||||
|
||||
CREATE DATABASE db1;
|
||||
CREATE DATABASE db2;
|
||||
|
||||
USE db2;
|
||||
--disable_query_log
|
||||
eval CREATE TABLE t1 (b INT) ENGINE MYISAM
|
||||
DATA DIRECTORY = '$MYSQLTEST_VARDIR/master-data/db1/';
|
||||
--enable_query_log
|
||||
|
||||
INSERT INTO db2.t1 VALUES (1);
|
||||
SELECT * FROM db2.t1;
|
||||
RESET QUERY CACHE;
|
||||
|
||||
USE db1;
|
||||
|
||||
#no warning from create table
|
||||
SET SESSION keep_files_on_create = TRUE;
|
||||
--write_file $MYSQLTEST_VARDIR/master-data/test/t1.MYD
|
||||
EOF
|
||||
--disable_abort_on_error
|
||||
--error 1,1
|
||||
--error 1,1,ER_TABLE_EXISTS_ERROR
|
||||
CREATE TABLE t1 (a INT) ENGINE MYISAM;
|
||||
--error 0,1
|
||||
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYD;
|
||||
--enable_abort_on_error
|
||||
|
||||
CREATE TABLE t3 (a INT) Engine=MyISAM;
|
||||
INSERT INTO t3 VALUES (1),(2),(3);
|
||||
TRUNCATE TABLE t3;
|
||||
SELECT * from t3;
|
||||
|
||||
SET SESSION keep_files_on_create = DEFAULT;
|
||||
|
||||
DROP TABLE db2.t1, db1.t3;
|
||||
DROP DATABASE db1;
|
||||
DROP DATABASE db2;
|
||||
USE test;
|
||||
|
||||
SET SESSION keep_files_on_create = FALSE;
|
||||
CREATE TABLE t1 (a INT) ENGINE MYISAM;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
#
|
||||
# Bug#32167: another privilege bypass with DATA/INDEX DIRECTORY
|
||||
#
|
||||
--replace_result $MYSQLTEST_VARDIR TEST_DIR
|
||||
--error 1210
|
||||
eval CREATE TABLE t1(a INT)
|
||||
INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data/mysql';
|
||||
--replace_result $MYSQLTEST_VARDIR TEST_DIR
|
||||
--error 1210
|
||||
eval CREATE TABLE t1(a INT)
|
||||
DATA DIRECTORY='$MYSQLTEST_VARDIR/master-data/test';
|
||||
--replace_result $MYSQLTEST_VARDIR TEST_DIR
|
||||
eval CREATE TABLE t1(a INT)
|
||||
DATA DIRECTORY='$MYSQLTEST_VARDIR/master-data/';
|
||||
DROP TABLE t1;
|
||||
--replace_result $MYSQLTEST_VARDIR TEST_DIR
|
||||
eval CREATE TABLE t1(a INT)
|
||||
INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data';
|
||||
DROP TABLE t1;
|
||||
--replace_result $MYSQLTEST_VARDIR TEST_DIR
|
||||
--error 1
|
||||
eval CREATE TABLE t1(a INT)
|
||||
INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data_var';
|
||||
# BUG#25677 - With --skip-symbolic-links option on, DATA DIRECTORY clause is
|
||||
# silently ignored
|
||||
#
|
||||
|
|
|
@ -49,3 +49,16 @@ drop table t2,t1;
|
|||
unlock tables;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug#23588 SHOW COLUMNS on a temporary table causes locking issues
|
||||
#
|
||||
create temporary table t1(f1 int);
|
||||
lock tables t1 write;
|
||||
insert into t1 values (1);
|
||||
show columns from t1;
|
||||
insert into t1 values(2);
|
||||
drop table t1;
|
||||
unlock tables;
|
||||
|
||||
# End of 5.0 tests
|
||||
|
|
|
@ -56,3 +56,23 @@ set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17',
|
|||
'50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','1'));
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#15409: Columns with SET datatype with 64-element sets
|
||||
# may not be updated with integers
|
||||
#
|
||||
|
||||
let $i=64;
|
||||
let $s='$i';
|
||||
dec $i;
|
||||
while ($i) {
|
||||
let $s='$i',$s;
|
||||
dec $i;
|
||||
}
|
||||
--eval CREATE TABLE t1(c set($s))
|
||||
INSERT INTO t1 VALUES(7);
|
||||
INSERT INTO t1 VALUES(9223372036854775808);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--# echo End of 5.0 tests
|
||||
|
|
|
@ -3384,7 +3384,6 @@ SELECT profile.person_id AS person_id
|
|||
INSERT INTO t1 VALUES
|
||||
(6,'Sw','A'), (-1136332546,'ols','e'), (0,' *\n','0'),
|
||||
(-717462680,'ENTS Ta','0'), (-904346964,'ndard SQL\n','0');
|
||||
|
||||
INSERT INTO t2 VALUES
|
||||
(1,3,6),(2,4,7),(3,5,8),(4,6,9),(5,1,6),(6,1,7),(7,1,8),(8,1,9),(9,1,10);
|
||||
|
||||
|
@ -3468,6 +3467,40 @@ set @@sql_mode=@old_mode;
|
|||
drop view v1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #33389: Selecting from a view into a table from within SP or trigger
|
||||
# crashes server
|
||||
#
|
||||
|
||||
create table t1 (a int, key(a));
|
||||
create table t2 (c int);
|
||||
|
||||
create view v1 as select a b from t1;
|
||||
create view v2 as select 1 a from t2, v1 where c in
|
||||
(select 1 from t1 where b = a);
|
||||
|
||||
insert into t1 values (1), (1);
|
||||
insert into t2 values (1), (1);
|
||||
|
||||
prepare stmt from "select * from v2 where a = 1";
|
||||
execute stmt;
|
||||
|
||||
drop view v1, v2;
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# Bug #33049: Assert while running test-as3ap test(mysql-bench suite)
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE VIEW v1 AS SELECT p.a AS a FROM t1 p, t1 q;
|
||||
|
||||
INSERT INTO t1 VALUES (1), (1);
|
||||
SELECT MAX(a), COUNT(DISTINCT a) FROM v1 GROUP BY a;
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo # -----------------------------------------------------------------
|
||||
|
|
|
@ -193,4 +193,37 @@ DROP PROCEDURE sp1;
|
|||
DROP PROCEDURE sp2;
|
||||
DROP PROCEDURE sp3;
|
||||
|
||||
|
||||
#
|
||||
# Bug#30059: End-space truncation warnings are inconsistent or incorrect
|
||||
#
|
||||
|
||||
create table t1 (c_char char(255), c_varchar varchar(255), c_tinytext tinytext);
|
||||
create table t2 (c_tinyblob tinyblob); # not affected by bug, for regression testing
|
||||
set @c = repeat(' ', 256);
|
||||
set @q = repeat('q', 256);
|
||||
|
||||
set sql_mode = '';
|
||||
|
||||
insert into t1 values(@c, @c, @c);
|
||||
insert into t2 values(@c);
|
||||
insert into t1 values(@q, @q, @q);
|
||||
insert into t2 values(@q);
|
||||
|
||||
set sql_mode = 'traditional';
|
||||
|
||||
insert into t1 values(@c, @c, @c);
|
||||
--error 1406
|
||||
insert into t2 values(@c);
|
||||
--error 1406
|
||||
insert into t1 values(@q, NULL, NULL);
|
||||
--error 1406
|
||||
insert into t1 values(NULL, @q, NULL);
|
||||
--error 1406
|
||||
insert into t1 values(NULL, NULL, @q);
|
||||
--error 1406
|
||||
insert into t2 values(@q);
|
||||
|
||||
drop table t1, t2;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
File my_create(const char *FileName, int CreateFlags, int access_flags,
|
||||
myf MyFlags)
|
||||
{
|
||||
int fd;
|
||||
int fd, rc;
|
||||
DBUG_ENTER("my_create");
|
||||
DBUG_PRINT("my",("Name: '%s' CreateFlags: %d AccessFlags: %d MyFlags: %d",
|
||||
FileName, CreateFlags, access_flags, MyFlags));
|
||||
|
@ -52,6 +52,20 @@ File my_create(const char *FileName, int CreateFlags, int access_flags,
|
|||
fd = open(FileName, access_flags);
|
||||
#endif
|
||||
|
||||
DBUG_RETURN(my_register_filename(fd, FileName, FILE_BY_CREATE,
|
||||
EE_CANTCREATEFILE, MyFlags));
|
||||
rc= my_register_filename(fd, FileName, FILE_BY_CREATE,
|
||||
EE_CANTCREATEFILE, MyFlags);
|
||||
/*
|
||||
my_register_filename() may fail on some platforms even if the call to
|
||||
*open() above succeeds. In this case, don't leave the stale file because
|
||||
callers assume the file to not exist if my_create() fails, so they don't
|
||||
do any cleanups.
|
||||
*/
|
||||
if (unlikely(fd >= 0 && rc < 0))
|
||||
{
|
||||
int tmp= my_errno;
|
||||
my_delete(FileName, MyFlags);
|
||||
my_errno= tmp;
|
||||
}
|
||||
|
||||
DBUG_RETURN(rc);
|
||||
} /* my_create */
|
||||
|
|
|
@ -123,11 +123,13 @@ include="-I$pkgincludedir"
|
|||
# Remove some options that a client doesn't have to care about
|
||||
# FIXME until we have a --cxxflags, we need to remove -Xa
|
||||
# and -xstrconst to make --cflags usable for Sun Forte C++
|
||||
# FIXME until we have a --cxxflags, we need to remove -AC99
|
||||
# to make --cflags usable for HP C++ (aCC)
|
||||
for remove in DDBUG_OFF DSAFEMALLOC USAFEMALLOC DSAFE_MUTEX \
|
||||
DPEDANTIC_SAFEMALLOC DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS \
|
||||
DEXTRA_DEBUG DHAVE_purify O 'O[0-9]' 'xO[0-9]' 'W[-A-Za-z]*' \
|
||||
'mtune=[-A-Za-z0-9]*' 'mcpu=[-A-Za-z0-9]*' 'march=[-A-Za-z0-9]*' \
|
||||
Xa xstrconst "xc99=none" \
|
||||
Xa xstrconst "xc99=none" AC99 \
|
||||
unroll2 ip mp restrict
|
||||
do
|
||||
# The first option we might strip will always have a space before it because
|
||||
|
|
|
@ -112,6 +112,7 @@ uint mysql_port=0;
|
|||
char *mysql_unix_port= 0;
|
||||
const char *unknown_sqlstate= "HY000";
|
||||
const char *not_error_sqlstate= "00000";
|
||||
const char *cant_connect_sqlstate= "08001";
|
||||
#ifdef HAVE_SMEM
|
||||
char *shared_memory_base_name= 0;
|
||||
const char *def_shared_memory_base_name= default_shared_memory_base_name;
|
||||
|
@ -126,6 +127,9 @@ static int wait_for_data(my_socket fd, uint timeout);
|
|||
|
||||
CHARSET_INFO *default_client_charset_info = &my_charset_latin1;
|
||||
|
||||
/* Server error code and message */
|
||||
unsigned int mysql_server_last_errno;
|
||||
char mysql_server_last_error[MYSQL_ERRMSG_SIZE];
|
||||
|
||||
/****************************************************************************
|
||||
A modified version of connect(). my_connect() allows you to specify
|
||||
|
@ -288,11 +292,18 @@ void set_mysql_error(MYSQL *mysql, int errcode, const char *sqlstate)
|
|||
DBUG_PRINT("enter", ("error :%d '%s'", errcode, ER(errcode)));
|
||||
DBUG_ASSERT(mysql != 0);
|
||||
|
||||
net= &mysql->net;
|
||||
net->last_errno= errcode;
|
||||
strmov(net->last_error, ER(errcode));
|
||||
strmov(net->sqlstate, sqlstate);
|
||||
|
||||
if (mysql)
|
||||
{
|
||||
net= &mysql->net;
|
||||
net->last_errno= errcode;
|
||||
strmov(net->last_error, ER(errcode));
|
||||
strmov(net->sqlstate, sqlstate);
|
||||
}
|
||||
else
|
||||
{
|
||||
mysql_server_last_errno= errcode;
|
||||
strmov(mysql_server_last_error, ER(errcode));
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
@ -1489,7 +1500,10 @@ mysql_init(MYSQL *mysql)
|
|||
if (!mysql)
|
||||
{
|
||||
if (!(mysql=(MYSQL*) my_malloc(sizeof(*mysql),MYF(MY_WME | MY_ZEROFILL))))
|
||||
{
|
||||
set_mysql_error(NULL, CR_OUT_OF_MEMORY, unknown_sqlstate);
|
||||
return 0;
|
||||
}
|
||||
mysql->free_me=1;
|
||||
}
|
||||
else
|
||||
|
@ -3087,13 +3101,13 @@ unsigned int STDCALL mysql_num_fields(MYSQL_RES *res)
|
|||
|
||||
uint STDCALL mysql_errno(MYSQL *mysql)
|
||||
{
|
||||
return mysql->net.last_errno;
|
||||
return mysql ? mysql->net.last_errno : mysql_server_last_errno;
|
||||
}
|
||||
|
||||
|
||||
const char * STDCALL mysql_error(MYSQL *mysql)
|
||||
{
|
||||
return mysql->net.last_error;
|
||||
return mysql ? mysql->net.last_error : mysql_server_last_error;
|
||||
}
|
||||
|
||||
|
||||
|
|
84
sql/field.cc
84
sql/field.cc
|
@ -2261,13 +2261,11 @@ int Field_decimal::store(double nr)
|
|||
return 1;
|
||||
}
|
||||
|
||||
#ifdef HAVE_FINITE
|
||||
if (!finite(nr)) // Handle infinity as special case
|
||||
if (!isfinite(nr)) // Handle infinity as special case
|
||||
{
|
||||
overflow(nr < 0.0);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
reg4 uint i;
|
||||
size_t length;
|
||||
|
@ -6323,26 +6321,41 @@ check_string_copy_error(Field_str *field,
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Send a truncation warning or a truncation error
|
||||
after storing a too long character string info a field.
|
||||
Check if we lost any important data and send a truncation error/warning
|
||||
|
||||
SYNOPSIS
|
||||
report_data_too_long()
|
||||
field - Field
|
||||
Field_longstr::report_if_important_data()
|
||||
ptr - Truncated rest of string
|
||||
end - End of truncated string
|
||||
|
||||
RETURN
|
||||
N/A
|
||||
RETURN VALUES
|
||||
0 - None was truncated (or we don't count cut fields)
|
||||
2 - Some bytes was truncated
|
||||
|
||||
NOTE
|
||||
Check if we lost any important data (anything in a binary string,
|
||||
or any non-space in others). If only trailing spaces was lost,
|
||||
send a truncation note, otherwise send a truncation error.
|
||||
*/
|
||||
|
||||
inline void
|
||||
report_data_too_long(Field_str *field)
|
||||
int
|
||||
Field_longstr::report_if_important_data(const char *ptr, const char *end)
|
||||
{
|
||||
if (field->table->in_use->abort_on_warning)
|
||||
field->set_warning(MYSQL_ERROR::WARN_LEVEL_ERROR, ER_DATA_TOO_LONG, 1);
|
||||
else
|
||||
field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
|
||||
if ((ptr < end) && table->in_use->count_cuted_fields)
|
||||
{
|
||||
if (test_if_important_data(field_charset, ptr, end))
|
||||
{
|
||||
if (table->in_use->abort_on_warning)
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_ERROR, ER_DATA_TOO_LONG, 1);
|
||||
else
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
|
||||
}
|
||||
else /* If we lost only spaces then produce a NOTE, not a WARNING */
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_NOTE, WARN_DATA_TRUNCATED, 1);
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -6377,19 +6390,7 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs)
|
|||
cannot_convert_error_pos, from + length, cs))
|
||||
return 2;
|
||||
|
||||
/*
|
||||
Check if we lost any important data (anything in a binary string,
|
||||
or any non-space in others).
|
||||
*/
|
||||
if ((from_end_pos < from + length) && table->in_use->count_cuted_fields)
|
||||
{
|
||||
if (test_if_important_data(field_charset, from_end_pos, from + length))
|
||||
{
|
||||
report_data_too_long(this);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return report_if_important_data(from_end_pos, from + length);
|
||||
}
|
||||
|
||||
|
||||
|
@ -6964,16 +6965,7 @@ int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs)
|
|||
cannot_convert_error_pos, from + length, cs))
|
||||
return 2;
|
||||
|
||||
// Check if we lost something other than just trailing spaces
|
||||
if ((from_end_pos < from + length) && table->in_use->count_cuted_fields)
|
||||
{
|
||||
if (test_if_important_data(field_charset, from_end_pos, from + length))
|
||||
report_data_too_long(this);
|
||||
else /* If we lost only spaces then produce a NOTE, not a WARNING */
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_NOTE, WARN_DATA_TRUNCATED, 1);
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
return report_if_important_data(from_end_pos, from + length);
|
||||
}
|
||||
|
||||
|
||||
|
@ -7676,13 +7668,7 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
|
|||
cannot_convert_error_pos, from + length, cs))
|
||||
return 2;
|
||||
|
||||
if (from_end_pos < from + length)
|
||||
{
|
||||
report_data_too_long(this);
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return report_if_important_data(from_end_pos, from + length);
|
||||
|
||||
oom_error:
|
||||
/* Fatal OOM error */
|
||||
|
@ -8630,10 +8616,10 @@ int Field_set::store(longlong nr, bool unsigned_val)
|
|||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
int error= 0;
|
||||
if ((ulonglong) nr > (ulonglong) (((longlong) 1 << typelib->count) -
|
||||
(longlong) 1))
|
||||
ulonglong max_nr= set_bits(ulonglong, typelib->count);
|
||||
if ((ulonglong) nr > max_nr)
|
||||
{
|
||||
nr&= (longlong) (((longlong) 1 << typelib->count) - (longlong) 1);
|
||||
nr&= max_nr;
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
|
||||
error=1;
|
||||
}
|
||||
|
|
|
@ -593,6 +593,8 @@ public:
|
|||
|
||||
class Field_longstr :public Field_str
|
||||
{
|
||||
protected:
|
||||
int report_if_important_data(const char *ptr, const char *end);
|
||||
public:
|
||||
Field_longstr(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
|
||||
uchar null_bit_arg, utype unireg_check_arg,
|
||||
|
|
|
@ -230,8 +230,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
|
|||
sort_keys= table_sort.sort_keys;
|
||||
if (memavl < min_sort_memory)
|
||||
{
|
||||
my_error(ER_OUTOFMEMORY,MYF(ME_ERROR+ME_WAITTANG),
|
||||
thd->variables.sortbuff_size);
|
||||
my_error(ER_OUT_OF_SORTMEMORY,MYF(ME_ERROR+ME_WAITTANG));
|
||||
goto err;
|
||||
}
|
||||
if (open_cached_file(&buffpek_pointers,mysql_tmpdir,TEMP_PREFIX,
|
||||
|
|
|
@ -117,7 +117,8 @@ void ndb_serialize_cond(const Item *item, void *arg)
|
|||
if (item->type() == Item::FUNC_ITEM)
|
||||
{
|
||||
Item_func *func_item= (Item_func *) item;
|
||||
if (func_item->functype() == Item_func::UNKNOWN_FUNC &&
|
||||
if ((func_item->functype() == Item_func::UNKNOWN_FUNC ||
|
||||
func_item->functype() == Item_func::NEG_FUNC) &&
|
||||
func_item->const_item())
|
||||
{
|
||||
// Skip any arguments since we will evaluate function instead
|
||||
|
@ -369,8 +370,9 @@ void ndb_serialize_cond(const Item *item, void *arg)
|
|||
{
|
||||
Item_func *func_item= (Item_func *) item;
|
||||
// Check that we expect a function or functional expression here
|
||||
if (context->expecting(Item::FUNC_ITEM) ||
|
||||
func_item->functype() == Item_func::UNKNOWN_FUNC)
|
||||
if (context->expecting(Item::FUNC_ITEM) ||
|
||||
func_item->functype() == Item_func::UNKNOWN_FUNC ||
|
||||
func_item->functype() == Item_func::NEG_FUNC)
|
||||
context->expect_nothing();
|
||||
else
|
||||
{
|
||||
|
@ -584,6 +586,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
|
|||
context->expect(Item::FUNC_ITEM);
|
||||
break;
|
||||
}
|
||||
case Item_func::NEG_FUNC:
|
||||
case Item_func::UNKNOWN_FUNC:
|
||||
{
|
||||
DBUG_PRINT("info", ("UNKNOWN_FUNC %s",
|
||||
|
|
|
@ -233,6 +233,7 @@ public:
|
|||
case (Item_func::ISNOTNULL_FUNC): { return NDB_ISNOTNULL_FUNC; }
|
||||
case (Item_func::LIKE_FUNC): { return NDB_LIKE_FUNC; }
|
||||
case (Item_func::NOT_FUNC): { return NDB_NOT_FUNC; }
|
||||
case (Item_func::NEG_FUNC): { return NDB_UNKNOWN_FUNC; }
|
||||
case (Item_func::UNKNOWN_FUNC): { return NDB_UNKNOWN_FUNC; }
|
||||
case (Item_func::COND_AND_FUNC): { return NDB_COND_AND_FUNC; }
|
||||
case (Item_func::COND_OR_FUNC): { return NDB_COND_OR_FUNC; }
|
||||
|
|
|
@ -1924,6 +1924,13 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path,
|
|||
handler *handler::clone(MEM_ROOT *mem_root)
|
||||
{
|
||||
handler *new_handler= get_new_handler(table->s, mem_root, table->s->db_type());
|
||||
/*
|
||||
Allocate handler->ref here because otherwise ha_open will allocate it
|
||||
on this->table->mem_root and we will not be able to reclaim that memory
|
||||
when the clone handler object is destroyed.
|
||||
*/
|
||||
if (!(new_handler->ref= (uchar*) alloc_root(mem_root, ALIGN_SIZE(ref_length)*2)))
|
||||
return NULL;
|
||||
if (new_handler && !new_handler->ha_open(table,
|
||||
table->s->normalized_path.str,
|
||||
table->db_stat,
|
||||
|
@ -1992,7 +1999,9 @@ int handler::ha_open(TABLE *table_arg, const char *name, int mode,
|
|||
table->db_stat|=HA_READ_ONLY;
|
||||
(void) extra(HA_EXTRA_NO_READCHECK); // Not needed in SQL
|
||||
|
||||
if (!(ref= (uchar*) alloc_root(&table->mem_root, ALIGN_SIZE(ref_length)*2)))
|
||||
/* ref is already allocated for us if we're called from handler::clone() */
|
||||
if (!ref && !(ref= (uchar*) alloc_root(&table->mem_root,
|
||||
ALIGN_SIZE(ref_length)*2)))
|
||||
{
|
||||
close();
|
||||
error=HA_ERR_OUT_OF_MEM;
|
||||
|
|
126
sql/item.cc
126
sql/item.cc
|
@ -18,6 +18,7 @@
|
|||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
#include "mysql_priv.h"
|
||||
#include <mysql.h>
|
||||
#include <m_ctype.h>
|
||||
#include "my_dir.h"
|
||||
#include "sp_rcontext.h"
|
||||
|
@ -1237,6 +1238,22 @@ bool Item_name_const::is_null()
|
|||
return value_item->is_null();
|
||||
}
|
||||
|
||||
|
||||
Item_name_const::Item_name_const(Item *name_arg, Item *val):
|
||||
value_item(val), name_item(name_arg)
|
||||
{
|
||||
if (!(valid_args= name_item->basic_const_item() &&
|
||||
(value_item->basic_const_item() ||
|
||||
((value_item->type() == FUNC_ITEM) &&
|
||||
(((Item_func *) value_item)->functype() ==
|
||||
Item_func::NEG_FUNC) &&
|
||||
(((Item_func *) value_item)->key_item()->type() !=
|
||||
FUNC_ITEM)))))
|
||||
my_error(ER_WRONG_ARGUMENTS, MYF(0), "NAME_CONST");
|
||||
Item::maybe_null= TRUE;
|
||||
}
|
||||
|
||||
|
||||
Item::Type Item_name_const::type() const
|
||||
{
|
||||
/*
|
||||
|
@ -1248,8 +1265,17 @@ Item::Type Item_name_const::type() const
|
|||
if (item->type() == FIELD_ITEM)
|
||||
((Item_field *) item)->...
|
||||
we return NULL_ITEM in the case to avoid wrong casting.
|
||||
|
||||
valid_args guarantees value_item->basic_const_item(); if type is
|
||||
FUNC_ITEM, then we have a fudged item_func_neg() on our hands
|
||||
and return the underlying type.
|
||||
*/
|
||||
return valid_args ? value_item->type() : NULL_ITEM;
|
||||
return valid_args ?
|
||||
(((value_item->type() == FUNC_ITEM) &&
|
||||
(((Item_func *) value_item)->functype() == Item_func::NEG_FUNC)) ?
|
||||
((Item_func *) value_item)->key_item()->type() :
|
||||
value_item->type()) :
|
||||
NULL_ITEM;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3984,6 +4010,18 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
|
|||
else if (!from_field)
|
||||
goto error;
|
||||
|
||||
if (!outer_fixed && cached_table && cached_table->select_lex &&
|
||||
context->select_lex &&
|
||||
cached_table->select_lex != context->select_lex)
|
||||
{
|
||||
int ret;
|
||||
if ((ret= fix_outer_field(thd, &from_field, reference)) < 0)
|
||||
goto error;
|
||||
if (!ret)
|
||||
return FALSE;
|
||||
outer_fixed= 1;
|
||||
}
|
||||
|
||||
/*
|
||||
if it is not expression from merged VIEW we will set this field.
|
||||
|
||||
|
@ -3999,18 +4037,6 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
|
|||
if (from_field == view_ref_found)
|
||||
return FALSE;
|
||||
|
||||
if (!outer_fixed && cached_table && cached_table->select_lex &&
|
||||
context->select_lex &&
|
||||
cached_table->select_lex != context->select_lex)
|
||||
{
|
||||
int ret;
|
||||
if ((ret= fix_outer_field(thd, &from_field, reference)) < 0)
|
||||
goto error;
|
||||
if (!ret)
|
||||
return FALSE;
|
||||
outer_fixed= 1;
|
||||
}
|
||||
|
||||
set_field(from_field);
|
||||
if (thd->lex->in_sum_func &&
|
||||
thd->lex->in_sum_func->nest_level ==
|
||||
|
@ -4181,6 +4207,30 @@ bool Item_field::subst_argument_checker(uchar **arg)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Convert a numeric value to a zero-filled string
|
||||
|
||||
@param[in,out] item the item to operate on
|
||||
@param field The field that this value is equated to
|
||||
|
||||
This function converts a numeric value to a string. In this conversion
|
||||
the zero-fill flag of the field is taken into account.
|
||||
This is required so the resulting string value can be used instead of
|
||||
the field reference when propagating equalities.
|
||||
*/
|
||||
|
||||
static void convert_zerofill_number_to_string(Item **item, Field_num *field)
|
||||
{
|
||||
char buff[MAX_FIELD_WIDTH],*pos;
|
||||
String tmp(buff,sizeof(buff), field->charset()), *res;
|
||||
|
||||
res= (*item)->val_str(&tmp);
|
||||
field->prepend_zeros(res);
|
||||
pos= (char *) sql_strmake (res->ptr(), res->length());
|
||||
*item= new Item_string(pos, res->length(), field->charset());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Set a pointer to the multiple equality the field reference belongs to
|
||||
(if any).
|
||||
|
@ -4227,6 +4277,13 @@ Item *Item_field::equal_fields_propagator(uchar *arg)
|
|||
if (!item ||
|
||||
(cmp_context != (Item_result)-1 && item->cmp_context != cmp_context))
|
||||
item= this;
|
||||
else if (field && (field->flags & ZEROFILL_FLAG) && IS_NUM(field->type()))
|
||||
{
|
||||
if (item && cmp_context != INT_RESULT)
|
||||
convert_zerofill_number_to_string(&item, (Field_num *)field);
|
||||
else
|
||||
item= this;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
|
@ -4403,6 +4460,49 @@ String *Item::check_well_formed_result(String *str, bool send_error)
|
|||
return str;
|
||||
}
|
||||
|
||||
/*
|
||||
Compare two items using a given collation
|
||||
|
||||
SYNOPSIS
|
||||
eq_by_collation()
|
||||
item item to compare with
|
||||
binary_cmp TRUE <-> compare as binaries
|
||||
cs collation to use when comparing strings
|
||||
|
||||
DESCRIPTION
|
||||
This method works exactly as Item::eq if the collation cs coincides with
|
||||
the collation of the compared objects. Otherwise, first the collations that
|
||||
differ from cs are replaced for cs and then the items are compared by
|
||||
Item::eq. After the comparison the original collations of items are
|
||||
restored.
|
||||
|
||||
RETURN
|
||||
1 compared items has been detected as equal
|
||||
0 otherwise
|
||||
*/
|
||||
|
||||
bool Item::eq_by_collation(Item *item, bool binary_cmp, CHARSET_INFO *cs)
|
||||
{
|
||||
CHARSET_INFO *save_cs= 0;
|
||||
CHARSET_INFO *save_item_cs= 0;
|
||||
if (collation.collation != cs)
|
||||
{
|
||||
save_cs= collation.collation;
|
||||
collation.collation= cs;
|
||||
}
|
||||
if (item->collation.collation != cs)
|
||||
{
|
||||
save_item_cs= item->collation.collation;
|
||||
item->collation.collation= cs;
|
||||
}
|
||||
bool res= eq(item, binary_cmp);
|
||||
if (save_cs)
|
||||
collation.collation= save_cs;
|
||||
if (save_item_cs)
|
||||
item->collation.collation= save_item_cs;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Create a field to hold a string value from an item.
|
||||
|
|
39
sql/item.h
39
sql/item.h
|
@ -1007,6 +1007,7 @@ public:
|
|||
virtual Field::geometry_type get_geometry_type() const
|
||||
{ return Field::GEOM_GEOMETRY; };
|
||||
String *check_well_formed_result(String *str, bool send_error= 0);
|
||||
bool eq_by_collation(Item *item, bool binary_cmp, CHARSET_INFO *cs);
|
||||
};
|
||||
|
||||
|
||||
|
@ -1264,14 +1265,7 @@ class Item_name_const : public Item
|
|||
Item *name_item;
|
||||
bool valid_args;
|
||||
public:
|
||||
Item_name_const(Item *name_arg, Item *val):
|
||||
value_item(val), name_item(name_arg)
|
||||
{
|
||||
if (!(valid_args= name_item->basic_const_item() &
|
||||
value_item->basic_const_item()))
|
||||
my_error(ER_WRONG_ARGUMENTS, MYF(0), "NAME_CONST");
|
||||
Item::maybe_null= TRUE;
|
||||
}
|
||||
Item_name_const(Item *name_arg, Item *val);
|
||||
|
||||
bool fix_fields(THD *, Item **);
|
||||
|
||||
|
@ -2219,6 +2213,35 @@ public:
|
|||
Item_field *filed_for_view_update()
|
||||
{ return (*ref)->filed_for_view_update(); }
|
||||
virtual Ref_Type ref_type() { return REF; }
|
||||
|
||||
// Row emulation: forwarding of ROW-related calls to ref
|
||||
uint cols()
|
||||
{
|
||||
return ref && result_type() == ROW_RESULT ? (*ref)->cols() : 1;
|
||||
}
|
||||
Item* element_index(uint i)
|
||||
{
|
||||
return ref && result_type() == ROW_RESULT ? (*ref)->element_index(i) : this;
|
||||
}
|
||||
Item** addr(uint i)
|
||||
{
|
||||
return ref && result_type() == ROW_RESULT ? (*ref)->addr(i) : 0;
|
||||
}
|
||||
bool check_cols(uint c)
|
||||
{
|
||||
return ref && result_type() == ROW_RESULT ? (*ref)->check_cols(c)
|
||||
: Item::check_cols(c);
|
||||
}
|
||||
bool null_inside()
|
||||
{
|
||||
return ref && result_type() == ROW_RESULT ? (*ref)->null_inside() : 0;
|
||||
}
|
||||
void bring_value()
|
||||
{
|
||||
if (ref && result_type() == ROW_RESULT)
|
||||
(*ref)->bring_value();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -3059,7 +3059,10 @@ void in_string::set(uint pos,Item *item)
|
|||
{
|
||||
if (res->uses_buffer_owned_by(str))
|
||||
res->copy();
|
||||
*str= *res;
|
||||
if (item->type() == Item::FUNC_ITEM)
|
||||
str->copy(*res);
|
||||
else
|
||||
*str= *res;
|
||||
}
|
||||
if (!str->charset())
|
||||
{
|
||||
|
|
|
@ -1093,7 +1093,7 @@ double Item_func_plus::real_op()
|
|||
double value= args[0]->val_real() + args[1]->val_real();
|
||||
if ((null_value=args[0]->null_value || args[1]->null_value))
|
||||
return 0.0;
|
||||
return value;
|
||||
return fix_result(value);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1171,7 +1171,7 @@ double Item_func_minus::real_op()
|
|||
double value= args[0]->val_real() - args[1]->val_real();
|
||||
if ((null_value=args[0]->null_value || args[1]->null_value))
|
||||
return 0.0;
|
||||
return value;
|
||||
return fix_result(value);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1211,7 +1211,7 @@ double Item_func_mul::real_op()
|
|||
double value= args[0]->val_real() * args[1]->val_real();
|
||||
if ((null_value=args[0]->null_value || args[1]->null_value))
|
||||
return 0.0;
|
||||
return value;
|
||||
return fix_result(value);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1269,7 +1269,7 @@ double Item_func_div::real_op()
|
|||
signal_divide_by_null();
|
||||
return 0.0;
|
||||
}
|
||||
return value/val2;
|
||||
return fix_result(value/val2);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1643,7 +1643,7 @@ double Item_func_exp::val_real()
|
|||
double value= args[0]->val_real();
|
||||
if ((null_value=args[0]->null_value))
|
||||
return 0.0; /* purecov: inspected */
|
||||
return exp(value);
|
||||
return fix_result(exp(value));
|
||||
}
|
||||
|
||||
double Item_func_sqrt::val_real()
|
||||
|
@ -1662,7 +1662,7 @@ double Item_func_pow::val_real()
|
|||
double val2= args[1]->val_real();
|
||||
if ((null_value=(args[0]->null_value || args[1]->null_value)))
|
||||
return 0.0; /* purecov: inspected */
|
||||
return pow(value,val2);
|
||||
return fix_result(pow(value,val2));
|
||||
}
|
||||
|
||||
// Trigonometric functions
|
||||
|
@ -1674,7 +1674,7 @@ double Item_func_acos::val_real()
|
|||
volatile double value= args[0]->val_real();
|
||||
if ((null_value=(args[0]->null_value || (value < -1.0 || value > 1.0))))
|
||||
return 0.0;
|
||||
return fix_result(acos(value));
|
||||
return acos(value);
|
||||
}
|
||||
|
||||
double Item_func_asin::val_real()
|
||||
|
@ -1684,7 +1684,7 @@ double Item_func_asin::val_real()
|
|||
volatile double value= args[0]->val_real();
|
||||
if ((null_value=(args[0]->null_value || (value < -1.0 || value > 1.0))))
|
||||
return 0.0;
|
||||
return fix_result(asin(value));
|
||||
return asin(value);
|
||||
}
|
||||
|
||||
double Item_func_atan::val_real()
|
||||
|
@ -1700,7 +1700,7 @@ double Item_func_atan::val_real()
|
|||
return 0.0;
|
||||
return fix_result(atan2(value,val2));
|
||||
}
|
||||
return fix_result(atan(value));
|
||||
return atan(value);
|
||||
}
|
||||
|
||||
double Item_func_cos::val_real()
|
||||
|
@ -1709,7 +1709,7 @@ double Item_func_cos::val_real()
|
|||
double value= args[0]->val_real();
|
||||
if ((null_value=args[0]->null_value))
|
||||
return 0.0;
|
||||
return fix_result(cos(value));
|
||||
return cos(value);
|
||||
}
|
||||
|
||||
double Item_func_sin::val_real()
|
||||
|
@ -1718,7 +1718,7 @@ double Item_func_sin::val_real()
|
|||
double value= args[0]->val_real();
|
||||
if ((null_value=args[0]->null_value))
|
||||
return 0.0;
|
||||
return fix_result(sin(value));
|
||||
return sin(value);
|
||||
}
|
||||
|
||||
double Item_func_tan::val_real()
|
||||
|
@ -3646,18 +3646,28 @@ longlong Item_func_benchmark::val_int()
|
|||
String tmp(buff,sizeof(buff), &my_charset_bin);
|
||||
my_decimal tmp_decimal;
|
||||
THD *thd=current_thd;
|
||||
ulong loop_count;
|
||||
ulonglong loop_count;
|
||||
|
||||
loop_count= (ulong) args[0]->val_int();
|
||||
loop_count= (ulonglong) args[0]->val_int();
|
||||
|
||||
if (args[0]->null_value)
|
||||
if (args[0]->null_value ||
|
||||
(!args[0]->unsigned_flag && (((longlong) loop_count) < 0)))
|
||||
{
|
||||
if (!args[0]->null_value)
|
||||
{
|
||||
char buff[22];
|
||||
llstr(((longlong) loop_count), buff);
|
||||
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
|
||||
ER_WRONG_VALUE_FOR_TYPE, ER(ER_WRONG_VALUE_FOR_TYPE),
|
||||
"count", buff, "benchmark");
|
||||
}
|
||||
|
||||
null_value= 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
null_value=0;
|
||||
for (ulong loop=0 ; loop < loop_count && !thd->killed; loop++)
|
||||
for (ulonglong loop=0 ; loop < loop_count && !thd->killed; loop++)
|
||||
{
|
||||
switch (args[1]->result_type()) {
|
||||
case REAL_RESULT:
|
||||
|
@ -5504,6 +5514,8 @@ Item_func_sp::make_field(Send_field *tmp_field)
|
|||
DBUG_ENTER("Item_func_sp::make_field");
|
||||
DBUG_ASSERT(sp_result_field);
|
||||
sp_result_field->make_field(tmp_field);
|
||||
if (name)
|
||||
tmp_field->col_name= name;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,8 @@ public:
|
|||
NOT_FUNC, NOT_ALL_FUNC,
|
||||
NOW_FUNC, TRIG_COND_FUNC,
|
||||
SUSERVAR_FUNC, GUSERVAR_FUNC, COLLATE_FUNC,
|
||||
EXTRACT_FUNC, CHAR_TYPECAST_FUNC, FUNC_SP, UDF_FUNC };
|
||||
EXTRACT_FUNC, CHAR_TYPECAST_FUNC, FUNC_SP, UDF_FUNC,
|
||||
NEG_FUNC };
|
||||
enum optimize_type { OPTIMIZE_NONE,OPTIMIZE_KEY,OPTIMIZE_OP, OPTIMIZE_NULL,
|
||||
OPTIMIZE_EQUAL };
|
||||
enum Type type() const { return FUNC_ITEM; }
|
||||
|
@ -192,6 +193,13 @@ public:
|
|||
void * arg, traverse_order order);
|
||||
bool is_expensive_processor(uchar *arg);
|
||||
virtual bool is_expensive() { return 0; }
|
||||
inline double fix_result(double value)
|
||||
{
|
||||
if (isfinite(value))
|
||||
return value;
|
||||
null_value=1;
|
||||
return 0.0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -479,7 +487,7 @@ public:
|
|||
longlong int_op();
|
||||
my_decimal *decimal_op(my_decimal *);
|
||||
const char *func_name() const { return "-"; }
|
||||
virtual bool basic_const_item() const { return args[0]->basic_const_item(); }
|
||||
enum Functype functype() const { return NEG_FUNC; }
|
||||
void fix_length_and_dec();
|
||||
void fix_num_length_and_dec();
|
||||
uint decimal_precision() const { return args[0]->decimal_precision(); }
|
||||
|
@ -511,18 +519,6 @@ class Item_dec_func :public Item_real_func
|
|||
decimals=NOT_FIXED_DEC; max_length=float_length(decimals);
|
||||
maybe_null=1;
|
||||
}
|
||||
inline double fix_result(double value)
|
||||
{
|
||||
#ifndef HAVE_FINITE
|
||||
return value;
|
||||
#else
|
||||
/* The following should be safe, even if we compare doubles */
|
||||
if (finite(value) && value != POSTFIX_ERROR)
|
||||
return value;
|
||||
null_value=1;
|
||||
return 0.0;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
class Item_func_exp :public Item_dec_func
|
||||
|
|
|
@ -600,6 +600,7 @@ Item_sum_hybrid::fix_fields(THD *thd, Item **ref)
|
|||
result_field=0;
|
||||
null_value=1;
|
||||
fix_length_and_dec();
|
||||
item= item->real_item();
|
||||
if (item->type() == Item::FIELD_ITEM)
|
||||
hybrid_field_type= ((Item_field*) item)->field->type();
|
||||
else
|
||||
|
@ -3493,6 +3494,6 @@ void Item_func_group_concat::print(String *str, enum_query_type query_type)
|
|||
|
||||
Item_func_group_concat::~Item_func_group_concat()
|
||||
{
|
||||
if (unique_filter)
|
||||
if (!original && unique_filter)
|
||||
delete unique_filter;
|
||||
}
|
||||
|
|
10
sql/log.cc
10
sql/log.cc
|
@ -4449,15 +4449,7 @@ static void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
|
|||
return an error (e.g. logging to the log tables)
|
||||
*/
|
||||
|
||||
#ifdef EMBEDDED_LIBRARY
|
||||
int vprint_msg_to_log(enum loglevel level __attribute__((unused)),
|
||||
const char *format __attribute__((unused)),
|
||||
va_list argsi __attribute__((unused)))
|
||||
{
|
||||
DBUG_ENTER("vprint_msg_to_log");
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#else /*!EMBEDDED_LIBRARY*/
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
static void print_buffer_to_file(enum loglevel level, const char *buffer)
|
||||
{
|
||||
time_t skr;
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
/* Copyright (C) 2000-2001 MySQL AB
|
||||
|
||||
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
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
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 */
|
||||
|
||||
/* Fix that we got POSTFIX_ERROR when doing unreasonable math (not core) */
|
||||
|
||||
#include <my_global.h>
|
||||
#include <errno.h>
|
||||
|
||||
/* Fix that we gets POSTFIX_ERROR when error in math */
|
||||
|
||||
#if defined(HAVE_MATHERR)
|
||||
int matherr(struct exception *x)
|
||||
{
|
||||
if (x->type != PLOSS)
|
||||
x->retval=POSTFIX_ERROR;
|
||||
switch (x->type) {
|
||||
case DOMAIN:
|
||||
case SING:
|
||||
my_errno=EDOM;
|
||||
break;
|
||||
case OVERFLOW:
|
||||
case UNDERFLOW:
|
||||
my_errno=ERANGE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return(1); /* Take no other action */
|
||||
}
|
||||
#endif
|
|
@ -761,6 +761,7 @@ bool check_string_byte_length(LEX_STRING *str, const char *err_msg,
|
|||
bool check_string_char_length(LEX_STRING *str, const char *err_msg,
|
||||
uint max_char_length, CHARSET_INFO *cs,
|
||||
bool no_error);
|
||||
bool test_if_data_home_dir(const char *dir);
|
||||
|
||||
bool parse_sql(THD *thd,
|
||||
class Lex_input_stream *lip,
|
||||
|
@ -1806,7 +1807,8 @@ extern time_t server_start_time, flush_status_time;
|
|||
#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
|
||||
extern uint mysql_data_home_len;
|
||||
extern char *mysql_data_home,server_version[SERVER_VERSION_LENGTH],
|
||||
mysql_real_data_home[];
|
||||
mysql_real_data_home[], mysql_unpacked_real_data_home[];
|
||||
extern CHARSET_INFO *character_set_filesystem;
|
||||
#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
|
||||
#ifdef MYSQL_SERVER
|
||||
extern char *opt_mysql_tmpdir, mysql_charsets_dir[],
|
||||
|
|
|
@ -518,6 +518,7 @@ char mysql_real_data_home[FN_REFLEN],
|
|||
language[FN_REFLEN], reg_ext[FN_EXTLEN], mysql_charsets_dir[FN_REFLEN],
|
||||
*opt_init_file, *opt_tc_log_file,
|
||||
def_ft_boolean_syntax[sizeof(ft_boolean_syntax)];
|
||||
char mysql_unpacked_real_data_home[FN_REFLEN];
|
||||
uint reg_ext_length;
|
||||
const key_map key_map_empty(0);
|
||||
key_map key_map_full(0); // Will be initialized later
|
||||
|
@ -2512,10 +2513,6 @@ static void init_signals(void)
|
|||
struct sigaction sa;
|
||||
DBUG_ENTER("init_signals");
|
||||
|
||||
if (test_flags & TEST_SIGINT)
|
||||
{
|
||||
my_sigset(thr_kill_signal, end_thread_signal);
|
||||
}
|
||||
my_sigset(THR_SERVER_ALARM,print_signal_warning); // Should never be called!
|
||||
|
||||
if (!(test_flags & TEST_NO_STACKTRACE) || (test_flags & TEST_CORE_ON_SIGNAL))
|
||||
|
@ -2552,7 +2549,6 @@ static void init_signals(void)
|
|||
(void) sigemptyset(&set);
|
||||
my_sigset(SIGPIPE,SIG_IGN);
|
||||
sigaddset(&set,SIGPIPE);
|
||||
sigaddset(&set,SIGINT);
|
||||
#ifndef IGNORE_SIGHUP_SIGQUIT
|
||||
sigaddset(&set,SIGQUIT);
|
||||
sigaddset(&set,SIGHUP);
|
||||
|
@ -2574,9 +2570,12 @@ static void init_signals(void)
|
|||
sigaddset(&set,THR_SERVER_ALARM);
|
||||
if (test_flags & TEST_SIGINT)
|
||||
{
|
||||
my_sigset(thr_kill_signal, end_thread_signal);
|
||||
// May be SIGINT
|
||||
sigdelset(&set, thr_kill_signal);
|
||||
}
|
||||
else
|
||||
sigaddset(&set,SIGINT);
|
||||
sigprocmask(SIG_SETMASK,&set,NULL);
|
||||
pthread_sigmask(SIG_SETMASK,&set,NULL);
|
||||
DBUG_VOID_RETURN;
|
||||
|
@ -8303,6 +8302,9 @@ static void fix_paths(void)
|
|||
pos[1]= 0;
|
||||
}
|
||||
convert_dirname(mysql_real_data_home,mysql_real_data_home,NullS);
|
||||
(void) fn_format(buff, mysql_real_data_home, "", "",
|
||||
(MY_RETURN_REAL_PATH|MY_RESOLVE_SYMLINKS));
|
||||
(void) unpack_dirname(mysql_unpacked_real_data_home, buff);
|
||||
convert_dirname(language,language,NullS);
|
||||
(void) my_load_path(mysql_home,mysql_home,""); // Resolve current dir
|
||||
(void) my_load_path(mysql_real_data_home,mysql_real_data_home,mysql_home);
|
||||
|
|
|
@ -1265,4 +1265,60 @@ error:
|
|||
mem_alloc_error(size);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Check if path does not contain mysql data home directory
|
||||
for partition elements with data directory and index directory
|
||||
|
||||
SYNOPSIS
|
||||
check_partition_dirs()
|
||||
part_info partition_info struct
|
||||
|
||||
RETURN VALUES
|
||||
0 ok
|
||||
1 error
|
||||
*/
|
||||
|
||||
bool check_partition_dirs(partition_info *part_info)
|
||||
{
|
||||
if (!part_info)
|
||||
return 0;
|
||||
|
||||
partition_element *part_elem;
|
||||
List_iterator<partition_element> part_it(part_info->partitions);
|
||||
while ((part_elem= part_it++))
|
||||
{
|
||||
if (part_elem->subpartitions.elements)
|
||||
{
|
||||
List_iterator<partition_element> sub_it(part_elem->subpartitions);
|
||||
partition_element *subpart_elem;
|
||||
while ((subpart_elem= sub_it++))
|
||||
{
|
||||
if (test_if_data_home_dir(subpart_elem->data_file_name))
|
||||
goto dd_err;
|
||||
if (test_if_data_home_dir(subpart_elem->index_file_name))
|
||||
goto id_err;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (test_if_data_home_dir(part_elem->data_file_name))
|
||||
goto dd_err;
|
||||
if (test_if_data_home_dir(part_elem->index_file_name))
|
||||
goto id_err;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
dd_err:
|
||||
my_error(ER_WRONG_ARGUMENTS,MYF(0),"DATA DIRECORY");
|
||||
return 1;
|
||||
|
||||
id_err:
|
||||
my_error(ER_WRONG_ARGUMENTS,MYF(0),"INDEX DIRECORY");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
#endif /* WITH_PARTITION_STORAGE_ENGINE */
|
||||
|
|
|
@ -290,6 +290,7 @@ private:
|
|||
};
|
||||
|
||||
uint32 get_next_partition_id_range(struct st_partition_iter* part_iter);
|
||||
bool check_partition_dirs(partition_info *part_info);
|
||||
|
||||
/* Initialize the iterator to return a single partition with given part_id */
|
||||
|
||||
|
|
|
@ -29,9 +29,9 @@ int init_strvar_from_file(char *var, int max_size, IO_CACHE *f,
|
|||
|
||||
Master_info::Master_info()
|
||||
:Slave_reporting_capability("I/O"),
|
||||
ssl(0), fd(-1), io_thd(0), inited(0),
|
||||
ssl(0), ssl_verify_server_cert(0), fd(-1), io_thd(0), inited(0),
|
||||
abort_slave(0),slave_running(0),
|
||||
ssl_verify_server_cert(0), slave_run_id(0)
|
||||
slave_run_id(0)
|
||||
{
|
||||
host[0] = 0; user[0] = 0; password[0] = 0;
|
||||
ssl_ca[0]= 0; ssl_capath[0]= 0; ssl_cert[0]= 0;
|
||||
|
|
|
@ -33,12 +33,12 @@ Relay_log_info::Relay_log_info()
|
|||
:Slave_reporting_capability("SQL"),
|
||||
no_storage(FALSE), replicate_same_server_id(::replicate_same_server_id),
|
||||
info_fd(-1), cur_log_fd(-1), save_temporary_tables(0),
|
||||
group_relay_log_pos(0), event_relay_log_pos(0),
|
||||
#if HAVE_purify
|
||||
is_fake(FALSE),
|
||||
#endif
|
||||
cur_log_old_open_count(0), group_master_log_pos(0), log_space_total(0),
|
||||
ignore_log_space_limit(0), last_master_timestamp(0), slave_skip_counter(0),
|
||||
cur_log_old_open_count(0), group_relay_log_pos(0), event_relay_log_pos(0),
|
||||
group_master_log_pos(0), log_space_total(0), ignore_log_space_limit(0),
|
||||
last_master_timestamp(0), slave_skip_counter(0),
|
||||
abort_pos_wait(0), slave_run_id(0), sql_thd(0),
|
||||
inited(0), abort_slave(0), slave_running(0), until_condition(UNTIL_NONE),
|
||||
until_log_pos(0), retried_trans(0),
|
||||
|
|
|
@ -137,7 +137,8 @@ static void fix_trans_mem_root(THD *thd, enum_var_type type);
|
|||
static void fix_server_id(THD *thd, enum_var_type type);
|
||||
static ulonglong fix_unsigned(THD *, ulonglong, const struct my_option *);
|
||||
static bool get_unsigned(THD *thd, set_var *var);
|
||||
static void throw_bounds_warning(THD *thd, const char *name, ulonglong num);
|
||||
bool throw_bounds_warning(THD *thd, bool fixed, bool unsignd,
|
||||
const char *name, longlong val);
|
||||
static KEY_CACHE *create_key_cache(const char *name, uint length);
|
||||
void fix_sql_mode_var(THD *thd, enum_var_type type);
|
||||
static uchar *get_error_count(THD *thd);
|
||||
|
@ -1207,13 +1208,29 @@ static void fix_server_id(THD *thd, enum_var_type type)
|
|||
}
|
||||
|
||||
|
||||
static void throw_bounds_warning(THD *thd, const char *name, ulonglong num)
|
||||
bool throw_bounds_warning(THD *thd, bool fixed, bool unsignd,
|
||||
const char *name, longlong val)
|
||||
{
|
||||
char buf[22];
|
||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_TRUNCATED_WRONG_VALUE,
|
||||
ER(ER_TRUNCATED_WRONG_VALUE), name,
|
||||
ullstr(num, buf));
|
||||
if (fixed)
|
||||
{
|
||||
char buf[22];
|
||||
|
||||
if (unsignd)
|
||||
ullstr((ulonglong) val, buf);
|
||||
else
|
||||
llstr(val, buf);
|
||||
|
||||
if (thd->variables.sql_mode & MODE_STRICT_ALL_TABLES)
|
||||
{
|
||||
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, buf);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_TRUNCATED_WRONG_VALUE,
|
||||
ER(ER_TRUNCATED_WRONG_VALUE), name, buf);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static ulonglong fix_unsigned(THD *thd, ulonglong num,
|
||||
|
@ -1222,8 +1239,7 @@ static ulonglong fix_unsigned(THD *thd, ulonglong num,
|
|||
my_bool fixed= FALSE;
|
||||
ulonglong out= getopt_ull_limit_value(num, option_limits, &fixed);
|
||||
|
||||
if (fixed)
|
||||
throw_bounds_warning(thd, option_limits->name, num);
|
||||
throw_bounds_warning(thd, fixed, TRUE, option_limits->name, (longlong) num);
|
||||
return out;
|
||||
}
|
||||
|
||||
|
@ -1266,7 +1282,8 @@ bool sys_var_long_ptr_global::update(THD *thd, set_var *var)
|
|||
if (tmp > ULONG_MAX)
|
||||
{
|
||||
tmp= ULONG_MAX;
|
||||
throw_bounds_warning(thd, name, var->save_result.ulonglong_value);
|
||||
throw_bounds_warning(thd, TRUE, TRUE, name,
|
||||
(longlong) var->save_result.ulonglong_value);
|
||||
}
|
||||
#endif
|
||||
*value= (ulong) tmp;
|
||||
|
@ -1355,7 +1372,7 @@ bool sys_var_thd_ulong::update(THD *thd, set_var *var)
|
|||
/* Don't use bigger value than given with --maximum-variable-name=.. */
|
||||
if ((ulong) tmp > max_system_variables.*offset)
|
||||
{
|
||||
throw_bounds_warning(thd, name, tmp);
|
||||
throw_bounds_warning(thd, TRUE, TRUE, name, (longlong) tmp);
|
||||
tmp= max_system_variables.*offset;
|
||||
}
|
||||
|
||||
|
@ -1365,7 +1382,7 @@ bool sys_var_thd_ulong::update(THD *thd, set_var *var)
|
|||
else if (tmp > ULONG_MAX)
|
||||
{
|
||||
tmp= ULONG_MAX;
|
||||
throw_bounds_warning(thd, name, var->save_result.ulonglong_value);
|
||||
throw_bounds_warning(thd, TRUE, TRUE, name, (longlong) var->save_result.ulonglong_value);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue