Project

General

Profile

1
SELECT util.search_path_append('util');
2

    
3
SELECT create_if_not_exists($$CREATE INDEX "Specimen.acronym" ON $$||:table_str||$$ ("specimenHolderInstitutions")$$);
4

    
5
-- Remove institutions that we have direct data for
6
DELETE FROM :table
7
WHERE "specimenHolderInstitutions" IN (
8
      'MO'
9
    , 'NY'
10
)
11
/* list obtained using:
12
SELECT DISTINCT dataprovider
13
FROM sourcelist
14
JOIN provider_count ON provider_count.dataprovider = sourcelist.name
15
WHERE source_id = (SELECT source_by_shortname('SpeciesLink'))
16
ORDER BY dataprovider
17
*/
18
;
19

    
20
SELECT mk_derived_col((:table_str, 'collectorNumber'),
21
$$_alt("collectorNumber_from_recordNumber", "collectorNumber_from_fieldNumber")$$)
22
; -- runtime: 3 min ("Time: 177696.140 ms") @starscream
(6-6/10)