# JDBC Input set jdbc\_default\_timezone loses precision

**URL:** <https://discuss.elastic.co/t/jdbc-input-set-jdbc-default-timezone-loses-precision/139408>\
**Category:** Logstash\
**Created:** [July 10, 2018, 5:25pm UTC](https://discuss.elastic.co/t/jdbc-input-set-jdbc-default-timezone-loses-precision/139408 "2018-07-10T17:25:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![skatemple](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@skatemple](https://discuss.elastic.co/u/skatemple)\
**Post date:** [July 10, 2018, 5:25pm UTC](https://discuss.elastic.co/t/jdbc-input-set-jdbc-default-timezone-loses-precision/139408/1 "2018-07-10T17:25:32Z")

</div>

So I'm facing a duplicate info issue because of a malformed SQL query on JDBC input type.

I saw this issue ([https://github.com/logstash-plugins/logstash-input-jdbc/issues/140](https://github.com/logstash-plugins/logstash-input-jdbc/issues/140)) but I'm still getting that bug.

The last sql value is saved like this:

```
# cat "/usr/share/logstash/jdbc_last_run/.logstash_jdbc_last_run_AffiliateTransactionConversionDate"
--- !ruby/object:DateTime '2018-07-10 13:19:02.466835200 -04:00'

```

And the query is executed like this:

```
[2018-07-10T13:20:07,327][INFO][logstash.inputs.jdbc] (3.676289s) SELECT * FROM SELECT.... FROM [Transaction] T (NOLOCK) WHERE T.conversionDate > '2018-07-10T17:19:02.466') AS [T1] ORDER BY 1 OFFSET 0 ROWS FETCH NEXT 20000 ROWS ONLY

```

As you see, the precision is truncated to 3 digits after seconds, while the saved value has 7 digits (in fact it has 9 but last two are always 00). The row in MSSQL has also 7 digits after the seconds.

This is a big problem because it leads to duplicated info.

Am I doing something wrong? Is there any way to get this fixed?

Best regards,  
Salvador Aguallo

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 11, 2018, 6:14am UTC](https://discuss.elastic.co/t/jdbc-input-set-jdbc-default-timezone-loses-precision/139408/2 "2018-07-11T06:14:01Z")

</div>

Elasticsearch only supports millisecond precision for timestamps, which could explain what you are seeing.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 8, 2018, 6:22am UTC](https://discuss.elastic.co/t/jdbc-input-set-jdbc-default-timezone-loses-precision/139408/3 "2018-08-08T06:22:03Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
