Commit 090c339a authored by unknown's avatar unknown

Merge bk-internal.mysql.com:/data0/bk/mysql-5.0

into  bk-internal.mysql.com:/data0/bk/mysql-5.0-kt
parents 10cb018b 155de819
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
Optimization="0" Optimization="0"
OptimizeForProcessor="2" OptimizeForProcessor="2"
AdditionalIncludeDirectories="../include,../zlib" AdditionalIncludeDirectories="../include,../zlib"
PreprocessorDefinitions="__NT__;_DEBUG;SAFEMALLOC;SAFE_MUTEX;_WINDOWS;USE_SYMDIR" PreprocessorDefinitions="_DEBUG;SAFEMALLOC;SAFE_MUTEX;_WINDOWS;USE_SYMDIR"
RuntimeLibrary="1" RuntimeLibrary="1"
PrecompiledHeaderFile=".\debug/mysys.pch" PrecompiledHeaderFile=".\debug/mysys.pch"
AssemblerListingLocation=".\debug/" AssemblerListingLocation=".\debug/"
......
...@@ -43,7 +43,10 @@ ...@@ -43,7 +43,10 @@
OutputFile="../client_classic/mysqld-nt.exe" OutputFile="../client_classic/mysqld-nt.exe"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="" GenerateDebugInformation="TRUE"
ProgramDatabaseFile="../client_classic/mysqld-nt.pdb"
GenerateMapFile="TRUE"
MapFileName="../client_classic/mysqld-nt.map"
SubSystem="1" SubSystem="1"
TargetMachine="1"/> TargetMachine="1"/>
<Tool <Tool
...@@ -104,6 +107,10 @@ ...@@ -104,6 +107,10 @@
OutputFile="../client_release/mysqld-max.exe" OutputFile="../client_release/mysqld-max.exe"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="../client_release/mysqld-max.pdb"
GenerateMapFile="TRUE"
MapFileName="../client_release/mysqld-max.map"
SubSystem="1" SubSystem="1"
TargetMachine="1"/> TargetMachine="1"/>
<Tool <Tool
...@@ -164,9 +171,10 @@ ...@@ -164,9 +171,10 @@
OutputFile="../client_release/mysqld-max-nt.exe" OutputFile="../client_release/mysqld-max-nt.exe"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"
ProgramDatabaseFile=".\max_nt/mysqld-max-nt.pdb" GenerateDebugInformation="TRUE"
ProgramDatabaseFile="../client_release/mysqld-max-nt.pdb"
GenerateMapFile="TRUE" GenerateMapFile="TRUE"
MapFileName=".\max_nt/mysqld-max-nt.map" MapFileName="../client_release/mysqld-max-nt.map"
SubSystem="1" SubSystem="1"
TargetMachine="1"/> TargetMachine="1"/>
<Tool <Tool
...@@ -227,9 +235,10 @@ ...@@ -227,9 +235,10 @@
OutputFile="../client_release/mysqld-nt.exe" OutputFile="../client_release/mysqld-nt.exe"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"
ProgramDatabaseFile=".\nt/mysqld-nt.pdb" GenerateDebugInformation="TRUE"
ProgramDatabaseFile="../client_release/mysqld-nt.pdb"
GenerateMapFile="TRUE" GenerateMapFile="TRUE"
MapFileName=".\nt/mysqld-nt.map" MapFileName="../client_release/mysqld-nt.map"
SubSystem="1" SubSystem="1"
TargetMachine="1"/> TargetMachine="1"/>
<Tool <Tool
...@@ -290,7 +299,10 @@ ...@@ -290,7 +299,10 @@
OutputFile="../client_pro/mysqld-nt.exe" OutputFile="../client_pro/mysqld-nt.exe"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="" GenerateDebugInformation="TRUE"
ProgramDatabaseFile="../client_pro/mysqld-nt.pdb"
GenerateMapFile="TRUE"
MapFileName="../client_pro/mysqld-nt.map"
SubSystem="1" SubSystem="1"
TargetMachine="1"/> TargetMachine="1"/>
<Tool <Tool
...@@ -350,7 +362,9 @@ ...@@ -350,7 +362,9 @@
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE" GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\debug/mysqld-debug.pdb" ProgramDatabaseFile="../client_debug/mysqld-debug.pdb"
GenerateMapFile="TRUE"
MapFileName="../client_debug/mysqld-debug.map"
SubSystem="1" SubSystem="1"
TargetMachine="1"/> TargetMachine="1"/>
<Tool <Tool
...@@ -411,7 +425,10 @@ ...@@ -411,7 +425,10 @@
OutputFile="../client_pro/mysqld.exe" OutputFile="../client_pro/mysqld.exe"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="" GenerateDebugInformation="TRUE"
ProgramDatabaseFile="../client_pro/mysqld.pdb"
GenerateMapFile="TRUE"
MapFileName="../client_pro/mysqld.map"
SubSystem="1" SubSystem="1"
TargetMachine="1"/> TargetMachine="1"/>
<Tool <Tool
...@@ -472,7 +489,10 @@ ...@@ -472,7 +489,10 @@
OutputFile="../client_classic/mysqld.exe" OutputFile="../client_classic/mysqld.exe"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="" GenerateDebugInformation="TRUE"
ProgramDatabaseFile="../client_classic/mysqld.pdb"
GenerateMapFile="TRUE"
MapFileName="../client_classic/mysqld.map"
SubSystem="1" SubSystem="1"
TargetMachine="1"/> TargetMachine="1"/>
<Tool <Tool
...@@ -533,6 +553,10 @@ ...@@ -533,6 +553,10 @@
OutputFile="../client_release/mysqld.exe" OutputFile="../client_release/mysqld.exe"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="../client_release/mysqld.pdb"
GenerateMapFile="TRUE"
MapFileName="../client_release/mysqld.map"
SubSystem="1" SubSystem="1"
TargetMachine="1"/> TargetMachine="1"/>
<Tool <Tool
......
...@@ -276,7 +276,7 @@ select * from t1; ...@@ -276,7 +276,7 @@ select * from t1;
N M N M
3 0 3 0
delete P1.*,p2.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS p2 ON P1.N = p2.N; delete P1.*,p2.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS p2 ON P1.N = p2.N;
ERROR HY000: The target table p2 of the DELETE is not updatable ERROR 42S02: Unknown table 'p2' in MULTI DELETE
delete P1.* from `t1` AS P1 INNER JOIN (SELECT aaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N; delete P1.* from `t1` AS P1 INNER JOIN (SELECT aaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
ERROR 42S22: Unknown column 'aaa' in 'field list' ERROR 42S22: Unknown column 'aaa' in 'field list'
drop table t1; drop table t1;
......
...@@ -5057,4 +5057,19 @@ concat('data was: /', var1, '/') ...@@ -5057,4 +5057,19 @@ concat('data was: /', var1, '/')
data was: /1/ data was: /1/
drop table t3| drop table t3|
drop procedure bug15217| drop procedure bug15217|
drop table if exists t3|
drop database if exists mysqltest1|
create table t3 (a int)|
insert into t3 (a) values (1), (2)|
create database mysqltest1|
use mysqltest1|
drop database mysqltest1|
select database()|
database()
NULL
select * from (select 1 as a) as t1 natural join (select * from test.t3) as t2|
a
1
use test|
drop table t3|
drop table t1,t2; drop table t1,t2;
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -157,7 +157,7 @@ UPDATE `t1` AS P1 INNER JOIN (SELECT aaaa FROM `t1` GROUP BY N HAVING Count(M) > ...@@ -157,7 +157,7 @@ UPDATE `t1` AS P1 INNER JOIN (SELECT aaaa FROM `t1` GROUP BY N HAVING Count(M) >
delete P1.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N; delete P1.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
select * from t1; select * from t1;
--replace_result P2 p2 --replace_result P2 p2
--error 1288 --error ER_UNKNOWN_TABLE
delete P1.*,P2.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N; delete P1.*,P2.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
-- error 1054 -- error 1054
delete P1.* from `t1` AS P1 INNER JOIN (SELECT aaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N; delete P1.* from `t1` AS P1 INNER JOIN (SELECT aaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
......
...@@ -5962,6 +5962,31 @@ call bug15217()| ...@@ -5962,6 +5962,31 @@ call bug15217()|
drop table t3| drop table t3|
drop procedure bug15217| drop procedure bug15217|
#
# Bug#21002 "Derived table not selecting from a "real" table fails in JOINs"
#
# A regression caused by the fix for Bug#18444: for derived tables we should
# set an empty string as the current database. They do not belong to any
# database and must be usable even if there is no database
# selected.
--disable_warnings
drop table if exists t3|
drop database if exists mysqltest1|
--enable_warnings
create table t3 (a int)|
insert into t3 (a) values (1), (2)|
create database mysqltest1|
use mysqltest1|
drop database mysqltest1|
# No current database
select database()|
select * from (select 1 as a) as t1 natural join (select * from test.t3) as t2|
use test|
drop table t3|
# #
# BUG#NNNN: New bug synopsis # BUG#NNNN: New bug synopsis
# #
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
OutputFile="../../client_debug/mysqlmanager.exe" OutputFile="../../client_debug/mysqlmanager.exe"
LinkIncremental="2" LinkIncremental="2"
GenerateDebugInformation="TRUE" GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/mysqlmanager.pdb" ProgramDatabaseFile="../../client_debug/mysqlmanager.pdb"
SubSystem="1" SubSystem="1"
TargetMachine="1"/> TargetMachine="1"/>
<Tool <Tool
......
...@@ -3717,15 +3717,12 @@ log space"); ...@@ -3717,15 +3717,12 @@ log space");
write_ignored_events_info_to_relay_log(thd, mi); write_ignored_events_info_to_relay_log(thd, mi);
thd->proc_info = "Waiting for slave mutex on exit"; thd->proc_info = "Waiting for slave mutex on exit";
pthread_mutex_lock(&mi->run_lock); pthread_mutex_lock(&mi->run_lock);
mi->slave_running = 0;
mi->io_thd = 0;
/* Forget the relay log's format */ /* Forget the relay log's format */
delete mi->rli.relay_log.description_event_for_queue; delete mi->rli.relay_log.description_event_for_queue;
mi->rli.relay_log.description_event_for_queue= 0; mi->rli.relay_log.description_event_for_queue= 0;
// TODO: make rpl_status part of MASTER_INFO // TODO: make rpl_status part of MASTER_INFO
change_rpl_status(RPL_ACTIVE_SLAVE,RPL_IDLE_SLAVE); change_rpl_status(RPL_ACTIVE_SLAVE,RPL_IDLE_SLAVE);
mi->abort_slave = 0; // TODO: check if this is needed
DBUG_ASSERT(thd->net.buff != 0); DBUG_ASSERT(thd->net.buff != 0);
net_end(&thd->net); // destructor will not free it, because net.vio is 0 net_end(&thd->net); // destructor will not free it, because net.vio is 0
close_thread_tables(thd, 0); close_thread_tables(thd, 0);
...@@ -3733,8 +3730,11 @@ log space"); ...@@ -3733,8 +3730,11 @@ log space");
THD_CHECK_SENTRY(thd); THD_CHECK_SENTRY(thd);
delete thd; delete thd;
pthread_mutex_unlock(&LOCK_thread_count); pthread_mutex_unlock(&LOCK_thread_count);
pthread_cond_broadcast(&mi->stop_cond); // tell the world we are done mi->abort_slave= 0;
mi->slave_running= 0;
mi->io_thd= 0;
pthread_mutex_unlock(&mi->run_lock); pthread_mutex_unlock(&mi->run_lock);
pthread_cond_broadcast(&mi->stop_cond); // tell the world we are done
#ifndef DBUG_OFF #ifndef DBUG_OFF
if (abort_slave_event_count && !events_till_abort) if (abort_slave_event_count && !events_till_abort)
goto slave_begin; goto slave_begin;
......
...@@ -1846,7 +1846,6 @@ sp_use_new_db(THD *thd, LEX_STRING new_db, LEX_STRING *old_db, ...@@ -1846,7 +1846,6 @@ sp_use_new_db(THD *thd, LEX_STRING new_db, LEX_STRING *old_db,
bool no_access_check, bool *dbchangedp) bool no_access_check, bool *dbchangedp)
{ {
int ret; int ret;
static char empty_c_string[1]= {0}; /* used for not defined db */
DBUG_ENTER("sp_use_new_db"); DBUG_ENTER("sp_use_new_db");
DBUG_PRINT("enter", ("newdb: %s", new_db.str)); DBUG_PRINT("enter", ("newdb: %s", new_db.str));
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
table name table name
*/ */
char internal_table_name[2]= "*"; char internal_table_name[2]= "*";
char empty_c_string[1]= {0}; /* used for not defined db */
const char * const THD::DEFAULT_WHERE= "field list"; const char * const THD::DEFAULT_WHERE= "field list";
......
...@@ -41,6 +41,7 @@ enum enum_check_fields { CHECK_FIELD_IGNORE, CHECK_FIELD_WARN, ...@@ -41,6 +41,7 @@ enum enum_check_fields { CHECK_FIELD_IGNORE, CHECK_FIELD_WARN,
CHECK_FIELD_ERROR_FOR_NULL }; CHECK_FIELD_ERROR_FOR_NULL };
extern char internal_table_name[2]; extern char internal_table_name[2];
extern char empty_c_string[1];
extern const char **errmesg; extern const char **errmesg;
#define TC_LOG_PAGE_SIZE 8192 #define TC_LOG_PAGE_SIZE 8192
...@@ -1983,11 +1984,21 @@ class Table_ident :public Sql_alloc ...@@ -1983,11 +1984,21 @@ class Table_ident :public Sql_alloc
{ {
db.str=0; db.str=0;
} }
/*
This constructor is used only for the case when we create a derived
table. A derived table has no name and doesn't belong to any database.
Later, if there was an alias specified for the table, it will be set
by add_table_to_list.
*/
inline Table_ident(SELECT_LEX_UNIT *s) : sel(s) inline Table_ident(SELECT_LEX_UNIT *s) : sel(s)
{ {
/* We must have a table name here as this is used with add_table_to_list */ /* We must have a table name here as this is used with add_table_to_list */
db.str=0; table.str= internal_table_name; table.length=1; db.str= empty_c_string; /* a subject to casedn_str */
db.length= 0;
table.str= internal_table_name;
table.length=1;
} }
bool is_derived_table() const { return test(sel); }
inline void change_db(char *db_name) inline void change_db(char *db_name)
{ {
db.str= db_name; db.length= (uint) strlen(db_name); db.str= db_name; db.length= (uint) strlen(db_name);
......
...@@ -6118,8 +6118,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, ...@@ -6118,8 +6118,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
if (!table) if (!table)
DBUG_RETURN(0); // End of memory DBUG_RETURN(0); // End of memory
alias_str= alias ? alias->str : table->table.str; alias_str= alias ? alias->str : table->table.str;
if (check_table_name(table->table.str,table->table.length) || if (check_table_name(table->table.str, table->table.length))
table->db.str && check_db_name(table->db.str))
{ {
my_error(ER_WRONG_TABLE_NAME, MYF(0), table->table.str); my_error(ER_WRONG_TABLE_NAME, MYF(0), table->table.str);
DBUG_RETURN(0); DBUG_RETURN(0);
...@@ -6140,6 +6139,11 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, ...@@ -6140,6 +6139,11 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
DBUG_RETURN(0); /* purecov: inspected */ DBUG_RETURN(0); /* purecov: inspected */
if (table->db.str) if (table->db.str)
{ {
if (table->is_derived_table() == FALSE && check_db_name(table->db.str))
{
my_error(ER_WRONG_DB_NAME, MYF(0), table->db.str);
DBUG_RETURN(0);
}
ptr->db= table->db.str; ptr->db= table->db.str;
ptr->db_length= table->db.length; ptr->db_length= table->db.length;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment