SQL CHECK constraint to prevent date overlap
- by Michael
I have a table that describes which software versions were installed on a machine at various times:
machine_id::integer, version::text, datefrom::timestamp, dateto::timestamp
I'd like to do a constraint to ensure that no date ranges overlap, i.e. it is not possible to have multiple software versions installed on a machine at the same time.
How can this be achieved in SQL? I am using PostgreSQL v8.4.