Skip to content

Commit

Permalink
Check for empty string UUID in instance_nature_content
Browse files Browse the repository at this point in the history
  • Loading branch information
nassibnassar committed Apr 9, 2024
1 parent 8fa9d57 commit 2926369
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions sql_metadb/derived_tables/instance_nature_content.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,20 @@ WITH nature_content AS (
SELECT
i.id AS instance_id,
jsonb_extract_path_text(i.jsonb, 'hrid') AS instance_hrid,
nature_of_content_term_ids.jsonb #>> '{}' AS nature_of_content_term_id,
NULLIF(nature_of_content_term_ids.jsonb #>> '{}', '')::uuid AS nature_of_content_term_id,
nature_of_content_term_ids.ordinality AS nature_of_content_ordinality
FROM
folio_inventory.instance AS i
CROSS JOIN jsonb_array_elements(jsonb_extract_path(i.jsonb, 'natureOfContentTermIds')) WITH ORDINALITY AS nature_of_content_term_ids (jsonb)
CROSS JOIN jsonb_array_elements(jsonb_extract_path(i.jsonb, 'natureOfContentTermIds'))
WITH ORDINALITY AS nature_of_content_term_ids (jsonb)
)
SELECT
nc.instance_id,
nc.instance_hrid,
nc.nature_of_content_term_id::uuid,
nc.nature_of_content_term_id,
noctt.name AS nature_of_content_term_name,
noctt.source AS nature_of_content_term_source,
nc.nature_of_content_ordinality
FROM
nature_content AS nc
LEFT JOIN folio_inventory.nature_of_content_term__t AS noctt ON nc.nature_of_content_term_id::uuid = noctt.id::uuid;


LEFT JOIN folio_inventory.nature_of_content_term__t AS noctt ON nc.nature_of_content_term_id = noctt.id::uuid;

0 comments on commit 2926369

Please sign in to comment.