Re: copy_from does not stop reading after an error - Mailing list psycopg

From Nicolas Grilly
Subject Re: copy_from does not stop reading after an error
Date
Msg-id AANLkTimYOEeHNKCFfewKqKJsmt8wxAjRJMwfubD9JrK6@mail.gmail.com
Whole thread Raw
In response to Re: copy_from does not stop reading after an error  (Marko Kreen <markokr@gmail.com>)
List 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 by date:

Previous
From: Marko Kreen
Date:
Subject: Re: copy_from does not stop reading after an error
Next
From: Danny Milosavljevic
Date:
Subject: psycopg2 (async) socket timeout