Skip to content

Commit

Permalink
Merge pull request #1962 from tpolecat/upgrade_postgres_postgis
Browse files Browse the repository at this point in the history
Upgrade postgis to 2023.1.0 / postgres-jdbc to 42.7.1
  • Loading branch information
jatcwang committed Dec 19, 2023
2 parents 9fa2f52 + a506048 commit 4ad7f3e
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 18 deletions.
20 changes: 15 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import FreeGen2.*
import FreeGen2._
import sbt.dsl.LinterLevel.Ignore

import scala.annotation.nowarn
import scala.sys.process.*
import scala.sys.process._

// Library versions all in one place, for convenience and sanity.
lazy val catsVersion = "2.10.0"
Expand All @@ -12,8 +13,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"
Expand Down Expand Up @@ -88,6 +89,9 @@ lazy val compilerFlags = Seq(
Test / scalacOptions --= Seq(
"-Xfatal-warnings"
),
// scalacOptions ++= Seq(
// "-Xsource:3"
// )
)

lazy val buildSettings = Seq(
Expand Down Expand Up @@ -203,6 +207,12 @@ lazy val free = project
classOf[java.sql.ResultSet]
)
},
freeGen2KleisliInterpreterImportExcludes := Set[Class[_]](
classOf[java.util.Map[_, _]],
classOf[java.sql.DriverPropertyInfo],
classOf[java.io.Writer],
classOf[java.io.OutputStream]
)
)


Expand Down Expand Up @@ -313,7 +323,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._
""",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ import scala.concurrent.duration.FiniteDuration

// Types referenced in the JDBC API
import java.io.InputStream
import java.io.OutputStream
import java.io.Reader
import java.io.Writer
import java.lang.Class
import java.lang.String
import java.math.BigDecimal
Expand All @@ -30,7 +28,6 @@ import java.sql.Connection
import java.sql.DatabaseMetaData
import java.sql.Date
import java.sql.Driver
import java.sql.DriverPropertyInfo
import java.sql.NClob
import java.sql.ParameterMetaData
import java.sql.PreparedStatement
Expand All @@ -53,7 +50,6 @@ import java.sql.Time
import java.sql.Timestamp
import java.sql.{ Array => SqlArray }
import java.util.Calendar
import java.util.Map
import java.util.Properties
import java.util.concurrent.Executor
import java.util.logging.Logger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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))

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =>
Expand Down Expand Up @@ -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]
Expand All @@ -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]

}

Expand Down Expand Up @@ -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] {
Expand Down Expand Up @@ -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._
Expand Down Expand Up @@ -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))
Expand All @@ -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] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion project/build.sbt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 4ad7f3e

Please sign in to comment.