How is it possible that when I try to add a unique constraint named "serveurs_domain" it says I can't because the constraint already exists. BUT, when I try to drop the constraint "serveurs_abbr" it says it doesn't exist.
I'm confused ???
ALTER TABLE serveurs
DROP CONSTRAINT serveurs_domain;
ERROR: constraint « serveurs_domain » of relation « serveurs » does not exist
ALTER TABLE serveurs
ADD CONSTRAINT serveurs_domain UNIQUE (domain);
ERROR: constraint « serveurs_domain » already exists
select version();
PostgreSQL 13.8 (Debian 13.8-0+deb11u1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
I found the solution.
I should use DROP INDEX serveurs_domain;
instead of ALTER TABLE ...