You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
first of all, thank you very much for creating Respawn. I have enjoyed using the library so far.
We are running into problems because we have a table with a single row that should not be deleted. It is protected with a trigger that makes sure of that. I excluded the table from Respawn's processing, but it still triggers the exception that it's being deleted.
I saw that the generated SQL creates a 'truncate ... cascade' statement.
The way this apparently works is that Postgres just truncates any table that has a relationship with the truncated ones. This unfortunately means that the excluded table, still gets truncated (it has foreign keys with 'on cascade delete set null' set), which raises an error.
What would be the best way to deal with this issue? I would offer you a pull-request with the truncate removed, but I'm worried that there might be a good reason for it being there?
Thanks & best
Alon
The text was updated successfully, but these errors were encountered:
ayedo
changed the title
Issue with trunace cascade in Postgres
Issue with truncate cascade in Postgres
Nov 15, 2022
Hello,
first of all, thank you very much for creating Respawn. I have enjoyed using the library so far.
We are running into problems because we have a table with a single row that should not be deleted. It is protected with a trigger that makes sure of that. I excluded the table from Respawn's processing, but it still triggers the exception that it's being deleted.
I saw that the generated SQL creates a 'truncate ... cascade' statement.
The way this apparently works is that Postgres just truncates any table that has a relationship with the truncated ones. This unfortunately means that the excluded table, still gets truncated (it has foreign keys with 'on cascade delete set null' set), which raises an error.
What would be the best way to deal with this issue? I would offer you a pull-request with the
truncate
removed, but I'm worried that there might be a good reason for it being there?Thanks & best
Alon
The text was updated successfully, but these errors were encountered: