我最近将我的数据库从 MySQL 切换到了 PostGres。我也使用 GeoKit。当我使用已经播种的新数据库启动我的应用程序时,出现以下错误:
PGError: ERROR: function radians(character varying) does not exist
LINE 1: ...COS(0.661045389762993)*COS(-2.12957994527573)*COS(RADIANS(ti...
^
HINT: No function matches the given name and argument types. You might
need to add explicit type casts.
有人知道为什么现在会崩溃吗?我知道 GeoKit 仍然有效,因为它在为数据库播种时仍在每张票证模型中执行地理编码,只是不会正确计算距离。
最佳答案
对于那些在搜索中查找此答案的人来说,问题在于 Postgresql 要求 lat、lng 列为十进制或至少为非字符串,而 MySQL 允许同时使用这两种列。
关于ruby-on-rails - rails : Converting from MySQL to PostGres breaks Geokit Distance Calculations?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2814968/