Skip to content

Commit ff64762

Browse files
committed
Reverting an accidental change to the doi.freeze function.
It was accidentally overwritten by doi.doiapi().
1 parent ec7616f commit ff64762

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

function/doi/doifreeze.sql

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
CREATE OR REPLACE FUNCTION doi.doiapi(dsid integer[])
2-
RETURNS TABLE(dataset jsonb)
1+
CREATE OR REPLACE FUNCTION doi.doifreeze(dsid integer[])
2+
RETURNS TABLE(datasetid integer, record json)
33
LANGUAGE sql
44
AS $function$
55
WITH chronmeta AS (
@@ -14,11 +14,12 @@ ids AS (
1414
datameta AS (
1515
SELECT * FROM doi.ndbdata(dsid)
1616
)
17-
SELECT jsonb_build_object( 'datasetid', ids.dsid,
18-
'chronologies', chr.chronologies,
19-
'data', dt.data) AS dataset
17+
SELECT ids.dsid AS datasetid,
18+
json_strip_nulls(json_build_object('chronologies', jsonb_build_object('chronologies', chr.chronologies),
19+
'data', dt.data)) AS record
2020
FROM
2121
datameta AS dt
2222
JOIN chronmeta AS chr ON dt.datasetid = chr.datasetid
2323
JOIN ids AS ids ON ids.dsid = dt.datasetid
24-
$function$;
24+
25+
$function$

0 commit comments

Comments
 (0)