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

From Christopher Kings-Lynne
Subject Re: Constraint not shown on \d ?
Date
Msg-id 409CCC1D.8070809@familyhealth.com.au
Whole thread Raw
In response to Constraint not shown on \d ?  (Gaetano Mendola <mendola@bigfoot.com>)
Responses Re: Constraint not shown on \d ?  (Gaetano Mendola <mendola@bigfoot.com>)
List pgsql-hackers
> 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".

Yes, you're right.  Basically the only difference is that the latter 
will make it a "constraint" that can only be dropped with DROP CONSTRAINT.

Also, if you wanted to create a unique non-btree index, partial index or 
expressional index, you'd have to use the former syntax

Chris



pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: Re: Aclitem "high level description"
Next
From: Gaetano Mendola
Date:
Subject: email built in type