Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UFo1P-0001py-LZ for pgsql-bugs@arkaria.postgresql.org; Wed, 13 Mar 2013 15:55:19 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UFo1O-0000yg-BX for pgsql-bugs@arkaria.postgresql.org; Wed, 13 Mar 2013 15:55:18 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UFjRE-0007ZM-5e for pgsql-bugs@postgresql.org; Wed, 13 Mar 2013 11:01:40 +0000 Received: from mahout.postgresql.org ([2001:4800:7903:4::123]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UFjRC-0004p2-UV for pgsql-bugs@postgresql.org; Wed, 13 Mar 2013 11:01:39 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UFjRC-0006ve-AW for pgsql-bugs@postgresql.org; Wed, 13 Mar 2013 11:01:38 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1UFjRC-00069s-2F for pgsql-bugs@postgresql.org; Wed, 13 Mar 2013 11:01:38 +0000 Date: Wed, 13 Mar 2013 11:01:38 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #7940: Auto increment issue To: pgsql-bugs@postgresql.org From: krishnakumar.eeee@gmail.com X-Pg-Spam-Score: -3.3 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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:=20=20=20=20=20=20=20=20 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)=3D(1) already exists till upto restored number of entries. ...what is the solution to over come this issue ... MY SCHEMA is=20 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=20 INSERT INTO smsserver_out(id,type,recipient,text,wap_url,wap_expiry_date,wap_signal,cre= ate_date,originator,encoding,status_report,flash_sms,src_port,dst_port,sent= _date,ref_no,priority,status,errors,gateway_id) --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs