Skip to content

Commit f61b123

Browse files
committed
Merge branch 'master' into explorerFixes
2 parents 10c1c19 + 1abef78 commit f61b123

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

function/ap/explorersearch.sql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ BEGIN
193193
_ageyoung := -250;
194194
END IF;
195195

196-
IF _ageDoContain = true THEN
196+
IF _agedocontain = true THEN
197197
cteAgesWhere := cteAgesWhere || '
198198
AND (
199199
(' || _ageyoung || '<= sa.age AND sa.age <= ' || _ageold || ') OR
@@ -250,7 +250,7 @@ BEGIN
250250
AND sd.elementtypeid IN (array_to_string(' || _elemtypeids || ','',''))';
251251
END IF;
252252

253-
IF ageDoContain = false THEN
253+
IF _agedocontain = false THEN
254254
cteAges := cteAges || '
255255
AND NOT (c.calageolder < ' || _ageyoung || ' OR ' || _ageold || ' < c.calageyounger)';
256256
ELSE
@@ -409,7 +409,7 @@ BEGIN
409409
IF noTaxa = true AND NOT (_ageold IS NULL AND _ageyoung IS NULL) THEN
410410
BEGIN
411411
IF _ageold IS NULL THEN
412-
_ageold:= 10000000;
412+
_ageold := 10000000;
413413
END IF;
414414
IF _ageyoung IS NULL THEN
415415
_ageyoung := -250;
@@ -423,8 +423,8 @@ BEGIN
423423
ELSE
424424
cteDsWhere := cteDsWhere || '
425425
AND (
426-
NOT (ages.ageyoungest < ' || _ageold || ' OR ages.ageoldest > ' || _ageyoung ' ) OR
427-
NOT (ages.agemin < ' || _ageold || ' OR ages.agemax > ' || _ageyoung || ')
426+
(' || _ageyoung || ' <= ages.ageyoungest AND ages.ageoldest <= ' || _ageold || ' ) OR
427+
NOT (ages.maxage < ' || _ageyoung || ' OR ' || _ageold || ' < ages.minage)
428428
)';
429429
END IF;
430430
END;

function/doi/doifreeze.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CREATE OR REPLACE FUNCTION doi.doifreeze(dsid integer[])
2-
RETURNS TABLE(datasetid integer, frozendata json)
2+
RETURNS TABLE(datasetid integer, record json)
33
LANGUAGE sql
44
AS $function$
55
WITH chronmeta AS (
@@ -17,7 +17,7 @@ SELECT * FROM doi.ndbdata(dsid)
1717

1818
SELECT ids.dsid AS datasetid,
1919
json_strip_nulls(json_build_object('chronologies', jsonb_build_object('chronologies', chr.chronologies),
20-
'data', dt.data)) AS download
20+
'data', dt.data)) AS record
2121
FROM
2222
datameta AS dt
2323
JOIN chronmeta AS chr ON dt.datasetid = chr.datasetid

function/ndb/getalltables.sql

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CREATE OR REPLACE FUNCTION ndb.getalltables(_schema text)
2+
RETURNS TABLE(schema text, "table" text,
3+
"column" text, data_type text,
4+
"default" text)
5+
LANGUAGE sql
6+
AS
7+
$function$
8+
SELECT table_schema, table_name, column_name, data_type, column_default
9+
FROM information_schema.columns
10+
WHERE table_schema = _schema
11+
ORDER BY table_name, ordinal_position;
12+
$function$

0 commit comments

Comments
 (0)