Re: Do we want SYNONYMS?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael C Rosenstein <mcr(at)mdibl(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Do we want SYNONYMS?
Date: 2010-12-06 21:38:21
Message-ID: 2613.1291671501@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Michael C Rosenstein <mcr(at)mdibl(dot)org> writes:
> 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.

> 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.

[ shrug... ] Beauty is in the eye of the beholder, I guess. To me the
search_path change seems like the natural way to do that, and flipping a
mess of synonyms the hack. What happens when you miss one synonym?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andy Colson 2010-12-06 21:41:18 Re: Do we want SYNONYMS?
Previous Message Dmitriy Igrishin 2010-12-06 21:33:43 Re: Do we want SYNONYMS?