dbTalk Databases Forums  

[BUGS] partial PGresult in pgsql v8.2rc1

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] partial PGresult in pgsql v8.2rc1 in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Igor Shevchenko
 
Posts: n/a

Default [BUGS] partial PGresult in pgsql v8.2rc1 - 12-01-2006 , 11:27 AM






Hi All,

I've been using partial PGresult-s since pgsql v7.4, and one of "signs" that
it's there (after a "read" event on a non-blocking tcp connection to pgsql +
a call to PQconsumeInput) is a check: "pgconn->result != NULL", where pgconn
is a pointer to a PGconn object. Looks like in v8.2rc1, the "result" can have
wrong pointers - my test app dies with the following trace:

#0 0x00e065a8 in PQntuples (res=0x11f) at fe-exec.c:2063
#1 0x080a1a75 in pg::db::can_read (this=0xa3b2f78) at pgdb.cpp:197

where: pgdb.cpp:

197: if ( conn->result != NULL && PQntuples ( conn->result ) ) {

fe-exec.c:2063:

int
PQntuples(const PGresult *res)
{
if (!res)
return 0;
2063: return res->ntups;
}


Looks like the "result" has an invalid pointer ? Address=0x11f is unlikely.

--
Best Regards,
Igor Shevchenko

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] partial PGresult in pgsql v8.2rc1 - 12-01-2006 , 11:56 AM






Igor Shevchenko <igor (AT) carcass (DOT) ath.cx> writes:
Quote:
I've been using partial PGresult-s since pgsql v7.4, and one of "signs" that
it's there (after a "read" event on a non-blocking tcp connection to pgsql +
a call to PQconsumeInput) is a check: "pgconn->result != NULL", where pgconn
is a pointer to a PGconn object.
PGconn is not an exported struct, and so what you are doing is unsupported,
but I'll bet your app was compiled against the wrong version of libpq-int.h.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend


Reply With Quote
  #3  
Old   
Igor Shevchenko
 
Posts: n/a

Default Re: [BUGS] partial PGresult in pgsql v8.2rc1 - 12-04-2006 , 09:39 AM



On Friday 01 December 2006 19:52, you wrote:
Quote:
Igor Shevchenko <igor (AT) carcass (DOT) ath.cx> writes:
I've been using partial PGresult-s since pgsql v7.4, and one of "signs"
that it's there (after a "read" event on a non-blocking tcp connection to
pgsql + a call to PQconsumeInput) is a check: "pgconn->result != NULL",
where pgconn is a pointer to a PGconn object.

PGconn is not an exported struct, and so what you are doing is unsupported,
but I'll bet your app was compiled against the wrong version of
libpq-int.h.
Thanks Tom, that was it. An old libpq-int.h was compiled into a precompiled
header.

The reason I'm using libpq-int.h is that I can use SELECT-ed data from
not-yet-complete queries, and this is very useful for long searches which
yeld data from time to time. The only other approach I can think of, cursor
open / fetch, causes bidirectional network traffic and it's not very
efficient when there are many immediate results. OFC I understand that using
internal libpq stuff means I'm on my own, so I was thinking will you accept a
patch which would allow libpq provide data from incomplete queries ? I've
asked about this before, your statement was that this breaks the consistency,
but sometimes it doesn't really matter, e.g. with searches.

--
Best Regards,
Igor Shevchenko

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.