Re: Drop column constraint

From: Chris Sterritt <chris(dot)sterritt(at)yobota(dot)xyz>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Drop column constraint
Date: 2020-10-30 15:38:43
Message-ID: 01fb91c7-346f-a0ad-7d3b-9ccbde3aa56c@yobota.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On 30/10/2020 15:30, Rich Shepard wrote:
> A table has a unique constraint on a column that needs removing.
> Reading the
> postgres-12.x docs for alter table it appears the correct syntax is:
>
> alter table locations drop constraint unique;
>
> but this is wrong.
>
> Trying 'alter table locations alter column loc_nbr drop constraint
> unique;' also
> failed.
>
> What's the proper syntax to drop the unique constraint on a table column?
>
> TIA,
>
> Rich
>
>
>
You need

alter table locations drop constraint <constraint name>;

Cheers, Chris Sterritt

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2020-10-30 15:54:57 Re: Drop column constraint [FIXED]
Previous Message Adrian Klaver 2020-10-30 15:37:27 Re: Drop column constraint