Re: FK constraint question

From: Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>
To: "Heinemann, Manfred (IMS)" <HeinemannM(at)imsweb(dot)com>
Cc: "pgsql-sql(at)lists(dot)postgresql(dot)org" <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: Re: FK constraint question
Date: 2020-04-22 16:31:08
Message-ID: CAE9k0P=srFJ6CMs0Dsm=iPWg4eJZe4+sBe2QHKzq7vcA0GiO1w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

Do you have multiple task table created in your database?

Can you share the output of \d+ task_history?

On Wednesday, April 1, 2020, Heinemann, Manfred (IMS) <HeinemannM(at)imsweb(dot)com>
wrote:

> 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.
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message John Zhang 2020-04-23 12:42:46 How to sql scripts in a file?
Previous Message Samed YILDIRIM 2020-04-22 15:50:40 Re: FK constraint question