pgdiff icon indicating copy to clipboard operation
pgdiff copied to clipboard

ERROR: constraint 25733 is not a foreign key constraint

Open David-Angel opened this issue 7 years ago • 2 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.

David-Angel avatar Mar 28 '18 17:03 David-Angel

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

joncrlsn avatar Apr 02 '18 01:04 joncrlsn

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.

cazgp avatar Jun 14 '18 11:06 cazgp