engine icon indicating copy to clipboard operation
engine copied to clipboard

support nulls not distinct for unique constraints

Open matej21 opened this issue 1 year ago • 0 comments

This pull request introduces the option to configure null behavior in unique indexes—specifically, whether nulls should be distinct. This feature is available starting from PostgreSQL version 15.

Initially, I thought this would be a straightforward enhancement. However, we encountered a significant challenge: our current implementation relies on unique constraints, which do not support variations in null behavior; this capability is exclusive to unique indexes. Additionally, unique indexes lack support for timing options like deferrable constraints.

Moreover, our internal metadata is structured around the use of unique constraints rather than indexes.

To address this, we can either provide an option that allows users to explicitly choose between using an index or a constraint, or we could automate this decision based on the parameters provided. If a user's requirements for timing and null behavior conflict, the operation should fail.

matej21 avatar May 23 '24 14:05 matej21