On 14.04.2011 10:15, Pavel Stehule wrote:
I have a problem with PQputCopyData function. It doesn't signal some error.
while ((row = mysql_fetch_row(res)) != NULL)
snprintf(buffer, sizeof(buffer), "%s%s\n", row,
copy_result = PQputCopyData(pconn, buffer,
if (copy_result != 1)
fprintf(stderr, "Copy to target table failed:
it returns 1 for broken values too :(
Is necessary some special check?
The way COPY works is that PQputCopyData just sends the data to the
server, and the server will buffer it in its internal buffer and
processes it when it feels like it. The PQputCopyData() calls don't even
need to match line boundaries.
I think you'll need to send all the data and finish the COPY until you
get an error. If you have a lot of data to send, you might want to slice
it into multiple COPY statements of say 50MB each, so that you can catch
errors in between.
Sent via pgsql-hackers mailing list (email@example.com)
To make changes to your subscription: