Re: Multiple database queries - Mailing list pgsql-general

From Marc Andre Paquin
Subject Re: Multiple database queries
Date
Msg-id 200510022320.38247.tempo@marquo.com
Whole thread Raw
In response to Re: Multiple database queries  (David Fetter <david@fetter.org>)
List pgsql-general
Le 2005 10 02 14:36, David Fetter a ecrit:
> On Sat, Oct 01, 2005 at 09:37:49PM -0700, Cosmopo wrote:
> > Hello,
> >
> > I was using many years ago Sybase that was able then to query
> > several tables that could be located in more than one database... I
> > know that Postgresql did not at the time have this capability.
> >
> > Does the new version 8.0.x ofter this feature? We need to create
> > several databases based on our customer's specs... but we need our
> > own customer, permission, history, etc database. We want to be able
> > to query 2 database that would have share customer's ID and other
> > info.
>
> I don't know exactly what you mean by tables that can be located in
> more than one database, as "database" has several definitions, but
> PostgreSQL has "schemas" which are essentially namespaces inside the
> same database, and you can query across schemas without extra add-ons.

Hello, thank you...

Well, when I do a "createdb owndb1"  and "createdb customerdb2"
I want to put a table "customer" in the owndb1 with user name, account
specification that will be valuable for all our customers...

I would like to make a query like this:

select
owndb1.customer.co_name,owndb1.customer.passwd,customerdb2.event.title,...
from owndb1.customer,customerdb2.event where customerdb2.info.user_id =
owndb1.customer.user_id;

In Sybase I used to be able to query accross 2 databases since we usualy
made a database per customer but account, permissions info, etc for those
customers where in a central database.

From your response, I guess this is not possible even many years later. Some
data like cities, regions, countries can be made once and put in a "general
purpose database"... that another database (entire independant data
structure) can reuse some basic info on geographic for example... If USA is
county_id 27 in one database, why not simply put a field like country_id in
a table of another database and use this info with a simple query...

Thanks!
--
Mark
~~~~

pgsql-general by date:

Previous
From: David Fetter
Date:
Subject: Re: Multiple database queries
Next
From: Tom Lane
Date:
Subject: Re: Compiling contrib module - intarray