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

* Drop a primary
@ 2019-10-02 18:48  Martin Mueller <martinmueller@northwestern.edu>
  0 siblings, 1 reply; 2+ messages in thread

From: Martin Mueller @ 2019-10-02 18:48 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

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.




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

* Re: Drop a primary
@ 2019-10-02 18:52  Ron <ronljohnsonjr@gmail.com>
  parent: Martin Mueller <martinmueller@northwestern.edu>
  0 siblings, 0 replies; 2+ messages in thread

From: Ron @ 2019-10-02 18:52 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

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.

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


end of thread, other threads:[~2019-10-02 18:52 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-10-02 18:48 Drop a primary Martin Mueller <martinmueller@northwestern.edu>
2019-10-02 18:52 ` Ron <ronljohnsonjr@gmail.com>

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