From: | Volkan YAZICI <volkan(dot)yazici(at)gmail(dot)com> |
---|---|
To: | PostgreSQL Novice <pgsql-novice(at)postgresql(dot)org> |
Subject: | PQconsumeInput() usage in PQgetCopyData() |
Date: | 2005-06-06 08:45:58 |
Message-ID: | 7104a7370506060145364590e5@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Hi,
[Excuse me, if here's the wrong list to ask this question.]
From PQgetCopyData() documentation, it says that:
«When async is true (not zero), PQgetCopyData will not block waiting for
input; it will return zero if the COPY is still in progress but no complete
row is available. (In this case wait for read-ready before trying again; it
does not matter whether you call PQconsumeInput.)»
But in my opinion, a PQconsumeInput() call would matter in here. When
I look at pqGetCopyData3() in src/interfaces/libpq/fe-protocol3.c from
CVS:
974 nodata:
975 /* Don't block if async read requested */
976 if (async)
977 return 0;
978 /* Need to load more data */
979 if (pqWait(TRUE, FALSE, conn) ||
980 pqReadData(conn) < 0)
981 return -2;
If there's no data in sync. mode, pqGetCopyData3() is calling
pqReadData() - just like PQconsumeInput() does. Thus, in my opinion,
user should call PQconsumeInput() in the program flow while using
PQgetCopyData() in async. mode.
Moreover, when I look at pqWait further:
[src/interfaces/libpq/fe-misc.c]
pqWait() -> pqWaitTimed() -> pqSocketCheck():
/*
* Checks a socket, using poll or select, for data to be read, written,
* or both.
* ...
*/
static int
pqSocketCheck(...
To summarize, despite documentation, (as I understand) user should
call PQconsumeInput() while using PQgetCopyData() in async. mode too.
Any comments will be appreciated.
Regards.
From | Date | Subject | |
---|---|---|---|
Next Message | John DeSoi | 2005-06-06 12:56:24 | Re: phppgadmin |
Previous Message | Volkan YAZICI | 2005-06-06 08:01:41 | Re: phppgadmin |