Search Postgresql Archives

ECPG and COPY and PQputCopyData - don't get errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux