Re: text and bytea

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: hernan gonzalez <hgonzalez(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: text and bytea
Date: 2008-02-25 07:39:02
Message-ID: 20080225073902.GB31692@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Feb 22, 2008 at 01:54:46PM -0200, hernan gonzalez wrote:
> > It seems to me that postgres is trying to do as you suggest: text is
> > characters and bytea is bytes, like in Java.
>
> But the big difference is that, for text type, postgresql knows "this
> is a text" but doesnt know the encoding, as my example showed. This
> goes against the concept of "text vs bytes" distintion, which per se
> is very useful and powerful (specially in this Unicode world) and
> leads to a dubious/clumsy string api (IMHO, as always).

Umm, I think all you showed was that the to_ascii() function was
broken. Postgres knows exactly what encoding the string is in, the
backend encoding: in your case UTF-8.

Now, it would be nice if postgres could handle other encodings in the
backend, but there's no agreement on how to implement that feature so
it isn't implemented.

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Those who make peaceful revolution impossible will make violent revolution inevitable.
> -- John F Kennedy

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message danmcb 2008-02-25 08:01:47 Re: request help forming query
Previous Message Stuart Brooks 2008-02-25 06:57:29 autovacuum not freeing up unused space on 8.3.0