Re: Multidatabase query

From: Vibhor Kumar <vibhor(dot)aim(at)gmail(dot)com>
To: Mauro Bertoli <bertoli(dot)mauro(at)yahoo(dot)it>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Multidatabase query
Date: 2009-03-27 23:57:57
Message-ID: 49CD6805.9080706@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Mauro,

Not possible in PostgreSQL.

However, you can use dblink for creating query between multidatabase as
given below:

select empno from dblink('dbname=edb','SELECT empno from emp') as
emp(empno numeric)
union
select empno from dblink('dbname=enterprisedb','SELECT empno from emp')
as emp(empno numeric);

where edb and enterprisedb are database names

For More information about dblink, please follow the link given below:
http://www.postgresql.org/docs/current/static/dblink.html
http://www.enterprisedb.com/docs/en/8.3/oracompat/EnterpriseDB_OraCompat_EN_8.3-49.htm

Regards,
Vibhor Kumar
www.enterprisedb.com

Mauro Bertoli wrote:
> Hi all,
> is possible in PostgreSQL to create query between multidatabase like Sql Server 2005?
>
> An example:
> SELECT
> db1.a.id FROM db1.a
> UNION
> db2.b.id FROM db2.b
>
> Where "db1" is a database and "db2" is another database. "a" is a table in database "db1" and "b" is a table in database "db2"
>
> Best regards,
> Mauro
>
>
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dhaval Jaiswal 2009-03-28 00:37:07 Re: Determining PUBLIC's permissions
Previous Message Dhaval Jaiswal 2009-03-27 23:50:25 Re: Installation Error, Server Won't Start