[OSM-dev] osmosis foreign key constraint

Brett Henderson brett at bretth.com
Wed Sep 15 01:32:20 BST 2010


I'd try dropping the constraint.  I'm not sure how well rails will cope with
invalid data but it might be your only option.  Ideally the OSM file
shouldn't have any referential integrity problems but it often seems to
happen.  For extra points you could then figure out what the dodgy data is,
clean it up and re-enable the constraint, but that may not be necessary.

On Wed, Sep 15, 2010 at 5:06 AM, Jose Cid <doncid at gmail.com> wrote:

>  Hello all,
>
> Has anyone run into the following while loading an osm file via osmosis? If
> so, has anyone found a solution/work around? Any insight as how to proceed?
>
> SEVERE: Thread for task 1-read-xml-0.6 failed
> org.openstreetmap.osmosis.core.OsmosisRuntimeException: Unable to load
> current way nodes.
>         at
> org.openstreetmap.osmosis.apidb.v0_6.ApidbWriter.populateCurrentWays(ApidbWriter.java:975)
>         at
> org.openstreetmap.osmosis.apidb.v0_6.ApidbWriter.populateCurrentTables(ApidbWriter.java:1026)
>         at
> org.openstreetmap.osmosis.apidb.v0_6.ApidbWriter.complete(ApidbWriter.java:1051)
>         at
> org.openstreetmap.osmosis.xml.v0_6.XmlReader.run(XmlReader.java:110)
>         at java.lang.Thread.run(Thread.java:636)
> Caused by: org.postgresql.util.PSQLException: ERROR: insert or update on
> table "current_way_nodes" violates foreign key constraint
> "current_way_nodes_node_id_fkey"
>   Detail: Key (node_id)=(51847177) is not present in table "current_nodes".
>         at
> org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062)
>         at
> org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795)
>         at
> org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
>         at
> org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479)
>         at
> org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:367)
>         at
> org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:360)
>         at
> org.openstreetmap.osmosis.apidb.v0_6.ApidbWriter.populateCurrentWays(ApidbWriter.java:972)
>         ... 4 more
> Sep 14, 2010 2:24:48 PM org.openstreetmap.osmosis.core.Osmosis main
> SEVERE: Execution aborted.
> org.openstreetmap.osmosis.core.OsmosisRuntimeException: One or more tasks
> failed.
>         at
> org.openstreetmap.osmosis.core.pipeline.common.Pipeline.waitForCompletion(Pipeline.java:146)
>         at org.openstreetmap.osmosis.core.Osmosis.run(Osmosis.java:92)
>         at org.openstreetmap.osmosis.core.Osmosis.main(Osmosis.java:37)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:616)
>         at
> org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
>         at
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
>         at
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
>         at
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
>         at org.codehaus.classworlds.Launcher.main(Launcher.java:31)
>
>
> _______________________________________________
> dev mailing list
> dev at openstreetmap.org
> http://lists.openstreetmap.org/listinfo/dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20100915/c852f1d5/attachment.html>


More information about the dev mailing list