Bug #10682

Cannot create new authority record and add relationship at the same time

Added by Dan Gillean over 5 years ago. Updated 4 months ago.

Status:VerifiedStart date:12/13/2016
Priority:MediumDue date:
Assignee:-% Done:

0%

Category:Actor
Target version:Release 2.7.0
Google Code Legacy ID: Tested version:2.4
Sponsored:No Requires documentation:No

Description

To reproduce

  • Create a new authority record. Give it some basic info
  • Open the Relationships area and try to add a relationship to another authority record - make sure you pick a category and a type
  • Save the record

Error encountered

500 error - record is not created. From the error log:

2016/12/13 21:33:49 [error] 2820#0: *101 FastCGI sent in stderr: "PHP message: Unable to execute INSERT statement. [wrapped: SQLSTATE[23000]: Integrity
 constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`atom`.`relation`, CONSTRAINT `relation_FK_3` FOREIGN KEY 
(`object_id`) REFERENCES `object` (`id`))]" while reading response header from upstream, client: 10.10.10.1, server: _, request: "POST /actor/add 
HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.atom.sock:", host: "10.10.10.10", referrer: "http://10.10.10.10/actor/add" 

Notes

See attached screenshot. When creating the relationship, the new record has not yet been saved first, so it throws an error - at least, that's my theory. If possible, we should order the save process so the new record saves first, then the relationship is registered. Not sure if this is possible or not without involving the job scheduler for the relationships.

Expected result
  • User can create new authority record with relationships without having to save first
  • At bare minimum, if above is not possible the UI should not allow creation of relationships until record is saved, and a note should be present to indicate this

new-authority-relationship.png (44.3 KB) Dan Gillean, 12/13/2016 04:49 PM


Related issues

Related to Access to Memory (AtoM) - Bug #13499: Saving a resource with incomplete relation data causes a ... Verified 04/22/2021
Duplicated by Access to Memory (AtoM) - Bug #13309: Creating an actor with a relationship to another results ... Duplicate 05/05/2020

History

#1 Updated by Sara Allain almost 5 years ago

Confirmed that this is still happening on qa/2.4.x, as of 17 August 2017.

#2 Updated by Dan Gillean about 2 years ago

  • Duplicated by Bug #13309: Creating an actor with a relationship to another results in a 500 error added

#3 Updated by Mike Cantelon about 2 years ago

When this is fixed make sure arUpdateEsActorRelationsJob is run after creation.

#4 Updated by Dan Gillean 4 months ago

  • Category set to Actor
  • Target version set to Release 2.7.0
  • Requires documentation set to No

Working in qa/2.x - seems that the fixes included in #13499 have resolved this issue.

#5 Updated by Dan Gillean 4 months ago

  • Related to Bug #13499: Saving a resource with incomplete relation data causes a 500 error added

#6 Updated by Dan Gillean 4 months ago

  • Status changed from New to Verified

Also available in: Atom PDF