Re: foreign key constraint across databases

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: foreign key constraint across databases
Дата
Msg-id 27637.1047011905@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: foreign key constraint across databases  (Siva Kumar <siva@leatherlink.net>)
Список pgsql-general
Siva Kumar <siva@leatherlink.net> writes:
> Is it possible to have a column in Table-2 of Database-B to have a
> foreign key constraint referencing Table-1 of Database-A?
>>
>> What are you planning to use it for (ie, why separate databases rather
>> than something like separate schemas)

> Our application is used by different companies for their operation and will be
> accessible over internet. We want to have separate databases for each company
> and the application will interact with all the databases to enable
> buyer-supplier relationships etc.

Let me get this straight: you want separable, removable databases for
each client --- but you are going to maintain foreign-key relationships
between them?  Something needs rethinking here.

Either you need an airtight separation between clients, or you don't.
If you don't, then a schema per client ought to do the job.  If you do,
I think foreign-key relationships are mighty questionable.  Exactly
which client is going to have their queries fail when the FK constraint
is violated?  And how are you going to explain the failure to the client
that thought they had an airtight private database?

            regards, tom lane

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Is renaming a database easy or dangerous
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Why PostgreSQL?