简体   繁体   中英

Operator does not exist: tstzrange && timestamp with time zone

Running:

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

I get error message:

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.

Why there is no range overlap with a point?
This operation looks reasonable

Why there is no range overlap with a point?

Because this is not how "overlaps" is defined. If you want to test if a single timestamp value falls into a range, you need to use the contains operator @>

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

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM