Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Incomplete
-
Affects Version/s: JRuby 1.5.1
-
Fix Version/s: None
-
Component/s: Extensions
-
Labels:None
-
Number of attachments :
Description
Using postgresql 8.4.4 and PostGIS 1.5.1 (the latest of each). PostGIS adds several column data types, including 'point' which represents a geographic point.
There is a gem called spatial_adapter which adds support for the PostGIS data types to the standard AR postgresql driver.
Currently I can't migrate my database to create a point column due to this error:
ActiveRecord::ActiveRecordError: ERROR: type modifier is not allowed for type "point" Position: 36: ALTER TABLE "hoods" ADD "centroid" point(0)
The cause is this code in jdbc_adapter.rb:
def choose_best_types
type_map = {}
@types.each do |row|
name = row['type_name'].downcase
k = name.to_sym
type_map[k] = { :name => name }
type_map[k][:limit] = row['precision'].to_i if row['precision']
end
Here's the 'row' hash associated with the point type:
{"type_name"=>"point", "data_type"=>1111, "precision"=>0, "literal_prefix"=>"'", "literal_suffix"=>"'", "create_params"=>nil, "nullable"=>1, "case_sensitive"=>"t", "searchable"=>3, "unsigned_attribute"=>"t", "fixed_prec_scale"=>"f", "auto_increment"=>"f", "local_type_name"=>nil, "minimum_scale"=>0, "maximum_scale"=>0, "sql_data_type"=>nil, "sql_datetime_sub"=>nil, "num_prec_radix"=>10}