Обсуждение: BUG #14359: serial datatype issue

Поиск
Список
Период
Сортировка

BUG #14359: serial datatype issue

От
debaratis@techmahindra.com
Дата:
VGhlIGZvbGxvd2luZyBidWcgaGFzIGJlZW4gbG9nZ2VkIG9uIHRoZSB3ZWJz
aXRlOgoKQnVnIHJlZmVyZW5jZTogICAgICAxNDM1OQpMb2dnZWQgYnk6ICAg
ICAgICAgIERlYmFyYXRpIFNlbmd1cHRhCkVtYWlsIGFkZHJlc3M6ICAgICAg
ZGViYXJhdGlzQHRlY2htYWhpbmRyYS5jb20KUG9zdGdyZVNRTCB2ZXJzaW9u
OiA5LjQuNQpPcGVyYXRpbmcgc3lzdGVtOiAgIFdpbmRvd3MKRGVzY3JpcHRp
b246ICAgICAgICAKCkkgaGF2ZSBjcmVhdGVkIHRhYmxlcyB3aXRoIHByaW1h
cnkga2V5IGFzIHNlcmlhbCBkYXRhdHlwZSwgd2hpbGUgaW5zZXJ0aW5nCmRh
dGEgdGhyb3VnaCBmdW5jdGlvbnMgYXQgdGltZXMgdGhlIG5leHQgdmFsdWUg
aXMgbm90IGdlbmVyYXRlZCBhbmQgaXQgdHJpZXMKaW5zZXJ0aW5nIGRhdGEg
d2l0aCB0aGUgc2FtZSB2YWx1ZSwgaGVuY2UgY29uZmxpY3RpbmcgYW5kIHJh
aXNpbmcgZXJyb3IKc2F5aW5nIHRoZSB2YWx1ZSBhbHJlYWR5IGV4aXN0cy4g
Cgo=

Re: BUG #14359: serial datatype issue

От
hubert depesz lubaczewski
Дата:
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/