Skip to content
This repository was archived by the owner on Dec 3, 2019. It is now read-only.
This repository was archived by the owner on Dec 3, 2019. It is now read-only.

Postgresql 9.5 Timestamp with time zone #240

Open
@ZenLiuCN

Description

@ZenLiuCN

I'm using vertx 3.5.0 with postgresqlasync_2.12:0.2.21
insert into postgresql with Instant.now(),after then sometimes will got

java.lang.IllegalArgumentException: Invalid format: "2017-12-22 10:19:38+08" is malformed at "+08"
	at org.joda.time.format.DateTimeFormatter.parseDateTime(DateTimeFormatter.java:945)
	at com.github.mauricio.async.db.postgresql.column.PostgreSQLTimestampEncoderDecoder$.decode(PostgreSQLTimestampEncoderDecoder.scala:71)
	at com.github.mauricio.async.db.postgresql.column.PostgreSQLColumnDecoderRegistry.decode(PostgreSQLColumnDecoderRegistry.scala:52)
	at com.github.mauricio.async.db.postgresql.PostgreSQLConnection.onDataRow(PostgreSQLConnection.scala:203)
	at com.github.mauricio.async.db.postgresql.codec.PostgreSQLConnectionHandler.channelRead0(PostgreSQLConnectionHandler.scala:203)
	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)

i think it's because Instant.now() is with zone have zero millseconds(like 2017-01-01T00:00:00+8)
finally
i use

fun String.toPgTimeParse():String="to_char($this at time zone 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS\"Z\"')"

to convert it before get from database

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions