Re: How to return a large String with C

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stefan Niantschur <sniantschur(at)web(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to return a large String with C
Date: 2008-02-17 19:28:18
Message-ID: 27047.1203276498@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Stefan Niantschur <sniantschur(at)web(dot)de> writes:
> Am Sun, 17 Feb 2008 09:17:08 -0500
> schrieb Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>> Hardly surprising when you're printing the string into a fixed-size
>> 8K buffer. The buffer overflow is smashing the stack, in particular
>> the function's return address.

> Yes, I know, but the backend does not allow for a bigger buffer. Trying
> to use a 80K (char[81920])buffer did not work and returns:

So you've got some other bug in code you didn't show us. It's highly
unlikely that you wouldn't be able to allocate an 80K buffer. (Whether
that's big enough for your data even yet is a separate question.)

What I was wondering was why you even bothered with the char[] buffer,
when it looked like the actually useful return value was being
accumulated in an expansible StringInfo buffer.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ivan Sergio Borgonovo 2008-02-17 20:51:40 function or temporary table or what?
Previous Message Vyacheslav Kalinin 2008-02-17 17:23:40 Re: How to return a large String with C