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