Re: [HACKERS] UTF8 or Unicode

From: lsunley(at)mb(dot)sympatico(dot)ca
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>, tgl(at)sss(dot)pgh(dot)pa(dot)us, dpage(at)vale-housing(dot)co(dot)uk, oliver(at)opencloud(dot)com, zakkr(at)zf(dot)jcu(dot)cz, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] UTF8 or Unicode
Date: 2005-02-26 23:08:52
Message-ID: 0ICJ006MDN936C@l-daemon
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

The routines that do the conversion could have alternate names specified
in the conversion_create.sql. There is not reason that I can see why you
cannot have two function names pointing to the same routine.

like

CREATE OR REPLACE FUNCTION ascii_to_mic (INTEGER, INTEGER, CSTRING,
CSTRING, INTEGER) RETURNS VOID AS '$libdir/ascmic', 'ascii_to_mic'
LANGUAGE 'c' STRICT;

and

CREATE OR REPLACE FUNCTION ascii_to_whatever (INTEGER, INTEGER, CSTRING,
CSTRING, INTEGER) RETURNS VOID AS '$libdir/ascmic', 'ascii_to_mic'
LANGUAGE 'c' STRICT;

I just tried with those two and it works OK

That way you do not break compatibility with existing SQL scripts and/or
programs using the existing function names.

Lorne

In <200502262050(dot)j1QKoNi10358(at)candle(dot)pha(dot)pa(dot)us>, on 02/26/05
at 03:50 PM, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> said:

>Peter Eisentraut wrote:
>> Am Freitag, 25. Februar 2005 05:51 schrieb Bruce Momjian:
>> > so I see what he is saying. We are not consistent in favoring the
>> > official names vs. the common names.
>> >
>> > I will work on a patch that people can review and test.
>>
>> I think this is what we should do:
>>
>> UNICODE => UTF8
>> ALT => WIN866
>> WIN => WIN1251
>> TCVN => WIN1258
>>
>> That should clear it up.

>OK, here is a patch that makes those changes.

>The only uncertainty I have is with the the use of the TCVN conversion
>routine names, e.g.:

> SELECT CONVERT('foo' USING tcvn_to_utf_8);

>I assume this is the same as:

> SELECT CONVERT('foo', 'WIN1258', 'UTF8');
>and
> SELECT CONVERT('foo', 'TCVN', 'UTF8'); -- alias usage

>So, why would people use the routine name? Both forms are documented.
>The first one with USING does not accept aliases, while the others do.

>I think this should be renamed to win1258_to_utf_8. However, this would
>be an incompatibility. We should mention it in the release notes.

>Other than that the other conversion files were already named fine, e.g.
>ascii_to_utf_8 (no UNICODE), however it is utf_8 and not utf8. I am
>unsure how to handle these.

--
-----------------------------------------------------------
lsunley(at)mb(dot)sympatico(dot)ca
-----------------------------------------------------------

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message lsunley 2005-02-26 23:49:36 Re: [HACKERS] UTF8 or Unicode
Previous Message Bruce Momjian 2005-02-26 20:50:23 Re: [HACKERS] UTF8 or Unicode

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2005-02-26 23:32:37 Re: dbsize patch
Previous Message Bruce Momjian 2005-02-26 20:50:23 Re: [HACKERS] UTF8 or Unicode