Revision 8123
Added by Aaron Marcuse-Kubitza over 11 years ago
inputs/FIA/REF_PLANT_DICTIONARY/postprocess.sql | ||
---|---|---|
1 |
SELECT functions.to_global_col_names(:table_str); |
|
2 |
|
|
3 |
SELECT functions.rename_if_exists($$ALTER TABLE "REF_PLANT_DICTIONARY" RENAME "REF_PLANT_DICTIONARY.SYMBOL_TYPE" TO ".SYMBOL_TYPE"$$); |
|
4 |
SELECT functions.rename_if_exists($$ALTER TABLE "REF_PLANT_DICTIONARY" RENAME "REF_PLANT_DICTIONARY.SYMBOL" TO ".SYMBOL" $$); |
|
5 |
|
|
6 |
-- Remove 56 duplicate symbols of type 'Old' (these are ambiguous) |
|
7 |
DELETE FROM :table |
|
8 |
WHERE ".SYMBOL" IN ( |
|
9 |
SELECT ".SYMBOL" |
|
10 |
FROM :table |
|
11 |
WHERE ".SYMBOL_TYPE" = 'Old' |
|
12 |
GROUP BY ".SYMBOL" |
|
13 |
HAVING count(*) > 1 |
|
14 |
); |
|
15 |
|
|
16 |
SELECT functions.create_if_not_exists($$ALTER TABLE "REF_PLANT_DICTIONARY" ADD CONSTRAINT "REF_PLANT_DICTIONARY.unique" UNIQUE (".SYMBOL_TYPE", ".SYMBOL")$$); |
Also available in: Unified diff
Added inputs/FIA/REF_PLANT_DICTIONARY/postprocess.sql