[Tile-serving] [openstreetmap/osm2pgsql] Switch to "Identity" columns instead of "Serial" for PostgreSQL 10+ (#1538)

mboeringa notifications at github.com
Sat Jul 10 21:04:56 UTC 2021


@joto 

You are right, this is already supported.

My first attempt failed though:

![afbeelding](https://user-images.githubusercontent.com/7635726/125176254-5d527980-e1d2-11eb-8e07-980bcd7961d9.png)

But I then realized that the code should read:

`column = 'ID', sql_type = 'bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY', create_only = true`

to prevent the not-null constraint error, as properly documented on the manual pages.

After changing that, both 'serial' and the 'identity' clauses worked.

I did realize there is another reason good reason to switch to 'identity' though: I noticed in DBeaver it appears the 'serial' column type is created as 'int4' by default by PostgreSQL. While not an immediate concern, it is clear though that eventually one may run out of values with 'int4' and the ever growing OpenStreetMap database... It is not without reason osm_id has been 'int8' for quite some time.

-- 
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/discussions/1538#discussioncomment-989141
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20210710/adadb65b/attachment.htm>


More information about the Tile-serving mailing list