Re: Multiple database queries

From: Marc Andre Paquin <tempo(at)marquo(dot)com>
To: David Fetter <david(at)fetter(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Multiple database queries
Date: 2005-10-03 03:20:38
Message-ID: 200510022320.38247.tempo@marquo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
~~~~

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jonathan Tse 2005-10-03 03:55:16 Compiling contrib module - intarray
Previous Message Tom Lane 2005-10-03 00:31:19 Re: 8.1 'make check' fails