From: | Gaetano Mendola <mendola(at)bigfoot(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Constraint not shown on \d ? |
Date: | 2004-05-07 10:25:07 |
Message-ID: | c7fo6f$7a3$1@floppy.pyrenet.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Zeugswetter Andreas SB SD | 2004-05-07 11:05:07 | Re: ALTER TABLE TODO items |
Previous Message | Gaetano Mendola | 2004-05-07 09:54:38 | Re: psql 7.3.4 disagrees with NATURAL CROSS JOIN |