FK constraint question

From: "Heinemann, Manfred (IMS)" <HeinemannM(at)imsweb(dot)com>
To: "pgsql-sql(at)lists(dot)postgresql(dot)org" <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: FK constraint question
Date: 2020-04-01 13:49:03
Message-ID: e5f1fa241b2a4f67816c3f1915f49ff2@NAIAD.omni.imsweb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Can something explain why something like the following could happen?

INSERT INTO task_history (task_id, user_id, task_date)
SELECT task_id, user_id, task_date
FROM task
WHERE task_id IN (1, 2, 3);

ERROR: insert or update on table "task_history" violates foreign key constraint "fk_task_history_task_id"
Detail: Key (task_id)=(1) is not present in table "task".

Thanks,
Manfred

________________________________

Information in this e-mail may be confidential. It is intended only for the addressee(s) identified above. If you are not the addressee(s), or an employee or agent of the addressee(s), please note that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please notify the sender of the error.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Steve Midgley 2020-04-01 15:29:44 Re: FK constraint question
Previous Message Bruce Momjian 2020-03-25 17:45:10 Re: min()/max() with BRIN indexes