Project

General

Profile

« Previous | Next » 

Revision 12527

fix: schemas/vegbien.sql: plots* validation queries: renamed plot_code columns (with names plotcode, plotCode, SiteCode) to match the input queries (plot_code)

View differences:

vegbien.sql
1971 1971
SET search_path = public_validations, pg_catalog;
1972 1972

  
1973 1973
--
1974
-- Name: ~type._plots_04_count_of_plots_in_each_project_in_this_source; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
1975
--
1976

  
1977
CREATE TABLE "~type._plots_04_count_of_plots_in_each_project_in_this_source" (
1978
    project_name text,
1979
    plots bigint
1980
);
1981

  
1982

  
1983
--
1984
-- Name: keys("~type._plots_04_count_of_plots_in_each_project_in_this_source"); Type: FUNCTION; Schema: public_validations; Owner: -
1985
--
1986

  
1987
CREATE FUNCTION keys(value "~type._plots_04_count_of_plots_in_each_project_in_this_source") RETURNS record
1988
    LANGUAGE sql IMMUTABLE
1989
    AS $_$
1990
SELECT $1.project_name
1991
$_$;
1992

  
1993

  
1994
--
1995
-- Name: ~type._traits_04_count_records_per_trait; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
1996
--
1997

  
1998
CREATE TABLE "~type._traits_04_count_records_per_trait" (
1999
    trait text,
2000
    measurements bigint
2001
);
2002

  
2003

  
2004
--
2005
-- Name: keys("~type._traits_04_count_records_per_trait"); Type: FUNCTION; Schema: public_validations; Owner: -
2006
--
2007

  
2008
CREATE FUNCTION keys(value "~type._traits_04_count_records_per_trait") RETURNS record
2009
    LANGUAGE sql IMMUTABLE
2010
    AS $_$
2011
SELECT $1.trait
2012
$_$;
2013

  
2014

  
2015
--
2016 1974
-- Name: query_view_relation_max_prefix_len(); Type: FUNCTION; Schema: public_validations; Owner: -
2017 1975
--
2018 1976

  
......
2493 2451
$_$;
2494 2452

  
2495 2453

  
2454
--
2455
-- Name: ~type._plots_01_count_of_projects; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
2456
--
2457

  
2458
CREATE TABLE "~type._plots_01_count_of_projects" (
2459
    projects bigint
2460
);
2461

  
2462

  
2463
--
2464
-- Name: ~type._plots_02_list_of_project_names; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
2465
--
2466

  
2467
CREATE TABLE "~type._plots_02_list_of_project_names" (
2468
    project_name text
2469
);
2470

  
2471

  
2472
--
2473
-- Name: ~type._plots_03_count_of_all_plots_in_this_source; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
2474
--
2475

  
2476
CREATE TABLE "~type._plots_03_count_of_all_plots_in_this_source" (
2477
    plots bigint
2478
);
2479

  
2480

  
2481
--
2482
-- Name: ~type._plots_04_count_of_plots_in_each_project_in_this_source; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
2483
--
2484

  
2485
CREATE TABLE "~type._plots_04_count_of_plots_in_each_project_in_this_source" (
2486
    project_name text,
2487
    plots bigint
2488
);
2489

  
2490

  
2491
--
2492
-- Name: ~type._plots_10_count_of_individuals_per_plot_in_each_project; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
2493
--
2494

  
2495
CREATE TABLE "~type._plots_10_count_of_individuals_per_plot_in_each_project" (
2496
    project_name text,
2497
    plot_code text,
2498
    individuals bigint
2499
);
2500

  
2501

  
2502
--
2503
-- Name: ~type._plots_11_count_of_stems_per_plot_in_each_project; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
2504
--
2505

  
2506
CREATE TABLE "~type._plots_11_count_of_stems_per_plot_in_each_project" (
2507
    project_name text,
2508
    plot_code text,
2509
    stems bigint
2510
);
2511

  
2512

  
2513
--
2514
-- Name: ~type._plots_12_count_of_verbatim_taxa_per_plot_in_each_project; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
2515
--
2516

  
2517
CREATE TABLE "~type._plots_12_count_of_verbatim_taxa_per_plot_in_each_project" (
2518
    project_name text,
2519
    plot_code text,
2520
    taxa bigint
2521
);
2522

  
2523

  
2524
--
2525
-- Name: ~type._plots_13_list_of_distinct_verbatim_taxa_in_each_plot_in_; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
2526
--
2527

  
2528
CREATE TABLE "~type._plots_13_list_of_distinct_verbatim_taxa_in_each_plot_in_" (
2529
    project_name text,
2530
    plot_code text,
2531
    taxon text
2532
);
2533

  
2534

  
2535
--
2536
-- Name: ~type._plots_14_count_of_indiv_per_verbatim_taxon_per_plot_in_e; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
2537
--
2538

  
2539
CREATE TABLE "~type._plots_14_count_of_indiv_per_verbatim_taxon_per_plot_in_e" (
2540
    project_name text,
2541
    plot_code text,
2542
    taxon text,
2543
    individuals bigint
2544
);
2545

  
2546

  
2547
--
2548
-- Name: ~type._plots_17_count_of_subplots_per_plot_for_each_project; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
2549
--
2550

  
2551
CREATE TABLE "~type._plots_17_count_of_subplots_per_plot_for_each_project" (
2552
    project_name text,
2553
    plot_code text,
2554
    subplots bigint
2555
);
2556

  
2557

  
2496 2558
SET search_path = public, pg_catalog;
2497 2559

  
2498 2560
--
......
6021 6083

  
6022 6084
CREATE VIEW _plots_05_list_of_plot_codes_by_project AS
6023 6085
 SELECT p.projectname AS project_name, 
6024
    l.authorlocationcode AS "plotCode"
6086
    l.authorlocationcode AS plot_code
6025 6087
   FROM (((public.location l
6026 6088
   JOIN public.locationevent le ON ((l.location_id = le.location_id)))
6027 6089
   JOIN public.project p ON ((p.project_id = le.project_id)))
......
6035 6097

  
6036 6098
CREATE VIEW _plots_06_list_of_plots_with_stem_measurements AS
6037 6099
 SELECT project.projectname AS project_name, 
6038
    plot.authorlocationcode AS "SiteCode"
6100
    plot.authorlocationcode AS plot_code
6039 6101
   FROM ((public.plot
6040 6102
   JOIN public.locationevent USING (location_id))
6041 6103
   JOIN public.project USING (project_id))
......
6057 6119

  
6058 6120
CREATE VIEW _plots_10_count_of_individuals_per_plot_in_each_project AS
6059 6121
 SELECT p.projectname AS project_name, 
6060
    l.authorlocationcode AS plotcode, 
6122
    l.authorlocationcode AS plot_code, 
6061 6123
    sum(ao.count) AS individuals
6062 6124
   FROM ((((((public.project p
6063 6125
   JOIN public.source s ON ((p.source_id = s.source_id)))
......
6088 6150

  
6089 6151
CREATE VIEW _plots_11_count_of_stems_per_plot_in_each_project AS
6090 6152
 SELECT p.projectname AS project_name, 
6091
    l.authorlocationcode AS plotcode, 
6153
    l.authorlocationcode AS plot_code, 
6092 6154
    count(DISTINCT so.stemobservation_id) AS stems
6093 6155
   FROM ((((((((public.project p
6094 6156
   JOIN public.source s ON ((p.source_id = s.source_id)))
......
6119 6181

  
6120 6182
CREATE VIEW _plots_12_count_of_verbatim_taxa_per_plot_in_each_project AS
6121 6183
 SELECT p.projectname AS project_name, 
6122
    l.authorlocationcode AS plotcode, 
6184
    l.authorlocationcode AS plot_code, 
6123 6185
    count(DISTINCT btrim((((((((''::text || COALESCE(tv.family, ''::text)) || ' '::text) || COALESCE(tv.genus, ''::text)) || ' '::text) || COALESCE(tv.specific_epithet, ''::text)) || ' '::text) || COALESCE(tv.morphospecies, ''::text)))) AS taxa
6124 6186
   FROM (((((((public.project p
6125 6187
   JOIN public.source s ON ((p.source_id = s.source_id)))
......
6151 6213

  
6152 6214
CREATE VIEW _plots_13_list_of_distinct_verbatim_taxa_in_each_plot_in_each_p AS
6153 6215
 SELECT DISTINCT p.projectname AS project_name, 
6154
    l.authorlocationcode AS plotcode, 
6216
    l.authorlocationcode AS plot_code, 
6155 6217
    btrim((((((((''::text || COALESCE(tv.family, ''::text)) || ' '::text) || COALESCE(tv.genus, ''::text)) || ' '::text) || COALESCE(tv.specific_epithet, ''::text)) || ' '::text) || COALESCE(tv.morphospecies, ''::text))) AS taxon
6156 6218
   FROM (((((((public.project p
6157 6219
   JOIN public.source s ON ((p.source_id = s.source_id)))
......
6180 6242

  
6181 6243
CREATE VIEW _plots_14_count_of_indiv_per_verbatim_taxon_per_plot_in_each_pr AS
6182 6244
 SELECT DISTINCT p.projectname AS project_name, 
6183
    l.authorlocationcode AS plotcode, 
6245
    l.authorlocationcode AS plot_code, 
6184 6246
    btrim((((((((''::text || COALESCE(tv.family, ''::text)) || ' '::text) || COALESCE(tv.genus, ''::text)) || ' '::text) || COALESCE(tv.specific_epithet, ''::text)) || ' '::text) || COALESCE(tv.morphospecies, ''::text))) AS taxon, 
6185 6247
    sum(ao.count) AS individuals
6186 6248
   FROM ((((((((public.project p
......
6212 6274

  
6213 6275
CREATE VIEW _plots_15_pct_cover_of_each_verb_taxon_in_each_plot_in_each_pro AS
6214 6276
 SELECT DISTINCT p.projectname AS project_name, 
6215
    l.authorlocationcode AS plotcode, 
6277
    l.authorlocationcode AS plot_code, 
6216 6278
    btrim((((((((''::text || COALESCE(tv.family, ''::text)) || ' '::text) || COALESCE(tv.genus, ''::text)) || ' '::text) || COALESCE(tv.specific_epithet, ''::text)) || ' '::text) || COALESCE(tv.morphospecies, ''::text))) AS taxon, 
6217 6279
    sum(ci.coverpercent) AS totalpercentcover
6218 6280
   FROM (((((((((public.project p
......
6248 6310

  
6249 6311
CREATE VIEW _plots_17_count_of_subplots_per_plot_for_each_project AS
6250 6312
 SELECT p.projectname AS project_name, 
6251
    l.authorlocationcode AS plotcode, 
6313
    l.authorlocationcode AS plot_code, 
6252 6314
    count(DISTINCT sub_locationevent.locationevent_id) AS subplots
6253 6315
   FROM ((((public.project p
6254 6316
   JOIN public.source s ON ((p.source_id = s.source_id)))
......
6266 6328

  
6267 6329
CREATE VIEW _plots_18_list_of_subplots_codes_for_each_plot_for_each_project AS
6268 6330
 SELECT p.projectname AS project_name, 
6269
    l.authorlocationcode AS plotcode, 
6270
    sub_locationevent.authoreventcode AS "subplotCode"
6331
    l.authorlocationcode AS plot_code, 
6332
    sub_locationevent.authoreventcode AS subplot_code
6271 6333
   FROM ((((public.project p
6272 6334
   JOIN public.source s ON ((p.source_id = s.source_id)))
6273 6335
   JOIN public.locationevent le ON ((p.project_id = le.project_id)))
......
6410 6472
  ORDER BY taxonverbatim.taxonname;
6411 6473

  
6412 6474

  
6413
--
6414
-- Name: ~type._plots_01_count_of_projects; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
6415
--
6416

  
6417
CREATE TABLE "~type._plots_01_count_of_projects" (
6418
    projects bigint
6419
);
6420

  
6421

  
6422
--
6423
-- Name: ~type._plots_02_list_of_project_names; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
6424
--
6425

  
6426
CREATE TABLE "~type._plots_02_list_of_project_names" (
6427
    project_name text
6428
);
6429

  
6430

  
6431
--
6432
-- Name: ~type._plots_03_count_of_all_plots_in_this_source; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
6433
--
6434

  
6435
CREATE TABLE "~type._plots_03_count_of_all_plots_in_this_source" (
6436
    plots bigint
6437
);
6438

  
6439

  
6440
--
6441
-- Name: ~type._plots_06_list_of_plots_with_stem_measurements; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
6442
--
6443

  
6444
CREATE TABLE "~type._plots_06_list_of_plots_with_stem_measurements" (
6445
    project_name text,
6446
    "SiteCode" text
6447
);
6448

  
6449

  
6450
--
6451
-- Name: ~type._plots_10_count_of_individuals_per_plot_in_each_project; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
6452
--
6453

  
6454
CREATE TABLE "~type._plots_10_count_of_individuals_per_plot_in_each_project" (
6455
    project_name text,
6456
    plotcode text,
6457
    individuals bigint
6458
);
6459

  
6460

  
6461
--
6462
-- Name: ~type._plots_11_count_of_stems_per_plot_in_each_project; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
6463
--
6464

  
6465
CREATE TABLE "~type._plots_11_count_of_stems_per_plot_in_each_project" (
6466
    project_name text,
6467
    plotcode text,
6468
    stems bigint
6469
);
6470

  
6471

  
6472
--
6473
-- Name: ~type._plots_12_count_of_verbatim_taxa_per_plot_in_each_project; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
6474
--
6475

  
6476
CREATE TABLE "~type._plots_12_count_of_verbatim_taxa_per_plot_in_each_project" (
6477
    project_name text,
6478
    plotcode text,
6479
    taxa bigint
6480
);
6481

  
6482

  
6483
--
6484
-- Name: ~type._plots_13_list_of_distinct_verbatim_taxa_in_each_plot_in_; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
6485
--
6486

  
6487
CREATE TABLE "~type._plots_13_list_of_distinct_verbatim_taxa_in_each_plot_in_" (
6488
    project_name text,
6489
    plotcode text,
6490
    taxon text
6491
);
6492

  
6493

  
6494
--
6495
-- Name: ~type._plots_14_count_of_indiv_per_verbatim_taxon_per_plot_in_e; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
6496
--
6497

  
6498
CREATE TABLE "~type._plots_14_count_of_indiv_per_verbatim_taxon_per_plot_in_e" (
6499
    project_name text,
6500
    plotcode text,
6501
    taxon text,
6502
    individuals bigint
6503
);
6504

  
6505

  
6506
--
6507
-- Name: ~type._plots_17_count_of_subplots_per_plot_for_each_project; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
6508
--
6509

  
6510
CREATE TABLE "~type._plots_17_count_of_subplots_per_plot_for_each_project" (
6511
    project_name text,
6512
    plotcode text,
6513
    subplots bigint
6514
);
6515

  
6516

  
6517
--
6518
-- Name: ~type._traits_01_count_records; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
6519
--
6520

  
6521
CREATE TABLE "~type._traits_01_count_records" (
6522
    "totalRecords" bigint
6523
);
6524

  
6525

  
6526
--
6527
-- Name: ~type._traits_02_count_trait_names; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
6528
--
6529

  
6530
CREATE TABLE "~type._traits_02_count_trait_names" (
6531
    traits bigint
6532
);
6533

  
6534

  
6535
--
6536
-- Name: ~type._traits_03_list_trait_names; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
6537
--
6538

  
6539
CREATE TABLE "~type._traits_03_list_trait_names" (
6540
    trait text
6541
);
6542

  
6543

  
6544
--
6545
-- Name: ~type._traits_05_count_taxa; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
6546
--
6547

  
6548
CREATE TABLE "~type._traits_05_count_taxa" (
6549
    taxa bigint
6550
);
6551

  
6552

  
6553
--
6554
-- Name: ~type._traits_06_list_distinct_taxa; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
6555
--
6556

  
6557
CREATE TABLE "~type._traits_06_list_distinct_taxa" (
6558
    taxonwithauthor text
6559
);
6560

  
6561

  
6562
--
6563
-- Name: ~type._traits_07_trait_value_and_units; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
6564
--
6565

  
6566
CREATE TABLE "~type._traits_07_trait_value_and_units" (
6567
    trait text,
6568
    value text,
6569
    units text
6570
);
6571

  
6572

  
6573
--
6574
-- Name: ~type._traits_08_taxonname_trait_and_value; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
6575
--
6576

  
6577
CREATE TABLE "~type._traits_08_taxonname_trait_and_value" (
6578
    taxonwithauthor text,
6579
    trait text,
6580
    value text
6581
);
6582

  
6583

  
6584 6475
SET search_path = public, pg_catalog;
6585 6476

  
6586 6477
--
......
9404 9295

  
9405 9296

  
9406 9297
--
9407
-- Data for Name: ~type._plots_06_list_of_plots_with_stem_measurements; Type: TABLE DATA; Schema: public_validations; Owner: -
9408
--
9409

  
9410

  
9411

  
9412
--
9413 9298
-- Data for Name: ~type._plots_10_count_of_individuals_per_plot_in_each_project; Type: TABLE DATA; Schema: public_validations; Owner: -
9414 9299
--
9415 9300

  
......
9445 9330

  
9446 9331

  
9447 9332

  
9448
--
9449
-- Data for Name: ~type._traits_01_count_records; Type: TABLE DATA; Schema: public_validations; Owner: -
9450
--
9451

  
9452

  
9453

  
9454
--
9455
-- Data for Name: ~type._traits_02_count_trait_names; Type: TABLE DATA; Schema: public_validations; Owner: -
9456
--
9457

  
9458

  
9459

  
9460
--
9461
-- Data for Name: ~type._traits_03_list_trait_names; Type: TABLE DATA; Schema: public_validations; Owner: -
9462
--
9463

  
9464

  
9465

  
9466
--
9467
-- Data for Name: ~type._traits_04_count_records_per_trait; Type: TABLE DATA; Schema: public_validations; Owner: -
9468
--
9469

  
9470

  
9471

  
9472
--
9473
-- Data for Name: ~type._traits_05_count_taxa; Type: TABLE DATA; Schema: public_validations; Owner: -
9474
--
9475

  
9476

  
9477

  
9478
--
9479
-- Data for Name: ~type._traits_06_list_distinct_taxa; Type: TABLE DATA; Schema: public_validations; Owner: -
9480
--
9481

  
9482

  
9483

  
9484
--
9485
-- Data for Name: ~type._traits_07_trait_value_and_units; Type: TABLE DATA; Schema: public_validations; Owner: -
9486
--
9487

  
9488

  
9489

  
9490
--
9491
-- Data for Name: ~type._traits_08_taxonname_trait_and_value; Type: TABLE DATA; Schema: public_validations; Owner: -
9492
--
9493

  
9494

  
9495

  
9496 9333
SET search_path = public, pg_catalog;
9497 9334

  
9498 9335
--

Also available in: Unified diff