OVERLAPS operator is another useful but rarely used PostgreSQL feature. It checks if two time ranges overlap. For example, this query returns true:

SELECT (DATE '2016-01-10', DATE '2016-02-01') OVERLAPS (DATE '2016-01-20', DATE '2016-02-10');

The endpoints of time ranges can be specified as:

  • either dates (times or timestamps) like in the previous example,
  • or as a date and an interval like in the next example.
SELECT (DATE '2016-01-10', INTERVAL '1 month') OVERLAPS (DATE '2016-01-20', INTERVAL '7 days');

Please note that if the end of the first time range is equal to the beginning of the second time range then the operator returns false.


Learn about another useful PostgreSQL operatorBETWEEN SYMMETRIC.