agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Heinemann, Manfred (IMS) <HeinemannM@imsweb.com>
To: pgsql-sql@lists.postgresql.org <pgsql-sql@lists.postgresql.org>
Subject: FK constraint question
Date: Wed, 1 Apr 2020 13:49:03 +0000
Message-ID: <e5f1fa241b2a4f67816c3f1915f49ff2@NAIAD.omni.imsweb.com> (raw)

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.

view thread (4+ messages)  latest in thread

Message-ID: <e5f1fa241b2a4f67816c3f1915f49ff2@NAIAD.omni.imsweb.com>
Permalink:  ../e5f1fa241b2a4f67816c3f1915f49ff2@NAIAD.omni.imsweb.com/
Also on:    postgresql.org/message-id/e5f1fa241b2a4f67816c3f1915f49ff2@NAIAD.omni.imsweb.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: HeinemannM@imsweb.com, pgsql-sql@lists.postgresql.org
  Subject: Re: FK constraint question
  In-Reply-To: <e5f1fa241b2a4f67816c3f1915f49ff2@NAIAD.omni.imsweb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox