X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 09234D1B50F for ; Fri, 3 Oct 2003 16:02:51 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 82531-01 for ; Fri, 3 Oct 2003 13:02:04 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id D7D9CD1B558 for ; Fri, 3 Oct 2003 13:02:03 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h93G23hn026245; Fri, 3 Oct 2003 12:02:03 -0400 (EDT) To: "Jeroen T. Vermeulen" Cc: greg@turnstep.com, pgsql-interfaces@postgresql.org Subject: Re: PQescapeString handling of \0 In-reply-to: <20031003155101.GC75826@xs4all.nl> References: <19872.1065195062@sss.pgh.pa.us> <20031003155101.GC75826@xs4all.nl> Comments: In-reply-to "Jeroen T. Vermeulen" message dated "Fri, 03 Oct 2003 17:51:02 +0200" Date: Fri, 03 Oct 2003 12:02:03 -0400 Message-ID: <26244.1065196923@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/4 X-Sequence-Number: 4493 "Jeroen T. Vermeulen" 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