Project

General

Profile

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