Re: STARTING SERIAL / BIGSERIAL FIELDS FROM 1.

From: Lacey Powers <lacey(dot)powers(at)commandprompt(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: STARTING SERIAL / BIGSERIAL FIELDS FROM 1.
Date: 2009-07-21 04:37:18
Message-ID: 4A6545FE.3060104@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hello Jorge,

An even easier way to accomplish this would be to use the following:

ALTER SEQUENCE <sequence_name> RESTART WITH 1;

As shown in the documentation, here:

http://www.postgresql.org/docs/8.3/interactive/sql-altersequence.html

Hope that helps. =)

Sincerely,

Lacey
> How can a serial or bigserial field start from 1 again?
> I need to manually remove all the records from a table and I need
> these kind of fields to start from 1 once again.
>
> With respect,
> Jorge Maldonado

--
Lacey Powers

The PostgreSQL Company - Command Prompt, Inc. 1.503.667.4564 ext 104
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message tgs 2009-07-21 07:30:47 Re: trouble connecting to DB
Previous Message Mike 2009-07-20 20:45:31 Re: How to insert data from a text file