Re: this is postgresql question..how do i drop unique constraint on a column?

From: Jan Ploski <jpljpl(at)gmx(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: this is postgresql question..how do i drop unique constraint on a column?
Date: 2002-09-09 14:48:46
Message-ID: 13799530.1031582926251.JavaMail.jpl@remotejava
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mario Weilguni 2002-09-09 14:49:55 Re: SQL: how to find if a table exists?
Previous Message Bruno Wolff III 2002-09-09 14:47:03 Re: Literal dash in regular expression brackets