[OSM-dev] Osmosis and Postgresql

Brett Henderson brett at bretth.com
Tue Jun 23 14:09:15 BST 2009


Jeffrey Warren wrote:
> Hi, I'm compiling a very long description of a Postgres/Rails port 
> schema import, though I'm writing directly to the db. I'd be happy to 
> share/post my notes on the process as I managed to get around a number 
> of undocumented problems. 
>
> I'm still not done right now (i've been pinging the list here 
> occasionally) and my latest problem is that I'm getting several errors 
> like the following:
>
>
> ERROR:  insert or update on table "current_way_nodes" violates foreign 
> key constraint "current_way_nodes_node_id_fkey"
>
> DETAIL:  Key (node_id)=(17704640) is not present in table "current_nodes".
>
>
> ********** Error **********
>
>
> ERROR: insert or update on table "current_way_nodes" violates foreign 
> key constraint "current_way_nodes_node_id_fkey"
>
> SQL state: 23503
>
> Detail: Key (node_id)=(17704640) is not present in table "current_nodes".
>
>
> These are current_way_nodes which were not deleted from the current_ 
> table when their matching current_nodes were deleted. I'm now trying 
> to delete them manually since this only occurs where nodes are 
> visible=false, but it's confusing when this causes the foreign key 
> constraint creation to fail:
>
>
> ALTER TABLE ONLY current_way_nodes
>
>     ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY 
> (node_id) REFERENCES current_nodes(id);
>
>
> Has anyone else encountered this? Is there a better way to resolve it?
When testing local imports I drop that constraint from the database.  
I'm not aware of any better ways of solving the problem.

Brett

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20090623/fd426729/attachment.html>


More information about the dev mailing list