From 8c65a3071cd1b0a91fa7e365059c758941027f16 Mon Sep 17 00:00:00 2001 From: Bertil Chapuis Date: Tue, 14 Jan 2025 09:10:57 +0100 Subject: [PATCH] Generate different queries depending on the postgresql version (#914) - Generate different queries depending on the postgresql version - Caching is not needed anymore as String concatenation is faster than query parsing. --- .../java/org/apache/baremaps/cli/map/Dev.java | 3 +- .../org/apache/baremaps/cli/map/Serve.java | 3 +- .../baremaps/tasks/ExportVectorTiles.java | 14 ++- .../tilestore/postgres/PostgresTileStore.java | 110 ++++++++++++------ .../postgres/PostgresTileStoreTest.java | 29 ++++- .../postgres/utils/PostgresUtils.java | 13 +++ 6 files changed, 126 insertions(+), 46 deletions(-) diff --git a/baremaps-cli/src/main/java/org/apache/baremaps/cli/map/Dev.java b/baremaps-cli/src/main/java/org/apache/baremaps/cli/map/Dev.java index e44fcd434..e899dabee 100644 --- a/baremaps-cli/src/main/java/org/apache/baremaps/cli/map/Dev.java +++ b/baremaps-cli/src/main/java/org/apache/baremaps/cli/map/Dev.java @@ -87,6 +87,7 @@ public Integer call() throws Exception { var objectMapper = objectMapper(); var tileset = objectMapper.readValue(configReader.read(this.tilesetPath), Tileset.class); var datasource = PostgresUtils.createDataSourceFromObject(tileset.getDatabase()); + var postgresVersion = PostgresUtils.getPostgresVersion(datasource); var tilesetSupplier = (Supplier) () -> { try { @@ -99,7 +100,7 @@ public Integer call() throws Exception { var tileStoreSupplier = (Supplier>) () -> { var tileJSON = tilesetSupplier.get(); - return new PostgresTileStore(datasource, tileJSON); + return new PostgresTileStore(datasource, tileJSON, postgresVersion); }; var styleSupplier = (Supplier