diff options
author | unknown <gluh@eagle.intranet.mysql.r18.ru> | 2006-04-10 20:54:42 +0500 |
---|---|---|
committer | unknown <gluh@eagle.intranet.mysql.r18.ru> | 2006-04-10 20:54:42 +0500 |
commit | b04dd7e2486c93a31dc2cd58cf8c89f182469b03 (patch) | |
tree | bfe95678fa7d473fefb73ab8da7306cdfc431dd6 /sql/ha_partition.cc | |
parent | e0a19fd9043de0047d759e6978f0fc582452fab0 (diff) | |
download | mariadb-git-b04dd7e2486c93a31dc2cd58cf8c89f182469b03.tar.gz |
Fix for bug#18753 Partitions: auto_increment fails
Current auto increment value is placed in partition in which latest
record was saved. So to get auto_increment they have to scan
all partitions and return max value.
mysql-test/r/partition.result:
Fix for bug#18753 Partitions: auto_increment fails
test case
mysql-test/t/partition.test:
Fix for bug#18753 Partitions: auto_increment fails
test case
Diffstat (limited to 'sql/ha_partition.cc')
-rw-r--r-- | sql/ha_partition.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 7cf841a5d71..3f74b555f4a 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -4201,11 +4201,7 @@ void ha_partition::info(uint flag) if (flag & HA_STATUS_AUTO) { DBUG_PRINT("info", ("HA_STATUS_AUTO")); - /* - The auto increment value is only maintained by the first handler - so we will only call this. - */ - m_file[0]->info(HA_STATUS_AUTO); + auto_increment_value= get_auto_increment(); } if (flag & HA_STATUS_VARIABLE) { @@ -5349,9 +5345,15 @@ void ha_partition::restore_auto_increment() ulonglong ha_partition::get_auto_increment() { + ulonglong auto_inc, max_auto_inc= 0; DBUG_ENTER("ha_partition::get_auto_increment"); - DBUG_RETURN(m_file[0]->get_auto_increment()); + for (uint i= 0; i < m_tot_parts; i++) + { + auto_inc= m_file[i]->get_auto_increment(); + set_if_bigger(max_auto_inc, auto_inc); + } + DBUG_RETURN(max_auto_inc); } |