Still, when I browse the database, the /DB/path only exists once (as far as I can see from the sorting), but querying is giving me two documents, according to db:path() living in the same path. This should never happen, should it?
This is surprising indeed.
Right now, db:add is still faster than db:replace, because the check for existing database paths can be completely skipped. This allows high-performance database insertions.In a future version of BaseX, I would love to get rid of db:add and db:replace and replace these functions with a db:update function, which will enforce that each document path exists only once in the database. This would surely reduce patterns like the one you encountered.
If you still manage to get this reproduced, just come back to us.