Bug 125804

Summary: auto_increment cannot be overridden
Product: [Fedora] Fedora Reporter: Joshua Ginsberg <joshg>
Component: mysqlAssignee: Tom Lane <tgl>
Status: CLOSED NOTABUG QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 2CC: hhorak
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-06-11 20:14:31 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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