问题描述
使用这个
createdAt TIMESTAMP AS LocalDateTime NOT NULL,
编译但适配器永远不会在 postgres 中从 localdatetime 转换为 TIMESTAMP。相反,我收到
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.
我认为这是一个错误,但我首先在这里询问是否有人在 github 上提交错误报告之前有任何想法。谢谢。
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
解决方法
这似乎与提交的问题 here 相同。