Re: [NOVICE] alter existing table column with primary key to auto-increment - Mailing list pgsql-novice

From Rounak Jain
Subject Re: [NOVICE] alter existing table column with primary key to auto-increment
Date
Msg-id CANNuxWN4eLxuO10tA60e6ynra8o+Xz1fpNVXySzRhNdE6KpyFw@mail.gmail.com
Whole thread Raw
In response to Re: [NOVICE] alter existing table column with primary key to auto-increment  (Rounak Jain <rounakjainis@gmail.com>)
List pgsql-novice
yes, thanks for the help, martin.
create sequence product_id_seq;
alter table product alter column id set default nextval('product_id_seq');
alter sequence product_id_seq owned by product.id;

On Fri, Feb 17, 2017 at 9:17 PM, Martin Steer <martinsteer@maxi.net.au> wrote:
On Sun, Feb 05, 2017 at 04:27:44PM +0530, Rounak Jain wrote:
alter table customer add column id serial primary key;
I want to know how to alter the column instead of dropping it.

Consult the online help:

\h alter

\h alter table

\h alter sequence

M.


pgsql-novice by date:

Previous
From: neha khatri
Date:
Subject: Re: [NOVICE] Regression test : pg_conversion validation
Next
From: KARIN SUSANNE HILBERT
Date:
Subject: [NOVICE] Create PostgreSQL Database with ENCODING 'WIN1252' onCluster Initialized with locale "en_US.UTF-8"?