Reputation: 7357
Is it possible to create a foreign key constraint to a non-primary key column which is UNIQUE
? I'm using PostgreSQL 8.4
.
Upvotes: 1
Views: 1174
Reputation: 382132
Yes.
From the documentation:
Finally, we should mention that a foreign key must reference columns that either are a primary key or form a unique constraint.
Upvotes: 5