我最近将我的数据库从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.
Run Code Online (Sandbox Code Playgroud)
任何人都知道为什么现在这会破裂?我知道GeoKit仍然有效,因为当数据库被播种时,它仍然在每张票的模型中执行地理编码,它只是不能正确地进行距离计算.
我刚刚开始使用Rails为我正在构建的应用程序玩geokit.我的记录得到了地理编码,但是当我进入控制台看看我能用它做什么时它会爆炸以下内容:用户是我的数据库中带有lat和lng的用户对象
>> Restaurant.find(:all, :origin => user)
Restaurant Load (0.0ms) PGError: ERROR: operator does not exist:
numeric - character varying
LINE 1: ...*, SQRT(POW(111.1819*(-33.872517-restauran...
^
HINT: No operator matches the given name and argument type(s). You
might need to add explicit type casts.
: SELECT *, SQRT(POW(111.1819*(-33.872517-restaurants.lat),2)+
POW(76.7136337302943*(151.205536-restaurants.lng),2))
AS distance FROM "restaurants"
ActiveRecord::StatementInvalid: PGError: ERROR: operator does not
exist: numeric - character varying
LINE 1: ...*, SQRT(POW(111.1819*(-33.872517-
restauran...
^
HINT: No operator matches the given name and argument type(s). You
might …Run Code Online (Sandbox Code Playgroud)