Re: ECPG and COPY and PQputCopyData - don't get errors

From: Wes <wespvp(at)syntegra(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Michael Meskes <meskes(at)postgresql(dot)org>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: ECPG and COPY and PQputCopyData - don't get errors
Date: 2006-02-26 20:14:56
Message-ID: C0276860.1F5FB%wespvp@syntegra.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2/26/06 12:12 PM, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> That just indicates that the data was sent to the backend without error.
> You forgot to check the copy command result afterward.

Ok, after re-reading the docs for the 10th time, I see I missed that I need
to paragraph about calling 'PQgetResult' after the PQputCopyEnd. I was just
checking the result and PQerrorMessage. I think what threw me off was:

"If a COPY command is issued via PQexec in a string that could contain
additional commands, the application must continue fetching results via
PQgetResult after completing the COPY sequence. Only when PQgetResult
returns NULL is it certain that the PQexec command string is done and it is
safe to issue more commands."

(looked like this was needed only if multiple commands were in the Pqexec)

and

"PQgetResult
Waits for the next result from a prior PQsendQuery, PQsendQueryParams,
PQsendPrepare, or PQsendQueryPrepared call, and returns it."

(doesn't mention COPY).

I have it working now. Thanks.

Wes

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-02-26 20:23:22 Re: Management of Concurrent Clients
Previous Message Roman Neuhauser 2006-02-26 20:05:07 Re: majordomo unmaintained, postmaster emails ignored?