Is it possible to create a foreign key constraint to a non-primary key column which is UNIQUE
? I'm using PostgreSQL 8.4
.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.