Re: copy_from does not stop reading after an error

From: Nicolas Grilly <nicolas(at)gardentechno(dot)com>
To: Marko Kreen <markokr(at)gmail(dot)com>
Cc: Federico Di Gregorio <federico(dot)digregorio(at)dndg(dot)it>, psycopg(at)postgresql(dot)org
Subject: Re: copy_from does not stop reading after an error
Date: 2011-02-01 13:41:07
Message-ID: AANLkTimYOEeHNKCFfewKqKJsmt8wxAjRJMwfubD9JrK6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmail(dot)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
>

In response to

Browse psycopg by date

  From Date Subject
Next Message Danny Milosavljevic 2011-02-03 20:04:39 psycopg2 (async) socket timeout
Previous Message Marko Kreen 2011-02-01 13:18:29 Re: copy_from does not stop reading after an error