Synchronisation problems in COPY IN - Mailing list pgsql-jdbc

From Kim Bisgaard
Subject Synchronisation problems in COPY IN
Date
Msg-id 4C8E1564.80405@alleroedderne.adsl.dk
Whole thread Raw
Responses Re: Synchronisation problems in COPY IN  (Kris Jurka <books@ejurka.com>)
List pgsql-jdbc
Hi,

We are occasionally experiencing problems with our JDBC implementation
of COPY IN.

We have cut our program down to the attached example.

Guessing from the error messages it looks like jdbc is overwriting the
buffer sent to the server before it is done. We are writing the data in
CSV format, with integer(serial),date(now),float format, so it is easy
to see if the buffer is garbled. Here is an example:
INFO: ERROR: extra data after last expected column
   Where: COPY temporary_wind_speed_50_m_3, line 175:
"60000179,2010-09-07 00:00:00,60001043,2010-09-07
00:00:00,10.032084733490484"
org.postgresql.util.PSQLException: ERROR: extra data after last expected
column
   Where: COPY temporary_wind_speed_50_m_3, line 175:
"60000179,2010-09-07 00:00:00,60001043,2010-09-07
00:00:00,10.032084733490484"
         at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062)
         at
org.postgresql.core.v3.QueryExecutorImpl.processCopyResults(QueryExecutorImpl.java:929)
         at
org.postgresql.core.v3.QueryExecutorImpl.writeToCopy(QueryExecutorImpl.java:838)
         at
org.postgresql.core.v3.CopyInImpl.writeToCopy(CopyInImpl.java:53)
         at org.postgresql.copy.CopyManager.copyIn(CopyManager.java:179)
         at org.postgresql.copy.CopyManager.copyIn(CopyManager.java:161)
         at dk.dmi.appl.evejrfeeder.EvejrDBCopy.run(Unknown Source)
         at java.lang.Thread.run(Thread.java:595)


It thus looks like a synchronisation problem (locking problem), but we
are using Piped(Input/Output)Stream, which must be properly
synchronised, and CopyManager.CopyIn, where there is nowhere to add
synchronisation.

To us it looks like a problem in CopyManager.CopyIn, or alternatively we
are not doing something we where expected to do?

We use PostgreSQL 8.4, and JDBC 8.4-702.

Thanks in advance!

Kim


Attachment

pgsql-jdbc by date:

Previous
From: Craig Ringer
Date:
Subject: Re: Send a command to postgres and close the program
Next
From: Kris Jurka
Date:
Subject: Re: Synchronisation problems in COPY IN