Revision 5554
Added by Aaron Marcuse-Kubitza over 12 years ago
tree_cross-links.sql | ||
---|---|---|
8 | 8 |
$BODY$ |
9 | 9 |
DECLARE |
10 | 10 |
-- Use matched_concept_id's ancestors instead if available |
11 |
parent_id_ taxonconcept.taxonconcept_id%TYPE := |
|
12 |
COALESCE(new.matched_concept_id, new.parent_id);
|
|
11 |
parent_id_ taxonconcept.taxonconcept_id%TYPE := COALESCE(
|
|
12 |
NULLIF(new.matched_concept_id, new.taxonconcept_id), new.parent_id);
|
|
13 | 13 |
BEGIN |
14 | 14 |
IF parent_id_ IS DISTINCT FROM old_parent_id THEN |
15 | 15 |
DECLARE |
... | ... | |
77 | 77 |
RETURNS trigger AS |
78 | 78 |
$BODY$ |
79 | 79 |
BEGIN |
80 |
PERFORM taxonconcept_update_ancestors(new, |
|
81 |
COALESCE(old.matched_concept_id, old.parent_id));
|
|
80 |
PERFORM taxonconcept_update_ancestors(new, COALESCE(
|
|
81 |
NULLIF(old.matched_concept_id, old.taxonconcept_id), old.parent_id));
|
|
82 | 82 |
|
83 | 83 |
RETURN new; |
84 | 84 |
END; |
Also available in: Unified diff
schemas/vegbien.sql: taxonconcept: taxonconcept_update_ancestors() trigger: Fixed bug where matched_concept_id needed to be changed to NULL when equal to taxonconcept_id, to avoid including the node itself with its parent's ancestors (which would violate the taxonconcept_ancestor pkey)