pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeroen T. Vermeulen <jtv@xs4all.nl>
Cc: greg@turnstep.com
Cc: pgsql-interfaces@postgresql.org
Subject: Re: PQescapeString handling of \0
Date: Fri, 03 Oct 2003 12:02:03 -0400
Message-ID: <26244.1065196923@sss.pgh.pa.us> (raw)
In-Reply-To: <20031003155101.GC75826@xs4all.nl>
References: <c4029001e28eb9350effc9118d391bc9@biglumber.com>
	<19872.1065195062@sss.pgh.pa.us>
	<20031003155101.GC75826@xs4all.nl>

"Jeroen T. Vermeulen" <jtv@xs4all.nl> writes:
> On Fri, Oct 03, 2003 at 11:31:02AM -0400, Tom Lane wrote:
>> So essentially PQescapeString is going to become like strncpy --- stop
>> at either \0 or the given count.

> I've no idea whether this makes sense, but as a matter of style, shouldn't
> strings containing '\0's be escaped as binary strings anyway?  And if we're
> going to see multibyte encodings growing in popularity (lots of zeroes and
> "high" byte values), perhaps PQescapeString should even be deprecated?

I think you might be confusing PQescapeString (intended for text) with
PQescapeBytea (intended for binary data).  We do not support any text
encodings that require embedded zeroes, and are unlikely to do so
anytime soon.  (Had anyone suggested this as a design goal when we were
doing the recent FE/BE protocol redesign, perhaps the protocol wouldn't
still rely on null-terminated strings.  But no one did and it's too late
now.)

			regards, tom lane



view thread (9+ messages)  latest in thread

Message-ID: <26244.1065196923@sss.pgh.pa.us>
Permalink:  ../26244.1065196923@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/26244.1065196923@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jtv@xs4all.nl, greg@turnstep.com
  Subject: Re: PQescapeString handling of \0
  In-Reply-To: <26244.1065196923@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox