MySQL Error Foreign Key Constraint

9 years 2 months ago #1 by lgilliver
Joomla v 3.3.6
Issue v1.6.6 (fresh install)
PHP v5.4
MySQL v5.0.10

I've got the PHP CLI being called and raising the following error when trying to update the db with a new email submission / issue.
Application Instantiation Error: Cannot add or update a child row: a foreign key constraint fails (`j_####`.`#__it_issues`, CONSTRAINT `#__it_issues_assigned_to_fk` FOREIGN KEY (`assigned_to_person_id`) REFERENCES `#__it_people` (`user_id`))

(I've omitted my table prefix and db suffix)


Had a look around online, and had a gander in PHPMyAdmin but I'm not too certain how key/constraints work.

Any advice would be greatly appreciated.

Please Log in or Create an account to join the conversation.

9 years 2 months ago - 9 years 2 months ago #2 by chrisc
The issue that is being saved doesn't have an 'assigned person' to work the issue. This indicates (to me) that the component has not been defined to have a 'default' assigned person. Alternatively there is a defined person but subsequently the entry in the it_person table has been removed.

In a nutshell a Foreign key is a reference to another record usually in an other table. In this case the field in the it_issues table is checking that the assigned_to_person_id field is a valid entry as present in the it_people (user_id) table.

To resolve this ensure that the component has a defined 'default assignee' which would be an entry in the it_people table, which it selects from in the parameters settings anyway.

Update: The above is true whether the issue is opened via the CLI email submission or directly from the front or back end. The only slight difference when raised via the CLI is that there are two possible 'assignee' settings. The is an 'IMAP' default assignee that will be used if specified. If not specified it will use the 'default assignee' as used by the front & back ends. The difference is just in case one wants a different assignee for email submitted issues. i.e. someone to 'pre-check' the issue and assign it to some one else.

Regards

If you are using our extensions please leave a review at the JED: IP Mapping | Issue Tracker | JAudit | Password Control

Please Log in or Create an account to join the conversation.

Time to create page: 0.134 seconds
Go To Top

Joomla! Debug Console

Session

Profile Information

Memory Usage

Database Queries