libpq incompatibility - Mailing list pgsql-bugs

From Admin Gaston
Subject libpq incompatibility
Date
Msg-id 00a001c351b5$511aff00$02193264@compu2
Whole thread Raw
Responses Re: libpq incompatibility
List pgsql-bugs
Hi, sorry my english. Recently i was using postgresql 7.2, and then i updat=
e to 7.3.3. We was running a C program that was working fine with 7.2, but =
in 7.3.3 it seg fault.

int procesarConsultasSQL(int nCliente){
    .......... more code
    FD_SET(cli->socketDB, &readfds);
    timeout.tv_sec =3D timeout.tv_usec =3D 0;
    select(cli->socketDB + 1, &readfds, NULL, NULL, &timeout);
    if (FD_ISSET(cli->socketDB, &readfds)){
        if (PQconsumeInput(cli->conn)){
            if (!PQisBusy(cli->conn)){
                while ((cli->res =3D PQgetResult(cli->conn)) !=3D NULL){
                    //procesamos los datos devueltos por la base de datos, =
ya sean
                    //select's o update's y lo agregamos en la cola de envi=
o del cliente
                    switch(PQresultStatus(cli->res)){
                        ....... more code
                    }
                    ....... more code
                    PQclear(cli->res);
                }
                ........ more code
            }
        }
    }
    ....... more code
}

When the program is running for a while, it finish with segmentation fault =
(core dumped).

#0  0x420742e2 in _int_malloc () from /lib/tls/libc.so.6
#1  0x4207360b in malloc () from /lib/tls/libc.so.6
#2  0x400278b3 in PQmakeEmptyPGresult () from /usr/lib/libpq.so.3
#3  0x40028387 in PQconsumeInput () from /usr/lib/libpq.so.3
#4  0x400282f1 in PQconsumeInput () from /usr/lib/libpq.so.3
#5  0x4002886a in PQisBusy () from /usr/lib/libpq.so.3
#6  0x0804c3dc in procesarConsultasSQL(int) ()
#7  0x0804cfe0 in main ()

Is this a know bug?, or the way i am programming this isn't correct? Any he=
lp is aprecciated, and thanks to Tom Lane for my other problem, it was solv=
ed.

Regards,
Tavella Gaston.=

pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Small problem in contrib/dbase/dbf2pg.c
Next
From: Andreas Pflug
Date:
Subject: problem with libpq7.3.3/encrypted