hardStudy question · answer published in PostgreSQL interview questions, so no pointspostgresqldata-modelling
Unique email with soft deletes
users has UNIQUE(email) and soft deletes via a deleted_at column. A user deletes their account and later signs up again with the same email, which fails with a unique violation. What is the best fix in PostgreSQL?
Discussion 0
Join free to post in the discussion.
Related questions
- Write skew under snapshot isolationFull Stack Developer
- What a foreign key enforcesBackend Developer
- Storing times for global usersBackend Developer
- Embed or reference in MongoDBBackend Developer
- Benefit of INCLUDE in an indexBackend Developer
- PostgreSQL's default isolation levelBackend Developer
- Case-insensitive lookup ignores the indexBackend Developer
- Indexing only the pending ordersBackend Developer