COPY command returns "ERROR: invalid XML content"

From: Konstantin Izmailov <pgfizm(at)gmail(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: COPY command returns "ERROR: invalid XML content"
Date: 2019-10-07 03:45:40
Message-ID: CAAw-MsfDCUO3AbY7TqoaJLTRB_DVXCgZio4_MTDDnNkvU+GP5Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
I'm using libpq (v10) to import lots of xml files into a PG10 table. I
noticed if number of records imported exceeds 2100 then the following error
is returned:
ERROR: invalid XML content
DETAIL: line 1: Couldn't find end of Start Tag
timeBasedFileNamingAndTriggerin line 1
logFile.%d{yyyy-MM-dd}.%i.html</fileNamePattern><timeBasedFileNamingAndTriggerin

^
line 1: Premature end of data in tag rollingPolicy line 1
line 1: Premature end of data in tag appender line 1
line 1: Premature end of data in tag configuration line 1
CONTEXT: COPY xmltest, line 2098, column Roles

The target table was created as:
CREATE TABLE "xmltest" ("id" int NOT NULL primary key,"Roles" xml)

And the code that imports the files is very simple:
PQexec("COPY xmltest(id,\"Roles\") FROM stdin WITH BINARY", 0, 0);
PQputCopyData(conn, ti_buffer, ti_size);
PQputCopyEnd(conn, 0);

If I call PQputCopyEnd() after every 2100 or less records placed into
ti_buffer, I can import tens of thousands of xml files. But attempt to
import 2101 or more records causes the error. I inspected the ti_buffer and
confirmed that it contains all data expected. It appears like libpq does
not transmit the buffer to the server after about 9,100,000 characters. I'm
running the application on Windows Server 2012R2, compiled with VS2013. The
PG10 server is running on the same workstation on Port 5410. I also tried
to Copy the records to Postgres 11, and got the same results.

I will appreciate any suggestion on troubleshooting/resolving the issue.
Thanks!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mageshwaran Janarthanam 2019-10-07 05:00:32 Install postgres on rhel 7
Previous Message Andrew Gierth 2019-10-06 21:39:10 Re: v12 and pg_restore -f-