pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feed(no subject)
2+ messages / 2 participants
[nested] [flat]
* (no subject)
@ 2001-10-03 17:13 Darko Prenosil <Darko.Prenosil@finteh.hr>
2001-10-03 17:41 ` Re: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: Darko Prenosil @ 2001-10-03 17:13 UTC (permalink / raw)
To: Bruce Momjian <pgman@candle.pha.pa.us>; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-interfaces
Hi guys,
Sorry for bothering you, but we ran into a situation...
Story goes like this:
We wanted to use non-blocking PQSendQuery to send a large query which consists of many SELECTs. Our pglib interface sent just first 8192 bytes and returned EOF. Whole query was more than 64k.
We took a brief look through the source and here is what confuses us:
These two chunks of code are from fe-misc.c
pqPutBytes(const char *s, size_t nbytes, PGconn *conn){
........
while (nbytes > avail)
{
memcpy(conn->outBuffer + conn->outCount, s, avail);
conn->outCount += avail;
s += avail;
nbytes -= avail;
if (pqFlush(conn))
return EOF;
avail = conn->outBufSize;
}
...........
}
*************************************
pqFlush(PGconn *conn) {
............
#ifdef USE_SSL
/* can't do anything for our SSL users yet */
if (conn->ssl == NULL)
{
#endif
if (pqIsnonblocking(conn))
{
/* shift the contents of the buffer */
memmove(conn->outBuffer, ptr, len);
conn->outCount = len;
return EOF; <- Why it returns EOF after just shifting the buffer ???
}
#ifdef USE_SSL
}
#endif
...............
}
When we corected the code to look like this:
#ifdef USE_SSL
/* can't do anything for our SSL users yet */
if (conn->ssl == NULL)
{
if (pqIsnonblocking(conn))
{
/* shift the contents of the buffer */
memmove(conn->outBuffer, ptr, len);
conn->outCount = len;
return EOF;
}
}
#endif
we succeed to send queries bigger than 8k. We tried to figure what is happening, and saw that there
is few pqWait calls, but our queries are send correctly. Is there some fact that we are missing ?
Can You please explain ???
Maybe it is important to say that we are compiling library for WIN32.
Thanks.
Darko
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re:
2001-10-03 17:13 (no subject) Darko Prenosil <Darko.Prenosil@finteh.hr>
@ 2001-10-03 17:41 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2001-10-03 17:41 UTC (permalink / raw)
To: Darko Prenosil <Darko.Prenosil@finteh.hr>; +Cc: Bruce Momjian <pgman@candle.pha.pa.us>; pgsql-interfaces
"Darko Prenosil" <Darko.Prenosil@finteh.hr> writes:
> We wanted to use non-blocking PQSendQuery to send a large query which =
> consists of many SELECTs. Our pglib interface sent just first 8192 bytes =
> and returned EOF. Whole query was more than 64k.
I've said since day one that libpq's non-blocking mode is fundamentally
broken --- see http://fts.postgresql.org/db/mw/msg.html?mid=35774 and
rest of that thread. Tempt me not too far, or I'll rip it all out
until someone reimplements it in a non-broken fashion ...
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2001-10-03 17:41 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-10-03 17:13 Darko Prenosil <Darko.Prenosil@finteh.hr>
2001-10-03 17:41 ` Re: Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox