Re: Array access to type "name" - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Array access to type "name"
Date
Msg-id 22716.1051419961@sss.pgh.pa.us
Whole thread Raw
In response to Array access to type "name"  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Array access to type "name"  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> The type "name" can be subscripted like an array to access the individual
> "char" elements.  But since a character stored in a "name" value isn't
> necessarily one byte, this is incorrect.  Does anything rely on this
> facility, or would it be better to remove it for type "name"?

The fact that it isn't very useful for multibyte character sets doesn't
seem to me to be reason to remove it for everyone ...

> Here's an example that produces a failure:
> $ export PGCLIENTENCODING=latin1
> $ createdb -E UNICODE test
> $ psql test
> => create table �land (a int);
> => create table �berschall (b int);
> => select relname[0] from pg_class;
> ERROR:  Could not convert UTF-8 to ISO8859-1

I'm not having any luck duplicating that here, but in any case what the
above suggests to me is lack of robustness in the output conversion
chain for type "char".  Or do you want to legislate that byte values
corresponding to the first bytes of multibyte character sequences are
illegal values for type "char"?  I'd have a problem with that ...
        regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: STABLE functions
Next
From: Tom Lane
Date:
Subject: Re: current breakage with PGCLIENTENCODING