pg_restore: while PROCESSING TOC: pg_restore: from TOC entry 3344; 2606 33409 FK CONSTRAINT table9 fk_table9_to_table8 postgres pg_restore: error: could not execute query: ERROR:  deadlock detected DETAIL:  Process 55304 waits for ShareRowExclusiveLock on relation 33489 of database 33434; blocked by process 55305. Process 55305 waits for ShareRowExclusiveLock on relation 33477 of database 33434; blocked by process 55303. Process 55303 waits for ShareRowExclusiveLock on relation 33489 of database 33434; blocked by process 55304. HINT:  See server log for query details. Command was: ALTER TABLE ONLY public.table9     ADD CONSTRAINT fk_table9_to_table8 FOREIGN KEY (id) REFERENCES public.table8(id);