Re: How does PostgreSQL treat null values in unique

From: Neil Conway <neilc(at)samurai(dot)com>
To: jim(at)nasby(dot)net
Cc: Dennis Gearon <gearond(at)cvc(dot)net>, P G <pg_dba(at)yahoo(dot)com>, PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: How does PostgreSQL treat null values in unique
Date: 2003-04-09 01:08:04
Message-ID: 1049850484.1008.4.camel@tokyo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 2003-04-08 at 20:31, Jim C. Nasby wrote:
> Take note that there is no standard for how NULLs are handled in unique
> constraints, though.

On the contrary, there *is* a standard for this behaviour (namely, the
SQL standard). For example, section 4.18.2 of the SQL 200x draft
standard says:

"A unique constraint is satisfied if and only if no two rows in a table
have the same non-null values in the _unique columns_."

Some databases might not follow this part of the spec, but the standard
is pretty clear, AFAICS.

Cheers,

Neil

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2003-04-09 01:59:37 Re: [SQL] Yet Another (Simple) Case of Index not used
Previous Message Brent Wood 2003-04-09 00:44:48 Re: Yet Another (Simple) Case of Index not used