472,805 Members | 803 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 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 1707

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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.