-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cloud spanner supports cascade deletion on foreign key #19
Comments
It is necessary to have schema information that easily facilitates the implementation of the following two logics:
We need to consider the following aspects to address cascade deletions by foreign key referencing:
Parent-child relationships defined by Interleave can be managed with a tree structure, whereas relationships defined by foreign keys may require a more complex approach, potentially necessitating the graph structure. It may be useful as a temporary measure to explicitly state that cascade deletion by foreign key has not yet been addressed and to alert users. |
If foreign key constraints form the circular dependency, the current way to delete the rows using partition update with spanner-truncate/truncate/deleter.go Lines 55 to 56 in 5862e7d
But considering that we haven't heard of any feedback for supporting such situation, I think for now it's ok to leave it as it is. It might be too complex to fully support the foreign key constraints. |
How about adding a description to limitations on Readme like this?
|
Let's say a basic scenario. If user wants to delete the table1 and table2 where table2 references table1 (table2 -> table1), user can specify the both tables (or implicitly all tables) to delete the both tables. There is a following line to start deleting table1 first, so the deletion on both tables should work. spanner-truncate/truncate/coordinator.go Lines 54 to 58 in 5862e7d
What we would be able to say is that not all scenarios using foreign keys are supported (e.g. circular dependency) despite of usage of cascade deletion. So I agree that we can add these limitations in the following section: https://github.com/cloudspannerecosystem/spanner-truncate/blob/main/README.md#limitations |
Oh, I had completely missed that process. |
This release might affect the behavior of spanner-truncate.
See Release Notes, July 18, 2023
The text was updated successfully, but these errors were encountered: