Re: How to return a large String with C

From: "Vyacheslav Kalinin" <vka(at)mgcp(dot)com>
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 17:23:40
Message-ID: 9b1af80e0802170923o4c3a8728p5909f63db627627c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.
> <http://archives.postgresql.org/>

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.

In response to

Browse pgsql-general by date

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