Re: Connection to second database on server

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: Connection to second database on server
Дата
Msg-id dcc563d10808242124t13ca0e68w62f3145b8003d73e@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Connection to second database on server  (Troy Rasiah <troyr@vicnet.net.au>)
Ответы Re: Connection to second database on server  (Troy Rasiah <troyr@vicnet.net.au>)
Список pgsql-general
On Sun, Aug 24, 2008 at 10:19 PM, Troy Rasiah <troyr@vicnet.net.au> wrote:
>
>
> Scott Marlowe wrote:
>> On Sun, Aug 24, 2008 at 8:43 PM, Troy Rasiah <troyr@vicnet.net.au> wrote:
>>> Sorry for bringing up an old post...If you have a generic set of tables..
>>>
>>> eg. table of countries / post codes etc which are used across several
>>> databases what is the best way to access / store them?
>>> I currently
>>>  - use dblink to create views when i want to do joins,
>>>  OR
>>>  - i just open up a separate db handle when i just want to display the
>>> data (via a perl script) from the 'generic database' (eg. a select list
>>> of countries)
>>>
>>> but was wondering whether schema's would apply to me as well ?
>>
>> Yes, schemas would be much better.  The nice thing is with
>> search_path, you could have a setup where application1 and
>> application2 live in different schemas but have access to a common
>> schema.  When running app1, you'd do something like:
>>
>> set search_path='app1','commonschema';
>>
>> and when running app2 you'd change the app1 up there to app2 and then
>> you could access the tables in both schemas without having to use
>> prefixes.
>
>
> Thanks Scott. We currently do websites for different customers on the
> same machine so we have been setting each of them up with individual
> (database,user,pass).
>
> Instead should i be setting them all up in the one database and having
> individual schema's for each customer and then only granting each user
> access to their schema & the proposed 'commonschema' ?

That's how I'd do it.  You probably want to drop the public schema as
well.  If you need to separate everybody from each other into their
own database, then you could always replicate the common schema to
each db,  but if the common schema is large or changes a lot this
could be a pain.

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

Предыдущее
От: Ow Mun Heng
Дата:
Сообщение: Issue with creation of Partial_indexes (Immutable?)
Следующее
От: Troy Rasiah
Дата:
Сообщение: Re: Connection to second database on server