Project

General

Profile

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

    
3
-- Remove 56 duplicate symbols of type 'Old' (these are ambiguous)
4
DELETE FROM "REF_PLANT_DICTIONARY"
5
WHERE "*PLANT_SYMBOL" IN (
6
    SELECT "*PLANT_SYMBOL"
7
    FROM "REF_PLANT_DICTIONARY"
8
    WHERE "*PLANT_SYMBOL_TYPE" = 'Old'
9
    GROUP BY "*PLANT_SYMBOL"
10
    HAVING count(*) > 1
11
);
12

    
13
SELECT create_if_not_exists($$ALTER TABLE "REF_PLANT_DICTIONARY" ADD CONSTRAINT "REF_PLANT_DICTIONARY.unique" UNIQUE ("*PLANT_SYMBOL_TYPE", "*PLANT_SYMBOL")$$);
(7-7/10)