0

Using this

  createdAt TIMESTAMP AS LocalDateTime NOT NULL,

compiles but the Adapter never converts from localdatetime to TIMESTAMP in postgres. Instead I receive

Exception in thread "AWT-EventQueue-0" org.postgresql.util.PSQLException: ERROR: column "createdat" is of type timestamp without time zone but expression is of type character varying
  Hint: You will need to rewrite or cast the expression.

I think this is a bug but I am asking here first to see if anybody has any ideas before submitting a bug report on github. Thanks.


   val localDatetimeColumnAdapter = object : ColumnAdapter<LocalDateTime,String> {
                override fun decode(databaseValue: String) =
            LocalDateTime.parse(databaseValue)
        override fun encode(value: LocalDateTime) = value.toString()


kotlin_version = 1.3.41
sqldelight_version = 1.5.0
hikari_cp_version = 4.0.3
postgresql_version = 42.2.20
BbopLifa
  • 131
  • 2
  • 5
  • I just tried with mysql and it works perfectly only with OffsetDateTime maybe I can save some people some time, my test shows that the postgres implementation in Sqldelight does not work with date times, only strings. – BbopLifa May 14 '21 at 22:02

1 Answers1

1

This appears to be identical to the issue submitted here.

veyndan
  • 382
  • 5
  • 9