Re: PQgetlength vs. octet_length()

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Michael Clark" <codingninja(at)gmail(dot)com>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PQgetlength vs. octet_length()
Date: 2009-08-18 15:23:20
Message-ID: 4A8A81180200002500029C22@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Michael Clark <codingninja(at)gmail(dot)com> wrote:
> Hello - am I in the wrong mailing list for this sort of problem? :-/

Probably. If you check here:

http://www.postgresql.org/community/lists/

You'll find this description for the list:

"The PostgreSQL developers team lives here. Discussion of current
development issues, problems and bugs, and proposed new features. If
your question cannot be answered by people in the other lists, and it
is likely that only a developer will know the answer, you may re-post
your question in this list. You must try elsewhere first!"

Your question sounds appropriate for the pgsql-general list.

>> I have a value inserted into a bytea column, which is about 137megs
>> in size.
>>
>> If I use octet_length() to check the size of the column for this
>> specific row I get this:
>> TestDB=# SELECT octet_length(rawdata) FROM LargeData;
>> octet_length
>> --------------
>> 143721188
>>
>> When fetching the row through the C API, and I use PQgetlength() on
>> the column of the row in question I get:
>> (gdb) p (int)PQgetlength(result, rowIndex, i)
>> $3 = 544453159

As long as I'm replying, I'll point out that the relative sizes would
make sense if you were using an interface which got the text
representation of the bytea column, since many bytes would be
represented in octal with a backslash escape (four characters per
byte).

-Kevin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Verite 2009-08-18 15:25:25 Re: comparing NEW and OLD (any good this way?)
Previous Message Michael Clark 2009-08-18 15:04:24 Re: PQgetlength vs. octet_length()

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-08-18 15:30:11 "make install" now tries to build the documentation
Previous Message Michael Clark 2009-08-18 15:04:24 Re: PQgetlength vs. octet_length()