Skip to content

Commit

Permalink
Merge pull request #101874 from ecwall/backport23.1-101236
Browse files Browse the repository at this point in the history
release-23.1: ttl: allow outbound foreign keys on TTL tables
  • Loading branch information
ecwall authored Apr 24, 2023
2 parents 18dc409 + 49ced4e commit 571a28a
Show file tree
Hide file tree
Showing 4 changed files with 284 additions and 279 deletions.
23 changes: 7 additions & 16 deletions pkg/sql/catalog/tabledesc/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,23 +198,14 @@ func (desc *wrapper) ValidateForwardReferences(
}
}

// Row-level TTL is not compatible with foreign keys.
// Row-level TTL is not compatible with inbound foreign keys.
// This check should be in ValidateSelf but interferes with AllocateIDs.
if desc.HasRowLevelTTL() {
if len(desc.OutboundForeignKeys()) > 0 {
vea.Report(unimplemented.NewWithIssuef(
76407,
`foreign keys from table with TTL %q are not permitted`,
desc.GetName(),
))
}
if len(desc.InboundForeignKeys()) > 0 {
vea.Report(unimplemented.NewWithIssuef(
76407,
`foreign keys to table with TTL %q are not permitted`,
desc.GetName(),
))
}
if desc.HasRowLevelTTL() && len(desc.InboundForeignKeys()) > 0 {
vea.Report(unimplemented.NewWithIssuef(
76407,
`foreign keys to table with TTL %q are not permitted`,
desc.GetName(),
))
}

// Check enforced outbound foreign keys.
Expand Down
Loading

0 comments on commit 571a28a

Please sign in to comment.