pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kalle Hallivuori <kato@iki.fi>
To: Владимир Баранов <baranoff@inbox.ru>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: COPY <table> FROM STDIN BINARY
Date: Sun, 19 Aug 2007 22:43:53 +0300
Message-ID: <c637d8bb0708191243k2d6628c1yf59a47d205ee2b1@mail.gmail.com> (raw)
In-Reply-To: <E1IM0A4-000BYC-00.baranoff-inbox-ru@f31.mail.ru>
References: <E1IM0A4-000BYC-00.baranoff-inbox-ru@f31.mail.ru>

Hi Vladimir and jdbc-list!

2007/8/17, Владимир Баранов <baranoff@inbox.ru>:
> I have troubles with bulk insert of binary data via COPY command.
>
> I use JDBC 3.0 driver patched by Kalle Hallivuori (http://kato.iki.fi/)

Makes me happy that people are at least trying to use it :)

...
> copy bulk_data from stdin binary;
>
> All integer, varchar and bytea values are copied correctly. But when I put into stream System.currentTimeMillis() as the timestamp value, that value is interpreted by PostgreSQL in a manner I could not understand; as the result I get wrong timestamp value in the table.

Interesting. I haven't yet looked into binary copying myself, so I
can't really say what would be the appropriate value. Here are some
blind guesses:

1) byte order - does Java write the long value into the stream in the
same order that the server expects to read it?
2) time zone - which time zone is the java VM running in, and how much
is it different from that of the postgresql server process?

Could you post some values that you send to the server and what values
they produce at the server?

> My question is: what input binary format of a timestamp value should I use?

That would probably be specified in PostgreSQL binary format
documentation? I don't have the time to look deep into it right now,
but this seems pretty common problem, given the answers from google
for 'site:postgresql.org "binary format"'.

-- 
Kalle Hallivuori +358-41-5053073 http://korpiq.iki.fi/


view thread (3+ messages)  latest in thread

Message-ID: <c637d8bb0708191243k2d6628c1yf59a47d205ee2b1@mail.gmail.com>
Permalink:  ../c637d8bb0708191243k2d6628c1yf59a47d205ee2b1@mail.gmail.com/
Also on:    postgresql.org/message-id/c637d8bb0708191243k2d6628c1yf59a47d205ee2b1@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: kato@iki.fi, baranoff@inbox.ru
  Subject: Re: COPY <table> FROM STDIN BINARY
  In-Reply-To: <c637d8bb0708191243k2d6628c1yf59a47d205ee2b1@mail.gmail.com>
  References: <E1IM0A4-000BYC-00.baranoff-inbox-ru@f31.mail.ru> <c637d8bb0708191243k2d6628c1yf59a47d205ee2b1@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox