Auto generate number in Postgres-9.1.

From: Dinesh Chandra 12108 <Dinesh(dot)Chandra(at)cyient(dot)com>
To: "pgsql-performance-owner(at)postgresql(dot)org" <pgsql-performance-owner(at)postgresql(dot)org>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Auto generate number in Postgres-9.1.
Date: 2017-03-20 13:38:40
Message-ID: ab77f3e1c16540a09002740e283529c5@cyient.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Dear expert,

I have to add one column "ID" in postgres table which will generate Auto Increment<http://www.davidghedini.com/pg/entry/postgresql_auto_increment>ed number .

Example:
Suppose I have five records and if I insert 1 new record It should auto generate 6.
If I truncate the same table and then again insert rows should start with 1 in "ID" column.

Regards,
Dinesh Chandra
|Database administrator (Oracle/PostgreSQL)| Cyient Ltd. Noida.

________________________________

DISCLAIMER:

This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. Check all attachments for viruses before opening them. All views or opinions presented in this e-mail are those of the author and may not reflect the opinion of Cyient or those of our affiliates.

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Josh Berkus 2017-03-20 13:43:11 Re: Auto generate number in Postgres-9.1.
Previous Message Jeff Janes 2017-03-08 18:00:47 Re: Please help with a slow query: there are millions of records, what can we do?