Re: this is postgresql question..how do i drop unique constraint on a column? - Mailing list pgsql-general

From Jan Ploski
Subject Re: this is postgresql question..how do i drop unique constraint on a column?
Date
Msg-id 13799530.1031582926251.JavaMail.jpl@remotejava
Whole thread Raw
In response to this is postgresql question..how do i drop unique constraint on a column?  (Eugene Kim <Eugene_Kim@baylor.edu>)
Responses Re: this is postgresql question..how do i drop unique constraint on a column?
List pgsql-general
On Fri, Sep 06, 2002 at 03:12:09AM +0000, Eugene Kim wrote:
> content in content table has unique constraint..(although i can't see it
> with \d content)
>
> how can i drop that constraint?

Eugene,

first, you need to figure out the constraint's name:

select c.relname from pg_class c, pg_index i where
    i.indrelid=(select oid from pg_class where relname='content') and
    c.oid=i.indexrelid and i.indisunique='t';

Then use "drop index <name>" to drop it.

For more info about accessing database metadata, see Developer's Guide,
chapter "System Catalogs".

-JPL


pgsql-general by date:

Previous
From: "Mario Weilguni"
Date:
Subject: Re: SQL: how to find if a table exists?
Next
From: Darren Ferguson
Date:
Subject: Re: Debugging plpgsql functions