Skip to content

Commit 3607f56

Browse files
committed
Fixing dataset PI insertion with name changes.
When an individual changes their name, but has associated publications that use their prior name, Tilia attempts to post the same name twice, and associate the prior alias. This violates the constraint that the dataset PI rows must be unique. This change allows a conflict to fail.
1 parent 630488d commit 3607f56

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

function/ts/deletechronology.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ AS $function$
1515

1616
DELETE FROM ndb.chronologies AS ch
1717
WHERE ch.chronologyid = _chronologyid;
18-
$function$
18+
$function$;

function/ts/insertdatasetpi.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ CREATE OR REPLACE FUNCTION ts.insertdatasetpi(_datasetid integer, _contactid int
44
AS $function$
55
INSERT INTO ndb.datasetpis(datasetid, contactid, piorder)
66
VALUES (_datasetid, _contactid, _piorder)
7+
ON CONFLICT (datasetid, contactid) DO NOTHING;
78
$function$

0 commit comments

Comments
 (0)