1 comment

[ 3.0 ms ] story [ 12.2 ms ] thread
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...