On Wed, Feb 28, 2024, 09:45 David Barron <david.barron@xxxxxxxxxx> wrote:
If, for example, table a has a constraint that references rows in table b, table b has to be restored first, but pg_dump doesn't take that into account. So the restore tries to restore table a first, but can't because table b contains no data. That's what I ran into in general terms.
It is illegal to write a check constraint that references another table. It doesn't matter that hiding your illegal setup inside a back box function prevents the system from stopping you. You need to fix your design so as not to break the documented rules. Namely by using a trigger.
David J.