From: | Ryouichi Matsuda <r-matuda(at)sra(dot)co(dot)jp> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | bug in PreparedStatement of JDBC in 7.2b4 |
Date: | 2002-01-10 12:36:42 |
Message-ID: | 20020110213253.A307.R-MATUDA@sra.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
I found a bug in PreparedStatement#setTimestamp() of JDBC included
in PostgreSQL7.2beta4. An attached patch corrects this bug.
(1) ".01" sec becomes ".10" sec
$ create table test(ts timestamp);
String sql = "insert into test values(?)";
PreparedStatement pst = db.prepareStatement(sql);
pst.setTimestamp(1, Timestamp.valueOf("2002-01-10 19:30:59.01"));
pst.executeUpdate();
$ select * from test;
$ 2002-01-10 19:30:59.10+09
Though I inserted ".01" second, ".10" second has been inserted.
There is this bug in 7.2beta4 and 7.1.3.
(2) ".876543210" sec becomes ".87" sec
pst.setTimestamp(1, Timestamp.valueOf("2002-01-10 19:30:59.876543210"));
pst.executeUpdate();
$ select * from test;
$ 2002-01-10 19:30:59.87+09
In PostgreSQL7.2, a decimal can insert only two columns, and remainder
is thrown away.
Attachment | Content-Type | Size |
---|---|---|
PreparedStatement.java.diff | application/octet-stream | 1.1 KB |
TimestampTest.java | application/octet-stream | 1.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Barry Lind | 2002-01-10 17:46:10 | Re: Statement.java patch (Postgresql 7.1.3) |
Previous Message | Ed Yu | 2002-01-10 04:10:19 | Re: JDBC patch for DatabaseMetaData |