Re: ADD FOREIGN KEY fails, but the records exist

2021-02-15 Thread Adrian Klaver
On 2/15/21 8:55 AM, Ron wrote: The time portions of the part_date fields don't match... sides=> ALTER TABLE employer_response     ADD CONSTRAINT amended_response_fk FOREIGN KEY (amended_response_id, part_date)     REFERENCES employer_response(employer_response_id, part_date)     ON

Re: ADD FOREIGN KEY fails, but the records exist

2021-02-15 Thread Ron
On 2/15/21 10:58 AM, Adrian Klaver wrote: On 2/15/21 8:55 AM, Ron wrote: On 2/15/21 10:27 AM, Adrian Klaver wrote: On 2/15/21 8:23 AM, Ron wrote: On 2/15/21 10:17 AM, Adrian Klaver wrote: On 2/15/21 8:12 AM, Ron wrote: Postgresql 12.5 The error: DETAIL:  Key (amended_response_id, part

Re: ADD FOREIGN KEY fails, but the records exist

2021-02-15 Thread Adrian Klaver
On 2/15/21 8:55 AM, Ron wrote: On 2/15/21 10:27 AM, Adrian Klaver wrote: On 2/15/21 8:23 AM, Ron wrote: On 2/15/21 10:17 AM, Adrian Klaver wrote: On 2/15/21 8:12 AM, Ron wrote: Postgresql 12.5 The error: DETAIL:  Key (amended_response_id, part_date)=(103309154, 2021-01-06 00:00:00) is

Re: ADD FOREIGN KEY fails, but the records exist

2021-02-15 Thread Ron
On 2/15/21 10:27 AM, Adrian Klaver wrote: On 2/15/21 8:23 AM, Ron wrote: On 2/15/21 10:17 AM, Adrian Klaver wrote: On 2/15/21 8:12 AM, Ron wrote: Postgresql 12.5 The error: DETAIL:  Key (amended_response_id, part_date)=(103309154, 2021-01-06 00:00:00) is not present in table "employer_

Re: ADD FOREIGN KEY fails, but the records exist

2021-02-15 Thread Tom Lane
Ron writes: > Postgresql 12.5 > It's a self-referential FK on a single (but partitioned) table.  The ALTER > TABLE command fails, but I queried it, and the record that it fails on > exists.  I modified the original INITIALLY IMMEDIATE clause to INITIALLY > DEFERRED but that did not help. > Wha

Re: ADD FOREIGN KEY fails, but the records exist

2021-02-15 Thread Ron
On 2/15/21 10:27 AM, Adrian Klaver wrote: On 2/15/21 8:23 AM, Ron wrote: On 2/15/21 10:17 AM, Adrian Klaver wrote: On 2/15/21 8:12 AM, Ron wrote: Postgresql 12.5 The error: DETAIL:  Key (amended_response_id, part_date)=(103309154, 2021-01-06 00:00:00) is not present in table "employer_re

Re: ADD FOREIGN KEY fails, but the records exist

2021-02-15 Thread Adrian Klaver
On 2/15/21 8:23 AM, Ron wrote: On 2/15/21 10:17 AM, Adrian Klaver wrote: On 2/15/21 8:12 AM, Ron wrote: Postgresql 12.5 The error: DETAIL:  Key (amended_response_id, part_date)=(103309154, 2021-01-06 00:00:00) is not present in table "employer_response" is pointing at 103309154 for amen

Re: ADD FOREIGN KEY fails, but the records exist

2021-02-15 Thread Ron
On 2/15/21 10:17 AM, Adrian Klaver wrote: On 2/15/21 8:12 AM, Ron wrote: Postgresql 12.5 It's a self-referential FK on a single (but partitioned) table. The ALTER TABLE command fails, but I queried it, and the record that it fails on exists.  I modified the original INITIALLY IMMEDIATE clause

Re: ADD FOREIGN KEY fails, but the records exist

2021-02-15 Thread Adrian Klaver
On 2/15/21 8:12 AM, Ron wrote: Postgresql 12.5 It's a self-referential FK on a single (but partitioned) table.  The ALTER TABLE command fails, but I queried it, and the record that it fails on exists.  I modified the original INITIALLY IMMEDIATE clause to INITIALLY DEFERRED but that did not h