Skip to content

NULL=NULL is NULL in Postgres #199

@deviant-logic

Description

@deviant-logic

The section on persistent says:

The reason for this is that the SQL standard is ambiguous on how uniqueness should be applied to NULL (e.g., is NULL=NULL true or false?). Besides that ambiguity, most SQL engines in fact
implement rules which would be contrary to what the Haskell datatypes anticipate (e.g., PostgreSQL says that NULL=NULL is false, whereas Haskell says Nothing == Nothing is True).

My understanding had alway been that NULL=NULL gave NULL, and indeed in the Postgres on my machine at the moment (9.6.5) as well as the sqlite, select (null = null) is null evaluates to true. The article on SQL Nulls believes the distinction is worth calling out in its own section.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions