[Tile-serving] [osm2pgsql-dev/osm2pgsql] Can Flex styles run arbitrary SQL against the database? (Discussion #1415)
Amanda
notifications at github.com
Wed Nov 12 11:27:05 UTC 2025
I think I have hit this issue while looking at [postpass](https://github.com/woodpeck/postpass-ops/) setup. There are [several SQL views])(https://github.com/woodpeck/postpass-ops/blob/main/SCHEMA.md#views) on the production server, and I think they should be created by `osm2pgsql`.
I attempted hack something like this, but it didn't work.
```lua
function osm2pgsql.after_relations()
osm2pgsql.run_sql({
description = "Create view",
sql = "create or replace view postpass_... AS ..."
})
end
```
While I understand the concern about some SQL modifying _the data_ that osm2pgsql inserts, there is an easier use case of allowing people to create views.
How about a `osm2pgsql.define_view{ name = "whatever", sql_def = "create view blah …" }`? Afte all tables are created, osm2pgsql will see if a view named that exists, if so, it'll run the `sql_def`, otherwise not. If you change the `sql_def`, then no change is made. Would this be a safer intermediate step?
--
Reply to this email directly or view it on GitHub:
https://github.com/osm2pgsql-dev/osm2pgsql/discussions/1415#discussioncomment-14946761
You are receiving this because you are subscribed to this thread.
Message ID: <osm2pgsql-dev/osm2pgsql/repo-discussions/1415/comments/14946761 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20251112/c4f135a2/attachment.htm>
More information about the Tile-serving
mailing list