summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2006-03-08 11:06:01 -0800
committerunknown <jimw@mysql.com>2006-03-08 11:06:01 -0800
commite99b11d3696ce63aa0f584241cc1a5b324597069 (patch)
tree2fe6846f327e00e58008b6fcb3148f8199d36ccd
parent56df722382767cb8ac272607f5e3fbaa0839661d (diff)
downloadmariadb-git-e99b11d3696ce63aa0f584241cc1a5b324597069.tar.gz
Bug #14673: Wrong InnoDB default row format
Make partitioned tables report the row format of the underlying tables (when they are all the same). mysql-test/r/partition.result: Add new results mysql-test/t/partition.test: Add regression test sql/ha_partition.cc: Add get_row_type(), which peeks at the underlying tables and returns the row_type if they are consistent. sql/ha_partition.h: Add get_row_type() method
-rw-r--r--mysql-test/r/partition.result5
-rw-r--r--mysql-test/t/partition.test7
-rw-r--r--sql/ha_partition.cc16
-rw-r--r--sql/ha_partition.h3
4 files changed, 31 insertions, 0 deletions
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index 59e29046d90..52f509f6187 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -422,4 +422,9 @@ partition_name partition_description table_rows
x123 11,12 1
x234 NULL,1 1
drop table t1;
+create table t1 (a int) engine=innodb partition by hash(a) ;
+show table status like 't1';
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 PARTITION 10 Compact 2 8192 16384 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+drop table t1;
End of 5.1 tests
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index f22edb54756..75a7df9b1d8 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -540,4 +540,11 @@ select partition_name, partition_description, table_rows
from information_schema.partitions where table_schema ='test';
drop table t1;
+#
+# Bug #14673: Wrong InnoDB default row format
+#
+create table t1 (a int) engine=innodb partition by hash(a) ;
+show table status like 't1';
+drop table t1;
+
--echo End of 5.1 tests
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 14fa9f0393c..60a31d97649 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -5115,6 +5115,22 @@ const char *ha_partition::index_type(uint inx)
}
+enum row_type ha_partition::get_row_type() const
+{
+ handler **file;
+ enum row_type type= (*m_file)->get_row_type();
+
+ for (file= m_file, file++; *file; file++)
+ {
+ enum row_type part_type= (*file)->get_row_type();
+ if (part_type != type)
+ return ROW_TYPE_NOT_USED;
+ }
+
+ return type;
+}
+
+
void ha_partition::print_error(int error, myf errflag)
{
DBUG_ENTER("ha_partition::print_error");
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index f828cc65ed3..32ea75fabf0 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -527,6 +527,9 @@ public:
virtual const char *table_type() const
{ return "PARTITION"; }
+ /* The name of the row type used for the underlying tables. */
+ virtual enum row_type get_row_type() const;
+
/*
Handler specific error messages
*/