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 14:17:08
Message-ID: 10383.1203257828@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:
> 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.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Colin Wetherbee 2008-02-17 14:51:27 Re: How to return a large String with C
Previous Message Jorge Godoy 2008-02-17 12:47:21 Re: the feasibility of sending email from stored procedure in Postgres