cockroachdb / cockroachdb/cockroach

Allow tables to be excluded from backup if any incoming foreign key constraints have also been excluded from backup

Open
#104,332 7 comments 0 reactions 0 assignees View on GitHub
C-enhancement db-cy-23 O-support P-3 T-sql-foundations
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.