[INSTRM-2015] Change the foreign key constraint of `cobra_move` and `cobra_match` Created: 08/Jul/23  Updated: 21/Jul/23  Resolved: 21/Jul/23

Status: Done
Project: Instrument control development
Component/s: spt_operational_database
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Normal
Reporter: Kiyoto Yabe Assignee: Kiyoto Yabe
Resolution: Done Votes: 0
Labels: EngRun, opDB
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to INSTRM-1687 Separating some columns from cobra_ta... Done
Reviewers: chyan

 Description   

During chyan's test, there happened the following error:

2023-07-07T08:53:17.944 mcs f text="command failed: IntegrityError('(psycopg2.errors.ForeignKeyViolation) insert or update on table \"cobra_match\" violates foreign key constraint \"cobra_match_pfs_visit_id_fkey\"\nDETAIL: Key (pfs_visit_id, iteration, cobra_id)=(96418, 0, 1) is not present in table \"cobra_move\".\n') in execute_values() at /software/conda/envs/rubin3_ics/lib/python3.8/site-packages/psycopg2/extras.py:1270"

This is because the insertion sequence is `cobra_target` --> `cobra_match` --> `cobra_move`. Please change the order of foreign key constraints of `cobra_move` and `cobra_match`.



 Comments   
Comment by Kiyoto Yabe [ 21/Jul/23 ]

Merged and tagged as 0.2.11

Generated at Sat Feb 10 16:42:07 JST 2024 using Jira 8.3.4#803005-sha1:1f96e09b3c60279a408a2ae47be3c745f571388b.