Reputation: 31574
I ran this DDL to add an exclusion constraint to a table:
ALTER TABLE recurring_charges
ADD EXCLUDE USING GIST (period WITH &&);
Now I want to remove the constraint - how do I do that? I tried some variations of ALTER TABLE ... DROP EXCLUDE
and DROP CONSTRAINT
but nothing seems to work.
Upvotes: 3
Views: 792
Reputation: 431
To add to the above answer, to find out the constraint name, you can find it in psql using:
\d+ tableName
Upvotes: 1
Reputation: 31574
Figured it out - looks like it generated a name for the constraint that I have to use.
ALTER TABLE recurring_charges
DROP CONSTRAINT recurring_charges_period_excl;
And now I've updated my original DDL to use the full ADD CONSTRAINT
syntax so that I can name my constraint rather than relying on automatic naming behavior:
ALTER TABLE recurring_charges
ADD CONSTRAINT recurring_charges_period_excl EXCLUDE USING GIST (period WITH &&);
Upvotes: 5