Hi,
PFA test case. It used simple select statement to retrieve data via plpython. It crashes latest pg 9.2 with the following stack trace i.e.
#0 0x000000000073021f in pfree ()
#1 0x00007fa74b632f7a in PLy_result_dealloc () from /home/masif/work/postgresql/postgresql/inst/lib/plpython2.so
#2 0x00007fa74b2c710b in iter_iternext (iterator=0x1ad7150) at Objects/iterobject.c:74
#3 0x00007fa74b2934db in PyIter_Next (iter=0x1b3c5f0) at Objects/abstract.c:3107
#4 0x00007fa74b630245 in PLy_exec_function () from /home/masif/work/postgresql/postgresql/inst/lib/plpython2.so
#5 0x00007fa74b630c57 in plpython_call_handler () from /home/masif/work/postgresql/postgresql/inst/lib/plpython2.so
#6 0x0000000000583907 in ExecMakeFunctionResult ()
#7 0x000000000057f146 in ExecProject ()
#8 0x0000000000596740 in ExecResult ()
#9 0x000000000057e708 in ExecProcNode ()
#10 0x000000000057d582 in standard_ExecutorRun ()
#11 0x000000000064f477 in PortalRunSelect ()
#12 0x0000000000650778 in PortalRun ()
#13 0x000000000064ceca in exec_simple_query ()
#14 0x000000000064ddc7 in PostgresMain ()
#15 0x000000000060bdd9 in ServerLoop ()
#16 0x000000000060e9d7 in PostmasterMain ()
#17 0x00000000005ad360 in main ()
Apparently it is being crashed because of invalid related pointer value of pfree() *header->context->methods->free_p. It is reproducible with latest version of python i.e. Python-2.7.3 and Python-3.2.3. Thanks.
Best Regards,
Muhammad Asif Naeem