Hi Kathryn!
On Mon, 2007-10-22 at 23:09 -0500, Kathryn Steinbrink wrote:
> It is documented in the MySQL 5.1 Reference that the SHOW CREATE TABLE
> statement can be used to show the statement syntax that was used to create
> the specified table. For the auto_increment table option, the value that
> is returned is the 'next value' that will be generated for the
> auto_increment column. Offhand, this seems wrong. I would have expected
> the original auto_increment= value to be displayed that was indeed
> specified on the original CREATE TABLE (or ALTER TABLE) statement. Can you
> please comment?
>
> If a storage engine has access to the original value, is it okay to return
> the original value instead of the 'next value'? (If not, why not?)
The (real) purpose behind SHOW CREATE TABLE is to enable things like
mysqldump to exist.
However... users like it too :)
The aim is to produce an SQL statement that will create the table as it
currently is (all ALTERS etc taken into account). Since the
auto_increment column is affected by normal queries, it should also be
taken into account as it's part of the current state.
i.e. SHOW CREATE TABLE is showing the CREATE statement needed to create
the table as it exists *now*.
Any other behaviour (e.g. original auto_inc value) would be inconsistent
with the rest of the output (else you'd expect CREATE + a bunch of
ALTER TABLE).
You could possibly display this information in the comment field (which
ends up in INFORMATION_SCHEMA at least).
If you have other metadata that makes sense to export,
INFORMATION_SCHEMA plugins are rather easy too, so you could always
export it there.
hope this helps,
stewart
--
Stewart Smith, Senior Software Engineer
MySQL AB, www.mysql.com
Office: +14082136540 Ext: 6616
VoIP: 6616@stripped
Mobile: +61 4 3 8844 332
Jumpstart your cluster:
http://www.mysql.com/consulting/packaged/cluster.html
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc