Re: Add Foreign Keys To Table

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Add Foreign Keys To Table
Date: 2011-07-07 20:05:40
Message-ID: alpine.LNX.2.00.1107071304590.20399@salmo.appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 7 Jul 2011, John R Pierce wrote:

> Since your PK of station_type is a composite, your foreign key must also be
> composite.
>
> CREATE TABLE stuffed (
> id serial;
> otherestuffs text;
> sta varchar(50),
> sec varchar(50),
> FOREIGN KEY (sta, sec) REFERENCES station_type(sta_type, secondary_type)
> );

Thanks, John, for showing me how to apply this approach.

Rich

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2011-07-07 20:18:32 Re: Add Foreign Keys To Table
Previous Message Dave Coventry 2011-07-07 20:04:14 Re: Insufficient privileges.