Re: Problems with protocol V3 after migration to latest driver

From: Kris Jurka <books(at)ejurka(dot)com>
To: Alexey Yudichev <Alexey(at)francoudi(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Problems with protocol V3 after migration to latest driver
Date: 2004-10-26 17:33:23
Message-ID: Pine.BSO.4.56.0410261227101.24411@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Tue, 26 Oct 2004, Alexey Yudichev wrote:

> Ah, except that thing with "at time zone":
>
> select now() at time zone ('-02:00'::interval);
> works OK in psql console;
>
> but with JDBC
> select now() at time zone (?::interval)
> with setString(1, '-02:00')

Right, setString was recently changed from typing things as text to
varchar. This means you need (?::text::interval) now, at least for this
example on 7.4. Another solution would be to use the PGobject type
PGInterval via something like:

SELECT now() AT TIME ZONE ?

setObject(1, new org.postgresql.util.PGInterval("-02:00"));

I actually forget if this will work at the moment, but if not it will
eventually because of a patch from Oliver Jowett. This avoids the pg
specific cast in your sql code, but adds pg specific code at compile time.
I imagine it might be more future proof though.

Kris Jurka

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Jason Tesser 2004-10-27 12:55:18 using 8 bit ascii
Previous Message Kris Jurka 2004-10-26 17:26:39 Re: Problems with protocol V3 after migration to latest driver