Re: Refer to another database

From: David Fetter <david(at)fetter(dot)org>
To: Andreas Kalsch <andreaskalsch(at)gmx(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Refer to another database
Date: 2009-08-04 03:07:22
Message-ID: 20090804030722.GF3399@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Aug 04, 2009 at 04:41:51AM +0200, Andreas Kalsch wrote:
> How is it possible to refer to another database, like:
>
> select * from otherDatabase.nodes;

Generally, you use schemas for this. Schemas are just namespaces
inside the one database.

> I have read something about schemas and I have simply created an own
> schema for every database with the same name, but it still does not
> work. Is there anything plain and simple?

SELECT f.one, b.two
FROM
one_schema.foo AS f
JOIN
other_schema.bar AS b
ON (f.id = b.foo_id)
WHERE...

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Kalsch 2009-08-04 03:32:25 Re: Refer to another database
Previous Message Andreas Kalsch 2009-08-04 02:41:51 Refer to another database