mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
A fix and a test case for Bug#21002 "Derived table not selecting from a
"real" table fails in JOINs". This is a regression caused by the fix for Bug 18444. This fix removed the assignment of empty_c_string to table->db performed in add_table_to_list, as neither me nor anyone else knew what it was there for. Now we know it and it's covered with tests: the only case when a table database name can be empty is when the table is a derived table. The fix puts the assignment back but makes it a bit more explicit. Additionally, finally drop sp.result.orig which was checked in by mistake.
This commit is contained in:
@ -41,6 +41,7 @@ enum enum_check_fields { CHECK_FIELD_IGNORE, CHECK_FIELD_WARN,
|
||||
CHECK_FIELD_ERROR_FOR_NULL };
|
||||
|
||||
extern char internal_table_name[2];
|
||||
extern char empty_c_string[1];
|
||||
extern const char **errmesg;
|
||||
|
||||
#define TC_LOG_PAGE_SIZE 8192
|
||||
@ -1977,11 +1978,21 @@ public:
|
||||
{
|
||||
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)
|
||||
{
|
||||
/* 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)
|
||||
{
|
||||
db.str= db_name; db.length= (uint) strlen(db_name);
|
||||
|
Reference in New Issue
Block a user