At 4:00 PM -0500 2/8/01, Paul E. Miller wrote:
>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?
Yes, it was added in version 3.23.5. You've discovered the meaning of
this item in the 3.23.5 change notes:
@item
One can now with MyISAM have the auto_increment part as a sub part:
@code{CREATE TABLE foo (a int not null auto_increment, b char(5),
primary key (b
,a))}
Just make sure the AUTO_INCREMENT column is the last column of the index.
>
> 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?
--
Paul DuBois, [EMAIL PROTECTED]
---------------------------------------------------------------------
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