pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
From: guyco33 (@guyco33) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: Re: [pgjdbc/pgjdbc] issue #1225: Java 8 Time Support for Postgres Arrays
Date: Tue, 30 Jul 2019 08:06:25 +0000
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

I've also encountered similar issue with `timestamp[]`:
```
create table test_ts(ts_col timestamp, ts_arr_col timestamp[]);

insert into test_ts values (
      '1970-01-01 00:12:34.567'::timestamp, 
array['1970-01-01 00:12:34.567'::timestamp]);

select * from public.test_ts;
         ts_col          |         ts_arr_col
-------------------------+-----------------------------
 1970-01-01 00:12:34.567 | {"1970-01-01 00:12:34.567"}
(1 row)
```

`rs.getTimestamp("ts_col"));`  --> 1970-01-01 01:12:34.567 (wrong value)
`rs.getObject("ts_col", LocalDateTime.class);` --> 1970-01-01T00:12:34.567

`Array.get(rs.getArray("ts_arr_col").getArray(),0));`  --> 1970-01-01 01:12:34.567   (wrong value)
`Array.get(rs.getArray("ts_arr_col").getArray(),0).getClass()` --> class `java.sql.Timestamp`

As you can see, it's not possible to retrieve the correct value from `timestamp[]`, since there is no way to use `java.time.LocalDateTime` 





view thread (16+ messages)  latest in thread

reply

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 using the --to and --cc options:
  reply via email

  To: github://pgjdbc/pgjdbc
  Cc: [email protected], [email protected]
  Subject: Re: [pgjdbc/pgjdbc] issue #1225: Java 8 Time Support for Postgres Arrays
  In-Reply-To: <<[email protected]>>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox