Thread: Join between tables of two or more databases

Join between tables of two or more databases

From
"T.J. Adami"
Date:
Hi people. I have 2 databases named as follows:

1) company_a

2) company_b


These two databases do not have the same ER model. However, I want to
access tables on "company_a" there are in "company_b". I want to use
them as local tables (as other databases like Sybase allows, since you
have opened a database link).

The question is: can I do this using remote database servers
(different hosts)? If does not, can I do it at least on local
databases on the same server?


Re: Join between tables of two or more databases

From
Reg Me Please
Date:
Il Wednesday 31 October 2007 11:47:46 T.J. Adami ha scritto:
> Hi people. I have 2 databases named as follows:
>
> 1) company_a
>
> 2) company_b
>
>
> These two databases do not have the same ER model. However, I want to
> access tables on "company_a" there are in "company_b". I want to use
> them as local tables (as other databases like Sybase allows, since you
> have opened a database link).
>
> The question is: can I do this using remote database servers
> (different hosts)? If does not, can I do it at least on local
> databases on the same server?
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend

As far as they are "different databases", you cannot do it at the moment.
It doesn't matter whether they are local or not.
The only option should be to do it at the application level with two
connections.

--
Reg me Please

Re: Join between tables of two or more databases

From
Luca Ferrari
Date:
On Wednesday 31 October 2007 T.J. Adami's cat, walking on the keyboard, wrote:
> The question is: can I do this using remote database servers
> (different hosts)? If does not, can I do it at least on local
> databases on the same server?

I guess the dblink module could help you.

Luca

Re: Join between tables of two or more databases

From
"Pavel Stehule"
Date:
On 31/10/2007, T.J. Adami <adamitj@gmail.com> wrote:
> Hi people. I have 2 databases named as follows:
>
> 1) company_a
>
> 2) company_b
>
>

hello

you can access others databases via dblink
look to contrib

Pavel Stehule

Re: Join between tables of two or more databases

From
"Scott Marlowe"
Date:
On 10/31/07, Reg Me Please <regmeplease@gmail.com> wrote:
> Il Wednesday 31 October 2007 11:47:46 T.J. Adami ha scritto:

> > The question is: can I do this using remote database servers
> > (different hosts)? If does not, can I do it at least on local
> > databases on the same server?
> >
> As far as they are "different databases", you cannot do it at the moment.
> It doesn't matter whether they are local or not.
> The only option should be to do it at the application level with two
> connections.

Or put the databases into schemas in the same database.  If you need
the join two datasets in pgsql, they need to be in the same database.