I recently switched my database from MySQL to PostGres. I also use GeoKit. When I started my app up with the new database already seeded, I get the following error:
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.
Anyone know why this is breaking now? I know GeoKit still works because it's still performing the geocoding in the model per ticket when the database is seeded, it just won't do the distance calculations correctly.
对于那些在搜索中查找此答案的人来说,问题是Postgresql要求lat,lng列为十进制或至少是非字符串,而MySQL允许使用两者。
Unsurprisingly the "radians" function expects a DOUBLE PRECISION argument. And there's no cast defined for TEXT/CHARACTER VARYING (aka VARCHAR) to DOUBLE PRECISION.
Probably the easiest solution is to define such a cast.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.