cockroachdb / cockroachdb/cockroach
Allow tables to be excluded from backup if any incoming foreign key constraints have also been excluded from backup
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
I want to exclude a table from a backup, but I cannot if there's another table with an incoming foreign key dependency:
```
ALTER TABLE userfiles_root_upload_files SET (exclude_data_from_backup = true);
ERROR: cannot set data in a table with inbound foreign key constraints to be excluded from backup
```
However, if I also exclude the other table, I still cannot exclude the original table:
```
root@localhost:26257/defaultdb> ALTER TABLE userfiles_root_upload_payload SET (exclude_data_from_backup = true);
ALTER TABLE
root@localhost:26257/defaultdb> ALTER TABLE userfiles_root_upload_files SET (exclude_data_from_backup = true);
ERROR: cannot set data in a table with inbound foreign key constraints to be excluded from backup
```
**Describe the solution you'd like**
CockroachDB would run through the chain of FK constraints and only showing the above error message if it finds a dependency that isn't excluded.
Jira issue: CRDB-28473
Epic CRDB-61002
Contributor guide
Assessment
This issue has not been assessed yet.