473,396 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

auto_increment reuse in MyISAM

I made a MyISAM table on mysql 4.0.18 NT with auto_increment column
started at 2147483646. The third row I insert fails as expected
because the integer range is maxed out. However, if I delete the
topmost row, and then re-insert a row, the topmost value is reused.
This contradicts the documentation.

http://dev.mysql.com/doc/mysql/en/CREATE_TABLE.html
"If you delete the row containing the maximum value for an
AUTO_INCREMENT column, the value will be reused for an ISAM or BDB
table, but not for a MyISAM or InnoDB table."

------------------------------------------------------------
mysql> create table testauto (myint int primary key auto_increment)
-> auto_increment=2147483646;
Query OK, 0 rows affected (0.00 sec)

mysql> insert into testauto values (null);
Query OK, 1 row affected (0.00 sec)

mysql> insert into testauto values (null);
Query OK, 1 row affected (0.00 sec)

mysql> insert into testauto values (null);
ERROR 1062: Duplicate entry '2147483647' for key 1

mysql> delete from testauto where myint=2147483647;
Query OK, 1 row affected (0.00 sec)

mysql> insert into testauto values (null);
Query OK, 1 row affected (0.00 sec)

mysql> select * from testauto;
+------------+
| myint |
+------------+
| 2147483646 |
| 2147483647 |
+------------+
2 rows in set (0.00 sec)

mysql> show table status from test like 'testauto';
+----------+--------+------------+------+----------------+-------------+--------
---------+--------------+-----------+----------------+---------------------+----
-----------------+------------+----------------+---------+
| Name | Type | Row_format | Rows | Avg_row_length | Data_length
| Max_dat
a_length | Index_length | Data_free | Auto_increment | Create_time
| Upd
ate_time | Check_time | Create_options | Comment |
+----------+--------+------------+------+----------------+-------------+--------
---------+--------------+-----------+----------------+---------------------+----
-----------------+------------+----------------+---------+
| testauto | MyISAM | Fixed | 2 | 5 | 10
| 214
74836479 | 2048 | 0 | 2147483647 | 2004-04-17
00:34:58 | 200
4-04-17 00:35:49 | NULL | | |
+----------+--------+------------+------+----------------+-------------+--------
---------+--------------+-----------+----------------+---------------------+----
-----------------+------------+----------------+---------+
1 row in set (0.00 sec)
Jul 20 '05 #1
0 1745

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Paul Lamonby | last post by:
Hi, i want to create a unique serial number to my Db entries. I thought the best way would be to add the auto_increment primary key value to a string, then insert it into a table field...
2
by: Ittay Freiman | last post by:
i cannot set auto_increment to start from anything other than 1: mysql> create table test (id int unsigned not null auto_increment primary key); mysql> alter table test auto_increment=2; ...
9
by: Bart Van der Donck | last post by:
Hello, The first column of my table is AUTO_INCREMENT. I fill my table with 5 records with a blanco value in their first field. The first column of my table will then hold the values 1,2,3,4,5...
0
by: Shailesh | last post by:
I made a MyISAM table on mysql 4.0.18 NT with auto_increment column started at 2147483646. The third row I insert fails as expected because the integer range is maxed out. However, if I delete...
2
by: hjyn | last post by:
Hi, how can I add char to auto_increment? For example, the auto_increment is for integer, I want to add a character at the front of that number. Ex: >create table abs (UserID INT(3) NOT NULL...
1
by: Fábio Emilio Costa | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi! I'm working in a project in C++ using MySQL C API (Win98/Dev-C++ 4.9.9.8/MySQL DevPak/MySQL 4.1.13) and I want to know if it's possible to...
4
by: Good Man | last post by:
Hi there I have a database with about 20 or so tables, maybe a few thousand rows in each. I am starting to do more complex things with my insertions etc, and I want to start to use...
2
by: crescent_au | last post by:
I've read articles and postings about MyISAM vs InnoDB but I am still a bit unsure about which storage engine to use for my new project. I am developing a website in PHP/MySQL, which includes...
110
by: alf | last post by:
Hi, is it possible that due to OS crash or mysql itself crash or some e.g. SCSI failure to lose all the data stored in the table (let's say million of 1KB rows). In other words what is the worst...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.