SELECT util.search_path_append('util'); SELECT create_if_not_exists($$CREATE INDEX "Specimen.acronym" ON $$||:table_str||$$ ("specimenHolderInstitutions")$$); -- Remove institutions that we have direct data for DELETE FROM :table WHERE "specimenHolderInstitutions" IN ( 'MO' , 'NY' ) /* list obtained using: SELECT DISTINCT dataprovider FROM sourcelist JOIN provider_count ON provider_count.dataprovider = sourcelist.name WHERE source_id = (SELECT source_by_shortname('SpeciesLink')) ORDER BY dataprovider */ ; SELECT mk_derived_col((:table_str, 'collectorNumber'), $$_alt("collectorNumber_from_recordNumber", "collectorNumber_from_fieldNumber")$$) ; -- runtime: 3 min ("Time: 177696.140 ms") @starscream