Re: BUG #14359: serial datatype issue - Mailing list pgsql-bugs

From hubert depesz lubaczewski
Subject Re: BUG #14359: serial datatype issue
Date
Msg-id 20161007120953.655cxzfdmdamasr7@depesz.com
Whole thread Raw
In response to BUG #14359: serial datatype issue  (debaratis@techmahindra.com)
List pgsql-bugs
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/

pgsql-bugs by date:

Previous
From: "Zuk, Kacper"
Date:
Subject: Re: BUG #14329: libpq doesn't send complete client certificate chain on first SSL connection
Next
From: hubert depesz lubaczewski
Date:
Subject: Re: Rows go missing when selecting "for update" after savepoint "play"