Re: [GENERAL] How to return a large String with C

2008-02-18 Thread Stefan Niantschur
Am Mon, 18 Feb 2008 14:15:14 -0500 schrieb Tom Lane <[EMAIL PROTECTED]>: > Stefan Niantschur <[EMAIL PROTECTED]> writes: > > Please find below the most recent code snippet. It is mainly based > > on examples from the pg documentation: > > ---8< --- > > #define GET_TEXT(cstrp) DatumGetTextP

Re: [GENERAL] How to return a large String with C

2008-02-18 Thread Tom Lane
Stefan Niantschur <[EMAIL PROTECTED]> writes: > Please find below the most recent code snippet. It is mainly based on > examples from the pg documentation: > ---8< --- > #define GET_TEXT(cstrp) DatumGetTextP(DirectFunctionCall1(textin, > CStringGetDatum(cstrp))) > (...) > char *cres; > int

Re: [GENERAL] How to return a large String with C (solved)

2008-02-18 Thread Stefan Niantschur
Am Sun, 17 Feb 2008 14:28:18 -0500 schrieb Tom Lane <[EMAIL PROTECTED]>: > Stefan Niantschur <[EMAIL PROTECTED]> writes: > > Am Sun, 17 Feb 2008 09:17:08 -0500 > > schrieb Tom Lane <[EMAIL PROTECTED]>: > >> Hardly surprising when you're printing the string into a fixed-size > >> 8K buffer. The buf

Re: [GENERAL] How to return a large String with C

2008-02-18 Thread Stefan Niantschur
Am Sun, 17 Feb 2008 14:28:18 -0500 schrieb Tom Lane <[EMAIL PROTECTED]>: > Stefan Niantschur <[EMAIL PROTECTED]> writes: > > Am Sun, 17 Feb 2008 09:17:08 -0500 > > schrieb Tom Lane <[EMAIL PROTECTED]>: > >> Hardly surprising when you're printing the string into a fixed-size > >> 8K buffer. The buf

Re: [GENERAL] How to return a large String with C

2008-02-17 Thread Tom Lane
Stefan Niantschur <[EMAIL PROTECTED]> writes: > Am Sun, 17 Feb 2008 09:17:08 -0500 > schrieb Tom Lane <[EMAIL PROTECTED]>: >> 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.

Re: [GENERAL] How to return a large String with C

2008-02-17 Thread Vyacheslav Kalinin
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 abnor

Re: [GENERAL] How to return a large String with C

2008-02-17 Thread Stefan Niantschur
Am Sun, 17 Feb 2008 09:17:08 -0500 schrieb Tom Lane <[EMAIL PROTECTED]>: > Stefan Niantschur <[EMAIL PROTECTED]> 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 c

Re: [GENERAL] How to return a large String with C

2008-02-17 Thread Colin Wetherbee
Tom Lane wrote: Stefan Niantschur <[EMAIL PROTECTED]> 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

Re: [GENERAL] How to return a large String with C

2008-02-17 Thread Tom Lane
Stefan Niantschur <[EMAIL PROTECTED]> 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

[GENERAL] How to return a large String with C

2008-02-17 Thread Stefan Niantschur
Hi all, I want to write a function in C which retrieves a large string from a table, does some work on it and returns the result to the surrounding SELECT. (e.g. SELECT my_c_func(text);) So far I have been successfully doing calls to SPI, select the data from the table and return it. However,