News for hackers. Stuff that matters.
Re:Postgres 15 improves UNIQUE and NULL by dtech on Monday July 11, 2022 @06:54AM (#32054479)
Not OP, but this constraint means "the data must either be empty or unique", which is an extremely common constraint. In contrast, I've never encountered "only 1 entry is allowed not to have the data, all others must be unique".
Re:Postgres 15 improves UNIQUE and NULL by enkrs on Monday July 11, 2022 @08:05AM (#32055008)
"only 1 entry is allowed not to have the data, all others must be unique" makes sense in larger schemas as the database grows. It replaces is_default_address, is_primary_child etc. fields and constraints on relational tables. In the perfect world all the data would be normalized not to have such columns and cases, but in real life it just grows that way. So for some cases NULLS NOT DISTINCT will be a welcome addition.