Thread: Accessing different databases in a cluster

Accessing different databases in a cluster

From
Dave Blasby
Date:
Is it possible to access tables in one database from another database if
they're in the same cluster?  I dont seem to be able to do it; is there
something I have to do or is it impossible?

Ie.
If I have two databases accessible from the same postmaster; one called
db_one and the other called db_two.


%psql -U postgres -p 5555 db_one
db_one=# select * from db_two.mytable;
...

or, from the other perspective;

%psql -U postgres -p 5555 db_two
db_two=# select * from db_one.myothertable;
...

Thanks,
dave


Re: Accessing different databases in a cluster

From
Stephan Szabo
Date:
On Wed, 1 Aug 2001, Dave Blasby wrote:

> Is it possible to access tables in one database from another database if
> they're in the same cluster?  I dont seem to be able to do it; is there
> something I have to do or is it impossible?

No, AFAIK, this isn't currently possible.



Re: Accessing different databases in a cluster

From
Naomi Walker
Date:
At 12:22 PM 8/1/01 -0700, Stephan Szabo wrote:
>On Wed, 1 Aug 2001, Dave Blasby wrote:
>
> > Is it possible to access tables in one database from another database if
> > they're in the same cluster?  I dont seem to be able to do it; is there
> > something I have to do or is it impossible?
>
>No, AFAIK, this isn't currently possible.
Really, you cannot do a "select from" one and "insert into" another?

You could probably rig it up through pipes, like a pg_dump piped to a 
pg_restore.



--
Naomi Walker
Chief Information Officer
Eldorado Computing, Inc.
602-604-3100  ext 242 



Re: Accessing different databases in a cluster

From
Stephan Szabo
Date:
On Wed, 1 Aug 2001, Naomi Walker wrote:

> At 12:22 PM 8/1/01 -0700, Stephan Szabo wrote:
> >On Wed, 1 Aug 2001, Dave Blasby wrote:
> >
> > > Is it possible to access tables in one database from another database if
> > > they're in the same cluster?  I dont seem to be able to do it; is there
> > > something I have to do or is it impossible?
> >
> >No, AFAIK, this isn't currently possible.
>
> Really, you cannot do a "select from" one and "insert into" another?
> 
> You could probably rig it up through pipes, like a pg_dump piped to a 
> pg_restore.

True, but you can't do it entirely within postgres without writing your
own functions.  You could do some kind of replication, but then you'd
really only be accessing tables inside one database, just ones that were
replicated from another.