From: | Tino Wildenhain <tino(at)wildenhain(dot)de> |
---|---|
To: | Michael Fuhr <mike(at)fuhr(dot)org> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: process crash when a plpython function returns |
Date: | 2005-06-18 15:27:28 |
Message-ID: | 1119108448.1183.71.camel@Andrea.peacock.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-hackers |
Am Samstag, den 18.06.2005, 08:41 -0600 schrieb Michael Fuhr:
> I've moved this thread from pgsql-bugs to pgsql-hackers; here are
> the original messages:
>
> http://archives.postgresql.org/pgsql-bugs/2005-06/msg00105.php
> http://archives.postgresql.org/pgsql-bugs/2005-06/msg00107.php
>
> As I mentioned in my followup to the bug report, a simple fix would
> appear to be to check for a NULL return value from PyObject_Str()
> before calling PyString_AsString() at the following location:
>
> /* Lines 776-77 in plpython.c */
> plrv_so = PyObject_Str(plrv);
> plrv_sc = PyString_AsString(plrv_so);
>
> I was going to submit a patch, but I don't know enough about the
> Python API or how Python and PostgreSQL handle Unicode to know
> whether adding that simple check is the appropriate solution (I was
> planning to raise an error if PyObject_Str() returned NULL). Can
> anybody think of a better fix?
raise error would be a correct solution since this is what
python does in this case:
http://docs.python.org/api/exceptions.html
also in this context it would be helpful
if sys.defaultencoding would be set to
the database encoding so strings get encoded
to utf-8 when postgres works in unicode mode
rather then the default encoding of ascii.
This could avoid most of the PyObject_Str()
exeptions in the first place.
From | Date | Subject | |
---|---|---|---|
Next Message | Chii-Tung Liu | 2005-06-19 11:25:59 | BUG #1721: mutiple bytes character string comaprison error |
Previous Message | Michael Fuhr | 2005-06-18 14:41:15 | Re: process crash when a plpython function returns unicode |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-06-18 15:41:21 | Post-mortem: final 2PC patch |
Previous Message | Tino Wildenhain | 2005-06-18 15:04:18 | Re: [PATCHES] default database creation with initdb |