Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add knowlege of constraints to internal schema representation #105

Open
1 of 5 tasks
andrew-farries opened this issue Sep 18, 2023 · 0 comments
Open
1 of 5 tasks
Assignees

Comments

@andrew-farries
Copy link
Collaborator

andrew-farries commented Sep 18, 2023

Constraints (initially CHECK and FOREIGN KEY) should be represented in pg-roll's internal schema representation.

Also, UNIQUE constraints should be part of the internal schema representation too.

Having constraints represented in the internal schema would enable:

  • Better validation of operations involving constraints:
    • Ensure that a constraint of the same name does not exist when adding a new constraint.
    • Ensure that the constraint exists when dropping a constraint.
  • Not having to specify the name of the column on which the constraint is defined when dropping a constraint (and the confusion that occurs when the wrong column is specified)

Tasks

andrew-farries added a commit that referenced this issue Jan 18, 2024
…241)

Add knowledge of `CHECK` constraints defined on a table to `pgroll`'s
internal schema representation

Part of #105
andrew-farries added a commit that referenced this issue Jan 18, 2024
…#242)

Add knowledge of `UNIQUE` constraints defined on a table to `pgroll`'s
internal schema representation.

`UNIQUE` constraints were already present as indexes, but this PR adds
them as their own top-level field in the `Table` schema and includes
information about the columns involved in the constraint.

Part of #105
@andrew-farries andrew-farries self-assigned this Jan 25, 2024
andrew-farries added a commit that referenced this issue Jan 26, 2024
…aint operation (#252)

Add extra validation to the drop constraint operation to ensure that the
constraint to be dropped actually exists on the table. Validation fails
if the constraint does not exist.

This is possible now that all supported constraints (`CHECK`, `UNIQUE`
and `FOREIGN KEY`) are part of the internal schema representation.

Part of #105
@andrew-farries andrew-farries pinned this issue Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant