Accessing different databases in a cluster

Started by Dave Blasbyover 24 years ago4 messages
#1Dave Blasby
dblasby@refractions.net

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

#2Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: Dave Blasby (#1)
Re: Accessing different databases in a cluster

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.

#3Naomi Walker
nwalker@eldocomp.com
In reply to: Stephan Szabo (#2)
Re: Accessing different databases in a cluster

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

#4Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: Naomi Walker (#3)
Re: Accessing different databases in a cluster

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.