Re: PL/Python - Mailing list pgsql-general

From Tom Lane
Subject Re: PL/Python
Date
Msg-id 7899.1043174930@sss.pgh.pa.us
Whole thread Raw
In response to Re: PL/Python  (Tom Jenkins <tjenkins@devis.com>)
List pgsql-general
Tom Jenkins <tjenkins@devis.com> writes:
> please pardon me if this is really obvious, but i can't seem to find a null
> flag in the structures i have in that function.  I don't get how to set the
> null flag for the datum slot.  I'm still learning how to work with the
> backend code.

It looks like whoever wrote the plpython code was still learning, too.
Parts of it handle NULLs correctly, but PLy_spi_execute_plan doesn't
seem to cope at all.  It looks like you ought to add a nulls flag array
to PLyPlanObject, fill it during PLy_spi_execute_plan, and pass it to
SPI_execp.  IIRC it's a char array, containing 'n' for a null arg and
' ' for not-null, but check SPI_execp to be sure.

Also, the code that explicitly pfree's the typfunc's results here is a
waste of space, if not actively dangerous...

            regards, tom lane

pgsql-general by date:

Previous
From: Medi Montaseri
Date:
Subject: Re: postmaster.pid
Next
From: Bruce Becker
Date:
Subject: Help