citusdata / citusdata/citus

Dropping cascading objects may skip invalidating foreign key graph

Open
#2,250 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C
Stars
12.8k
Forks
794
Avg merge
2d 14h
Merged PRs (30d)
31

Description

We've implemented a graph which holds the transitivity of the foreign
key relations with #2211.

The main logic of invalidation is that as soon as a foreign key
created or dropped, invalidate and re-form the graph.

However, we've realized in some cases, Citus skips invalidating the
graph, when any object cascades to dropping a foreign key.

We're expecting some edge cases such as:

- `DROP TYPE` cascades to a column, which cascades to a forein key
- `DROP INDEX` cascades to a forein key

There might be some other edge cases. The propoer solution would be
write a function similar to `findDependentObjects()` which for any
given `DROP` command checks whether any foreign key depends on it.

(Note that the naive solution would be to invalidate the graph on any
`DROP` command. However, we didn't want to go that way since the
invalidation is quite costly.)

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.