Constraint not shown on \d ?
От | Gaetano Mendola |
---|---|
Тема | Constraint not shown on \d ? |
Дата | |
Msg-id | c7fo6f$7a3$1@floppy.pyrenet.fr обсуждение исходный текст |
Ответы |
Re: Constraint not shown on \d ?
|
Список | pgsql-hackers |
Hi all, today I was tryng to delete an index but I had the following error: ERROR: cannot drop index activation_code_code_key because constraint activation_code_code_key on table activation_code requires it HINT: You may drop constraint activation_code_code_key on table activation_code instead. however this is what \d show: # \d activation_code Table "public.activation_code" Column | Type | Modifiers --------------------+-----------------------+--------------------------------------------------------------------------------- id_activation_code| integer | not null default nextval('public.activation_code_id_activation_code_seq'::text) code | character varying(64) | not null id_code_pool | integer | not null Indexes: "activation_code_pkey" primary key, btree (id_activation_code) "activation_code_code_key" unique, btree (code,id_code_pool) Check constraints: "activation_code_code" CHECK (char_length(code::text) >= 5) Foreign-key constraints: "$1" FOREIGN KEY (id_code_pool) REFERENCES code_pool(id_code_pool) ON UPDATE CASCADE ON DELETE CASCADE basically what is the difference between: CREATE UNIQUE INDEX "activation_code_code_key" ON "public"."activation_code" USING btree ("code", "id_code_pool"); or ALTER TABLE activation_code ADD UNIQUE ( code, id_code_pool ); with \d command there is no difference but is different because the first command create an index deleteable with a "drop index". Regards Gaetano Mendola
В списке pgsql-hackers по дате отправления: