<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Jeffrey Warren wrote:
<blockquote
 cite="mid:f3515e330906221346n12d693efg1a2572f72ef9e281@mail.gmail.com"
 type="cite">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. 
  <div><br>
  </div>
  <div>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:</div>
  <div>
  <p
 style="margin: 0px; font-family: Lucida Grande; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: normal; font-size-adjust: none; font-stretch: normal; min-height: 16px;"><br>
  </p>
  <p
 style="margin: 0px; font-family: Lucida Grande; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: normal; font-size-adjust: none; font-stretch: normal;">ERROR: 
insert or update on table "current_way_nodes" violates foreign key
constraint "current_way_nodes_node_id_fkey"</p>
  <p
 style="margin: 0px; font-family: Lucida Grande; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: normal; font-size-adjust: none; font-stretch: normal;">DETAIL: 
Key (node_id)=(17704640) is not present in table "current_nodes".</p>
  <p
 style="margin: 0px; font-family: Lucida Grande; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: normal; font-size-adjust: none; font-stretch: normal; min-height: 16px;"><br>
  </p>
  <p
 style="margin: 0px; font-family: Lucida Grande; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: normal; font-size-adjust: none; font-stretch: normal;">**********
Error **********</p>
  <p
 style="margin: 0px; font-family: Lucida Grande; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: normal; font-size-adjust: none; font-stretch: normal; min-height: 16px;"><br>
  </p>
  <p
 style="margin: 0px; font-family: Lucida Grande; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: normal; font-size-adjust: none; font-stretch: normal;">ERROR:
insert or update on table "current_way_nodes" violates foreign key
constraint "current_way_nodes_node_id_fkey"</p>
  <p
 style="margin: 0px; font-family: Lucida Grande; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: normal; font-size-adjust: none; font-stretch: normal;">SQL
state: 23503</p>
  <p
 style="margin: 0px; font-family: Lucida Grande; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: normal; font-size-adjust: none; font-stretch: normal;">Detail:
Key (node_id)=(17704640) is not present in table "current_nodes".</p>
  <p
 style="margin: 0px; font-family: Lucida Grande; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: normal; font-size-adjust: none; font-stretch: normal; min-height: 16px;"><font
 class="Apple-style-span" face="arial"><span class="Apple-style-span"
 style="font-size: small;"><br>
  </span></font></p>
  <p
 style="margin: 0px; font-family: Lucida Grande; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: normal; font-size-adjust: none; font-stretch: normal; min-height: 16px;"><font
 class="Apple-style-span" face="arial"><span class="Apple-style-span"
 style="font-size: small;">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:</span></font></p>
  <p
 style="margin: 0px; font-family: Lucida Grande; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: normal; font-size-adjust: none; font-stretch: normal; min-height: 16px;"><font
 class="Apple-style-span" face="arial"><span class="Apple-style-span"
 style="font-size: small;"><br>
  </span></font></p>
  <p
 style="margin: 0px; font-family: Lucida Grande; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: normal; font-size-adjust: none; font-stretch: normal; min-height: 16px;"><font
 class="Apple-style-span" face="arial"><span class="Apple-style-span"
 style="font-size: small;"><span class="Apple-style-span"
 style="font-family: 'Lucida Grande'; font-size: 13px;">ALTER TABLE
ONLY current_way_nodes</span></span></font></p>
  <p
 style="margin: 0px; font-family: Lucida Grande; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: normal; font-size-adjust: none; font-stretch: normal; min-height: 16px;">  
 ADD CONSTRAINT current_way_nodes_node_id_fkey FOREIGN KEY (node_id)
REFERENCES current_nodes(id);</p>
  <p
 style="margin: 0px; font-family: Lucida Grande; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: normal; font-size-adjust: none; font-stretch: normal; min-height: 16px;"><font
 class="Apple-style-span" face="arial"><span class="Apple-style-span"
 style="font-size: small;"><br>
  </span></font></p>
  <div>Has anyone else encountered this? Is there a better way to
resolve it?</div>
  </div>
</blockquote>
When testing local imports I drop that constraint from the database. 
I'm not aware of any better ways of solving the problem.<br>
<br>
Brett<br>
<br>
</body>
</html>