On Fri, 28 Apr 2006, Sidar Lopez Cruz wrote: > > The following bug has been logged online: > > Bug reference: 2412 > Logged by: Sidar Lopez Cruz > Email address: [EMAIL PROTECTED] > PostgreSQL version: 8.1.3 > Operating system: Ubuntu 6.04 > Description: Foreing key accept nulls > Details: > > I think that when I create table that have a foreing key to another one > these FK may not accept nulls by default.
The SQL spec seems to say otherwise. A foreign key constraint with match simple (unspecified) is considered satisfied if any component of the key is null or there is a match in the referenced table. A foreign key constraint with match full is considered satisified if all components of the key is null or there is a match in the referenced table. For a single column key, this means NULLs are acceptable unless the column has other constraints (like not null). ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match