Re: STARTING SERIAL / BIGSERIAL FIELDS FROM 1. - Mailing list pgsql-novice

From Lacey Powers
Subject Re: STARTING SERIAL / BIGSERIAL FIELDS FROM 1.
Date
Msg-id 4A6545FE.3060104@commandprompt.com
Whole thread Raw
In response to STARTING SERIAL / BIGSERIAL FIELDS FROM 1.  (JORGE MALDONADO <jorgemal1960@gmail.com>)
Responses Re: STARTING SERIAL / BIGSERIAL FIELDS FROM 1.  (Michael Wood <esiotrot@gmail.com>)
List 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


pgsql-novice by date:

Previous
From: "tgs"
Date:
Subject: Re: trouble connecting to DB
Next
From: Lacey Powers
Date:
Subject: Re: trouble connecting to DB