On Fri, 25 Mar 2011, yuriy.tereschuk wrote:


The following bug has been logged online:

Bug reference:      5948
PostgreSQL version: postgresql90
Operating system:   Linux Fedora 14
Description:        JDBC wrond insert of timestamp data
Details:

org.postgresql.util.PSQLException: ERROR: column "datetime" is of type
timestamp without time zone but expression is of type character varying
 Hint: You will need to rewrite or cast the expression.

JDBC version postgresql90-jdbc-9.0.801-1PGDG.f14.i686


You are most likely setting the timestamp value by using setString or setObject with a string value on a PreparedStatement. This is indicating to the driver that you want the parameter to have a string (varchar) type. This is not correct for a timestamp. You should use setTimestamp or setObject with a third parameter indicating that the value is a timestamp. If you are unable to change your application for some reason, you can adjust the driver's binding behavior by using the stringtype=unspecified connection parameter described here:

http://jdbc.postgresql.org/documentation/84/connect.html#connection-parameters

Kris Jurka

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to