Re: [ADMIN] DB link from postgres to Oracle; how to query Dbname.tablename?

From: Chris Twombly <CTwombly(at)s2sys(dot)com>
To: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>, Bhanu Murthy <bhanu_murthy(at)yahoo(dot)com>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>, "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: [ADMIN] DB link from postgres to Oracle; how to query Dbname.tablename?
Date: 2013-10-02 17:03:24
Message-ID: 16E7B47C74F4CA47918704C70A57611B2FE979@S2EX10.hq.s2sys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-sql

Do keep in mind that querying across databases generally garners really poor performance, and can bring
your application to its knees with astonishing speed.

________________________________________
From: pgsql-admin-owner(at)postgresql(dot)org [pgsql-admin-owner(at)postgresql(dot)org] on behalf of Albe Laurenz [laurenz(dot)albe(at)wien(dot)gv(dot)at]
Sent: Wednesday, October 02, 2013 3:58 AM
To: Bhanu Murthy; pgsql-admin(at)postgresql(dot)org; pgsql-sql(at)postgresql(dot)org
Subject: Re: [ADMIN] DB link from postgres to Oracle; how to query Dbname.tablename?

Bhanu Murthy wrote:
> Using Oracle Heterogeneous Services (Oracle HS) I have configured/created a DB link from Postgres 9.3
> database into Oracle 11gR3 database (with postgres DB user credentials).
>
> SQL> create public database link pg_link connect to "postgres" identified by "blahblah" using
> 'postgresql';
> Since Postgres does not support public synonyms across databases in a cluster, how do I connect to a
> specific database and query a specific table in this Postgres cluster using the HS DB link?
>
> Let's say, if I have 2 Postgres databases named pgdb01 and pgdb02 in the Postgres cluster, using this
> DB link that I have created in Oracle, how can I query a specific table called table01 from pgdb01
> database?
>
> Even though the table user_account exists in pgdb01 database, I cannot select from it using the DB
> link.

You have to connect to a database to query its data.

Rather than defining a database link to database "postgres",
define two links, one for "pgdb01" and one for "pgdb02".

Yours,
Laurenz Albe

--
Sent via pgsql-admin mailing list (pgsql-admin(at)postgresql(dot)org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Radovan Jablonovsky 2013-10-02 20:14:50 partitioning system tables
Previous Message Kevin Grittner 2013-10-02 14:58:45 Re: Random server overload

Browse pgsql-sql by date

  From Date Subject
Next Message David Johnston 2013-10-03 01:06:08 Re: Help needed with Window function
Previous Message Sergey Klochkov 2013-10-02 14:44:51 Re: PostgreSQL 9.2 - pg_dump out of memory when backuping a database with 300000000 large objects