Skip to content

Commit

Permalink
[METASVC-149] Add condition to subjects_is_unique_type_identifier
Browse files Browse the repository at this point in the history
If there are no identifiers then type and label must be unique
among those entries without identifiers. Therefore entries are allowed
that have the same type and label but one is with and one w/o
identifiers.
  • Loading branch information
daforster committed Jan 15, 2025
1 parent bd9421c commit a33b8b0
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ declare
tuple_exists boolean;
begin
if ids is null or cardinality(ids) = 0 then
execute 'select exists(select 1 from public.subjects where $1 = type and $2 = label and $3 <> uuid)'
execute 'select exists(select 1 from public.subjects where $1 = type and $2 = label and coalesce(identifiers, array[]::dbidentifier[]) = array[]::dbidentifier[] and $3 <> uuid)'
into tuple_exists
using ptype, plabel, puuid;
if tuple_exists then
Expand Down

0 comments on commit a33b8b0

Please sign in to comment.