I currently trying to understand why the @>
gives me false when I evaluate this query
select tsrange('1990-01-01 01:00:00','infinity') @> tsrange('1990-01-01 00:00:00','2001-10-01 00:00:00')
https://dbfiddle.uk/?rdbms=postgres_12&fiddle=f2e5b7e2b24ea8c0bda74f7cdae1c3d4
As I understand the operator from https://www.postgresql.org/docs/current/functions-range.html
It should answer whether the
Does the first range contain the second?
In which case I would mean yes?
It seems to work in when I change the lower limit, but why should I change that? it should still contain the second? or am I missing something
Result is correct it must be false
. Range Right operand is starting at 1990-01-01 00:00:00
but Left Operand is starting at 1990-01-01 01:00:00
which is one hour after the left operand. That's why it is returning false
. with @>
operator range of right operand must be with in the range of left operand.(both boundaries are included)
if you compare like below it will return true
select tsrange('1990-01-01 00:00:00','infinity') @> tsrange('1990-01-01 00:00:00','2001-10-01 00:00:00')