Re: BUG #2817: Mixing spi_prepare and spi_exec_query causes postgresql to terminate itself on bad argument types
От | Tom Lane |
---|---|
Тема | Re: BUG #2817: Mixing spi_prepare and spi_exec_query causes postgresql to terminate itself on bad argument types |
Дата | |
Msg-id | 23182.1165538532@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | BUG #2817: Mixing spi_prepare and spi_exec_query causes postgresql to terminate itself on bad argument types ("Michael Andreen" <harv@ruin.nu>) |
Список | pgsql-bugs |
"Michael Andreen" <harv@ruin.nu> writes: > CREATE OR REPLACE FUNCTION crash() > RETURNS int4 AS > $BODY$$rv = spi_exec_query("SELECT 1"); > $query = spi_prepare('SELECT 1 WHERE 1 = $1','integer'); > return 1;$BODY$ > LANGUAGE 'plperl' VOLATILE; Thanks for the test case. This is not plperl's fault, it's the consequence of some anti-memory-leak code added very recently. Here's the fix if you need it right away... regards, tom lane *** src/backend/executor/spi.c.orig Tue Nov 21 17:35:29 2006 --- src/backend/executor/spi.c Thu Dec 7 19:33:33 2006 *************** *** 1543,1548 **** --- 1543,1551 ---- SPI_lastoid = my_lastoid; SPI_tuptable = my_tuptable; + /* tuptable now is caller's responsibility, not SPI's */ + _SPI_current->tuptable = NULL; + return my_res; } *************** *** 1694,1699 **** --- 1697,1705 ---- /* Put the result into place for access by caller */ SPI_processed = _SPI_current->processed; SPI_tuptable = _SPI_current->tuptable; + + /* tuptable now is caller's responsibility, not SPI's */ + _SPI_current->tuptable = NULL; /* Pop the SPI stack */ _SPI_end_call(true);
В списке pgsql-bugs по дате отправления: