Project

General

Profile

1 10778 aaronmk
--
2
-- PostgreSQL database dump
3
--
4 10737 aaronmk
5 10778 aaronmk
SET statement_timeout = 0;
6 11708 aaronmk
SET lock_timeout = 0;
7 10778 aaronmk
SET client_encoding = 'UTF8';
8
SET standard_conforming_strings = on;
9
SET check_function_bodies = false;
10
SET client_min_messages = warning;
11
12 10737 aaronmk
--
13 10778 aaronmk
-- Name: TNRS; Type: SCHEMA; Schema: -; Owner: -
14
--
15 10737 aaronmk
16 10778 aaronmk
--CREATE SCHEMA "TNRS";
17 10725 aaronmk
18
19 11614 aaronmk
--
20
-- Name: SCHEMA "TNRS"; Type: COMMENT; Schema: -; Owner: -
21
--
22
23 13575 aaronmk
COMMENT ON SCHEMA "TNRS" IS '
24
IMPORTANT: when changing this schema, you must also make the same changes on vegbiendev:
25 11617 aaronmk
on vegbiendev:
26
# back up existing TNRS schema (in case of an accidental incorrect change):
27 11614 aaronmk
$ make backups/TNRS.backup-remake # runtime: 3 min ("real 2m44.277s")
28 11616 aaronmk
$ svn up
29
$ svn di
30
# make the changes shown in the diff
31
## to change column types:
32 13861 aaronmk
SELECT util.set_col_types(''"TNRS".taxon_match'', ARRAY[
33 11614 aaronmk
  (''col'', ''new_type'')
34 11616 aaronmk
]::util.col_cast[]); -- runtime: 9 min ("531282 ms")
35 11617 aaronmk
$ rm=1 inputs/.TNRS/schema.sql.run
36
# repeat until `svn di` shows no diff
37
# back up new TNRS schema:
38 13575 aaronmk
$ make backups/TNRS.backup-remake # runtime: 3 min ("real 2m44.277s")
39
';
40 11614 aaronmk
41
42 10778 aaronmk
SET search_path = "TNRS", pg_catalog;
43
44
--
45
-- Name: batch__fill(); Type: FUNCTION; Schema: TNRS; Owner: -
46
--
47
48
CREATE FUNCTION batch__fill() RETURNS trigger
49
    LANGUAGE plpgsql
50
    AS $$
51 10728 aaronmk
BEGIN
52
	new.id_by_time = new.time_submitted;
53
	new.id = COALESCE(new.id, new.id_by_time);
54
	RETURN new;
55
END;
56 10778 aaronmk
$$;
57 10728 aaronmk
58
59
--
60 10778 aaronmk
-- Name: family_is_homonym(text); Type: FUNCTION; Schema: TNRS; Owner: -
61
--
62 10728 aaronmk
63 10778 aaronmk
CREATE FUNCTION family_is_homonym(family text) RETURNS boolean
64
    LANGUAGE sql STABLE STRICT
65
    AS $_$
66
SELECT EXISTS(SELECT * FROM "IRMNG".family_homonym_epithet WHERE "taxonNameOrEpithet" = $1)
67
$_$;
68 10736 aaronmk
69 10778 aaronmk
70 10736 aaronmk
--
71 10778 aaronmk
-- Name: genus_is_homonym(text); Type: FUNCTION; Schema: TNRS; Owner: -
72
--
73 10736 aaronmk
74 10778 aaronmk
CREATE FUNCTION genus_is_homonym(genus text) RETURNS boolean
75
    LANGUAGE sql STABLE STRICT
76
    AS $_$
77
SELECT EXISTS(SELECT * FROM "IRMNG".genus_homonym_epithet WHERE "taxonNameOrEpithet" = $1)
78
$_$;
79 7844 aaronmk
80 9985 aaronmk
81 10778 aaronmk
--
82 11709 aaronmk
-- Name: map_taxonomic_status(text, text); Type: FUNCTION; Schema: TNRS; Owner: -
83
--
84
85 13503 aaronmk
CREATE FUNCTION map_taxonomic_status(taxonomic_status_verbatim text, accepted_taxon_name_no_author text) RETURNS text
86 11709 aaronmk
    LANGUAGE sql IMMUTABLE
87
    AS $_$
88 13503 aaronmk
/* from http://wiki.vegpath.org/2013-11-14_conference_call#taxonomic-fields:
89
"taxonomic_status should be accepted instead of synonym when an accepted name is
90
available (this is not always the case when a name is marked as a synonym)" */
91 11709 aaronmk
SELECT CASE WHEN $2 IS NOT NULL THEN 'accepted' ELSE lower($1) END
92
$_$;
93
94
95
--
96 13868 aaronmk
-- Name: taxon_match__batch_begin(); Type: FUNCTION; Schema: TNRS; Owner: -
97 13866 aaronmk
--
98
99 13868 aaronmk
CREATE FUNCTION taxon_match__batch_begin() RETURNS trigger
100 13866 aaronmk
    LANGUAGE plpgsql
101
    AS $$
102
BEGIN
103 13869 aaronmk
	PERFORM util.seq__reset('pg_temp.taxon_match__match_num__seq', 0);
104 13567 aaronmk
	RETURN NULL;
105
END;
106
$$;
107
108
109
--
110 13868 aaronmk
-- Name: taxon_match__fill(); Type: FUNCTION; Schema: TNRS; Owner: -
111 13578 aaronmk
--
112
113 13868 aaronmk
CREATE FUNCTION taxon_match__fill() RETURNS trigger
114 13578 aaronmk
    LANGUAGE plpgsql
115
    AS $$
116 11643 aaronmk
BEGIN
117 13871 aaronmk
	DECLARE
118
		"Specific_epithet_is_plant" boolean :=
119 11628 aaronmk
			(CASE
120 14111 aaronmk
			WHEN   new."*Infraspecific_epithet_matched"	 IS NOT NULL
121
				OR new."*Infraspecific_epithet_2_matched" IS NOT NULL
122
				OR new."*Specific_epithet_score" >= 0.9 -- fuzzy match
123 13871 aaronmk
				THEN true
124
			ELSE NULL -- ambiguous
125
			END);
126 14111 aaronmk
		never_homonym boolean = COALESCE(new."*Author_score" >= 0.6, false);
127 13871 aaronmk
			-- author disambiguates
128
		family_is_homonym boolean = NOT never_homonym
129 14111 aaronmk
			AND "TNRS".family_is_homonym(new."*Family_matched");
130 13871 aaronmk
		genus_is_homonym  boolean = NOT never_homonym
131 14111 aaronmk
			AND "TNRS".genus_is_homonym(new."*Genus_matched");
132 13871 aaronmk
	BEGIN
133
		/* exclude homonyms because these are not valid matches (TNRS provides a
134
		name, but the name is not meaningful because it is not unambiguous) */
135 14111 aaronmk
		new.is_valid_match = new."*Taxonomic_status" != 'Invalid'
136 13871 aaronmk
			AND COALESCE(CASE
137 14111 aaronmk
			WHEN new."*Family_score" = 1 AND NOT family_is_homonym -- exact match
138 13871 aaronmk
				THEN true
139
			ELSE -- consider genus
140 11628 aaronmk
				(CASE
141 14111 aaronmk
				WHEN new."*Genus_score" =  1	   -- exact match
142 13871 aaronmk
					THEN
143
					(CASE
144
					WHEN NOT genus_is_homonym THEN true
145
					ELSE "Specific_epithet_is_plant"
146
					END)
147 14111 aaronmk
				WHEN new."*Genus_score" >= 0.85 -- fuzzy match
148 13871 aaronmk
					THEN "Specific_epithet_is_plant"
149
				ELSE NULL -- ambiguous
150 11628 aaronmk
				END)
151 13871 aaronmk
			END, false);
152
	END;
153 11628 aaronmk
154 13871 aaronmk
	DECLARE
155
		matched_taxon_name_with_author text = NULLIF(concat_ws(' '
156 14111 aaronmk
			, NULLIF(NULLIF(new."*Name_matched_accepted_family", 'Unknown'),
157
				new."*Name_matched")
158
			, NULLIF(new."*Name_matched", 'No suitable matches found.')
159
			, new."*Name_matched_author"
160 13871 aaronmk
			), '');
161
		accepted_taxon_name_with_author text = NULLIF(concat_ws(' '
162 14111 aaronmk
			, NULLIF(NULLIF(new."*Accepted_name_family", 'Unknown'),
163
				new."*Accepted_name")
164
			, new."*Accepted_name"
165
			, new."*Accepted_name_author"
166 13871 aaronmk
			), '');
167
	BEGIN
168
		new.scrubbed_unique_taxon_name = COALESCE(
169
			accepted_taxon_name_with_author, matched_taxon_name_with_author);
170
	END;
171
172 11628 aaronmk
	RETURN new;
173 7134 aaronmk
END;
174 10778 aaronmk
$$;
175
176
177
--
178 13868 aaronmk
-- Name: FUNCTION taxon_match__fill(); Type: COMMENT; Schema: TNRS; Owner: -
179 10778 aaronmk
--
180
181 13868 aaronmk
COMMENT ON FUNCTION taxon_match__fill() IS '
182 13575 aaronmk
IMPORTANT: when changing this function, you must regenerate the derived cols:
183 13861 aaronmk
UPDATE "TNRS".taxon_match SET "Name_submitted" = "Name_submitted"
184 11715 aaronmk
runtime: 30 min ("5564082 rows affected, 1918900 ms execution time")
185 13861 aaronmk
VACUUM ANALYZE "TNRS".taxon_match -- to remove previous rows
186 13575 aaronmk
runtime: 1.5 min ("92633 ms")
187
';
188 7134 aaronmk
189 7251 aaronmk
190 13631 aaronmk
--
191 14122 aaronmk
-- Name: taxon_match__fill_derived(); Type: FUNCTION; Schema: TNRS; Owner: -
192
--
193
194
CREATE FUNCTION taxon_match__fill_derived() RETURNS trigger
195
    LANGUAGE plpgsql
196
    AS $$
197
BEGIN
198 14309 aaronmk
	-- clear derived cols so old values won't be used in calculations
199 14311 aaronmk
	new."[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org" = NULL;
200 14309 aaronmk
	new."[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org" = NULL;
201 14330 aaronmk
	new."matched~Name[_no_author]___@TNRS__@vegpath.org" = NULL;
202 14309 aaronmk
	new."[matched_]scientificName[_with_author]__@DwC__@vegpath.org" = NULL;
203
	new.matched_has_accepted = NULL;
204 14318 aaronmk
	new."Accepted_family__@TNRS__@vegpath.org" = NULL;
205 14309 aaronmk
	new."__accepted_{genus,specific_epithet}" = NULL;
206
	new."[accepted_]genus__@DwC__@vegpath.org" = NULL;
207
	new."[accepted_]specificEpithet__@DwC__@vegpath.org" = NULL;
208 14311 aaronmk
	new."[accepted_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org" = NULL;
209 14309 aaronmk
	new.__accepted_infraspecific_label = NULL;
210
	new."__accepted_infraspecific_{rank,epithet}" = NULL;
211
	new."[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" = NULL;
212
	new."[accepted_]infraspecificEpithet__@DwC__@vegpath.org" = NULL;
213
	new."[accepted_]scientificName[_with_author]__@DwC__@vegpath.org" = NULL;
214 14328 aaronmk
	new."[scrubbed_]taxonomicStatus__@DwC__@vegpath.org" = NULL;
215 14309 aaronmk
	new."[scrubbed_]taxonRank__@DwC__@vegpath.org" = NULL;
216
	new."[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org" = NULL;
217
	new."[scrubbed_]genus__@DwC__@vegpath.org" = NULL;
218
	new."[scrubbed_]specificEpithet__@DwC__@vegpath.org" = NULL;
219
	new."[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org" = NULL;
220 14328 aaronmk
	new."[scrubbed_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org" = NULL;
221 14309 aaronmk
	new."[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" = NULL;
222
	new."[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org" = NULL;
223
	new."[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org" = NULL;
224
	new."[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org" = NULL;
225
	new."[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org" = NULL;
226
227
	-- populate derived cols
228 14311 aaronmk
	new."[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org" = (SELECT "*Unmatched_terms" FROM (SELECT new.*) new);
229 14308 aaronmk
	new."[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org" = (SELECT ("*Genus_matched" || ' '::text) || "*Specific_epithet_matched" FROM (SELECT new.*) new);
230 14330 aaronmk
	new."matched~Name[_no_author]___@TNRS__@vegpath.org" = (SELECT NULLIF("*Name_matched", 'No suitable matches found.'::text) FROM (SELECT new.*) new);
231
	new."[matched_]scientificName[_with_author]__@DwC__@vegpath.org" = (SELECT "matched~Name[_no_author]___@TNRS__@vegpath.org" || COALESCE((' '::text || "*Name_matched_author"), ''::text) FROM (SELECT new.*) new);
232 14308 aaronmk
	new.matched_has_accepted = (SELECT "*Accepted_name" IS NOT NULL FROM (SELECT new.*) new);
233 14318 aaronmk
	new."Accepted_family__@TNRS__@vegpath.org" = (SELECT COALESCE("*Accepted_name_family",
234
CASE
235
    WHEN ("*Accepted_name_rank" = 'family'::text) THEN "*Accepted_name"
236
    ELSE NULL::text
237
END) FROM (SELECT new.*) new);
238 14308 aaronmk
	new."__accepted_{genus,specific_epithet}" = (SELECT regexp_split_to_array("*Accepted_name_species", ' '::text) FROM (SELECT new.*) new);
239 14325 aaronmk
	new."[accepted_]genus__@DwC__@vegpath.org" = (SELECT COALESCE("__accepted_{genus,specific_epithet}"[1],
240
CASE
241
    WHEN ("*Accepted_name_rank" = 'genus'::text) THEN "*Accepted_name"
242
    ELSE NULL::text
243
END) FROM (SELECT new.*) new);
244 14308 aaronmk
	new."[accepted_]specificEpithet__@DwC__@vegpath.org" = (SELECT "__accepted_{genus,specific_epithet}"[2] FROM (SELECT new.*) new);
245 14311 aaronmk
	new."[accepted_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org" = (SELECT CASE
246 14323 aaronmk
    WHEN ("*Accepted_name_rank" = 'family'::text) THEN concat_ws(' '::text, "Accepted_family__@TNRS__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
247 14327 aaronmk
    WHEN ("*Accepted_name_rank" = 'genus'::text) THEN concat_ws(' '::text, "[accepted_]genus__@DwC__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
248 14311 aaronmk
    ELSE "*Accepted_name_species"
249
END FROM (SELECT new.*) new);
250 14308 aaronmk
	new.__accepted_infraspecific_label = (SELECT ltrim(NULLIF(util.remove_prefix("*Accepted_name_species", "*Accepted_name", require := true), ''::text), ' '::text) FROM (SELECT new.*) new);
251
	new."__accepted_infraspecific_{rank,epithet}" = (SELECT regexp_split_to_array(__accepted_infraspecific_label, ' '::text) FROM (SELECT new.*) new);
252
	new."[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" = (SELECT "__accepted_infraspecific_{rank,epithet}"[1] FROM (SELECT new.*) new);
253
	new."[accepted_]infraspecificEpithet__@DwC__@vegpath.org" = (SELECT "__accepted_infraspecific_{rank,epithet}"[2] FROM (SELECT new.*) new);
254
	new."[accepted_]scientificName[_with_author]__@DwC__@vegpath.org" = (SELECT "*Accepted_name" || COALESCE((' '::text || "*Accepted_name_author"), ''::text) FROM (SELECT new.*) new);
255 14328 aaronmk
	new."[scrubbed_]taxonomicStatus__@DwC__@vegpath.org" = (SELECT "TNRS".map_taxonomic_status("*Taxonomic_status", "*Accepted_name") FROM (SELECT new.*) new);
256 14308 aaronmk
	new."[scrubbed_]taxonRank__@DwC__@vegpath.org" = (SELECT CASE
257 14282 aaronmk
    WHEN matched_has_accepted THEN "*Accepted_name_rank"
258
    ELSE "*Name_matched_rank"
259 14308 aaronmk
END FROM (SELECT new.*) new);
260
	new."[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org" = (SELECT CASE
261 14323 aaronmk
    WHEN matched_has_accepted THEN "Accepted_family__@TNRS__@vegpath.org"
262 14282 aaronmk
    ELSE "*Name_matched_accepted_family"
263 14308 aaronmk
END FROM (SELECT new.*) new);
264
	new."[scrubbed_]genus__@DwC__@vegpath.org" = (SELECT CASE
265 14282 aaronmk
    WHEN matched_has_accepted THEN "[accepted_]genus__@DwC__@vegpath.org"
266
    ELSE "*Genus_matched"
267 14308 aaronmk
END FROM (SELECT new.*) new);
268
	new."[scrubbed_]specificEpithet__@DwC__@vegpath.org" = (SELECT CASE
269 14282 aaronmk
    WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
270
    ELSE "*Specific_epithet_matched"
271 14308 aaronmk
END FROM (SELECT new.*) new);
272
	new."[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org" = (SELECT CASE
273 14282 aaronmk
    WHEN matched_has_accepted THEN "*Accepted_name_species"
274
    ELSE "[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org"
275 14308 aaronmk
END FROM (SELECT new.*) new);
276 14328 aaronmk
	new."[scrubbed_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org" = (SELECT CASE
277
    WHEN ("[scrubbed_]taxonRank__@DwC__@vegpath.org" = 'family'::text) THEN concat_ws(' '::text, "[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
278
    WHEN ("[scrubbed_]taxonRank__@DwC__@vegpath.org" = 'genus'::text) THEN concat_ws(' '::text, "[scrubbed_]genus__@DwC__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
279
    ELSE "[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org"
280
END FROM (SELECT new.*) new);
281 14308 aaronmk
	new."[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" = (SELECT CASE
282 14282 aaronmk
    WHEN matched_has_accepted THEN "[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org"
283
    ELSE "*Infraspecific_rank"
284 14308 aaronmk
END FROM (SELECT new.*) new);
285
	new."[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org" = (SELECT CASE
286 14282 aaronmk
    WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
287
    ELSE "*Infraspecific_epithet_matched"
288 14308 aaronmk
END FROM (SELECT new.*) new);
289
	new."[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org" = (SELECT CASE
290 14282 aaronmk
    WHEN matched_has_accepted THEN "*Accepted_name"
291 14330 aaronmk
    ELSE "matched~Name[_no_author]___@TNRS__@vegpath.org"
292 14308 aaronmk
END FROM (SELECT new.*) new);
293
	new."[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org" = (SELECT CASE
294 14282 aaronmk
    WHEN matched_has_accepted THEN "*Accepted_name_author"
295
    ELSE "*Name_matched_author"
296 14308 aaronmk
END FROM (SELECT new.*) new);
297
	new."[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org" = (SELECT CASE
298 14282 aaronmk
    WHEN matched_has_accepted THEN "[accepted_]scientificName[_with_author]__@DwC__@vegpath.org"
299
    ELSE "[matched_]scientificName[_with_author]__@DwC__@vegpath.org"
300 14308 aaronmk
END FROM (SELECT new.*) new);
301 14304 aaronmk
302 14122 aaronmk
	RETURN new;
303
END;
304
$$;
305
306
307
--
308 14254 aaronmk
-- Name: FUNCTION taxon_match__fill_derived(); Type: COMMENT; Schema: TNRS; Owner: -
309
--
310
311
COMMENT ON FUNCTION taxon_match__fill_derived() IS '
312
autogenerated, do not edit
313
314
to regenerate:
315
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
316
';
317
318
319
--
320 13868 aaronmk
-- Name: taxon_match__match_num__fill(); Type: FUNCTION; Schema: TNRS; Owner: -
321
--
322
323
CREATE FUNCTION taxon_match__match_num__fill() RETURNS trigger
324
    LANGUAGE plpgsql
325
    AS $$
326
BEGIN
327
	IF new.match_num IS NULL THEN
328 13869 aaronmk
		new.match_num = "TNRS".taxon_match__match_num__next();
329 13868 aaronmk
	END IF;
330
	RETURN new;
331
END;
332
$$;
333
334
335
--
336 13869 aaronmk
-- Name: taxon_match__match_num__next(); Type: FUNCTION; Schema: TNRS; Owner: -
337
--
338
339
CREATE FUNCTION taxon_match__match_num__next() RETURNS bigint
340
    LANGUAGE sql
341
    AS $$
342
SELECT nextval('pg_temp.taxon_match__match_num__seq');
343
$$;
344
345
346
--
347 13868 aaronmk
-- Name: taxon_match_input__copy_to__insert(); Type: FUNCTION; Schema: TNRS; Owner: -
348
--
349
350
CREATE FUNCTION taxon_match_input__copy_to__insert() RETURNS trigger
351
    LANGUAGE plpgsql
352
    AS $$
353
BEGIN
354
	INSERT INTO "TNRS".taxon_match_input SELECT new.*;
355
	RETURN NULL;
356
END;
357
$$;
358
359
360
--
361
-- Name: taxon_name_is_safe(text); Type: FUNCTION; Schema: TNRS; Owner: -
362
--
363
364
CREATE FUNCTION taxon_name_is_safe(taxon_name text) RETURNS boolean
365
    LANGUAGE sql IMMUTABLE
366
    AS $_$
367
SELECT NOT ($1 = ANY("TNRS".unsafe_taxon_names()))
368
$_$;
369
370
371
--
372 13631 aaronmk
-- Name: unsafe_taxon_names(); Type: FUNCTION; Schema: TNRS; Owner: -
373
--
374
375
CREATE FUNCTION unsafe_taxon_names() RETURNS text[]
376
    LANGUAGE sql IMMUTABLE
377
    AS $$
378
SELECT ARRAY[
379 13686 aaronmk
]::text[]
380 13631 aaronmk
$$;
381
382
383 10778 aaronmk
SET default_tablespace = '';
384
385
SET default_with_oids = false;
386
387 10728 aaronmk
--
388 13861 aaronmk
-- Name: taxon_match; Type: TABLE; Schema: TNRS; Owner: -; Tablespace:
389 10778 aaronmk
--
390 7251 aaronmk
391 13861 aaronmk
CREATE TABLE taxon_match (
392 10778 aaronmk
    batch text DEFAULT now() NOT NULL,
393 13580 aaronmk
    match_num integer NOT NULL,
394 14111 aaronmk
    "*Name_number" integer NOT NULL,
395
    "*Name_submitted" text NOT NULL,
396
    "*Overall_score" double precision,
397
    "*Name_matched" text,
398
    "*Name_matched_rank" text,
399
    "*Name_score" double precision,
400
    "*Name_matched_author" text,
401
    "*Name_matched_url" text,
402
    "*Author_matched" text,
403
    "*Author_score" double precision,
404
    "*Family_matched" text,
405
    "*Family_score" double precision,
406
    "*Name_matched_accepted_family" text,
407
    "*Genus_matched" text,
408
    "*Genus_score" double precision,
409
    "*Specific_epithet_matched" text,
410
    "*Specific_epithet_score" double precision,
411
    "*Infraspecific_rank" text,
412
    "*Infraspecific_epithet_matched" text,
413
    "*Infraspecific_epithet_score" double precision,
414
    "*Infraspecific_rank_2" text,
415
    "*Infraspecific_epithet_2_matched" text,
416
    "*Infraspecific_epithet_2_score" double precision,
417
    "*Annotations" text,
418
    "*Unmatched_terms" text,
419
    "*Taxonomic_status" text,
420
    "*Accepted_name" text,
421
    "*Accepted_name_author" text,
422
    "*Accepted_name_rank" text,
423
    "*Accepted_name_url" text,
424
    "*Accepted_name_species" text,
425
    "*Accepted_name_family" text,
426
    "*Selected" text,
427
    "*Source" text,
428
    "*Warnings" text,
429
    "*Accepted_name_lsid" text,
430 11628 aaronmk
    is_valid_match boolean NOT NULL,
431 14122 aaronmk
    scrubbed_unique_taxon_name text,
432 14310 aaronmk
    "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org" text,
433 14279 aaronmk
    "[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org" text,
434 14329 aaronmk
    "matched~Name[_no_author]___@TNRS__@vegpath.org" text,
435 14279 aaronmk
    "[matched_]scientificName[_with_author]__@DwC__@vegpath.org" text,
436
    matched_has_accepted boolean,
437 14318 aaronmk
    "Accepted_family__@TNRS__@vegpath.org" text,
438 14122 aaronmk
    "__accepted_{genus,specific_epithet}" text[],
439 14257 aaronmk
    "[accepted_]genus__@DwC__@vegpath.org" text,
440
    "[accepted_]specificEpithet__@DwC__@vegpath.org" text,
441 14310 aaronmk
    "[accepted_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org" text,
442 14264 aaronmk
    __accepted_infraspecific_label text,
443 14265 aaronmk
    "__accepted_infraspecific_{rank,epithet}" text[],
444 14266 aaronmk
    "[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" text,
445
    "[accepted_]infraspecificEpithet__@DwC__@vegpath.org" text,
446 14267 aaronmk
    "[accepted_]scientificName[_with_author]__@DwC__@vegpath.org" text,
447 14328 aaronmk
    "[scrubbed_]taxonomicStatus__@DwC__@vegpath.org" text,
448 14281 aaronmk
    "[scrubbed_]taxonRank__@DwC__@vegpath.org" text,
449
    "[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org" text,
450
    "[scrubbed_]genus__@DwC__@vegpath.org" text,
451
    "[scrubbed_]specificEpithet__@DwC__@vegpath.org" text,
452
    "[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org" text,
453 14328 aaronmk
    "[scrubbed_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org" text,
454 14281 aaronmk
    "[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" text,
455
    "[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org" text,
456
    "[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org" text,
457
    "[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org" text,
458
    "[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org" text,
459 14318 aaronmk
    CONSTRAINT "Accepted_family__@TNRS__@vegpath.org" CHECK ((NOT ("Accepted_family__@TNRS__@vegpath.org" IS DISTINCT FROM COALESCE("*Accepted_name_family",
460
CASE
461
    WHEN ("*Accepted_name_rank" = 'family'::text) THEN "*Accepted_name"
462
    ELSE NULL::text
463
END)))),
464 14266 aaronmk
    CONSTRAINT "[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" CHECK ((NOT ("[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" IS DISTINCT FROM "__accepted_infraspecific_{rank,epithet}"[1]))),
465 14325 aaronmk
    CONSTRAINT "[accepted_]genus__@DwC__@vegpath.org" CHECK ((NOT ("[accepted_]genus__@DwC__@vegpath.org" IS DISTINCT FROM COALESCE("__accepted_{genus,specific_epithet}"[1],
466
CASE
467
    WHEN ("*Accepted_name_rank" = 'genus'::text) THEN "*Accepted_name"
468
    ELSE NULL::text
469
END)))),
470 14266 aaronmk
    CONSTRAINT "[accepted_]infraspecificEpithet__@DwC__@vegpath.org" CHECK ((NOT ("[accepted_]infraspecificEpithet__@DwC__@vegpath.org" IS DISTINCT FROM "__accepted_infraspecific_{rank,epithet}"[2]))),
471 14304 aaronmk
    CONSTRAINT "[accepted_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org" CHECK ((NOT ("[accepted_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org" IS DISTINCT FROM
472
CASE
473 14323 aaronmk
    WHEN ("*Accepted_name_rank" = 'family'::text) THEN concat_ws(' '::text, "Accepted_family__@TNRS__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
474 14327 aaronmk
    WHEN ("*Accepted_name_rank" = 'genus'::text) THEN concat_ws(' '::text, "[accepted_]genus__@DwC__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
475 14304 aaronmk
    ELSE "*Accepted_name_species"
476
END))),
477 14267 aaronmk
    CONSTRAINT "[accepted_]scientificName[_with_author]__@DwC__@vegpath.org" CHECK ((NOT ("[accepted_]scientificName[_with_author]__@DwC__@vegpath.org" IS DISTINCT FROM ("*Accepted_name" || COALESCE((' '::text || "*Accepted_name_author"), ''::text))))),
478 14257 aaronmk
    CONSTRAINT "[accepted_]specificEpithet__@DwC__@vegpath.org" CHECK ((NOT ("[accepted_]specificEpithet__@DwC__@vegpath.org" IS DISTINCT FROM "__accepted_{genus,specific_epithet}"[2]))),
479 14330 aaronmk
    CONSTRAINT "[matched_]scientificName[_with_author]__@DwC__@vegpath.org" CHECK ((NOT ("[matched_]scientificName[_with_author]__@DwC__@vegpath.org" IS DISTINCT FROM ("matched~Name[_no_author]___@TNRS__@vegpath.org" || COALESCE((' '::text || "*Name_matched_author"), ''::text))))),
480 14278 aaronmk
    CONSTRAINT "[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org" CHECK ((NOT ("[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org" IS DISTINCT FROM (("*Genus_matched" || ' '::text) || "*Specific_epithet_matched")))),
481 14303 aaronmk
    CONSTRAINT "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org" CHECK ((NOT ("[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org" IS DISTINCT FROM "*Unmatched_terms"))),
482 14281 aaronmk
    CONSTRAINT "[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" CHECK ((NOT ("[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" IS DISTINCT FROM
483
CASE
484
    WHEN matched_has_accepted THEN "[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org"
485
    ELSE "*Infraspecific_rank"
486
END))),
487
    CONSTRAINT "[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org" CHECK ((NOT ("[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org" IS DISTINCT FROM
488
CASE
489
    WHEN matched_has_accepted THEN "*Accepted_name_author"
490
    ELSE "*Name_matched_author"
491
END))),
492
    CONSTRAINT "[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org" CHECK ((NOT ("[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org" IS DISTINCT FROM
493
CASE
494 14323 aaronmk
    WHEN matched_has_accepted THEN "Accepted_family__@TNRS__@vegpath.org"
495 14281 aaronmk
    ELSE "*Name_matched_accepted_family"
496
END))),
497
    CONSTRAINT "[scrubbed_]genus__@DwC__@vegpath.org" CHECK ((NOT ("[scrubbed_]genus__@DwC__@vegpath.org" IS DISTINCT FROM
498
CASE
499
    WHEN matched_has_accepted THEN "[accepted_]genus__@DwC__@vegpath.org"
500
    ELSE "*Genus_matched"
501
END))),
502
    CONSTRAINT "[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org" CHECK ((NOT ("[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org" IS DISTINCT FROM
503
CASE
504
    WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
505
    ELSE "*Infraspecific_epithet_matched"
506
END))),
507 14326 aaronmk
    CONSTRAINT "[scrubbed_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org" CHECK ((NOT ("[scrubbed_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org" IS DISTINCT FROM
508
CASE
509
    WHEN ("[scrubbed_]taxonRank__@DwC__@vegpath.org" = 'family'::text) THEN concat_ws(' '::text, "[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
510
    WHEN ("[scrubbed_]taxonRank__@DwC__@vegpath.org" = 'genus'::text) THEN concat_ws(' '::text, "[scrubbed_]genus__@DwC__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
511
    ELSE "[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org"
512
END))),
513 14281 aaronmk
    CONSTRAINT "[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org" CHECK ((NOT ("[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org" IS DISTINCT FROM
514
CASE
515
    WHEN matched_has_accepted THEN "*Accepted_name"
516 14330 aaronmk
    ELSE "matched~Name[_no_author]___@TNRS__@vegpath.org"
517 14281 aaronmk
END))),
518
    CONSTRAINT "[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org" CHECK ((NOT ("[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org" IS DISTINCT FROM
519
CASE
520
    WHEN matched_has_accepted THEN "[accepted_]scientificName[_with_author]__@DwC__@vegpath.org"
521
    ELSE "[matched_]scientificName[_with_author]__@DwC__@vegpath.org"
522
END))),
523
    CONSTRAINT "[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org" CHECK ((NOT ("[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org" IS DISTINCT FROM
524
CASE
525
    WHEN matched_has_accepted THEN "*Accepted_name_species"
526
    ELSE "[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org"
527
END))),
528
    CONSTRAINT "[scrubbed_]specificEpithet__@DwC__@vegpath.org" CHECK ((NOT ("[scrubbed_]specificEpithet__@DwC__@vegpath.org" IS DISTINCT FROM
529
CASE
530
    WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
531
    ELSE "*Specific_epithet_matched"
532
END))),
533
    CONSTRAINT "[scrubbed_]taxonRank__@DwC__@vegpath.org" CHECK ((NOT ("[scrubbed_]taxonRank__@DwC__@vegpath.org" IS DISTINCT FROM
534
CASE
535
    WHEN matched_has_accepted THEN "*Accepted_name_rank"
536
    ELSE "*Name_matched_rank"
537
END))),
538 14324 aaronmk
    CONSTRAINT "[scrubbed_]taxonomicStatus__@DwC__@vegpath.org" CHECK ((NOT ("[scrubbed_]taxonomicStatus__@DwC__@vegpath.org" IS DISTINCT FROM map_taxonomic_status("*Taxonomic_status", "*Accepted_name")))),
539 14264 aaronmk
    CONSTRAINT __accepted_infraspecific_label CHECK ((NOT (__accepted_infraspecific_label IS DISTINCT FROM ltrim(NULLIF(util.remove_prefix("*Accepted_name_species", "*Accepted_name", require := true), ''::text), ' '::text)))),
540 14265 aaronmk
    CONSTRAINT "__accepted_infraspecific_{rank,epithet}" CHECK ((NOT ("__accepted_infraspecific_{rank,epithet}" IS DISTINCT FROM regexp_split_to_array(__accepted_infraspecific_label, ' '::text)))),
541 14269 aaronmk
    CONSTRAINT "__accepted_{genus,specific_epithet}" CHECK ((NOT ("__accepted_{genus,specific_epithet}" IS DISTINCT FROM regexp_split_to_array("*Accepted_name_species", ' '::text)))),
542 14329 aaronmk
    CONSTRAINT matched_has_accepted CHECK ((NOT (matched_has_accepted IS DISTINCT FROM ("*Accepted_name" IS NOT NULL)))),
543
    CONSTRAINT "matched~Name[_no_author]___@TNRS__@vegpath.org" CHECK ((NOT ("matched~Name[_no_author]___@TNRS__@vegpath.org" IS DISTINCT FROM NULLIF("*Name_matched", 'No suitable matches found.'::text))))
544 10778 aaronmk
);
545 7823 aaronmk
546 9759 aaronmk
547 10778 aaronmk
--
548 13861 aaronmk
-- Name: TABLE taxon_match; Type: COMMENT; Schema: TNRS; Owner: -
549 10778 aaronmk
--
550 7823 aaronmk
551 13861 aaronmk
COMMENT ON TABLE taxon_match IS '
552 14161 aaronmk
whenever columns are renamed:
553 14312 aaronmk
SELECT util.derived_cols_update(''"TNRS".taxon_match'');
554 14161 aaronmk
555 13577 aaronmk
to remove columns or add columns at the end:
556
$ rm=1 inputs/.TNRS/data.sql.run
557
$ make schemas/remake
558
559
to add columns in the middle:
560
make the changes in inputs/.TNRS/schema.sql
561
$ inputs/.TNRS/data.sql.run refresh # re-run TNRS
562 14313 aaronmk
SELECT util.derived_cols_update(''"TNRS".taxon_match'');
563 14317 aaronmk
SELECT util.derived_cols_repopulate(''"TNRS".taxon_match'');
564 13577 aaronmk
$ make schemas/remake
565 13582 aaronmk
566
to populate a new column:
567 13868 aaronmk
ALTER TABLE "TNRS".taxon_match DISABLE TRIGGER taxon_match__fill; --speeds up update
568 13861 aaronmk
UPDATE "TNRS".taxon_match SET "col" = value;
569 13582 aaronmk
	-- runtime: 30 min ("5564201 rows affected, 1624829 ms execution time")
570 14132 aaronmk
CLUSTER "TNRS".taxon_match; -- ensure rows are exported in sorted order
571 13868 aaronmk
ALTER TABLE "TNRS".taxon_match ENABLE TRIGGER taxon_match__fill;
572 13861 aaronmk
VACUUM ANALYZE "TNRS".taxon_match --remove previous rows; runtime: 1.5 min ("92633 ms")
573 13584 aaronmk
574
to add a constraint: runtime: 3 min ("173620 ms")
575 13575 aaronmk
';
576 10778 aaronmk
577
578
--
579 14311 aaronmk
-- Name: COLUMN taxon_match."[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
580
--
581
582
COMMENT ON COLUMN taxon_match."[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org" IS '
583
= "*Unmatched_terms"
584
585
derived column
586
587
to modify expr:
588
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org'')::util.col, $$"*Unmatched_terms"$$)::util.derived_col_def);
589
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
590
591
to rename:
592
# rename column
593
# rename CHECK constraint
594
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
595
';
596
597
598
--
599 14279 aaronmk
-- Name: COLUMN taxon_match."[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
600 14254 aaronmk
--
601
602 14279 aaronmk
COMMENT ON COLUMN taxon_match."[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org" IS '
603 14283 aaronmk
= ("*Genus_matched" || '' ''::text) || "*Specific_epithet_matched"
604 14254 aaronmk
605 14283 aaronmk
derived column
606
607 14275 aaronmk
to modify expr:
608 14282 aaronmk
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$("*Genus_matched" || '' ''::text) || "*Specific_epithet_matched"$$)::util.derived_col_def);
609 14258 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
610 14275 aaronmk
611
to rename:
612
# rename column
613
# rename CHECK constraint
614
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
615 14254 aaronmk
';
616
617
618
--
619 14329 aaronmk
-- Name: COLUMN taxon_match."matched~Name[_no_author]___@TNRS__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
620
--
621
622
COMMENT ON COLUMN taxon_match."matched~Name[_no_author]___@TNRS__@vegpath.org" IS '
623
= NULLIF("*Name_matched", ''No suitable matches found.''::text)
624
625
derived column
626
627
to modify expr:
628
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''matched~Name[_no_author]___@TNRS__@vegpath.org'')::util.col, $$NULLIF("*Name_matched", ''No suitable matches found.''::text)$$)::util.derived_col_def);
629
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
630
631
to rename:
632
# rename column
633
# rename CHECK constraint
634
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
635
';
636
637
638
--
639 14279 aaronmk
-- Name: COLUMN taxon_match."[matched_]scientificName[_with_author]__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
640 14257 aaronmk
--
641
642 14279 aaronmk
COMMENT ON COLUMN taxon_match."[matched_]scientificName[_with_author]__@DwC__@vegpath.org" IS '
643 14330 aaronmk
= "matched~Name[_no_author]___@TNRS__@vegpath.org" || COALESCE(('' ''::text || "*Name_matched_author"), ''''::text)
644 14257 aaronmk
645 14283 aaronmk
derived column
646
647 14275 aaronmk
to modify expr:
648 14330 aaronmk
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[matched_]scientificName[_with_author]__@DwC__@vegpath.org'')::util.col, $$"matched~Name[_no_author]___@TNRS__@vegpath.org" || COALESCE(('' ''::text || "*Name_matched_author"), ''''::text)$$)::util.derived_col_def);
649 14258 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
650 14275 aaronmk
651
to rename:
652
# rename column
653
# rename CHECK constraint
654
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
655 14257 aaronmk
';
656
657
658
--
659 14279 aaronmk
-- Name: COLUMN taxon_match.matched_has_accepted; Type: COMMENT; Schema: TNRS; Owner: -
660 14257 aaronmk
--
661
662 14279 aaronmk
COMMENT ON COLUMN taxon_match.matched_has_accepted IS '
663 14283 aaronmk
= "*Accepted_name" IS NOT NULL
664 14257 aaronmk
665 14283 aaronmk
derived column
666
667 14275 aaronmk
to modify expr:
668 14279 aaronmk
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''matched_has_accepted'')::util.col, $$"*Accepted_name" IS NOT NULL$$)::util.derived_col_def);
669 14258 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
670 14275 aaronmk
671
to rename:
672
# rename column
673
# rename CHECK constraint
674
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
675 14257 aaronmk
';
676
677
678
--
679 14318 aaronmk
-- Name: COLUMN taxon_match."Accepted_family__@TNRS__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
680
--
681
682
COMMENT ON COLUMN taxon_match."Accepted_family__@TNRS__@vegpath.org" IS '
683
= COALESCE("*Accepted_name_family",
684
CASE
685
    WHEN ("*Accepted_name_rank" = ''family''::text) THEN "*Accepted_name"
686
    ELSE NULL::text
687
END)
688
689
derived column
690
691
to modify expr:
692
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''Accepted_family__@TNRS__@vegpath.org'')::util.col, $$COALESCE("*Accepted_name_family",
693
CASE
694
    WHEN ("*Accepted_name_rank" = ''family''::text) THEN "*Accepted_name"
695
    ELSE NULL::text
696
END)$$)::util.derived_col_def);
697
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
698
699
to rename:
700
# rename column
701
# rename CHECK constraint
702
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
703
';
704
705
706
--
707 14279 aaronmk
-- Name: COLUMN taxon_match."__accepted_{genus,specific_epithet}"; Type: COMMENT; Schema: TNRS; Owner: -
708 14264 aaronmk
--
709
710 14279 aaronmk
COMMENT ON COLUMN taxon_match."__accepted_{genus,specific_epithet}" IS '
711 14283 aaronmk
= regexp_split_to_array("*Accepted_name_species", '' ''::text)
712 14264 aaronmk
713 14283 aaronmk
derived column
714
715 14275 aaronmk
to modify expr:
716 14279 aaronmk
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''__accepted_{genus,specific_epithet}'')::util.col, $$regexp_split_to_array("*Accepted_name_species", '' ''::text)$$)::util.derived_col_def);
717 14264 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
718 14275 aaronmk
719
to rename:
720
# rename column
721
# rename CHECK constraint
722
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
723 14264 aaronmk
';
724
725
726
--
727 14279 aaronmk
-- Name: COLUMN taxon_match."[accepted_]genus__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
728 14265 aaronmk
--
729
730 14279 aaronmk
COMMENT ON COLUMN taxon_match."[accepted_]genus__@DwC__@vegpath.org" IS '
731 14325 aaronmk
= COALESCE("__accepted_{genus,specific_epithet}"[1],
732
CASE
733
    WHEN ("*Accepted_name_rank" = ''genus''::text) THEN "*Accepted_name"
734
    ELSE NULL::text
735
END)
736 14265 aaronmk
737 14283 aaronmk
derived column
738
739 14275 aaronmk
to modify expr:
740 14325 aaronmk
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[accepted_]genus__@DwC__@vegpath.org'')::util.col, $$COALESCE("__accepted_{genus,specific_epithet}"[1],
741
CASE
742
    WHEN ("*Accepted_name_rank" = ''genus''::text) THEN "*Accepted_name"
743
    ELSE NULL::text
744
END)$$)::util.derived_col_def);
745 14265 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
746 14275 aaronmk
747
to rename:
748
# rename column
749
# rename CHECK constraint
750
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
751 14265 aaronmk
';
752
753
754
--
755 14279 aaronmk
-- Name: COLUMN taxon_match."[accepted_]specificEpithet__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
756 14266 aaronmk
--
757
758 14279 aaronmk
COMMENT ON COLUMN taxon_match."[accepted_]specificEpithet__@DwC__@vegpath.org" IS '
759 14283 aaronmk
= "__accepted_{genus,specific_epithet}"[2]
760 14266 aaronmk
761 14283 aaronmk
derived column
762
763 14275 aaronmk
to modify expr:
764 14279 aaronmk
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[accepted_]specificEpithet__@DwC__@vegpath.org'')::util.col, $$"__accepted_{genus,specific_epithet}"[2]$$)::util.derived_col_def);
765 14266 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
766 14275 aaronmk
767
to rename:
768
# rename column
769
# rename CHECK constraint
770
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
771 14266 aaronmk
';
772
773
774
--
775 14311 aaronmk
-- Name: COLUMN taxon_match."[accepted_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
776
--
777
778
COMMENT ON COLUMN taxon_match."[accepted_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org" IS '
779
= CASE
780 14323 aaronmk
    WHEN ("*Accepted_name_rank" = ''family''::text) THEN concat_ws('' ''::text, "Accepted_family__@TNRS__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
781 14327 aaronmk
    WHEN ("*Accepted_name_rank" = ''genus''::text) THEN concat_ws('' ''::text, "[accepted_]genus__@DwC__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
782 14311 aaronmk
    ELSE "*Accepted_name_species"
783
END
784
785
derived column
786
787
to modify expr:
788
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[accepted_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org'')::util.col, $$CASE
789 14323 aaronmk
    WHEN ("*Accepted_name_rank" = ''family''::text) THEN concat_ws('' ''::text, "Accepted_family__@TNRS__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
790 14327 aaronmk
    WHEN ("*Accepted_name_rank" = ''genus''::text) THEN concat_ws('' ''::text, "[accepted_]genus__@DwC__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
791 14311 aaronmk
    ELSE "*Accepted_name_species"
792
END$$)::util.derived_col_def);
793
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
794
795
to rename:
796
# rename column
797
# rename CHECK constraint
798
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
799
';
800
801
802
--
803 14279 aaronmk
-- Name: COLUMN taxon_match.__accepted_infraspecific_label; Type: COMMENT; Schema: TNRS; Owner: -
804 14266 aaronmk
--
805
806 14279 aaronmk
COMMENT ON COLUMN taxon_match.__accepted_infraspecific_label IS '
807 14283 aaronmk
= ltrim(NULLIF(util.remove_prefix("*Accepted_name_species", "*Accepted_name", require := true), ''''::text), '' ''::text)
808 14266 aaronmk
809 14283 aaronmk
derived column
810
811 14275 aaronmk
to modify expr:
812 14279 aaronmk
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''__accepted_infraspecific_label'')::util.col, $$ltrim(NULLIF(util.remove_prefix("*Accepted_name_species", "*Accepted_name", require := true), ''''::text), '' ''::text)$$)::util.derived_col_def);
813 14266 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
814 14275 aaronmk
815
to rename:
816
# rename column
817
# rename CHECK constraint
818
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
819 14266 aaronmk
';
820
821
822
--
823 14279 aaronmk
-- Name: COLUMN taxon_match."__accepted_infraspecific_{rank,epithet}"; Type: COMMENT; Schema: TNRS; Owner: -
824 14267 aaronmk
--
825
826 14279 aaronmk
COMMENT ON COLUMN taxon_match."__accepted_infraspecific_{rank,epithet}" IS '
827 14283 aaronmk
= regexp_split_to_array(__accepted_infraspecific_label, '' ''::text)
828 14267 aaronmk
829 14283 aaronmk
derived column
830
831 14275 aaronmk
to modify expr:
832 14279 aaronmk
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''__accepted_infraspecific_{rank,epithet}'')::util.col, $$regexp_split_to_array(__accepted_infraspecific_label, '' ''::text)$$)::util.derived_col_def);
833 14267 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
834 14275 aaronmk
835
to rename:
836
# rename column
837
# rename CHECK constraint
838
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
839 14267 aaronmk
';
840
841
842
--
843 14279 aaronmk
-- Name: COLUMN taxon_match."[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
844 14267 aaronmk
--
845
846 14279 aaronmk
COMMENT ON COLUMN taxon_match."[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" IS '
847 14283 aaronmk
= "__accepted_infraspecific_{rank,epithet}"[1]
848 14267 aaronmk
849 14283 aaronmk
derived column
850
851 14275 aaronmk
to modify expr:
852 14279 aaronmk
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org'')::util.col, $$"__accepted_infraspecific_{rank,epithet}"[1]$$)::util.derived_col_def);
853 14267 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
854 14275 aaronmk
855
to rename:
856
# rename column
857
# rename CHECK constraint
858
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
859 14267 aaronmk
';
860
861
862
--
863 14279 aaronmk
-- Name: COLUMN taxon_match."[accepted_]infraspecificEpithet__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
864 14269 aaronmk
--
865
866 14279 aaronmk
COMMENT ON COLUMN taxon_match."[accepted_]infraspecificEpithet__@DwC__@vegpath.org" IS '
867 14283 aaronmk
= "__accepted_infraspecific_{rank,epithet}"[2]
868 14269 aaronmk
869 14283 aaronmk
derived column
870
871 14275 aaronmk
to modify expr:
872 14279 aaronmk
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[accepted_]infraspecificEpithet__@DwC__@vegpath.org'')::util.col, $$"__accepted_infraspecific_{rank,epithet}"[2]$$)::util.derived_col_def);
873 14269 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
874 14275 aaronmk
875
to rename:
876
# rename column
877
# rename CHECK constraint
878
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
879 14269 aaronmk
';
880
881
882
--
883 14279 aaronmk
-- Name: COLUMN taxon_match."[accepted_]scientificName[_with_author]__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
884 14278 aaronmk
--
885
886 14279 aaronmk
COMMENT ON COLUMN taxon_match."[accepted_]scientificName[_with_author]__@DwC__@vegpath.org" IS '
887 14283 aaronmk
= "*Accepted_name" || COALESCE(('' ''::text || "*Accepted_name_author"), ''''::text)
888 14278 aaronmk
889 14283 aaronmk
derived column
890
891 14278 aaronmk
to modify expr:
892 14279 aaronmk
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[accepted_]scientificName[_with_author]__@DwC__@vegpath.org'')::util.col, $$"*Accepted_name" || COALESCE(('' ''::text || "*Accepted_name_author"), ''''::text)$$)::util.derived_col_def);
893 14278 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
894
895
to rename:
896
# rename column
897
# rename CHECK constraint
898
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
899
';
900
901
902
--
903 14328 aaronmk
-- Name: COLUMN taxon_match."[scrubbed_]taxonomicStatus__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
904
--
905
906
COMMENT ON COLUMN taxon_match."[scrubbed_]taxonomicStatus__@DwC__@vegpath.org" IS '
907
= "TNRS".map_taxonomic_status("*Taxonomic_status", "*Accepted_name")
908
909
derived column
910
911
to modify expr:
912
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]taxonomicStatus__@DwC__@vegpath.org'')::util.col, $$"TNRS".map_taxonomic_status("*Taxonomic_status", "*Accepted_name")$$)::util.derived_col_def);
913
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
914
915
to rename:
916
# rename column
917
# rename CHECK constraint
918
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
919
';
920
921
922
--
923 14281 aaronmk
-- Name: COLUMN taxon_match."[scrubbed_]taxonRank__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
924
--
925
926
COMMENT ON COLUMN taxon_match."[scrubbed_]taxonRank__@DwC__@vegpath.org" IS '
927 14283 aaronmk
= CASE
928 14282 aaronmk
    WHEN matched_has_accepted THEN "*Accepted_name_rank"
929
    ELSE "*Name_matched_rank"
930
END
931 14281 aaronmk
932 14283 aaronmk
derived column
933
934 14281 aaronmk
to modify expr:
935 14282 aaronmk
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]taxonRank__@DwC__@vegpath.org'')::util.col, $$CASE
936
    WHEN matched_has_accepted THEN "*Accepted_name_rank"
937
    ELSE "*Name_matched_rank"
938
END$$)::util.derived_col_def);
939 14281 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
940
941
to rename:
942
# rename column
943
# rename CHECK constraint
944
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
945
';
946
947
948
--
949
-- Name: COLUMN taxon_match."[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
950
--
951
952
COMMENT ON COLUMN taxon_match."[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org" IS '
953 14283 aaronmk
= CASE
954 14323 aaronmk
    WHEN matched_has_accepted THEN "Accepted_family__@TNRS__@vegpath.org"
955 14282 aaronmk
    ELSE "*Name_matched_accepted_family"
956
END
957 14281 aaronmk
958 14283 aaronmk
derived column
959
960 14281 aaronmk
to modify expr:
961 14282 aaronmk
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$CASE
962 14323 aaronmk
    WHEN matched_has_accepted THEN "Accepted_family__@TNRS__@vegpath.org"
963 14282 aaronmk
    ELSE "*Name_matched_accepted_family"
964
END$$)::util.derived_col_def);
965 14281 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
966
967
to rename:
968
# rename column
969
# rename CHECK constraint
970
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
971
';
972
973
974
--
975
-- Name: COLUMN taxon_match."[scrubbed_]genus__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
976
--
977
978
COMMENT ON COLUMN taxon_match."[scrubbed_]genus__@DwC__@vegpath.org" IS '
979 14283 aaronmk
= CASE
980 14282 aaronmk
    WHEN matched_has_accepted THEN "[accepted_]genus__@DwC__@vegpath.org"
981
    ELSE "*Genus_matched"
982
END
983 14281 aaronmk
984 14283 aaronmk
derived column
985
986 14281 aaronmk
to modify expr:
987 14282 aaronmk
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]genus__@DwC__@vegpath.org'')::util.col, $$CASE
988
    WHEN matched_has_accepted THEN "[accepted_]genus__@DwC__@vegpath.org"
989
    ELSE "*Genus_matched"
990
END$$)::util.derived_col_def);
991 14281 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
992
993
to rename:
994
# rename column
995
# rename CHECK constraint
996
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
997
';
998
999
1000
--
1001
-- Name: COLUMN taxon_match."[scrubbed_]specificEpithet__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
1002
--
1003
1004
COMMENT ON COLUMN taxon_match."[scrubbed_]specificEpithet__@DwC__@vegpath.org" IS '
1005 14283 aaronmk
= CASE
1006 14282 aaronmk
    WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
1007
    ELSE "*Specific_epithet_matched"
1008
END
1009 14281 aaronmk
1010 14283 aaronmk
derived column
1011
1012 14281 aaronmk
to modify expr:
1013 14282 aaronmk
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]specificEpithet__@DwC__@vegpath.org'')::util.col, $$CASE
1014
    WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
1015
    ELSE "*Specific_epithet_matched"
1016
END$$)::util.derived_col_def);
1017 14281 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
1018
1019
to rename:
1020
# rename column
1021
# rename CHECK constraint
1022
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
1023
';
1024
1025
1026
--
1027
-- Name: COLUMN taxon_match."[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
1028
--
1029
1030
COMMENT ON COLUMN taxon_match."[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org" IS '
1031 14283 aaronmk
= CASE
1032 14282 aaronmk
    WHEN matched_has_accepted THEN "*Accepted_name_species"
1033
    ELSE "[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org"
1034
END
1035 14281 aaronmk
1036 14283 aaronmk
derived column
1037
1038 14281 aaronmk
to modify expr:
1039 14282 aaronmk
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$CASE
1040
    WHEN matched_has_accepted THEN "*Accepted_name_species"
1041
    ELSE "[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org"
1042
END$$)::util.derived_col_def);
1043 14281 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
1044
1045
to rename:
1046
# rename column
1047
# rename CHECK constraint
1048
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
1049
';
1050
1051
1052
--
1053 14328 aaronmk
-- Name: COLUMN taxon_match."[scrubbed_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
1054
--
1055
1056
COMMENT ON COLUMN taxon_match."[scrubbed_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org" IS '
1057
= CASE
1058
    WHEN ("[scrubbed_]taxonRank__@DwC__@vegpath.org" = ''family''::text) THEN concat_ws('' ''::text, "[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
1059
    WHEN ("[scrubbed_]taxonRank__@DwC__@vegpath.org" = ''genus''::text) THEN concat_ws('' ''::text, "[scrubbed_]genus__@DwC__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
1060
    ELSE "[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org"
1061
END
1062
1063
derived column
1064
1065
to modify expr:
1066
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org'')::util.col, $$CASE
1067
    WHEN ("[scrubbed_]taxonRank__@DwC__@vegpath.org" = ''family''::text) THEN concat_ws('' ''::text, "[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
1068
    WHEN ("[scrubbed_]taxonRank__@DwC__@vegpath.org" = ''genus''::text) THEN concat_ws('' ''::text, "[scrubbed_]genus__@DwC__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
1069
    ELSE "[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org"
1070
END$$)::util.derived_col_def);
1071
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
1072
1073
to rename:
1074
# rename column
1075
# rename CHECK constraint
1076
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
1077
';
1078
1079
1080
--
1081 14281 aaronmk
-- Name: COLUMN taxon_match."[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
1082
--
1083
1084
COMMENT ON COLUMN taxon_match."[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" IS '
1085 14283 aaronmk
= CASE
1086 14282 aaronmk
    WHEN matched_has_accepted THEN "[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org"
1087
    ELSE "*Infraspecific_rank"
1088
END
1089 14281 aaronmk
1090 14283 aaronmk
derived column
1091
1092 14281 aaronmk
to modify expr:
1093 14282 aaronmk
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org'')::util.col, $$CASE
1094
    WHEN matched_has_accepted THEN "[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org"
1095
    ELSE "*Infraspecific_rank"
1096
END$$)::util.derived_col_def);
1097 14281 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
1098
1099
to rename:
1100
# rename column
1101
# rename CHECK constraint
1102
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
1103
';
1104
1105
1106
--
1107
-- Name: COLUMN taxon_match."[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
1108
--
1109
1110
COMMENT ON COLUMN taxon_match."[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org" IS '
1111 14283 aaronmk
= CASE
1112 14282 aaronmk
    WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
1113
    ELSE "*Infraspecific_epithet_matched"
1114
END
1115 14281 aaronmk
1116 14283 aaronmk
derived column
1117
1118 14281 aaronmk
to modify expr:
1119 14282 aaronmk
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org'')::util.col, $$CASE
1120
    WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
1121
    ELSE "*Infraspecific_epithet_matched"
1122
END$$)::util.derived_col_def);
1123 14281 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
1124
1125
to rename:
1126
# rename column
1127
# rename CHECK constraint
1128
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
1129
';
1130
1131
1132
--
1133
-- Name: COLUMN taxon_match."[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
1134
--
1135
1136
COMMENT ON COLUMN taxon_match."[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org" IS '
1137 14283 aaronmk
= CASE
1138 14282 aaronmk
    WHEN matched_has_accepted THEN "*Accepted_name"
1139 14330 aaronmk
    ELSE "matched~Name[_no_author]___@TNRS__@vegpath.org"
1140 14282 aaronmk
END
1141 14281 aaronmk
1142 14283 aaronmk
derived column
1143
1144 14281 aaronmk
to modify expr:
1145 14282 aaronmk
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$CASE
1146
    WHEN matched_has_accepted THEN "*Accepted_name"
1147 14330 aaronmk
    ELSE "matched~Name[_no_author]___@TNRS__@vegpath.org"
1148 14282 aaronmk
END$$)::util.derived_col_def);
1149 14281 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
1150
1151
to rename:
1152
# rename column
1153
# rename CHECK constraint
1154
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
1155
';
1156
1157
1158
--
1159
-- Name: COLUMN taxon_match."[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
1160
--
1161
1162
COMMENT ON COLUMN taxon_match."[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org" IS '
1163 14283 aaronmk
= CASE
1164 14282 aaronmk
    WHEN matched_has_accepted THEN "*Accepted_name_author"
1165
    ELSE "*Name_matched_author"
1166
END
1167 14281 aaronmk
1168 14283 aaronmk
derived column
1169
1170 14281 aaronmk
to modify expr:
1171 14282 aaronmk
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$CASE
1172
    WHEN matched_has_accepted THEN "*Accepted_name_author"
1173
    ELSE "*Name_matched_author"
1174
END$$)::util.derived_col_def);
1175 14281 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
1176
1177
to rename:
1178
# rename column
1179
# rename CHECK constraint
1180
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
1181
';
1182
1183
1184
--
1185
-- Name: COLUMN taxon_match."[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
1186
--
1187
1188
COMMENT ON COLUMN taxon_match."[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org" IS '
1189 14283 aaronmk
= CASE
1190 14282 aaronmk
    WHEN matched_has_accepted THEN "[accepted_]scientificName[_with_author]__@DwC__@vegpath.org"
1191
    ELSE "[matched_]scientificName[_with_author]__@DwC__@vegpath.org"
1192
END
1193 14281 aaronmk
1194 14283 aaronmk
derived column
1195
1196 14281 aaronmk
to modify expr:
1197 14282 aaronmk
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org'')::util.col, $$CASE
1198
    WHEN matched_has_accepted THEN "[accepted_]scientificName[_with_author]__@DwC__@vegpath.org"
1199
    ELSE "[matched_]scientificName[_with_author]__@DwC__@vegpath.org"
1200
END$$)::util.derived_col_def);
1201 14281 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
1202
1203
to rename:
1204
# rename column
1205
# rename CHECK constraint
1206
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
1207
';
1208
1209
1210
--
1211 13878 aaronmk
-- Name: taxon_best_match; Type: VIEW; Schema: TNRS; Owner: -
1212
--
1213
1214
CREATE VIEW taxon_best_match AS
1215
 SELECT taxon_match.batch,
1216
    taxon_match.match_num,
1217 14111 aaronmk
    taxon_match."*Name_number",
1218
    taxon_match."*Name_submitted",
1219
    taxon_match."*Overall_score",
1220
    taxon_match."*Name_matched",
1221
    taxon_match."*Name_matched_rank",
1222
    taxon_match."*Name_score",
1223
    taxon_match."*Name_matched_author",
1224
    taxon_match."*Name_matched_url",
1225
    taxon_match."*Author_matched",
1226
    taxon_match."*Author_score",
1227
    taxon_match."*Family_matched",
1228
    taxon_match."*Family_score",
1229
    taxon_match."*Name_matched_accepted_family",
1230
    taxon_match."*Genus_matched",
1231
    taxon_match."*Genus_score",
1232
    taxon_match."*Specific_epithet_matched",
1233
    taxon_match."*Specific_epithet_score",
1234
    taxon_match."*Infraspecific_rank",
1235
    taxon_match."*Infraspecific_epithet_matched",
1236
    taxon_match."*Infraspecific_epithet_score",
1237
    taxon_match."*Infraspecific_rank_2",
1238
    taxon_match."*Infraspecific_epithet_2_matched",
1239
    taxon_match."*Infraspecific_epithet_2_score",
1240
    taxon_match."*Annotations",
1241
    taxon_match."*Unmatched_terms",
1242
    taxon_match."*Taxonomic_status",
1243
    taxon_match."*Accepted_name",
1244
    taxon_match."*Accepted_name_author",
1245
    taxon_match."*Accepted_name_rank",
1246
    taxon_match."*Accepted_name_url",
1247
    taxon_match."*Accepted_name_species",
1248
    taxon_match."*Accepted_name_family",
1249
    taxon_match."*Selected",
1250
    taxon_match."*Source",
1251
    taxon_match."*Warnings",
1252
    taxon_match."*Accepted_name_lsid",
1253 13878 aaronmk
    taxon_match.is_valid_match,
1254 14268 aaronmk
    taxon_match.scrubbed_unique_taxon_name,
1255 14284 aaronmk
    taxon_match."[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org",
1256
    taxon_match."[matched_]scientificName[_with_author]__@DwC__@vegpath.org",
1257
    taxon_match.matched_has_accepted,
1258 14268 aaronmk
    taxon_match."__accepted_{genus,specific_epithet}",
1259
    taxon_match."[accepted_]genus__@DwC__@vegpath.org",
1260
    taxon_match."[accepted_]specificEpithet__@DwC__@vegpath.org",
1261
    taxon_match.__accepted_infraspecific_label,
1262
    taxon_match."__accepted_infraspecific_{rank,epithet}",
1263
    taxon_match."[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org",
1264
    taxon_match."[accepted_]infraspecificEpithet__@DwC__@vegpath.org",
1265 14284 aaronmk
    taxon_match."[accepted_]scientificName[_with_author]__@DwC__@vegpath.org",
1266
    taxon_match."[scrubbed_]taxonRank__@DwC__@vegpath.org",
1267
    taxon_match."[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org",
1268
    taxon_match."[scrubbed_]genus__@DwC__@vegpath.org",
1269
    taxon_match."[scrubbed_]specificEpithet__@DwC__@vegpath.org",
1270
    taxon_match."[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org",
1271
    taxon_match."[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org",
1272
    taxon_match."[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org",
1273
    taxon_match."[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org",
1274
    taxon_match."[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org",
1275
    taxon_match."[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org"
1276 13878 aaronmk
   FROM taxon_match
1277 14111 aaronmk
  WHERE (taxon_match."*Selected" = 'true'::text);
1278 13878 aaronmk
1279
1280
--
1281
-- Name: VIEW taxon_best_match; Type: COMMENT; Schema: TNRS; Owner: -
1282
--
1283
1284
COMMENT ON VIEW taxon_best_match IS '
1285
to modify:
1286
SELECT util.recreate_view(''"TNRS"."taxon_best_match"'', $$
1287
SELECT __
1288
$$);
1289
';
1290
1291
1292
--
1293 10778 aaronmk
-- Name: MatchedTaxon; Type: VIEW; Schema: TNRS; Owner: -
1294
--
1295
1296
CREATE VIEW "MatchedTaxon" AS
1297 14110 aaronmk
 SELECT taxon_best_match.batch,
1298
    taxon_best_match.match_num,
1299 14111 aaronmk
    taxon_best_match."*Name_number",
1300
    taxon_best_match."*Name_submitted",
1301
    taxon_best_match."*Overall_score",
1302
    taxon_best_match."*Name_matched",
1303
    taxon_best_match."*Name_matched_rank",
1304
    taxon_best_match."*Name_score",
1305
    taxon_best_match."*Name_matched_author",
1306
    taxon_best_match."*Name_matched_url",
1307
    taxon_best_match."*Author_matched",
1308
    taxon_best_match."*Author_score",
1309
    taxon_best_match."*Family_matched",
1310
    taxon_best_match."*Family_score",
1311
    taxon_best_match."*Name_matched_accepted_family",
1312
    taxon_best_match."*Genus_matched",
1313
    taxon_best_match."*Genus_score",
1314
    taxon_best_match."*Specific_epithet_matched",
1315
    taxon_best_match."*Specific_epithet_score",
1316
    taxon_best_match."*Infraspecific_rank",
1317
    taxon_best_match."*Infraspecific_epithet_matched",
1318
    taxon_best_match."*Infraspecific_epithet_score",
1319
    taxon_best_match."*Infraspecific_rank_2",
1320
    taxon_best_match."*Infraspecific_epithet_2_matched",
1321
    taxon_best_match."*Infraspecific_epithet_2_score",
1322
    taxon_best_match."*Annotations",
1323
    taxon_best_match."*Unmatched_terms",
1324
    taxon_best_match."*Taxonomic_status",
1325
    taxon_best_match."*Accepted_name",
1326
    taxon_best_match."*Accepted_name_author",
1327
    taxon_best_match."*Accepted_name_rank",
1328
    taxon_best_match."*Accepted_name_url",
1329
    taxon_best_match."*Accepted_name_species",
1330
    taxon_best_match."*Accepted_name_family",
1331
    taxon_best_match."*Selected",
1332
    taxon_best_match."*Source",
1333
    taxon_best_match."*Warnings",
1334
    taxon_best_match."*Accepted_name_lsid",
1335 14110 aaronmk
    taxon_best_match.is_valid_match,
1336
    taxon_best_match.scrubbed_unique_taxon_name,
1337 14284 aaronmk
    taxon_best_match."[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org",
1338
    taxon_best_match."[matched_]scientificName[_with_author]__@DwC__@vegpath.org",
1339
    taxon_best_match.matched_has_accepted,
1340 14268 aaronmk
    taxon_best_match."__accepted_{genus,specific_epithet}",
1341
    taxon_best_match."[accepted_]genus__@DwC__@vegpath.org",
1342
    taxon_best_match."[accepted_]specificEpithet__@DwC__@vegpath.org",
1343
    taxon_best_match.__accepted_infraspecific_label,
1344
    taxon_best_match."__accepted_infraspecific_{rank,epithet}",
1345
    taxon_best_match."[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org",
1346
    taxon_best_match."[accepted_]infraspecificEpithet__@DwC__@vegpath.org",
1347
    taxon_best_match."[accepted_]scientificName[_with_author]__@DwC__@vegpath.org",
1348 14284 aaronmk
    taxon_best_match."[scrubbed_]taxonRank__@DwC__@vegpath.org",
1349
    taxon_best_match."[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org",
1350
    taxon_best_match."[scrubbed_]genus__@DwC__@vegpath.org",
1351
    taxon_best_match."[scrubbed_]specificEpithet__@DwC__@vegpath.org",
1352
    taxon_best_match."[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org",
1353
    taxon_best_match."[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org",
1354
    taxon_best_match."[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org",
1355
    taxon_best_match."[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org",
1356
    taxon_best_match."[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org",
1357
    taxon_best_match."[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org",
1358 14111 aaronmk
    map_taxonomic_status(taxon_best_match."*Taxonomic_status", taxon_best_match."*Accepted_name") AS "taxonomicStatus",
1359 13498 aaronmk
        CASE
1360 14111 aaronmk
            WHEN (taxon_best_match."*Accepted_name_rank" = 'family'::text) THEN concat_ws(' '::text, taxon_best_match."*Accepted_name_family", taxon_best_match."*Unmatched_terms")
1361
            WHEN (taxon_best_match."*Accepted_name_rank" = 'genus'::text) THEN concat_ws(' '::text, taxon_best_match."*Accepted_name", taxon_best_match."*Unmatched_terms")
1362
            ELSE taxon_best_match."*Accepted_name_species"
1363 13498 aaronmk
        END AS accepted_morphospecies_binomial
1364 14110 aaronmk
   FROM taxon_best_match;
1365 10778 aaronmk
1366
1367
--
1368 13498 aaronmk
-- Name: VIEW "MatchedTaxon"; Type: COMMENT; Schema: TNRS; Owner: -
1369
--
1370
1371
COMMENT ON VIEW "MatchedTaxon" IS '
1372 13501 aaronmk
to modify:
1373 13845 aaronmk
SELECT util.recreate_view(''"TNRS"."MatchedTaxon"'', $$
1374 13647 aaronmk
SELECT __
1375 13501 aaronmk
$$);
1376 13498 aaronmk
';
1377
1378
1379
--
1380 10778 aaronmk
-- Name: ValidMatchedTaxon; Type: VIEW; Schema: TNRS; Owner: -
1381
--
1382
1383
CREATE VIEW "ValidMatchedTaxon" AS
1384 14108 aaronmk
 SELECT "MatchedTaxon".batch,
1385 14105 aaronmk
    "MatchedTaxon".match_num,
1386 14111 aaronmk
    "MatchedTaxon"."*Name_number",
1387
    "MatchedTaxon"."*Name_submitted",
1388
    "MatchedTaxon"."*Overall_score",
1389
    "MatchedTaxon"."*Name_matched",
1390
    "MatchedTaxon"."*Name_matched_rank",
1391
    "MatchedTaxon"."*Name_score",
1392
    "MatchedTaxon"."*Name_matched_author",
1393
    "MatchedTaxon"."*Name_matched_url",
1394
    "MatchedTaxon"."*Author_matched",
1395
    "MatchedTaxon"."*Author_score",
1396
    "MatchedTaxon"."*Family_matched",
1397
    "MatchedTaxon"."*Family_score",
1398
    "MatchedTaxon"."*Name_matched_accepted_family",
1399
    "MatchedTaxon"."*Genus_matched",
1400
    "MatchedTaxon"."*Genus_score",
1401
    "MatchedTaxon"."*Specific_epithet_matched",
1402
    "MatchedTaxon"."*Specific_epithet_score",
1403
    "MatchedTaxon"."*Infraspecific_rank",
1404
    "MatchedTaxon"."*Infraspecific_epithet_matched",
1405
    "MatchedTaxon"."*Infraspecific_epithet_score",
1406
    "MatchedTaxon"."*Infraspecific_rank_2",
1407
    "MatchedTaxon"."*Infraspecific_epithet_2_matched",
1408
    "MatchedTaxon"."*Infraspecific_epithet_2_score",
1409
    "MatchedTaxon"."*Annotations",
1410
    "MatchedTaxon"."*Unmatched_terms",
1411
    "MatchedTaxon"."*Taxonomic_status",
1412
    "MatchedTaxon"."*Accepted_name",
1413
    "MatchedTaxon"."*Accepted_name_author",
1414
    "MatchedTaxon"."*Accepted_name_rank",
1415
    "MatchedTaxon"."*Accepted_name_url",
1416
    "MatchedTaxon"."*Accepted_name_species",
1417
    "MatchedTaxon"."*Accepted_name_family",
1418
    "MatchedTaxon"."*Selected",
1419
    "MatchedTaxon"."*Source",
1420
    "MatchedTaxon"."*Warnings",
1421
    "MatchedTaxon"."*Accepted_name_lsid",
1422 14108 aaronmk
    "MatchedTaxon".is_valid_match,
1423 13800 aaronmk
    "MatchedTaxon".scrubbed_unique_taxon_name,
1424 14284 aaronmk
    "MatchedTaxon"."[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org",
1425
    "MatchedTaxon"."[matched_]scientificName[_with_author]__@DwC__@vegpath.org",
1426
    "MatchedTaxon".matched_has_accepted,
1427 14268 aaronmk
    "MatchedTaxon"."__accepted_{genus,specific_epithet}",
1428
    "MatchedTaxon"."[accepted_]genus__@DwC__@vegpath.org",
1429
    "MatchedTaxon"."[accepted_]specificEpithet__@DwC__@vegpath.org",
1430
    "MatchedTaxon".__accepted_infraspecific_label,
1431
    "MatchedTaxon"."__accepted_infraspecific_{rank,epithet}",
1432
    "MatchedTaxon"."[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org",
1433
    "MatchedTaxon"."[accepted_]infraspecificEpithet__@DwC__@vegpath.org",
1434
    "MatchedTaxon"."[accepted_]scientificName[_with_author]__@DwC__@vegpath.org",
1435 14284 aaronmk
    "MatchedTaxon"."[scrubbed_]taxonRank__@DwC__@vegpath.org",
1436
    "MatchedTaxon"."[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org",
1437
    "MatchedTaxon"."[scrubbed_]genus__@DwC__@vegpath.org",
1438
    "MatchedTaxon"."[scrubbed_]specificEpithet__@DwC__@vegpath.org",
1439
    "MatchedTaxon"."[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org",
1440
    "MatchedTaxon"."[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org",
1441
    "MatchedTaxon"."[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org",
1442
    "MatchedTaxon"."[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org",
1443
    "MatchedTaxon"."[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org",
1444
    "MatchedTaxon"."[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org",
1445 14103 aaronmk
    "MatchedTaxon"."taxonomicStatus",
1446 13498 aaronmk
    "MatchedTaxon".accepted_morphospecies_binomial
1447 11708 aaronmk
   FROM "MatchedTaxon"
1448 14108 aaronmk
  WHERE "MatchedTaxon".is_valid_match;
1449 10778 aaronmk
1450
1451
--
1452
-- Name: VIEW "ValidMatchedTaxon"; Type: COMMENT; Schema: TNRS; Owner: -
1453
--
1454
1455 13443 aaronmk
COMMENT ON VIEW "ValidMatchedTaxon" IS '
1456
to update, use * as the column list
1457
';
1458 10778 aaronmk
1459
1460
--
1461
-- Name: batch; Type: TABLE; Schema: TNRS; Owner: -; Tablespace:
1462
--
1463
1464
CREATE TABLE batch (
1465
    id text NOT NULL,
1466
    id_by_time text,
1467
    time_submitted timestamp with time zone DEFAULT now(),
1468
    client_version text
1469
);
1470
1471
1472
--
1473
-- Name: batch_download_settings; Type: TABLE; Schema: TNRS; Owner: -; Tablespace:
1474
--
1475
1476
CREATE TABLE batch_download_settings (
1477
    id text NOT NULL,
1478
    "E-mail" text,
1479
    "Id" text,
1480
    "Job type" text,
1481
    "Contains Id" boolean,
1482
    "Start time" text,
1483
    "Finish time" text,
1484
    "TNRS version" text,
1485
    "Sources selected" text,
1486
    "Match threshold" double precision,
1487
    "Classification" text,
1488
    "Allow partial matches?" boolean,
1489
    "Sort by source" boolean,
1490
    "Constrain by higher taxonomy" boolean
1491
);
1492
1493
1494
--
1495
-- Name: TABLE batch_download_settings; Type: COMMENT; Schema: TNRS; Owner: -
1496
--
1497
1498 13575 aaronmk
COMMENT ON TABLE batch_download_settings IS '
1499
stores data from http://tnrs.iplantcollaborative.org/TNRSapp.html > Submit List > results section > Download settings > settings.txt
1500
';
1501 10778 aaronmk
1502
1503
--
1504
-- Name: client_version; Type: TABLE; Schema: TNRS; Owner: -; Tablespace:
1505
--
1506
1507
CREATE TABLE client_version (
1508
    id text NOT NULL,
1509
    global_rev integer NOT NULL,
1510
    "/lib/tnrs.py rev" integer,
1511
    "/bin/tnrs_db rev" integer
1512
);
1513
1514
1515
--
1516
-- Name: TABLE client_version; Type: COMMENT; Schema: TNRS; Owner: -
1517
--
1518
1519 13575 aaronmk
COMMENT ON TABLE client_version IS '
1520
contains svn revisions
1521
';
1522 10778 aaronmk
1523
1524
--
1525
-- Name: COLUMN client_version.global_rev; Type: COMMENT; Schema: TNRS; Owner: -
1526
--
1527
1528 13575 aaronmk
COMMENT ON COLUMN client_version.global_rev IS '
1529
from `svn info .` > Last Changed Rev
1530
';
1531 10778 aaronmk
1532
1533
--
1534
-- Name: COLUMN client_version."/lib/tnrs.py rev"; Type: COMMENT; Schema: TNRS; Owner: -
1535
--
1536
1537 13575 aaronmk
COMMENT ON COLUMN client_version."/lib/tnrs.py rev" IS '
1538
from `svn info lib/tnrs.py` > Last Changed Rev
1539
';
1540 10778 aaronmk
1541
1542
--
1543
-- Name: COLUMN client_version."/bin/tnrs_db rev"; Type: COMMENT; Schema: TNRS; Owner: -
1544
--
1545
1546 13575 aaronmk
COMMENT ON COLUMN client_version."/bin/tnrs_db rev" IS '
1547
from `svn info bin/tnrs_db` > Last Changed Rev
1548
';
1549 10778 aaronmk
1550
1551
--
1552 13866 aaronmk
-- Name: taxon_match_input; Type: VIEW; Schema: TNRS; Owner: -
1553
--
1554
1555
CREATE VIEW taxon_match_input AS
1556 14111 aaronmk
 SELECT taxon_match."*Name_number" AS "Name_number",
1557
    taxon_match."*Name_submitted" AS "Name_submitted",
1558
    taxon_match."*Overall_score" AS "Overall_score",
1559
    taxon_match."*Name_matched" AS "Name_matched",
1560
    taxon_match."*Name_matched_rank" AS "Name_matched_rank",
1561
    taxon_match."*Name_score" AS "Name_score",
1562
    taxon_match."*Name_matched_author" AS "Name_matched_author",
1563
    taxon_match."*Name_matched_url" AS "Name_matched_url",
1564
    taxon_match."*Author_matched" AS "Author_matched",
1565
    taxon_match."*Author_score" AS "Author_score",
1566
    taxon_match."*Family_matched" AS "Family_matched",
1567
    taxon_match."*Family_score" AS "Family_score",
1568
    taxon_match."*Name_matched_accepted_family" AS "Name_matched_accepted_family",
1569
    taxon_match."*Genus_matched" AS "Genus_matched",
1570
    taxon_match."*Genus_score" AS "Genus_score",
1571
    taxon_match."*Specific_epithet_matched" AS "Specific_epithet_matched",
1572
    taxon_match."*Specific_epithet_score" AS "Specific_epithet_score",
1573
    taxon_match."*Infraspecific_rank" AS "Infraspecific_rank",
1574
    taxon_match."*Infraspecific_epithet_matched" AS "Infraspecific_epithet_matched",
1575
    taxon_match."*Infraspecific_epithet_score" AS "Infraspecific_epithet_score",
1576
    taxon_match."*Infraspecific_rank_2" AS "Infraspecific_rank_2",
1577
    taxon_match."*Infraspecific_epithet_2_matched" AS "Infraspecific_epithet_2_matched",
1578
    taxon_match."*Infraspecific_epithet_2_score" AS "Infraspecific_epithet_2_score",
1579
    taxon_match."*Annotations" AS "Annotations",
1580
    taxon_match."*Unmatched_terms" AS "Unmatched_terms",
1581
    taxon_match."*Taxonomic_status" AS "Taxonomic_status",
1582
    taxon_match."*Accepted_name" AS "Accepted_name",
1583
    taxon_match."*Accepted_name_author" AS "Accepted_name_author",
1584
    taxon_match."*Accepted_name_rank" AS "Accepted_name_rank",
1585
    taxon_match."*Accepted_name_url" AS "Accepted_name_url",
1586
    taxon_match."*Accepted_name_species" AS "Accepted_name_species",
1587
    taxon_match."*Accepted_name_family" AS "Accepted_name_family",
1588
    taxon_match."*Selected" AS "Selected",
1589
    taxon_match."*Source" AS "Source",
1590
    taxon_match."*Warnings" AS "Warnings",
1591
    taxon_match."*Accepted_name_lsid" AS "Accepted_name_lsid"
1592 13866 aaronmk
   FROM taxon_match;
1593
1594
1595
--
1596
-- Name: taxon_match_input__copy_to; Type: TABLE; Schema: TNRS; Owner: -; Tablespace:
1597
--
1598
1599
CREATE TABLE taxon_match_input__copy_to (
1600
    "Name_number" integer,
1601
    "Name_submitted" text,
1602
    "Overall_score" double precision,
1603
    "Name_matched" text,
1604
    "Name_matched_rank" text,
1605
    "Name_score" double precision,
1606
    "Name_matched_author" text,
1607
    "Name_matched_url" text,
1608
    "Author_matched" text,
1609
    "Author_score" double precision,
1610
    "Family_matched" text,
1611
    "Family_score" double precision,
1612
    "Name_matched_accepted_family" text,
1613
    "Genus_matched" text,
1614
    "Genus_score" double precision,
1615
    "Specific_epithet_matched" text,
1616
    "Specific_epithet_score" double precision,
1617
    "Infraspecific_rank" text,
1618
    "Infraspecific_epithet_matched" text,
1619
    "Infraspecific_epithet_score" double precision,
1620
    "Infraspecific_rank_2" text,
1621
    "Infraspecific_epithet_2_matched" text,
1622
    "Infraspecific_epithet_2_score" double precision,
1623
    "Annotations" text,
1624
    "Unmatched_terms" text,
1625
    "Taxonomic_status" text,
1626
    "Accepted_name" text,
1627
    "Accepted_name_author" text,
1628
    "Accepted_name_rank" text,
1629
    "Accepted_name_url" text,
1630
    "Accepted_name_species" text,
1631
    "Accepted_name_family" text,
1632
    "Selected" text,
1633
    "Source" text,
1634
    "Warnings" text,
1635
    "Accepted_name_lsid" text
1636
);
1637
1638
1639
--
1640 11964 aaronmk
-- Name: taxon_scrub.scrubbed_unique_taxon_name.*; Type: VIEW; Schema: TNRS; Owner: -
1641
--
1642
1643
CREATE VIEW "taxon_scrub.scrubbed_unique_taxon_name.*" AS
1644 14111 aaronmk
 SELECT taxon_match."*Name_submitted" AS scrubbed_unique_taxon_name,
1645
    taxon_match."*Name_matched_rank" AS scrubbed_taxon_rank,
1646
    COALESCE(taxon_match."*Name_matched_accepted_family", taxon_match."*Family_matched") AS scrubbed_family,
1647
    taxon_match."*Genus_matched" AS scrubbed_genus,
1648
    taxon_match."*Specific_epithet_matched" AS scrubbed_specific_epithet,
1649
    taxon_match."*Infraspecific_rank" AS scrubbed_infraspecific_rank,
1650
    taxon_match."*Infraspecific_epithet_matched" AS scrubbed_infraspecific_epithet,
1651
    taxon_match."*Name_matched_author" AS scrubbed_author,
1652
    taxon_match."*Name_matched" AS scrubbed_taxon_name_no_author,
1653
    (taxon_match."*Name_matched" || COALESCE((' '::text || taxon_match."*Name_matched_author"), ''::text)) AS scrubbed_taxon_name_with_author
1654 13861 aaronmk
   FROM taxon_match;
1655 11964 aaronmk
1656
1657
--
1658 11965 aaronmk
-- Name: VIEW "taxon_scrub.scrubbed_unique_taxon_name.*"; Type: COMMENT; Schema: TNRS; Owner: -
1659
--
1660
1661 13575 aaronmk
COMMENT ON VIEW "taxon_scrub.scrubbed_unique_taxon_name.*" IS '
1662 13846 aaronmk
to modify:
1663
SELECT util.recreate_view(''"TNRS"."taxon_scrub.scrubbed_unique_taxon_name.*"'', $$
1664
SELECT __
1665
$$);
1666
1667 13575 aaronmk
scrubbed_family: Name_matched_accepted_family was missing from the TNRS results at one point, so Family_matched is used as a workaround to populate this. the workaround is for *accepted names only*, as no opinion names do not have an Accepted_name_family to prepend to the scrubbed name to parse.
1668
';
1669 11965 aaronmk
1670
1671
--
1672 11964 aaronmk
-- Name: taxon_scrub; Type: VIEW; Schema: TNRS; Owner: -
1673
--
1674
1675
CREATE VIEW taxon_scrub AS
1676 13800 aaronmk
 SELECT "ValidMatchedTaxon".scrubbed_unique_taxon_name,
1677 14108 aaronmk
    "ValidMatchedTaxon".batch,
1678 14105 aaronmk
    "ValidMatchedTaxon".match_num,
1679 14111 aaronmk
    "ValidMatchedTaxon"."*Name_number",
1680
    "ValidMatchedTaxon"."*Name_submitted",
1681
    "ValidMatchedTaxon"."*Overall_score",
1682
    "ValidMatchedTaxon"."*Name_matched",
1683
    "ValidMatchedTaxon"."*Name_matched_rank",
1684
    "ValidMatchedTaxon"."*Name_score",
1685
    "ValidMatchedTaxon"."*Name_matched_author",
1686
    "ValidMatchedTaxon"."*Name_matched_url",
1687
    "ValidMatchedTaxon"."*Author_matched",
1688
    "ValidMatchedTaxon"."*Author_score",
1689
    "ValidMatchedTaxon"."*Family_matched",
1690
    "ValidMatchedTaxon"."*Family_score",
1691
    "ValidMatchedTaxon"."*Name_matched_accepted_family",
1692
    "ValidMatchedTaxon"."*Genus_matched",
1693
    "ValidMatchedTaxon"."*Genus_score",
1694
    "ValidMatchedTaxon"."*Specific_epithet_matched",
1695
    "ValidMatchedTaxon"."*Specific_epithet_score",
1696
    "ValidMatchedTaxon"."*Infraspecific_rank",
1697
    "ValidMatchedTaxon"."*Infraspecific_epithet_matched",
1698
    "ValidMatchedTaxon"."*Infraspecific_epithet_score",
1699
    "ValidMatchedTaxon"."*Infraspecific_rank_2",
1700
    "ValidMatchedTaxon"."*Infraspecific_epithet_2_matched",
1701
    "ValidMatchedTaxon"."*Infraspecific_epithet_2_score",
1702
    "ValidMatchedTaxon"."*Annotations",
1703
    "ValidMatchedTaxon"."*Unmatched_terms",
1704
    "ValidMatchedTaxon"."*Taxonomic_status",
1705
    "ValidMatchedTaxon"."*Accepted_name",
1706
    "ValidMatchedTaxon"."*Accepted_name_author",
1707
    "ValidMatchedTaxon"."*Accepted_name_rank",
1708
    "ValidMatchedTaxon"."*Accepted_name_url",
1709
    "ValidMatchedTaxon"."*Accepted_name_species",
1710
    "ValidMatchedTaxon"."*Accepted_name_family",
1711
    "ValidMatchedTaxon"."*Selected",
1712
    "ValidMatchedTaxon"."*Source",
1713
    "ValidMatchedTaxon"."*Warnings",
1714
    "ValidMatchedTaxon"."*Accepted_name_lsid",
1715 14108 aaronmk
    "ValidMatchedTaxon".is_valid_match,
1716 14284 aaronmk
    "ValidMatchedTaxon"."[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org",
1717
    "ValidMatchedTaxon"."[matched_]scientificName[_with_author]__@DwC__@vegpath.org",
1718
    "ValidMatchedTaxon".matched_has_accepted,
1719 14268 aaronmk
    "ValidMatchedTaxon"."__accepted_{genus,specific_epithet}",
1720
    "ValidMatchedTaxon"."[accepted_]genus__@DwC__@vegpath.org",
1721
    "ValidMatchedTaxon"."[accepted_]specificEpithet__@DwC__@vegpath.org",
1722
    "ValidMatchedTaxon".__accepted_infraspecific_label,
1723
    "ValidMatchedTaxon"."__accepted_infraspecific_{rank,epithet}",
1724
    "ValidMatchedTaxon"."[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org",
1725
    "ValidMatchedTaxon"."[accepted_]infraspecificEpithet__@DwC__@vegpath.org",
1726
    "ValidMatchedTaxon"."[accepted_]scientificName[_with_author]__@DwC__@vegpath.org",
1727 14284 aaronmk
    "ValidMatchedTaxon"."[scrubbed_]taxonRank__@DwC__@vegpath.org",
1728
    "ValidMatchedTaxon"."[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org",
1729
    "ValidMatchedTaxon"."[scrubbed_]genus__@DwC__@vegpath.org",
1730
    "ValidMatchedTaxon"."[scrubbed_]specificEpithet__@DwC__@vegpath.org",
1731
    "ValidMatchedTaxon"."[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org",
1732
    "ValidMatchedTaxon"."[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org",
1733
    "ValidMatchedTaxon"."[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org",
1734
    "ValidMatchedTaxon"."[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org",
1735
    "ValidMatchedTaxon"."[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org",
1736
    "ValidMatchedTaxon"."[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org",
1737 14103 aaronmk
    "ValidMatchedTaxon"."taxonomicStatus",
1738 13800 aaronmk
    "ValidMatchedTaxon".accepted_morphospecies_binomial,
1739
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_rank,
1740
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_family,
1741
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_genus,
1742
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_specific_epithet,
1743
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_infraspecific_rank,
1744
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_infraspecific_epithet,
1745
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_author,
1746
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_name_no_author,
1747
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_name_with_author,
1748 13532 aaronmk
        CASE
1749 14111 aaronmk
            WHEN ("taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_rank = 'family'::text) THEN concat_ws(' '::text, "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_family, "ValidMatchedTaxon"."*Unmatched_terms")
1750
            WHEN ("taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_rank = 'genus'::text) THEN concat_ws(' '::text, "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_name_no_author, "ValidMatchedTaxon"."*Unmatched_terms")
1751 13532 aaronmk
            ELSE (("taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_genus || ' '::text) || "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_specific_epithet)
1752
        END AS scrubbed_morphospecies_binomial
1753 11964 aaronmk
   FROM ("ValidMatchedTaxon"
1754
   LEFT JOIN "taxon_scrub.scrubbed_unique_taxon_name.*" USING (scrubbed_unique_taxon_name));
1755
1756
1757
--
1758
-- Name: VIEW taxon_scrub; Type: COMMENT; Schema: TNRS; Owner: -
1759
--
1760
1761 13443 aaronmk
COMMENT ON VIEW taxon_scrub IS '
1762 13531 aaronmk
to modify:
1763 13845 aaronmk
SELECT util.recreate_view(''"TNRS".taxon_scrub'', $$
1764 13647 aaronmk
SELECT __
1765 13531 aaronmk
$$);
1766 13443 aaronmk
';
1767 11964 aaronmk
1768
1769
--
1770 10778 aaronmk
-- Name: batch_download_settings_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: -; Tablespace:
1771
--
1772
1773
ALTER TABLE ONLY batch_download_settings
1774
    ADD CONSTRAINT batch_download_settings_pkey PRIMARY KEY (id);
1775
1776
1777
--
1778
-- Name: batch_id_by_time_key; Type: CONSTRAINT; Schema: TNRS; Owner: -; Tablespace:
1779
--
1780
1781
ALTER TABLE ONLY batch
1782
    ADD CONSTRAINT batch_id_by_time_key UNIQUE (id_by_time);
1783
1784
1785
--
1786
-- Name: batch_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: -; Tablespace:
1787
--
1788
1789
ALTER TABLE ONLY batch
1790
    ADD CONSTRAINT batch_pkey PRIMARY KEY (id);
1791
1792
1793
--
1794
-- Name: client_version_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: -; Tablespace:
1795
--
1796
1797
ALTER TABLE ONLY client_version
1798
    ADD CONSTRAINT client_version_pkey PRIMARY KEY (id);
1799
1800
1801
--
1802 13868 aaronmk
-- Name: taxon_match_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: -; Tablespace:
1803 10778 aaronmk
--
1804
1805 13861 aaronmk
ALTER TABLE ONLY taxon_match
1806 13868 aaronmk
    ADD CONSTRAINT taxon_match_pkey PRIMARY KEY (batch, match_num);
1807 10778 aaronmk
1808 14125 aaronmk
ALTER TABLE taxon_match CLUSTER ON taxon_match_pkey;
1809 10778 aaronmk
1810 14125 aaronmk
1811 10778 aaronmk
--
1812 10793 aaronmk
-- Name: batch_client_version_idx; Type: INDEX; Schema: TNRS; Owner: -; Tablespace:
1813
--
1814
1815
CREATE INDEX batch_client_version_idx ON batch USING btree (client_version);
1816
1817
1818
--
1819 13879 aaronmk
-- Name: taxon_best_match__valid_match; Type: INDEX; Schema: TNRS; Owner: -; Tablespace:
1820 13589 aaronmk
--
1821
1822 14111 aaronmk
CREATE INDEX taxon_best_match__valid_match ON taxon_match USING btree ("*Name_submitted") WHERE (("*Selected" = 'true'::text) AND is_valid_match);
1823 13589 aaronmk
1824
1825
--
1826 13879 aaronmk
-- Name: taxon_match_Name_submitted_idx; Type: INDEX; Schema: TNRS; Owner: -; Tablespace:
1827 13874 aaronmk
--
1828
1829 14111 aaronmk
CREATE INDEX "taxon_match_Name_submitted_idx" ON taxon_match USING btree ("*Name_submitted");
1830 13874 aaronmk
1831
1832
--
1833 13879 aaronmk
-- Name: taxon_match__one_selected_match; Type: INDEX; Schema: TNRS; Owner: -; Tablespace:
1834 11607 aaronmk
--
1835
1836 14111 aaronmk
CREATE UNIQUE INDEX taxon_match__one_selected_match ON taxon_match USING btree (batch, "*Name_number") WHERE ("*Selected" = 'true'::text);
1837 11607 aaronmk
1838
1839
--
1840 10778 aaronmk
-- Name: batch__fill; Type: TRIGGER; Schema: TNRS; Owner: -
1841
--
1842
1843
CREATE TRIGGER batch__fill BEFORE INSERT OR UPDATE ON batch FOR EACH ROW EXECUTE PROCEDURE batch__fill();
1844
1845
1846
--
1847 13868 aaronmk
-- Name: taxon_match__batch_begin; Type: TRIGGER; Schema: TNRS; Owner: -
1848 13866 aaronmk
--
1849
1850 13868 aaronmk
CREATE TRIGGER taxon_match__batch_begin BEFORE INSERT ON taxon_match_input__copy_to FOR EACH STATEMENT EXECUTE PROCEDURE taxon_match__batch_begin();
1851 13866 aaronmk
1852
1853
--
1854 13868 aaronmk
-- Name: taxon_match__fill; Type: TRIGGER; Schema: TNRS; Owner: -
1855 13567 aaronmk
--
1856
1857 13868 aaronmk
CREATE TRIGGER taxon_match__fill BEFORE INSERT OR UPDATE ON taxon_match FOR EACH ROW EXECUTE PROCEDURE taxon_match__fill();
1858 13567 aaronmk
1859
1860
--
1861 14122 aaronmk
-- Name: taxon_match__fill_derived; Type: TRIGGER; Schema: TNRS; Owner: -
1862
--
1863
1864
CREATE TRIGGER taxon_match__fill_derived BEFORE INSERT OR UPDATE ON taxon_match FOR EACH ROW EXECUTE PROCEDURE taxon_match__fill_derived();
1865
1866
1867
--
1868 13868 aaronmk
-- Name: taxon_match__match_num__fill; Type: TRIGGER; Schema: TNRS; Owner: -
1869 13578 aaronmk
--
1870
1871 13868 aaronmk
CREATE TRIGGER taxon_match__match_num__fill BEFORE INSERT ON taxon_match FOR EACH ROW EXECUTE PROCEDURE taxon_match__match_num__fill();
1872 13578 aaronmk
1873
1874
--
1875 13868 aaronmk
-- Name: taxon_match_input__copy_to__insert; Type: TRIGGER; Schema: TNRS; Owner: -
1876 10778 aaronmk
--
1877
1878 13868 aaronmk
CREATE TRIGGER taxon_match_input__copy_to__insert BEFORE INSERT ON taxon_match_input__copy_to FOR EACH ROW EXECUTE PROCEDURE taxon_match_input__copy_to__insert();
1879 10778 aaronmk
1880
1881
--
1882
-- Name: batch_client_version_fkey; Type: FK CONSTRAINT; Schema: TNRS; Owner: -
1883
--
1884
1885
ALTER TABLE ONLY batch
1886
    ADD CONSTRAINT batch_client_version_fkey FOREIGN KEY (client_version) REFERENCES client_version(id) ON UPDATE CASCADE ON DELETE CASCADE;
1887
1888
1889
--
1890
-- Name: batch_download_settings_id_fkey; Type: FK CONSTRAINT; Schema: TNRS; Owner: -
1891
--
1892
1893
ALTER TABLE ONLY batch_download_settings
1894
    ADD CONSTRAINT batch_download_settings_id_fkey FOREIGN KEY (id) REFERENCES batch(id) ON UPDATE CASCADE ON DELETE CASCADE;
1895
1896
1897
--
1898 13868 aaronmk
-- Name: taxon_match_batch_fkey; Type: FK CONSTRAINT; Schema: TNRS; Owner: -
1899 10778 aaronmk
--
1900
1901 13861 aaronmk
ALTER TABLE ONLY taxon_match
1902 13868 aaronmk
    ADD CONSTRAINT taxon_match_batch_fkey FOREIGN KEY (batch) REFERENCES batch(id) ON UPDATE CASCADE ON DELETE CASCADE;
1903 10778 aaronmk
1904
1905
--
1906
-- Name: TNRS; Type: ACL; Schema: -; Owner: -
1907
--
1908
1909
REVOKE ALL ON SCHEMA "TNRS" FROM PUBLIC;
1910
REVOKE ALL ON SCHEMA "TNRS" FROM bien;
1911
GRANT ALL ON SCHEMA "TNRS" TO bien;
1912
GRANT USAGE ON SCHEMA "TNRS" TO bien_read;
1913
1914
1915
--
1916 13861 aaronmk
-- Name: taxon_match; Type: ACL; Schema: TNRS; Owner: -
1917 10778 aaronmk
--
1918
1919 13861 aaronmk
REVOKE ALL ON TABLE taxon_match FROM PUBLIC;
1920
REVOKE ALL ON TABLE taxon_match FROM bien;
1921
GRANT ALL ON TABLE taxon_match TO bien;
1922
GRANT SELECT ON TABLE taxon_match TO bien_read;
1923 10778 aaronmk
1924
1925
--
1926 13878 aaronmk
-- Name: taxon_best_match; Type: ACL; Schema: TNRS; Owner: -
1927
--
1928
1929
REVOKE ALL ON TABLE taxon_best_match FROM PUBLIC;
1930
REVOKE ALL ON TABLE taxon_best_match FROM bien;
1931
GRANT ALL ON TABLE taxon_best_match TO bien;
1932
GRANT SELECT ON TABLE taxon_best_match TO bien_read;
1933
1934
1935
--
1936 11912 aaronmk
-- Name: MatchedTaxon; Type: ACL; Schema: TNRS; Owner: -
1937
--
1938
1939
REVOKE ALL ON TABLE "MatchedTaxon" FROM PUBLIC;
1940
REVOKE ALL ON TABLE "MatchedTaxon" FROM bien;
1941
GRANT ALL ON TABLE "MatchedTaxon" TO bien;
1942
GRANT SELECT ON TABLE "MatchedTaxon" TO bien_read;
1943
1944
1945
--
1946
-- Name: ValidMatchedTaxon; Type: ACL; Schema: TNRS; Owner: -
1947
--
1948
1949
REVOKE ALL ON TABLE "ValidMatchedTaxon" FROM PUBLIC;
1950
REVOKE ALL ON TABLE "ValidMatchedTaxon" FROM bien;
1951
GRANT ALL ON TABLE "ValidMatchedTaxon" TO bien;
1952
GRANT SELECT ON TABLE "ValidMatchedTaxon" TO bien_read;
1953
1954
1955
--
1956 13866 aaronmk
-- Name: taxon_match_input; Type: ACL; Schema: TNRS; Owner: -
1957
--
1958
1959
REVOKE ALL ON TABLE taxon_match_input FROM PUBLIC;
1960
REVOKE ALL ON TABLE taxon_match_input FROM bien;
1961
GRANT ALL ON TABLE taxon_match_input TO bien;
1962
GRANT SELECT ON TABLE taxon_match_input TO bien_read;
1963
1964
1965
--
1966 11912 aaronmk
-- Name: taxon_scrub.scrubbed_unique_taxon_name.*; Type: ACL; Schema: TNRS; Owner: -
1967
--
1968
1969
REVOKE ALL ON TABLE "taxon_scrub.scrubbed_unique_taxon_name.*" FROM PUBLIC;
1970
REVOKE ALL ON TABLE "taxon_scrub.scrubbed_unique_taxon_name.*" FROM bien;
1971
GRANT ALL ON TABLE "taxon_scrub.scrubbed_unique_taxon_name.*" TO bien;
1972
GRANT SELECT ON TABLE "taxon_scrub.scrubbed_unique_taxon_name.*" TO bien_read;
1973
1974
1975
--
1976
-- Name: taxon_scrub; Type: ACL; Schema: TNRS; Owner: -
1977
--
1978
1979
REVOKE ALL ON TABLE taxon_scrub FROM PUBLIC;
1980
REVOKE ALL ON TABLE taxon_scrub FROM bien;
1981
GRANT ALL ON TABLE taxon_scrub TO bien;
1982
GRANT SELECT ON TABLE taxon_scrub TO bien_read;
1983
1984
1985
--
1986 10778 aaronmk
-- PostgreSQL database dump complete
1987
--