Hacker News new | ask | show | jobs
by nierman 5159 days ago
Using gist indices for exclusion constraints (added in pg 9.0) can be pretty useful also.

The Postgres docs show a simple example that enforces the constraint "no two rows in the table contain overlapping circles" (&& is the overlaps operator for geometric types):

  CREATE TABLE circles (
    c circle,
    EXCLUDE USING gist (c WITH &&)
  );
http://www.postgresql.org/docs/9.1/static/ddl-constraints.ht...