mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge tkatchaounov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into lamia.home:/home/tkatchaounov/autopush/5.0-bug-21007 client/mysql.cc: Auto merged mysql-test/r/date_formats.result: Auto merged mysql-test/r/func_str.result: Auto merged mysql-test/t/date_formats.test: Auto merged mysql-test/t/func_str.test: Auto merged sql/item_strfunc.cc: Auto merged sql/sql_class.cc: Auto merged sql/time.cc: Auto merged
This commit is contained in:
@ -2970,6 +2970,7 @@ static int
|
||||
com_use(String *buffer __attribute__((unused)), char *line)
|
||||
{
|
||||
char *tmp, buff[FN_REFLEN + 1];
|
||||
int select_db;
|
||||
|
||||
bzero(buff, sizeof(buff));
|
||||
strmov(buff, line);
|
||||
@ -2989,34 +2990,52 @@ com_use(String *buffer __attribute__((unused)), char *line)
|
||||
if (!current_db || cmp_database(charset_info, current_db,tmp))
|
||||
{
|
||||
if (one_database)
|
||||
skip_updates= 1;
|
||||
else
|
||||
{
|
||||
/*
|
||||
reconnect once if connection is down or if connection was found to
|
||||
be down during query
|
||||
*/
|
||||
if (!connected && reconnect())
|
||||
return opt_reconnect ? -1 : 1; // Fatal error
|
||||
if (mysql_select_db(&mysql,tmp))
|
||||
{
|
||||
if (mysql_errno(&mysql) != CR_SERVER_GONE_ERROR)
|
||||
return put_error(&mysql);
|
||||
|
||||
if (reconnect())
|
||||
return opt_reconnect ? -1 : 1; // Fatal error
|
||||
if (mysql_select_db(&mysql,tmp))
|
||||
return put_error(&mysql);
|
||||
}
|
||||
my_free(current_db,MYF(MY_ALLOW_ZERO_PTR));
|
||||
current_db=my_strdup(tmp,MYF(MY_WME));
|
||||
#ifdef HAVE_READLINE
|
||||
build_completion_hash(rehash, 1);
|
||||
#endif
|
||||
skip_updates= 1;
|
||||
select_db= 0; // don't do mysql_select_db()
|
||||
}
|
||||
else
|
||||
select_db= 2; // do mysql_select_db() and build_completion_hash()
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
USE to the current db specified.
|
||||
We do need to send mysql_select_db() to make server
|
||||
update database level privileges, which might
|
||||
change since last USE (see bug#10979).
|
||||
For performance purposes, we'll skip rebuilding of completion hash.
|
||||
*/
|
||||
skip_updates= 0;
|
||||
select_db= 1; // do only mysql_select_db(), without completion
|
||||
}
|
||||
|
||||
if (select_db)
|
||||
{
|
||||
/*
|
||||
reconnect once if connection is down or if connection was found to
|
||||
be down during query
|
||||
*/
|
||||
if (!connected && reconnect())
|
||||
return opt_reconnect ? -1 : 1; // Fatal error
|
||||
if (mysql_select_db(&mysql,tmp))
|
||||
{
|
||||
if (mysql_errno(&mysql) != CR_SERVER_GONE_ERROR)
|
||||
return put_error(&mysql);
|
||||
|
||||
if (reconnect())
|
||||
return opt_reconnect ? -1 : 1; // Fatal error
|
||||
if (mysql_select_db(&mysql,tmp))
|
||||
return put_error(&mysql);
|
||||
}
|
||||
my_free(current_db,MYF(MY_ALLOW_ZERO_PTR));
|
||||
current_db=my_strdup(tmp,MYF(MY_WME));
|
||||
#ifdef HAVE_READLINE
|
||||
if (select_db > 1)
|
||||
build_completion_hash(rehash, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
put_info("Database changed",INFO_INFO);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2239,17 +2239,18 @@ static void dump_table(char *table, char *db)
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (opt_disable_keys)
|
||||
{
|
||||
fprintf(md_result_file, "\n/*!40000 ALTER TABLE %s DISABLE KEYS */;\n",
|
||||
opt_quoted_table);
|
||||
check_io(md_result_file);
|
||||
}
|
||||
if (opt_lock)
|
||||
{
|
||||
fprintf(md_result_file,"LOCK TABLES %s WRITE;\n", opt_quoted_table);
|
||||
check_io(md_result_file);
|
||||
}
|
||||
/* Moved disable keys to after lock per bug 15977 */
|
||||
if (opt_disable_keys)
|
||||
{
|
||||
fprintf(md_result_file, "/*!40000 ALTER TABLE %s DISABLE KEYS */;\n",
|
||||
opt_quoted_table);
|
||||
check_io(md_result_file);
|
||||
}
|
||||
|
||||
total_length= opt_net_buffer_length; /* Force row break */
|
||||
row_break=0;
|
||||
@ -2511,17 +2512,19 @@ static void dump_table(char *table, char *db)
|
||||
error= EX_CONSCHECK;
|
||||
goto err;
|
||||
}
|
||||
if (opt_lock)
|
||||
{
|
||||
fputs("UNLOCK TABLES;\n", md_result_file);
|
||||
check_io(md_result_file);
|
||||
}
|
||||
|
||||
/* Moved enable keys to before unlock per bug 15977 */
|
||||
if (opt_disable_keys)
|
||||
{
|
||||
fprintf(md_result_file,"/*!40000 ALTER TABLE %s ENABLE KEYS */;\n",
|
||||
opt_quoted_table);
|
||||
check_io(md_result_file);
|
||||
}
|
||||
if (opt_lock)
|
||||
{
|
||||
fputs("UNLOCK TABLES;\n", md_result_file);
|
||||
check_io(md_result_file);
|
||||
}
|
||||
if (opt_autocommit)
|
||||
{
|
||||
fprintf(md_result_file, "commit;\n");
|
||||
@ -2781,6 +2784,12 @@ static my_bool dump_all_views_in_db(char *database)
|
||||
uint numrows;
|
||||
char table_buff[NAME_LEN*2+3];
|
||||
|
||||
if (mysql_select_db(sock, database))
|
||||
{
|
||||
DB_error(sock, "when selecting the database");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (opt_xml)
|
||||
print_xml_tag1(md_result_file, "", "database name=", database, "\n");
|
||||
if (lock_tables)
|
||||
@ -3436,12 +3445,13 @@ static my_bool get_view_structure(char *table, char* db)
|
||||
mysql_free_result(table_res);
|
||||
|
||||
/* Get the result from "select ... information_schema" */
|
||||
if (!(table_res= mysql_store_result(sock)))
|
||||
if (!(table_res= mysql_store_result(sock)) ||
|
||||
!(row= mysql_fetch_row(table_res)))
|
||||
{
|
||||
safe_exit(EX_MYSQLERR);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
row= mysql_fetch_row(table_res);
|
||||
|
||||
lengths= mysql_fetch_lengths(table_res);
|
||||
|
||||
/*
|
||||
|
@ -651,7 +651,7 @@ AC_ARG_ENABLE(assembler,
|
||||
|
||||
AC_MSG_CHECKING(if we should use assembler functions)
|
||||
# For now we only support assembler on i386 and sparc systems
|
||||
AM_CONDITIONAL(ASSEMBLER_x86, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "i386")
|
||||
AM_CONDITIONAL(ASSEMBLER_x86, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "i386" && $AS strings/strings-x86.s -o checkassembler >/dev/null 2>&1 && test -f checkassembler && (rm -f checkassembler; exit 0;))
|
||||
AM_CONDITIONAL(ASSEMBLER_sparc32, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparc")
|
||||
AM_CONDITIONAL(ASSEMBLER_sparc64, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparcv9")
|
||||
AM_CONDITIONAL(ASSEMBLER, test "$ASSEMBLER_x86_TRUE" = "" -o "$ASSEMBLER_sparc32_TRUE" = "")
|
||||
|
4
mysql-test/include/have_case_sensitive_file_system.inc
Normal file
4
mysql-test/include/have_case_sensitive_file_system.inc
Normal file
@ -0,0 +1,4 @@
|
||||
--require r/case_sensitive_file_system.require
|
||||
--disable_query_log
|
||||
show variables like "lower_case_file_system";
|
||||
--enable_query_log
|
@ -116,7 +116,7 @@ sub collect_test_cases ($) {
|
||||
while ( <DISABLED> )
|
||||
{
|
||||
chomp;
|
||||
if ( /^\s*(\S+)\s*:\s*(.*?)\s*$/ )
|
||||
if ( /^\s*([^\s:]+)\s*:\s*(.*?)\s*$/ )
|
||||
{
|
||||
$disabled{$1}= $2;
|
||||
}
|
||||
|
@ -3074,6 +3074,7 @@ sub run_mysqltest ($) {
|
||||
my $cmdline_mysql_client_test=
|
||||
"$exe_mysql_client_test --no-defaults --testcase --user=root --silent " .
|
||||
"--port=$master->[0]->{'path_myport'} " .
|
||||
"--vardir=$opt_vardir " .
|
||||
"--socket=$master->[0]->{'path_mysock'}";
|
||||
|
||||
if ( $glob_use_embedded_server )
|
||||
|
2
mysql-test/r/case_sensitive_file_system.require
Normal file
2
mysql-test/r/case_sensitive_file_system.require
Normal file
@ -0,0 +1,2 @@
|
||||
Variable_name Value
|
||||
lower_case_file_system OFF
|
@ -33,6 +33,9 @@ instr('hello','HE') instr('hello',binary 'HE') instr(binary 'hello','HE')
|
||||
select position(binary 'll' in 'hello'),position('a' in binary 'hello');
|
||||
position(binary 'll' in 'hello') position('a' in binary 'hello')
|
||||
3 0
|
||||
select left('hello',null), right('hello',null);
|
||||
left('hello',null) right('hello',null)
|
||||
NULL NULL
|
||||
select left('hello',2),right('hello',2),substring('hello',2,2),mid('hello',1,5) ;
|
||||
left('hello',2) right('hello',2) substring('hello',2,2) mid('hello',1,5)
|
||||
he lo el hello
|
||||
|
@ -2099,3 +2099,46 @@ SOUTH EAST SOUTH EAST
|
||||
SOUTH WEST SOUTH WEST
|
||||
WESTERN WESTERN
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (id1 INT, id2 INT);
|
||||
CREATE TABLE t2 (id2 INT, id3 INT, id5 INT);
|
||||
CREATE TABLE t3 (id3 INT, id4 INT);
|
||||
CREATE TABLE t4 (id4 INT);
|
||||
CREATE TABLE t5 (id5 INT, id6 INT);
|
||||
CREATE TABLE t6 (id6 INT);
|
||||
INSERT INTO t1 VALUES(1,1);
|
||||
INSERT INTO t2 VALUES(1,1,1);
|
||||
INSERT INTO t3 VALUES(1,1);
|
||||
INSERT INTO t4 VALUES(1);
|
||||
INSERT INTO t5 VALUES(1,1);
|
||||
INSERT INTO t6 VALUES(1);
|
||||
SELECT * FROM
|
||||
t1
|
||||
NATURAL JOIN
|
||||
(t2 JOIN (t3 NATURAL JOIN t4, t5 NATURAL JOIN t6)
|
||||
ON (t3.id3 = t2.id3 AND t5.id5 = t2.id5));
|
||||
id2 id1 id3 id5 id4 id3 id6 id5
|
||||
1 1 1 1 1 1 1 1
|
||||
SELECT * FROM
|
||||
t1
|
||||
NATURAL JOIN
|
||||
(((t3 NATURAL JOIN t4) join (t5 NATURAL JOIN t6) on t3.id4 = t5.id5) JOIN t2
|
||||
ON (t3.id3 = t2.id3 AND t5.id5 = t2.id5));
|
||||
id2 id1 id4 id3 id6 id5 id3 id5
|
||||
1 1 1 1 1 1 1 1
|
||||
SELECT * FROM t1 NATURAL JOIN ((t3 join (t5 NATURAL JOIN t6)) JOIN t2);
|
||||
id2 id1 id3 id4 id6 id5 id3 id5
|
||||
1 1 1 1 1 1 1 1
|
||||
SELECT * FROM
|
||||
(t2 JOIN (t3 NATURAL JOIN t4, t5 NATURAL JOIN t6)
|
||||
ON (t3.id3 = t2.id3 AND t5.id5 = t2.id5))
|
||||
NATURAL JOIN
|
||||
t1;
|
||||
id2 id3 id5 id4 id3 id6 id5 id1
|
||||
1 1 1 1 1 1 1 1
|
||||
SELECT * FROM
|
||||
(t2 JOIN ((t3 NATURAL JOIN t4) join (t5 NATURAL JOIN t6)))
|
||||
NATURAL JOIN
|
||||
t1;
|
||||
id2 id3 id5 id4 id3 id6 id5 id1
|
||||
1 1 1 1 1 1 1 1
|
||||
DROP TABLE t1,t2,t3,t4,t5,t6;
|
||||
|
11
mysql-test/r/lowercase_fs_off.result
Normal file
11
mysql-test/r/lowercase_fs_off.result
Normal file
@ -0,0 +1,11 @@
|
||||
create database d1;
|
||||
grant all on d1.* to 'sample'@'localhost' identified by 'password';
|
||||
flush privileges;
|
||||
select database();
|
||||
database()
|
||||
d1
|
||||
create database d2;
|
||||
ERROR 42000: Access denied for user 'sample'@'localhost' to database 'd2'
|
||||
create database D1;
|
||||
ERROR 42000: Access denied for user 'sample'@'localhost' to database 'D1'
|
||||
drop database if exists d1;
|
@ -115,7 +115,6 @@ CREATE TABLE `t1` (
|
||||
`name` varchar(32) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
|
||||
INSERT DELAYED IGNORE INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
@ -125,7 +124,6 @@ CREATE TABLE `t2` (
|
||||
`name` varchar(32) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
|
||||
INSERT DELAYED IGNORE INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
|
||||
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
|
||||
@ -135,7 +133,6 @@ CREATE TABLE `t3` (
|
||||
`name` varchar(32) default NULL
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `t3` DISABLE KEYS */;
|
||||
INSERT DELAYED IGNORE INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
|
||||
/*!40000 ALTER TABLE `t3` ENABLE KEYS */;
|
||||
@ -145,7 +142,6 @@ CREATE TABLE `t4` (
|
||||
`name` varchar(32) default NULL
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `t4` DISABLE KEYS */;
|
||||
INSERT DELAYED IGNORE INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
|
||||
/*!40000 ALTER TABLE `t4` ENABLE KEYS */;
|
||||
@ -155,7 +151,6 @@ CREATE TABLE `t5` (
|
||||
`name` varchar(32) default NULL
|
||||
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `t5` DISABLE KEYS */;
|
||||
INSERT DELAYED IGNORE INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
|
||||
/*!40000 ALTER TABLE `t5` ENABLE KEYS */;
|
||||
@ -165,7 +160,6 @@ CREATE TABLE `t6` (
|
||||
`name` varchar(32) default NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `t6` DISABLE KEYS */;
|
||||
INSERT IGNORE INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
|
||||
/*!40000 ALTER TABLE `t6` ENABLE KEYS */;
|
||||
@ -200,7 +194,6 @@ CREATE TABLE `t1` (
|
||||
`name` varchar(32) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
|
||||
INSERT DELAYED INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
@ -210,7 +203,6 @@ CREATE TABLE `t2` (
|
||||
`name` varchar(32) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
|
||||
INSERT DELAYED INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
|
||||
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
|
||||
@ -220,7 +212,6 @@ CREATE TABLE `t3` (
|
||||
`name` varchar(32) default NULL
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `t3` DISABLE KEYS */;
|
||||
INSERT DELAYED INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
|
||||
/*!40000 ALTER TABLE `t3` ENABLE KEYS */;
|
||||
@ -230,7 +221,6 @@ CREATE TABLE `t4` (
|
||||
`name` varchar(32) default NULL
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `t4` DISABLE KEYS */;
|
||||
INSERT DELAYED INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
|
||||
/*!40000 ALTER TABLE `t4` ENABLE KEYS */;
|
||||
@ -240,7 +230,6 @@ CREATE TABLE `t5` (
|
||||
`name` varchar(32) default NULL
|
||||
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `t5` DISABLE KEYS */;
|
||||
INSERT DELAYED INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
|
||||
/*!40000 ALTER TABLE `t5` ENABLE KEYS */;
|
||||
@ -250,7 +239,6 @@ CREATE TABLE `t6` (
|
||||
`name` varchar(32) default NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `t6` DISABLE KEYS */;
|
||||
INSERT INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
|
||||
/*!40000 ALTER TABLE `t6` ENABLE KEYS */;
|
||||
|
File diff suppressed because one or more lines are too long
@ -485,6 +485,20 @@ execute stmt;
|
||||
pnum
|
||||
deallocate prepare stmt;
|
||||
drop table t1, t2;
|
||||
drop table if exists t1;
|
||||
create temporary table if not exists t1 (a1 int);
|
||||
prepare stmt from "delete t1 from t1 where (cast(a1/3 as unsigned) * 3) = a1";
|
||||
drop temporary table t1;
|
||||
create temporary table if not exists t1 (a1 int);
|
||||
execute stmt;
|
||||
drop temporary table t1;
|
||||
create temporary table if not exists t1 (a1 int);
|
||||
execute stmt;
|
||||
drop temporary table t1;
|
||||
create temporary table if not exists t1 (a1 int);
|
||||
execute stmt;
|
||||
drop temporary table t1;
|
||||
deallocate prepare stmt;
|
||||
create table t1 (a varchar(20));
|
||||
insert into t1 values ('foo');
|
||||
prepare stmt FROM 'SELECT char_length (a) FROM t1';
|
||||
|
@ -19,6 +19,11 @@ select hex(char(256));
|
||||
select locate('he','hello'),locate('he','hello',2),locate('lo','hello',2) ;
|
||||
select instr('hello','HE'), instr('hello',binary 'HE'), instr(binary 'hello','HE');
|
||||
select position(binary 'll' in 'hello'),position('a' in binary 'hello');
|
||||
#
|
||||
# Bug#11728 string function LEFT,
|
||||
# strange undocumented behaviour, strict mode
|
||||
#
|
||||
select left('hello',null), right('hello',null);
|
||||
select left('hello',2),right('hello',2),substring('hello',2,2),mid('hello',1,5) ;
|
||||
select concat('',left(right(concat('what ',concat('is ','happening')),9),4),'',substring('monty',5,1)) ;
|
||||
select substring_index('www.tcx.se','.',-2),substring_index('www.tcx.se','.',1);
|
||||
|
@ -746,3 +746,51 @@ EXPLAIN SELECT DISTINCT a,a FROM t1 ORDER BY a;
|
||||
SELECT DISTINCT a,a FROM t1 ORDER BY a;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #21007: NATURAL JOIN (any JOIN (2 x NATURAL JOIN)) crashes the server
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (id1 INT, id2 INT);
|
||||
CREATE TABLE t2 (id2 INT, id3 INT, id5 INT);
|
||||
CREATE TABLE t3 (id3 INT, id4 INT);
|
||||
CREATE TABLE t4 (id4 INT);
|
||||
CREATE TABLE t5 (id5 INT, id6 INT);
|
||||
CREATE TABLE t6 (id6 INT);
|
||||
|
||||
INSERT INTO t1 VALUES(1,1);
|
||||
INSERT INTO t2 VALUES(1,1,1);
|
||||
INSERT INTO t3 VALUES(1,1);
|
||||
INSERT INTO t4 VALUES(1);
|
||||
INSERT INTO t5 VALUES(1,1);
|
||||
INSERT INTO t6 VALUES(1);
|
||||
|
||||
-- original bug query
|
||||
SELECT * FROM
|
||||
t1
|
||||
NATURAL JOIN
|
||||
(t2 JOIN (t3 NATURAL JOIN t4, t5 NATURAL JOIN t6)
|
||||
ON (t3.id3 = t2.id3 AND t5.id5 = t2.id5));
|
||||
|
||||
-- inner join swapped
|
||||
SELECT * FROM
|
||||
t1
|
||||
NATURAL JOIN
|
||||
(((t3 NATURAL JOIN t4) join (t5 NATURAL JOIN t6) on t3.id4 = t5.id5) JOIN t2
|
||||
ON (t3.id3 = t2.id3 AND t5.id5 = t2.id5));
|
||||
|
||||
-- one join less, no ON cond
|
||||
SELECT * FROM t1 NATURAL JOIN ((t3 join (t5 NATURAL JOIN t6)) JOIN t2);
|
||||
|
||||
-- wrong error message: 'id2' - ambiguous column
|
||||
SELECT * FROM
|
||||
(t2 JOIN (t3 NATURAL JOIN t4, t5 NATURAL JOIN t6)
|
||||
ON (t3.id3 = t2.id3 AND t5.id5 = t2.id5))
|
||||
NATURAL JOIN
|
||||
t1;
|
||||
SELECT * FROM
|
||||
(t2 JOIN ((t3 NATURAL JOIN t4) join (t5 NATURAL JOIN t6)))
|
||||
NATURAL JOIN
|
||||
t1;
|
||||
|
||||
DROP TABLE t1,t2,t3,t4,t5,t6;
|
||||
|
27
mysql-test/t/lowercase_fs_off.test
Normal file
27
mysql-test/t/lowercase_fs_off.test
Normal file
@ -0,0 +1,27 @@
|
||||
#
|
||||
# Specific tests for case sensitive file systems
|
||||
# i.e. lower_case_filesystem=OFF
|
||||
#
|
||||
-- source include/have_case_sensitive_file_system.inc
|
||||
|
||||
connect (master,localhost,root,,);
|
||||
connection master;
|
||||
create database d1;
|
||||
grant all on d1.* to 'sample'@'localhost' identified by 'password';
|
||||
flush privileges;
|
||||
|
||||
connect (sample,localhost,sample,password,d1);
|
||||
connection sample;
|
||||
select database();
|
||||
--error 1044
|
||||
create database d2;
|
||||
--error 1044
|
||||
create database D1;
|
||||
disconnect sample;
|
||||
|
||||
connection master;
|
||||
drop database if exists d1;
|
||||
disconnect master;
|
||||
connection default;
|
||||
|
||||
# End of 4.1 tests
|
@ -1194,6 +1194,7 @@ drop table t1;
|
||||
--exec $MYSQL_DUMP --force -N --compact --skip-comments test
|
||||
--echo } mysqldump
|
||||
drop view v1;
|
||||
|
||||
# BUG#17201 Spurious 'DROP DATABASE' in output,
|
||||
# also confusion between tables and views.
|
||||
# Example code from Markus Popp
|
||||
@ -1210,3 +1211,20 @@ insert into t1 values (0815);
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
drop database mysqldump_test_db;
|
||||
|
||||
# Bug21014 Segmentation fault of mysqldump on view
|
||||
|
||||
create database mysqldump_tables;
|
||||
use mysqldump_tables;
|
||||
create table basetable ( id serial, tag varchar(64) );
|
||||
|
||||
create database mysqldump_views;
|
||||
use mysqldump_views;
|
||||
create view nasishnasifu as select mysqldump_tables.basetable.id from mysqldump_tables.basetable;
|
||||
|
||||
--exec $MYSQL_DUMP --skip-comments --databases mysqldump_tables mysqldump_views;
|
||||
|
||||
drop view nasishnasifu;
|
||||
drop database mysqldump_views;
|
||||
drop table mysqldump_tables.basetable;
|
||||
drop database mysqldump_tables;
|
||||
|
@ -491,6 +491,30 @@ deallocate prepare stmt;
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# Bug#19399 "Stored Procedures 'Lost Connection' when dropping/creating
|
||||
# tables"
|
||||
# Check that multi-delete tables are also cleaned up before re-execution.
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
create temporary table if not exists t1 (a1 int);
|
||||
--enable_warnings
|
||||
# exact delete syntax is essential
|
||||
prepare stmt from "delete t1 from t1 where (cast(a1/3 as unsigned) * 3) = a1";
|
||||
drop temporary table t1;
|
||||
create temporary table if not exists t1 (a1 int);
|
||||
# the server crashed on the next statement without the fix
|
||||
execute stmt;
|
||||
drop temporary table t1;
|
||||
create temporary table if not exists t1 (a1 int);
|
||||
# the problem was in memory corruption: repeat the test just in case
|
||||
execute stmt;
|
||||
drop temporary table t1;
|
||||
create temporary table if not exists t1 (a1 int);
|
||||
execute stmt;
|
||||
drop temporary table t1;
|
||||
deallocate prepare stmt;
|
||||
|
||||
# Bug#6102 "Server crash with prepared statement and blank after
|
||||
# function name"
|
||||
# ensure that stored functions are cached when preparing a statement
|
||||
|
@ -22,7 +22,7 @@
|
||||
static const char* cMonth[] = { "x", "January", "February", "Mars", "April", "May", "June",
|
||||
"July", "August", "September", "October", "November", "December"};
|
||||
|
||||
static const char* cDay[] = { "x", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
|
||||
static const char* cDay[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
|
||||
"Saturday", "Sunday"};
|
||||
|
||||
static const char* cHour[] = { "00","01","02","03","04","05","06","07","08","09","10","11","12",
|
||||
|
@ -1,5 +1,6 @@
|
||||
#!@PERL@ -w
|
||||
#!@PERL@
|
||||
use strict;
|
||||
use warnings;
|
||||
use DBI;
|
||||
|
||||
use Getopt::Long;
|
||||
@ -58,7 +59,7 @@ else {
|
||||
}
|
||||
else {
|
||||
$Param->{Start} = time;
|
||||
while(<STDIN>) {
|
||||
while(<>) {
|
||||
$Param->{LineCount} ++ ;
|
||||
|
||||
if ($Param->{ViewDate} ) {
|
||||
@ -317,6 +318,8 @@ Usage: $0 [OPTIONS] < LOGFILE
|
||||
-p=PASSWORD
|
||||
--socket=SOCKET mysqld socket file to connect
|
||||
-s=SOCKET
|
||||
--printerror=1 enable error output
|
||||
-e 1
|
||||
|
||||
Read logfile from STDIN an try to EXPLAIN all SELECT statements. All UPDATE statements are rewritten to an EXPLAIN SELECT statement. The results of the EXPLAIN statement are collected and counted. All results with type=ALL are collected in an separete list. Results are printed to STDOUT.
|
||||
|
||||
@ -331,7 +334,7 @@ __END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
explain_log.pl
|
||||
mysql_explain_log
|
||||
|
||||
Feed a mysqld general logfile (created with mysqld --log) back into mysql
|
||||
and collect statistics about index usage with EXPLAIN.
|
||||
@ -348,7 +351,7 @@ Then add indices to avoid table scans and remove those which aren't used.
|
||||
|
||||
=head1 USAGE
|
||||
|
||||
explain_log.pl [--date=YYMMDD] --host=dbhost] [--user=dbuser] [--password=dbpw] [--socket=/path/to/socket] < logfile
|
||||
mysql_explain_log [--date=YYMMDD] --host=dbhost] [--user=dbuser] [--password=dbpw] [--socket=/path/to/socket] < logfile
|
||||
|
||||
--date=YYMMDD select only entrys of date
|
||||
|
||||
@ -370,21 +373,20 @@ explain_log.pl [--date=YYMMDD] --host=dbhost] [--user=dbuser] [--password=dbpw]
|
||||
|
||||
-s=SOCKET
|
||||
|
||||
--printerror=1 enable error output
|
||||
|
||||
-e 1
|
||||
|
||||
=head1 EXAMPLE
|
||||
|
||||
explain_log.pl --host=localhost --user=foo --password=bar < /var/lib/mysql/mobile.log
|
||||
mysql_explain_log --host=localhost --user=foo --password=bar < /var/lib/mysql/mobile.log
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Stefan Nitz
|
||||
Jan Willamowius <jan@mobile.de>, http://www.mobile.de
|
||||
Jan Willamowius <jan@willamowius.de>, http://www.willamowius.de
|
||||
Dennis Haney <davh@davh.dk> (Added socket support)
|
||||
|
||||
=head1 RECRUITING
|
||||
|
||||
If you are looking for a MySQL or Perl job, take a look at http://www.mobile.de
|
||||
and send me an email with your resume (you must be speaking German!).
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
mysql documentation
|
||||
|
@ -321,10 +321,13 @@ then
|
||||
ulimit -n $open_files
|
||||
args="--open-files-limit=$open_files $args"
|
||||
fi
|
||||
if test -n "$core_file_size"
|
||||
then
|
||||
ulimit -c $core_file_size
|
||||
fi
|
||||
fi
|
||||
|
||||
# Try to set the core file size (even if we aren't root) because many systems
|
||||
# don't specify a hard limit on core file size.
|
||||
if test -n "$core_file_size"
|
||||
then
|
||||
ulimit -c $core_file_size
|
||||
fi
|
||||
|
||||
#
|
||||
|
@ -1673,11 +1673,18 @@ C_MODE_START
|
||||
int mysql_init_character_set(MYSQL *mysql)
|
||||
{
|
||||
NET *net= &mysql->net;
|
||||
const char *default_collation_name;
|
||||
|
||||
/* Set character set */
|
||||
if (!mysql->options.charset_name &&
|
||||
!(mysql->options.charset_name=
|
||||
if (!mysql->options.charset_name)
|
||||
{
|
||||
default_collation_name= MYSQL_DEFAULT_COLLATION_NAME;
|
||||
if (!(mysql->options.charset_name=
|
||||
my_strdup(MYSQL_DEFAULT_CHARSET_NAME,MYF(MY_WME))))
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
default_collation_name= NULL;
|
||||
|
||||
{
|
||||
const char *save= charsets_dir;
|
||||
@ -1685,6 +1692,28 @@ int mysql_init_character_set(MYSQL *mysql)
|
||||
charsets_dir=mysql->options.charset_dir;
|
||||
mysql->charset=get_charset_by_csname(mysql->options.charset_name,
|
||||
MY_CS_PRIMARY, MYF(MY_WME));
|
||||
if (mysql->charset && default_collation_name)
|
||||
{
|
||||
CHARSET_INFO *collation;
|
||||
if ((collation=
|
||||
get_charset_by_name(default_collation_name, MYF(MY_WME))))
|
||||
{
|
||||
if (!my_charset_same(mysql->charset, collation))
|
||||
{
|
||||
my_printf_error(ER_UNKNOWN_ERROR,
|
||||
"COLLATION %s is not valid for CHARACTER SET %s",
|
||||
MYF(0),
|
||||
default_collation_name, mysql->options.charset_name);
|
||||
mysql->charset= NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
mysql->charset= collation;
|
||||
}
|
||||
}
|
||||
else
|
||||
mysql->charset= NULL;
|
||||
}
|
||||
charsets_dir= save;
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,10 @@ public:
|
||||
{
|
||||
return (null_value=args[0]->get_time(ltime));
|
||||
}
|
||||
bool is_null() { (void) val_int(); return null_value; }
|
||||
bool is_null() {
|
||||
(void) val_int(); /* Discard result. It sets null_value as side-effect. */
|
||||
return null_value;
|
||||
}
|
||||
void signal_divide_by_null();
|
||||
friend class udf_handler;
|
||||
Field *tmp_table_field() { return result_field; }
|
||||
|
@ -1041,7 +1041,7 @@ String *Item_func_left::val_str(String *str)
|
||||
long length =(long) args[1]->val_int();
|
||||
uint char_pos;
|
||||
|
||||
if ((null_value=args[0]->null_value))
|
||||
if ((null_value=(args[0]->null_value || args[1]->null_value)))
|
||||
return 0;
|
||||
if (length <= 0)
|
||||
return &my_empty_string;
|
||||
@ -1081,7 +1081,7 @@ String *Item_func_right::val_str(String *str)
|
||||
String *res =args[0]->val_str(str);
|
||||
long length =(long) args[1]->val_int();
|
||||
|
||||
if ((null_value=args[0]->null_value))
|
||||
if ((null_value=(args[0]->null_value || args[1]->null_value)))
|
||||
return 0; /* purecov: inspected */
|
||||
if (length <= 0)
|
||||
return &my_empty_string; /* purecov: inspected */
|
||||
|
@ -149,8 +149,8 @@ my_bool acl_init(bool dont_read_acl_tables)
|
||||
acl_cache= new hash_filo(ACL_CACHE_SIZE, 0, 0,
|
||||
(hash_get_key) acl_entry_get_key,
|
||||
(hash_free_key) free,
|
||||
/* Use the case sensitive "binary" charset */
|
||||
&my_charset_bin);
|
||||
lower_case_file_system ?
|
||||
system_charset_info : &my_charset_bin);
|
||||
if (dont_read_acl_tables)
|
||||
{
|
||||
DBUG_RETURN(0); /* purecov: tested */
|
||||
|
@ -4041,36 +4041,48 @@ store_top_level_join_columns(THD *thd, TABLE_LIST *table_ref,
|
||||
if (table_ref->nested_join)
|
||||
{
|
||||
List_iterator_fast<TABLE_LIST> nested_it(table_ref->nested_join->join_list);
|
||||
TABLE_LIST *cur_left_neighbor= nested_it++;
|
||||
TABLE_LIST *cur_right_neighbor= NULL;
|
||||
TABLE_LIST *same_level_left_neighbor= nested_it++;
|
||||
TABLE_LIST *same_level_right_neighbor= NULL;
|
||||
/* Left/right-most neighbors, possibly at higher levels in the join tree. */
|
||||
TABLE_LIST *real_left_neighbor, *real_right_neighbor;
|
||||
|
||||
while (cur_left_neighbor)
|
||||
while (same_level_left_neighbor)
|
||||
{
|
||||
TABLE_LIST *cur_table_ref= cur_left_neighbor;
|
||||
cur_left_neighbor= nested_it++;
|
||||
TABLE_LIST *cur_table_ref= same_level_left_neighbor;
|
||||
same_level_left_neighbor= nested_it++;
|
||||
/*
|
||||
The order of RIGHT JOIN operands is reversed in 'join list' to
|
||||
transform it into a LEFT JOIN. However, in this procedure we need
|
||||
the join operands in their lexical order, so below we reverse the
|
||||
join operands. Notice that this happens only in the first loop, and
|
||||
not in the second one, as in the second loop cur_left_neighbor == NULL.
|
||||
This is the correct behavior, because the second loop
|
||||
sets cur_table_ref reference correctly after the join operands are
|
||||
join operands. Notice that this happens only in the first loop,
|
||||
and not in the second one, as in the second loop
|
||||
same_level_left_neighbor == NULL.
|
||||
This is the correct behavior, because the second loop sets
|
||||
cur_table_ref reference correctly after the join operands are
|
||||
swapped in the first loop.
|
||||
*/
|
||||
if (cur_left_neighbor &&
|
||||
if (same_level_left_neighbor &&
|
||||
cur_table_ref->outer_join & JOIN_TYPE_RIGHT)
|
||||
{
|
||||
/* This can happen only for JOIN ... ON. */
|
||||
DBUG_ASSERT(table_ref->nested_join->join_list.elements == 2);
|
||||
swap_variables(TABLE_LIST*, cur_left_neighbor, cur_table_ref);
|
||||
swap_variables(TABLE_LIST*, same_level_left_neighbor, cur_table_ref);
|
||||
}
|
||||
|
||||
/*
|
||||
Pick the parent's left and right neighbors if there are no immediate
|
||||
neighbors at the same level.
|
||||
*/
|
||||
real_left_neighbor= (same_level_left_neighbor) ?
|
||||
same_level_left_neighbor : left_neighbor;
|
||||
real_right_neighbor= (same_level_right_neighbor) ?
|
||||
same_level_right_neighbor : right_neighbor;
|
||||
|
||||
if (cur_table_ref->nested_join &&
|
||||
store_top_level_join_columns(thd, cur_table_ref,
|
||||
cur_left_neighbor, cur_right_neighbor))
|
||||
real_left_neighbor, real_right_neighbor))
|
||||
goto err;
|
||||
cur_right_neighbor= cur_table_ref;
|
||||
same_level_right_neighbor= cur_table_ref;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2135,7 +2135,8 @@ void reinit_stmt_before_use(THD *thd, LEX *lex)
|
||||
Reset old pointers to TABLEs: they are not valid since the tables
|
||||
were closed in the end of previous prepare or execute call.
|
||||
*/
|
||||
tables->table= 0;
|
||||
tables->reinit_before_use(thd);
|
||||
|
||||
/* Reset is_schema_table_processed value(needed for I_S tables */
|
||||
tables->is_schema_table_processed= FALSE;
|
||||
|
||||
|
16
sql/table.cc
16
sql/table.cc
@ -2985,6 +2985,22 @@ Field_iterator_table_ref::get_natural_column_ref()
|
||||
return nj_col;
|
||||
}
|
||||
|
||||
/*
|
||||
Cleanup this table for re-execution.
|
||||
|
||||
SYNOPSIS
|
||||
st_table_list::reinit_before_use()
|
||||
*/
|
||||
|
||||
void st_table_list::reinit_before_use(THD * /* thd */)
|
||||
{
|
||||
/*
|
||||
Reset old pointers to TABLEs: they are not valid since the tables
|
||||
were closed in the end of previous prepare or execute call.
|
||||
*/
|
||||
table= 0;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** Instansiate templates
|
||||
|
@ -668,6 +668,11 @@ typedef struct st_table_list
|
||||
Security_context *find_view_security_context(THD *thd);
|
||||
bool prepare_view_securety_context(THD *thd);
|
||||
#endif
|
||||
/*
|
||||
Cleanup for re-execution in a prepared statement or a stored
|
||||
procedure.
|
||||
*/
|
||||
void reinit_before_use(THD *thd);
|
||||
|
||||
private:
|
||||
bool prep_check_option(THD *thd, uint8 check_opt_type);
|
||||
|
@ -58,6 +58,7 @@ static unsigned int iter_count= 0;
|
||||
static my_bool have_innodb= FALSE;
|
||||
|
||||
static const char *opt_basedir= "./";
|
||||
static const char *opt_vardir= "mysql-test/var";
|
||||
|
||||
static longlong opt_getopt_ll_test= 0;
|
||||
|
||||
@ -14883,6 +14884,7 @@ static void test_bug17667()
|
||||
|
||||
struct buffer_and_length *statement_cursor;
|
||||
FILE *log_file;
|
||||
char *master_log_filename;
|
||||
|
||||
myheader("test_bug17667");
|
||||
|
||||
@ -14894,7 +14896,13 @@ static void test_bug17667()
|
||||
}
|
||||
|
||||
sleep(1); /* The server may need time to flush the data to the log. */
|
||||
log_file= fopen("var/log/master.log", "r");
|
||||
|
||||
master_log_filename = (char *) malloc(strlen(opt_vardir) + strlen("/log/master.log") + 1);
|
||||
strcpy(master_log_filename, opt_vardir);
|
||||
strcat(master_log_filename, "/log/master.log");
|
||||
log_file= fopen(master_log_filename, "r");
|
||||
free(master_log_filename);
|
||||
|
||||
if (log_file != NULL) {
|
||||
|
||||
for (statement_cursor= statements; statement_cursor->buffer != NULL;
|
||||
@ -14918,7 +14926,7 @@ static void test_bug17667()
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Could not find the log file, var/log/master.log, so "
|
||||
fprintf(stderr, "Could not find the log file, VARDIR/log/master.log, so "
|
||||
"test_bug17667 is \ninconclusive. Run test from the "
|
||||
"mysql-test/mysql-test-run* program \nto set up the correct "
|
||||
"environment for this test.\n\n");
|
||||
@ -15062,6 +15070,8 @@ static struct my_option client_test_long_options[] =
|
||||
{"user", 'u', "User for login if not current user", (char **) &opt_user,
|
||||
(char **) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif
|
||||
{"vardir", 'v', "Data dir for tests.", (gptr*) &opt_vardir,
|
||||
(gptr*) &opt_vardir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"getopt-ll-test", 'g', "Option for testing bug in getopt library",
|
||||
(char **) &opt_getopt_ll_test, (char **) &opt_getopt_ll_test, 0,
|
||||
GET_LL, REQUIRED_ARG, 0, 0, LONGLONG_MAX, 0, 0, 0},
|
||||
|
Reference in New Issue
Block a user