[Git][debian-gis-team/osm2pgsql][master] 5 commits: New upstream version 2.0.1+ds

Bas Couwenberg (@sebastic) gitlab at salsa.debian.org
Tue Dec 3 06:01:26 GMT 2024



Bas Couwenberg pushed to branch master at Debian GIS Project / osm2pgsql


Commits:
4224f490 by Bas Couwenberg at 2024-12-03T06:41:05+01:00
New upstream version 2.0.1+ds
- - - - -
2640ad48 by Bas Couwenberg at 2024-12-03T06:41:07+01:00
Update upstream source from tag 'upstream/2.0.1+ds'

Update to upstream version '2.0.1+ds'
with Debian dir fbfdd90091cfa7bdce8b935d1e586d682350c373
- - - - -
68014564 by Bas Couwenberg at 2024-12-03T06:41:18+01:00
New upstream release.

- - - - -
49064e7b by Bas Couwenberg at 2024-12-03T06:54:19+01:00
Update lintian overrides.

- - - - -
5c53b8b6 by Bas Couwenberg at 2024-12-03T06:54:19+01:00
Set distribution to unstable.

- - - - -


18 changed files:

- .github/workflows/ci.yml
- CMakeLists.txt
- README.md
- debian/changelog
- debian/lintian-overrides
- man/CMakeLists.txt
- man/osm2pgsql-gen.1
- man/osm2pgsql-replication.1
- man/osm2pgsql.1
- scripts/osm2pgsql-replication
- src/middle-pgsql.cpp
- src/osmdata.cpp
- src/osmdata.hpp
- src/pgsql-params.hpp
- + tests/bdd/command-line/replication_schema.feature
- tests/common-import.hpp
- tests/common-options.hpp
- tests/test-output-flex-update.cpp


Changes:

=====================================
.github/workflows/ci.yml
=====================================
@@ -3,50 +3,6 @@ name: CI
 on: [ push, pull_request ]
 
 jobs:
-  macos:
-    strategy:
-      fail-fast: false
-      matrix:
-        os:
-          - "macos-13"
-          - "macos-14" # latest
-    runs-on: ${{ matrix.os }}
-
-    env:
-      LUA_VERSION: 5.4
-
-    steps:
-      - uses: actions/checkout at v4
-
-      - name: Install prerequisites
-        run: |
-          # Workaround for github/brew problem. Python is already install
-          # on the Github action runner and then homebrew comes along...
-          # See also: https://github.com/Homebrew/homebrew-core/issues/173191
-          rm -f /usr/local/bin/2to3* /usr/local/bin/idle3* /usr/local/bin/pydoc3* /usr/local/bin/python3*
-          brew install boost lua nlohmann-json opencv pandoc postgis potrace python3
-          # --break-system-packages is needed on macOS 14
-          pip3 install --break-system-packages psycopg2 behave osmium
-          mkdir ~/postgres
-          pg_ctl -D ~/postgres init
-          pg_ctl -D ~/postgres start
-        shell: bash
-
-      - name: Setup database
-        run: |
-          psql -d postgres -c 'CREATE EXTENSION postgis'
-          psql -d postgres -c 'CREATE EXTENSION hstore'
-          psql -d postgres -c 'SELECT PostGIS_Full_Version()'
-          mkdir -m 700 $GITHUB_WORKSPACE/tablespacetest
-          psql -d postgres -c "CREATE TABLESPACE tablespacetest LOCATION '$GITHUB_WORKSPACE/tablespacetest'"
-        shell: bash
-
-      - uses: ./.github/actions/linux-cmake
-      - uses: ./.github/actions/build-and-test
-        with:
-          test-wrapper: ''
-        env:
-          PGHOST: /tmp
 
   ubuntu20-pg96-gcc10-jit:
     runs-on: ubuntu-20.04


=====================================
CMakeLists.txt
=====================================
@@ -1,7 +1,7 @@
 
 cmake_minimum_required(VERSION 3.8.0)
 
-project(osm2pgsql VERSION 2.0.0 LANGUAGES CXX C)
+project(osm2pgsql VERSION 2.0.1 LANGUAGES CXX C)
 
 set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
 
@@ -330,7 +330,6 @@ if (ENABLE_INSTALL)
     install(FILES default.style empty.style DESTINATION share/osm2pgsql)
     install(PROGRAMS scripts/osm2pgsql-replication DESTINATION bin)
     if (BUILD_GEN)
-        install(TARGETS osm2pgsql-gen COMPONENT gen EXCLUDE_FROM_ALL DESTINATION bin)
-        add_custom_target(install-gen cmake --install ${CMAKE_BINARY_DIR} --component gen)
+        install(TARGETS osm2pgsql-gen DESTINATION bin)
     endif()
 endif()


=====================================
README.md
=====================================
@@ -150,12 +150,6 @@ The compiled files can be installed with
 sudo make install
 ```
 
-To install the experimental `osm2pgsql-gen` binary use
-
-```sh
-sudo make install-gen
-```
-
 By default, the Release build with debug info is created and no tests are
 compiled. You can change that behavior by using additional options like
 following:


=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+osm2pgsql (2.0.1+ds-1) unstable; urgency=medium
+
+  * New upstream release.
+  * Update lintian overrides.
+
+ -- Bas Couwenberg <sebastic at debian.org>  Tue, 03 Dec 2024 06:42:17 +0100
+
 osm2pgsql (2.0.0+ds-1) unstable; urgency=medium
 
   * New upstream release.


=====================================
debian/lintian-overrides
=====================================
@@ -2,5 +2,5 @@
 spelling-error-in-binary lon long *
 
 # False positive
-groff-message * warning: cannot select font 'V' [usr/share/man/man1/osm2pgsql.1.gz:*]
+groff-message * warning: cannot select font 'V' [*]
 


=====================================
man/CMakeLists.txt
=====================================
@@ -65,6 +65,6 @@ if(ENABLE_INSTALL)
     install(FILES osm2pgsql.1 DESTINATION share/man/man1)
     install(FILES osm2pgsql-replication.1 DESTINATION share/man/man1)
     if (BUILD_GEN)
-        install(FILES osm2pgsql-gen.1 COMPONENT gen EXCLUDE_FROM_ALL DESTINATION share/man/man1)
+        install(FILES osm2pgsql-gen.1 DESTINATION share/man/man1)
     endif()
 endif()


=====================================
man/osm2pgsql-gen.1
=====================================
@@ -1,4 +1,4 @@
-.TH "OSM2PGSQL" "1" "2.0.0" "" ""
+.TH "OSM2PGSQL" "1" "2.0.1" "" ""
 .SH NAME
 .PP
 osm2pgsql-gen - Generalize OpenStreetMap data - EXPERIMENTAL!


=====================================
man/osm2pgsql-replication.1
=====================================
@@ -1,4 +1,4 @@
-.TH "OSM2PGSQL-REPLICATION" "1" "2.0.0" "" ""
+.TH "OSM2PGSQL-REPLICATION" "1" "2.0.1" "" ""
 .SH NAME
 osm2pgsql-replication \- osm2pgsql database updater
 .SH SYNOPSIS


=====================================
man/osm2pgsql.1
=====================================
@@ -1,4 +1,4 @@
-.TH "OSM2PGSQL" "1" "2.0.0" "" ""
+.TH "OSM2PGSQL" "1" "2.0.1" "" ""
 .SH NAME
 .PP
 osm2pgsql - OpenStreetMap data to PostgreSQL converter


=====================================
scripts/osm2pgsql-replication
=====================================
@@ -111,8 +111,8 @@ class DBError(Exception):
 
 class DBConnection:
 
-    def __init__(self, args):
-        self.schema = args.middle_schema
+    def __init__(self, schema, args):
+        self.schema = schema
 
         # If dbname looks like a conninfo string use it as such
         if args.database and any(part in args.database for part in ['=', '://']):
@@ -535,8 +535,10 @@ def update(props, args):
 
     osm2pgsql = [args.osm2pgsql_cmd, '--append', '--slim', '--prefix', args.prefix]
     osm2pgsql.extend(args.extra_params)
-    if args.middle_schema != 'public':
+    if args.middle_schema:
         osm2pgsql.extend(('--middle-schema', args.middle_schema))
+    if args.schema:
+        osm2pgsql.extend(('--schema', args.schema))
     if args.database:
         osm2pgsql.extend(('-d', args.database))
     if args.username:
@@ -717,16 +719,16 @@ def main(prog_args=None):
                         datefmt='%Y-%m-%d %H:%M:%S',
                         level=max(4 - args.verbose, 1) * 10)
 
-    args.middle_schema = args.middle_schema or args.schema or 'public'
+    prop_table_schema = args.middle_schema or args.schema or 'public'
 
-    with DBConnection(args) as db:
+    with DBConnection(prop_table_schema, args) as db:
         if db.table_exists(Osm2pgsqlProperties.PROP_TABLE_NAME):
             props = Osm2pgsqlProperties(db)
         else:
             props = LegacyProperties(db, args.prefix)
 
         if not props.is_updatable:
-            LOG.fatal(f'osm2pgsql middle table "{args.middle_schema}.{args.prefix}_ways" not found in database "{db.name}". '
+            LOG.fatal(f'osm2pgsql middle table "{prop_table_schema}.{args.prefix}_ways" not found in database "{db.name}". '
                        'Database needs to be imported in --slim mode.')
             return 1
 


=====================================
src/middle-pgsql.cpp
=====================================
@@ -659,7 +659,7 @@ void middle_pgsql_t::get_node_parents(idlist_t const &changed_nodes,
     // better to do a full table scan which totally destroys performance.
     // This is due to the PostgreSQL statistics on ARRAYs being way off.
     queries.emplace_back(R"(
-CREATE OR REPLACE FUNCTION osm2pgsql_find_changed_ways() RETURNS void AS $$
+CREATE OR REPLACE FUNCTION {schema}osm2pgsql_find_changed_ways() RETURNS void AS $$
 DECLARE
   changed_buckets RECORD;
 BEGIN
@@ -677,8 +677,8 @@ BEGIN
 END;
 $$ LANGUAGE plpgsql
 )");
-    queries.emplace_back("SELECT osm2pgsql_find_changed_ways()");
-    queries.emplace_back("DROP FUNCTION osm2pgsql_find_changed_ways()");
+    queries.emplace_back("SELECT {schema}osm2pgsql_find_changed_ways()");
+    queries.emplace_back("DROP FUNCTION {schema}osm2pgsql_find_changed_ways()");
 
     queries.emplace_back(R"(
 INSERT INTO osm2pgsql_changed_relations


=====================================
src/osmdata.cpp
=====================================
@@ -432,10 +432,16 @@ void osmdata_t::process_dependents()
     proc.process_relations_stage1c(std::move(rels_pending_tracker));
 }
 
-void osmdata_t::reprocess_marked() const { m_output->reprocess_marked(); }
-
-void osmdata_t::postprocess_database() const
+void osmdata_t::stop()
 {
+    if (m_append) {
+        process_dependents();
+    }
+
+    // Run stage 2 processing: Reprocess objects marked in stage 1 (if any).
+    m_output->reprocess_marked();
+
+    // Run postprocessing on database: Clustering and index creation.
     m_output->free_middle_references();
 
     if (m_droptemp) {
@@ -458,14 +464,3 @@ void osmdata_t::postprocess_database() const
     m_mid->wait();
     m_output->wait();
 }
-
-void osmdata_t::stop()
-{
-    if (m_append) {
-        process_dependents();
-    }
-
-    reprocess_marked();
-
-    postprocess_database();
-}


=====================================
src/osmdata.hpp
=====================================
@@ -76,16 +76,6 @@ private:
      */
     void process_dependents();
 
-    /**
-     * Run stage 2 processing: Reprocess objects marked in stage 1 (if any).
-     */
-    void reprocess_marked() const;
-
-    /**
-     * Run postprocessing on database: Clustering and index creation.
-     */
-    void postprocess_database() const;
-
     /**
      * In append mode all new and changed nodes will be added to this. After
      * all nodes are read this is used to figure out which parent ways and


=====================================
src/pgsql-params.hpp
=====================================
@@ -34,6 +34,13 @@ public:
 
     auto end() const noexcept { return m_params.end(); }
 
+    void merge_with(connection_params_t const &other)
+    {
+        for (auto const &p : other.m_params) {
+            m_params[p.first] = p.second;
+        }
+    }
+
 private:
     std::map<std::string, std::string> m_params;
 


=====================================
tests/bdd/command-line/replication_schema.feature
=====================================
@@ -0,0 +1,68 @@
+Feature: Tests for the osm2pgsql-replication script with schemas
+
+    Scenario: Replication updates work on database with schema
+        Given the input file 'liechtenstein-2013-08-03.osm.pbf'
+        And the database schema foobar
+        And the replication service at http://example.com/europe/liechtenstein-updates
+            | sequence | timestamp            |
+            | 9999999  | 2013-08-01T01:00:02Z |
+            | 10000000 | 2013-09-01T01:00:00Z |
+            | 10000001 | 2013-10-01T01:00:00Z |
+        When running osm2pgsql pgsql with parameters
+            | --slim | --schema | foobar |
+        And running osm2pgsql-replication
+            | init | --schema | foobar |
+        And running osm2pgsql-replication
+            | update | --schema | foobar |
+
+        Then table foobar.osm2pgsql_properties contains
+            | property                    | value                                           |
+            | replication_base_url        | http://example.com/europe/liechtenstein-updates |
+            | replication_sequence_number | 10000001                                        |
+            | replication_timestamp       | 2013-10-01T01:00:00Z                            |
+
+
+    Scenario: Replication updates work on database with different middle schema
+        Given the input file 'liechtenstein-2013-08-03.osm.pbf'
+        And the database schema foobar
+        And the replication service at http://example.com/europe/liechtenstein-updates
+            | sequence | timestamp            |
+            | 9999999  | 2013-08-01T01:00:02Z |
+            | 10000000 | 2013-09-01T01:00:00Z |
+            | 10000001 | 2013-10-01T01:00:00Z |
+        When running osm2pgsql pgsql with parameters
+            | --slim | --middle-schema | foobar |
+        And running osm2pgsql-replication
+            | init | --middle-schema | foobar |
+        And running osm2pgsql-replication
+            | update | --middle-schema | foobar |
+
+        Then table foobar.osm2pgsql_properties contains
+            | property                    | value                                           |
+            | replication_base_url        | http://example.com/europe/liechtenstein-updates |
+            | replication_sequence_number | 10000001                                        |
+            | replication_timestamp       | 2013-10-01T01:00:00Z                            |
+
+
+    Scenario: Replication updates work on database with middle schema different from schema
+        Given the input file 'liechtenstein-2013-08-03.osm.pbf'
+        And the database schema foobar
+        And the database schema baz
+        And the replication service at http://example.com/europe/liechtenstein-updates
+            | sequence | timestamp            |
+            | 9999999  | 2013-08-01T01:00:02Z |
+            | 10000000 | 2013-09-01T01:00:00Z |
+            | 10000001 | 2013-10-01T01:00:00Z |
+        When running osm2pgsql pgsql with parameters
+            | --slim | --middle-schema | foobar | --schema | baz |
+        And running osm2pgsql-replication
+            | init | --middle-schema | foobar | --schema | baz |
+        And running osm2pgsql-replication
+            | update | --middle-schema | foobar | --schema | baz |
+
+        Then table foobar.osm2pgsql_properties contains
+            | property                    | value                                           |
+            | replication_base_url        | http://example.com/europe/liechtenstein-updates |
+            | replication_sequence_number | 10000001                                        |
+            | replication_timestamp       | 2013-10-01T01:00:00Z                            |
+


=====================================
tests/common-import.hpp
=====================================
@@ -131,7 +131,7 @@ public:
                     std::initializer_list<std::string> input_data,
                     std::string const &format = "opl")
     {
-        options.connection_params = m_db.connection_params();
+        options.connection_params.merge_with(m_db.connection_params());
 
         properties_t const properties{options.connection_params,
                                       options.middle_dbschema};
@@ -165,7 +165,7 @@ public:
 
     void run_file(options_t options, char const *file = nullptr)
     {
-        options.connection_params = m_db.connection_params();
+        options.connection_params.merge_with(m_db.connection_params());
 
         properties_t const properties{options.connection_params,
                                       options.middle_dbschema};


=====================================
tests/common-options.hpp
=====================================
@@ -89,6 +89,21 @@ public:
         return *this;
     }
 
+    opt_t &schema(char const *schema_name)
+    {
+        m_opt.dbschema = schema_name;
+        m_opt.middle_dbschema = schema_name;
+        m_opt.output_dbschema = schema_name;
+        return *this;
+    }
+
+    opt_t &user(char const *user, char const *password)
+    {
+        m_opt.connection_params.set("user", user);
+        m_opt.connection_params.set("password", password);
+        return *this;
+    }
+
 private:
     options_t m_opt;
 };


=====================================
tests/test-output-flex-update.cpp
=====================================
@@ -11,6 +11,7 @@
 
 #include "common-import.hpp"
 #include "common-options.hpp"
+#include "common-pg.hpp"
 
 namespace {
 
@@ -38,8 +39,50 @@ struct options_slim_expire
     }
 };
 
+struct options_slim_schema
+{
+    static options_t options()
+    {
+        auto conn = db.db().connect();
+        // Create limited user (if it doesn't exist yet),
+        // which we need to test that the public schema won't be touched.
+        // If the public schema is tried to be modified at any point, this user won't have the
+        // necessary permissions, and hence the test will fail.
+        conn.exec(R"(
+DO
+$$
+BEGIN
+   IF NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname = 'limited') THEN
+      CREATE ROLE limited LOGIN PASSWORD 'password_limited';
+   END IF;
+END
+$$;
+                  )");
+        conn.exec("REVOKE ALL PRIVILEGES ON ALL TABLES IN SCHEMA public FROM "
+                  "PUBLIC, limited;");
+        conn.exec("REVOKE CREATE ON SCHEMA public FROM PUBLIC, limited;");
+        conn.exec(
+            "CREATE SCHEMA IF NOT EXISTS myschema AUTHORIZATION limited;");
+        conn.close();
+        return testing::opt_t()
+            .slim()
+            .flex(conf_file)
+            .schema("myschema")
+            .user("limited", "password_limited");
+    }
+};
+
+// Return a string with the schema name prepended to the table name.
+std::string with_schema(char const *table_name, options_t const &options)
+{
+    if (options.dbschema.empty()) {
+        return {table_name};
+    }
+    return options.dbschema + "." + table_name;
+}
+
 TEMPLATE_TEST_CASE("updating a node", "", options_slim_default,
-                   options_slim_expire)
+                   options_slim_expire, options_slim_schema)
 {
     options_t options = TestType::options();
 
@@ -48,16 +91,16 @@ TEMPLATE_TEST_CASE("updating a node", "", options_slim_default,
 
     auto conn = db.db().connect();
 
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_point"));
+    REQUIRE(0 == conn.get_count(with_schema("osm2pgsql_test_point", options)));
 
     // give the node a tag...
     options.append = true;
     REQUIRE_NOTHROW(
         db.run_import(options, "n10 v2 dV x10 y10 Tamenity=restaurant\n"));
 
-    REQUIRE(1 == conn.get_count("osm2pgsql_test_point"));
+    REQUIRE(1 == conn.get_count(with_schema("osm2pgsql_test_point", options)));
     REQUIRE(1 ==
-            conn.get_count("osm2pgsql_test_point",
+            conn.get_count(with_schema("osm2pgsql_test_point", options),
                            "node_id = 10 AND tags->'amenity' = 'restaurant'"));
 
     SECTION("remove the tag from node")
@@ -70,11 +113,11 @@ TEMPLATE_TEST_CASE("updating a node", "", options_slim_default,
         REQUIRE_NOTHROW(db.run_import(options, "n10 v3 dD\n"));
     }
 
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_point"));
+    REQUIRE(0 == conn.get_count(with_schema("osm2pgsql_test_point", options)));
 }
 
 TEMPLATE_TEST_CASE("updating a way", "", options_slim_default,
-                   options_slim_expire)
+                   options_slim_expire, options_slim_schema)
 {
     options_t options = TestType::options();
 
@@ -86,9 +129,9 @@ TEMPLATE_TEST_CASE("updating a way", "", options_slim_default,
 
     auto conn = db.db().connect();
 
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_point"));
-    REQUIRE(1 == conn.get_count("osm2pgsql_test_line"));
-    REQUIRE(1 == conn.get_count("osm2pgsql_test_line",
+    REQUIRE(0 == conn.get_count(with_schema("osm2pgsql_test_point", options)));
+    REQUIRE(1 == conn.get_count(with_schema("osm2pgsql_test_line", options)));
+    REQUIRE(1 == conn.get_count(with_schema("osm2pgsql_test_line", options),
                                 "osm_id = 20 AND tags->'highway' = 'primary' "
                                 "AND ST_NumPoints(geom) = 2"));
 
@@ -97,18 +140,18 @@ TEMPLATE_TEST_CASE("updating a way", "", options_slim_default,
     REQUIRE_NOTHROW(
         db.run_import(options, "w20 v2 dV Thighway=secondary Nn10,n11\n"));
 
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_point"));
-    REQUIRE(1 == conn.get_count("osm2pgsql_test_line"));
-    REQUIRE(1 == conn.get_count("osm2pgsql_test_line",
+    REQUIRE(0 == conn.get_count(with_schema("osm2pgsql_test_point", options)));
+    REQUIRE(1 == conn.get_count(with_schema("osm2pgsql_test_line", options)));
+    REQUIRE(1 == conn.get_count(with_schema("osm2pgsql_test_line", options),
                                 "osm_id = 20 AND tags->'highway' = "
                                 "'secondary' AND ST_NumPoints(geom) = 2"));
 
     // now change a node in the way...
     REQUIRE_NOTHROW(db.run_import(options, "n10 v2 dV x10.0 y10.3\n"));
 
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_point"));
-    REQUIRE(1 == conn.get_count("osm2pgsql_test_line"));
-    REQUIRE(1 == conn.get_count("osm2pgsql_test_line",
+    REQUIRE(0 == conn.get_count(with_schema("osm2pgsql_test_point", options)));
+    REQUIRE(1 == conn.get_count(with_schema("osm2pgsql_test_line", options)));
+    REQUIRE(1 == conn.get_count(with_schema("osm2pgsql_test_line", options),
                                 "osm_id = 20 AND tags->'highway' = "
                                 "'secondary' AND ST_NumPoints(geom) = 2"));
 
@@ -117,21 +160,21 @@ TEMPLATE_TEST_CASE("updating a way", "", options_slim_default,
         options, "n12 v1 dV x10.2 y10.1\n"
                  "w20 v3 dV Thighway=residential Nn10,n11,n12\n"));
 
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_point"));
-    REQUIRE(1 == conn.get_count("osm2pgsql_test_line"));
-    REQUIRE(1 == conn.get_count("osm2pgsql_test_line",
+    REQUIRE(0 == conn.get_count(with_schema("osm2pgsql_test_point", options)));
+    REQUIRE(1 == conn.get_count(with_schema("osm2pgsql_test_line", options)));
+    REQUIRE(1 == conn.get_count(with_schema("osm2pgsql_test_line", options),
                                 "osm_id = 20 AND tags->'highway' = "
                                 "'residential' AND ST_NumPoints(geom) = 3"));
 
     // now delete the way...
     REQUIRE_NOTHROW(db.run_import(options, "w20 v4 dD\n"));
 
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_point"));
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_line"));
+    REQUIRE(0 == conn.get_count(with_schema("osm2pgsql_test_point", options)));
+    REQUIRE(0 == conn.get_count(with_schema("osm2pgsql_test_line", options)));
 }
 
 TEMPLATE_TEST_CASE("ways as linestrings and polygons", "", options_slim_default,
-                   options_slim_expire)
+                   options_slim_expire, options_slim_schema)
 {
     options_t options = TestType::options();
 
@@ -145,10 +188,11 @@ TEMPLATE_TEST_CASE("ways as linestrings and polygons", "", options_slim_default,
 
     auto conn = db.db().connect();
 
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_point"));
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_line"));
-    REQUIRE(1 == conn.get_count("osm2pgsql_test_polygon"));
-    REQUIRE(1 == conn.get_count("osm2pgsql_test_polygon",
+    REQUIRE(0 == conn.get_count(with_schema("osm2pgsql_test_point", options)));
+    REQUIRE(0 == conn.get_count(with_schema("osm2pgsql_test_line", options)));
+    REQUIRE(1 ==
+            conn.get_count(with_schema("osm2pgsql_test_polygon", options)));
+    REQUIRE(1 == conn.get_count(with_schema("osm2pgsql_test_polygon", options),
                                 "osm_id = 20 AND tags->'building' = 'yes' AND "
                                 "ST_GeometryType(geom) = 'ST_Polygon'"));
 
@@ -157,48 +201,52 @@ TEMPLATE_TEST_CASE("ways as linestrings and polygons", "", options_slim_default,
     REQUIRE_NOTHROW(db.run_import(
         options, "w20 v2 dV Thighway=secondary Nn10,n11,n12,n13,n10\n"));
 
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_point"));
-    REQUIRE(1 == conn.get_count("osm2pgsql_test_line"));
+    REQUIRE(0 == conn.get_count(with_schema("osm2pgsql_test_point", options)));
+    REQUIRE(1 == conn.get_count(with_schema("osm2pgsql_test_line", options)));
     REQUIRE(1 ==
-            conn.get_count("osm2pgsql_test_line",
+            conn.get_count(with_schema("osm2pgsql_test_line", options),
                            "osm_id = 20 AND tags->'highway' = 'secondary' AND "
                            "ST_GeometryType(geom) = 'ST_LineString'"));
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_polygon"));
+    REQUIRE(0 ==
+            conn.get_count(with_schema("osm2pgsql_test_polygon", options)));
 
     // now remove a node from the way...
     REQUIRE_NOTHROW(db.run_import(
         options, "w20 v3 dV Thighway=secondary Nn10,n11,n12,n13\n"));
 
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_point"));
-    REQUIRE(1 == conn.get_count("osm2pgsql_test_line"));
+    REQUIRE(0 == conn.get_count(with_schema("osm2pgsql_test_point", options)));
+    REQUIRE(1 == conn.get_count(with_schema("osm2pgsql_test_line", options)));
     REQUIRE(1 ==
-            conn.get_count("osm2pgsql_test_line",
+            conn.get_count(with_schema("osm2pgsql_test_line", options),
                            "osm_id = 20 AND tags->'highway' = 'secondary' AND "
                            "ST_GeometryType(geom) = 'ST_LineString'"));
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_polygon"));
+    REQUIRE(0 ==
+            conn.get_count(with_schema("osm2pgsql_test_polygon", options)));
 
     // now change the tag back to an area tag (but the way is not closed)...
     REQUIRE_NOTHROW(
         db.run_import(options, "w20 v4 dV Tbuilding=yes Nn10,n11,n12,n13\n"));
 
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_point"));
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_line"));
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_polygon"));
+    REQUIRE(0 == conn.get_count(with_schema("osm2pgsql_test_point", options)));
+    REQUIRE(0 == conn.get_count(with_schema("osm2pgsql_test_line", options)));
+    REQUIRE(0 ==
+            conn.get_count(with_schema("osm2pgsql_test_polygon", options)));
 
     // now close the way again
     REQUIRE_NOTHROW(db.run_import(
         options, "w20 v5 dV Tbuilding=yes Nn10,n11,n12,n13,n10\n"));
 
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_point"));
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_line"));
-    REQUIRE(1 == conn.get_count("osm2pgsql_test_polygon"));
-    REQUIRE(1 == conn.get_count("osm2pgsql_test_polygon",
+    REQUIRE(0 == conn.get_count(with_schema("osm2pgsql_test_point", options)));
+    REQUIRE(0 == conn.get_count(with_schema("osm2pgsql_test_line", options)));
+    REQUIRE(1 ==
+            conn.get_count(with_schema("osm2pgsql_test_polygon", options)));
+    REQUIRE(1 == conn.get_count(with_schema("osm2pgsql_test_polygon", options),
                                 "osm_id = 20 AND tags->'building' = 'yes' AND "
                                 "ST_GeometryType(geom) = 'ST_Polygon'"));
 }
 
 TEMPLATE_TEST_CASE("multipolygons", "", options_slim_default,
-                   options_slim_expire)
+                   options_slim_expire, options_slim_schema)
 {
     options_t options = TestType::options();
 
@@ -213,10 +261,11 @@ TEMPLATE_TEST_CASE("multipolygons", "", options_slim_default,
 
     auto conn = db.db().connect();
 
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_point"));
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_line"));
-    REQUIRE(1 == conn.get_count("osm2pgsql_test_polygon"));
-    REQUIRE(1 == conn.get_count("osm2pgsql_test_polygon",
+    REQUIRE(0 == conn.get_count(with_schema("osm2pgsql_test_point", options)));
+    REQUIRE(0 == conn.get_count(with_schema("osm2pgsql_test_line", options)));
+    REQUIRE(1 ==
+            conn.get_count(with_schema("osm2pgsql_test_polygon", options)));
+    REQUIRE(1 == conn.get_count(with_schema("osm2pgsql_test_polygon", options),
                                 "osm_id = -30 AND tags->'building' = 'yes' AND "
                                 "ST_GeometryType(geom) = 'ST_Polygon'"));
 
@@ -226,10 +275,11 @@ TEMPLATE_TEST_CASE("multipolygons", "", options_slim_default,
         options,
         "r30 v2 dV Ttype=multipolygon,building=yes,name=Shed Mw20@\n"));
 
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_point"));
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_line"));
-    REQUIRE(1 == conn.get_count("osm2pgsql_test_polygon"));
-    REQUIRE(1 == conn.get_count("osm2pgsql_test_polygon",
+    REQUIRE(0 == conn.get_count(with_schema("osm2pgsql_test_point", options)));
+    REQUIRE(0 == conn.get_count(with_schema("osm2pgsql_test_line", options)));
+    REQUIRE(1 ==
+            conn.get_count(with_schema("osm2pgsql_test_polygon", options)));
+    REQUIRE(1 == conn.get_count(with_schema("osm2pgsql_test_polygon", options),
                                 "osm_id = -30 AND tags->'building' = 'yes' AND "
                                 "ST_GeometryType(geom) = 'ST_Polygon'"));
 
@@ -244,7 +294,8 @@ TEMPLATE_TEST_CASE("multipolygons", "", options_slim_default,
             options, "r30 v3 dV Tbuilding=yes,name=Shed Mw20@\n"));
     }
 
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_point"));
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_line"));
-    REQUIRE(0 == conn.get_count("osm2pgsql_test_polygon"));
+    REQUIRE(0 == conn.get_count(with_schema("osm2pgsql_test_point", options)));
+    REQUIRE(0 == conn.get_count(with_schema("osm2pgsql_test_line", options)));
+    REQUIRE(0 ==
+            conn.get_count(with_schema("osm2pgsql_test_polygon", options)));
 }



View it on GitLab: https://salsa.debian.org/debian-gis-team/osm2pgsql/-/compare/55e80ad40457503f6dc7ec8a5177e9907471d0bc...5c53b8b6d0da8048b6dba3ac062437a2e9c1186f

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/osm2pgsql/-/compare/55e80ad40457503f6dc7ec8a5177e9907471d0bc...5c53b8b6d0da8048b6dba3ac062437a2e9c1186f
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20241203/b8154a01/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list