Re: [PATCHES] plpython crash on exception

2007-11-23 Thread Marko Kreen
On 11/23/07, Tom Lane [EMAIL PROTECTED] wrote: Marko Kreen [EMAIL PROTECTED] writes: On 11/23/07, Tom Lane [EMAIL PROTECTED] wrote: Why? I can't imagine any real use for it. If you're thinking that it could provide a guide as to what to resize the buffer to, think again. If the

Re: [PATCHES] plpython crash on exception

2007-11-23 Thread Tom Lane
Marko Kreen [EMAIL PROTECTED] writes: Actually, the meaning could be changed to *needmore and compensated inside function: How's that different from the existing function result? regards, tom lane ---(end of broadcast)---

Re: [PATCHES] plpython crash on exception

2007-11-23 Thread Alvaro Herrera
Marko Kreen escribió: On 11/23/07, Alvaro Herrera [EMAIL PROTECTED] wrote: (If you are really interested in a fix for 7.3, let me know too ... I couldn't even get plpython to run a trivial function due to RExec issues. I didn't try 7.2). RExec seems to hint that 7.3 can work only with

Re: [PATCHES] plpython crash on exception

2007-11-22 Thread Tom Lane
Marko Kreen [EMAIL PROTECTED] writes: Following function crashes plpython on x86-64 / gcc 4.1.2 / debian 4.0: CREATE FUNCTION crashme(str_len integer) RETURNS text AS $$ raise Exception(X * str_len) $$ LANGUAGE plpythonu; SELECT crashme(1000); Problem turns out to be va_list

Re: [PATCHES] plpython crash on exception

2007-11-22 Thread Alvaro Herrera
Tom Lane escribió: Marko Kreen [EMAIL PROTECTED] writes: Following function crashes plpython on x86-64 / gcc 4.1.2 / debian 4.0: CREATE FUNCTION crashme(str_len integer) RETURNS text AS $$ raise Exception(X * str_len) $$ LANGUAGE plpythonu; SELECT crashme(1000);

Re: [PATCHES] plpython crash on exception

2007-11-22 Thread Tom Lane
Alvaro Herrera [EMAIL PROTECTED] writes: Tom Lane escribió: This patch isn't acceptable because va_copy() isn't portable. I'm kinda wondering why PLy_printf and the functions after it even exist. They look like rather poorly done reimplementations of functionality that exists elsewhere in

Re: [PATCHES] plpython crash on exception

2007-11-22 Thread Alvaro Herrera
Tom Lane escribió: Alvaro Herrera [EMAIL PROTECTED] writes: Tom Lane escribi�: This patch isn't acceptable because va_copy() isn't portable. I'm kinda wondering why PLy_printf and the functions after it even exist. They look like rather poorly done reimplementations of functionality

Re: [PATCHES] plpython crash on exception

2007-11-22 Thread Alvaro Herrera
Alvaro Herrera escribió: One problem here is that 7.3 does not have appendStringInfoVA. From 7.4 onwards there is no problem. Should I backport the code from 7.4? (On a first try to do it I introduced a nasty bug, so it's not as easy as a cut'n paste). No nasty bug anywhere -- just that I

Re: [PATCHES] plpython crash on exception

2007-11-22 Thread Tom Lane
Alvaro Herrera [EMAIL PROTECTED] writes: What I'm going to do is commit the fix to just 7.4 onwards. Fair enough. 7.3 is on life support anyway --- I'm not in favor of heroic efforts to port patches that far back. regards, tom lane ---(end of

Re: [PATCHES] plpython crash on exception

2007-11-22 Thread Alvaro Herrera
Marko Kreen escribió: Problem turns out to be va_list handling in PLy_vprintf() which uses same va_list repeatedly. Fix is to va_copy to temp variable. Marko, I just applied what I posted earlier today from 7.4 to 8.2 and HEAD. I assume you had a more complex test case; please have a try

Re: [PATCHES] plpython crash on exception

2007-11-22 Thread Tom Lane
Marko Kreen [EMAIL PROTECTED] writes: On 11/23/07, Tom Lane [EMAIL PROTECTED] wrote: Why? I can't imagine any real use for it. If you're thinking that it could provide a guide as to what to resize the buffer to, think again. If the output was truncated due to this limit then the return

Re: [PATCHES] plpython crash on exception

2007-11-22 Thread Marko Kreen
On 11/23/07, Tom Lane [EMAIL PROTECTED] wrote: Marko Kreen [EMAIL PROTECTED] writes: Just a note - appendStringInfoVA should take *nprinted argument. Why? I can't imagine any real use for it. If you're thinking that it could provide a guide as to what to resize the buffer to, think again.

Re: [PATCHES] plpython crash on exception

2007-11-22 Thread Tom Lane
Marko Kreen [EMAIL PROTECTED] writes: Just a note - appendStringInfoVA should take *nprinted argument. Why? I can't imagine any real use for it. If you're thinking that it could provide a guide as to what to resize the buffer to, think again. regards, tom lane

Re: [PATCHES] plpython crash on exception

2007-11-22 Thread Marko Kreen
On 11/22/07, Alvaro Herrera [EMAIL PROTECTED] wrote: One problem here is that 7.3 does not have appendStringInfoVA. From 7.4 onwards there is no problem. Should I backport the code from 7.4? (On a first try to do it I introduced a nasty bug, so it's not as easy as a cut'n paste). Just a

Re: [PATCHES] plpython crash on exception

2007-11-22 Thread Marko Kreen
On 11/23/07, Alvaro Herrera [EMAIL PROTECTED] wrote: Marko Kreen escribió: Problem turns out to be va_list handling in PLy_vprintf() which uses same va_list repeatedly. Fix is to va_copy to temp variable. Marko, I just applied what I posted earlier today from 7.4 to 8.2 and HEAD. I