I think this should be solved using a unique constraint/index on the parentid
and name
columns. Otherwise, anyone with INSERT/UPDATE access to the table can circumvent your business rule.
CREATE UNIQUE INDEX blah_uk ON FILE_MANAGER_FOLDER(parentId, name) USING BTREE