PGexec dumps core at pqResultAlloc

Поиск
Список
Период
Сортировка
От ryan p bobko
Тема PGexec dumps core at pqResultAlloc
Дата
Msg-id 61533E21196D0E42ACBA1C877B7093E9C87096@EXCHANGE_SERVER.pqa.local
обсуждение исходный текст
Список pgsql-general
Hi All,
I'm trying to write a Postgres database plugin in an application of mine.
The rest of the app is written in C++, but I'm NOT interested in using
libpqxx at this time. This plugin will be dynamically loaded, and other
plugins I've written seem to work just fine.

The problem appears to be in my second call to the connection pointer. The
first select statement I made works just fine (though no rows are returned),
but the second time I try to run a select statement, I get a core. Running
multiple queries in psql work perfectly. Here's the stacktrace form my dump:

#0  0x408cf47e in malloc_consolidate () from /lib/libc.so.6
#1  0x408ced83 in _int_malloc () from /lib/libc.so.6
#2  0x408cdf1a in malloc () from /lib/libc.so.6
#3  0x40c834cd in pqResultAlloc (res=0x4098a9a0, nBytes=1083746720,
isBinary=1 '\001') at fe-exec.c:496
#4  0x40c83e18 in getRowDescriptions (conn=0x80699b8) at fe-exec.c:1129
#5  0x40c83d5f in parseInput (conn= x80699b8) at fe-exec.c:1023
#6  0x40c8437b in PQgetResult (conn=0x80699b8) at fe-exec.c:1349
#7  0x40c84489 in PQexec (conn=0x80699b8, query=0x8070398 "select * from
accounts where ID!=0") at fe-exec.c:1461

The code is pretty basic, in my opinion. The following is the snippet that's
failling. By the time execution gets to this point, the connection is open,
and the first line always prints 0 1 0
---
    cout<<conn<<": "<<PQstatus( conn )<<" "<<CONNECTION_BAD<<"
"<<CONNECTION_OK<<endl;

    PGresult * result=PQexec( conn, "BEGIN" );
    cout<<"here a"<<endl;
    PQclear( result );

    cout<<"here a.1"<<endl;
    result=PQexec( conn, stmt );
    cout<<"here a.2"<<endl;
--

Platform: Slackware Linux 9.1, x86, gcc-3.2.3

I would appreciate any help I can get at this point. It looks like someone
had a similar issue back in 1998, but I can't imagine this is the same
error. Thanks for your help,

ry


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

Предыдущее
От: spam@fisher.forestry.uga.edu (Chris Fonnesbeck)
Дата:
Сообщение: psql version mismatch
Следующее
От: Rajesh Kumar Mallah
Дата:
Сообщение: Re: Postgre Architecture