Bug 125804 - auto_increment cannot be overridden
Summary: auto_increment cannot be overridden
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: mysql
Version: 2
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tom Lane
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-06-11 16:18 UTC by Joshua Ginsberg
Modified: 2013-07-03 03:01 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2004-06-11 20:14:31 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Joshua Ginsberg 2004-06-11 16:18:34 UTC
Description of problem:
When a table is defined as having its primary key "auto_increment",
this cannot be overridden by an insert command.

Version-Release number of selected component (if applicable):
3.23.58-9

How reproducible:
Use the following definition:
create table foo (
id int not null primary key auto_increment,
s varchar(20)
);

insert into foo values (0, 'foo');
insert into foo values (1, 'bar');
  
Actual results:
An error is thrown about having duplicate indicies for the second
insert statement; 'foo' was entered with an index of 1, not 0.

Expected results:

'foo' is entered with an id of 0.

Additional info:

Comment 1 Tom Lane 2004-06-11 20:14:31 UTC
AFAIK this is the intended behavior in MySQL.

Comment 2 Joshua Ginsberg 2004-06-11 20:16:05 UTC
Hehe. We had a midair collision. I was just putting that I found
NO_AUTO_VALUE_ON_ZERO -- so never mind. Thanks!

-jag


Note You need to log in before you can comment on or make changes to this bug.