Re: Add Foreign Keys To Table

From: Alan Hodgson
Subject: Re: Add Foreign Keys To Table
Date: ,
Msg-id: 201107071119.56980.ahodgson@simkin.ca
(view: Whole thread, Raw)
In response to: Add Foreign Keys To Table  (Rich Shepard)
Responses: Re: Add Foreign Keys To Table  (Rich Shepard)
List: pgsql-general

Tree view

Add Foreign Keys To Table  (Rich Shepard, )
 Re: Add Foreign Keys To Table  (Alan Hodgson, )
  Re: Add Foreign Keys To Table  (Rich Shepard, )
   Re: Add Foreign Keys To Table  (Alan Hodgson, )
    Re: Add Foreign Keys To Table  (Rich Shepard, )
     Re: Add Foreign Keys To Table  (Alan Hodgson, )
      Re: Add Foreign Keys To Table  (Rich Shepard, )
       Re: Add Foreign Keys To Table  (John R Pierce, )
        Re: Add Foreign Keys To Table  (Rich Shepard, )
     Re: Add Foreign Keys To Table  ("David Johnston", )
 Re: Add Foreign Keys To Table  (John R Pierce, )
  Re: Add Foreign Keys To Table  (Rich Shepard, )
 Re: Add Foreign Keys To Table  ("David Johnston", )
 Re: Add Foreign Keys To Table  ("Dr. Tingrong Lu", )

On July 7, 2011 10:40:11 AM Rich Shepard wrote:
> alter table station_information add column sta_type varchar(50)
> unique not null references station_type(sta_type);
> NOTICE:  ALTER TABLE / ADD UNIQUE will create implicit index
> "station_information_sta_type_key" for table "station_information"
> ERROR:  there is no unique constraint matching given keys for referenced
> table "station_type"
>    Reading the alter table document page for 9.x does not show me what I'm
> doing incorrectly.

You need a unique index on station_type.sta_type



pgsql-general by date:

From: "David Johnston"
Date:
Subject: Re: Trying to find miss and mister of the last month with highest rating
From: "Dr. Tingrong Lu"
Date:
Subject: Re: Add Foreign Keys To Table