Re: Tightening binary receive functions

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Tightening binary receive functions
Date: 2009-08-31 11:01:54
Message-ID: 4A9BADA2.4080905@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greg Stark wrote:
> On Mon, Aug 31, 2009 at 9:12 AM, Heikki
> Linnakangas<heikki(dot)linnakangas(at)enterprisedb(dot)com> wrote:
>> The most notable of these is the change to "char" datatype. The patch
>> tightens it so that it no longer accepts values >127 with a multi-byte
>> database encoding.
>
> That doesn't sound right to me. We accept casts from integer to "char"
> for all values in range (-128..127).

The patch limits that range to 0..127, with multibyte encodings.

> The question should be what the
> text representation should be since the raw bytes aren't valid mb
> encodings.

Hmm, perhaps we should follow what we did to chr() and ascii(): map the
integer to unicode code points if the database encoding is UTF-8, and
restrict the range to 0..127 for other multi-byte encodings.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2009-08-31 11:27:46 Re: Tightening binary receive functions
Previous Message Greg Stark 2009-08-31 10:41:24 Re: Tightening binary receive functions