Re: Array access to type "name"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Array access to type "name"
Date: 2003-04-27 05:06:01
Message-ID: 22716.1051419961@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-04-27 05:13:54 Re: current breakage with PGCLIENTENCODING
Previous Message Tom Lane 2003-04-27 04:55:34 Re: STABLE functions