Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Column wrongly mistaken as a geometric point #978

Open
lasseebert opened this issue Feb 2, 2023 · 0 comments
Open

Column wrongly mistaken as a geometric point #978

lasseebert opened this issue Feb 2, 2023 · 0 comments

Comments

@lasseebert
Copy link

We have postgis for geometric data, and our geometric columns are annotated correctly, e.g.:

#  coordinates       :geography        not null, point, 4326

However, we have some enum types that was created after we installed postgis, and these are annotated weirdly:

#  category          :enum             not null, point, 0

Notice the point, 0

This is the postgres column:

    category public.point_of_interest_category NOT NULL,

(point_of_interest_category is an enum type)

When introspecting the column in active record I get:

PointOfInterest.columns.find{_1.name == "category"}
=> 
#<ActiveRecord::ConnectionAdapters::PostGIS::SpatialColumn:0x00007f5c2a45ae60                 
 @collation=nil,                                                                              
 @comment=nil,                                                                                
 @default=nil,                                                                                
 @default_function=nil,                                                                       
 @generated="",                                                                               
 @geographic=false,                                                                           
 @geometric_type=RGeo::Feature::Point,                                                        
 @has_m=false,                                                                                
 @has_z=false,                                                                                
 @name="category",                                                                            
 @null=false,                                                                                 
 @serial=nil,                                                                                 
 @sql_type_metadata=                                                                          
  #<ActiveRecord::ConnectionAdapters::SqlTypeMetadata:0x00007f5c2a45b130
   @limit=nil,
   @precision=nil,
   @scale=nil,
   @sql_type="point_of_interest_category",
   @type=:enum>,
 @srid=0>

Notice that it has geographic: false, but it also has a geometric_type. I'm not sure, but I think in this case, it should not be treated as a geometry in annotate?

(I'm not sure if the problem is in annotate or in the postgis adapter)

Commands

Running annotate as part of migrate

Version

  • annotate version: 3.2.0
  • rails version: 7.0.4.1
  • ruby version: 3.1.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant