aaff0a559f
The original coding leaked memory (at least 8K per crosstab_hash call) because it allowed the hash table to be allocated as a child of TopMemoryContext and then never freed it. Fix that by putting the hash table under per_query_ctx, instead. Also get rid of use of a static variable to point to the hash table. Aside from being ugly, that would actively do the wrong thing in the case of re-entrant calls to crosstab_hash, which are at least theoretically possible since it was expecting the static variable to stay valid across a SPI_execute call. |
||
---|---|---|
.. | ||
data | ||
expected | ||
sql | ||
Makefile | ||
tablefunc.c | ||
tablefunc.h | ||
tablefunc.sql.in | ||
uninstall_tablefunc.sql |