unsigned and signed chars in libpq API

Started by Dmitriy Igrishinalmost 14 years ago4 messages
#1Dmitriy Igrishin
dmitigr@gmail.com

Hey all,

Could you tell me please an objective reason why PQunescapeBytea()
returns unsigned char* rather than just char* ?
I am asking because a bit confused. How this intermixes with LO's API,
which based on signed chars (although as we all know large object -
is a just bytea splitted on chunks)?
And also PQgetvalue() returns char* rather than unsigned char*.

Thanks.

--
// Dmitriy.

#2Bruce Momjian
bruce@momjian.us
In reply to: Dmitriy Igrishin (#1)
Re: unsigned and signed chars in libpq API

On Thu, Feb 2, 2012 at 10:33:24AM +0300, Dmitriy Igrishin wrote:

Hey all,

Could you tell me please an objective reason why PQunescapeBytea()
returns unsigned char* rather than just char* ?
I am asking because a bit confused. How this intermixes with LO's API,
which based on signed chars (although as we all know large object -
is a just bytea splitted on chunks)?
And also PQgetvalue() returns char* rather than unsigned char*.

Can someone answer this? Are we consistent here?

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#2)
Re: unsigned and signed chars in libpq API

Bruce Momjian <bruce@momjian.us> writes:

On Thu, Feb 2, 2012 at 10:33:24AM +0300, Dmitriy Igrishin wrote:

Could you tell me please an objective reason why PQunescapeBytea()
returns unsigned char* rather than just char* ?
I am asking because a bit confused. How this intermixes with LO's API,
which based on signed chars (although as we all know large object -
is a just bytea splitted on chunks)?
And also PQgetvalue() returns char* rather than unsigned char*.

Can someone answer this? Are we consistent here?

We're not, particularly, but changing any of this seems likely to
create more pain than it removes.

regards, tom lane

#4Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#3)
Re: unsigned and signed chars in libpq API

On Mon, Aug 27, 2012 at 12:40:37PM -0400, Tom Lane wrote:

Bruce Momjian <bruce@momjian.us> writes:

On Thu, Feb 2, 2012 at 10:33:24AM +0300, Dmitriy Igrishin wrote:

Could you tell me please an objective reason why PQunescapeBytea()
returns unsigned char* rather than just char* ?
I am asking because a bit confused. How this intermixes with LO's API,
which based on signed chars (although as we all know large object -
is a just bytea splitted on chunks)?
And also PQgetvalue() returns char* rather than unsigned char*.

Can someone answer this? Are we consistent here?

We're not, particularly, but changing any of this seems likely to
create more pain than it removes.

OK, thanks.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +