Re: [GENERAL] How to increment by hand a sequence number.

From: Jeong Jae Ick:정재익: <advance(at)advance(dot)sarang(dot)net>
To: Valerio Santinelli <tanis(at)mediacom(dot)it>
Cc: "pgsql-general(at)postgreSQL(dot)org" <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: [GENERAL] How to increment by hand a sequence number.
Date: 1999-01-18 15:48:52
Message-ID: Pine.LNX.3.96K.990119004143.4903A-100000@advance.sarang.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

It maybe done with next syntax;
drop sequence_name;
create sequence sequence_name start start_no;

But, if you want to increment the sequence_no by one manually, then;
select nextval('sequence_name');

==========ooOO /. .\ OOoo======================================
Dept. of Neurosurgery | http://advance.sarang.net
Masan Military Hospital | http://database.sarang.net
Korea | advance(at)nownuri(dot)net
| advance(at)advance(dot)sarang(dot)net
Hanil-Town 201-2007, Yangduk2-Dong| Phone: +82-551-299-2624
Hwoiwon-Gu, Masan-Si, Kyungnam | O.P. : +82-551-271-2318
============OOo./-\.oOO========================================

On Mon, 18 Jan 1999, Valerio Santinelli wrote:

> I've exported a table from an existing MSAccess database to my
> PostgreSQL db.
> I use a serial ID on the table and now I'm getting errors when I add a
> new entry in the table if i don't specify the ID by hand (which should
> be placed automatically by the db since it's a serial).
>
> The exact error is this one:
>
> Cannot insert a duplicate key into a unique index.
>
>
> I think I should set the "last_value" field in the sequence to my real
> last value aon the ID field of the table, but Idon't know how to do it.
> Is there anybody who can help me ?
>
> Thanks

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Remi Lehn 1999-01-18 15:52:25 Re: [GENERAL] Postgres' DBI(Pg) problems.
Previous Message Valerio Santinelli 1999-01-18 15:31:30 How to increment by hand a sequence number.