Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Solution for Oracle synonyms

Status
Not open for further replies.

Johnny29

Technical User
Jan 3, 2005
1
US
I am looking for a solution to Oracle synonyms. I know it is not supported in PostgreSQL. So what kind of workarounds are there.

ex: there are 2 databases db1 and db2. db1 contains foo_seq which needs to be accessed by db2
 
you cannot access other db with straight SQL in postgresql (and as far as I know in oracle too)
in postgresql there is contrib module dblink which can help it, but not doing synonyms

if you mean schemas than it can be achieved almost the same as synonyms with Schema Search Path
 
You can use dblinks in Postgresql, they are supported in a contrib package, which is also available on windows (v 8.0 only).
Because in Oracle you are using a synonym to hide a dblink.
What follows is an example taken from the docs:

SELECT *
FROM dblink('dbname=template1', 'select proname, prosrc from pg_proc')
AS t1(proname name, prosrc text)
WHERE proname LIKE 'bytea%';

The dblink function executes a remote query (see contrib/dblink). It is declared to return record since it might be used for any kind of query. The actual column set must be specified in the calling query so that the parser knows, for example, what * should expand to.

Stick to your guns
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top