Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres NULL values in unique index #167

Open
Jaymon opened this issue Jun 28, 2023 · 0 comments
Open

Postgres NULL values in unique index #167

Jaymon opened this issue Jun 28, 2023 · 0 comments

Comments

@Jaymon
Copy link
Owner

Jaymon commented Jun 28, 2023

Looks like Postgres 15 has a new thing where you can set UNIQUE NULLS NOT DISTINCT so that NULL values aren't treated as always different. Would I want to support something like this?

Here is how they behave when this isn't used:

In general, a unique constraint is violated if there is more than one row in the table where the values of all of the columns included in the constraint are equal. However, two null values are never considered equal in this comparison. That means even in the presence of a unique constraint it is possible to store duplicate rows that contain a null value in at least one of the constrained columns. This behavior conforms to the SQL standard, but we have heard that other SQL databases might not follow this rule. So be careful when developing applications that are intended to be portable.

search:

  • postgres on conflict field with null value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant