Re: Do we want SYNONYMS? - Mailing list pgsql-general

From Dmitriy Igrishin
Subject Re: Do we want SYNONYMS?
Date
Msg-id AANLkTinb-m3u7zY-WrkT1HdAsu8zaXttJjWPsaGjbpbr@mail.gmail.com
Whole thread Raw
In response to Re: Do we want SYNONYMS?  (Michael C Rosenstein <mcr@mdibl.org>)
List pgsql-general


2010/12/7 Michael C Rosenstein <mcr@mdibl.org>
On 12/6/10 4:09 PM, Tom Lane wrote:
Michael C Rosenstein<mcr@mdibl.org>  writes:
What is "schema" in this context?

Oracle "schema" == Postgres "database":  a collection of objects
(tables, functions, triggers, views, etc) owned by a user.

That seems like a pretty unlikely equivalence.  What I'm afraid
you are really saying you want is cross-database synonyms (ie links
to objects in remote databases).  Which I'm pretty sure is not what
JD is offering to implement, though I think it is possible to do
in Oracle.

Nope, not talking about remote database links, but merely links to different databases in the same process on the same host.

For example webAppUser sometimes needs to access the public1.get_customer_name() function, the public1.order table and the edit.account table. After a new data load of the public2 database, the webAppUser would need to access the public2.get_customer_name() function, the public2.order table and the edit.account table. By switching the webAppUser's 'get_customer_name()' and 'account' synonyms, this toggling between accessing public1 and public2 objects is quick, easy and seamless.  The webAppUser code need only contain:
select get_customer_name();
or
select * from order;
without needing to be conscious of whether it is selecting from public1 or public2.
There are NOTIFY/LISTEN system in PostgreSQL and you can use
appropriate function on some event (data loaded in you case), for example.

Synonyms are a great feature in Oracle. The lack of synonyms in PostgreSQL was one of our biggest hesitations in switching. As I said, however, we found a hacky workaround by toggling the webAppUser's search path.

/m


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



--
// Dmitriy.


pgsql-general by date:

Previous
From: Michael C Rosenstein
Date:
Subject: Re: Do we want SYNONYMS?
Next
From: Tom Lane
Date:
Subject: Re: Do we want SYNONYMS?