Re: [GENERAL] Syntax error needs fresh eyeballs - Mailing list pgsql-general

From Rich Shepard
Subject Re: [GENERAL] Syntax error needs fresh eyeballs
Date
Msg-id alpine.LNX.2.11.1612261610230.25972@localhost
Whole thread Raw
In response to Re: [GENERAL] Syntax error needs fresh eyeballs  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Mon, 26 Dec 2016, Tom Lane wrote:

>> ERROR:  there is no unique constraint matching given keys for referenced
>> table "weather_params".
>
> because Weather_Params.param isn't constrained to be unique.
  ...
> Seeing that Weather_Data also has a site_id column, I'm going to guess
> that what you wanted to put in Weather_Data is a two-column FK:
>
>     FOREIGN KEY (site_id, param) REFERENCES Weather_Params (site_id, param)
>
> That would match Weather_Params' pkey, so it's enough to identify a
> unique row of Weather_Params.

   Thanks, Tom. Yes, I do want a 2-column FK.

Much appreciated,

Rich


pgsql-general by date:

Previous
From: "Mike Sofen"
Date:
Subject: Re: [GENERAL] Syntax error needs fresh eyeballs
Next
From: Thomas.Deboben.ext@rohde-schwarz.com
Date:
Subject: Re: [GENERAL] Windows installation - could not connect to server:Connection refused (0x0000274D/10061)