X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 375B19DC999 for ; Mon, 23 Jan 2006 16:10:20 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30676-06 for ; Mon, 23 Jan 2006 16:10:19 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [131.203.101.226]) by postgresql.org (Postfix) with ESMTP id 4B44A9DC887 for ; Mon, 23 Jan 2006 16:10:16 -0400 (AST) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.20]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1F1810-00063E-G3; Tue, 24 Jan 2006 09:10:14 +1300 Message-ID: <43D53825.10107@opencloud.com> Date: Tue, 24 Jan 2006 09:10:13 +1300 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051009) X-Accept-Language: en-us, en MIME-Version: 1.0 To: dba@vilaj.com CC: pgsql-jdbc@postgresql.org Subject: Re: Inserting an Interval Using JDBC References: <43D50C19.9040408@vilaj.com> In-Reply-To: <43D50C19.9040408@vilaj.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.111 required=5 tests=[AWL=0.111] X-Spam-Score: 0.111 X-Spam-Level: X-Archive-Number: 200601/104 X-Sequence-Number: 14555 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