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