-- -- tree_ancestor_keys/1 -- create or replace function tree_ancestor_keys( bit varying ) returns varbit as $$ select tree_ancestor_keys($1, 1) $$ language plpgsql; -- -- tree_ancestor_keys/2 -- create or replace function tree_ancestor_keys( bit varying, integer ) returns varbit as $$ select tree_ancestor_key($1, $2) union select tree_ancestor_keys($1, $2 + 1) where $2 < tree_level($1) $$ language plpgsql;