Project

General

Profile

« Previous | Next » 

Revision 7252

schemas/vegbien.sql: unscrubbed_taxondetermination_view: Fixed bug where need to use tnrs_accepted.Name_submitted IS NOT NULL rather than tnrs_accepted.* IS NOT NULL, because tnrs_accepted.* (which plain tnrs_accepted gets changed to by PostgreSQL) checks each field of the tnrs_accepted tuple rather than checking if the tuple itself is NULL

View differences:

vegbien.sql
4558 4558
--
4559 4559

  
4560 4560
CREATE VIEW unscrubbed_taxondetermination_view AS
4561
    SELECT taxondetermination.taxonoccurrence_id, (CASE WHEN (tnrs_accepted.* IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Time_submitted" AS "Time_submitted", (CASE WHEN (tnrs_accepted.* IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Name_number" AS "Name_number", (CASE WHEN (tnrs_accepted.* IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Name_submitted" AS "Name_submitted", tnrs."Overall_score", (CASE WHEN (tnrs_accepted.* IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Name_matched" AS "Name_matched", (CASE WHEN (tnrs_accepted.* IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Name_matched_rank" AS "Name_matched_rank", tnrs."Name_score", (CASE WHEN (tnrs_accepted.* IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Name_matched_author" AS "Name_matched_author", (CASE WHEN (tnrs_accepted.* IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Name_matched_url" AS "Name_matched_url", (CASE WHEN (tnrs_accepted.* IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Author_matched" AS "Author_matched", tnrs."Author_score", (CASE WHEN (tnrs_accepted.* IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Family_matched" AS "Family_matched", tnrs."Family_score", (CASE WHEN (tnrs_accepted.* IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Name_matched_accepted_family" AS "Name_matched_accepted_family", (CASE WHEN (tnrs_accepted.* IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Genus_matched" AS "Genus_matched", tnrs."Genus_score", (CASE WHEN (tnrs_accepted.* IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Specific_epithet_matched" AS "Specific_epithet_matched", tnrs."Specific_epithet_score", (CASE WHEN (tnrs_accepted.* IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Infraspecific_rank" AS "Infraspecific_rank", (CASE WHEN (tnrs_accepted.* IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Infraspecific_epithet_matched" AS "Infraspecific_epithet_matched", tnrs."Infraspecific_epithet_score", (CASE WHEN (tnrs_accepted.* IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Infraspecific_rank_2" AS "Infraspecific_rank_2", (CASE WHEN (tnrs_accepted.* IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Infraspecific_epithet_2_matched" AS "Infraspecific_epithet_2_matched", tnrs."Infraspecific_epithet_2_score", tnrs."Annotations", tnrs."Unmatched_terms", (CASE WHEN (tnrs_accepted.* IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Taxonomic_status" AS "Taxonomic_status", (CASE WHEN (tnrs_accepted.* IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Selected" AS "Selected", (CASE WHEN (tnrs_accepted.* IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Source" AS "Source", (CASE WHEN (tnrs_accepted.* IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Warnings" AS "Warnings" FROM ((((taxondetermination JOIN taxonverbatim USING (taxonverbatim_id)) JOIN taxonlabel USING (taxonlabel_id)) JOIN "TNRS".tnrs ON ((tnrs."Name_submitted" = taxonlabel.taxonomicname))) LEFT JOIN "TNRS".tnrs tnrs_accepted ON ((tnrs_accepted."Name_submitted" = tnrs."Accepted_scientific_name"))) WHERE (taxondetermination.iscurrent AND (taxondetermination.source_id <> COALESCE((SELECT source.source_id FROM source WHERE (source.shortname = 'TNRS'::text)), 2147483647))) ORDER BY taxondetermination.taxonoccurrence_id;
4561
    SELECT taxondetermination.taxonoccurrence_id, (CASE WHEN (tnrs_accepted."Name_submitted" IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Time_submitted" AS "Time_submitted", (CASE WHEN (tnrs_accepted."Name_submitted" IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Name_number" AS "Name_number", (CASE WHEN (tnrs_accepted."Name_submitted" IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Name_submitted" AS "Name_submitted", tnrs."Overall_score", (CASE WHEN (tnrs_accepted."Name_submitted" IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Name_matched" AS "Name_matched", (CASE WHEN (tnrs_accepted."Name_submitted" IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Name_matched_rank" AS "Name_matched_rank", tnrs."Name_score", (CASE WHEN (tnrs_accepted."Name_submitted" IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Name_matched_author" AS "Name_matched_author", (CASE WHEN (tnrs_accepted."Name_submitted" IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Name_matched_url" AS "Name_matched_url", (CASE WHEN (tnrs_accepted."Name_submitted" IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Author_matched" AS "Author_matched", tnrs."Author_score", (CASE WHEN (tnrs_accepted."Name_submitted" IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Family_matched" AS "Family_matched", tnrs."Family_score", (CASE WHEN (tnrs_accepted."Name_submitted" IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Name_matched_accepted_family" AS "Name_matched_accepted_family", (CASE WHEN (tnrs_accepted."Name_submitted" IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Genus_matched" AS "Genus_matched", tnrs."Genus_score", (CASE WHEN (tnrs_accepted."Name_submitted" IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Specific_epithet_matched" AS "Specific_epithet_matched", tnrs."Specific_epithet_score", (CASE WHEN (tnrs_accepted."Name_submitted" IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Infraspecific_rank" AS "Infraspecific_rank", (CASE WHEN (tnrs_accepted."Name_submitted" IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Infraspecific_epithet_matched" AS "Infraspecific_epithet_matched", tnrs."Infraspecific_epithet_score", (CASE WHEN (tnrs_accepted."Name_submitted" IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Infraspecific_rank_2" AS "Infraspecific_rank_2", (CASE WHEN (tnrs_accepted."Name_submitted" IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Infraspecific_epithet_2_matched" AS "Infraspecific_epithet_2_matched", tnrs."Infraspecific_epithet_2_score", tnrs."Annotations", tnrs."Unmatched_terms", (CASE WHEN (tnrs_accepted."Name_submitted" IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Taxonomic_status" AS "Taxonomic_status", (CASE WHEN (tnrs_accepted."Name_submitted" IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Selected" AS "Selected", (CASE WHEN (tnrs_accepted."Name_submitted" IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Source" AS "Source", (CASE WHEN (tnrs_accepted."Name_submitted" IS NOT NULL) THEN tnrs_accepted.* ELSE tnrs.* END)."Warnings" AS "Warnings" FROM ((((taxondetermination JOIN taxonverbatim USING (taxonverbatim_id)) JOIN taxonlabel USING (taxonlabel_id)) JOIN "TNRS".tnrs ON ((tnrs."Name_submitted" = taxonlabel.taxonomicname))) LEFT JOIN "TNRS".tnrs tnrs_accepted ON ((tnrs_accepted."Name_submitted" = tnrs."Accepted_scientific_name"))) WHERE (taxondetermination.iscurrent AND (taxondetermination.source_id <> COALESCE((SELECT source.source_id FROM source WHERE (source.shortname = 'TNRS'::text)), 2147483647))) ORDER BY taxondetermination.taxonoccurrence_id;
4562 4562

  
4563 4563

  
4564 4564
--

Also available in: Unified diff