Re: BUG #14359: serial datatype issue

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: debaratis(at)techmahindra(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14359: serial datatype issue
Date: 2016-10-07 12:09:53
Message-ID: 20161007120953.655cxzfdmdamasr7@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Oct 07, 2016 at 08:51:01AM +0000, debaratis(at)techmahindra(dot)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/

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message hubert depesz lubaczewski 2016-10-07 12:10:51 Re: Rows go missing when selecting "for update" after savepoint "play"
Previous Message Marco Colombo 2016-10-07 11:39:06 Re: BUG #14351: Upsert not working in case of partitioned tables