pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: greg@turnstep.com
To: pgsql-interfaces@postgresql.org
Subject: Re: PQescapeString handling of \0
Date: Fri,  3 Oct 2003 13:37:34 -0000
Message-ID: <c4029001e28eb9350effc9118d391bc9@biglumber.com> (raw)
In-Reply-To: <200309292215.20949.igor@carcass.ath.cx>


-----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-----





view thread (9+ messages)  latest in thread

Message-ID: <c4029001e28eb9350effc9118d391bc9@biglumber.com>
Permalink:  ../c4029001e28eb9350effc9118d391bc9@biglumber.com/
Also on:    postgresql.org/message-id/c4029001e28eb9350effc9118d391bc9@biglumber.com

 · 

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: greg@turnstep.com
  Subject: Re: PQescapeString handling of \0
  In-Reply-To: <c4029001e28eb9350effc9118d391bc9@biglumber.com>

* 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