Jedi, > "The behavior of the auto-increment mechanism is not defined if a user gives > a negative value to the column or if the value becomes bigger than the > maximum integer that can be stored in the specified integer type."
> Does it mean that MySQL databases will definitely stop working at a random > date (when an auto-incremental column will overflow) ? Nope. Say you have a table with a column "id" of type TINYINT which forms the primary key. The column definition in CREATE TABLE would be: id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY Now, if you don't enter data for this column manually, the first entry will be "1", the second will be "2", etc. The maximum value for TINYINT UNSIGNED is 255. So this means that when your table has 255 entries, MySQL would tried to set entry #256 to id = 256. This is not possible, so MySQL will clip this value to 255. This, however, cannot be entered because it would violate the uniqueness of the primary key. As a result, you get an error, and the record is not inserted. So you'll have to choose carefully what column type you need. For a primary key, always use the UNSIGNED option. Regarding range of values, you have this choice: TINYINT: maximum 255 SMALLINT: maximum 65535 MEDIUMINT: maximum 16.7 million INT: maximum 4.2 billion BIGINT: no maximum (I can't count up to this ;-) Details: http://www.mysql.com/doc/en/Numeric_types.html Regards, -- Stefan Hinz <[EMAIL PROTECTED]> iConnect GmbH <http://iConnect.de> Heesestr. 6, 12169 Berlin (Germany) Telefon: +49 30 7970948-0 Fax: +49 30 7970948-3 [filter fodder: sql, mysql, query] --------------------------------------------------------------------- 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