解决pgpool2.2.2在PostgreSQL8.4.0下无法使用问题

August 8th, 2009 no comment

PostgreSQL从8.3.x升级到8.4.0后,pgpool-II的最新版2.2.2无法编译通过,报以下错误:


sed 's,MODULE_PATHNAME,$libdir/pgpool-recovery,g' pgpool-recovery.sql.in >pgpool-recovery.sql
cc -O2 -fno-strict-aliasing -pipe -O3 -funroll-loops -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv -fPIC -DPIC -I. -I/usr/local/include/postgresql/server -I/usr/local/include/postgresql/internal -I/usr/local/include -c -o pgpool-recovery.o pgpool-recovery.c
pgpool-recovery.c: In function `pgpool_recovery':
pgpool-recovery.c:47: error: `textout' undeclared (first use in this function)
pgpool-recovery.c:47: error: (Each undeclared identifier is reported only once
pgpool-recovery.c:47: error: for each function it appears in.)
pgpool-recovery.c: In function `pgpool_remote_start':
pgpool-recovery.c:79: error: `textout' undeclared (first use in this function)
gmake: *** [pgpool-recovery.o] Error 1
*** Error code 2

经过查找,应该是PostgreSQL 8.4.0的include头文件有了一些改动造成。
解决方法:
在pgpool-II 2.2.2的源代码文件 sql/pgpool-recovery/pgpool-recovery.c 第40行加入:

extern Datum textout (PG_FUNCTION_ARGS);

即可!