Project

General

Profile

1 10084 aaronmk
SELECT util.search_path_append('util');
2 8163 aaronmk
3 8123 aaronmk
-- Remove 56 duplicate symbols of type 'Old' (these are ambiguous)
4 8136 aaronmk
DELETE FROM "REF_PLANT_DICTIONARY"
5 10054 aaronmk
WHERE "*PLANT_SYMBOL" IN (
6
    SELECT "*PLANT_SYMBOL"
7 8136 aaronmk
    FROM "REF_PLANT_DICTIONARY"
8 10054 aaronmk
    WHERE "*PLANT_SYMBOL_TYPE" = 'Old'
9
    GROUP BY "*PLANT_SYMBOL"
10 8123 aaronmk
    HAVING count(*) > 1
11
);
12
13 10054 aaronmk
SELECT create_if_not_exists($$ALTER TABLE "REF_PLANT_DICTIONARY" ADD CONSTRAINT "REF_PLANT_DICTIONARY.unique" UNIQUE ("*PLANT_SYMBOL_TYPE", "*PLANT_SYMBOL")$$);