Search Postgresql Archives

Re: Add Foreign Keys To Table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On July 7, 2011 12:30:35 PM Rich Shepard wrote:
> On Thu, 7 Jul 2011, Alan Hodgson wrote:
> > It implies the composite is unique. Not sta_type.
> 
>    OK. Now I understand. How, then, do I add a unique constraint to each
> component of the composite key so I can add them as foreign keys to the
> station_information table? Or, is there another way to add those two
> columns to station_information and then add the foreign key constraints?
> 
> Thanks for clarifying,
> 

create unique index index_name on table (column).

Or I think you can create a foreign key on a composite like "foreign key 
(column1,column2) references table (column1,column2)" which probably makes 
more sense if that is a natural key.

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux