mauricio / postgresql-async

Async, Netty based, database drivers for PostgreSQL and MySQL written in Scala
Apache License 2.0
1.43k stars 222 forks source link

Timestamp encoding with BC dates #248

Open cornerman opened 6 years ago

cornerman commented 6 years ago

When having a LocalDateTime with a negative year, this is encoded as a date string with a negative year (sign in front of the year number). But this throws an SQL-Error ErrorMessage(fields=Map(Line -> 3793, File -> datetime.c, SQLSTATE -> 22009, Routine -> DateTimeParseError, V -> ERROR, Message -> time zone displacement out of range: "-4713-01-01 00:53:28.000000", Severity -> ERROR)).

For postgres, negative years need to be encoded with a BC postfix after date string instead.