Re: [PERFORM] Auto generate number in Postgres-9.1.
От | Josh Berkus |
---|---|
Тема | Re: [PERFORM] Auto generate number in Postgres-9.1. |
Дата | |
Msg-id | 97da050c-395c-7205-c5e9-95e7fdf13fde@berkus.org обсуждение исходный текст |
Ответ на | [PERFORM] Auto generate number in Postgres-9.1. (Dinesh Chandra 12108 <Dinesh.Chandra@cyient.com>) |
Ответы |
Re: [PERFORM] Auto generate number in Postgres-9.1.
Re: [PERFORM] Auto generate number in Postgres-9.1. |
Список | pgsql-performance |
Dinesh, > 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. https://www.postgresql.org/docs/9.6/static/sql-createsequence.html also SERIAL on this page: https://www.postgresql.org/docs/9.6/static/datatype-numeric.html > > If I truncate the same table and then again insert rows should start > with 1 in “ID” column. That's not how it works, normally. I'd suggest adding an ON TRUNCATE trigger to the table. -- Josh Berkus Containers & Databases Oh My!
В списке pgsql-performance по дате отправления: