Project

General

Profile

1 10245 aaronmk
SELECT util.search_path_append('util');
2 7247 aaronmk
3 10530 aaronmk
SELECT create_if_not_exists($$CREATE INDEX "Specimen.acronym" ON $$||:table_str||$$ ("specimenHolderInstitutions")$$);
4 10245 aaronmk
5 7247 aaronmk
-- Remove institutions that we have direct data for
6
DELETE FROM :table
7 10530 aaronmk
WHERE "specimenHolderInstitutions" IN (
8 7247 aaronmk
      'MO'
9
    , 'NY'
10
)
11
/* list obtained using:
12 9501 aaronmk
SELECT DISTINCT dataprovider
13 7247 aaronmk
FROM sourcelist
14 9501 aaronmk
JOIN provider_count ON provider_count.dataprovider = sourcelist.name
15 7247 aaronmk
WHERE source_id = source_by_shortname('SpeciesLink')
16 9501 aaronmk
ORDER BY dataprovider
17 7247 aaronmk
*/
18
;
19 10528 aaronmk
20
SELECT mk_derived_col((:table_str, 'collectorNumber'),
21 10530 aaronmk
$$_alt("collectorNumber_from_recordNumber", "collectorNumber_from_fieldNumber")$$)
22 10528 aaronmk
; -- runtime: 3 min ("Time: 177696.140 ms") @starscream