Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] foreign key is from different tables - what to do?

From: "PG Explorer" <pgmail(at)pgexplorer(dot)com>
To: "Cyril Samovskiy" <cyril_s31(at)yahoo(dot)com>,"Oliver Elphick" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: [HACKERS] foreign key is from different tables - what to do?
Date: 2002-02-21 20:40:10
Message-ID: 002c01c1bb17$febfa920$c80ba8c0@sabex.com (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-novice
You have to create 2 foreign keys

alter table YourTable
ALTER TABLE "YourTable" ADD CONSTRAINT "my_a_fk" FOREIGN KEY (a) REFERENCES
aaa(a) MATCH FULL;
ALTER TABLE "YourTable" ADD CONSTRAINT "my_b_fk" FOREIGN KEY (b) REFERENCES
bbb(b) MATCH FULL;

Hope this Helps

http://www.pgexplorer.com
Postgres GUI tool



----- Original Message -----
From: "Cyril Samovskiy" <cyril_s31(at)yahoo(dot)com>
To: "Oliver Elphick" <pgsql-novice(at)postgresql(dot)org>
Sent: Thursday, February 21, 2002 11:39 AM
Subject: Re: [NOVICE] [HACKERS] foreign key is from different tables - what
to do?


> >> hi. i'm rookie in postgres, so here is my question:
>
> OE> Therefore your question should have gone to pgsql-novice.  (Reply-To
set
> OE> there.)
>
> oh, i'm sorry i didn't know that
>
> >> i have foreign key consisting of 2 fields (a and b). a is foreign key
from
> >> table aaa, b is FK from table bbb. how to create table is that complex
> >> foreign key consisiting of fields from different tables?
> >> thank you
>
> OE> You seem to have two foreign keys, not one.  I'm guessing that you
> OE> actually have a multi-field primary key, each field of which is a
> OE> foreign key to another table:
>
> no my primary key is only one field, another one. actually i found how
> to make multi-FK from different tables using ALTER TABLE stuff.
> anyway thanks a lot for your support
> and sorry again for disturbing you
> bye
>
>
> -------------------
> Best regards,
> Cyril Samovskiy
> cyril_s31(at)yahoo(dot)com
> cyril(at)somiconline(dot)org
>
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)


In response to

pgsql-novice by date

Next:From: Diane MooreDate: 2002-02-21 22:55:05
Subject: How to determine table definitions
Previous:From: Keller, SidDate: 2002-02-21 20:34:10
Subject: Logging Apache web server log information to Postgresql

pgsql-hackers by date

Next:From: Stephan SzaboDate: 2002-02-21 20:54:50
Subject: Re: [HACKERS] fmgr_info: function 20071: cache lookup failed
Previous:From: soetebeer.comDate: 2002-02-21 20:29:42
Subject: Problems with the lower() and upper() functions and umlaut chars in 7.2

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group