Revision 11828
Added by Aaron Marcuse-Kubitza about 11 years ago
schemas/vegbien.sql | ||
---|---|---|
1596 | 1596 |
VALUES (new.taxonlabel_id, new.taxonlabel_id) |
1597 | 1597 |
; |
1598 | 1598 |
|
1599 |
PERFORM taxonlabel_update_ancestors(new, new.parent_id); |
|
1600 | 1599 |
PERFORM taxonlabel_update_ancestors(new, |
1601 |
NULLIF(new.matched_label_id, new.taxonlabel_id));
|
|
1600 |
COALESCE(NULLIF(new.matched_label_id, new.taxonlabel_id), new.parent_id));
|
|
1602 | 1601 |
|
1603 | 1602 |
RETURN new; |
1604 | 1603 |
END; |
... | ... | |
1613 | 1612 |
LANGUAGE plpgsql |
1614 | 1613 |
AS $$ |
1615 | 1614 |
BEGIN |
1616 |
PERFORM taxonlabel_update_ancestors(new, new.parent_id, old.parent_id); |
|
1617 | 1615 |
PERFORM taxonlabel_update_ancestors(new, |
1618 |
NULLIF(new.matched_label_id, new.taxonlabel_id),
|
|
1619 |
NULLIF(old.matched_label_id, old.taxonlabel_id));
|
|
1616 |
COALESCE(NULLIF(new.matched_label_id, new.taxonlabel_id), new.parent_id),
|
|
1617 |
COALESCE(NULLIF(old.matched_label_id, old.taxonlabel_id), old.parent_id));
|
|
1620 | 1618 |
|
1621 | 1619 |
RETURN new; |
1622 | 1620 |
END; |
Also available in: Unified diff
bugfix: schemas/vegbien.sql: taxonlabel_update_ancestors_on_{insert,update}(): only use either the matched taxon's ancestors or the parent's ancestors, to avoid issues related to duplication between these two ancestors lists. this also fixes a bug where the 2nd taxonlabel_update_ancestors() call assumes that the existing ancestors are for the old parent, when in fact they have actually just been set to those for the new matched taxon (which horribly confuses taxonlabel_update_ancestors()).