Add quto increment to existing column

From: Robert Buckley <robertdbuckley(at)yahoo(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Add quto increment to existing column
Date: 2011-10-04 06:14:01
Message-ID: 1317708841.25240.YahooMailNeo@web24103.mail.ird.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I have a column in a table called hist_id with the datatype "integer". When I created the table I assigned this column the primary key constraint but didn´t make it an auto-increment column.

How could I do this to an the already existing column?

I have created the sequence with the following command but don´t know how to change the existing column to auto-increment.

$ create sequence hist_id_seq;

thanks for any help,

Rob

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Fujii Masao 2011-10-04 07:11:44 Re: How to avoid TimeLine increase / Change on recovery?
Previous Message Venkat Balaji 2011-10-04 05:08:51 Re: : PostgreSQL Online Backup