运算符不存在:带有时区的tstzrange &&时间戳

时间:2019-07-09 11:35:11

标签: postgresql

运行:

SELECT tstzrange( '2019-05-01', '2019-05-09' ) && '2019-05-01'::timestamptz

我收到错误消息:

SQL Error [42883]: ERROR: operator does not exist: tstzrange && timestamp with time zone
Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.

为什么点与范围没有重叠?
该操作看起来合理

1 个答案:

答案 0 :(得分:2)

  

为什么没有与点重叠的范围?

因为这不是定义“重叠”的方式。如果要测试单个时间戳记值是否落在某个范围内,则需要使用包含运算符@>

SELECT tstzrange( '2019-05-01', '2019-05-09' ) @> '2019-05-01'::timestamptz
相关问题