Re: [PATCH] plpythonu datatype conversion improvements

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Caleb Welton <cwelton(at)greenplum(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] plpythonu datatype conversion improvements
Date: 2009-08-15 23:44:20
Message-ID: 1250379860.18992.13.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
plpython-datatypes.patch text/x-patch 31.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2009-08-15 23:44:21 Re: [COMMITTERS] pgsql: Remove tabs from SGML.
Previous Message Bruce Momjian 2009-08-15 23:42:50 Re: [COMMITTERS] pgsql: Remove tabs from SGML.