diff -ruN postgresql-7.4.13-old/src/pgcluster/pgrp/replicate.c postgresql-7.4.13/src/pgcluster/pgrp/replicate.c
--- postgresql-7.4.13-old/src/pgcluster/pgrp/replicate.c	2006-08-11 10:15:12.000000000 +0200
+++ postgresql-7.4.13/src/pgcluster/pgrp/replicate.c	2006-08-11 10:17:46.000000000 +0200
@@ -101,7 +101,7 @@
 static bool is_executed_query_in_origin( ReplicateHeader *header );
 static bool is_executed_query( PGconn *conn, ReplicateHeader * header);
 static int send_sync_data(PGconn *conn, ReplicateHeader * header, bool sync_command_flg, int current_cluster);
-static int replicate_query(PGresult * res, PGconn * conn, HostTbl * host_ptr, ReplicateHeader * header, char *query, bool sync_command_flg, int current_cluster);
+static int replicate_query(PGresult **res, PGconn * conn, HostTbl * host_ptr, ReplicateHeader * header, char *query, bool sync_command_flg, int current_cluster);
 static TransactionTbl * get_conn( HostTbl * host_ptr, ReplicateHeader * header);
 static TransactionTbl * recreate_conn( HostTbl* host_ptr, ReplicateHeader* header);
 static void * thread_send_source(void * arg);
@@ -1288,7 +1288,7 @@
 	}
 	else
 	{
-		status = replicate_query(res, conn, host_ptr,header, query, sync_command_flg, current_cluster);
+		status = replicate_query(&res, conn, host_ptr,header, query, sync_command_flg, current_cluster);
 		if ((status == STATUS_OK) && (res == NULL))
 		{
 			return STATUS_OK;
@@ -1452,13 +1452,13 @@
 }
 
 static int
-replicate_query(PGresult * res, PGconn * conn, HostTbl * host_ptr, ReplicateHeader * header, char *query, bool sync_command_flg, int current_cluster)
+replicate_query(PGresult **res, PGconn * conn, HostTbl * host_ptr, ReplicateHeader * header, char *query, bool sync_command_flg, int current_cluster)
 {
 	char * func ="replicate_query()";
 	TransactionTbl * transaction_tbl = NULL;
 	int cnt = 0;
 
-	while ((res = PQexec(conn, query)) == NULL)
+	while ((*res = PQexec(conn, query)) == NULL)
 	{
 		if (header->cmdSts == CMD_STS_NOTICE )
 		{
