From: krishnakumar.eeee@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #7940: Auto increment issue
Date: Wed, 13 Mar 2013 11:01:38 +0000
Message-ID: <E1UFjRC-00069s-2F@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 7940
Logged by: krishna
Email address: krishnakumar.eeee@gmail.com
PostgreSQL version: 9.0.1
Operating system: Ubuntu
Description:
Hi,
I'm using PostgreSQL 9.0.1 and driver PostgreSQL 9.0 JDBC4 and my OS
is Ubuntu.I'm using serial type for auto-incrementing column id in my table
everything works fine .when i stop my application and restart the
application its fine but when i backup DB and then restore it back manually
i'm inserting id column by myself during restoring...after restore If i
start the application, the id column doesn't start incrementing from maximum
value of id instead starts from begining (i.e., 1) and getting duplicate key
value violates unique constraint "smsserver_out_pkey" Detail: Key (id)=(1)
already exists till upto restored number of entries. ...what is the solution
to over come this issue ...
MY SCHEMA is
create table smsserver_out
(
id serial NOT NULL,
type varchar(1) NOT NULL,
recipient varchar(16) NOT NULL,
text text NOT NULL,
wap_url text NOT NULL,
wap_expiry_date varchar(50),
wap_signal varchar(1),
create_date varchar(50) NOT NULL,
originator varchar(16) NOT NULL,
encoding varchar(1) NOT NULL,
status_report integer NOT NULL,
flash_sms integer NOT NULL,
src_port integer NOT NULL,
dst_port integer NOT NULL,
sent_date varchar(50),
ref_no varchar(64),
priority integer NOT NULL,
status varchar(1) NOT NULL,
errors integer NOT NULL,
gateway_id varchar(64) NOT NULL,
PRIMARY KEY (id )
)
My Insert Query for restoring the database
INSERT INTO
smsserver_out(id,type,recipient,text,wap_url,wap_expiry_date,wap_signal,create_date,originator,encoding,status_report,flash_sms,src_port,dst_port,sent_date,ref_no,priority,status,errors,gateway_id)
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: krishnakumar.eeee@gmail.com
Subject: Re: BUG #7940: Auto increment issue
In-Reply-To: <E1UFjRC-00069s-2F@wrigleys.postgresql.org>
References: <E1UFjRC-00069s-2F@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox