On Thu, Jul 13, 2006 at 10:40:43AM -0400, Chris Hoover wrote: > Why is PostgreSQL not enforcing this index? This appears to be a pretty > major a bug? It would seem that you could have a unique index across > columns that might have a null in them. This comes up frequently due to a misunderstanding of how NULL comparison works. http://www.postgresql.org/docs/8.1/interactive/ddl-constraints.html#AEN2016 "In general, a unique constraint is violated when there are two or more rows in the table where the values of all of the columns included in the constraint are equal. However, null values are not 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 may not follow this rule. So be careful when developing applications that are intended to be portable." -- Michael Fuhr