Afficher un message
Vieux 13/02/2008, 17h52   #6
Peter H. Coffin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: mysqldump not including auto_increment statements

On Wed, 13 Feb 2008 07:38:50 -0800 (PST), lawpoop@gmail.com wrote:
> On Feb 12, 3:32 pm, "Peter H. Coffin" <hell...@ninehells.com> wrote:
>> On Tue, 12 Feb 2008 12:33:24 -0800 (PST), lawp...@gmail.com wrote:
>>
>> > If you run a mysqldump with --skip-opt, do you get the auto_increments
>> > in your create table statements? The man page for mysqldump says that
>> > --opt is shorthand for the following switches: --add-drop-table, --add-
>> > locks, --all, --extended-insert, --quick, --lock-tables . The man page
>> > doesn't mention anything about auto_increment for any of those
>> > switches; in fact, it doesn't mention auto_increment at all. I'm
>> > guessing it's the --all switch ( "Include all MySQL specific create
>> > options." ) that includes the auto_increment statements?

>>
>> Looks like you've got it sussed. --all on my mysqldump is
>> --create-options; dropping it spits out this table def for the same
>> database:

>
><snip>
>
> It would be nice if that were mentioned in the man or docs
> somewhere Is the auto_increment non ANSI standard SQL? I can't
> imagine a scenario where you wouldn't want the auto_increments
> included in your dumps, unless you were creating a universal ANSI sql
> file.


Nope, it's not standard SQL at all. DB2 (the RDBMS I'm otherwise
most familiar with) has two different ways of doing kind of what
auto-increment does: SEQUENCEs and IDENTITYs. IDENTITYs work a lot like
autoincrement. SEQUENCES are magic ways of coming up with values across
the whole database, by name, and you plug them into records yourself.
Every time something anywhere on the database instance ask for the
value of a named sequence, it gets the next value in line, subject to
a whole lot of conditions (max value, min value, how many values to
skip, whether the values are allow to roll over, ascending or decending,
etc.).

--
57. Before employing any captured artifacts or machinery, I will carefully
read the owner's manual.
--Peter Anspach's list of things to do as an Evil Overlord
  Réponse avec citation
 
Page generated in 0,05166 seconds with 9 queries