Re: Compatibility types, type aliases, and distinct types

From: "Asko Oja" <ascoja(at)gmail(dot)com>
To: "Peter Eisentraut" <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Compatibility types, type aliases, and distinct types
Date: 2008-08-18 12:50:29
Message-ID: ecd779860808180550y7b137e9ax280c05275dc377c9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

In my experience synonyms as well as rules are hacks and should be avoided
althou there are cases where they can save some work for dba's during
transitions from one situation to better one.

> There is also another possible way one might want to create a
compatibility
> type. Instead of creating a new type, create an alias for an existing
type,
> much like we currently have built-in mappings for int -> int4, bigint ->
> int8, etc. The difference here is that the type you put in is not the
same
> as the one you get dumped out. So depending on taste and requirements, a
> user might want to choose the distinct type or the alias route.

Example or two would be helpful here where you expect this kind of
functionality be useful. Could you use it for defining Oracle compatibel
varchar2 and how would it work then?

On Mon, Aug 18, 2008 at 3:33 PM, Stephen Frost <sfrost(at)snowman(dot)net> wrote:

> * Peter Eisentraut (peter_e(at)gmx(dot)net) wrote:
> > There is also another possible way one might want to create a
> compatibility
> > type. Instead of creating a new type, create an alias for an existing
> type,
> > much like we currently have built-in mappings for int -> int4, bigint ->
> > int8, etc. The difference here is that the type you put in is not the
> same
> > as the one you get dumped out. So depending on taste and requirements, a
> > user might want to choose the distinct type or the alias route.
>
> The alias route gets me thinking about Oracle synonyms.. That'd be nice
> to have in PG for a number of object types. Most recently I was wishing
> I could create a schema synonym, though being able to do tables/views
> would have worked as well in that case, just a bit more work.
>
> > What do you think about adding this kind of support to PostgreSQL?
> Obviously,
> > some details need to be worked out, but most of this is actually
> > straightforward catalog manipulation.
>
> I like the concept. Not sure how much I'd end up using it, personally.
>
> Thanks,
>
> Stephen
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAkipbCgACgkQrzgMPqB3kiinmwCfROrhdu8YDpzsJvOtvpSW147O
> SOQAn3y/4MGadFz9VqDsmcm8fiKuxsn5
> =gdfU
> -----END PGP SIGNATURE-----
>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2008-08-18 13:07:18 Re: any psql static binary for iphone ?
Previous Message Stephen Frost 2008-08-18 12:33:44 Re: Compatibility types, type aliases, and distinct types