joncrlsn / pgdiff

Compares the PostgreSQL schema between two databases and generates SQL statements that can be run manually against the second database to make their schemas match.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ERROR: constraint 25733 is not a foreign key constraint

David-Angel opened this issue · comments

After running the generated upgrade script we get this error when trying to delete records from a parent table. (cascading deletes to its children)

The problem is the change script is generating these bad triggers.
CREATE CONSTRAINT TRIGGER "RI_ConstraintTrigger_c_16652"

That looks to be a method of creating foreign key cascading which no longer works.

Add this to "trigger.go" in func initTriggerSqlTemplate()
and t.tgname not like 'RI_ConstraintTrigger%'

To support older versions of postgresql it could be a parameter passed in to exclude them.

Thank you, David! I put that into a development branch that will hopefully get to the product soon.

commented

Having the same issue with the TRIGGER check. Any ideas on when this may land? Is feature/handle-case usable? Unfortunately my go-fu is not great, but if you need any testers or anything, happy to help! And thanks for the great library.