Project

General

Profile

« Previous | Next » 

Revision 14440

schemas/public_.sql: added viewFullOccurrence_individual_view_modify(), analogous to analytical_stem_view_modify()

View differences:

trunk/schemas/vegbien.my.sql
1880 1880

  
1881 1881

  
1882 1882

  
1883
--
1884
-- Name: viewfulloccurrence_individual_view_modify(int(1)); Type: FUNCTION; Schema: public; Owner: -
1885
--
1886

  
1887

  
1888

  
1889

  
1883 1890
USE public_validations;
1884 1891

  
1885 1892
--
trunk/schemas/public_.sql
3420 3420
$$;
3421 3421

  
3422 3422

  
3423
--
3424
-- Name: viewfulloccurrence_individual_view_modify(boolean); Type: FUNCTION; Schema: public; Owner: -
3425
--
3426

  
3427
CREATE FUNCTION viewfulloccurrence_individual_view_modify(repopulate boolean DEFAULT true) RETURNS void
3428
    LANGUAGE sql
3429
    AS $_$
3430
SELECT util.rematerialize_view('"viewFullOccurrence_individual"', '"viewFullOccurrence_individual_view"', $$
3431
ALTER TABLE "viewFullOccurrence_individual" ADD COLUMN "TAXONOBSERVATION_ID__@VegBank__.taxonObservation@vegpath.org" serial PRIMARY KEY;
3432
COMMENT ON COLUMN "viewFullOccurrence_individual"."TAXONOBSERVATION_ID__@VegBank__.taxonObservation@vegpath.org" IS 'VegBIEN-autogenerated "identifier assigned to each unique observation of a taxon in a plot"';
3433

  
3434
GRANT SELECT ON TABLE "viewFullOccurrence_individual" TO bien_read;
3435
GRANT SELECT ON TABLE "viewFullOccurrence_individual_view" TO bien_read;
3436

  
3437
ALTER TABLE "viewFullOccurrence_individual" ALTER COLUMN "datasource__@Brad__.identifier_examples@vegpath.org" SET NOT NULL;
3438
ALTER TABLE "viewFullOccurrence_individual" ALTER COLUMN "locationID__@DwC__@vegpath.org" SET NOT NULL;
3439

  
3440
CREATE INDEX ON "viewFullOccurrence_individual" ("datasource__@Brad__.identifier_examples@vegpath.org", "occurrenceID__@DwC__@vegpath.org");
3441
CREATE INDEX ON "viewFullOccurrence_individual" ("datasource__@Brad__.identifier_examples@vegpath.org", "[custodial_]institutionCode[s]__@DwC__@vegpath.org", "collectionCode__@DwC__@vegpath.org", "catalogNumber__@DwC__@vegpath.org");
3442
CREATE INDEX ON "viewFullOccurrence_individual" ("datasource__@Brad__.identifier_examples@vegpath.org", "projectID__@VegX__.plotObservation@vegpath.org", "locationID__@DwC__@vegpath.org", "eventDate__@DwC__@vegpath.org");
3443
CREATE INDEX ON "viewFullOccurrence_individual" ("speciesBinomialWithMorphospecies__@VegCore__@vegpath.org");
3444
$$, repopulate);
3445
$_$;
3446

  
3447

  
3423 3448
SET search_path = public_validations, pg_catalog;
3424 3449

  
3425 3450
--
trunk/schemas/vegbien.sql
3420 3420
$$;
3421 3421

  
3422 3422

  
3423
--
3424
-- Name: viewfulloccurrence_individual_view_modify(boolean); Type: FUNCTION; Schema: public; Owner: -
3425
--
3426

  
3427
CREATE FUNCTION viewfulloccurrence_individual_view_modify(repopulate boolean DEFAULT true) RETURNS void
3428
    LANGUAGE sql
3429
    AS $_$
3430
SELECT util.rematerialize_view('"viewFullOccurrence_individual"', '"viewFullOccurrence_individual_view"', $$
3431
ALTER TABLE "viewFullOccurrence_individual" ADD COLUMN "TAXONOBSERVATION_ID__@VegBank__.taxonObservation@vegpath.org" serial PRIMARY KEY;
3432
COMMENT ON COLUMN "viewFullOccurrence_individual"."TAXONOBSERVATION_ID__@VegBank__.taxonObservation@vegpath.org" IS 'VegBIEN-autogenerated "identifier assigned to each unique observation of a taxon in a plot"';
3433

  
3434
GRANT SELECT ON TABLE "viewFullOccurrence_individual" TO bien_read;
3435
GRANT SELECT ON TABLE "viewFullOccurrence_individual_view" TO bien_read;
3436

  
3437
ALTER TABLE "viewFullOccurrence_individual" ALTER COLUMN "datasource__@Brad__.identifier_examples@vegpath.org" SET NOT NULL;
3438
ALTER TABLE "viewFullOccurrence_individual" ALTER COLUMN "locationID__@DwC__@vegpath.org" SET NOT NULL;
3439

  
3440
CREATE INDEX ON "viewFullOccurrence_individual" ("datasource__@Brad__.identifier_examples@vegpath.org", "occurrenceID__@DwC__@vegpath.org");
3441
CREATE INDEX ON "viewFullOccurrence_individual" ("datasource__@Brad__.identifier_examples@vegpath.org", "[custodial_]institutionCode[s]__@DwC__@vegpath.org", "collectionCode__@DwC__@vegpath.org", "catalogNumber__@DwC__@vegpath.org");
3442
CREATE INDEX ON "viewFullOccurrence_individual" ("datasource__@Brad__.identifier_examples@vegpath.org", "projectID__@VegX__.plotObservation@vegpath.org", "locationID__@DwC__@vegpath.org", "eventDate__@DwC__@vegpath.org");
3443
CREATE INDEX ON "viewFullOccurrence_individual" ("speciesBinomialWithMorphospecies__@VegCore__@vegpath.org");
3444
$$, repopulate);
3445
$_$;
3446

  
3447

  
3423 3448
SET search_path = public_validations, pg_catalog;
3424 3449

  
3425 3450
--

Also available in: Unified diff