notify problem
От | Alessandro GARDICH |
---|---|
Тема | notify problem |
Дата | |
Msg-id | 1062746373.2225.40.camel@motoko.loc обсуждение исходный текст |
Ответы |
Re: notify problem
|
Список | pgsql-general |
Hi to all I have problem with NOTIFY/LISTEN ... I'm writing a C++ application with libpqxx, I thought was a problem of the lib but I try also with a C program using libpq with the same result, so maybe there is something else of wrong. Using the example 2 in the libpq chapter on "Postgres Programmer's Guide" as template i write : !----------> #include <unistd.h> #include <libpq-fe.h> int main() { PGconn *conn; PGresult *res; PGnotify *notify; int i; conn = PQconnectdb ("host=localhost user=test dbname=test"); if (PQstatus(conn) == CONNECTION_BAD) { fprintf(stderr,"failed connecting.\n"); PQfinish(conn); exit(1); } res = PQexec(conn, "LISTEN alert"); if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) { fprintf(stderr,"failed listening.\n"); PQclear(res); PQfinish(conn); exit(1); } PQclear(res); for(i = 0; i < 80 ; ++i) { sleep(1); PQconsumeInput(conn); while ((notify = PQnotifies(conn)) != NULL) { fprintf(stderr,"\nGOT NOTIFY!!!\n"); free(notify); } fprintf(stderr,"."); } PQfinish(conn); return 0; } <----------! On a console with psql I issue some notify with NOTIFY alert; COMMIT; but nothing are catched !!! if in another console with psql i do a "LISTEN alert;" all work correctly. I'm using Linux, RedHat 9, so PostgreSQL 7.3.2. user and database are created with : createuser -h localhost -U postgres -D -A -P test createdb -O test -h localhost -U postgres test and nothing alse, the database are empty. what's wrong ??? Thanks. -- Alessandro GARDICH <gremlin@gremlin.it> gremlin.it
В списке pgsql-general по дате отправления: