我有一个带有名为 shape 的多边形列的 postgres 表。为了确定一个点是否在里面,我跑
select * from areas where shape @> point '(1,1)';
这一切都很好,并且在我的 ruby on rails 应用程序中工作,但在我的 RSpec 测试中失败了。当我查看我的日志时,我发现此错误是源
PGError: ERROR: operator does not exist: character varying @> point
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
使用数据库的所有其他 50 多个测试都可以工作,只有这一个可以使用。它再次在代码和控制台中工作。测试环境全部设置妥当。
我的问题: - 我怎样才能使比较对象起作用?- 为什么它只会在测试中失败?