 where blah.id = name.id;
 drop table if exists tmp_path_fam;
 
--- now set the family to the accepted taxon family for all names and synonyms on APC
+-- now set the family to the accepted taxon family for all names and synonyms on ${classificationTreeName}
 -- don't change the name_path because that is the name_name_path
 UPDATE name name
 SET family_id = find_family_name_id(tvte.element_link)
 FROM
   tree_element element
   JOIN tree_version_element tvte ON element.id = tvte.tree_element_id
-  JOIN tree ON tvte.tree_version_id = tree.current_tree_version_id AND tree.name = 'APC'
+  JOIN tree ON tvte.tree_version_id = tree.current_tree_version_id AND tree.name = '${classificationTreeName}'
   ,
   Instance i,
   Instance s,


-- *************** end tree creation ***************

-- set all the existing name paths and family from APC tree
UPDATE name n
SET name_path = '', family_id = NULL;


SET current_tree_version_id = (SELECT max(id)
                               FROM tree_version v
                               WHERE v.tree_id = t.id)
WHERE name = '${classificationTreeName}';

VACUUM ANALYSE;

