joto created an issue (osm2pgsql-dev/osm2pgsql#2307)

Enums are an interesting datatype in SQL. Enums can be created with `CREATE 
TYPE` in PostgreSQL. Features:

1. Storage is relatively compact, 4 bytes only. This is less than typical text 
labels.
2. Externally they behave mostly like text, making it easy to use.
3. Enums are sorted by internal encoding, this allows "choosing" order in a 
sense, for instance by "importance" in a value ("motorway" before "trunk" 
before "primary",...) instead of text-based ordering. This is useful for map 
rendering.
4. Enums can be changed with `ALTER TYPE`, for instance new values can be 
added, but they are still not as flexible as free text, of course.

Currently enums can be used with osm2pgsql by creating the enum type before 
osm2pgsql is run and then using `sql_type = 'YOUR_ENUM_TYPE'` in the table 
definition. After that they are used as if they were a text type.

Support in osm2pgsql could help with 
* Easier to define everything in Lua config instead of having external SQL.
* Checking values in osm2pgsql would allow for better error messages instead of 
failure in the COPY command.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/osm2pgsql-dev/osm2pgsql/issues/2307
You are receiving this because you are subscribed to this thread.

Message ID: <osm2pgsql-dev/osm2pgsql/issues/[email protected]>
_______________________________________________
Tile-serving mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/tile-serving

Reply via email to