Re: copy_from does not stop reading after an error

Поиск
Список
Период
Сортировка
От Nicolas Grilly
Тема Re: copy_from does not stop reading after an error
Дата
Msg-id AANLkTimYOEeHNKCFfewKqKJsmt8wxAjRJMwfubD9JrK6@mail.gmail.com
обсуждение исходный текст
Ответ на Re: copy_from does not stop reading after an error  (Marko Kreen <markokr@gmail.com>)
Список psycopg
So, considering the test case I attached in my previous message, do you think it should be possible to retrieve the error message (Invalid syntax for integer "Bad key", CONTEXT: COPY test, line 10, column id: "Bad key") without waiting for complete transmission?

Do you think it is possible to modify psycopg2 to implement what you suggested? I guess the related code is in file pqpath.c, function _pq_copy_in_v3, correct?

On Tue, Feb 1, 2011 at 14:18, Marko Kreen <markokr@gmail.com> wrote:
No, the error message should arrive immediately.  But it may be deficiency of
libpq that you cannot aquire it before ending the copy.

I'm not sure about that actually.  It should be possible to call
select() & PQconsumeInput
between copy calls, thus also PQgetResult to get the error.
--
marko

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

Предыдущее
От: Marko Kreen
Дата:
Сообщение: Re: copy_from does not stop reading after an error
Следующее
От: Danny Milosavljevic
Дата:
Сообщение: psycopg2 (async) socket timeout