pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Drop column constraint
3+ messages / 3 participants
[nested] [flat]

* Drop column constraint
@ 2020-10-30 15:30 Rich Shepard <rshepard@appl-ecosys.com>
  2020-10-30 15:37 ` Re: Drop column constraint Adrian Klaver <adrian.klaver@aklaver.com>
  2020-10-30 15:38 ` Re: Drop column constraint Chris Sterritt <chris.sterritt@yobota.xyz>
  0 siblings, 2 replies; 3+ messages in thread

From: Rich Shepard @ 2020-10-30 15:30 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

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






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Drop column constraint
  2020-10-30 15:30 Drop column constraint Rich Shepard <rshepard@appl-ecosys.com>
@ 2020-10-30 15:37 ` Adrian Klaver <adrian.klaver@aklaver.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Adrian Klaver @ 2020-10-30 15:37 UTC (permalink / raw)
  To: Rich Shepard <rshepard@appl-ecosys.com>; pgsql-general@lists.postgresql.org

On 10/30/20 8:30 AM, 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;

It should be:

alter table locations drop constraint 'constraint_name';

Where you can find 'constraint_name' from:

\d locations

> 
> 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
> 
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Drop column constraint
  2020-10-30 15:30 Drop column constraint Rich Shepard <rshepard@appl-ecosys.com>
@ 2020-10-30 15:38 ` Chris Sterritt <chris.sterritt@yobota.xyz>
  1 sibling, 0 replies; 3+ messages in thread

From: Chris Sterritt @ 2020-10-30 15:38 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org


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






^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2020-10-30 15:38 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-10-30 15:30 Drop column constraint Rich Shepard <rshepard@appl-ecosys.com>
2020-10-30 15:37 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-10-30 15:38 ` Chris Sterritt <chris.sterritt@yobota.xyz>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox