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 BD9BDD1B55A for ; Fri, 3 Oct 2003 13:38:24 +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 49091-04 for ; Fri, 3 Oct 2003 10:37:39 -0300 (ADT) Received: from biglumber.com (biglumber.com [207.228.252.42]) by svr1.postgresql.org (Postfix) with SMTP id 0E4DBD1B533 for ; Fri, 3 Oct 2003 10:37:35 -0300 (ADT) Received: (qmail 1965 invoked from network); 3 Oct 2003 13:37:34 -0000 Received: from biglumber.com (HELO localhost) (207.228.252.42) by 0 with SMTP; 3 Oct 2003 13:37:34 -0000 From: greg@turnstep.com To: pgsql-interfaces@postgresql.org Subject: Re: PQescapeString handling of \0 X-PGP-Key: 2529 DF6A B8F7 9407 E944 45B4 BC9B 9067 1496 4AC8 X-Request-PGP: http://www.biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 In-Reply-To: <200309292215.20949.igor@carcass.ath.cx> Date: Fri, 3 Oct 2003 13:37:34 -0000 X-Mailer: JoyMail 1.38 Message-ID: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/1 X-Sequence-Number: 4490 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Tom Lane wrote: > Hm. Is that really the right behavior? Given that the function is > defined to take a counted string rather than a null-terminated string, > I'd sort of expect it to turn \0 into "\000" or some such. Of course, > given that this could overflow the specified size of the return buffer, > one might simply conclude that the defined API is broken ... Igor Shevchenko replied: > If the purpose of PQescapeString is to make a safe variant of a given string > (NULL-terminated or counted), where safity means ability to simply add it to > the query (which is char* and is passed directly to PQexec), then either > length should return what strlen would return for the given string or \0 > should be escaped somehow. Has we reached a consensus on this? I'd like to have DBD::Pg and PQescapeString consistent. Right now, we (DBD::Pg) are leaning toward the "bail if we hit \0" theory, but it would be nice to have something definitive in the API. - -- Greg Sabino Mullane greg@turnstep.com PGP Key: 0x14964AC8 200310030936 -----BEGIN PGP SIGNATURE----- Comment: http://www.turnstep.com/pgp.html iD8DBQE/fXvlvJuQZxSWSsgRAsc9AKDbn7QdDCk0lGDVP17249I0VbN9ygCg+BH4 UJxIs5PakXA0Mkth0td0jHw= =KMEd -----END PGP SIGNATURE-----