ECPG and COPY and PQputCopyData - don't get errors

From: Wes <wespvp(at)syntegra(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Michael Meskes <meskes(at)postgresql(dot)org>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: ECPG and COPY and PQputCopyData - don't get errors
Date: 2006-02-26 00:42:06
Message-ID: C026557E.1F56B%wespvp@syntegra.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Randy Yates 2006-02-26 02:56:15 postgresql documentation
Previous Message Peter Eisentraut 2006-02-26 00:37:50 Re: From ASCII to UTF-8