Skip site navigation (1) Skip section navigation (2)

libpq incompatibility

From: "Admin Gaston" <admin(at)intergamesclub(dot)com>
To: <pgsql-bugs(at)postgresql(dot)org>
Subject: libpq incompatibility
Date: 2003-07-24 07:29:28
Message-ID: 00a001c351b5$511aff00$02193264@compu2 (view raw or flat)
Thread:
Lists: pgsql-bugs
Hi, sorry my english. Recently i was using postgresql 7.2, and then i update 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 = timeout.tv_usec = 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 = PQgetResult(cli->conn)) != NULL){
                    //procesamos los datos devueltos por la base de datos, ya sean
                    //select's o update's y lo agregamos en la cola de envio 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 help is aprecciated, and thanks to Tom Lane for my other problem, it was solved.

Regards,
Tavella Gaston.

Responses

pgsql-bugs by date

Next:From: Andreas PflugDate: 2003-07-24 08:37:39
Subject: problem with libpq7.3.3/encrypted
Previous:From: Bruce MomjianDate: 2003-07-24 02:29:21
Subject: Re: Small problem in contrib/dbase/dbf2pg.c

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group