summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authormonty@hundin.mysql.fi <>2001-08-29 17:33:41 +0300
committermonty@hundin.mysql.fi <>2001-08-29 17:33:41 +0300
commit2f93aa9e51559f1a681544c1e0b7be4706e3fe24 (patch)
tree3d579fb9d02e1fa69457e4ec1706fb325190d90c /sql/sql_parse.cc
parent788bc3f43bb20915e5ae733f868f98cbce85fdcc (diff)
downloadmariadb-git-2f93aa9e51559f1a681544c1e0b7be4706e3fe24.tar.gz
Test that all MERGE tables comes from the same database
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 2e5333925e7..99fc0fc8fbf 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2178,10 +2178,18 @@ static bool check_merge_table_access(THD *thd, char *db,
int error=0;
if (table_list)
{
- /* Force all tables to use the current database */
+ /* Check that all tables use the current database */
TABLE_LIST *tmp;
for (tmp=table_list; tmp ; tmp=tmp->next)
- tmp->db=db;
+ {
+ if (!tmp->db || !tmp->db[0])
+ tmp->db=db;
+ else if (!strcmp(tmp->db,db))
+ {
+ send_error(&thd->net,ER_UNION_TABLES_IN_DIFFERENT_DIR);
+ return 1;
+ }
+ }
error=check_table_access(thd, SELECT_ACL | UPDATE_ACL | DELETE_ACL,
table_list);
}