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