Re: [PATCH] plpythonu datatype conversion improvements - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [PATCH] plpythonu datatype conversion improvements
Date
Msg-id 1250379860.18992.13.camel@vanquo.pezone.net
Whole thread Raw
In response to [PATCH] plpythonu datatype conversion improvements  (Caleb Welton <cwelton@greenplum.com>)
Responses Re: [PATCH] plpythonu datatype conversion improvements  (Pierre Frédéric Caillaud<lists@peufeu.com>)
Re: [PATCH] plpythonu datatype conversion improvements  (James Pye <lists@jwp.name>)
Re: [PATCH] plpythonu datatype conversion improvements  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [PATCH] plpythonu datatype conversion improvements  (Alvaro Herrera <alvherre@commandprompt.com>)
Re: [PATCH] plpythonu datatype conversion improvements  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
On tis, 2009-05-26 at 16:07 -0700, Caleb Welton wrote:
> Patch for plpythonu
>
> Primary motivation of the attached patch is to support handling bytea
> conversion allowing for embedded nulls, which in turn allows for
> supporting the marshal module.
>
> Secondary motivation is slightly improved performance for conversion
> routines of basic datatypes that have simple mappings between
> postgres/python.
>
> Primary design is to change the conversion routines from being based
> on cstrings to datums, eg:
>     PLyBool_FromString(const char *)  =>
> PLyBool_FromBool(PLyDatumToOb, Datum);

I have reworked this patch a bit and extended the plpython test suite
around it.  Current copy attached.

The remaining problem is that the patch loses domain checking on the
return types, because some paths no longer go through the data type's
input function.  I have marked these places as FIXME, and the regression
tests also contain a failing test case for this.

What's needed here, I think, is an API that takes a datum plus type
information and checks whether the datum is valid within the domain.  I
haven't found one that is exported, but maybe someone could give a tip.

Attachment

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [COMMITTERS] pgsql: Remove tabs from SGML.
Next
From: Andrew Dunstan
Date:
Subject: Re: [COMMITTERS] pgsql: Remove tabs from SGML.