Re: How to return a large String with C

From: Colin Wetherbee <cww(at)denterprises(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: How to return a large String with C
Date: 2008-02-17 14:51:27
Message-ID: 47B849EF.7020709@denterprises.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:
> Stefan Niantschur <sniantschur(at)web(dot)de> writes:
>> So far I have been successfully doing calls to SPI, select the data from the
>> table and return it. However, this works only with string not larger than
>> page size of char[8192].
>> The strings I expect are much longer and this causes the backend to crash.
>
> 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.

He also uses the variable "i" in *both* parts of his nested loop.

Stefan, you should probably pick up a C programming book before going
too much further with this.

Colin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stefan Niantschur 2008-02-17 17:13:29 Re: How to return a large String with C
Previous Message Tom Lane 2008-02-17 14:17:08 Re: How to return a large String with C