Re: PQgetlength vs. octet_length() - Mailing list pgsql-hackers

From Greg Stark
Subject Re: PQgetlength vs. octet_length()
Date
Msg-id 407d949e0908180915t1ccabad1r69fbd814373628f9@mail.gmail.com
Whole thread Raw
In response to Re: PQgetlength vs. octet_length()  (Michael Clark <codingninja@gmail.com>)
Responses Re: PQgetlength vs. octet_length()
List pgsql-hackers
On Tue, Aug 18, 2009 at 4:04 PM, Michael Clark<codingninja@gmail.com> wrote:
> Hello - am I in the wrong mailing list for this sort of problem? :-

Probably but it's also a pretty technical point and you're programming
in C so it's kind of borderline.

If you're using text-mode then your datum that you're getting from
libpq is a text representation of the datum. For bytea in released
versions that means anything which isn't a printable ascii character
will be octal encoded like \123. You can use PQunescapeBytea to
unescape it.

If you use binary encoding then you don't have to deal with that.
Though I seem to recall there is still a gotcha you have to worry
about if there are nul bytes in your datum. I don't recall exactly
what that meant you had to do though.

-- 
greg
http://mit.edu/~gsstark/resume.pdf


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: "make install" now tries to build the documentation
Next
From: Tom Lane
Date:
Subject: Re: "make install" now tries to build the documentation