Re: BUG #5835: PL/Python crashes - Mailing list pgsql-bugs

From Julien Demoor
Subject Re: BUG #5835: PL/Python crashes
Date
Msg-id 001301cbb57c$b018ab50$104a01f0$@com
Whole thread Raw
In response to Re: BUG #5835: PL/Python crashes  (Alex Hunsaker <badalex@gmail.com>)
List pgsql-bugs
I just tried and it works. Thank you very much.

-----Message d'origine-----
De : Alex Hunsaker [mailto:badalex@gmail.com]=20
Envoy=C3=A9 : vendredi 14 janvier 2011 07:33
=C3=80 : Julien Demoor
Cc : pgsql-bugs@postgresql.org
Objet : Re: [BUGS] BUG #5835: PL/Python crashes

On Thu, Jan 13, 2011 at 06:57, Julien Demoor <jdemoor@gmail.com> wrote:
>
> The following bug has been logged online:
>
> Bug reference:      5835
> Logged by:          Julien Demoor
> Email address:      jdemoor@gmail.com
> PostgreSQL version: 9.0.2
> Operating system:   Ubuntu Linux
> Description:        PL/Python crashes
> Details:

> BEGIN;
> CREATE OR REPLACE FUNCTION test_none_3(a numeric[]) RETURNS=20
> numeric(12,4) AS $$
>    return 1;
> $$ LANGUAGE plpython2u;
> SELECT test_none_3('{NULL, NULL, NULL}'::numeric[]) FROM
> generate_series(1,244) ORDER BY generate_series DESC LIMIT 1;=20
> ROLLBACK;

It looks like we are not incrementing a reference count for NULL entries in=
 an array.  The attached fixes it for me.  I did look for other places wher=
e we might have missed this and did not find any.  ( the PyDict_SetItemStri=
ng() that use Py_None look fishy, but apparently work ).

Can you see if it fixes it for you?

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Problems with adding a is not null to a query.
Next
From: Tim Uckun
Date:
Subject: Re: Problems with adding a is not null to a query.