Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jJdk8-0002mW-P8 for pgsql-sql@arkaria.postgresql.org; Wed, 01 Apr 2020 13:49:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jJdk7-00078D-Dd for pgsql-sql@arkaria.postgresql.org; Wed, 01 Apr 2020 13:49:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jJdk7-000786-7B for pgsql-sql@lists.postgresql.org; Wed, 01 Apr 2020 13:49:19 +0000 Received: from util-st-02.imsweb.com ([204.132.58.65]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jJdju-0007zg-Kv for pgsql-sql@lists.postgresql.org; Wed, 01 Apr 2020 13:49:18 +0000 Received: from NAIAD.omni.imsweb.com (haproxy-st-01 [204.132.58.75]) by util-st-02.imsweb.com (Postfix) with ESMTP id D910CE41F5 for ; Wed, 1 Apr 2020 09:49:03 -0400 (EDT) Received: from NAIAD.omni.imsweb.com (172.22.64.103) by NAIAD.omni.imsweb.com (172.22.64.103) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 1 Apr 2020 09:49:03 -0400 Received: from NAIAD.omni.imsweb.com ([172.22.64.103]) by NAIAD.omni.imsweb.com ([172.22.64.103]) with mapi id 15.00.1497.006; Wed, 1 Apr 2020 09:49:03 -0400 From: "Heinemann, Manfred (IMS)" To: "pgsql-sql@lists.postgresql.org" Subject: FK constraint question Thread-Topic: FK constraint question Thread-Index: AdYIK+fDrLfdeUAlT1qY34n4HgKNcg== Date: Wed, 1 Apr 2020 13:49:03 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [204.132.58.75] Content-Type: multipart/alternative; boundary="_000_e5f1fa241b2a4f67816c3f1915f49ff2NAIADomniimswebcom_" MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --_000_e5f1fa241b2a4f67816c3f1915f49ff2NAIADomniimswebcom_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 constr= aint "fk_task_history_task_id" Detail: Key (task_id)=3D(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 empl= oyee or agent of the addressee(s), please note that any dissemination, dist= ribution, or copying of this communication is strictly prohibited. If you h= ave received this e-mail in error, please notify the sender of the error. --_000_e5f1fa241b2a4f67816c3f1915f49ff2NAIADomniimswebcom_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Can something explain why something like the followi= ng could happen?

 

INSERT INTO task_history (task_id, user_id, task_dat= e)

SELECT task_id, user_id, task_date

FROM task

WHERE task_id IN (1, 2, 3);

 

ERROR: insert or update on table "task_history&= quot; violates foreign key constraint "fk_task_history_task_id"

  Detail: Key (task_id)=3D(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 empl= oyee or agent of the addressee(s), please note that any dissemination, dist= ribution, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please = notify the sender of the error.
--_000_e5f1fa241b2a4f67816c3f1915f49ff2NAIADomniimswebcom_--