Express a predicate DATE >= X and DATE < Y in form of DATE in [X,Y)



  • As per this paper:

    enter image description here

    I can express an upper and lower bound as a single predicate.

    • How can I do it in PostgreSQL?


  • Use a https://www.postgresql.org/docs/current/rangetypes.html

    daterange(x, y, '[)') @> the_date
    

    The @> operator tests if the value on the right hand side is contained in the range on the left hand side


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2