Ram
Ram

Reputation: 805

gist in exclude constraint in postgres

I created table using exclude constraint.but i do not know the use of gist in exclude constraint?Why we specify the gist keyword in exclude constraint?.Any specify reason for this.

CREATE TABLE Employee_age_Details(
name varchar(50),
age integer,
EXCLUDE USING gist
(age WITH <>));

Upvotes: 0

Views: 594

Answers (1)

jjanes
jjanes

Reputation: 44147

The default index type, Btree, does not offer support for the '<>' operator. The GiST index type (under btree_gist) does. You must use an index type which supports the operator.

If you changed the constraint operator to '=', then you could omit the "gist". But in that case you should just use a unique constraint, as it does the same thing better.

Upvotes: 3

Related Questions