Re: Problems with pgcrypto and special characters

From: "Markus Wollny" <Markus(dot)Wollny(at)computec(dot)de>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Problems with pgcrypto and special characters
Date: 2005-02-28 21:00:32
Message-ID: 2266D0630E43BB4290742247C891057502B9D6E3@dozer.computec.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!

-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
> Possibly a binary cast (WITHOUT FUNCTION) would solve your problem,
> though I doubt it will work well on bytea values containing \0.

Thanks, I've been a bit thick here, but I just found the solution to my problem - and that doesn't need this awkward function nor any type of extra WITHOUT FUNCTION casts - just decode and encode, alas in exactly the opposite order than I originally expected.

mypgdb=# select decode('Tübingen'::text,'escape');
decode
-----------------
T\303\274bingen
(1 row)

mypgdbe=# select encode('T\303\274bingen','escape');
encode
----------
Tübingen
(1 row)

I think this should be safe for any kind of bytea value.

Kind regards

Markus

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-02-28 21:05:11 Re: indexing date_part
Previous Message Markus Wollny 2005-02-28 20:54:42 Re: Problems with pgcrypto and special characters