I encountered something really handy while playing
around with mysql.  The documented behavior for
auto_increment is that it uses the next highest number no
matter what.

I noticed though, when I have a two element primary key,
that the auto_increment behavies in a majik uber-cool way.
I want to use this new found majik, but I'm afraid that
since it's not documented I won't be able to rely on it in
future versions.

Is it here to stay?

    Example:

    CREATE temporary TABLE neato (
      type smallint unsigned not null,
      id   smallint unsigned not null auto_increment, 

      PRIMARY KEY (type, id)
    );

    insert into neato(type) 
        values (1), (1), (1), (2), (2), (2), (2);

    select * from neato;

    +------+----+
    | type | id |
    +------+----+
    |    1 |  1 |
    |    1 |  2 |
    |    1 |  3 |
    |    2 |  1 |
    |    2 |  2 |
    |    2 |  3 |
    |    2 |  4 |
    +------+----+
    7 rows in set (0.19 sec)

Will it do this in the future? or just in the version I
have?

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to