[Pgpool-general] pool_check_fd: data is not ready tp->tv_sec5tp->tp_usec 5000000

Tatsuo Ishii ishii at sraoss.co.jp
Sun Oct 2 08:12:02 GMT 2005


> > Debug Output:
> 
> [snip]
> 
> Thanks for the info. I will dig into tomorrow.

Sorry for late. I couldn't run your exmaple on my computer, and I made
a similar program using libpq(see attached program). Unfortunately I
couldn't reproduce your problem.

Can you modify the C program so that it becomes a self contained test
case?

To compile it you type something like:

gcc -I /usr/local/pgsql/include/ test.c -L /usr/local/pgsql/lib/ -lpq

you need to create the table before testing:

create table t1(c1 varchar(10), c2 varchar(20), i1 int4, i2 int4);
--
SRA OSS, Inc. Japan
Tatsuo Ishii
-------------- next part --------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "libpq-fe.h"

static void
exit_nicely(PGconn *conn)
{
        PQfinish(conn);
        exit(1);
}

main(int argc, char **argv)
{
	const char *conninfo = "dbname=test";
	PGconn     *conn;
	PGresult   *res;
	static const char *paramValues[] = {"foo", "var", "100", "200"};

	conn = PQconnectdb(conninfo);

	if (PQstatus(conn) != CONNECTION_OK)
	{
		fprintf(stderr, "Connection to database failed: %s",
				PQerrorMessage(conn));
		exit_nicely(conn);
	}

	res = PQexec(conn, "PREPARE prep1(varchar, varchar, int4, int4) AS INSERT INTO t1 (c1, c2, i1, i2) VALUES($1, $2, $3, $4)");
	if (PQresultStatus(res) != PGRES_COMMAND_OK)
	{
		fprintf(stderr, "PQexec failed: %s", PQerrorMessage(conn));
		PQclear(res);
		exit_nicely(conn);
	}

	res = PQexecPrepared(conn,
						 "prep1",
						 4,
					   paramValues,
					   NULL,
					   NULL,
					   0);

	if (PQresultStatus(res) != PGRES_COMMAND_OK)
	{
		fprintf(stderr, "PQexecPrepared failed: %s", PQerrorMessage(conn));
		PQclear(res);
		exit_nicely(conn);
	}

	exit_nicely(conn);
}


More information about the Pgpool-general mailing list