pgjdbc: Error upgrading from 1209 to 1210
Today we attempted to upgrade from 1209 to 1210 (no other changes except the psql driver). We are using com.typesafe.play.anorm version 2.5.2
It appears something has changed in the psql driver with respect to extracting type information.
Any chance you all may be able to give us a pointer on how to upgrade? Included info below on error, table structure, and anorm parser.
Much appreciated!
anorm.AnormException: TypeDoesNotMatch(Column[ColumnName(applications.ports,Some(ports))] error converting [{"service":{"id":"svc02bac17cd6624e749087fd596211e988"},"external":12772,"internal":8080}]: class java.lang.String to Json)
registrydb=# \d applications
Table "public.applications"
Column | Type | Modifiers
--------------------+--------------------------+------------------------
id | text | not null
ports | json | not null
dependencies | json | not null
created_at | timestamp with time zone | not null default now()
updated_by_user_id | text | not null
select applications.id,
applications.ports,
applications.dependencies
from applications
private[this] def parser(
id: String = "id",
ports: String = "ports",
dependencies: String = "dependencies"
): RowParser[io.flow.registry.v0.models.Application] = {
SqlParser.str(id) ~
SqlParser.get[Seq[JsObject]](ports).? ~
SqlParser.get[Seq[JsObject]](dependencies).? map {
case id ~ ports ~ dependencies => {
io.flow.registry.v0.models.Application(
id = id,
ports = ports.getOrElse(Nil).map { _.as[Port] },
dependencies = dependencies.getOrElse(Nil).map { _.as[String] }
)
}
}
}
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 21 (11 by maintainers)
Commits related to this issue
- fix: json should be returned as PGObject, not as String for backward compatibility reasons (#640) fixes #639 — committed to zemian/pgjdbc by vlsi 8 years ago
Just in case: I’ve pushed a fix for json, and scala test works fine: https://travis-ci.org/pgjdbc/pgjdbc/jobs/160642403#L2844
Here’s Scala test: https://github.com/pgjdbc/pgjdbc/tree/master/test-anorm-sbt
PS. I’m fine with adding “checkout java.jdbc; mvn test” to regular pgjdbc test suite (see here: https://github.com/pgjdbc/pgjdbc/blob/master/.travis/travis_build.sh#L73-L76 )