summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorArun Kuruvila <arun.kuruvila@oracle.com>2015-01-28 09:43:34 +0530
committerArun Kuruvila <arun.kuruvila@oracle.com>2015-01-28 09:43:34 +0530
commit08526dfb0109a5809101ec7818a9514b2f5ea606 (patch)
treee827f3110f83527a4b60c42db1e0e54fd18b2f0a /sql/sql_table.cc
parentaa1de7372846e3a37c87b7488d34426264d7da44 (diff)
downloadmariadb-git-08526dfb0109a5809101ec7818a9514b2f5ea606.tar.gz
Bug #12671631 CREATE TABLE .. LIKE .. FEDERATED TABLE
CRASHES WITH AUTO_INCREMENT COLUMN Description:- Creating a federated table with AUTO_INCREMENT column using LIKE clause results in a server crash. Analysis:- Creating a federated table with AUTO_INCREMENT column using LIKE clause results in a federated server crash due to the uninitialized connection structure(mysql). Also due to unassigned connection string for the remote server, at the time of preparation of "create_info" structure, the creation of any federated table using LIKE clause fails with an error, "ERROR 1 (HY000): server name: '' doesn't exist!". This bug is not only with AUTO_INCREMENT but in all creations of federated tables with LIKE clause. Fix :- In ha_federated::info(), "mysql->insert_id" assigned to "stats.auto_increment_value" only when there is an active connection. This fixes the crash issue. For creating the federated table with LIKE clause, connection string is assigned at the time of preparation of "create_info" structure.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index e8de6a6928a..096e3d6be0f 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -5365,6 +5365,10 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
if (create_info->storage_media == HA_SM_DEFAULT)
create_info->storage_media= table->s->default_storage_media;
+ /* Creation of federated table with LIKE clause needs connection string */
+ if (!(used_fields & HA_CREATE_USED_CONNECTION))
+ create_info->connect_string= table->s->connect_string;
+
restore_record(table, s->default_values); // Empty record for DEFAULT
Create_field *def;