Re: Do we want SYNONYMS?

From: Dmitriy Igrishin <dmitigr(at)gmail(dot)com>
To: Andy Colson <andy(at)squeakycode(dot)net>
Cc: Daniel Verite <daniel(at)manitou-mail(dot)org>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Do we want SYNONYMS?
Date: 2010-12-07 15:23:16
Message-ID: AANLkTi=HHhrDVmr-Y7wuQ4EKQ9LrrZ5=H-x3-hS+Yh=k@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2010/12/7 Andy Colson <andy(at)squeakycode(dot)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(at)commandprompt(dot)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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

--
// Dmitriy.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jon Nelson 2010-12-07 15:30:07 Re: dotted quad netmask conversion
Previous Message Gauthier, Dave 2010-12-07 15:20:13 regexp err msg question