SQL99 CONVERT() function

Started by Tatsuo Ishiiover 23 years ago15 messages
#1Tatsuo Ishii
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

#2Tatsuo Ishii
t-ishii@sra.co.jp
In reply to: Tatsuo Ishii (#1)
Re: 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...
--
Tatsuo Ishii

#3Dave Page
dpage@vale-housing.co.uk
In reply to: Tatsuo Ishii (#2)
Re: SQL99 CONVERT() function

-----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.

#4Tatsuo Ishii
t-ishii@sra.co.jp
In reply to: Dave Page (#3)
Re: 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.
--
Tatsuo Ishii

#5Dave Page
dpage@vale-housing.co.uk
In reply to: Tatsuo Ishii (#4)
Re: SQL99 CONVERT() function

-----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.

#6Karel Zak
zakkr@zf.jcu.cz
In reply to: Tatsuo Ishii (#1)
Re: SQL99 CONVERT() function

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 seems
strange. 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

#7Tatsuo Ishii
t-ishii@sra.co.jp
In reply to: Karel Zak (#6)
Re: SQL99 CONVERT() function

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

#8Karel Zak
zakkr@zf.jcu.cz
In reply to: Tatsuo Ishii (#7)
Re: SQL99 CONVERT() function

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

#9Peter Eisentraut
peter_e@gmx.net
In reply to: Tatsuo Ishii (#7)
Re: SQL99 CONVERT() function

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

#10Tatsuo Ishii
t-ishii@sra.co.jp
In reply to: Peter Eisentraut (#9)
Re: SQL99 CONVERT() function

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

#11Kaori Inaba
i-kaori@sra.co.jp
In reply to: Tatsuo Ishii (#1)
1 attachment(s)
Re: [HACKERS] SQL99 CONVERT() function

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

Attachments:

pgsql.patch.gzapplication/octet-streamDownload
#12Tatsuo Ishii
t-ishii@sra.co.jp
In reply to: Kaori Inaba (#11)
Re: [HACKERS] SQL99 CONVERT() function

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

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

#13Tatsuo Ishii
t-ishii@sra.co.jp
In reply to: Tatsuo Ishii (#12)
Re: [HACKERS] SQL99 CONVERT() function

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

#14Tatsuo Ishii
t-ishii@sra.co.jp
In reply to: Tatsuo Ishii (#10)
Re: SQL99 CONVERT() function

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

#15Peter Eisentraut
peter_e@gmx.net
In reply to: Tatsuo Ishii (#14)
Re: SQL99 CONVERT() function

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