Re:SQL: 2023 is finished: Here is what's new
by Dylan16807 on Thursday April 13, 2023 @11:29PM
(#35565210)
If it can't be either behavior, then should nullable columns not be allowed in unique indexes at all?
[ Parent
| on HN ]
Re:SQL: 2023 is finished: Here is what's new
by masklinn on Friday April 14, 2023 @03:37AM
(#35566603)
A few DBs actually do that.
It can be rather limiting, though also less surprising (at runtime) than either other behaviour.
Re:SQL: 2023 is finished: Here is what's new
by SoftTalker on Friday April 14, 2023 @12:58PM
(#35571778)
No ideally not. If they are they must be ignored.
If other columns in the row index are unique regardless of the value of the nullable column, then the row is logically unique. So if in that case the NULL value is ignored, then OK. But two NULLs neither match each other nor are they distinct from each other. You just cannot say either way.