PostgreSQL - Are CREATE FUNCTION and DROP FUNCTION locking when used inside different transactions?
but there are no answers and isn't exactly the same as my question (though very similar).
I came to a dead point in a deadlock analyze. According to msdn:
RangeX-X are Exclusive range, exclusive resource lock; used when updating a key in a range.
RangeI-N are Insert range, null resource ...