Re: Syntax error needs fresh eyeballs

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Syntax error needs fresh eyeballs
Date: 2016-12-27 00:11:40
Message-ID: alpine.LNX.2.11.1612261610230.25972@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas.Deboben.ext 2016-12-27 07:43:10 Re: Windows installation - could not connect to server: Connection refused (0x0000274D/10061)
Previous Message Mike Sofen 2016-12-26 23:40:30 Re: Syntax error needs fresh eyeballs