Re: Selecting data from bytea field in 8.3

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Tomasz Rejman *EXTERN*" <tr(at)ideo(dot)pl>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Selecting data from bytea field in 8.3
Date: 2009-05-12 11:38:22
Message-ID: D960CB61B694CF459DCFB4B0128514C202FF65BC@exadv11.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tomasz Rejman wrote:
> Few days ago I have changed my postgreSQL to 8.3 version and I have problem
> with bytea fields. Let me show you an example:
>
> CREATE TABLE testtable
> (
> test bytea
> );
> insert into testTable (test) VALUES
> (E'\304\205\304\207\305\274\303\263\305\202wjfdsafdsa');
> select encode(test, 'escape') from testTable;
>
> In the previous version last Select will display exact characters in UTF8
> encoding (some polish letters with dot-s and comma-s on them), but in 8.3
> i'm getting an escaped string with byte codes (like this one in Insert
> querry)
>
> (correct data should be like that:
> select E'\304\205\304\207\305\274\303\263\305\202wjfdsafdsa';
> )
>
> What should I do to tell the postgreSQL to unescape that data?

select convert_from(test, 'UTF8') from testTable;

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message WP Perquin 2009-05-12 11:43:53 regexp_matches problem
Previous Message Glyn Astill 2009-05-12 11:04:32 Re: Could not open file "pg_clog/...."