From ed6355ceb8f67a61833be3b178663f1c9620d55a Mon Sep 17 00:00:00 2001 From: Emilio Lahr-Vivaz Date: Mon, 18 Sep 2023 19:06:45 +0000 Subject: [PATCH] GEOMESA-3294 Partitioned PostGIS - use default database schema if not specified --- .../postgis/PartitionedPostgisDataStoreFactory.scala | 7 +++++++ .../postgis/PartitionedPostgisDataStoreTest.scala | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/geomesa-gt/geomesa-gt-partitioning/src/main/scala/org/locationtech/geomesa/gt/partition/postgis/PartitionedPostgisDataStoreFactory.scala b/geomesa-gt/geomesa-gt-partitioning/src/main/scala/org/locationtech/geomesa/gt/partition/postgis/PartitionedPostgisDataStoreFactory.scala index d8eea4f256ba..05574c934414 100644 --- a/geomesa-gt/geomesa-gt-partitioning/src/main/scala/org/locationtech/geomesa/gt/partition/postgis/PartitionedPostgisDataStoreFactory.scala +++ b/geomesa-gt/geomesa-gt-partitioning/src/main/scala/org/locationtech/geomesa/gt/partition/postgis/PartitionedPostgisDataStoreFactory.scala @@ -50,6 +50,13 @@ class PartitionedPostgisDataStoreFactory extends PostgisNGDataStoreFactory with if (!params.containsKey(PreparedStatements.key)) { params.put(PreparedStatements.key, java.lang.Boolean.TRUE) } + // set default schema, if not specified - postgis store doesn't actually use its own default + if (!params.containsKey(PostgisNGDataStoreFactory.SCHEMA.key)) { + // need to set it in the store, as the key has already been processed + store.setDatabaseSchema("public") + // also set in the params for consistency, although it's not used anywhere + params.put(PostgisNGDataStoreFactory.SCHEMA.key, "public") + } val ds = super.createDataStoreInternal(store, params) val dialect = new PartitionedPostgisDialect(ds) diff --git a/geomesa-gt/geomesa-gt-partitioning/src/test/scala/org/locationtech/geomesa/gt/partition/postgis/PartitionedPostgisDataStoreTest.scala b/geomesa-gt/geomesa-gt-partitioning/src/test/scala/org/locationtech/geomesa/gt/partition/postgis/PartitionedPostgisDataStoreTest.scala index 7f2288e78b51..e25ba46c55e9 100644 --- a/geomesa-gt/geomesa-gt-partitioning/src/test/scala/org/locationtech/geomesa/gt/partition/postgis/PartitionedPostgisDataStoreTest.scala +++ b/geomesa-gt/geomesa-gt-partitioning/src/test/scala/org/locationtech/geomesa/gt/partition/postgis/PartitionedPostgisDataStoreTest.scala @@ -77,7 +77,6 @@ class PartitionedPostgisDataStoreTest extends Specification with BeforeAfterAll "dbtype" -> PartitionedPostgisDataStoreParams.DbType.sample, "host" -> host, "port" -> port, - "schema" -> schema, "database" -> "postgres", "user" -> "postgres", "passwd" -> "postgres",