Re: problem with foreign key

From: Ljubomir Erdeljan <ljubomir(dot)erdeljan(at)chello(dot)at>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: problem with foreign key
Date: 2010-09-05 20:49:32
Message-ID: 4C84025C.1060606@chello.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

This relate to different column names
docuuserid is column in porder1 but relate to tradeid in trade.

Thank you,

On 05/09/2010 22:40, Bèrto ëd Sèra wrote:
> An immediate question: did you check that Key (docuuserid)=(8415) is
> actually present in table "trade"?
>
> Bèrto
>
> On 5 September 2010 23:17, Ljubomir Erdeljan
> <ljubomir(dot)erdeljan(at)chello(dot)at <mailto:ljubomir(dot)erdeljan(at)chello(dot)at>> wrote:
>
> hi group,
>
> trying to create foreign key:
>
> ALTER TABLE porder1 ADD CONSTRAINT order_exist
> FOREIGN KEY (docuuserid) REFERENCES trade(tradeid) ON DELETE RESTRICT;
>
> column docuuserid is integer in porder1
> column tradeid is serial in trade and belong to primary key
> (single column)
>
> getting In EMS PostgreSQL
> ERROR: insert or update on table "porder1" violates foreign key
> constraint "order_exist"
> DETAIL: Key (docuuserid)=(8415) is not present in table "trade".
>
> In PostgreSQL Code Factory
> SQL Error: ERROR: insert or update on table "porder1" violates
> foreign key constraint "order_exist"
> DETAIL: Key (docuuserid)=(8415) is not present in table "trade".
>
> postgresql 8.4.4-1 on windows 7 ultimate 64 bit standard installation
>
> I'm not able to figure out what should be a problem.
>
>
>
> kindly regards
>
> ljubomir erdeljan
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin(at)postgresql(dot)org
> <mailto:pgsql-admin(at)postgresql(dot)org>)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
>
>
>
>
> --
> ==============================
> Constitution du 24 juin 1793 - Article 35. - Quand le gouvernement
> viole les droits du peuple, l'insurrection est, pour le peuple et pour
> chaque portion du peuple, le plus sacré des droits et le plus
> indispensable des devoirs.

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Lew 2010-09-07 00:22:22 Re: problem with foreign key
Previous Message Bèrto ëd Sèra 2010-09-05 20:40:48 Re: problem with foreign key