Using duplicate foreign keys

From: "Andrus" <kobruleht2(at)hot(dot)ee>
To: pgsql-general(at)postgresql(dot)org
Subject: Using duplicate foreign keys
Date: 2007-01-04 17:29:24
Message-ID: enjdia$12tq$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have multi-company database.
Each company has its own chart of accounts table which are stored in each
company schema.
Some account numbers are used in a common table which is stored in public
schema.

So I need to create duplicate foreign keys like

create temp table company1.chartoffaccounts ( accountnumber int primary
key);
create temp table company2.chartoffaccounts ( accountnumber int primary
key);

create temp table public.commontable ( accountnumber int,
FOREIGN KEY (accountnumber) REFERENCES c1hartoffaccounts
(accountnumber)
FOREIGN KEY (accountnumber) REFERENCES c2hartoffaccounts
(accountnumber) );

Is it OK to use duplicate foreign keys ? What issues will they cause ?

Andrus.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2007-01-04 17:35:21 Re: pg_dump question
Previous Message Scott Marlowe 2007-01-04 17:24:31 Re: Discovering time of last database write