• Peter Eisentraut's avatar
    PL/Python: Fix crash in functions returning SETOF and using SPI · 52aa334f
    Peter Eisentraut authored
    Allocate PLyResultObject.tupdesc in TopMemoryContext, because its
    lifetime is the lifetime of the Python object and it shouldn't be
    freed by some other memory context, such as one controlled by SPI.  We
    trust that the Python object will clean up its own memory.
    
    Before, this would crash the included regression test case by trying
    to use memory that was already freed.
    
    reported by Asif Naeem, analysis by Tom Lane
    52aa334f
plpython_setof.sql 1.9 KB