<p>Osm2pgsql needs to keep track of all objects it writes into the output<br>
tables by their id, so it can remove/update them when the database is<br>
updated. In the flex output there were two options:</p>
<ul>
<li>Use tables with nodes, ways, or relations only. Then we can write<br>
the id of those objects "as is" into those tables.</li>
<li>For area tables, ways can use positive ids and relations negative<br>
ids.</li>
<li>For tables which can take more than one type of object, we use<br>
two columns, one for the object type ("N", "W", or "R"), one for<br>
the id.</li>
</ul>
<p>The second option has the drawback that we need to have two columns<br>
which might take more space and also makes some operations more<br>
difficult. Some programs might also need a single unique id column.<br>
So we added a new option here: Just have a single id column and,<br>
similarly to how this is done for area tables, convert the ids.</p>
<p>Rather then inventing a new scheme, we use the same scheme that imposm<br>
uses in this case: node ids stay the same (so they are positive), way<br>
ids are negative and relation ids are negative and 1e17 is subtracted<br>
from them. This gives distinct ranges for all ids.</p>
<p>To tell osm2pgsql that you want the type scheme, do not set the<br>
"type_column" option on the ids setting in your flex Lua config.<br>
(Before this, not setting this option meant you get the default<br>
column name "osm_type".)</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/openstreetmap/osm2pgsql/pull/1299'>https://github.com/openstreetmap/osm2pgsql/pull/1299</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>Add option to how flex output handles ids in output tables</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/1299/files#diff-1805c9b742d8d030a8d1eb13c8ef3f89183c40f71eecb646e591c7cd0c1d2b24">src/flex-table.cpp</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/1299/files#diff-3eae076e672de2c081bf15f0d826d9cfb5415af741a5e24bc8294798aa02a8dc">src/flex-table.hpp</a>
    (15)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/1299/files#diff-becb223d44aa5a6bb197bf494c1e7e66308350843d927aed3363ce76a1945004">src/output-flex.cpp</a>
    (13)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/1299/files#diff-0483718292284c485816c2153315cec2149906b8ebc61ce388f5e690668f802e">tests/data/test_output_flex_uni.lua</a>
    (44)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/osm2pgsql/pull/1299/files#diff-498489f2937f8dbb1cd2b294306c2a3e782468aac79d4391a81fada4c76b8059">tests/test-output-flex-uni.cpp</a>
    (161)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/openstreetmap/osm2pgsql/pull/1299.patch'>https://github.com/openstreetmap/osm2pgsql/pull/1299.patch</a></li>
  <li><a href='https://github.com/openstreetmap/osm2pgsql/pull/1299.diff'>https://github.com/openstreetmap/osm2pgsql/pull/1299.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/osm2pgsql/pull/1299">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AA6353VTBARZNYIWHAADWZTSL3PZNANCNFSM4SZZOC7Q">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AA6353SVCKDO4MGBPF2QN5TSL3PZNA5CNFSM4SZZOC72YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4K2NPDBA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/osm2pgsql/pull/1299",
"url": "https://github.com/openstreetmap/osm2pgsql/pull/1299",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>