[Tile-serving] [osm2pgsql-dev/osm2pgsql] Properly set schema for osm2pgsql_find_changed_ways() (PR #2261)

Jochen Topf notifications at github.com
Thu Oct 3 08:33:38 UTC 2024


@joto requested changes on this pull request.

Thanks, the PR looks pretty good except  for the small changes I mention.

> +        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");
+    }
+};
+
+// Return a string with the schema name prepended to the table name.
+std::string with_schema(char const *name, options_t const *options)

We are not changing the options, so we should probably use a `const &` instead of `const *` as is done elsewhere in the osm2pgsql code. This will also make calling the function simpler.

> +        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");
+    }
+};
+
+// Return a string with the schema name prepended to the table name.
+std::string with_schema(char const *name, options_t const *options)

Can we name the parameter `table_name`? So it is clear that that's the table parameter and the schema comes from the options.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/osm2pgsql-dev/osm2pgsql/pull/2261#pullrequestreview-2344968262
You are receiving this because you are subscribed to this thread.

Message ID: <osm2pgsql-dev/osm2pgsql/pull/2261/review/2344968262 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20241003/c0897c4f/attachment.htm>


More information about the Tile-serving mailing list