Cross-database tables - Mailing list pgsql-novice

From Ron Johnson
Subject Cross-database tables
Date
Msg-id befe3ba109850821c46b1877da1ca82c.1yyiUmKVrL9Sn@rjohnson.com
Whole thread Raw
Responses Re: Cross-database tables
List pgsql-novice
Hi,

I'd love it if I could access tables from other databases.

Is there a way to do this?

Here's some sample pseudo-SQL in case I wasn't clear about that:

    select * from database1^table3, database2^table4;

Which would do something similar to:

    psql -d database1 -c 'select * from table3;'
    psql -d database2 -c 'select * from table4;'

All I see when I've read docs, or checked other sources is that databases
are separate, and can't access other info.

I suppose that answers my question -- but it just doesn't seem right.
It'd seem like there oughtta be a way, somehow, to access (at least read!)
data from multiple tables in multiple databases -- at least on the same
site.

There are only two other ways I can think of to do this...

  1)    Consolidate all tables into a single database.  I'd have a lot of
    stuff in that database then.  Uck.

  2)    Write scripts that access both databases, and essentially duplicate
    some of the database functions in the script.

So far, I do small parts of method 2, and in some cases, simply copy info
from one database to another, duplicating it.

Any other ideas are welcome.

--
RJohnson.com -+- Ron Johnson <rjohnson@rjohnson.com>
http://www2.rjohnson.com/me/1yyiUmKVrL9Sn/


pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: Join question
Next
From: "Brett W. McCoy"
Date:
Subject: Re: Cross-database tables