Revision 7134
Added by Aaron Marcuse-Kubitza almost 12 years ago
schema.sql | ||
---|---|---|
52 | 52 |
OIDS=FALSE |
53 | 53 |
); |
54 | 54 |
|
55 |
CREATE OR REPLACE FUNCTION tnrs_populate_accepted_scientific_name() |
|
56 |
RETURNS trigger AS |
|
57 |
$BODY$ |
|
58 |
BEGIN |
|
59 |
new."Accepted_scientific_name" = NULLIF(array_to_string(ARRAY[ |
|
60 |
NULLIF(new."Accepted_name_family", 'Unknown') |
|
61 |
, new."Accepted_name" |
|
62 |
, new."Accepted_name_author" |
|
63 |
], ' '), ''); |
|
64 |
|
|
65 |
RETURN new; |
|
66 |
END; |
|
67 |
$BODY$ |
|
68 |
LANGUAGE plpgsql VOLATILE |
|
69 |
COST 100; |
|
70 |
|
|
71 |
CREATE TRIGGER tnrs_populate_accepted_scientific_name |
|
72 |
BEFORE INSERT OR UPDATE |
|
73 |
ON tnrs |
|
74 |
FOR EACH ROW |
|
75 |
EXECUTE PROCEDURE tnrs_populate_accepted_scientific_name(); |
|
76 |
|
|
77 |
|
|
55 | 78 |
CREATE OR REPLACE VIEW "tnrs+accepted" AS |
56 | 79 |
SELECT |
57 | 80 |
tnrs.* |
Also available in: Unified diff
inputs/.TNRS/schema.sql: tnrs: Added tnrs_populate_accepted_scientific_name() trigger