citusdata / citusdata/citus

Refactor ErrorIfUnsupportedForeignConstraintExists

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

Description

We can define a function that takes 4 parameters like:
`referencingDistMethod, referencingReplicationModel, referencedDistMethod, referencedReplicationModel`

and then returns an enum to determine the referencing & referenced tables like `FKEY_REF_TO_DIST, FKEY_CITUS_LOCAL_TO_REF` etc.

And we can define several functions to error out for unsupported foreign keys like:
`ErrorOutForFKeyFromRefToDist`,
`ErrorOutForFKeyFromLocalToCitusLocal`

and use those functions both in `ErrorIfUnsupportedForeignConstraintExists` and across the codebase.

Then we can even move `ErrorIfUnsupportedForeignConstraintExists` function to pre process to simplify the way we process `AlterTable` commands

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.