summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorunknown <Sinisa@sinisa.nasamreza.org>2001-07-19 13:34:45 +0300
committerunknown <Sinisa@sinisa.nasamreza.org>2001-07-19 13:34:45 +0300
commitb588c6064638bd9245871cd840695854c1454e8b (patch)
treeb278e5e15e9edfd555fd2e72df452b45526e7cc5 /sql/sql_parse.cc
parent8e3872f34e26149437952832330814abb4438772 (diff)
parentcccb3aaf70ea1fafc629bcdedd9a2f019629c790 (diff)
downloadmariadb-git-b588c6064638bd9245871cd840695854c1454e8b.tar.gz
Merge sinisa@work.mysql.com:/home/bk/mysql-4.0
into sinisa.nasamreza.org:/mnt/hdc/Sinisa/mysql-4.0 sql/sql_insert.cc: Auto merged sql/sql_parse.cc: Auto merged
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc21
1 files changed, 19 insertions, 2 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 981e64e5de5..ea8e5980852 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1754,7 +1754,15 @@ mysql_execute_command(void)
break;
}
if (!(res=open_and_lock_tables(thd,(TABLE_LIST *)total->first)))
+ {
+ /* Fix tables--to-be-unioned-from list to point at opened tables */
+ for (SELECT_LEX *sl=&lex->select_lex;sl;sl=sl->next)
+ {
+ for (TABLE_LIST *cursor=(TABLE_LIST *)sl->table_list.first;cursor;cursor=cursor->next)
+ cursor->table= ((TABLE_LIST*) cursor->table)->table;
+ }
res=mysql_union(thd,lex, select_lex->select_number+1);
+ }
close_thread_tables(thd);
break;
}
@@ -2894,11 +2902,12 @@ TABLE_LIST *add_table_to_list(Table_ident *table, LEX_STRING *alias,
static int link_in_large_list_and_check_acl(THD *thd,LEX *lex,SQL_LIST *tables)
{
SELECT_LEX *sl; const char *current_db=thd->db ? thd->db : "";
+ TABLE_LIST *ptr;
for (sl=&lex->select_lex;sl;sl=sl->next)
{
if ((lex->sql_command == SQLCOM_UNION_SELECT) && (sl->order_list.first != (byte *)NULL) && (sl->next != (st_select_lex *)NULL))
{
- net_printf(&thd->net,ER_ILLEGAL_GRANT_FOR_TABLE); // correct error message will come here; only last SELECt can have ORDER BY
+ net_printf(&thd->net,ER_ILLEGAL_GRANT_FOR_TABLE); // correct error message will come here; only last SELECT can have ORDER BY
return -1;
}
if (sl->table_list.first == (byte *)NULL) continue;
@@ -2919,7 +2928,15 @@ static int link_in_large_list_and_check_acl(THD *thd,LEX *lex,SQL_LIST *tables)
aux->lock_type= lex->lock_option;
if (!tables->next)
tables->next= (byte**) &tables->first;
- link_in_list(tables,(byte*)aux,(byte**) &aux->next);
+ if (!(ptr = (TABLE_LIST *) thd->calloc(sizeof(TABLE_LIST))))
+ return 1;
+ ptr->db= aux->db; ptr->real_name=aux->real_name;
+ ptr->name=aux->name; ptr->lock_type=aux->lock_type;
+ ptr->updating=aux->updating;
+ ptr->use_index=aux->use_index;
+ ptr->ignore_index=aux->use_index;
+ aux->table=(TABLE *)ptr;
+ link_in_list(tables,(byte*)ptr,(byte**) &ptr->next);
}
}
}