sqlpostgresqlconstraintsadminer

Postgresql 11.3 delete constraint by adminer


I'm hurting my head through a wall.

I'm trying to remove a UNIQUE constraint for my table, using Adminer GUI.

When i'm looking the structure of my table :

Indexes:
UNIQUE  | fk_bank, type
UNIQUE  | fk_bank, url_id, type
PRIMARY | rowid

I click on "Alter indexes", this give me this page (image) I tried to delete the first constraint :

ALTER TABLE "llx_bank_url"
DROP CONSTRAINT "idx_16584_uk_bank_url";

RESULT : 
ERROR: constraint "idx_16584_uk_bank_url" of relation "llx_bank_url" does not exist 

How can it show this constraint if it doesn't exist?

Constraint doesn't appear in "table_constraints" :

SELECT * FROM "table_constraints" WHERE table_name = 'llx_bank_url';

RESULT :
constraint_catalog  constraint_schema   constraint_name         table_catalog   table_schema    table_name      constraint_type     is_deferrable   initially_deferred  enforced
dolibarr            public              idx_16584_primary       dolibarr        public          llx_bank_url    PRIMARY KEY         NO              NO                  YES
dolibarr            public              2200_16584_1_not_null   dolibarr        public          llx_bank_url    CHECK               NO              NO                  YES
dolibarr            public              2200_16584_6_not_null   dolibarr        public          llx_bank_url    CHECK               NO              NO                  YES

And of course :

ALTER TABLE "llx_bank_url"
  ADD CONSTRAINT idx_16584_uk_bank_url UNIQUE(fk_bank, type)

Error in query (7): ERROR: relation "idx_16584_uk_bank_url" already exists 

How do i delete this constraint?


Solution

  • It looks like you have a unique index, not a unique constraint. So, use drop index:

    DROP INDEX idx_16584_uk_bank_url;