Created
February 13, 2015 01:53
-
-
Save smathermather/9c2071fab6785ab2fc6f to your computer and use it in GitHub Desktop.
regexp split to table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE nr.oram_metrics AS | |
SELECT oram_id, 'm1_wetland_area'::text AS metric, regexp_split_to_table(m1_wetland_area, ',')::text AS selection | |
FROM nr.cm_oram_data | |
UNION ALL | |
SELECT oram_id, 'm2a_upland_buffer_width'::text AS metric, regexp_split_to_table(m2a_upland_buffer_width, ',')::text AS selection | |
FROM nr.cm_oram_data; | |
ALTER TABLE nr.oram_metrics ADD CONSTRAINT "metric_constraint" | |
FOREIGN KEY (metric, selection) REFERENCES nr.oram_score_lookup_all (metric, selection); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment