Project

General

Profile

« Previous | Next » 

Revision 13507

inputs/.TNRS/schema.sql: MatchedTaxon: to modify: use new MatchedTaxon_modify(), which eliminates the work of putting together the dependent views

View differences:

vegbien.sql
17142 17142

  
17143 17143
COMMENT ON VIEW "MatchedTaxon" IS '
17144 17144
to modify:
17145
-- use `*, ... AS accepted_morphospecies_binomial` as the column list
17146
SELECT util.force_recreate($$
17147
-- trigger the dependent_objects_still_exist exception
17148
DROP VIEW "TNRS"."MatchedTaxon"; -- *not* CASCADE; it must trigger an exception
17149

  
17150
CREATE VIEW "TNRS"."MatchedTaxon" AS 
17151
SELECT *, ... AS accepted_morphospecies_binomial
17152
/*revised def*/
17153
;
17154
GRANT SELECT ON TABLE "TNRS"."MatchedTaxon" TO bien_read;
17155
COMMENT ON VIEW "TNRS"."MatchedTaxon"
17156
  IS ''
17157
...
17158
'';
17159

  
17160
-- manually restore views that need to be updated for the changes
17161
-- **IMPORTANT**: update these as described in the views'' comments
17162

  
17163
CREATE VIEW "TNRS"."ValidMatchedTaxon" AS 
17164
 SELECT *
17165
   FROM "TNRS"."MatchedTaxon"
17166
  WHERE "MatchedTaxon".taxon_scrub__is_valid_match;
17167
GRANT SELECT ON TABLE "TNRS"."ValidMatchedTaxon" TO bien_read;
17168
COMMENT ON VIEW "TNRS"."ValidMatchedTaxon"
17169
  IS ''
17170
to update, use * as the column list
17171
'';
17172

  
17173
CREATE VIEW "TNRS".taxon_scrub AS 
17174
 SELECT *
17175
   FROM "TNRS"."ValidMatchedTaxon"
17176
   LEFT JOIN "TNRS"."taxon_scrub.scrubbed_unique_taxon_name.*" USING (scrubbed_unique_taxon_name);
17177
GRANT SELECT ON TABLE "TNRS".taxon_scrub TO bien_read;
17178
COMMENT ON VIEW "TNRS".taxon_scrub
17179
  IS ''
17180
to update, use * as the column list
17181
'';
17145
SELECT "TNRS"."MatchedTaxon_modify"($$
17146
 SELECT *, __ AS accepted_morphospecies_binomial
17147
   FROM __
17182 17148
$$);
17183 17149
';
17184 17150

  

Also available in: Unified diff