On PostgreSQL, I have a table with the columns name, surname and _deleted.
name and surname cannot be duplicated, so I had a unique constraint on them and everything was good.
after that, I added the _deleted for soft deletes. If I add (name, surname) and then I soft delete it, I cannot add anymore (name, surname).
I thought that the solution was adding unique to (name, surname, _deleted) but it does not work, because _deleted is a DateTime that is null when it is not deleted, hence NULL can be multiple.
How can I add a proper constraint?