Closed Bug 586497 Opened 14 years ago Closed 14 years ago

Cannot create flags. Receive error "DBD::mysql::db do failed: Duplicate entry '0' for key 1 "

Categories

(Bugzilla :: Administration, task)

3.4.6
x86
Linux
task
Not set
major

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: brennx0r, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 ( .NET CLR 3.5.30729)
Build Identifier: Bugzilla 3.4.6

With my company's installation of Bugzilla, we've found that we cannot create new flags.  Below describes the behavior that is experienced.  My IT team has looked into the issue but cannot resolve it, and suggested that I file a bug with you.  Any help or information about this issue would be much appreciated.



Reproducible: Always

Steps to Reproduce:

1.  Log in with Admin account
2.  Click the Administration link
3.  Click the Flags link
4.  Click the link for adding a new flag
5.  For the form flag name, submit the following value (any simple string value appears to make this issue occur):

TestCaseCreated



6.  Leave all other values at defaults.
7.  Submit the form




Actual Results:  
This error is given:

DBD::mysql::db do failed: Duplicate entry '0' for key 1 [for Statement "INSERT INTO flagtypes
                          (name, description, cc_list, target_type,
                           sortkey, is_active, is_requestable, 
                           is_requesteeble, is_multiplicable, 
                           grant_group_id, request_group_id) 
                   VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"] at /opt/bugzilla/editflagtypes.cgi line 324
	main::insert('t79Wgo9ts6') called at /opt/bugzilla/editflagtypes.cgi line 83


Expected Results:  
The flag is created without issue (no errors)

We don't use any themes.
OS: Windows XP → Linux
Version: unspecified → 3.4.6
I don't see how you can trigger a duplicate entry error as the flagtypes table has no UNIQUE key. Something must be wrong with your DB schema. Ask your IT team to look at what "desc flagtypes" returns.
Assignee: general → administration
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Component: Bugzilla-General → Administration
Resolution: --- → WORKSFORME
mysql> desc flagtypes 
-> ; 
+------------------+--------------+------+-----+---------+-------+ 
| Field | Type | Null | Key | Default | Extra | 
+------------------+--------------+------+-----+---------+-------+ 
| id | smallint(6) | NO | PRI | NULL | | 
| name | varchar(50) | NO | | NULL | | 
| description | mediumtext | NO | | NULL | | 
| cc_list | varchar(200) | YES | | NULL | | 
| target_type | char(1) | NO | | b | | 
| is_active | tinyint(4) | NO | | 1 | | 
| is_requestable | tinyint(4) | NO | | 0 | | 
| is_requesteeble | tinyint(4) | NO | | 0 | | 
| is_multiplicable | tinyint(4) | NO | | 0 | | 
| sortkey | smallint(6) | NO | | 0 | | 
| grant_group_id | mediumint(9) | YES | MUL | NULL | | 
| request_group_id | mediumint(9) | YES | MUL | NULL | | 
+------------------+--------------+------+-----+---------+-------+ 
12 rows in set (0.00 sec) 



SET character_set_client = utf8; 
CREATE TABLE `flagtypes` ( 
`id` smallint(6) NOT NULL, 
`name` varchar(50) NOT NULL, 
`description` mediumtext NOT NULL, 
`cc_list` varchar(200) default NULL, 
`target_type` char(1) NOT NULL default 'b', 
`is_active` tinyint(4) NOT NULL default '1', 
`is_requestable` tinyint(4) NOT NULL default '0', 
`is_requesteeble` tinyint(4) NOT NULL default '0', 
`is_multiplicable` tinyint(4) NOT NULL default '0', 
`sortkey` smallint(6) NOT NULL default '0', 
`grant_group_id` mediumint(9) default NULL, 
`request_group_id` mediumint(9) default NULL, 
PRIMARY KEY (`id`), 
KEY `fk_flagtypes_grant_group_id_groups_id` (`grant_group_id`), 
KEY `fk_flagtypes_request_group_id_groups_id` (`request_group_id`), 
CONSTRAINT `fk_flagtypes_grant_group_id_groups_id` FOREIGN KEY (`grant_group_id`) REFERENCES `groups` (`id`) ON UPDATE CASCADE, 
CONSTRAINT `fk_flagtypes_request_group_id_groups_id` FOREIGN KEY (`request_group_id`) REFERENCES `groups` (`id`) ON UPDATE CASCADE 
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
(In reply to comment #2)
> mysql> desc flagtypes 
> -> ; 
> +------------------+--------------+------+-----+---------+-------+ 
> | Field | Type | Null | Key | Default | Extra | 
> +------------------+--------------+------+-----+---------+-------+ 
> | id | smallint(6) | NO | PRI | NULL | | 
> | name | varchar(50) | NO | | NULL | | 
> | description | mediumtext | NO | | NULL | | 
> | cc_list | varchar(200) | YES | | NULL | | 
> | target_type | char(1) | NO | | b | | 
> | is_active | tinyint(4) | NO | | 1 | | 
> | is_requestable | tinyint(4) | NO | | 0 | | 
> | is_requesteeble | tinyint(4) | NO | | 0 | | 
> | is_multiplicable | tinyint(4) | NO | | 0 | | 
> | sortkey | smallint(6) | NO | | 0 | | 
> | grant_group_id | mediumint(9) | YES | MUL | NULL | | 
> | request_group_id | mediumint(9) | YES | MUL | NULL | | 
> +------------------+--------------+------+-----+---------+-------+ 
> 12 rows in set (0.00 sec) 
> 
> 
> 
> SET character_set_client = utf8; 
> CREATE TABLE `flagtypes` ( 
> `id` smallint(6) NOT NULL, 
> `name` varchar(50) NOT NULL, 
> `description` mediumtext NOT NULL, 
> `cc_list` varchar(200) default NULL, 
> `target_type` char(1) NOT NULL default 'b', 
> `is_active` tinyint(4) NOT NULL default '1', 
> `is_requestable` tinyint(4) NOT NULL default '0', 
> `is_requesteeble` tinyint(4) NOT NULL default '0', 
> `is_multiplicable` tinyint(4) NOT NULL default '0', 
> `sortkey` smallint(6) NOT NULL default '0', 
> `grant_group_id` mediumint(9) default NULL, 
> `request_group_id` mediumint(9) default NULL, 
> PRIMARY KEY (`id`), 
> KEY `fk_flagtypes_grant_group_id_groups_id` (`grant_group_id`), 
> KEY `fk_flagtypes_request_group_id_groups_id` (`request_group_id`), 
> CONSTRAINT `fk_flagtypes_grant_group_id_groups_id` FOREIGN KEY
> (`grant_group_id`) REFERENCES `groups` (`id`) ON UPDATE CASCADE, 
> CONSTRAINT `fk_flagtypes_request_group_id_groups_id` FOREIGN KEY
> (`request_group_id`) REFERENCES `groups` (`id`) ON UPDATE CASCADE 
> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Does this show any obvious issue or anomaly?
We are still having this issue and are still in need of assistance.
Status: RESOLVED → UNCONFIRMED
Resolution: WORKSFORME → ---
This is a support question. Please visit http://www.bugzilla.org/support for help.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago14 years ago
Resolution: --- → INVALID
Resolution: INVALID → WORKSFORME
You need to log in before you can comment on or make changes to this bug.