From: Oliver Jowett <oliver@opencloud.com>
To: dba@vilaj.com
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Inserting an Interval Using JDBC
Date: Tue, 24 Jan 2006 09:10:13 +1300
Message-ID: <43D53825.10107@opencloud.com> (raw)
In-Reply-To: <43D50C19.9040408@vilaj.com>
References: <43D50C19.9040408@vilaj.com>
Will Szopko wrote:
> I have just upgraded to the 8.1-404 version of the JDBC driver from a
> much older version. In the past I had been able load an interval into my
> database by sending it as a string, as such:
>
> String myInterval = "08:00"; // 8 hour interval
> ...
> stmt.setString(1, myInterval);
>
> Using the new driver I am no longer able to do this and get the
> following error:
>
> column "num_hours" is of type interval but expression is of type text
Use "CAST (? AS INTERVAL)" in your query, or use the custom
org.postgresql.util.PGInterval type and pass an instance to setObject().
-O
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: oliver@opencloud.com, dba@vilaj.com
Subject: Re: Inserting an Interval Using JDBC
In-Reply-To: <43D53825.10107@opencloud.com>
References: <43D50C19.9040408@vilaj.com> <43D53825.10107@opencloud.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