Is it possible to match overlapping datarange (datatype: daterange) values?
E.g. two tables containing daterange columns, one daterange column (table1.c1) has daterange values which encompass a 1-year period and the other daterange column (table2.c2) has daterange values which encompass 20-year periods.
How can I match the rows from table1 where the daterange of 'c1' overlaps with the daterange of 'c2' in table2?
I have tried using the OVERLAPS function but that led to a syntax error.
I'm using PostgreSQL 9.3.
There is no
OVERLAPS
operator in PostgreSQL.I have no idea where you got that from. Are you really using PostgreSQL, or some third party fork? Are you reading the PostgreSQL documentation, or some tutorial/docs for some other database product?
I think you want what the PostgreSQL user manual recommends, the
&&
operator: