Re: Failure in timestamptz of JDBC of 7.2b4 - Mailing list pgsql-jdbc

From Barry Lind
Subject Re: Failure in timestamptz of JDBC of 7.2b4
Date
Msg-id 3C43D250.9000402@xythos.com
Whole thread Raw
In response to Failure in timestamptz of JDBC of 7.2b4  (Ryouichi Matsuda <r-matuda@sra.co.jp>)
List pgsql-jdbc
Ryouichi,

I have applied the patch for this bug.  The fix won't be in 7.2b5, but
will be in 7.2RC1.  It will also be in the latest builds on the
jdbc.postgresql.org website.

thanks,
--Barry


Ryouichi Matsuda wrote:

> Barry Lind wrote:
>
>
>>select 'now'::timestamp;
>>select 'now'::timestamptz;
>>select 'now'::timestamp with time zone;
>>
>>These all seem to work correctly for me.
>>
>
> When I executed SQL in <<example.psql>>, exception occurred.
> In an approach by a getTimestamp() method, exception does not occur.
>
>     Statement st = db.createStatement();
>     ResultSet rs = st.executeQuery("SELECT 'now'::timestamp");
>     rs.next();
>     Timestamp ts = rs.getTimestamp(1);
>     System.out.println(ts);
>
>
> But, in an approach by a getObject() method, exception occurs.
>
>     Statement st = db.createStatement();
>     ResultSet rs = st.executeQuery("SELECT 'now'::timestamp");
>     rs.next();
>     Timestamp ts = (Timestamp)rs.getObject(1);
>     System.out.println(ts);
>
> Because a displayResult() method of 'example/psql.java' uses
> getObject(), exception of 'No class found for timestamptz' occurs.
> The patch which I attached to a former mail corrects this error.
>
>
>
>>Then however I did try your last query:
>>
>>select 'now'::timestamp without time zone;
>>
>>and this does fail for me with the string index out of bounds exception.
>>  However the patch you sent does not seem to fix this error.  And I
>>really don't know what to do with this datatype, since jdbc does not
>>have a corresponding datatype that doesn't contain timezone information.
>>
>
> My patch does not correct this error. It is difficult for me to
> correct this error justly, but I try to think.
>
>
> In addition, I found an error of time type.
>
>     Statement st = db.createStatement();
>     ResultSet rs = st.executeQuery("SELECT 'now'::time");
>     rs.next();
>     Time t = rs.getTime(1);
>     System.out.println(t);
>
> This becomes string index out of bounds exception.
>
>



pgsql-jdbc by date:

Previous
From: Barry Lind
Date:
Subject: Re: FW: LISTEN/NOTIFY support in JDBC driver?
Next
From: Ryouichi Matsuda
Date:
Subject: Re: bug in PreparedStatement of JDBC in 7.2b4