Revision 13646
Added by Aaron Marcuse-Kubitza over 10 years ago
trunk/inputs/.TNRS/schema.sql | ||
---|---|---|
48 | 48 |
CREATE FUNCTION "MatchedTaxon_modify"(view_query text DEFAULT NULL::text) RETURNS void |
49 | 49 |
LANGUAGE sql |
50 | 50 |
AS $_$ |
51 |
SELECT util.recreate_view('"TNRS"."MatchedTaxon"', $1, $$ |
|
52 |
-- **IMPORTANT**: keep these updated as described in the views' comments |
|
53 |
|
|
54 |
CREATE VIEW "TNRS"."ValidMatchedTaxon" AS |
|
55 |
SELECT * |
|
56 |
FROM "TNRS"."MatchedTaxon" |
|
57 |
WHERE "MatchedTaxon".taxon_scrub__is_valid_match; |
|
58 |
$$||util.mk_set_relation_metadata('"TNRS"."ValidMatchedTaxon"')||$$ |
|
59 |
|
|
60 |
CREATE VIEW "TNRS".taxon_scrub AS |
|
61 |
SELECT *, |
|
62 |
CASE |
|
63 |
WHEN "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_rank = 'family'::text THEN concat_ws(' '::text, "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_family, "ValidMatchedTaxon"."morphospeciesSuffix") |
|
64 |
WHEN "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_rank = 'genus'::text THEN concat_ws(' '::text, "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_name_no_author, "ValidMatchedTaxon"."morphospeciesSuffix") |
|
65 |
ELSE ("taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_genus || ' '::text) || "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_specific_epithet |
|
66 |
END AS scrubbed_morphospecies_binomial |
|
67 |
FROM "TNRS"."ValidMatchedTaxon" |
|
68 |
LEFT JOIN "TNRS"."taxon_scrub.scrubbed_unique_taxon_name.*" USING (scrubbed_unique_taxon_name); |
|
69 |
$$||util.mk_set_relation_metadata('"TNRS".taxon_scrub')||$$ |
|
70 |
$$); |
|
51 |
SELECT util.recreate_view('"TNRS"."MatchedTaxon"', $1); |
|
71 | 52 |
$_$; |
72 | 53 |
|
73 | 54 |
|
... | ... | |
78 | 59 |
COMMENT ON FUNCTION "MatchedTaxon_modify"(view_query text) IS ' |
79 | 60 |
usage: |
80 | 61 |
SELECT "TNRS"."MatchedTaxon_modify"($$ |
81 |
SELECT *, __ AS accepted_morphospecies_binomial |
|
82 |
FROM __ |
|
62 |
SELECT __ |
|
83 | 63 |
$$); |
84 | 64 |
|
85 | 65 |
idempotent |
... | ... | |
166 | 146 |
COMMENT ON FUNCTION taxon_scrub_modify(view_query text) IS ' |
167 | 147 |
usage: |
168 | 148 |
SELECT "TNRS".taxon_scrub_modify($$ |
169 |
SELECT *, __ AS scrubbed_morphospecies_binomial |
|
170 |
FROM "TNRS"."ValidMatchedTaxon" |
|
171 |
LEFT JOIN "TNRS"."taxon_scrub.scrubbed_unique_taxon_name.*" USING (scrubbed_unique_taxon_name); |
|
149 |
SELECT __ |
|
172 | 150 |
$$); |
173 | 151 |
|
174 | 152 |
idempotent |
trunk/schemas/vegbien.sql | ||
---|---|---|
16846 | 16846 |
CREATE FUNCTION "MatchedTaxon_modify"(view_query text DEFAULT NULL::text) RETURNS void |
16847 | 16847 |
LANGUAGE sql |
16848 | 16848 |
AS $_$ |
16849 |
SELECT util.recreate_view('"TNRS"."MatchedTaxon"', $1, $$ |
|
16850 |
-- **IMPORTANT**: keep these updated as described in the views' comments |
|
16851 |
|
|
16852 |
CREATE VIEW "TNRS"."ValidMatchedTaxon" AS |
|
16853 |
SELECT * |
|
16854 |
FROM "TNRS"."MatchedTaxon" |
|
16855 |
WHERE "MatchedTaxon".taxon_scrub__is_valid_match; |
|
16856 |
$$||util.mk_set_relation_metadata('"TNRS"."ValidMatchedTaxon"')||$$ |
|
16857 |
|
|
16858 |
CREATE VIEW "TNRS".taxon_scrub AS |
|
16859 |
SELECT *, |
|
16860 |
CASE |
|
16861 |
WHEN "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_rank = 'family'::text THEN concat_ws(' '::text, "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_family, "ValidMatchedTaxon"."morphospeciesSuffix") |
|
16862 |
WHEN "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_rank = 'genus'::text THEN concat_ws(' '::text, "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_name_no_author, "ValidMatchedTaxon"."morphospeciesSuffix") |
|
16863 |
ELSE ("taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_genus || ' '::text) || "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_specific_epithet |
|
16864 |
END AS scrubbed_morphospecies_binomial |
|
16865 |
FROM "TNRS"."ValidMatchedTaxon" |
|
16866 |
LEFT JOIN "TNRS"."taxon_scrub.scrubbed_unique_taxon_name.*" USING (scrubbed_unique_taxon_name); |
|
16867 |
$$||util.mk_set_relation_metadata('"TNRS".taxon_scrub')||$$ |
|
16868 |
$$); |
|
16849 |
SELECT util.recreate_view('"TNRS"."MatchedTaxon"', $1); |
|
16869 | 16850 |
$_$; |
16870 | 16851 |
|
16871 | 16852 |
|
... | ... | |
16876 | 16857 |
COMMENT ON FUNCTION "MatchedTaxon_modify"(view_query text) IS ' |
16877 | 16858 |
usage: |
16878 | 16859 |
SELECT "TNRS"."MatchedTaxon_modify"($$ |
16879 |
SELECT *, __ AS accepted_morphospecies_binomial |
|
16880 |
FROM __ |
|
16860 |
SELECT __ |
|
16881 | 16861 |
$$); |
16882 | 16862 |
|
16883 | 16863 |
idempotent |
... | ... | |
16964 | 16944 |
COMMENT ON FUNCTION taxon_scrub_modify(view_query text) IS ' |
16965 | 16945 |
usage: |
16966 | 16946 |
SELECT "TNRS".taxon_scrub_modify($$ |
16967 |
SELECT *, __ AS scrubbed_morphospecies_binomial |
|
16968 |
FROM "TNRS"."ValidMatchedTaxon" |
|
16969 |
LEFT JOIN "TNRS"."taxon_scrub.scrubbed_unique_taxon_name.*" USING (scrubbed_unique_taxon_name); |
|
16947 |
SELECT __ |
|
16970 | 16948 |
$$); |
16971 | 16949 |
|
16972 | 16950 |
idempotent |
Also available in: Unified diff
inputs/.TNRS/schema.sql: *_modify(): removed the need to manually maintain copies of the dependent view definitions with the *s in place, because the *s are now added automatically by view_def_to_orig()