Re: How to return a large String with C - Mailing list pgsql-general

From Vyacheslav Kalinin
Subject Re: How to return a large String with C
Date
Msg-id 9b1af80e0802170923o4c3a8728p5909f63db627627c@mail.gmail.com
Whole thread Raw
In response to Re: How to return a large String with C  (Stefan Niantschur <sniantschur@web.de>)
List pgsql-general


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:
INFO:  string-size : 48015
INFO:  +++++++++++++++++++++++++++
server closed the connection unexpectedly
       This probably means the server terminated abnormally
       before or while processing the request.
The connection to the server was lost. Attempting reset: Succeeded.


The surprising thing is that the data can be displayed using elog but
not returend with a string pointer.

You cannot just return pointer to stack (local for function) buffer - it gets freed on return from the function. You must explicitly palloc required memory chunk.

pgsql-general by date:

Previous
From: Stefan Niantschur
Date:
Subject: Re: How to return a large String with C
Next
From: Tom Lane
Date:
Subject: Re: How to return a large String with C