[作者:技术者高健@博客园 mail: ]
参考这个例子:
如果我们在 src/backend/executor/spi.c 的 SPI_finish 函数处进行调试(增加打印 SPI_finish called)可以发现,
如果不在SPI 程序中调用 SPI_finish,其实会有问题。
启动PostgreSQL:
[root@localhost ~]# su - postgres[postgres@localhost ~]$ cd /usr/local/pgsql/bin[postgres@localhost bin]$ ./postgres -D /usr/local/pgsql/dataLOG: database system was shut down at 2012-10-29 09:27:55 CSTLOG: autovacuum launcher startedLOG: database system is ready to accept connections
调用 execq函数:
postgres=# create or replace function execq(text,integer) returns integer as '/usr/local/pgsql/lib/execq.so','execq' language c strict;CREATE FUNCTIONpostgres=# select execq('select * from testtab',10);INFO: EXECQ: 1 | 12345 WARNING: transaction left non-empty SPI stackHINT: Check for missing "SPI_finish" calls. execq ------- 1(1 row)postgres=#
[作者:技术者高健@博客园 mail: ]
结束