Sqldelight and Postgres Column Adapter for Timestamp

946 Views Asked by At

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
1

There are 1 best solutions below

0
On

This appears to be identical to the issue submitted here.