Commit 3e463dda authored by unknown's avatar unknown

Bug #17005 Ndb partition handling for create table like is broken

parent 76d8dd3e
...@@ -9592,6 +9592,7 @@ bool ha_ndbcluster::get_no_parts(const char *name, uint *no_parts) ...@@ -9592,6 +9592,7 @@ bool ha_ndbcluster::get_no_parts(const char *name, uint *no_parts)
break; break;
} }
ndb= get_ndb(); ndb= get_ndb();
ndb->setDatabaseName(m_dbname);
dict= ndb->getDictionary(); dict= ndb->getDictionary();
if (!(tab= dict->getTable(m_tabname))) if (!(tab= dict->getTable(m_tabname)))
ERR_BREAK(dict->getNdbError(), err); ERR_BREAK(dict->getNdbError(), err);
......
...@@ -250,14 +250,14 @@ char *are_partitions_in_table(partition_info *new_part_info, ...@@ -250,14 +250,14 @@ char *are_partitions_in_table(partition_info *new_part_info,
FALSE Success FALSE Success
*/ */
bool partition_default_handling(TABLE *table, partition_info *part_info) bool partition_default_handling(TABLE *table, partition_info *part_info,
const char *normalized_path)
{ {
DBUG_ENTER("partition_default_handling"); DBUG_ENTER("partition_default_handling");
if (part_info->use_default_no_partitions) if (part_info->use_default_no_partitions)
{ {
if (table->file->get_no_parts(table->s->normalized_path.str, if (table->file->get_no_parts(normalized_path, &part_info->no_parts))
&part_info->no_parts))
{ {
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
...@@ -266,8 +266,7 @@ bool partition_default_handling(TABLE *table, partition_info *part_info) ...@@ -266,8 +266,7 @@ bool partition_default_handling(TABLE *table, partition_info *part_info)
part_info->use_default_no_subpartitions) part_info->use_default_no_subpartitions)
{ {
uint no_parts; uint no_parts;
if (table->file->get_no_parts(table->s->normalized_path.str, if (table->file->get_no_parts(normalized_path, &no_parts))
&no_parts))
{ {
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
...@@ -2005,7 +2004,8 @@ bool fix_partition_func(THD *thd, const char* name, TABLE *table, ...@@ -2005,7 +2004,8 @@ bool fix_partition_func(THD *thd, const char* name, TABLE *table,
if (!is_create_table_ind) if (!is_create_table_ind)
{ {
if (partition_default_handling(table, part_info)) if (partition_default_handling(table, part_info,
table->s->normalized_path.str))
{ {
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
...@@ -3901,9 +3901,15 @@ bool mysql_unpack_partition(THD *thd, const uchar *part_buf, ...@@ -3901,9 +3901,15 @@ bool mysql_unpack_partition(THD *thd, const uchar *part_buf,
old_lex->name contains the t2 and the table we are opening has old_lex->name contains the t2 and the table we are opening has
name t1. name t1.
*/ */
if (partition_default_handling(table, part_info)) Table_ident *table_ident= (Table_ident *)old_lex->name;
char *src_db= table_ident->db.str ? table_ident->db.str : thd->db;
char *src_table= table_ident->table.str;
char buf[FN_REFLEN];
build_table_filename(buf, sizeof(buf), src_db, src_table, "");
if (partition_default_handling(table, part_info, buf))
{ {
DBUG_RETURN(TRUE); result= TRUE;
goto end;
} }
} }
else else
......
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