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/[email protected]>
_______________________________________________
Tile-serving mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/tile-serving

Reply via email to