Skip to content

Instantly share code, notes, and snippets.

@franckverrot
Created July 9, 2015 11:54
Show Gist options
  • Save franckverrot/cbceac4051a0c8938a90 to your computer and use it in GitHub Desktop.
Save franckverrot/cbceac4051a0c8938a90 to your computer and use it in GitHub Desktop.
PostgreSQL OVERLAPS function and infinity timestamps
-- ]-inf;today[ overlaps [today,+inf[
# select ('-infinity'::timestamp, now()) overlaps (now(), 'infinity'::timestamp) ;
overlaps
----------
f
(1 row)
-- ]-inf;tomorrow[ overlaps [today,+inf[
# select ('-infinity'::timestamp, now() + interval '1 day') overlaps (now(), 'infinity'::timestamp) ;
overlaps
----------
t
(1 row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment