Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bsTyS-0005my-28 for pgsql-bugs@arkaria.postgresql.org; Fri, 07 Oct 2016 12:10:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bsTyR-0000ya-5a for pgsql-bugs@arkaria.postgresql.org; Fri, 07 Oct 2016 12:09:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bsTyQ-0000yJ-Ge for pgsql-bugs@postgresql.org; Fri, 07 Oct 2016 12:09:58 +0000 Received: from andy.depesz.com ([88.198.47.100] helo=depesz.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bsTyN-00060O-A2 for pgsql-bugs@postgresql.org; Fri, 07 Oct 2016 12:09:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20140207; h=In-Reply-To:Content-Type:MIME-Version:References:Reply-To: Message-ID:Subject:Cc:To:Sender:From:Date:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=VxaN+oMOK1G2vfjg1dh83cWBZ9wYfd8yoQLktfqBnNE=; b=N2ny7poH6Fa7KyKsh0Dubtn1TY 3kqS+dhflekGSMSW0sbzfjwSwzpPRScqvz7XkEdytM15WxWNzbj32wxxiwmXO4v/QzobmscNMWVSd cV6I5euCWev6NOK0c/F3UIYg9; Received: from andy.depesz.com ([88.198.47.100] helo=depesz.com) by depesz.com with esmtpa (Exim 4.87) (envelope-from ) id 1bsTyL-000493-JY; Fri, 07 Oct 2016 14:09:53 +0200 Date: Fri, 7 Oct 2016 14:09:53 +0200 From: hubert depesz lubaczewski To: debaratis@techmahindra.com Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #14359: serial datatype issue Message-ID: <20161007120953.655cxzfdmdamasr7@depesz.com> Reply-To: depesz@depesz.com References: <20161007085101.1412.11450@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20161007085101.1412.11450@wrigleys.postgresql.org> User-Agent: NeoMutt/20160916 (1.7.0) X-Pg-Spam-Score: -4.7 (----) 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 On Fri, Oct 07, 2016 at 08:51:01AM +0000, debaratis@techmahindra.com wrote: > I have created tables with primary key as serial datatype, while inserting > data through functions at times the next value is not generated and it tries > inserting data with the same value, hence conflicting and raising error > saying the value already exists. it means that something in your database is inserting data to table with specifying explicit value, like: insert into table (id, a, b, c) values (123, 'a', 'b', 'c'); and does not rely on sequence. if nextval() is not called (and it's not if you provide value for id column in insert) then sequence doesn't increment, and you'll get errors. Find what issues these bad inserts, and fix it. Best regards, depesz -- The best thing about modern society is how easy it is to avoid contact with it. http://depesz.com/ -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs