diff options
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r-- | sql/sql_show.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc index ecdf74a1fef..41e145790e9 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1479,6 +1479,24 @@ store_create_info(THD *thd, TABLE *table, String *packet) packet->append(" ENGINE=", 8); packet->append(file->table_type()); + /* + Add AUTO_INCREMENT=... if there is an AUTO_INCREMENT column, + and NEXT_ID > 1 (the default). We must not print the clause + for engines that do not support this as it would break the + import of dumps, but as of this writing, the test for whether + AUTO_INCREMENT columns are allowed and wether AUTO_INCREMENT=... + is supported is identical, !(file->table_flags() & HA_NO_AUTO_INCREMENT)) + Because of that, we do not explicitly test for the feature, + but may extrapolate its existence from that of an AUTO_INCREMENT column. + */ + + if(create_info.auto_increment_value > 1) + { + packet->append(" AUTO_INCREMENT=", 16); + end= longlong10_to_str(create_info.auto_increment_value, buff,10); + packet->append(buff, (uint) (end - buff)); + } + if (table->table_charset && !(thd->variables.sql_mode & MODE_MYSQL323) && !(thd->variables.sql_mode & MODE_MYSQL40)) |