Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 1st, 2012  |  syntax: SQL  |  size: 0.31 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. CHECK ( from_ts < to_ts ),
  2. CONSTRAINT overlapping_times EXCLUDE USING GIST (
  3.   box(
  4.     point( EXTRACT(epoch FROM from_ts at TIME zone 'UTC'), EXTRACT(epoch FROM from_ts at TIME zone 'UTC') ),
  5.     point( EXTRACT(epoch FROM to_ts at TIME zone 'UTC') , EXTRACT(epoch FROM to_ts at TIME zone 'UTC') )
  6.   ) WITH &&
  7. )