Fix an issue where `public-transport.lua` currently fails when run with `--slim 
-x`. Issue present since 8d1a55e5e6dd9fe5465fee78c87d41bda4ce8446

The cause is that `set_attributes_on_builder` would get its attribute columns 
from `offset + 2`, which is correct for ways and relations, but incorrect for 
nodes. A node that was read back from the middle now would get misaligned 
columns: it would get a changeset where it expected a timestamp, a uid where it 
expected a version, and a username where it expected a changeset, that last one 
having caused the actual crash with `illegal changeset: 'marcoh'`.

Command to reproduce: `osm2pgsql -d ptx -O flex -S public-transport.lua --slim 
-x ../tests/data/liechtenstein-2013-08-03.osm.pbf`

<details>
<summary>Logs currently on master (click to expand)</summary>

```
2026-09-24 14:50:52  osm2pgsql version 2.3.0 (2.3.0-16-gf720d32d)
2026-09-24 14:50:52  Database version: 18.6 (Debian 18.6-1.pgdg13+2)
2026-09-24 14:50:52  PostGIS version: 3.6
2026-09-24 14:50:52  Initializing properties table 
'"public"."osm2pgsql_properties"'.
2026-09-24 14:50:52  Storing properties to table 
'"public"."osm2pgsql_properties"'.
2026-09-24 14:50:52  Writing 226 entries to table 'planet_osm_users'...
2026-09-24 14:50:52  Reading input files done in 0s.
2026-09-24 14:50:52    Processed 65733 nodes in 0s - 66k/s
2026-09-24 14:50:52    Processed 7121 ways in 0s - 7k/s
2026-09-24 14:50:52    Processed 113 relations in 0s - 113/s
2026-09-24 14:50:52  Reprocess marked nodes/ways (stage 2)...
2026-09-24 14:50:52  Creating id index on table 'lines'...
2026-09-24 14:50:52  Creating id indexes took 0s
2026-09-24 14:50:52  There are 9 nodes to reprocess...
2026-09-24 14:50:52  ERROR: illegal changeset: 'marcoh'
```

</details>

<details>
<summary>Logs with this fix (click to expand)</summary>

```
2026-09-24 14:50:53  osm2pgsql version 2.3.0 (2.3.0-16-gf720d32d-changed)
2026-09-24 14:50:53  Database version: 18.6 (Debian 18.6-1.pgdg13+2)
2026-09-24 14:50:53  PostGIS version: 3.6
2026-09-24 14:50:53  Initializing properties table 
'"public"."osm2pgsql_properties"'.
2026-09-24 14:50:53  Storing properties to table 
'"public"."osm2pgsql_properties"'.
2026-09-24 14:50:53  Writing 226 entries to table 'planet_osm_users'...
2026-09-24 14:50:53  Reading input files done in 0s.
2026-09-24 14:50:53    Processed 65733 nodes in 0s - 66k/s
2026-09-24 14:50:53    Processed 7121 ways in 0s - 7k/s
2026-09-24 14:50:53    Processed 113 relations in 0s - 113/s
2026-09-24 14:50:53  Reprocess marked nodes/ways (stage 2)...
2026-09-24 14:50:53  Creating id index on table 'lines'...
2026-09-24 14:50:53  Creating id indexes took 0s
2026-09-24 14:50:53  There are 9 nodes to reprocess...
2026-09-24 14:50:53  There are 287 ways to reprocess...
2026-09-24 14:50:53  Building index on middle ways table
2026-09-24 14:50:53  Building indexes on middle rels table
2026-09-24 14:50:53  Done postprocessing on table 'planet_osm_nodes' in 0s
2026-09-24 14:50:53  Clustering table 'lines' by geometry...
2026-09-24 14:50:53  Clustering table 'stop_areas' by geometry...
2026-09-24 14:50:53  No indexes to create on table 'routes'.
2026-09-24 14:50:53  Creating id index on table 'routes'...
2026-09-24 14:50:53  Clustering table 'stops' by geometry...
2026-09-24 14:50:53  Analyzing table 'routes'...
2026-09-24 14:50:53  Creating index on table 'stop_areas' ("geom")...
2026-09-24 14:50:53  Creating index on table 'stops' ("geom")...
2026-09-24 14:50:53  Creating id index on table 'stop_areas'...
2026-09-24 14:50:53  Creating id index on table 'stops'...
2026-09-24 14:50:53  Analyzing table 'stop_areas'...
2026-09-24 14:50:53  Analyzing table 'stops'...
2026-09-24 14:50:53  Creating index on table 'lines' ("geom")...
2026-09-24 14:50:53  Creating id index on table 'lines'...
2026-09-24 14:50:53  Analyzing table 'lines'...
2026-09-24 14:50:53  Done postprocessing on table 'planet_osm_ways' in 0s
2026-09-24 14:50:53  Done postprocessing on table 'planet_osm_rels' in 0s
2026-09-24 14:50:53  All postprocessing on table 'stops' done in 0s.
2026-09-24 14:50:53  All postprocessing on table 'lines' done in 0s.
2026-09-24 14:50:53  All postprocessing on table 'routes' done in 0s.
2026-09-24 14:50:53  All postprocessing on table 'stop_areas' done in 0s.
2026-09-24 14:50:53  Storing properties to table 
'"public"."osm2pgsql_properties"'.
2026-09-24 14:50:53  osm2pgsql took 0s overall.
```

</details>
You can view, comment on, or merge this pull request online at:

  https://github.com/osm2pgsql-dev/osm2pgsql/pull/2501

-- Commit Summary --

  * fix reading attributes of nodes from the middle

-- File Changes --

    M src/middle-pgsql.cpp (33)
    M tests/test-middle.cpp (62)

-- Patch Links --

https://github.com/osm2pgsql-dev/osm2pgsql/pull/2501.patch
https://github.com/osm2pgsql-dev/osm2pgsql/pull/2501.diff

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

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

Reply via email to