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

From Dmitriy Igrishin
Subject Re: Do we want SYNONYMS?
Date
Msg-id AANLkTi=HHhrDVmr-Y7wuQ4EKQ9LrrZ5=H-x3-hS+Yh=k@mail.gmail.com
Whole thread Raw
In response to Re: Do we want SYNONYMS?  (Andy Colson <andy@squeakycode.net>)
List pgsql-general


2010/12/7 Andy Colson <andy@squeakycode.net>
On 12/7/2010 8:12 AM, Daniel Verite wrote:
       Vick Khera wrote:

On Mon, Dec 6, 2010 at 2:31 PM, Joshua D. Drake<jd@commandprompt.com>
wrote:
Command Prompt is currently considering writing a patch to provide
synonyms to PostgreSQL. Is this something the community is interested
in? Do we have use cases for it? MSSQL, DB2 and Oracle support them.


I must be missing something, but really, what's the point of synonyms?
 What's the real-world use case for them?

It's about decoupling the name from the actual object, much like what soft
links are for file systems.
It's convenient when you need to change the underlying object without
touching the application code.

Best regards,

So, you could rename a table without having to change the code?  But you cant rename a column, or drop one, and thats a much more common thing I'd bet.  And eventually you would change the code, right?  Isn't it much better to keep everyone on the same page?  If you have 10 program using 10 different names for the same table... how can that possibly be useful?  Just sounds confusing and troublesome.

I can see a situation for live/hot upgrades.  Having old code and new code run at the same time.  But eventually the old code would go away, and I think the same thing could be handled with views.  (perhaps updateable view's would be required... but still)

I dont see a situation where an alias gives me something updateable views dont.  I'd vote we spend time on updateable views instead.

And the types:

table: maybe useful for live upgrade, but views, transactons and stored procs do the same thing.

views: just create the new view.  Have both.  when the old code goes away, drop the old view.  No need for an alias.

sequence:  why bother?  Other than renaming during live upgrade, why would you need an alias?

index:  again, why bother... code really should not ever be dependent on an indexes name, correct?  And transactions take care of live updates.

So for the two use cases I've seen (live update, directing data flow (which is kinda like a live update)) we already have tools that do it: transactional ddl, views, schemas, stored procs, etc.  Updateable views might be the only thing missing.

Also:  I wonder if it might be a bad idea.  The people coming from oracle will see that PG supports synonyms, and they'll be all happy, but when they get into the guts of their translate they find PG's synonyms are different (and not compatible), and they have to throw it out and use schemas instead.

On the other hand, now that I think about it, if its really easy, it might help a few people out, then why not.  On the other other hand, if its not so easy, I think the time would be better spent on updatable views.

So here is my new vote:
IF its easy and wont slow anything down: +1
IF its hard: -1 (and spend the time on more important things)
Totally agreed.

-Andy


--
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: "Gauthier, Dave"
Date:
Subject: regexp err msg question
Next
From: Adrian Klaver
Date:
Subject: Re: if-clause to an exiting statement