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
	new."__accepted_{genus,specific_epithet}" = (SELECT
199 14150 aaronmk
		regexp_split_to_array("*Accepted_name_species", ' '::text)
200 14122 aaronmk
		FROM (SELECT new.*) new);
201
202 14257 aaronmk
	new."[accepted_]genus__@DwC__@vegpath.org" = (SELECT
203
		"__accepted_{genus,specific_epithet}"[1]
204
		FROM (SELECT new.*) new);
205
206
	new."[accepted_]specificEpithet__@DwC__@vegpath.org" = (SELECT
207
		"__accepted_{genus,specific_epithet}"[2]
208
		FROM (SELECT new.*) new);
209
210 14264 aaronmk
	new.__accepted_infraspecific_label = (SELECT
211
		ltrim(NULLIF(util.remove_prefix("*Accepted_name_species", "*Accepted_name", require := true), ''::text), ' '::text)
212
		FROM (SELECT new.*) new);
213
214 14265 aaronmk
	new."__accepted_infraspecific_{rank,epithet}" = (SELECT
215
		regexp_split_to_array(__accepted_infraspecific_label, ' '::text)
216
		FROM (SELECT new.*) new);
217
218 14266 aaronmk
	new."[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" = (SELECT
219
		"__accepted_infraspecific_{rank,epithet}"[1]
220
		FROM (SELECT new.*) new);
221
222
	new."[accepted_]infraspecificEpithet__@DwC__@vegpath.org" = (SELECT
223
		"__accepted_infraspecific_{rank,epithet}"[2]
224
		FROM (SELECT new.*) new);
225
226 14267 aaronmk
	new."[matched_]scientificName[_with_author]__@DwC__@vegpath.org" = (SELECT
227
		"*Name_matched" || COALESCE((' '::text || "*Name_matched_author"), ''::text)
228
		FROM (SELECT new.*) new);
229
230
	new."[accepted_]scientificName[_with_author]__@DwC__@vegpath.org" = (SELECT
231
		"*Accepted_name" || COALESCE((' '::text || "*Accepted_name_author"), ''::text)
232
		FROM (SELECT new.*) new);
233
234 14277 aaronmk
	new.matched_has_accepted = (SELECT
235 14269 aaronmk
		"*Accepted_name" IS NOT NULL
236
		FROM (SELECT new.*) new);
237
238 14278 aaronmk
	new."[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org" = (SELECT
239
		("*Genus_matched" || ' '::text) || "*Specific_epithet_matched"
240
		FROM (SELECT new.*) new);
241
242 14122 aaronmk
	RETURN new;
243
END;
244
$$;
245
246
247
--
248 14254 aaronmk
-- Name: FUNCTION taxon_match__fill_derived(); Type: COMMENT; Schema: TNRS; Owner: -
249
--
250
251
COMMENT ON FUNCTION taxon_match__fill_derived() IS '
252
autogenerated, do not edit
253
254
to regenerate:
255
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
256
';
257
258
259
--
260 13868 aaronmk
-- Name: taxon_match__match_num__fill(); Type: FUNCTION; Schema: TNRS; Owner: -
261
--
262
263
CREATE FUNCTION taxon_match__match_num__fill() RETURNS trigger
264
    LANGUAGE plpgsql
265
    AS $$
266
BEGIN
267
	IF new.match_num IS NULL THEN
268 13869 aaronmk
		new.match_num = "TNRS".taxon_match__match_num__next();
269 13868 aaronmk
	END IF;
270
	RETURN new;
271
END;
272
$$;
273
274
275
--
276 13869 aaronmk
-- Name: taxon_match__match_num__next(); Type: FUNCTION; Schema: TNRS; Owner: -
277
--
278
279
CREATE FUNCTION taxon_match__match_num__next() RETURNS bigint
280
    LANGUAGE sql
281
    AS $$
282
SELECT nextval('pg_temp.taxon_match__match_num__seq');
283
$$;
284
285
286
--
287 13868 aaronmk
-- Name: taxon_match_input__copy_to__insert(); Type: FUNCTION; Schema: TNRS; Owner: -
288
--
289
290
CREATE FUNCTION taxon_match_input__copy_to__insert() RETURNS trigger
291
    LANGUAGE plpgsql
292
    AS $$
293
BEGIN
294
	INSERT INTO "TNRS".taxon_match_input SELECT new.*;
295
	RETURN NULL;
296
END;
297
$$;
298
299
300
--
301
-- Name: taxon_name_is_safe(text); Type: FUNCTION; Schema: TNRS; Owner: -
302
--
303
304
CREATE FUNCTION taxon_name_is_safe(taxon_name text) RETURNS boolean
305
    LANGUAGE sql IMMUTABLE
306
    AS $_$
307
SELECT NOT ($1 = ANY("TNRS".unsafe_taxon_names()))
308
$_$;
309
310
311
--
312 13631 aaronmk
-- Name: unsafe_taxon_names(); Type: FUNCTION; Schema: TNRS; Owner: -
313
--
314
315
CREATE FUNCTION unsafe_taxon_names() RETURNS text[]
316
    LANGUAGE sql IMMUTABLE
317
    AS $$
318
SELECT ARRAY[
319 13686 aaronmk
]::text[]
320 13631 aaronmk
$$;
321
322
323 10778 aaronmk
SET default_tablespace = '';
324
325
SET default_with_oids = false;
326
327 10728 aaronmk
--
328 13861 aaronmk
-- Name: taxon_match; Type: TABLE; Schema: TNRS; Owner: -; Tablespace:
329 10778 aaronmk
--
330 7251 aaronmk
331 13861 aaronmk
CREATE TABLE taxon_match (
332 10778 aaronmk
    batch text DEFAULT now() NOT NULL,
333 13580 aaronmk
    match_num integer NOT NULL,
334 14111 aaronmk
    "*Name_number" integer NOT NULL,
335
    "*Name_submitted" text NOT NULL,
336
    "*Overall_score" double precision,
337
    "*Name_matched" text,
338
    "*Name_matched_rank" text,
339
    "*Name_score" double precision,
340
    "*Name_matched_author" text,
341
    "*Name_matched_url" text,
342
    "*Author_matched" text,
343
    "*Author_score" double precision,
344
    "*Family_matched" text,
345
    "*Family_score" double precision,
346
    "*Name_matched_accepted_family" text,
347
    "*Genus_matched" text,
348
    "*Genus_score" double precision,
349
    "*Specific_epithet_matched" text,
350
    "*Specific_epithet_score" double precision,
351
    "*Infraspecific_rank" text,
352
    "*Infraspecific_epithet_matched" text,
353
    "*Infraspecific_epithet_score" double precision,
354
    "*Infraspecific_rank_2" text,
355
    "*Infraspecific_epithet_2_matched" text,
356
    "*Infraspecific_epithet_2_score" double precision,
357
    "*Annotations" text,
358
    "*Unmatched_terms" text,
359
    "*Taxonomic_status" text,
360
    "*Accepted_name" text,
361
    "*Accepted_name_author" text,
362
    "*Accepted_name_rank" text,
363
    "*Accepted_name_url" text,
364
    "*Accepted_name_species" text,
365
    "*Accepted_name_family" text,
366
    "*Selected" text,
367
    "*Source" text,
368
    "*Warnings" text,
369
    "*Accepted_name_lsid" text,
370 11628 aaronmk
    is_valid_match boolean NOT NULL,
371 14122 aaronmk
    scrubbed_unique_taxon_name text,
372 14279 aaronmk
    "[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org" text,
373
    "[matched_]scientificName[_with_author]__@DwC__@vegpath.org" text,
374
    matched_has_accepted boolean,
375 14122 aaronmk
    "__accepted_{genus,specific_epithet}" text[],
376 14257 aaronmk
    "[accepted_]genus__@DwC__@vegpath.org" text,
377
    "[accepted_]specificEpithet__@DwC__@vegpath.org" text,
378 14264 aaronmk
    __accepted_infraspecific_label text,
379 14265 aaronmk
    "__accepted_infraspecific_{rank,epithet}" text[],
380 14266 aaronmk
    "[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" text,
381
    "[accepted_]infraspecificEpithet__@DwC__@vegpath.org" text,
382 14267 aaronmk
    "[accepted_]scientificName[_with_author]__@DwC__@vegpath.org" text,
383 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]))),
384 14257 aaronmk
    CONSTRAINT "[accepted_]genus__@DwC__@vegpath.org" CHECK ((NOT ("[accepted_]genus__@DwC__@vegpath.org" IS DISTINCT FROM "__accepted_{genus,specific_epithet}"[1]))),
385 14266 aaronmk
    CONSTRAINT "[accepted_]infraspecificEpithet__@DwC__@vegpath.org" CHECK ((NOT ("[accepted_]infraspecificEpithet__@DwC__@vegpath.org" IS DISTINCT FROM "__accepted_infraspecific_{rank,epithet}"[2]))),
386 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))))),
387 14257 aaronmk
    CONSTRAINT "[accepted_]specificEpithet__@DwC__@vegpath.org" CHECK ((NOT ("[accepted_]specificEpithet__@DwC__@vegpath.org" IS DISTINCT FROM "__accepted_{genus,specific_epithet}"[2]))),
388 14267 aaronmk
    CONSTRAINT "[matched_]scientificName[_with_author]__@DwC__@vegpath.org" CHECK ((NOT ("[matched_]scientificName[_with_author]__@DwC__@vegpath.org" IS DISTINCT FROM ("*Name_matched" || COALESCE((' '::text || "*Name_matched_author"), ''::text))))),
389 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")))),
390 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)))),
391 14265 aaronmk
    CONSTRAINT "__accepted_infraspecific_{rank,epithet}" CHECK ((NOT ("__accepted_infraspecific_{rank,epithet}" IS DISTINCT FROM regexp_split_to_array(__accepted_infraspecific_label, ' '::text)))),
392 14269 aaronmk
    CONSTRAINT "__accepted_{genus,specific_epithet}" CHECK ((NOT ("__accepted_{genus,specific_epithet}" IS DISTINCT FROM regexp_split_to_array("*Accepted_name_species", ' '::text)))),
393 14277 aaronmk
    CONSTRAINT matched_has_accepted CHECK ((NOT (matched_has_accepted IS DISTINCT FROM ("*Accepted_name" IS NOT NULL))))
394 10778 aaronmk
);
395 7823 aaronmk
396 9759 aaronmk
397 10778 aaronmk
--
398 13861 aaronmk
-- Name: TABLE taxon_match; Type: COMMENT; Schema: TNRS; Owner: -
399 10778 aaronmk
--
400 7823 aaronmk
401 13861 aaronmk
COMMENT ON TABLE taxon_match IS '
402 14161 aaronmk
whenever columns are renamed:
403
SELECT util.derived_cols_sync(''"TNRS".taxon_match'');
404
405 13577 aaronmk
to remove columns or add columns at the end:
406
$ rm=1 inputs/.TNRS/data.sql.run
407
$ make schemas/remake
408
409
to add columns in the middle:
410
make the changes in inputs/.TNRS/schema.sql
411
$ inputs/.TNRS/data.sql.run refresh # re-run TNRS
412
$ make schemas/remake
413 13582 aaronmk
414
to populate a new column:
415 13868 aaronmk
ALTER TABLE "TNRS".taxon_match DISABLE TRIGGER taxon_match__fill; --speeds up update
416 13861 aaronmk
UPDATE "TNRS".taxon_match SET "col" = value;
417 13582 aaronmk
	-- runtime: 30 min ("5564201 rows affected, 1624829 ms execution time")
418 14132 aaronmk
CLUSTER "TNRS".taxon_match; -- ensure rows are exported in sorted order
419 13868 aaronmk
ALTER TABLE "TNRS".taxon_match ENABLE TRIGGER taxon_match__fill;
420 13861 aaronmk
VACUUM ANALYZE "TNRS".taxon_match --remove previous rows; runtime: 1.5 min ("92633 ms")
421 13584 aaronmk
422
to add a constraint: runtime: 3 min ("173620 ms")
423 13575 aaronmk
';
424 10778 aaronmk
425
426
--
427 14279 aaronmk
-- Name: COLUMN taxon_match."[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
428 14254 aaronmk
--
429
430 14279 aaronmk
COMMENT ON COLUMN taxon_match."[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org" IS '
431
derived column; = ("*Genus_matched" || '' ''::text) || "*Specific_epithet_matched"
432 14254 aaronmk
433 14275 aaronmk
to modify expr:
434 14279 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);
435 14258 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
436 14275 aaronmk
437
to rename:
438
# rename column
439
# rename CHECK constraint
440
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
441 14254 aaronmk
';
442
443
444
--
445 14279 aaronmk
-- Name: COLUMN taxon_match."[matched_]scientificName[_with_author]__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
446 14257 aaronmk
--
447
448 14279 aaronmk
COMMENT ON COLUMN taxon_match."[matched_]scientificName[_with_author]__@DwC__@vegpath.org" IS '
449
derived column; = "*Name_matched" || COALESCE(('' ''::text || "*Name_matched_author"), ''''::text)
450 14257 aaronmk
451 14275 aaronmk
to modify expr:
452 14279 aaronmk
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[matched_]scientificName[_with_author]__@DwC__@vegpath.org'')::util.col, $$"*Name_matched" || COALESCE(('' ''::text || "*Name_matched_author"), ''''::text)$$)::util.derived_col_def);
453 14258 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
454 14275 aaronmk
455
to rename:
456
# rename column
457
# rename CHECK constraint
458
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
459 14257 aaronmk
';
460
461
462
--
463 14279 aaronmk
-- Name: COLUMN taxon_match.matched_has_accepted; Type: COMMENT; Schema: TNRS; Owner: -
464 14257 aaronmk
--
465
466 14279 aaronmk
COMMENT ON COLUMN taxon_match.matched_has_accepted IS '
467
derived column; = "*Accepted_name" IS NOT NULL
468 14257 aaronmk
469 14275 aaronmk
to modify expr:
470 14279 aaronmk
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''matched_has_accepted'')::util.col, $$"*Accepted_name" IS NOT NULL$$)::util.derived_col_def);
471 14258 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
472 14275 aaronmk
473
to rename:
474
# rename column
475
# rename CHECK constraint
476
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
477 14257 aaronmk
';
478
479
480
--
481 14279 aaronmk
-- Name: COLUMN taxon_match."__accepted_{genus,specific_epithet}"; Type: COMMENT; Schema: TNRS; Owner: -
482 14264 aaronmk
--
483
484 14279 aaronmk
COMMENT ON COLUMN taxon_match."__accepted_{genus,specific_epithet}" IS '
485
derived column; = regexp_split_to_array("*Accepted_name_species", '' ''::text)
486 14264 aaronmk
487 14275 aaronmk
to modify expr:
488 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);
489 14264 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
490 14275 aaronmk
491
to rename:
492
# rename column
493
# rename CHECK constraint
494
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
495 14264 aaronmk
';
496
497
498
--
499 14279 aaronmk
-- Name: COLUMN taxon_match."[accepted_]genus__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
500 14265 aaronmk
--
501
502 14279 aaronmk
COMMENT ON COLUMN taxon_match."[accepted_]genus__@DwC__@vegpath.org" IS '
503
derived column; = "__accepted_{genus,specific_epithet}"[1]
504 14265 aaronmk
505 14275 aaronmk
to modify expr:
506 14279 aaronmk
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[accepted_]genus__@DwC__@vegpath.org'')::util.col, $$"__accepted_{genus,specific_epithet}"[1]$$)::util.derived_col_def);
507 14265 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
508 14275 aaronmk
509
to rename:
510
# rename column
511
# rename CHECK constraint
512
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
513 14265 aaronmk
';
514
515
516
--
517 14279 aaronmk
-- Name: COLUMN taxon_match."[accepted_]specificEpithet__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
518 14266 aaronmk
--
519
520 14279 aaronmk
COMMENT ON COLUMN taxon_match."[accepted_]specificEpithet__@DwC__@vegpath.org" IS '
521
derived column; = "__accepted_{genus,specific_epithet}"[2]
522 14266 aaronmk
523 14275 aaronmk
to modify expr:
524 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);
525 14266 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
526 14275 aaronmk
527
to rename:
528
# rename column
529
# rename CHECK constraint
530
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
531 14266 aaronmk
';
532
533
534
--
535 14279 aaronmk
-- Name: COLUMN taxon_match.__accepted_infraspecific_label; Type: COMMENT; Schema: TNRS; Owner: -
536 14266 aaronmk
--
537
538 14279 aaronmk
COMMENT ON COLUMN taxon_match.__accepted_infraspecific_label IS '
539
derived column; = ltrim(NULLIF(util.remove_prefix("*Accepted_name_species", "*Accepted_name", require := true), ''''::text), '' ''::text)
540 14266 aaronmk
541 14275 aaronmk
to modify expr:
542 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);
543 14266 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
544 14275 aaronmk
545
to rename:
546
# rename column
547
# rename CHECK constraint
548
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
549 14266 aaronmk
';
550
551
552
--
553 14279 aaronmk
-- Name: COLUMN taxon_match."__accepted_infraspecific_{rank,epithet}"; Type: COMMENT; Schema: TNRS; Owner: -
554 14267 aaronmk
--
555
556 14279 aaronmk
COMMENT ON COLUMN taxon_match."__accepted_infraspecific_{rank,epithet}" IS '
557
derived column; = regexp_split_to_array(__accepted_infraspecific_label, '' ''::text)
558 14267 aaronmk
559 14275 aaronmk
to modify expr:
560 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);
561 14267 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
562 14275 aaronmk
563
to rename:
564
# rename column
565
# rename CHECK constraint
566
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
567 14267 aaronmk
';
568
569
570
--
571 14279 aaronmk
-- Name: COLUMN taxon_match."[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
572 14267 aaronmk
--
573
574 14279 aaronmk
COMMENT ON COLUMN taxon_match."[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" IS '
575
derived column; = "__accepted_infraspecific_{rank,epithet}"[1]
576 14267 aaronmk
577 14275 aaronmk
to modify expr:
578 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);
579 14267 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
580 14275 aaronmk
581
to rename:
582
# rename column
583
# rename CHECK constraint
584
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
585 14267 aaronmk
';
586
587
588
--
589 14279 aaronmk
-- Name: COLUMN taxon_match."[accepted_]infraspecificEpithet__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
590 14269 aaronmk
--
591
592 14279 aaronmk
COMMENT ON COLUMN taxon_match."[accepted_]infraspecificEpithet__@DwC__@vegpath.org" IS '
593
derived column; = "__accepted_infraspecific_{rank,epithet}"[2]
594 14269 aaronmk
595 14275 aaronmk
to modify expr:
596 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);
597 14269 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
598 14275 aaronmk
599
to rename:
600
# rename column
601
# rename CHECK constraint
602
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
603 14269 aaronmk
';
604
605
606
--
607 14279 aaronmk
-- Name: COLUMN taxon_match."[accepted_]scientificName[_with_author]__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
608 14278 aaronmk
--
609
610 14279 aaronmk
COMMENT ON COLUMN taxon_match."[accepted_]scientificName[_with_author]__@DwC__@vegpath.org" IS '
611
derived column; = "*Accepted_name" || COALESCE(('' ''::text || "*Accepted_name_author"), ''''::text)
612 14278 aaronmk
613
to modify expr:
614 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);
615 14278 aaronmk
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
616
617
to rename:
618
# rename column
619
# rename CHECK constraint
620
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
621
';
622
623
624
--
625 13878 aaronmk
-- Name: taxon_best_match; Type: VIEW; Schema: TNRS; Owner: -
626
--
627
628
CREATE VIEW taxon_best_match AS
629
 SELECT taxon_match.batch,
630
    taxon_match.match_num,
631 14111 aaronmk
    taxon_match."*Name_number",
632
    taxon_match."*Name_submitted",
633
    taxon_match."*Overall_score",
634
    taxon_match."*Name_matched",
635
    taxon_match."*Name_matched_rank",
636
    taxon_match."*Name_score",
637
    taxon_match."*Name_matched_author",
638
    taxon_match."*Name_matched_url",
639
    taxon_match."*Author_matched",
640
    taxon_match."*Author_score",
641
    taxon_match."*Family_matched",
642
    taxon_match."*Family_score",
643
    taxon_match."*Name_matched_accepted_family",
644
    taxon_match."*Genus_matched",
645
    taxon_match."*Genus_score",
646
    taxon_match."*Specific_epithet_matched",
647
    taxon_match."*Specific_epithet_score",
648
    taxon_match."*Infraspecific_rank",
649
    taxon_match."*Infraspecific_epithet_matched",
650
    taxon_match."*Infraspecific_epithet_score",
651
    taxon_match."*Infraspecific_rank_2",
652
    taxon_match."*Infraspecific_epithet_2_matched",
653
    taxon_match."*Infraspecific_epithet_2_score",
654
    taxon_match."*Annotations",
655
    taxon_match."*Unmatched_terms",
656
    taxon_match."*Taxonomic_status",
657
    taxon_match."*Accepted_name",
658
    taxon_match."*Accepted_name_author",
659
    taxon_match."*Accepted_name_rank",
660
    taxon_match."*Accepted_name_url",
661
    taxon_match."*Accepted_name_species",
662
    taxon_match."*Accepted_name_family",
663
    taxon_match."*Selected",
664
    taxon_match."*Source",
665
    taxon_match."*Warnings",
666
    taxon_match."*Accepted_name_lsid",
667 13878 aaronmk
    taxon_match.is_valid_match,
668 14268 aaronmk
    taxon_match.scrubbed_unique_taxon_name,
669
    taxon_match."__accepted_{genus,specific_epithet}",
670
    taxon_match."[accepted_]genus__@DwC__@vegpath.org",
671
    taxon_match."[accepted_]specificEpithet__@DwC__@vegpath.org",
672
    taxon_match.__accepted_infraspecific_label,
673
    taxon_match."__accepted_infraspecific_{rank,epithet}",
674
    taxon_match."[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org",
675
    taxon_match."[accepted_]infraspecificEpithet__@DwC__@vegpath.org",
676
    taxon_match."[matched_]scientificName[_with_author]__@DwC__@vegpath.org",
677
    taxon_match."[accepted_]scientificName[_with_author]__@DwC__@vegpath.org"
678 13878 aaronmk
   FROM taxon_match
679 14111 aaronmk
  WHERE (taxon_match."*Selected" = 'true'::text);
680 13878 aaronmk
681
682
--
683
-- Name: VIEW taxon_best_match; Type: COMMENT; Schema: TNRS; Owner: -
684
--
685
686
COMMENT ON VIEW taxon_best_match IS '
687
to modify:
688
SELECT util.recreate_view(''"TNRS"."taxon_best_match"'', $$
689
SELECT __
690
$$);
691
';
692
693
694
--
695 10778 aaronmk
-- Name: MatchedTaxon; Type: VIEW; Schema: TNRS; Owner: -
696
--
697
698
CREATE VIEW "MatchedTaxon" AS
699 14110 aaronmk
 SELECT taxon_best_match.batch,
700
    taxon_best_match.match_num,
701 14111 aaronmk
    taxon_best_match."*Name_number",
702
    taxon_best_match."*Name_submitted",
703
    taxon_best_match."*Overall_score",
704
    taxon_best_match."*Name_matched",
705
    taxon_best_match."*Name_matched_rank",
706
    taxon_best_match."*Name_score",
707
    taxon_best_match."*Name_matched_author",
708
    taxon_best_match."*Name_matched_url",
709
    taxon_best_match."*Author_matched",
710
    taxon_best_match."*Author_score",
711
    taxon_best_match."*Family_matched",
712
    taxon_best_match."*Family_score",
713
    taxon_best_match."*Name_matched_accepted_family",
714
    taxon_best_match."*Genus_matched",
715
    taxon_best_match."*Genus_score",
716
    taxon_best_match."*Specific_epithet_matched",
717
    taxon_best_match."*Specific_epithet_score",
718
    taxon_best_match."*Infraspecific_rank",
719
    taxon_best_match."*Infraspecific_epithet_matched",
720
    taxon_best_match."*Infraspecific_epithet_score",
721
    taxon_best_match."*Infraspecific_rank_2",
722
    taxon_best_match."*Infraspecific_epithet_2_matched",
723
    taxon_best_match."*Infraspecific_epithet_2_score",
724
    taxon_best_match."*Annotations",
725
    taxon_best_match."*Unmatched_terms",
726
    taxon_best_match."*Taxonomic_status",
727
    taxon_best_match."*Accepted_name",
728
    taxon_best_match."*Accepted_name_author",
729
    taxon_best_match."*Accepted_name_rank",
730
    taxon_best_match."*Accepted_name_url",
731
    taxon_best_match."*Accepted_name_species",
732
    taxon_best_match."*Accepted_name_family",
733
    taxon_best_match."*Selected",
734
    taxon_best_match."*Source",
735
    taxon_best_match."*Warnings",
736
    taxon_best_match."*Accepted_name_lsid",
737 14110 aaronmk
    taxon_best_match.is_valid_match,
738
    taxon_best_match.scrubbed_unique_taxon_name,
739 14268 aaronmk
    taxon_best_match."__accepted_{genus,specific_epithet}",
740
    taxon_best_match."[accepted_]genus__@DwC__@vegpath.org",
741
    taxon_best_match."[accepted_]specificEpithet__@DwC__@vegpath.org",
742
    taxon_best_match.__accepted_infraspecific_label,
743
    taxon_best_match."__accepted_infraspecific_{rank,epithet}",
744
    taxon_best_match."[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org",
745
    taxon_best_match."[accepted_]infraspecificEpithet__@DwC__@vegpath.org",
746
    taxon_best_match."[matched_]scientificName[_with_author]__@DwC__@vegpath.org",
747
    taxon_best_match."[accepted_]scientificName[_with_author]__@DwC__@vegpath.org",
748 14111 aaronmk
    map_taxonomic_status(taxon_best_match."*Taxonomic_status", taxon_best_match."*Accepted_name") AS "taxonomicStatus",
749 13498 aaronmk
        CASE
750 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")
751
            WHEN (taxon_best_match."*Accepted_name_rank" = 'genus'::text) THEN concat_ws(' '::text, taxon_best_match."*Accepted_name", taxon_best_match."*Unmatched_terms")
752
            ELSE taxon_best_match."*Accepted_name_species"
753 13498 aaronmk
        END AS accepted_morphospecies_binomial
754 14110 aaronmk
   FROM taxon_best_match;
755 10778 aaronmk
756
757
--
758 13498 aaronmk
-- Name: VIEW "MatchedTaxon"; Type: COMMENT; Schema: TNRS; Owner: -
759
--
760
761
COMMENT ON VIEW "MatchedTaxon" IS '
762 13501 aaronmk
to modify:
763 13845 aaronmk
SELECT util.recreate_view(''"TNRS"."MatchedTaxon"'', $$
764 13647 aaronmk
SELECT __
765 13501 aaronmk
$$);
766 13498 aaronmk
';
767
768
769
--
770 10778 aaronmk
-- Name: ValidMatchedTaxon; Type: VIEW; Schema: TNRS; Owner: -
771
--
772
773
CREATE VIEW "ValidMatchedTaxon" AS
774 14108 aaronmk
 SELECT "MatchedTaxon".batch,
775 14105 aaronmk
    "MatchedTaxon".match_num,
776 14111 aaronmk
    "MatchedTaxon"."*Name_number",
777
    "MatchedTaxon"."*Name_submitted",
778
    "MatchedTaxon"."*Overall_score",
779
    "MatchedTaxon"."*Name_matched",
780
    "MatchedTaxon"."*Name_matched_rank",
781
    "MatchedTaxon"."*Name_score",
782
    "MatchedTaxon"."*Name_matched_author",
783
    "MatchedTaxon"."*Name_matched_url",
784
    "MatchedTaxon"."*Author_matched",
785
    "MatchedTaxon"."*Author_score",
786
    "MatchedTaxon"."*Family_matched",
787
    "MatchedTaxon"."*Family_score",
788
    "MatchedTaxon"."*Name_matched_accepted_family",
789
    "MatchedTaxon"."*Genus_matched",
790
    "MatchedTaxon"."*Genus_score",
791
    "MatchedTaxon"."*Specific_epithet_matched",
792
    "MatchedTaxon"."*Specific_epithet_score",
793
    "MatchedTaxon"."*Infraspecific_rank",
794
    "MatchedTaxon"."*Infraspecific_epithet_matched",
795
    "MatchedTaxon"."*Infraspecific_epithet_score",
796
    "MatchedTaxon"."*Infraspecific_rank_2",
797
    "MatchedTaxon"."*Infraspecific_epithet_2_matched",
798
    "MatchedTaxon"."*Infraspecific_epithet_2_score",
799
    "MatchedTaxon"."*Annotations",
800
    "MatchedTaxon"."*Unmatched_terms",
801
    "MatchedTaxon"."*Taxonomic_status",
802
    "MatchedTaxon"."*Accepted_name",
803
    "MatchedTaxon"."*Accepted_name_author",
804
    "MatchedTaxon"."*Accepted_name_rank",
805
    "MatchedTaxon"."*Accepted_name_url",
806
    "MatchedTaxon"."*Accepted_name_species",
807
    "MatchedTaxon"."*Accepted_name_family",
808
    "MatchedTaxon"."*Selected",
809
    "MatchedTaxon"."*Source",
810
    "MatchedTaxon"."*Warnings",
811
    "MatchedTaxon"."*Accepted_name_lsid",
812 14108 aaronmk
    "MatchedTaxon".is_valid_match,
813 13800 aaronmk
    "MatchedTaxon".scrubbed_unique_taxon_name,
814 14268 aaronmk
    "MatchedTaxon"."__accepted_{genus,specific_epithet}",
815
    "MatchedTaxon"."[accepted_]genus__@DwC__@vegpath.org",
816
    "MatchedTaxon"."[accepted_]specificEpithet__@DwC__@vegpath.org",
817
    "MatchedTaxon".__accepted_infraspecific_label,
818
    "MatchedTaxon"."__accepted_infraspecific_{rank,epithet}",
819
    "MatchedTaxon"."[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org",
820
    "MatchedTaxon"."[accepted_]infraspecificEpithet__@DwC__@vegpath.org",
821
    "MatchedTaxon"."[matched_]scientificName[_with_author]__@DwC__@vegpath.org",
822
    "MatchedTaxon"."[accepted_]scientificName[_with_author]__@DwC__@vegpath.org",
823 14103 aaronmk
    "MatchedTaxon"."taxonomicStatus",
824 13498 aaronmk
    "MatchedTaxon".accepted_morphospecies_binomial
825 11708 aaronmk
   FROM "MatchedTaxon"
826 14108 aaronmk
  WHERE "MatchedTaxon".is_valid_match;
827 10778 aaronmk
828
829
--
830
-- Name: VIEW "ValidMatchedTaxon"; Type: COMMENT; Schema: TNRS; Owner: -
831
--
832
833 13443 aaronmk
COMMENT ON VIEW "ValidMatchedTaxon" IS '
834
to update, use * as the column list
835
';
836 10778 aaronmk
837
838
--
839
-- Name: batch; Type: TABLE; Schema: TNRS; Owner: -; Tablespace:
840
--
841
842
CREATE TABLE batch (
843
    id text NOT NULL,
844
    id_by_time text,
845
    time_submitted timestamp with time zone DEFAULT now(),
846
    client_version text
847
);
848
849
850
--
851
-- Name: batch_download_settings; Type: TABLE; Schema: TNRS; Owner: -; Tablespace:
852
--
853
854
CREATE TABLE batch_download_settings (
855
    id text NOT NULL,
856
    "E-mail" text,
857
    "Id" text,
858
    "Job type" text,
859
    "Contains Id" boolean,
860
    "Start time" text,
861
    "Finish time" text,
862
    "TNRS version" text,
863
    "Sources selected" text,
864
    "Match threshold" double precision,
865
    "Classification" text,
866
    "Allow partial matches?" boolean,
867
    "Sort by source" boolean,
868
    "Constrain by higher taxonomy" boolean
869
);
870
871
872
--
873
-- Name: TABLE batch_download_settings; Type: COMMENT; Schema: TNRS; Owner: -
874
--
875
876 13575 aaronmk
COMMENT ON TABLE batch_download_settings IS '
877
stores data from http://tnrs.iplantcollaborative.org/TNRSapp.html > Submit List > results section > Download settings > settings.txt
878
';
879 10778 aaronmk
880
881
--
882
-- Name: client_version; Type: TABLE; Schema: TNRS; Owner: -; Tablespace:
883
--
884
885
CREATE TABLE client_version (
886
    id text NOT NULL,
887
    global_rev integer NOT NULL,
888
    "/lib/tnrs.py rev" integer,
889
    "/bin/tnrs_db rev" integer
890
);
891
892
893
--
894
-- Name: TABLE client_version; Type: COMMENT; Schema: TNRS; Owner: -
895
--
896
897 13575 aaronmk
COMMENT ON TABLE client_version IS '
898
contains svn revisions
899
';
900 10778 aaronmk
901
902
--
903
-- Name: COLUMN client_version.global_rev; Type: COMMENT; Schema: TNRS; Owner: -
904
--
905
906 13575 aaronmk
COMMENT ON COLUMN client_version.global_rev IS '
907
from `svn info .` > Last Changed Rev
908
';
909 10778 aaronmk
910
911
--
912
-- Name: COLUMN client_version."/lib/tnrs.py rev"; Type: COMMENT; Schema: TNRS; Owner: -
913
--
914
915 13575 aaronmk
COMMENT ON COLUMN client_version."/lib/tnrs.py rev" IS '
916
from `svn info lib/tnrs.py` > Last Changed Rev
917
';
918 10778 aaronmk
919
920
--
921
-- Name: COLUMN client_version."/bin/tnrs_db rev"; Type: COMMENT; Schema: TNRS; Owner: -
922
--
923
924 13575 aaronmk
COMMENT ON COLUMN client_version."/bin/tnrs_db rev" IS '
925
from `svn info bin/tnrs_db` > Last Changed Rev
926
';
927 10778 aaronmk
928
929
--
930 13866 aaronmk
-- Name: taxon_match_input; Type: VIEW; Schema: TNRS; Owner: -
931
--
932
933
CREATE VIEW taxon_match_input AS
934 14111 aaronmk
 SELECT taxon_match."*Name_number" AS "Name_number",
935
    taxon_match."*Name_submitted" AS "Name_submitted",
936
    taxon_match."*Overall_score" AS "Overall_score",
937
    taxon_match."*Name_matched" AS "Name_matched",
938
    taxon_match."*Name_matched_rank" AS "Name_matched_rank",
939
    taxon_match."*Name_score" AS "Name_score",
940
    taxon_match."*Name_matched_author" AS "Name_matched_author",
941
    taxon_match."*Name_matched_url" AS "Name_matched_url",
942
    taxon_match."*Author_matched" AS "Author_matched",
943
    taxon_match."*Author_score" AS "Author_score",
944
    taxon_match."*Family_matched" AS "Family_matched",
945
    taxon_match."*Family_score" AS "Family_score",
946
    taxon_match."*Name_matched_accepted_family" AS "Name_matched_accepted_family",
947
    taxon_match."*Genus_matched" AS "Genus_matched",
948
    taxon_match."*Genus_score" AS "Genus_score",
949
    taxon_match."*Specific_epithet_matched" AS "Specific_epithet_matched",
950
    taxon_match."*Specific_epithet_score" AS "Specific_epithet_score",
951
    taxon_match."*Infraspecific_rank" AS "Infraspecific_rank",
952
    taxon_match."*Infraspecific_epithet_matched" AS "Infraspecific_epithet_matched",
953
    taxon_match."*Infraspecific_epithet_score" AS "Infraspecific_epithet_score",
954
    taxon_match."*Infraspecific_rank_2" AS "Infraspecific_rank_2",
955
    taxon_match."*Infraspecific_epithet_2_matched" AS "Infraspecific_epithet_2_matched",
956
    taxon_match."*Infraspecific_epithet_2_score" AS "Infraspecific_epithet_2_score",
957
    taxon_match."*Annotations" AS "Annotations",
958
    taxon_match."*Unmatched_terms" AS "Unmatched_terms",
959
    taxon_match."*Taxonomic_status" AS "Taxonomic_status",
960
    taxon_match."*Accepted_name" AS "Accepted_name",
961
    taxon_match."*Accepted_name_author" AS "Accepted_name_author",
962
    taxon_match."*Accepted_name_rank" AS "Accepted_name_rank",
963
    taxon_match."*Accepted_name_url" AS "Accepted_name_url",
964
    taxon_match."*Accepted_name_species" AS "Accepted_name_species",
965
    taxon_match."*Accepted_name_family" AS "Accepted_name_family",
966
    taxon_match."*Selected" AS "Selected",
967
    taxon_match."*Source" AS "Source",
968
    taxon_match."*Warnings" AS "Warnings",
969
    taxon_match."*Accepted_name_lsid" AS "Accepted_name_lsid"
970 13866 aaronmk
   FROM taxon_match;
971
972
973
--
974
-- Name: taxon_match_input__copy_to; Type: TABLE; Schema: TNRS; Owner: -; Tablespace:
975
--
976
977
CREATE TABLE taxon_match_input__copy_to (
978
    "Name_number" integer,
979
    "Name_submitted" text,
980
    "Overall_score" double precision,
981
    "Name_matched" text,
982
    "Name_matched_rank" text,
983
    "Name_score" double precision,
984
    "Name_matched_author" text,
985
    "Name_matched_url" text,
986
    "Author_matched" text,
987
    "Author_score" double precision,
988
    "Family_matched" text,
989
    "Family_score" double precision,
990
    "Name_matched_accepted_family" text,
991
    "Genus_matched" text,
992
    "Genus_score" double precision,
993
    "Specific_epithet_matched" text,
994
    "Specific_epithet_score" double precision,
995
    "Infraspecific_rank" text,
996
    "Infraspecific_epithet_matched" text,
997
    "Infraspecific_epithet_score" double precision,
998
    "Infraspecific_rank_2" text,
999
    "Infraspecific_epithet_2_matched" text,
1000
    "Infraspecific_epithet_2_score" double precision,
1001
    "Annotations" text,
1002
    "Unmatched_terms" text,
1003
    "Taxonomic_status" text,
1004
    "Accepted_name" text,
1005
    "Accepted_name_author" text,
1006
    "Accepted_name_rank" text,
1007
    "Accepted_name_url" text,
1008
    "Accepted_name_species" text,
1009
    "Accepted_name_family" text,
1010
    "Selected" text,
1011
    "Source" text,
1012
    "Warnings" text,
1013
    "Accepted_name_lsid" text
1014
);
1015
1016
1017
--
1018 11964 aaronmk
-- Name: taxon_scrub.scrubbed_unique_taxon_name.*; Type: VIEW; Schema: TNRS; Owner: -
1019
--
1020
1021
CREATE VIEW "taxon_scrub.scrubbed_unique_taxon_name.*" AS
1022 14111 aaronmk
 SELECT taxon_match."*Name_submitted" AS scrubbed_unique_taxon_name,
1023
    taxon_match."*Name_matched_rank" AS scrubbed_taxon_rank,
1024
    COALESCE(taxon_match."*Name_matched_accepted_family", taxon_match."*Family_matched") AS scrubbed_family,
1025
    taxon_match."*Genus_matched" AS scrubbed_genus,
1026
    taxon_match."*Specific_epithet_matched" AS scrubbed_specific_epithet,
1027
    taxon_match."*Infraspecific_rank" AS scrubbed_infraspecific_rank,
1028
    taxon_match."*Infraspecific_epithet_matched" AS scrubbed_infraspecific_epithet,
1029
    taxon_match."*Name_matched_author" AS scrubbed_author,
1030
    taxon_match."*Name_matched" AS scrubbed_taxon_name_no_author,
1031
    (taxon_match."*Name_matched" || COALESCE((' '::text || taxon_match."*Name_matched_author"), ''::text)) AS scrubbed_taxon_name_with_author
1032 13861 aaronmk
   FROM taxon_match;
1033 11964 aaronmk
1034
1035
--
1036 11965 aaronmk
-- Name: VIEW "taxon_scrub.scrubbed_unique_taxon_name.*"; Type: COMMENT; Schema: TNRS; Owner: -
1037
--
1038
1039 13575 aaronmk
COMMENT ON VIEW "taxon_scrub.scrubbed_unique_taxon_name.*" IS '
1040 13846 aaronmk
to modify:
1041
SELECT util.recreate_view(''"TNRS"."taxon_scrub.scrubbed_unique_taxon_name.*"'', $$
1042
SELECT __
1043
$$);
1044
1045 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.
1046
';
1047 11965 aaronmk
1048
1049
--
1050 11964 aaronmk
-- Name: taxon_scrub; Type: VIEW; Schema: TNRS; Owner: -
1051
--
1052
1053
CREATE VIEW taxon_scrub AS
1054 13800 aaronmk
 SELECT "ValidMatchedTaxon".scrubbed_unique_taxon_name,
1055 14108 aaronmk
    "ValidMatchedTaxon".batch,
1056 14105 aaronmk
    "ValidMatchedTaxon".match_num,
1057 14111 aaronmk
    "ValidMatchedTaxon"."*Name_number",
1058
    "ValidMatchedTaxon"."*Name_submitted",
1059
    "ValidMatchedTaxon"."*Overall_score",
1060
    "ValidMatchedTaxon"."*Name_matched",
1061
    "ValidMatchedTaxon"."*Name_matched_rank",
1062
    "ValidMatchedTaxon"."*Name_score",
1063
    "ValidMatchedTaxon"."*Name_matched_author",
1064
    "ValidMatchedTaxon"."*Name_matched_url",
1065
    "ValidMatchedTaxon"."*Author_matched",
1066
    "ValidMatchedTaxon"."*Author_score",
1067
    "ValidMatchedTaxon"."*Family_matched",
1068
    "ValidMatchedTaxon"."*Family_score",
1069
    "ValidMatchedTaxon"."*Name_matched_accepted_family",
1070
    "ValidMatchedTaxon"."*Genus_matched",
1071
    "ValidMatchedTaxon"."*Genus_score",
1072
    "ValidMatchedTaxon"."*Specific_epithet_matched",
1073
    "ValidMatchedTaxon"."*Specific_epithet_score",
1074
    "ValidMatchedTaxon"."*Infraspecific_rank",
1075
    "ValidMatchedTaxon"."*Infraspecific_epithet_matched",
1076
    "ValidMatchedTaxon"."*Infraspecific_epithet_score",
1077
    "ValidMatchedTaxon"."*Infraspecific_rank_2",
1078
    "ValidMatchedTaxon"."*Infraspecific_epithet_2_matched",
1079
    "ValidMatchedTaxon"."*Infraspecific_epithet_2_score",
1080
    "ValidMatchedTaxon"."*Annotations",
1081
    "ValidMatchedTaxon"."*Unmatched_terms",
1082
    "ValidMatchedTaxon"."*Taxonomic_status",
1083
    "ValidMatchedTaxon"."*Accepted_name",
1084
    "ValidMatchedTaxon"."*Accepted_name_author",
1085
    "ValidMatchedTaxon"."*Accepted_name_rank",
1086
    "ValidMatchedTaxon"."*Accepted_name_url",
1087
    "ValidMatchedTaxon"."*Accepted_name_species",
1088
    "ValidMatchedTaxon"."*Accepted_name_family",
1089
    "ValidMatchedTaxon"."*Selected",
1090
    "ValidMatchedTaxon"."*Source",
1091
    "ValidMatchedTaxon"."*Warnings",
1092
    "ValidMatchedTaxon"."*Accepted_name_lsid",
1093 14108 aaronmk
    "ValidMatchedTaxon".is_valid_match,
1094 14268 aaronmk
    "ValidMatchedTaxon"."__accepted_{genus,specific_epithet}",
1095
    "ValidMatchedTaxon"."[accepted_]genus__@DwC__@vegpath.org",
1096
    "ValidMatchedTaxon"."[accepted_]specificEpithet__@DwC__@vegpath.org",
1097
    "ValidMatchedTaxon".__accepted_infraspecific_label,
1098
    "ValidMatchedTaxon"."__accepted_infraspecific_{rank,epithet}",
1099
    "ValidMatchedTaxon"."[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org",
1100
    "ValidMatchedTaxon"."[accepted_]infraspecificEpithet__@DwC__@vegpath.org",
1101
    "ValidMatchedTaxon"."[matched_]scientificName[_with_author]__@DwC__@vegpath.org",
1102
    "ValidMatchedTaxon"."[accepted_]scientificName[_with_author]__@DwC__@vegpath.org",
1103 14103 aaronmk
    "ValidMatchedTaxon"."taxonomicStatus",
1104 13800 aaronmk
    "ValidMatchedTaxon".accepted_morphospecies_binomial,
1105
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_rank,
1106
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_family,
1107
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_genus,
1108
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_specific_epithet,
1109
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_infraspecific_rank,
1110
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_infraspecific_epithet,
1111
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_author,
1112
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_name_no_author,
1113
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_name_with_author,
1114 13532 aaronmk
        CASE
1115 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")
1116
            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")
1117 13532 aaronmk
            ELSE (("taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_genus || ' '::text) || "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_specific_epithet)
1118
        END AS scrubbed_morphospecies_binomial
1119 11964 aaronmk
   FROM ("ValidMatchedTaxon"
1120
   LEFT JOIN "taxon_scrub.scrubbed_unique_taxon_name.*" USING (scrubbed_unique_taxon_name));
1121
1122
1123
--
1124
-- Name: VIEW taxon_scrub; Type: COMMENT; Schema: TNRS; Owner: -
1125
--
1126
1127 13443 aaronmk
COMMENT ON VIEW taxon_scrub IS '
1128 13531 aaronmk
to modify:
1129 13845 aaronmk
SELECT util.recreate_view(''"TNRS".taxon_scrub'', $$
1130 13647 aaronmk
SELECT __
1131 13531 aaronmk
$$);
1132 13443 aaronmk
';
1133 11964 aaronmk
1134
1135
--
1136 10778 aaronmk
-- Name: batch_download_settings_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: -; Tablespace:
1137
--
1138
1139
ALTER TABLE ONLY batch_download_settings
1140
    ADD CONSTRAINT batch_download_settings_pkey PRIMARY KEY (id);
1141
1142
1143
--
1144
-- Name: batch_id_by_time_key; Type: CONSTRAINT; Schema: TNRS; Owner: -; Tablespace:
1145
--
1146
1147
ALTER TABLE ONLY batch
1148
    ADD CONSTRAINT batch_id_by_time_key UNIQUE (id_by_time);
1149
1150
1151
--
1152
-- Name: batch_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: -; Tablespace:
1153
--
1154
1155
ALTER TABLE ONLY batch
1156
    ADD CONSTRAINT batch_pkey PRIMARY KEY (id);
1157
1158
1159
--
1160
-- Name: client_version_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: -; Tablespace:
1161
--
1162
1163
ALTER TABLE ONLY client_version
1164
    ADD CONSTRAINT client_version_pkey PRIMARY KEY (id);
1165
1166
1167
--
1168 13868 aaronmk
-- Name: taxon_match_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: -; Tablespace:
1169 10778 aaronmk
--
1170
1171 13861 aaronmk
ALTER TABLE ONLY taxon_match
1172 13868 aaronmk
    ADD CONSTRAINT taxon_match_pkey PRIMARY KEY (batch, match_num);
1173 10778 aaronmk
1174 14125 aaronmk
ALTER TABLE taxon_match CLUSTER ON taxon_match_pkey;
1175 10778 aaronmk
1176 14125 aaronmk
1177 10778 aaronmk
--
1178 10793 aaronmk
-- Name: batch_client_version_idx; Type: INDEX; Schema: TNRS; Owner: -; Tablespace:
1179
--
1180
1181
CREATE INDEX batch_client_version_idx ON batch USING btree (client_version);
1182
1183
1184
--
1185 13879 aaronmk
-- Name: taxon_best_match__valid_match; Type: INDEX; Schema: TNRS; Owner: -; Tablespace:
1186 13589 aaronmk
--
1187
1188 14111 aaronmk
CREATE INDEX taxon_best_match__valid_match ON taxon_match USING btree ("*Name_submitted") WHERE (("*Selected" = 'true'::text) AND is_valid_match);
1189 13589 aaronmk
1190
1191
--
1192 13879 aaronmk
-- Name: taxon_match_Name_submitted_idx; Type: INDEX; Schema: TNRS; Owner: -; Tablespace:
1193 13874 aaronmk
--
1194
1195 14111 aaronmk
CREATE INDEX "taxon_match_Name_submitted_idx" ON taxon_match USING btree ("*Name_submitted");
1196 13874 aaronmk
1197
1198
--
1199 13879 aaronmk
-- Name: taxon_match__one_selected_match; Type: INDEX; Schema: TNRS; Owner: -; Tablespace:
1200 11607 aaronmk
--
1201
1202 14111 aaronmk
CREATE UNIQUE INDEX taxon_match__one_selected_match ON taxon_match USING btree (batch, "*Name_number") WHERE ("*Selected" = 'true'::text);
1203 11607 aaronmk
1204
1205
--
1206 10778 aaronmk
-- Name: batch__fill; Type: TRIGGER; Schema: TNRS; Owner: -
1207
--
1208
1209
CREATE TRIGGER batch__fill BEFORE INSERT OR UPDATE ON batch FOR EACH ROW EXECUTE PROCEDURE batch__fill();
1210
1211
1212
--
1213 13868 aaronmk
-- Name: taxon_match__batch_begin; Type: TRIGGER; Schema: TNRS; Owner: -
1214 13866 aaronmk
--
1215
1216 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();
1217 13866 aaronmk
1218
1219
--
1220 13868 aaronmk
-- Name: taxon_match__fill; Type: TRIGGER; Schema: TNRS; Owner: -
1221 13567 aaronmk
--
1222
1223 13868 aaronmk
CREATE TRIGGER taxon_match__fill BEFORE INSERT OR UPDATE ON taxon_match FOR EACH ROW EXECUTE PROCEDURE taxon_match__fill();
1224 13567 aaronmk
1225
1226
--
1227 14122 aaronmk
-- Name: taxon_match__fill_derived; Type: TRIGGER; Schema: TNRS; Owner: -
1228
--
1229
1230
CREATE TRIGGER taxon_match__fill_derived BEFORE INSERT OR UPDATE ON taxon_match FOR EACH ROW EXECUTE PROCEDURE taxon_match__fill_derived();
1231
1232
1233
--
1234 13868 aaronmk
-- Name: taxon_match__match_num__fill; Type: TRIGGER; Schema: TNRS; Owner: -
1235 13578 aaronmk
--
1236
1237 13868 aaronmk
CREATE TRIGGER taxon_match__match_num__fill BEFORE INSERT ON taxon_match FOR EACH ROW EXECUTE PROCEDURE taxon_match__match_num__fill();
1238 13578 aaronmk
1239
1240
--
1241 13868 aaronmk
-- Name: taxon_match_input__copy_to__insert; Type: TRIGGER; Schema: TNRS; Owner: -
1242 10778 aaronmk
--
1243
1244 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();
1245 10778 aaronmk
1246
1247
--
1248
-- Name: batch_client_version_fkey; Type: FK CONSTRAINT; Schema: TNRS; Owner: -
1249
--
1250
1251
ALTER TABLE ONLY batch
1252
    ADD CONSTRAINT batch_client_version_fkey FOREIGN KEY (client_version) REFERENCES client_version(id) ON UPDATE CASCADE ON DELETE CASCADE;
1253
1254
1255
--
1256
-- Name: batch_download_settings_id_fkey; Type: FK CONSTRAINT; Schema: TNRS; Owner: -
1257
--
1258
1259
ALTER TABLE ONLY batch_download_settings
1260
    ADD CONSTRAINT batch_download_settings_id_fkey FOREIGN KEY (id) REFERENCES batch(id) ON UPDATE CASCADE ON DELETE CASCADE;
1261
1262
1263
--
1264 13868 aaronmk
-- Name: taxon_match_batch_fkey; Type: FK CONSTRAINT; Schema: TNRS; Owner: -
1265 10778 aaronmk
--
1266
1267 13861 aaronmk
ALTER TABLE ONLY taxon_match
1268 13868 aaronmk
    ADD CONSTRAINT taxon_match_batch_fkey FOREIGN KEY (batch) REFERENCES batch(id) ON UPDATE CASCADE ON DELETE CASCADE;
1269 10778 aaronmk
1270
1271
--
1272
-- Name: TNRS; Type: ACL; Schema: -; Owner: -
1273
--
1274
1275
REVOKE ALL ON SCHEMA "TNRS" FROM PUBLIC;
1276
REVOKE ALL ON SCHEMA "TNRS" FROM bien;
1277
GRANT ALL ON SCHEMA "TNRS" TO bien;
1278
GRANT USAGE ON SCHEMA "TNRS" TO bien_read;
1279
1280
1281
--
1282 13861 aaronmk
-- Name: taxon_match; Type: ACL; Schema: TNRS; Owner: -
1283 10778 aaronmk
--
1284
1285 13861 aaronmk
REVOKE ALL ON TABLE taxon_match FROM PUBLIC;
1286
REVOKE ALL ON TABLE taxon_match FROM bien;
1287
GRANT ALL ON TABLE taxon_match TO bien;
1288
GRANT SELECT ON TABLE taxon_match TO bien_read;
1289 10778 aaronmk
1290
1291
--
1292 13878 aaronmk
-- Name: taxon_best_match; Type: ACL; Schema: TNRS; Owner: -
1293
--
1294
1295
REVOKE ALL ON TABLE taxon_best_match FROM PUBLIC;
1296
REVOKE ALL ON TABLE taxon_best_match FROM bien;
1297
GRANT ALL ON TABLE taxon_best_match TO bien;
1298
GRANT SELECT ON TABLE taxon_best_match TO bien_read;
1299
1300
1301
--
1302 11912 aaronmk
-- Name: MatchedTaxon; Type: ACL; Schema: TNRS; Owner: -
1303
--
1304
1305
REVOKE ALL ON TABLE "MatchedTaxon" FROM PUBLIC;
1306
REVOKE ALL ON TABLE "MatchedTaxon" FROM bien;
1307
GRANT ALL ON TABLE "MatchedTaxon" TO bien;
1308
GRANT SELECT ON TABLE "MatchedTaxon" TO bien_read;
1309
1310
1311
--
1312
-- Name: ValidMatchedTaxon; Type: ACL; Schema: TNRS; Owner: -
1313
--
1314
1315
REVOKE ALL ON TABLE "ValidMatchedTaxon" FROM PUBLIC;
1316
REVOKE ALL ON TABLE "ValidMatchedTaxon" FROM bien;
1317
GRANT ALL ON TABLE "ValidMatchedTaxon" TO bien;
1318
GRANT SELECT ON TABLE "ValidMatchedTaxon" TO bien_read;
1319
1320
1321
--
1322 13866 aaronmk
-- Name: taxon_match_input; Type: ACL; Schema: TNRS; Owner: -
1323
--
1324
1325
REVOKE ALL ON TABLE taxon_match_input FROM PUBLIC;
1326
REVOKE ALL ON TABLE taxon_match_input FROM bien;
1327
GRANT ALL ON TABLE taxon_match_input TO bien;
1328
GRANT SELECT ON TABLE taxon_match_input TO bien_read;
1329
1330
1331
--
1332 11912 aaronmk
-- Name: taxon_scrub.scrubbed_unique_taxon_name.*; Type: ACL; Schema: TNRS; Owner: -
1333
--
1334
1335
REVOKE ALL ON TABLE "taxon_scrub.scrubbed_unique_taxon_name.*" FROM PUBLIC;
1336
REVOKE ALL ON TABLE "taxon_scrub.scrubbed_unique_taxon_name.*" FROM bien;
1337
GRANT ALL ON TABLE "taxon_scrub.scrubbed_unique_taxon_name.*" TO bien;
1338
GRANT SELECT ON TABLE "taxon_scrub.scrubbed_unique_taxon_name.*" TO bien_read;
1339
1340
1341
--
1342
-- Name: taxon_scrub; Type: ACL; Schema: TNRS; Owner: -
1343
--
1344
1345
REVOKE ALL ON TABLE taxon_scrub FROM PUBLIC;
1346
REVOKE ALL ON TABLE taxon_scrub FROM bien;
1347
GRANT ALL ON TABLE taxon_scrub TO bien;
1348
GRANT SELECT ON TABLE taxon_scrub TO bien_read;
1349
1350
1351
--
1352 10778 aaronmk
-- PostgreSQL database dump complete
1353
--