Revision 12635
Added by Aaron Marcuse-Kubitza almost 11 years ago
trunk/inputs/SALVIAS/validations.sql | ||
---|---|---|
78 | 78 |
|
79 | 79 |
|
80 | 80 |
-- |
81 |
-- Name: _plots_06a_list_of_stems; Type: VIEW; Schema: SALVIAS; Owner: - |
|
82 |
-- |
|
83 |
|
|
84 |
CREATE VIEW _plots_06a_list_of_stems AS |
|
85 |
SELECT p.project_name, |
|
86 |
(pm."SiteCode")::text AS plot_code, |
|
87 |
(s.stem_id)::text AS stem_id |
|
88 |
FROM (((projects p |
|
89 |
JOIN "plotMetadata" pm ON ((p.project_id = pm.project_id))) |
|
90 |
JOIN "plotObservations" po ON ((pm."PlotID" = po."PlotID"))) |
|
91 |
JOIN stems s ON ((po."PlotObsID" = s.plotobs_id))) |
|
92 |
ORDER BY p.project_name, (pm."SiteCode")::text, (s.stem_id)::text; |
|
93 |
|
|
94 |
|
|
95 |
-- |
|
81 | 96 |
-- Name: _plots_07_list_of_plots_with_counts_of_individuals_per_species; Type: VIEW; Schema: SALVIAS; Owner: - |
82 | 97 |
-- |
83 | 98 |
|
trunk/schemas/vegbien.my.sql | ||
---|---|---|
252 | 252 |
|
253 | 253 |
|
254 | 254 |
-- |
255 |
-- Name: keys_~type._plots_06a_list_of_stems; Type: TYPE; Schema: public_validations; Owner: - |
|
256 |
-- |
|
257 |
|
|
258 |
|
|
259 |
|
|
260 |
|
|
261 |
-- |
|
255 | 262 |
-- Name: keys_~type._plots_10_count_of_individuals_per_plot_in_each_proj; Type: TYPE; Schema: public_validations; Owner: - |
256 | 263 |
-- |
257 | 264 |
|
... | ... | |
427 | 434 |
|
428 | 435 |
|
429 | 436 |
-- |
437 |
-- Name: values__~type._plots_06a_list_of_stems; Type: TYPE; Schema: public_validations; Owner: - |
|
438 |
-- |
|
439 |
|
|
440 |
|
|
441 |
|
|
442 |
|
|
443 |
-- |
|
430 | 444 |
-- Name: values__~type._plots_10_count_of_individuals_per_plot_in_each_p; Type: TYPE; Schema: public_validations; Owner: - |
431 | 445 |
-- |
432 | 446 |
|
... | ... | |
1303 | 1317 |
|
1304 | 1318 |
|
1305 | 1319 |
-- |
1320 |
-- Name: ~type._plots_06a_list_of_stems; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: |
|
1321 |
-- |
|
1322 |
|
|
1323 |
CREATE TABLE `~type._plots_06a_list_of_stems` ( |
|
1324 |
project_name varchar(255), |
|
1325 |
plot_code varchar(255), |
|
1326 |
stem_id varchar(255) |
|
1327 |
); |
|
1328 |
|
|
1329 |
|
|
1330 |
-- |
|
1331 |
-- Name: keys(`~type._plots_06a_list_of_stems`); Type: FUNCTION; Schema: public_validations; Owner: - |
|
1332 |
-- |
|
1333 |
|
|
1334 |
|
|
1335 |
|
|
1336 |
|
|
1337 |
-- |
|
1306 | 1338 |
-- Name: ~type._plots_10_count_of_individuals_per_plot_in_each_project; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: |
1307 | 1339 |
-- |
1308 | 1340 |
|
... | ... | |
1825 | 1857 |
|
1826 | 1858 |
|
1827 | 1859 |
-- |
1860 |
-- Name: values_(`~type._plots_06a_list_of_stems`); Type: FUNCTION; Schema: public_validations; Owner: - |
|
1861 |
-- |
|
1862 |
|
|
1863 |
|
|
1864 |
|
|
1865 |
|
|
1866 |
-- |
|
1828 | 1867 |
-- Name: values_(`~type._plots_10_count_of_individuals_per_plot_in_each_project`); Type: FUNCTION; Schema: public_validations; Owner: - |
1829 | 1868 |
-- |
1830 | 1869 |
|
... | ... | |
4605 | 4644 |
|
4606 | 4645 |
|
4607 | 4646 |
-- |
4647 |
-- Name: _plots_06a_list_of_stems; Type: VIEW; Schema: public_validations; Owner: - |
|
4648 |
-- |
|
4649 |
|
|
4650 |
|
|
4651 |
|
|
4652 |
|
|
4653 |
-- |
|
4608 | 4654 |
-- Name: _plots_10_count_of_individuals_per_plot_in_each_project; Type: VIEW; Schema: public_validations; Owner: - |
4609 | 4655 |
-- |
4610 | 4656 |
|
... | ... | |
7635 | 7681 |
|
7636 | 7682 |
|
7637 | 7683 |
-- |
7684 |
-- Data for Name: ~type._plots_06a_list_of_stems; Type: TABLE DATA; Schema: public_validations; Owner: - |
|
7685 |
-- |
|
7686 |
|
|
7687 |
|
|
7688 |
|
|
7689 |
-- |
|
7638 | 7690 |
-- Data for Name: ~type._plots_10_count_of_individuals_per_plot_in_each_project; Type: TABLE DATA; Schema: public_validations; Owner: - |
7639 | 7691 |
-- |
7640 | 7692 |
|
trunk/schemas/vegbien.sql | ||
---|---|---|
509 | 509 |
|
510 | 510 |
|
511 | 511 |
-- |
512 |
-- Name: keys_~type._plots_06a_list_of_stems; Type: TYPE; Schema: public_validations; Owner: - |
|
513 |
-- |
|
514 |
|
|
515 |
CREATE TYPE "keys_~type._plots_06a_list_of_stems" AS ( |
|
516 |
project_name text, |
|
517 |
plot_code text, |
|
518 |
stem_id text |
|
519 |
); |
|
520 |
|
|
521 |
|
|
522 |
-- |
|
512 | 523 |
-- Name: keys_~type._plots_10_count_of_individuals_per_plot_in_each_proj; Type: TYPE; Schema: public_validations; Owner: - |
513 | 524 |
-- |
514 | 525 |
|
... | ... | |
749 | 760 |
|
750 | 761 |
|
751 | 762 |
-- |
763 |
-- Name: values__~type._plots_06a_list_of_stems; Type: TYPE; Schema: public_validations; Owner: - |
|
764 |
-- |
|
765 |
|
|
766 |
CREATE TYPE "values__~type._plots_06a_list_of_stems" AS ( |
|
767 |
project_name text, |
|
768 |
plot_code text, |
|
769 |
stem_id text |
|
770 |
); |
|
771 |
|
|
772 |
|
|
773 |
-- |
|
752 | 774 |
-- Name: values__~type._plots_10_count_of_individuals_per_plot_in_each_p; Type: TYPE; Schema: public_validations; Owner: - |
753 | 775 |
-- |
754 | 776 |
|
... | ... | |
2571 | 2593 |
|
2572 | 2594 |
|
2573 | 2595 |
-- |
2596 |
-- Name: ~type._plots_06a_list_of_stems; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: |
|
2597 |
-- |
|
2598 |
|
|
2599 |
CREATE TABLE "~type._plots_06a_list_of_stems" ( |
|
2600 |
project_name text, |
|
2601 |
plot_code text, |
|
2602 |
stem_id text |
|
2603 |
); |
|
2604 |
|
|
2605 |
|
|
2606 |
-- |
|
2607 |
-- Name: keys("~type._plots_06a_list_of_stems"); Type: FUNCTION; Schema: public_validations; Owner: - |
|
2608 |
-- |
|
2609 |
|
|
2610 |
CREATE FUNCTION keys(value "~type._plots_06a_list_of_stems") RETURNS "keys_~type._plots_06a_list_of_stems" |
|
2611 |
LANGUAGE sql IMMUTABLE |
|
2612 |
AS $_$ |
|
2613 |
SELECT ROW($1.project_name, $1.plot_code, $1.stem_id)::public_validations."keys_~type._plots_06a_list_of_stems" |
|
2614 |
$_$; |
|
2615 |
|
|
2616 |
|
|
2617 |
-- |
|
2574 | 2618 |
-- Name: ~type._plots_10_count_of_individuals_per_plot_in_each_project; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: |
2575 | 2619 |
-- |
2576 | 2620 |
|
... | ... | |
3489 | 3533 |
|
3490 | 3534 |
|
3491 | 3535 |
-- |
3536 |
-- Name: values_("~type._plots_06a_list_of_stems"); Type: FUNCTION; Schema: public_validations; Owner: - |
|
3537 |
-- |
|
3538 |
|
|
3539 |
CREATE FUNCTION values_(value "~type._plots_06a_list_of_stems") RETURNS "values__~type._plots_06a_list_of_stems" |
|
3540 |
LANGUAGE sql IMMUTABLE |
|
3541 |
AS $_$ |
|
3542 |
SELECT ROW($1.project_name, $1.plot_code, $1.stem_id)::public_validations."values__~type._plots_06a_list_of_stems" |
|
3543 |
$_$; |
|
3544 |
|
|
3545 |
|
|
3546 |
-- |
|
3492 | 3547 |
-- Name: values_("~type._plots_10_count_of_individuals_per_plot_in_each_project"); Type: FUNCTION; Schema: public_validations; Owner: - |
3493 | 3548 |
-- |
3494 | 3549 |
|
... | ... | |
7356 | 7411 |
|
7357 | 7412 |
|
7358 | 7413 |
-- |
7414 |
-- Name: _plots_06a_list_of_stems; Type: VIEW; Schema: public_validations; Owner: - |
|
7415 |
-- |
|
7416 |
|
|
7417 |
CREATE VIEW _plots_06a_list_of_stems AS |
|
7418 |
SELECT project.projectname AS project_name, |
|
7419 |
plot.authorlocationcode AS plot_code, |
|
7420 |
stemobservation.sourceaccessioncode AS stem_id |
|
7421 |
FROM ((((((public.plot |
|
7422 |
JOIN public.locationevent USING (plot_id)) |
|
7423 |
LEFT JOIN public.project USING (project_id)) |
|
7424 |
JOIN public.taxonoccurrence USING (locationevent_id)) |
|
7425 |
JOIN public.aggregateoccurrence USING (taxonoccurrence_id)) |
|
7426 |
JOIN public.plantobservation USING (aggregateoccurrence_id)) |
|
7427 |
JOIN public.stemobservation USING (plantobservation_id)) |
|
7428 |
WHERE ((plot.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname)) AND ((stemobservation.sourceaccessioncode IS NOT NULL) OR (stemobservation.authorstemcode IS NOT NULL))) |
|
7429 |
ORDER BY project.projectname, plot.authorlocationcode, stemobservation.sourceaccessioncode; |
|
7430 |
|
|
7431 |
|
|
7432 |
-- |
|
7359 | 7433 |
-- Name: _plots_10_count_of_individuals_per_plot_in_each_project; Type: VIEW; Schema: public_validations; Owner: - |
7360 | 7434 |
-- |
7361 | 7435 |
|
... | ... | |
10578 | 10652 |
|
10579 | 10653 |
|
10580 | 10654 |
-- |
10655 |
-- Data for Name: ~type._plots_06a_list_of_stems; Type: TABLE DATA; Schema: public_validations; Owner: - |
|
10656 |
-- |
|
10657 |
|
|
10658 |
|
|
10659 |
|
|
10660 |
-- |
|
10581 | 10661 |
-- Data for Name: ~type._plots_10_count_of_individuals_per_plot_in_each_project; Type: TABLE DATA; Schema: public_validations; Owner: - |
10582 | 10662 |
-- |
10583 | 10663 |
|
Also available in: Unified diff
schemas/vegbien.sql, inputs/SALVIAS/validations.sql: added _plots_06a_list_of_stems, for use in figuring out the diff in _plots_06_list_of_plots_with_stem_measurements