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

Create unique constraint for living Tuples in Postgres datastore #11

Closed
jzelinskie opened this issue Aug 16, 2021 · 2 comments
Closed
Labels
area/datastore Affects the storage system priority/2 medium This needs to be done

Comments

@jzelinskie
Copy link
Member

The native CockroachDB schema guarantees uniqueness of Tuples, while the Postgres datastore does not. Theoretically, it's possible for SpiceDB to create duplicate living Tuples if there is a bug. By creating a unique constraint, we can enforce only a single living Tuple for a relationship at the database level.

@jzelinskie jzelinskie added priority/2 medium This needs to be done area/datastore Affects the storage system labels Aug 16, 2021
@ecordell
Copy link
Contributor

@jzelinskie This looks done to me: https://github.com/authzed/spicedb/blob/main/internal/datastore/postgres/migrations/add_unique_living_ns.go#L5

But that commit is from before this issue was made, so maybe I'm missing something. Is there anything else we need to do here?

@jakedt
Copy link
Member

jakedt commented Jun 6, 2022

As far as I can tell this was never an issue:
785d123#diff-14c374134210d368573327dd7ab593d8da51fe6eee637ed450f92383414d43b0R27

@jakedt jakedt closed this as completed Jun 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/datastore Affects the storage system priority/2 medium This needs to be done
Projects
None yet
Development

No branches or pull requests

3 participants