Constraint not shown on \d ? - Mailing list pgsql-hackers

From Gaetano Mendola
Subject Constraint not shown on \d ?
Date
Msg-id c7fo6f$7a3$1@floppy.pyrenet.fr
Whole thread Raw
Responses Re: Constraint not shown on \d ?  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
List 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 by date:

Previous
From: Gaetano Mendola
Date:
Subject: Re: psql 7.3.4 disagrees with NATURAL CROSS JOIN
Next
From: "Zeugswetter Andreas SB SD"
Date:
Subject: Re: ALTER TABLE TODO items