PQconsumeInput() usage in PQgetCopyData()
От | Volkan YAZICI |
---|---|
Тема | PQconsumeInput() usage in PQgetCopyData() |
Дата | |
Msg-id | 7104a7370506060145364590e5@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: PQconsumeInput() usage in PQgetCopyData()
|
Список | 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.
В списке pgsql-novice по дате отправления: