[OSM-dev] type "four_byte_unsigned" does not exist
Jeffrey Warren
warren at mit.edu
Tue May 26 22:45:56 BST 2009
Tom -
I also had to comment out the Rails error catching
in 005_tile_tracepoints.rb and 006_tile_nodes.rb.
The rescue was triggering but I think pgsql was still getting the error and
shutting down the transaction.
I did the following:
###################################
005_tile_tracepoints.rb
class TileTracepoints < ActiveRecord::Migration
def self.up
add_column "gps_points", "tile", :integer, :limit => 8
add_index "gps_points", ["tile"], :name => "points_tile_idx"
remove_index "gps_points", :name => "points_idx"
# begin
# Tracepoint.update_all("latitude = latitude * 10, longitude =
longitude * 10, tile = tile_for_point(latitude * 10, longitude * 10)")
# rescue ActiveRecord::StatementInvalid => ex
Tracepoint.find(:all).each do |tp|
tp.latitude = tp.latitude * 10
tp.longitude = tp.longitude * 10
tp.save!
end
# end
end
... etc ...
###################################
006_tile_nodes.rb:
require 'lib/migrate'
class TileNodes < ActiveRecord::Migration
def self.upgrade_table(from_table, to_table, model)
# begin
# execute <<-END_SQL
# INSERT INTO #{to_table} (id, latitude, longitude, user_id, visible,
tags, timestamp, tile)
# SELECT id, ROUND(latitude * 10000000), ROUND(longitude * 10000000),
# user_id, visible, tags, timestamp,
# tile_for_point(CAST(ROUND(latitude * 10000000) AS INTEGER),
# CAST(ROUND(longitude * 10000000) AS INTEGER))
# FROM #{from_table}
# END_SQL
# rescue ActiveRecord::StatementInvalid => ex
execute <<-END_SQL
INSERT INTO #{to_table} (id, latitude, longitude, user_id, visible,
tags, timestamp, tile)
SELECT id, ROUND(latitude * 10000000), ROUND(longitude * 10000000),
user_id, visible, tags, timestamp, 0
FROM #{from_table}
END_SQL
model.find(:all).each do |n|
n.save!
end
# end
end
... etc ...
###################################
The rescues were triggered by tile_for_point() because I couldn't get
libpgosm.so to install on Darwin/OS X Leopard. That thread is here:
http://forum.openstreetmap.org/viewtopic.php?pid=23062
I think it was a 32-bit vs. 64-bit problem, but setting archflags did not
really help... anyways i guess i just bypassed that problem.
Best,
Jeff
On Tue, May 26, 2009 at 2:38 PM, Tom Hughes <tom at compton.nu> wrote:
> Dan Karran wrote:
>
>> Hi Jeff,
>>
>> 2009/5/26 Jeffrey Warren <warren at mit.edu>:
>>
>>> I noticed that during db:migrate it doesn't pick up the /lib/migrate.rb
>>> type
>>> definitions... so I just changed it to :integer, :limit => 8, which is
>>> how
>>> four_byte_unsigned is defined in migrate.rb.
>>> I'm also setting up the rails port and am having trouble so if you want
>>> to
>>> compare notes I'd love to.
>>>
>>
>> Thanks, though it doesn't seem to get much further than that once I've
>> made the change, stopping after trying to remove the index points_idx.
>>
>
> As far as I know the issue with the missing require is the only problem
> when using postgres, so if you're seeing anything else please tell us the
> actual error so we can diagnose the problem.
>
>
> Tom
>
> --
> Tom Hughes (tom at compton.nu)
> http://www.compton.nu/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20090526/78dc3cc2/attachment.html>
More information about the dev
mailing list