Re: Bug #728: Interactions between bytea and character encoding - Mailing list pgsql-bugs

From Joe Conway
Subject Re: Bug #728: Interactions between bytea and character encoding
Date
Msg-id 3D4CBB04.4090906@joeconway.com
Whole thread Raw
In response to Bug #728: Interactions between bytea and character encoding when doing analyze  (pgsql-bugs@postgresql.org)
Responses Re: Bug #728: Interactions between bytea and character encoding  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-bugs
Tom Lane wrote:
> Ah.  So the issue is that ANALYZE tries to do textin(byteaout(...))
> in order to produce a textual representation of the most common value
> in the BYTEA column, and apparently textin feels that the string
> generated by byteaout is not legal text.  While Joe says that the
> problem has gone away in CVS tip, I'm not sure I believe that.

I didn't either, except I tried it and it worked ;-) But you're
undoubtedly correct that there are other cases which would break the
current code.


> A possible answer is to change the pg_statistics columns from text to
> some other less picky datatype.  (bytea maybe ;-))  Or should we
> conclude that text is broken and needs to be fixed?  Choice #3 would
> be "bytea is broken and needs to be fixed", but I don't care for that
> answer --- if bytea can produce an output string that will break
> pg_statistics, then so can some other future datatype.

BYTEA sounds like the best answer to me. TEXT is supposed to honor
character set specific peculiarities, while bytea should be able to
represent any arbitrary set of bytes.

Joe

pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: "analyze" putting wrong reltuples in pg_class
Next
From: Bruce Momjian
Date:
Subject: Re: Bug #728: Interactions between bytea and character encoding