Thread: SQL99 CONVERT() function

SQL99 CONVERT() function

From
Tatsuo Ishii
Date:
I have added SQL99's CONVERT() function. docs and regression tests
also updated. Our own convert() functions can also be used. Example
usage of CONVERT():

convert('PostgreSQL' using iso8859_1_to_utf8)

will return 'PostgreSQL' in UTF-8 encoding. See "String Functions and
Operators" section of Users's guide for more details and currently
available (predefined) conversions.

I believe remaining work for CONVERSION stuffs is some conversions for
cyrillic and win874/1250/1251/1256 encodings.
--
Tatsuo Ishii


Re: SQL99 CONVERT() function

From
Tatsuo Ishii
Date:
> I believe remaining work for CONVERSION stuffs is some conversions for
> cyrillic and win874/1250/1251/1256 encodings.

Oops. I forgot the cygwin (and AIX) issue. Need to address it before
beta freeze...
--
Tatsuo Ishii


Re: SQL99 CONVERT() function

From
"Dave Page"
Date:

> -----Original Message-----
> From: Tatsuo Ishii [mailto:t-ishii@sra.co.jp]
> Sent: 06 August 2002 07:58
> To: pgsql-hackers@postgresql.org
> Subject: Re: [HACKERS] SQL99 CONVERT() function
>
>
> > I believe remaining work for CONVERSION stuffs is some
> conversions for
> > cyrillic and win874/1250/1251/1256 encodings.
>
> Oops. I forgot the cygwin (and AIX) issue. Need to address it
> before beta freeze...

Yes please, it's halted pgAdmin development right now :-(

Regards, Dave.


Re: SQL99 CONVERT() function

From
Tatsuo Ishii
Date:
> > Oops. I forgot the cygwin (and AIX) issue. Need to address it 
> > before beta freeze...
> 
> Yes please, it's halted pgAdmin development right now :-(

I need to create the cygwin environment first. Sorry for the
inconvenience.
--
Tatsuo Ishii


Re: SQL99 CONVERT() function

From
"Dave Page"
Date:

> -----Original Message-----
> From: Tatsuo Ishii [mailto:t-ishii@sra.co.jp]
> Sent: 06 August 2002 08:25
> To: Dave Page
> Cc: pgsql-hackers@postgresql.org
> Subject: Re: [HACKERS] SQL99 CONVERT() function
>
>
> > > Oops. I forgot the cygwin (and AIX) issue. Need to address it
> > > before beta freeze...
> >
> > Yes please, it's halted pgAdmin development right now :-(
>
> I need to create the cygwin environment first. Sorry for the
> inconvenience.

If there's anything I can do to help just let me know. Unfortunately I'm
not particuarly wise in the ways of gmake...

Regards, Dave.


Re: SQL99 CONVERT() function

From
Karel Zak
Date:
On Tue, Aug 06, 2002 at 02:55:04PM +0900, Tatsuo Ishii wrote:
> I have added SQL99's CONVERT() function. docs and regression tests
> also updated. Our own convert() functions can also be used. Example
> usage of CONVERT():
> 
> convert('PostgreSQL' using iso8859_1_to_utf8)                                     ^^^^^What is it? Is it really in
standard?Sorry, but it seemsstrange. What 'ISO8859-1' as name?
 
CAST( int_as_char ) ? :-)
.... CONVERT('PostgreSQL' USING 'ISO8859-1' TO 'UTF8')
      Karel

-- Karel Zak  <zakkr@zf.jcu.cz>http://home.zf.jcu.cz/~zakkr/C, PostgreSQL, PHP, WWW, http://docs.linux.cz,
http://mape.jcu.cz


Re: SQL99 CONVERT() function

From
Tatsuo Ishii
Date:
> On Tue, Aug 06, 2002 at 02:55:04PM +0900, Tatsuo Ishii wrote:
> > I have added SQL99's CONVERT() function. docs and regression tests
> > also updated. Our own convert() functions can also be used. Example
> > usage of CONVERT():
> > 
> > convert('PostgreSQL' using iso8859_1_to_utf8)
>                                       ^^^^^
>  What is it? Is it really in standard?

It's a "conversion name".

From SQL99:             CONVERT <left paren> <character value expression>                 USING <form-of-use conversion
name><right paren>
 

> Sorry, but it seems
>  strange. What 'ISO8859-1' as name?

Sure, you can use '-' instead of '_' if you don't mind quoting it
with "(i.e. delimited identifier).

convert('PostgreSQL' using "iso8859-1-to-utf8")

I'm sure people don't like that way...
--
Tatsuo Ishii


Re: SQL99 CONVERT() function

From
Karel Zak
Date:
On Tue, Aug 06, 2002 at 05:19:50PM +0900, Tatsuo Ishii wrote:
> > On Tue, Aug 06, 2002 at 02:55:04PM +0900, Tatsuo Ishii wrote:
> > > I have added SQL99's CONVERT() function. docs and regression tests
> > > also updated. Our own convert() functions can also be used. Example
> > > usage of CONVERT():
> > > 
> > > convert('PostgreSQL' using iso8859_1_to_utf8)
> >                                       ^^^^^
> >  What is it? Is it really in standard?
> 
> It's a "conversion name".
> 
> >From SQL99:
>               CONVERT <left paren> <character value expression>
>                   USING <form-of-use conversion name> <right paren>
Ah.. conversion name. I was thinking it are names of encodings. It's right.   Karel   
-- Karel Zak  <zakkr@zf.jcu.cz>http://home.zf.jcu.cz/~zakkr/C, PostgreSQL, PHP, WWW, http://docs.linux.cz,
http://mape.jcu.cz


Re: SQL99 CONVERT() function

From
Peter Eisentraut
Date:
Tatsuo Ishii writes:

> > Sorry, but it seems
> >  strange. What 'ISO8859-1' as name?
>
> Sure, you can use '-' instead of '_' if you don't mind quoting it
> with "(i.e. delimited identifier).
>
> convert('PostgreSQL' using "iso8859-1-to-utf8")
>
> I'm sure people don't like that way...

I suggest using the official IANA names and replace all the non-identifier
characters by underscores and all upper-case letters with lower-case.
So it would be iso_8859_1_to_utf_8.  That way it's almost as pretty but a
lot more predictable.

-- 
Peter Eisentraut   peter_e@gmx.net



Re: SQL99 CONVERT() function

From
Tatsuo Ishii
Date:
> I suggest using the official IANA names and replace all the non-identifier
> characters by underscores and all upper-case letters with lower-case.
> So it would be iso_8859_1_to_utf_8.  That way it's almost as pretty but a
> lot more predictable.

Sounds reasonable. I'll look into this. However I have to examin each
encodings carefully. Because:

(1) some encodings are not listed IANA (e.g. TCVN, WIN874...)

(2) some offcial IANA names seem not appropriate   (e.g. Extended_UNIX_Code_Packed_Format_for_Japanese)
:
:
--
Tatsuo Ishii


Re: SQL99 CONVERT() function

From
Kaori Inaba
Date:
Hello,

The attached patch adds CONVERSION stuff for cyrillic and
win874/1250/1251/1256 encodings.

Thank you.

From: Tatsuo Ishii <t-ishii@sra.co.jp>
Subject: [HACKERS] SQL99 CONVERT() function
Date: Tue, 06 Aug 2002 14:55:04 +0900 (JST)
Message-ID: <20020806.145504.35027319.t-ishii@sra.co.jp>

> I have added SQL99's CONVERT() function. docs and regression tests
> also updated. Our own convert() functions can also be used. Example
> usage of CONVERT():
>
> convert('PostgreSQL' using iso8859_1_to_utf8)
>
> will return 'PostgreSQL' in UTF-8 encoding. See "String Functions and
> Operators" section of Users's guide for more details and currently
> available (predefined) conversions.
>
> I believe remaining work for CONVERSION stuffs is some conversions for
> cyrillic and win874/1250/1251/1256 encodings.
> --
> Tatsuo Ishii

-------------------
   Kaori Inaba
 i-kaori@sra.co.jp


Re: [PATCHES] SQL99 CONVERT() function

From
Tatsuo Ishii
Date:
> The attached patch adds CONVERSION stuff for cyrillic and
> win874/1250/1251/1256 encodings.

Thanks. I'll take care of this.
--
Tatsuo Ishii

Re: [PATCHES] SQL99 CONVERT() function

From
Tatsuo Ishii
Date:
> > The attached patch adds CONVERSION stuff for cyrillic and
> > win874/1250/1251/1256 encodings.
>
> Thanks. I'll take care of this.

Done. Documents and regression tests have been updated also. I think
now we have implemented all encoding conversions for 7.3 release.
--
Tatsuo Ishii

Re: SQL99 CONVERT() function

From
Tatsuo Ishii
Date:
> > I suggest using the official IANA names and replace all the non-identifier
> > characters by underscores and all upper-case letters with lower-case.
> > So it would be iso_8859_1_to_utf_8.  That way it's almost as pretty but a
> > lot more predictable.
> 
> Sounds reasonable. I'll look into this. However I have to examin each
> encodings carefully. Because:
> 
> (1) some encodings are not listed IANA (e.g. TCVN, WIN874...)
> 
> (2) some offcial IANA names seem not appropriate
>     (e.g. Extended_UNIX_Code_Packed_Format_for_Japanese)
> :
> :

Done. See current doc (user's guide "6.4. String Functions and
Operators" Table 6-7 "Available conversion names") how I changed the
conversion names.
--
Tatsuo Ishii


Re: SQL99 CONVERT() function

From
Peter Eisentraut
Date:
Tatsuo Ishii writes:

> Done. See current doc (user's guide "6.4. String Functions and
> Operators" Table 6-7 "Available conversion names") how I changed the
> conversion names.

What guideline did you follow?  For example, should koi8r be koi8_r?  Or
should winXXX be win_XXX?

-- 
Peter Eisentraut   peter_e@gmx.net