SIGSEGV in PQreset(..)

Поиск
Список
Период
Сортировка
От Arturs Zoldners
Тема SIGSEGV in PQreset(..)
Дата
Msg-id 1139866449.2642.31.camel@azazello.tuci.lv
обсуждение исходный текст
Ответы Re: SIGSEGV in PQreset(..)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
OS: FC4, 2.6.11-1.1369_FC4
PostgreSQL: postgresql-8.1.2-1PGDG (rpm install)
gcc: version 4.0.2 20051125 (Red Hat 4.0.2-8)

The following code raises SIGSEGV:

main.cpp (gcc -lstdc++ -lpq -g main.cpp)

extern "C"
{
    #include <libpq-fe.h>
}
int main(int arch, char* argv[])
{
        PGconn* conn = PQconnectdb("x");
        ConnStatusType status = PQstatus(conn);
    //status == CONNECTION_BAD
        PQreset(conn);
        return 0;
}

gdb:
Program received signal SIGSEGV, Segmentation fault.
0x0061371e in connectDBStart (conn=0x9f82008) at fe-connect.c:798

However, this code works ok:

main.cpp (gcc -lstdc++ -lpq -g main.cpp)

extern "C"
{
    #include <libpq-fe.h>
}
int main(int arch, char* argv[])
{
        PGconn* conn = PQconnectdb("user='x' password='x' dbname='x'");
        ConnStatusType status = PQstatus(conn);
    //status == CONNECTION_BAD
        PQreset(conn);
        status = PQstatus(conn);
    //status == CONNECTION_BAD
        return 0;
}

In both cases postmaster is not running.
The "successful" completion of second sample suggests me that SIGSEGV in the first sample is triggered by a bug.
Or is there any other return code indicating badly formated argument passed to PQconnectdb function?
I'm sorry if this is just a wrong usage of libpq API from my side.

Regards,
az

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: BUG #2246: Bad malloc interactions: ecpg, openssl
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #2246: Bad malloc interactions: ecpg, openssl