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-09-04 11:29:02
Message-ID: 4AA0F9FE.1030902@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greg Stark wrote:
> On Mon, Aug 31, 2009 at 12:01 PM, Heikki
> Linnakangas<heikki(dot)linnakangas(at)enterprisedb(dot)com> wrote:
>> 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.
>
> I don't think we even have to worry about the database's encoding.
> Just make the textual representation of "char" be \xxx (or perhaps we
> could switch to \xHH now) if the value isn't a printable ascii
> character. As long as "char" reads that in properly it doesn't matter
> if it's not a reasonable multibyte character.
>
> That allows people to treat it as a 1-byte integer type which happens
> to allow input or output as a single ascii character which is
> convenient sometimes.

Hmm, seems reasonable. However, it would mean that "\123" would be
interpreted differently in the new version than the old. In previous
versions the extra characters are truncated and the value becomes '\',
whereas the new interpretation would be 'S'.

(I committed the rest of the patch, without the "char" changes)

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Oleg Bartunov 2009-09-04 12:55:35 PgCon 2009 Developer Meeting pictures
Previous Message Simon Riggs 2009-09-04 06:29:52 Re: Hot Standby, max_connections and max_prepared_transactions