But does current_way_nodes have a node_id column? It looks to me like the foreign key constraint is making sure that the nodes in the current_way_nodes table actually exist in current_nodes
Ed From: dev-boun...@openstreetmap.org [mailto:dev-boun...@openstreetmap.org] On Behalf Of Jeffrey Warren Sent: 05 June 2009 19:59 To: Joachim Zobel Cc: dev Openstreetmap; Josh Levinger Subject: Re: [OSM-dev] Osmosis error, duplicate Thanks, I was tracing the original foreign key constraint error (reproduced in full below) and this line caught my eye: Detail: Key (node_id)=(395051992) is not present in table "current_nodes". current_nodes has no node_id column! The constraint is created in the latest pgsql schema, here: (apidb06-pgsql-latest.sql:2132) -- -- TOC entry 2018 (class 2606 OID 35690) -- Dependencies: 1579 1961 1589 -- Name: current_way_nodes_node_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: osm -- ALTER TABLE ONLY current_way_nodes ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id) REFERENCES current_nodes(id); I changed line 2139 to: ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (id) REFERENCES current_nodes(id); I'm going to run it now to see what happens. Best, Jeff ############################################### motel:bin eco$ cd ../motel:osmosis-0.31 eco$ bin/osmosis --read-xml-0.6 file="/Volumes/Planet/planet.osm" --write-apidb-0.6 populateCurrentTables=yes host="localhost" database="osm-planet" user="eco" password="poopies" validateSchemaVersion=no May 26, 2009 8:59:51 PM org.openstreetmap.osmosis.core.Osmosis run INFO: Osmosis Version 0.31 May 26, 2009 8:59:51 PM org.openstreetmap.osmosis.core.Osmosis run INFO: Preparing pipeline. May 26, 2009 8:59:51 PM org.openstreetmap.osmosis.core.Osmosis run INFO: Launching pipeline execution. May 26, 2009 8:59:51 PM org.openstreetmap.osmosis.core.Osmosis run INFO: Pipeline executing, waiting for completion. Jun 1, 2009 6:50:20 PM org.openstreetmap.osmosis.core.pipeline.common.ActiveTaskManager waitForCompletion 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.core.apidb.v0_6.ApidbWriter.complete(Apidb Writer.java:980) at org.openstreetmap.osmosis.core.xml.v0_6.XmlReader.run(XmlReader.java :110) at java.lang.Thread.run(Thread.java:637) 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)=(395051992) is not present in table "current_nodes". at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryE xecutorImpl.java:1592) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecuto rImpl.java:1327) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.j ava:192) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Sta tement.java:451) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(Abstrac tJdbc2Statement.java:350) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Sta tement.java:343) at org.openstreetmap.osmosis.core.apidb.v0_6.ApidbWriter.complete(Apidb Writer.java:977) ... 2 more Jun 1, 2009 6:50:20 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.waitForCompl etion(Pipeline.java:146) at org.openstreetmap.osmosis.core.Osmosis.run(Osmosis.java:85) at org.openstreetmap.osmosis.core.Osmosis.main(Osmosis.java:30) On Fri, Jun 5, 2009 at 1:29 PM, Joachim Zobel <jz-2...@heute-morgen.de> wrote: Am Freitag, den 05.06.2009, 12:40 -0400 schrieb Jeffrey Warren: > and it's been running the following query for about 24 hours: > > SELECT Count(*) AS changesetCount FROM changesets WHERE id=$1 Take a look on Brets pgsql-latest.sql script (after the COPYs) and add the index on id: ALTER TABLE ONLY changesets ADD CONSTRAINT pk_changesets PRIMARY KEY (id); Sincerely, Joachim
_______________________________________________ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev