From a50604847b2972176442027f2e69b87b5cc9988f Mon Sep 17 00:00:00 2001 From: Jacob Wang Date: Mon, 18 Dec 2023 17:31:11 +0000 Subject: [PATCH] Upgrade postgis to 2023.1.0 / postgres-jdbc to 42.7.1 --- build.sbt | 9 ++++++--- .../main/mdoc/docs/15-Extensions-PostgreSQL.md | 2 +- .../doobie/postgres/free/kleisliinterpreter.scala | 2 ++ .../scala/doobie/postgres/free/largeobject.scala | 15 +++++++++++++-- .../doobie/postgres/pgisgeographyinstances.scala | 4 ++-- .../scala/doobie/postgres/pgisinstances.scala | 4 ++-- .../test/scala/doobie/postgres/TypesSuite.scala | 2 +- project/build.sbt | 2 +- 8 files changed, 28 insertions(+), 12 deletions(-) diff --git a/build.sbt b/build.sbt index 9f6d33dbc..d4b37b6eb 100644 --- a/build.sbt +++ b/build.sbt @@ -12,8 +12,8 @@ lazy val h2Version = "1.4.200" lazy val hikariVersion = "5.1.0" // N.B. Hikari v4 introduces a breaking change via slf4j v2 lazy val kindProjectorVersion = "0.11.2" lazy val log4catsVersion = "2.6.0" -lazy val postGisVersion = "2.5.1" -lazy val postgresVersion = "42.7.0" +lazy val postGisVersion = "2023.1.0" +lazy val postgresVersion = "42.7.1" lazy val refinedVersion = "0.11.0" lazy val scalaCheckVersion = "1.15.4" lazy val scalatestVersion = "3.2.17" @@ -88,6 +88,9 @@ lazy val compilerFlags = Seq( Test / scalacOptions --= Seq( "-Xfatal-warnings" ), +// scalacOptions ++= Seq( +// "-Xsource:3" +// ) ) lazy val buildSettings = Seq( @@ -313,7 +316,7 @@ lazy val postgres = project val xa = Transactor.fromDriverManager[IO](driver = "org.postgresql.Driver", url = "jdbc:postgresql:world", user = "postgres", pass = "password", logHandler = None) val yolo = xa.yolo import yolo._ - import org.postgis._ + import net.postgis._ import org.postgresql.util._ import org.postgresql.geometric._ """, diff --git a/modules/docs/src/main/mdoc/docs/15-Extensions-PostgreSQL.md b/modules/docs/src/main/mdoc/docs/15-Extensions-PostgreSQL.md index 78c65bde5..14b4bd1e7 100644 --- a/modules/docs/src/main/mdoc/docs/15-Extensions-PostgreSQL.md +++ b/modules/docs/src/main/mdoc/docs/15-Extensions-PostgreSQL.md @@ -188,7 +188,7 @@ It is expected that these will be mapped to application-specific types via `xmap ### PostGIS Types -**doobie** provides mappings for the top-level PostGIS geometric types provided by the `org.postgis` driver extension. +**doobie** provides mappings for the top-level PostGIS geometric types provided by the `net.postgis` driver extension. Mappings for postgis are provided in the `pgistypes` module. Doobie expects postgis dependency to be provided, so if you use this module you should add postgis as a dependency. diff --git a/modules/postgres/src/main/scala/doobie/postgres/free/kleisliinterpreter.scala b/modules/postgres/src/main/scala/doobie/postgres/free/kleisliinterpreter.scala index b4c2086d8..150c9e029 100644 --- a/modules/postgres/src/main/scala/doobie/postgres/free/kleisliinterpreter.scala +++ b/modules/postgres/src/main/scala/doobie/postgres/free/kleisliinterpreter.scala @@ -248,6 +248,7 @@ class KleisliInterpreter[M[_]](logHandler: LogHandler[M])(implicit val asyncM: W override def close: Kleisli[M, LargeObject, Unit] = primitive(_.close) override def copy: Kleisli[M, LargeObject, LargeObject] = primitive(_.copy) override def getInputStream: Kleisli[M, LargeObject, InputStream] = primitive(_.getInputStream) + override def getInputStream(a: Int, b: Long) = primitive(_.getInputStream(a, b)) override def getInputStream(a: Long) = primitive(_.getInputStream(a)) override def getLongOID: Kleisli[M, LargeObject, Long] = primitive(_.getLongOID) override def getOutputStream: Kleisli[M, LargeObject, OutputStream] = primitive(_.getOutputStream) @@ -264,6 +265,7 @@ class KleisliInterpreter[M[_]](logHandler: LogHandler[M])(implicit val asyncM: W override def truncate64(a: Long) = primitive(_.truncate64(a)) override def write(a: Array[Byte]) = primitive(_.write(a)) override def write(a: Array[Byte], b: Int, c: Int) = primitive(_.write(a, b, c)) + override def write(a: ByteStreamWriter) = primitive(_.write(a)) } diff --git a/modules/postgres/src/main/scala/doobie/postgres/free/largeobject.scala b/modules/postgres/src/main/scala/doobie/postgres/free/largeobject.scala index b81b197a5..358c11812 100644 --- a/modules/postgres/src/main/scala/doobie/postgres/free/largeobject.scala +++ b/modules/postgres/src/main/scala/doobie/postgres/free/largeobject.scala @@ -15,6 +15,7 @@ import scala.concurrent.duration.FiniteDuration import java.io.InputStream import java.io.OutputStream import org.postgresql.largeobject.LargeObject +import org.postgresql.util.ByteStreamWriter // This file is Auto-generated using FreeGen2.scala object largeobject { module => @@ -63,6 +64,7 @@ object largeobject { module => def close: F[Unit] def copy: F[LargeObject] def getInputStream: F[InputStream] + def getInputStream(a: Int, b: Long): F[InputStream] def getInputStream(a: Long): F[InputStream] def getLongOID: F[Long] def getOutputStream: F[OutputStream] @@ -79,6 +81,7 @@ object largeobject { module => def truncate64(a: Long): F[Unit] def write(a: Array[Byte]): F[Unit] def write(a: Array[Byte], b: Int, c: Int): F[Unit] + def write(a: ByteStreamWriter): F[Unit] } @@ -139,7 +142,10 @@ object largeobject { module => case object GetInputStream extends LargeObjectOp[InputStream] { def visit[F[_]](v: Visitor[F]) = v.getInputStream } - final case class GetInputStream1(a: Long) extends LargeObjectOp[InputStream] { + final case class GetInputStream1(a: Int, b: Long) extends LargeObjectOp[InputStream] { + def visit[F[_]](v: Visitor[F]) = v.getInputStream(a, b) + } + final case class GetInputStream2(a: Long) extends LargeObjectOp[InputStream] { def visit[F[_]](v: Visitor[F]) = v.getInputStream(a) } case object GetLongOID extends LargeObjectOp[Long] { @@ -187,6 +193,9 @@ object largeobject { module => final case class Write1(a: Array[Byte], b: Int, c: Int) extends LargeObjectOp[Unit] { def visit[F[_]](v: Visitor[F]) = v.write(a, b, c) } + final case class Write2(a: ByteStreamWriter) extends LargeObjectOp[Unit] { + def visit[F[_]](v: Visitor[F]) = v.write(a) + } } import LargeObjectOp._ @@ -217,7 +226,8 @@ object largeobject { module => val close: LargeObjectIO[Unit] = FF.liftF(Close) val copy: LargeObjectIO[LargeObject] = FF.liftF(Copy) val getInputStream: LargeObjectIO[InputStream] = FF.liftF(GetInputStream) - def getInputStream(a: Long): LargeObjectIO[InputStream] = FF.liftF(GetInputStream1(a)) + def getInputStream(a: Int, b: Long): LargeObjectIO[InputStream] = FF.liftF(GetInputStream1(a, b)) + def getInputStream(a: Long): LargeObjectIO[InputStream] = FF.liftF(GetInputStream2(a)) val getLongOID: LargeObjectIO[Long] = FF.liftF(GetLongOID) val getOutputStream: LargeObjectIO[OutputStream] = FF.liftF(GetOutputStream) def read(a: Array[Byte], b: Int, c: Int): LargeObjectIO[Int] = FF.liftF(Read(a, b, c)) @@ -233,6 +243,7 @@ object largeobject { module => def truncate64(a: Long): LargeObjectIO[Unit] = FF.liftF(Truncate64(a)) def write(a: Array[Byte]): LargeObjectIO[Unit] = FF.liftF(Write(a)) def write(a: Array[Byte], b: Int, c: Int): LargeObjectIO[Unit] = FF.liftF(Write1(a, b, c)) + def write(a: ByteStreamWriter): LargeObjectIO[Unit] = FF.liftF(Write2(a)) // Typeclass instances for LargeObjectIO implicit val WeakAsyncLargeObjectIO: WeakAsync[LargeObjectIO] = diff --git a/modules/postgres/src/main/scala/doobie/postgres/pgisgeographyinstances.scala b/modules/postgres/src/main/scala/doobie/postgres/pgisgeographyinstances.scala index 000b08525..4f449587a 100644 --- a/modules/postgres/src/main/scala/doobie/postgres/pgisgeographyinstances.scala +++ b/modules/postgres/src/main/scala/doobie/postgres/pgisgeographyinstances.scala @@ -6,8 +6,8 @@ package doobie.postgres import doobie._ import doobie.util.invariant._ - -import org.postgis._ +import net.postgis.jdbc.PGgeography +import net.postgis.jdbc.geometry._ import scala.reflect.ClassTag import org.tpolecat.typename._ diff --git a/modules/postgres/src/main/scala/doobie/postgres/pgisinstances.scala b/modules/postgres/src/main/scala/doobie/postgres/pgisinstances.scala index e0374a30a..816893820 100644 --- a/modules/postgres/src/main/scala/doobie/postgres/pgisinstances.scala +++ b/modules/postgres/src/main/scala/doobie/postgres/pgisinstances.scala @@ -6,8 +6,8 @@ package doobie.postgres import doobie._ import doobie.util.invariant._ - -import org.postgis._ +import net.postgis.jdbc.{PGbox2d, PGbox3d, PGgeometry} +import net.postgis.jdbc.geometry._ import scala.reflect.ClassTag import org.tpolecat.typename._ diff --git a/modules/postgres/src/test/scala/doobie/postgres/TypesSuite.scala b/modules/postgres/src/test/scala/doobie/postgres/TypesSuite.scala index 5aaca9671..2953d2c63 100644 --- a/modules/postgres/src/test/scala/doobie/postgres/TypesSuite.scala +++ b/modules/postgres/src/test/scala/doobie/postgres/TypesSuite.scala @@ -17,7 +17,7 @@ import doobie.postgres.pgisimplicits._ import doobie.postgres.util.arbitraries.SQLArbitraries._ import doobie.postgres.util.arbitraries.TimeArbitraries._ import doobie.util.arbitraries.StringArbitraries._ -import org.postgis._ +import net.postgis.jdbc.geometry._ import org.postgresql.geometric._ import org.postgresql.util._ import org.scalacheck.Arbitrary diff --git a/project/build.sbt b/project/build.sbt index 41aa4559e..d2285f90b 100644 --- a/project/build.sbt +++ b/project/build.sbt @@ -1,3 +1,3 @@ // Required for the freegen definition for postgres in ../build.sbt -val postgresVersion = "42.7.0" +val postgresVersion = "42.7.1" libraryDependencies += "org.postgresql" % "postgresql" % postgresVersion