Re: [GENERAL] ECPG and COPY and PQputCopyData - don't get errors
Wes [EMAIL PROTECTED] writes: I sent the column headers as the first line of the input. While this I now know this is wrong, the problem here is that I got no error response back. ... However, every call to PQputCopyData, as well as PQputCopyEnd returned a result of 1. That just indicates that the data was sent to the backend without error. You forgot to check the copy command result afterward. regards, tom lane ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq
Re: [GENERAL] ECPG and COPY and PQputCopyData - don't get errors
On 2/26/06 12:12 PM, Tom Lane [EMAIL PROTECTED] 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 ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
[GENERAL] ECPG and COPY and PQputCopyData - don't get errors
Since I can't use ECPG COPY, I'm trying to use libpq PQputCopyData. Not realizing I had to use CSV format to include column header names, I used: PQexec(conn, COPY detail FROM stdin) I sent the column headers as the first line of the input. While this I now know this is wrong, the problem here is that I got no error response back. In the postmaster log, I see: ERROR: invalid input syntax for type numeric: messageid CONTEXT: COPY detail, line 1, column messagesize: messageid However, every call to PQputCopyData, as well as PQputCopyEnd returned a result of 1. Ok, so I fixed the above error, but any other data load errors are only showing up in the postgres log file. I tried defining PQsetNoticeReceiver(conn, pgsqlNoticeReceiver, (void *) dummy); For testing, pgsqlNoticeReceiver just writes a message and aborts. However, pgsqlNoticeReceiver is never called. What am I missing? I need to abort the transaction on any errors in the COPY. Wes ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly