pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Drop a primary
Date: Wed, 2 Oct 2019 13:52:54 -0500
Message-ID: <f045cc6f-b553-a7e0-9b7f-989523d8a4ea@gmail.com> (raw)
In-Reply-To: <566B8778-F815-4562-A325-B40952EF7494@northwestern.edu>
References: <566B8778-F815-4562-A325-B40952EF7494@northwestern.edu>

On 10/2/19 1:48 PM, Martin Mueller wrote:
>
> I created a primary key with the following commands
>
> Add id serial
>
> Add primary key (id)
>
> I cannot figure out from the documentation how to drop that column.
>

Drop it just like you added it:

test=# alter table foobar add id serial;
ALTER TABLE
test=# alter table foobar add primary key(id);
ALTER TABLE
test=# alter table foobar drop id;
ALTER TABLE


-- 
Angular momentum makes the world go 'round.

view thread (2+ messages)

Message-ID: <f045cc6f-b553-a7e0-9b7f-989523d8a4ea@gmail.com>
Permalink:  ../f045cc6f-b553-a7e0-9b7f-989523d8a4ea@gmail.com/
Also on:    postgresql.org/message-id/f045cc6f-b553-a7e0-9b7f-989523d8a4ea@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ronljohnsonjr@gmail.com
  Subject: Re: Drop a primary
  In-Reply-To: <f045cc6f-b553-a7e0-9b7f-989523d8a4ea@gmail.com>
  References: <566B8778-F815-4562-A325-B40952EF7494@northwestern.edu> <f045cc6f-b553-a7e0-9b7f-989523d8a4ea@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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