Re: Using duplicate foreign keys

Поиск
Список
Период
Сортировка
От Andrus
Тема Re: Using duplicate foreign keys
Дата
Msg-id enlk7q$o75$1@news.hub.org
обсуждение исходный текст
Ответ на Using duplicate foreign keys  ("Andrus" <kobruleht2@hot.ee>)
Список pgsql-general
> The problem I see with that is that any value of accountnumber in
> public.commontable would need to be in both company1.chartoffaccounts and
> company2.chartoffaccounts.  One key referencing two completely sets of
> data?  That sounds broken.  Can you give a more detailed example of how
> you want to use this?

public.commontable describes rules how invoices are posted to general
ledger.
It seems not reasonable to duplicate this table in every company schema
since it contains usually same data for every company.
public.commontable contians fixed account numbers which I think I must force
to be present in chart of accounts in every company schema to use this kind
of foreign key relationship.

> Off hand, it sounds like what you may want is to have accountnumber as the
> primary key of public.commontable with the accountnumber columns in the
> schema specific tables referencing it instead.

public commontable contains also a lot of other columns describing invoice
posting rules.
accountnumber cannot be primary key of  public.commontable since it can
contain same account numbers for different types of documents.

Yes, it seems to be possible to create a new table
public.commonaccountnumbers  with accountnumber as primary key.

So the question seems to be:

can I use duplicate foreign keys without problems or must I waste resources
to create new table commonaccountnumbers ?


Andrus.



В списке pgsql-general по дате отправления:

Предыдущее
От: ptjm@interlog.com (Patrick TJ McPhee)
Дата:
Сообщение: Re: Any form of connection-level "session variable" ?
Следующее
От: "imageguy"
Дата:
Сообщение: Re: Database versus filesystem for storing images