Re: convert function

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Jan Sunavec" <jan(dot)sunavec(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: convert function
Date: 2007-12-12 16:57:30
Message-ID: 162867790712120857u741729b9l58ab0dd36a68cf28@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12/12/2007, Jan Sunavec <jan(dot)sunavec(at)gmail(dot)com> wrote:
> Thanks a lot
>
> Lots like nice a easy solution.. I am not sure if this is fast solution..
> Many convertions you know.. :-(
> Thanks a lot anyway.
>

If you do this often, use functional index.

Pavel

> John
>
> On Wed, 12 Dec 2007 17:13:01 +0100, Pavel Stehule
> <pavel(dot)stehule(at)gmail(dot)com> wrote:
>
> > Hello
> >
> > It's look like SQL_ASCII support diacritic chars now. First you have
> > to encode from bytea to text
> >
> > postgres=# SELECT encode(convert('ján', 'UNICODE',
> > 'SQL_ASCII'),'escape');
> > encode
> > --------
> > ján
> > (1 row)
> >
> > you wont
> > postgres=# SELECT to_ascii(encode(convert_to('ján',
> > 'latin2'),'escape'),'latin2');
> > to_ascii
> > ----------
> > jan
> > (1 row)
> >
> > Regards
> > Pavel Stehule
> >
> >
> >
> > convert do conversion from text to bytea type. For diacritic
> > elimination use to_ascii function:
> >
> > postgres=# select to_ascii(convert('Příliš žlutý kůň' using
> > utf8_to_iso_8859_2),'latin2');
> > to_ascii
> > ------------------
> > Prilis zluty kun
> > (1 row)
> >
> >
> > On 12/12/2007, Jan Sunavec <jan(dot)sunavec(at)gmail(dot)com> wrote:
> >> Hi all
> >>
> >> I have problem with "convert" function. Previous behaviour was
> >> SELECT convert('ján', 'UNICODE', 'SQL_ASCII');
> >> =======================================
> >> jan
> >>
> >> In postgresql 8.3 is quite new behaviour.
> >> SELECT convert('ján', 'UNICODE', 'SQL_ASCII');
> >> ======================================
> >> "j\241n"
> >>
> >> This, drives me crazy. I mean, this is not useable for non english
> >> country. I don't need convert to \241 characters. I understand that
> >> someone need this behavour. But there should be possibility switch to
> >> "normal" behaviour.
> >>
> >> John
> >>
> >> ---------------------------(end of broadcast)---------------------------
> >> TIP 9: In versions below 8.0, the planner will ignore your desire to
> >> choose an index scan if your joining column's datatypes do not
> >> match
> >>
>
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2007-12-12 17:01:59 Re: General Q's
Previous Message David 2007-12-12 16:54:30 General Q's