[OSM-dev] Database Schema (was Re: [OSM-talk] Oh dear - planet has duplicate id's)

Tom Hughes tom at compton.nu
Sat Jun 23 15:36:48 BST 2007

In message <19E75E3A-30F1-4BA2-BD73-96B6DBDB41DF at asklater.com>
          SteveC <steve at asklater.com> wrote:

> On 23 Jun 2007, at 15:07, Tom Hughes wrote:
> > In message
> > <7679c25f0706230653m427dbbcfv68fafa95dc5faaf6 at mail.gmail.com>
> >           "Ray Booysen" <raybooysen at rjb.za.net> wrote:
> >
> >> Sorry if I'm jumping in late, but I'm finding it a bit strange
> >> that on the
> >> most important tables, we're missing primary keys.  Seems almost
> >> the first
> >> thing you do when designing tables is chosing you primary key and
> >> setting
> >> the index.
> >
> > Yes, we know. It's a bug that we want to fix!
> >
> > I'm not quite sure if it has always been like that or if the problem
> > was introduced by the rails port, but it doesn't really matter now.
> its a hangover from when all data was in one table per object, now we
> have current_nodes etc...

Ah right.

> there shouldn't be primary keys on the nodes, segments and ways
> tables as they have multiple entries from the history, of course.

Well ways can have one on id+version as it has an explicit version
column. Unfortunately nodes and segments don't and rely on a timestamp
which means there can be (and are in some cases) more than one copy
with the same timestamp in the history table.


Tom Hughes (tom at compton.nu)

More information about the dev mailing list