[Tile-serving] [openstreetmap/osm2pgsql] Create primary keys (#1216)
GGuillard
notifications at github.com
Tue Jun 16 17:20:21 UTC 2020
In order to support response paging as specified by WFS 2.0, GeoServer needs a primary key, or it will throw `java.io.IOException: Cannot do natural order without a primary key, please add it or specify a manual sort over existing attributes`. The server will then hang and end the communication with the client (or anyway things won’t go smoothly). If the client is QGIS, it will (or may ?) get stalled.
Although one can argue the issue lies in GeoServer or QGIS, it is likely that other similar WFS software are affected by the lack of primary key for this particular feature. Disabling it in the client (i.e. unchecking the "activate paging" box in QGIS’ WFS connection settings) or server side is not a satisfactory solution.
Furthermore, another situation where uniqueness was necessary [has already been mentioned](https://github.com/openstreetmap/osm2pgsql/issues/446#issuecomment-137660748) a while ago.
In order to [add primary keys manually](https://gis.stackexchange.com/a/171631/159691), **the user needs write access** on this database, which is not always granted. In addition, this requires resources like large additional disk space and CPU time, which may be a prejudicial issue in many cases.
On the other hand, computing primary keys at the creation of the database is pretty efficient, implementing it is straightforward, and the additional disk space used by such indexes sounds like quite a reasonable trade-off with regards to the current and future benefits of having a primary key.
Is there a rationale for not creating primary keys by default ? Note that there could exist an option to prevent their creation anyway (or vice versa, although I believe the decision to drop a useful feature should be left to the advanced user).
NB : I understand that it would be an additional field and not `osm_id`, which by design may not be primary.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/issues/1216
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20200616/6c2d3776/attachment.htm>
More information about the Tile-serving
mailing list