I'm using categories from 2.3.1 but it was modified, I noticed that in the repository there's a query in the generic xql that should be in a specific xql.
/categories/tcl/categories-procs.xql
fullquery name="category::get_parent.get_parent_id"
querytext
select parent_id
from categories
where category_id = :category_id
>>>> limit 1
/querytext
/fullquery